2 File: include/asm-arm/sl811-hw.h
5 Use Kernel 2.4.20 and this source from 2.4.22
6 Splitt hardware depens into file sl811-x86.h and sl811-arm.h.
10 Move Hardware depend header sl811-arm.h into include/asm-arm/sl811-hw.h.
14 Use Offset from ADDR to DATA instand of direct io.
17 Low level only for port io into hardware-include.
20 #ifndef __LINUX_SL811_HW_H
21 #define __LINUX_SL811_HW_H
23 #define MAX_CONTROLERS 1 /* Max number of sl811 controllers */
24 /* Always 1 for this architecture! */
26 #define SIZEOF_IO_REGION 1 /* Size for request/release region */
28 #define OFFSET_DATA_REG data_off /* Offset from ADDR_IO to DATA_IO (future) */
29 /* Can change by arg */
31 static int io = 0xf100000e; /* Base addr_io */
32 static int data_off = 1; /* Offset from addr_io to addr_io */
33 static int irq = 44; /* also change gprd !!! */
34 static int gprd = 23; /* also change irq !!! */
37 MODULE_PARM_DESC(io,"sl811 address io port 0xf100000e");
38 MODULE_PARM(data_off,"i");
39 MODULE_PARM_DESC(data_off,"sl811 data io port offset from address port (default 1)");
41 MODULE_PARM_DESC(irq,"sl811 irq 44(default)");
42 MODULE_PARM(gprd,"i");
43 MODULE_PARM_DESC(gprd,"sl811 GPRD port 23(default)");
46 * Low level: Read from Data port [arm]
48 static __u8 inline sl811_read_data (struct sl811_hc *hc)
51 data = readb(hc->data_io);
57 * Low level: Write to index register [arm]
59 static void inline sl811_write_index (struct sl811_hc *hc, __u8 index)
61 writeb(index, hc->addr_io);
66 * Low level: Write to Data port [arm]
68 static void inline sl811_write_data (struct sl811_hc *hc, __u8 data)
70 writeb(data, hc->data_io);
75 * Low level: Write to index register and data port [arm]
77 static void inline sl811_write_index_data (struct sl811_hc *hc, __u8 index, __u8 data)
79 writeb(index, hc->addr_io);
80 writeb(data, hc->data_io);
86 * This function is board specific. It sets up the interrupt to
87 * be an edge trigger and trigger on the rising edge
89 static void inline sl811_init_irq(void)
92 set_GPIO_IRQ_edge(1<<gprd, GPIO_RISING_EDGE);
95 /*****************************************************************
97 * Function Name: release_regions [arm]
99 * This function is board specific. It release all io address
100 * from memory (if can).
102 * Input: struct sl811_hc * *
104 * Return value : 0 = OK
106 *****************************************************************/
107 static void inline sl811_release_regions(struct sl811_hc *hc)
110 release_region(hc->addr_io, SIZEOF_IO_REGION);
114 release_region(hc->data_io, SIZEOF_IO_REGION);
118 /*****************************************************************
120 * Function Name: request_regions [arm]
122 * This function is board specific. It request all io address and
123 * maps into memory (if can).
125 * Input: struct sl811_hc *
127 * Return value : 0 = OK
129 *****************************************************************/
130 static int inline sl811_request_regions (struct sl811_hc *hc, int addr_io, int data_io, const char *name)
132 if (!request_region(addr_io, SIZEOF_IO_REGION, name)) {
133 PDEBUG(3, "request address %d failed", addr_io);
136 hc->addr_io = addr_io;
138 if (!request_region(data_io, SIZEOF_IO_REGION, MODNAME)) {
139 PDEBUG(3, "request address %d failed", data_io);
140 /* release_region(hc->addr_io, SIZEOF_IO_REGION); */
143 hc->data_io = data_io;
148 #endif // __LINUX_SL811_HW_H