MOXA linux-2.6.x / linux-2.6.9-uc0 from sdlinux-moxaart.tgz
[linux-2.6.9-moxart.git] / include / asm-arm / hardware / locomo.h
blob98d6da2dc424f8747315093f075820496fef8d51
1 /*
2 * linux/include/asm-arm/hardware/locomo.h
4 * This file contains the definitions for the LoCoMo G/A Chip
6 * (C) Copyright 2004 John Lenz
8 * May be copied or modified under the terms of the GNU General Public
9 * License. See linux/COPYING for more information.
11 * Based on sa1111.h
13 #ifndef _ASM_ARCH_LOCOMO
14 #define _ASM_ARCH_LOCOMO
16 #define locomo_writel(val,addr) ({ *(volatile u16 *)(addr) = (val); })
17 #define locomo_readl(addr) (*(volatile u16 *)(addr))
19 /* LOCOMO version */
20 #define LOCOMO_VER 0x00
22 /* Pin status */
23 #define LOCOMO_ST 0x04
25 /* Pin status */
26 #define LOCOMO_C32K 0x08
28 /* Interrupt controller */
29 #define LOCOMO_ICR 0x0C
31 /* MCS decoder for boot selecting */
32 #define LOCOMO_MCSX0 0x10
33 #define LOCOMO_MCSX1 0x14
34 #define LOCOMO_MCSX2 0x18
35 #define LOCOMO_MCSX3 0x1c
37 /* Touch panel controller */
38 #define LOCOMO_ASD 0x20 /* AD start delay */
39 #define LOCOMO_HSD 0x28 /* HSYS delay */
40 #define LOCOMO_HSC 0x2c /* HSYS period */
41 #define LOCOMO_TADC 0x30 /* tablet ADC clock */
43 /* TFT signal */
44 #define LOCOMO_TC 0x38 /* TFT control signal */
45 #define LOCOMO_CPSD 0x3c /* CPS delay */
47 /* Key controller */
48 #define LOCOMO_KIB 0x40 /* KIB level */
49 #define LOCOMO_KSC 0x44 /* KSTRB control */
50 #define LOCOMO_KCMD 0x48 /* KSTRB command */
51 #define LOCOMO_KIC 0x4c /* Key interrupt */
53 /* Audio clock */
54 #define LOCOMO_ACC 0x54
56 /* SPI interface */
57 #define LOCOMO_SPIMD 0x60 /* SPI mode setting */
58 #define LOCOMO_SPICT 0x64 /* SPI mode control */
59 #define LOCOMO_SPIST 0x68 /* SPI status */
60 #define LOCOMO_SPIIS 0x70 /* SPI interrupt status */
61 #define LOCOMO_SPIWE 0x74 /* SPI interrupt status write enable */
62 #define LOCOMO_SPIIE 0x78 /* SPI interrupt enable */
63 #define LOCOMO_SPIIR 0x7c /* SPI interrupt request */
64 #define LOCOMO_SPITD 0x80 /* SPI transfer data write */
65 #define LOCOMO_SPIRD 0x84 /* SPI receive data read */
66 #define LOCOMO_SPITS 0x88 /* SPI transfer data shift */
67 #define LOCOMO_SPIRS 0x8C /* SPI receive data shift */
69 #define LOCOMO_SPI_TEND (1 << 3) /* Transfer end bit */
70 #define LOCOMO_SPI_OVRN (1 << 2) /* Over Run bit */
71 #define LOCOMO_SPI_RFW (1 << 1) /* write buffer bit */
72 #define LOCOMO_SPI_RFR (1) /* read buffer bit */
74 /* GPIO */
75 #define LOCOMO_GPD 0x90 /* GPIO direction */
76 #define LOCOMO_GPE 0x94 /* GPIO input enable */
77 #define LOCOMO_GPL 0x98 /* GPIO level */
78 #define LOCOMO_GPO 0x9c /* GPIO out data setteing */
79 #define LOCOMO_GRIE 0xa0 /* GPIO rise detection */
80 #define LOCOMO_GFIE 0xa4 /* GPIO fall detection */
81 #define LOCOMO_GIS 0xa8 /* GPIO edge detection status */
82 #define LOCOMO_GWE 0xac /* GPIO status write enable */
83 #define LOCOMO_GIE 0xb0 /* GPIO interrupt enable */
84 #define LOCOMO_GIR 0xb4 /* GPIO interrupt request */
86 #define LOCOMO_GPIO0 (1<<0)
87 #define LOCOMO_GPIO1 (1<<1)
88 #define LOCOMO_GPIO2 (1<<2)
89 #define LOCOMO_GPIO3 (1<<3)
90 #define LOCOMO_GPIO4 (1<<4)
91 #define LOCOMO_GPIO5 (1<<5)
92 #define LOCOMO_GPIO6 (1<<6)
93 #define LOCOMO_GPIO7 (1<<7)
94 #define LOCOMO_GPIO8 (1<<8)
95 #define LOCOMO_GPIO9 (1<<9)
96 #define LOCOMO_GPIO10 (1<<10)
97 #define LOCOMO_GPIO11 (1<<11)
98 #define LOCOMO_GPIO12 (1<<12)
99 #define LOCOMO_GPIO13 (1<<13)
100 #define LOCOMO_GPIO14 (1<<14)
101 #define LOCOMO_GPIO15 (1<<15)
103 /* Front light adjustment controller */
104 #define LOCOMO_ALS 0xc8 /* Adjust light cycle */
105 #define LOCOMO_ALD 0xcc /* Adjust light duty */
107 /* PCM audio interface */
108 #define LOCOMO_PAIF 0xd0
110 /* Long time timer */
111 #define LOCOMO_LTC 0xd8 /* LTC interrupt setting */
112 #define LOCOMO_LTINT 0xdc /* LTC interrupt */
114 /* DAC control signal for LCD (COMADJ ) */
115 #define LOCOMO_DAC 0xe0
117 /* DAC control */
118 #define LOCOMO_DAC_SCLOEB 0x08 /* SCL pin output data */
119 #define LOCOMO_DAC_TEST 0x04 /* Test bit */
120 #define LOCOMO_DAC_SDA 0x02 /* SDA pin level (read-only) */
121 #define LOCOMO_DAC_SDAOEB 0x01 /* SDA pin output data */
123 /* LED controller */
124 #define LOCOMO_LPT0 0xe8 /* LEDPWM0 timer */
125 #define LOCOMO_LPT1 0xec /* LEDPWM1 timer */
127 #define LOCOMO_LPT_TOFH 0x80 /* */
128 #define LOCOMO_LPT_TOFL 0x08 /* */
129 #define LOCOMO_LPT_TOH(TOH) ((TOH & 0x7) << 4) /* */
130 #define LOCOMO_LPT_TOL(TOL) ((TOL & 0x7)) /* */
132 /* Audio clock */
133 #define LOCOMO_ACC_XON 0x80 /* */
134 #define LOCOMO_ACC_XEN 0x40 /* */
135 #define LOCOMO_ACC_XSEL0 0x00 /* */
136 #define LOCOMO_ACC_XSEL1 0x20 /* */
137 #define LOCOMO_ACC_MCLKEN 0x10 /* */
138 #define LOCOMO_ACC_64FSEN 0x08 /* */
139 #define LOCOMO_ACC_CLKSEL000 0x00 /* mclk 2 */
140 #define LOCOMO_ACC_CLKSEL001 0x01 /* mclk 3 */
141 #define LOCOMO_ACC_CLKSEL010 0x02 /* mclk 4 */
142 #define LOCOMO_ACC_CLKSEL011 0x03 /* mclk 6 */
143 #define LOCOMO_ACC_CLKSEL100 0x04 /* mclk 8 */
144 #define LOCOMO_ACC_CLKSEL101 0x05 /* mclk 12 */
146 /* PCM audio interface */
147 #define LOCOMO_PAIF_SCINV 0x20 /* */
148 #define LOCOMO_PAIF_SCEN 0x10 /* */
149 #define LOCOMO_PAIF_LRCRST 0x08 /* */
150 #define LOCOMO_PAIF_LRCEVE 0x04 /* */
151 #define LOCOMO_PAIF_LRCINV 0x02 /* */
152 #define LOCOMO_PAIF_LRCEN 0x01 /* */
154 /* GPIO */
155 #define LOCOMO_GPIO(Nb) (0x01 << (Nb)) /* LoCoMo GPIO [0...15] */
156 #define LOCOMO_GPIO_RTS LOCOMO_GPIO(0) /* LoCoMo GPIO [0] */
157 #define LOCOMO_GPIO_CTS LOCOMO_GPIO(1) /* LoCoMo GPIO [1] */
158 #define LOCOMO_GPIO_DSR LOCOMO_GPIO(2) /* LoCoMo GPIO [2] */
159 #define LOCOMO_GPIO_DTR LOCOMO_GPIO(3) /* LoCoMo GPIO [3] */
160 #define LOCOMO_GPIO_LCD_VSHA_ON LOCOMO_GPIO(4) /* LoCoMo GPIO [4] */
161 #define LOCOMO_GPIO_LCD_VSHD_ON LOCOMO_GPIO(5) /* LoCoMo GPIO [5] */
162 #define LOCOMO_GPIO_LCD_VEE_ON LOCOMO_GPIO(6) /* LoCoMo GPIO [6] */
163 #define LOCOMO_GPIO_LCD_MOD LOCOMO_GPIO(7) /* LoCoMo GPIO [7] */
164 #define LOCOMO_GPIO_DAC_ON LOCOMO_GPIO(8) /* LoCoMo GPIO [8] */
165 #define LOCOMO_GPIO_FL_VR LOCOMO_GPIO(9) /* LoCoMo GPIO [9] */
166 #define LOCOMO_GPIO_DAC_SDATA LOCOMO_GPIO(10) /* LoCoMo GPIO [10] */
167 #define LOCOMO_GPIO_DAC_SCK LOCOMO_GPIO(11) /* LoCoMo GPIO [11] */
168 #define LOCOMO_GPIO_DAC_SLOAD LOCOMO_GPIO(12) /* LoCoMo GPIO [12] */
170 extern struct bus_type locomo_bus_type;
172 struct locomo_dev {
173 struct device dev;
174 unsigned int devid;
175 struct resource res;
176 void *mapbase;
177 unsigned int irq[1];
178 u64 dma_mask;
181 #define LOCOMO_DEV(_d) container_of((_d), struct locomo_dev, dev)
183 #define locomo_get_drvdata(d) dev_get_drvdata(&(d)->dev)
184 #define locomo_set_drvdata(d,p) dev_set_drvdata(&(d)->dev, p)
186 struct locomo_driver {
187 struct device_driver drv;
188 unsigned int devid;
189 int (*probe)(struct locomo_dev *);
190 int (*remove)(struct locomo_dev *);
191 int (*suspend)(struct locomo_dev *, u32);
192 int (*resume)(struct locomo_dev *);
195 #define LOCOMO_DRV(_d) container_of((_d), struct locomo_driver, drv)
197 #define LOCOMO_DRIVER_NAME(_ldev) ((_ldev)->dev.driver->name)
199 void locomo_lcd_power(struct locomo_dev *, int, unsigned int);
201 int locomo_driver_register(struct locomo_driver *);
202 void locomo_driver_unregister(struct locomo_driver *);
204 #endif