summaryrefslogtreecommitdiffstats
path: root/arch/arm/kernel/oldlatches.c
blob: 3d6758ff45f75164074e9beafdc96b3af9d86ebb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/* Support for the latches on the old Archimedes which control the floppy,
 * hard disc and printer
 *
 * (c) David Alan Gilbert 1995/1996
 */
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>

#include <asm/io.h>
#include <asm/hardware.h>

static unsigned char latch_a_copy;
static unsigned char latch_b_copy;

/* newval=(oldval & ~mask)|newdata */
void oldlatch_aupdate(unsigned char mask,unsigned char newdata)
{
	if (machine_is_arc()) {
		latch_a_copy = (latch_a_copy & ~mask) | newdata;

		printk("Latch: A = 0x%02x\n", latch_a_copy);

		outb(latch_a_copy, LATCHAADDR);
	} else
		BUG();
}


/* newval=(oldval & ~mask)|newdata */
void oldlatch_bupdate(unsigned char mask,unsigned char newdata)
{
	if (machine_is_arc()) {
		latch_b_copy = (latch_b_copy & ~mask) | newdata;

		printk("Latch: B = 0x%02x\n", latch_b_copy);

		outb(latch_b_copy, LATCHBADDR);
	} else
		BUG();
}

static void __init oldlatch_init(void)
{
	if (machine_is_arc()) {
		oldlatch_aupdate(0xff, 0xff);
		/* Thats no FDC reset...*/
		oldlatch_bupdate(0xff, LATCHB_FDCRESET);
	}
}

initcall(oldlatch_init);

EXPORT_SYMBOL(oldlatch_aupdate);
EXPORT_SYMBOL(oldlatch_bupdate);