2 * linux/arch/arm/kernel/oldlatches.c
4 * Copyright (C) David Alan Gilbert 1995/1996,2000
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
10 * Support for the latches on the old Archimedes which control the floppy,
11 * hard disc and printer
13 #include <linux/module.h>
14 #include <linux/kernel.h>
15 #include <linux/init.h>
18 #include <asm/hardware.h>
19 #include <asm/mach-types.h>
20 #include <asm/arch/oldlatches.h>
22 static unsigned char latch_a_copy
;
23 static unsigned char latch_b_copy
;
25 /* newval=(oldval & ~mask)|newdata */
26 void oldlatch_aupdate(unsigned char mask
,unsigned char newdata
)
28 if (machine_is_archimedes()) {
31 local_save_flags(flags
);
32 latch_a_copy
= (latch_a_copy
& ~mask
) | newdata
;
33 __raw_writeb(latch_a_copy
, LATCHA_BASE
);
34 local_restore_flags(flags
);
36 printk("Latch: A = 0x%02x\n", latch_a_copy
);
42 /* newval=(oldval & ~mask)|newdata */
43 void oldlatch_bupdate(unsigned char mask
,unsigned char newdata
)
45 if (machine_is_archimedes()) {
48 local_save_flags(flags
);
49 latch_b_copy
= (latch_b_copy
& ~mask
) | newdata
;
50 __raw_writeb(latch_b_copy
, LATCHB_BASE
);
51 local_restore_flags(flags
);
53 printk("Latch: B = 0x%02x\n", latch_b_copy
);
58 static int __init
oldlatch_init(void)
60 if (machine_is_archimedes()) {
61 oldlatch_aupdate(0xff, 0xff);
62 /* Thats no FDC reset...*/
63 oldlatch_bupdate(0xff, LATCHB_FDCRESET
);
68 __initcall(oldlatch_init
);
70 EXPORT_SYMBOL(oldlatch_aupdate
);
71 EXPORT_SYMBOL(oldlatch_bupdate
);