diff options
Diffstat (limited to 'arch/arm/mach-pxa/tosa.c')
-rw-r--r-- | arch/arm/mach-pxa/tosa.c | 152 |
1 files changed, 148 insertions, 4 deletions
diff --git a/arch/arm/mach-pxa/tosa.c b/arch/arm/mach-pxa/tosa.c index 400609f8b6a8..c312054dfb88 100644 --- a/arch/arm/mach-pxa/tosa.c +++ b/arch/arm/mach-pxa/tosa.c | |||
@@ -98,6 +98,9 @@ struct platform_device tosascoop_jc_device = { | |||
98 | .resource = tosa_scoop_jc_resources, | 98 | .resource = tosa_scoop_jc_resources, |
99 | }; | 99 | }; |
100 | 100 | ||
101 | /* | ||
102 | * PCMCIA | ||
103 | */ | ||
101 | static struct scoop_pcmcia_dev tosa_pcmcia_scoop[] = { | 104 | static struct scoop_pcmcia_dev tosa_pcmcia_scoop[] = { |
102 | { | 105 | { |
103 | .dev = &tosascoop_device.dev, | 106 | .dev = &tosascoop_device.dev, |
@@ -111,16 +114,155 @@ static struct scoop_pcmcia_dev tosa_pcmcia_scoop[] = { | |||
111 | }, | 114 | }, |
112 | }; | 115 | }; |
113 | 116 | ||
117 | static void tosa_pcmcia_init(void) | ||
118 | { | ||
119 | /* Setup default state of GPIO outputs | ||
120 | before we enable them as outputs. */ | ||
121 | GPSR(GPIO48_nPOE) = GPIO_bit(GPIO48_nPOE) | | ||
122 | GPIO_bit(GPIO49_nPWE) | GPIO_bit(GPIO50_nPIOR) | | ||
123 | GPIO_bit(GPIO51_nPIOW) | GPIO_bit(GPIO52_nPCE_1) | | ||
124 | GPIO_bit(GPIO53_nPCE_2); | ||
125 | |||
126 | pxa_gpio_mode(GPIO48_nPOE_MD); | ||
127 | pxa_gpio_mode(GPIO49_nPWE_MD); | ||
128 | pxa_gpio_mode(GPIO50_nPIOR_MD); | ||
129 | pxa_gpio_mode(GPIO51_nPIOW_MD); | ||
130 | pxa_gpio_mode(GPIO55_nPREG_MD); | ||
131 | pxa_gpio_mode(GPIO56_nPWAIT_MD); | ||
132 | pxa_gpio_mode(GPIO57_nIOIS16_MD); | ||
133 | pxa_gpio_mode(GPIO52_nPCE_1_MD); | ||
134 | pxa_gpio_mode(GPIO53_nPCE_2_MD); | ||
135 | pxa_gpio_mode(GPIO54_pSKTSEL_MD); | ||
136 | } | ||
137 | |||
138 | static struct scoop_pcmcia_config tosa_pcmcia_config = { | ||
139 | .devs = &tosa_pcmcia_scoop[0], | ||
140 | .num_devs = 2, | ||
141 | .pcmcia_init = tosa_pcmcia_init, | ||
142 | }; | ||
143 | |||
144 | /* | ||
145 | * USB Device Controller | ||
146 | */ | ||
147 | static void tosa_udc_command(int cmd) | ||
148 | { | ||
149 | switch(cmd) { | ||
150 | case PXA2XX_UDC_CMD_CONNECT: | ||
151 | set_scoop_gpio(&tosascoop_jc_device.dev,TOSA_SCOOP_JC_USB_PULLUP); | ||
152 | break; | ||
153 | case PXA2XX_UDC_CMD_DISCONNECT: | ||
154 | reset_scoop_gpio(&tosascoop_jc_device.dev,TOSA_SCOOP_JC_USB_PULLUP); | ||
155 | break; | ||
156 | } | ||
157 | } | ||
158 | |||
159 | static int tosa_udc_is_connected(void) | ||
160 | { | ||
161 | return ((GPLR(TOSA_GPIO_USB_IN) & GPIO_bit(TOSA_GPIO_USB_IN)) == 0); | ||
162 | } | ||
163 | |||
164 | |||
165 | static struct pxa2xx_udc_mach_info udc_info __initdata = { | ||
166 | .udc_command = tosa_udc_command, | ||
167 | .udc_is_connected = tosa_udc_is_connected, | ||
168 | }; | ||
169 | |||
170 | /* | ||
171 | * MMC/SD Device | ||
172 | */ | ||
173 | static struct pxamci_platform_data tosa_mci_platform_data; | ||
174 | |||
175 | static int tosa_mci_init(struct device *dev, irqreturn_t (*tosa_detect_int)(int, void *, struct pt_regs *), void *data) | ||
176 | { | ||
177 | int err; | ||
178 | |||
179 | /* setup GPIO for PXA25x MMC controller */ | ||
180 | pxa_gpio_mode(GPIO6_MMCCLK_MD); | ||
181 | pxa_gpio_mode(GPIO8_MMCCS0_MD); | ||
182 | pxa_gpio_mode(TOSA_GPIO_nSD_DETECT | GPIO_IN); | ||
183 | |||
184 | tosa_mci_platform_data.detect_delay = msecs_to_jiffies(250); | ||
185 | |||
186 | err = request_irq(TOSA_IRQ_GPIO_nSD_DETECT, tosa_detect_int, SA_INTERRUPT, | ||
187 | "MMC/SD card detect", data); | ||
188 | if (err) { | ||
189 | printk(KERN_ERR "tosa_mci_init: MMC/SD: can't request MMC card detect IRQ\n"); | ||
190 | return -1; | ||
191 | } | ||
192 | |||
193 | set_irq_type(TOSA_IRQ_GPIO_nSD_DETECT, IRQT_BOTHEDGE); | ||
194 | |||
195 | return 0; | ||
196 | } | ||
197 | |||
198 | static void tosa_mci_setpower(struct device *dev, unsigned int vdd) | ||
199 | { | ||
200 | struct pxamci_platform_data* p_d = dev->platform_data; | ||
201 | |||
202 | if (( 1 << vdd) & p_d->ocr_mask) { | ||
203 | set_scoop_gpio(&tosascoop_device.dev,TOSA_SCOOP_PWR_ON); | ||
204 | } else { | ||
205 | reset_scoop_gpio(&tosascoop_device.dev,TOSA_SCOOP_PWR_ON); | ||
206 | } | ||
207 | } | ||
208 | |||
209 | static int tosa_mci_get_ro(struct device *dev) | ||
210 | { | ||
211 | return (read_scoop_reg(&tosascoop_device.dev, SCOOP_GPWR)&TOSA_SCOOP_SD_WP); | ||
212 | } | ||
213 | |||
214 | static void tosa_mci_exit(struct device *dev, void *data) | ||
215 | { | ||
216 | free_irq(TOSA_IRQ_GPIO_nSD_DETECT, data); | ||
217 | } | ||
218 | |||
219 | static struct pxamci_platform_data tosa_mci_platform_data = { | ||
220 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, | ||
221 | .init = tosa_mci_init, | ||
222 | .get_ro = tosa_mci_get_ro, | ||
223 | .setpower = tosa_mci_setpower, | ||
224 | .exit = tosa_mci_exit, | ||
225 | }; | ||
226 | |||
227 | /* | ||
228 | * Irda | ||
229 | */ | ||
230 | static void tosa_irda_transceiver_mode(struct device *dev, int mode) | ||
231 | { | ||
232 | if (mode & IR_OFF) { | ||
233 | reset_scoop_gpio(&tosascoop_device.dev,TOSA_SCOOP_IR_POWERDWN); | ||
234 | pxa_gpio_mode(GPIO47_STTXD|GPIO_DFLT_LOW); | ||
235 | pxa_gpio_mode(GPIO47_STTXD|GPIO_OUT); | ||
236 | } else { | ||
237 | pxa_gpio_mode(GPIO47_STTXD_MD); | ||
238 | set_scoop_gpio(&tosascoop_device.dev,TOSA_SCOOP_IR_POWERDWN); | ||
239 | } | ||
240 | } | ||
241 | |||
242 | static struct pxaficp_platform_data tosa_ficp_platform_data = { | ||
243 | .transceiver_cap = IR_SIRMODE | IR_OFF, | ||
244 | .transceiver_mode = tosa_irda_transceiver_mode, | ||
245 | }; | ||
246 | |||
247 | /* | ||
248 | * Tosa Keyboard | ||
249 | */ | ||
250 | static struct platform_device tosakbd_device = { | ||
251 | .name = "tosa-keyboard", | ||
252 | .id = -1, | ||
253 | }; | ||
114 | 254 | ||
115 | static struct platform_device *devices[] __initdata = { | 255 | static struct platform_device *devices[] __initdata = { |
116 | &tosascoop_device, | 256 | &tosascoop_device, |
117 | &tosascoop_jc_device, | 257 | &tosascoop_jc_device, |
258 | &tosakbd_device, | ||
118 | }; | 259 | }; |
119 | 260 | ||
120 | static void __init tosa_init(void) | 261 | static void __init tosa_init(void) |
121 | { | 262 | { |
122 | pxa_gpio_mode(TOSA_GPIO_ON_RESET | GPIO_IN); | 263 | pxa_gpio_mode(TOSA_GPIO_ON_RESET | GPIO_IN); |
123 | pxa_gpio_mode(TOSA_GPIO_TC6393_INT | GPIO_IN); | 264 | pxa_gpio_mode(TOSA_GPIO_TC6393_INT | GPIO_IN); |
265 | pxa_gpio_mode(TOSA_GPIO_USB_IN | GPIO_IN); | ||
124 | 266 | ||
125 | /* setup sleep mode values */ | 267 | /* setup sleep mode values */ |
126 | PWER = 0x00000002; | 268 | PWER = 0x00000002; |
@@ -131,13 +273,15 @@ static void __init tosa_init(void) | |||
131 | PGSR2 = 0x00014000; | 273 | PGSR2 = 0x00014000; |
132 | PCFR |= PCFR_OPDE; | 274 | PCFR |= PCFR_OPDE; |
133 | 275 | ||
134 | // enable batt_fault | 276 | /* enable batt_fault */ |
135 | PMCR = 0x01; | 277 | PMCR = 0x01; |
136 | 278 | ||
137 | platform_add_devices(devices, ARRAY_SIZE(devices)); | 279 | pxa_set_mci_info(&tosa_mci_platform_data); |
280 | pxa_set_udc_info(&udc_info); | ||
281 | pxa_set_ficp_info(&tosa_ficp_platform_data); | ||
282 | platform_scoop_config = &tosa_pcmcia_config; | ||
138 | 283 | ||
139 | scoop_num = 2; | 284 | platform_add_devices(devices, ARRAY_SIZE(devices)); |
140 | scoop_devs = &tosa_pcmcia_scoop[0]; | ||
141 | } | 285 | } |
142 | 286 | ||
143 | static void __init fixup_tosa(struct machine_desc *desc, | 287 | static void __init fixup_tosa(struct machine_desc *desc, |