aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-pxa/tosa.c
diff options
context:
space:
mode:
authorDirk Opfer <dirk@opfer-online.de>2005-11-08 14:15:30 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2005-11-08 14:15:30 -0500
commita93876c16275376c4f9f1630ce24036d329fa7a0 (patch)
tree1e5e876f9c428d96c6f5c367e50d019914669c4c /arch/arm/mach-pxa/tosa.c
parent3b6353fae0d7ba772d7eb2651727332c9e9c74ac (diff)
[ARM] 3123/1: Sharp SL-6000x: Add IRDA, MMC, UDC and keyboard device
Patch from Dirk Opfer This patch adds MMC, IRDA and UDC support to the Sharp SL-6000x device. Also it adds a platform device for the keyboard driver. Signed-off-by: Dirk Opfer Signed-off-by: Richard Purdie <rpurdie@rpsys.net> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-pxa/tosa.c')
-rw-r--r--arch/arm/mach-pxa/tosa.c117
1 files changed, 116 insertions, 1 deletions
diff --git a/arch/arm/mach-pxa/tosa.c b/arch/arm/mach-pxa/tosa.c
index 400609f8b6a8..f3e01891e851 100644
--- a/arch/arm/mach-pxa/tosa.c
+++ b/arch/arm/mach-pxa/tosa.c
@@ -111,16 +111,128 @@ static struct scoop_pcmcia_dev tosa_pcmcia_scoop[] = {
111}, 111},
112}; 112};
113 113
114/*
115 * USB Device Controller
116 */
117static void tosa_udc_command(int cmd)
118{
119 switch(cmd) {
120 case PXA2XX_UDC_CMD_CONNECT:
121 set_scoop_gpio(&tosascoop_jc_device.dev,TOSA_SCOOP_JC_USB_PULLUP);
122 break;
123 case PXA2XX_UDC_CMD_DISCONNECT:
124 reset_scoop_gpio(&tosascoop_jc_device.dev,TOSA_SCOOP_JC_USB_PULLUP);
125 break;
126 }
127}
128
129static int tosa_udc_is_connected(void)
130{
131 return ((GPLR(TOSA_GPIO_USB_IN) & GPIO_bit(TOSA_GPIO_USB_IN)) == 0);
132}
133
134
135static struct pxa2xx_udc_mach_info udc_info __initdata = {
136 .udc_command = tosa_udc_command,
137 .udc_is_connected = tosa_udc_is_connected,
138};
139
140/*
141 * MMC/SD Device
142 */
143static struct pxamci_platform_data tosa_mci_platform_data;
144
145static int tosa_mci_init(struct device *dev, irqreturn_t (*tosa_detect_int)(int, void *, struct pt_regs *), void *data)
146{
147 int err;
148
149 /* setup GPIO for PXA25x MMC controller */
150 pxa_gpio_mode(GPIO6_MMCCLK_MD);
151 pxa_gpio_mode(GPIO8_MMCCS0_MD);
152 pxa_gpio_mode(TOSA_GPIO_nSD_DETECT | GPIO_IN);
153
154 tosa_mci_platform_data.detect_delay = msecs_to_jiffies(250);
155
156 err = request_irq(TOSA_IRQ_GPIO_nSD_DETECT, tosa_detect_int, SA_INTERRUPT,
157 "MMC/SD card detect", data);
158 if (err) {
159 printk(KERN_ERR "tosa_mci_init: MMC/SD: can't request MMC card detect IRQ\n");
160 return -1;
161 }
162
163 set_irq_type(TOSA_IRQ_GPIO_nSD_DETECT, IRQT_BOTHEDGE);
164
165 return 0;
166}
167
168static void tosa_mci_setpower(struct device *dev, unsigned int vdd)
169{
170 struct pxamci_platform_data* p_d = dev->platform_data;
171
172 if (( 1 << vdd) & p_d->ocr_mask) {
173 set_scoop_gpio(&tosascoop_device.dev,TOSA_SCOOP_PWR_ON);
174 } else {
175 reset_scoop_gpio(&tosascoop_device.dev,TOSA_SCOOP_PWR_ON);
176 }
177}
178
179static int tosa_mci_get_ro(struct device *dev)
180{
181 return (read_scoop_reg(&tosascoop_device.dev, SCOOP_GPWR)&TOSA_SCOOP_SD_WP);
182}
183
184static void tosa_mci_exit(struct device *dev, void *data)
185{
186 free_irq(TOSA_IRQ_GPIO_nSD_DETECT, data);
187}
188
189static struct pxamci_platform_data tosa_mci_platform_data = {
190 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
191 .init = tosa_mci_init,
192 .get_ro = tosa_mci_get_ro,
193 .setpower = tosa_mci_setpower,
194 .exit = tosa_mci_exit,
195};
196
197/*
198 * Irda
199 */
200static void tosa_irda_transceiver_mode(struct device *dev, int mode)
201{
202 if (mode & IR_OFF) {
203 reset_scoop_gpio(&tosascoop_device.dev,TOSA_SCOOP_IR_POWERDWN);
204 pxa_gpio_mode(GPIO47_STTXD|GPIO_DFLT_LOW);
205 pxa_gpio_mode(GPIO47_STTXD|GPIO_OUT);
206 } else {
207 pxa_gpio_mode(GPIO47_STTXD_MD);
208 set_scoop_gpio(&tosascoop_device.dev,TOSA_SCOOP_IR_POWERDWN);
209 }
210}
211
212static struct pxaficp_platform_data tosa_ficp_platform_data = {
213 .transceiver_cap = IR_SIRMODE | IR_OFF,
214 .transceiver_mode = tosa_irda_transceiver_mode,
215};
216
217/*
218 * Tosa Keyboard
219 */
220static struct platform_device tosakbd_device = {
221 .name = "tosa-keyboard",
222 .id = -1,
223};
114 224
115static struct platform_device *devices[] __initdata = { 225static struct platform_device *devices[] __initdata = {
116 &tosascoop_device, 226 &tosascoop_device,
117 &tosascoop_jc_device, 227 &tosascoop_jc_device,
228 &tosakbd_device,
118}; 229};
119 230
120static void __init tosa_init(void) 231static void __init tosa_init(void)
121{ 232{
122 pxa_gpio_mode(TOSA_GPIO_ON_RESET | GPIO_IN); 233 pxa_gpio_mode(TOSA_GPIO_ON_RESET | GPIO_IN);
123 pxa_gpio_mode(TOSA_GPIO_TC6393_INT | GPIO_IN); 234 pxa_gpio_mode(TOSA_GPIO_TC6393_INT | GPIO_IN);
235 pxa_gpio_mode(TOSA_GPIO_USB_IN | GPIO_IN);
124 236
125 /* setup sleep mode values */ 237 /* setup sleep mode values */
126 PWER = 0x00000002; 238 PWER = 0x00000002;
@@ -131,9 +243,12 @@ static void __init tosa_init(void)
131 PGSR2 = 0x00014000; 243 PGSR2 = 0x00014000;
132 PCFR |= PCFR_OPDE; 244 PCFR |= PCFR_OPDE;
133 245
134 // enable batt_fault 246 /* enable batt_fault */
135 PMCR = 0x01; 247 PMCR = 0x01;
136 248
249 pxa_set_mci_info(&tosa_mci_platform_data);
250 pxa_set_udc_info(&udc_info);
251 pxa_set_ficp_info(&tosa_ficp_platform_data);
137 platform_add_devices(devices, ARRAY_SIZE(devices)); 252 platform_add_devices(devices, ARRAY_SIZE(devices));
138 253
139 scoop_num = 2; 254 scoop_num = 2;