Revert "[ARM] pxa: fix Verdex Pro mmc initialization"
[linux-2.6/verdex.git] / arch / arm / mach-pxa / gumstix-verdex.c
blobaa27c10d0d5b321e6893ba11c32b9fd432398a1b
1 /*
2 * linux/arch/arm/mach-pxa/gumstix-verdex.c
4 * Support for the Gumstix verdex motherboard.
6 * Original Author: Craig Hughes
7 * Created: Feb 14, 2008
8 * Copyright: Craig Hughes
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
14 * Implemented based on lubbock.c by Nicolas Pitre and code from Craig
15 * Hughes
18 #include <linux/module.h>
19 #include <linux/kernel.h>
20 #include <linux/init.h>
21 #include <linux/platform_device.h>
22 #include <linux/interrupt.h>
23 #include <linux/mtd/mtd.h>
24 #include <linux/mtd/partitions.h>
25 #include <linux/i2c/tsc2007.h>
27 #include <asm/setup.h>
28 #include <asm/memory.h>
29 #include <asm/mach-types.h>
30 #include <asm/irq.h>
31 #include <asm/sizes.h>
32 #include <asm/io.h>
34 #include <asm/mach/arch.h>
35 #include <asm/mach/map.h>
36 #include <asm/mach/irq.h>
37 #include <asm/mach/flash.h>
39 #include <mach/mmc.h>
40 #include <mach/udc.h>
41 #include <mach/pxafb.h>
42 #include <mach/ohci.h>
43 #include <plat/i2c.h>
44 #include <mach/pxa27x.h>
45 #include <mach/pxa27x-udc.h>
46 #include <mach/gpio.h>
48 #include <mach/gumstix.h>
50 #include "generic.h"
52 #include <linux/delay.h>
55 #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE) \
56 || defined(CONFIG_PCMCIA_PXA2XX) || defined(CONFIG_PCMCIA_PXA2XX_MODULE)
58 #include <linux/smsc911x.h>
60 static struct resource verdex_smsc911x_resources[] = {
61 [0] = {
62 .name = "smsc911x-memory",
63 .start = PXA_CS1_PHYS,
64 .end = PXA_CS1_PHYS + 0x000fffff,
65 .flags = IORESOURCE_MEM,
67 [1] = {
68 .start = IRQ_GPIO(GPIO_GUMSTIX_ETH0),
69 .end = IRQ_GPIO(GPIO_GUMSTIX_ETH0),
70 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
74 static struct smsc911x_platform_config verdex_smsc911x_config = {
75 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
76 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
77 .flags = SMSC911X_USE_16BIT | SMSC911X_SAVE_MAC_ADDRESS,
78 .phy_interface = PHY_INTERFACE_MODE_MII,
81 static struct platform_device verdex_smsc911x_device = {
82 .name = "smsc911x",
83 .id = -1,
84 .num_resources = ARRAY_SIZE(verdex_smsc911x_resources),
85 .resource = verdex_smsc911x_resources,
86 .dev = {
87 .platform_data = &verdex_smsc911x_config,
90 #endif
92 #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
93 static void __init verdex_init_smsc911x(void)
96 printk(KERN_INFO "Initializing Gumstix verdex smsc911x\n");
98 if (gpio_request(GPIO_GUMSTIX_ETH0_RST, "SMSC911x_ETH0_RST") != 0) {
99 printk(KERN_ERR "could not obtain gpio for SMSC911x_ETH0_RST\n");
100 goto err_request_gpio_eth0_rst;
103 if (gpio_request(GPIO_GUMSTIX_ETH0, "SMSC911x_ETH0_IRQ") != 0) {
104 printk(KERN_ERR "could not obtain gpio for SMSC911x_ETH0_IRQ\n");
105 goto err_request_gpio_eth0_irq;
108 if (gpio_direction_output(GPIO_GUMSTIX_ETH0_RST, 0) != 0) {
109 printk(KERN_ERR "could not set SMSC911x_ETH0_RST pin to output\n");
110 goto err_dir;
113 gpio_set_value(GPIO_GUMSTIX_ETH0_RST, 0);
115 msleep(500); // Hold RESET for at least 200ms
117 gpio_set_value(GPIO_GUMSTIX_ETH0_RST, 1);
119 msleep(50);
121 if (gpio_direction_input(GPIO_GUMSTIX_ETH0) != 0) {
122 printk(KERN_ERR "could not set SMSC911x_ETH0_IRQ pin to input\n");
123 goto err_dir;
126 gpio_export(GPIO_GUMSTIX_ETH0, 0);
127 platform_device_register(&verdex_smsc911x_device);
128 return;
130 err_dir:
131 gpio_free(GPIO_GUMSTIX_ETH0_RST);
133 err_request_gpio_eth0_irq:
134 gpio_free(GPIO_GUMSTIX_ETH0);
136 err_request_gpio_eth0_rst:
137 return;
140 #else
141 static void __init verdex_init_smsc911x(void) { return; }
142 #endif
144 static unsigned long verdex_pin_config[] = {
145 /* MMC */
146 GPIO32_MMC_CLK,
147 GPIO112_MMC_CMD,
148 GPIO92_MMC_DAT_0,
149 GPIO109_MMC_DAT_1,
150 GPIO110_MMC_DAT_2,
151 GPIO111_MMC_DAT_3,
153 /* BTUART */
154 GPIO42_BTUART_RXD,
155 GPIO43_BTUART_TXD,
156 GPIO44_BTUART_CTS,
157 GPIO45_BTUART_RTS,
159 /* STUART */
160 GPIO46_STUART_RXD,
161 GPIO47_STUART_TXD,
163 /* FFUART */
164 GPIO34_FFUART_RXD,
165 GPIO39_FFUART_TXD,
167 /* SSP 2 */
168 GPIO19_SSP2_SCLK,
169 GPIO14_SSP2_SFRM,
170 GPIO13_SSP2_TXD,
171 GPIO11_SSP2_RXD,
173 /* SDRAM and local bus */
174 GPIO49_nPWE,
175 GPIO15_nCS_1,
177 /* I2C */
178 GPIO117_I2C_SCL,
179 GPIO118_I2C_SDA,
181 /* PWM 0 */
182 GPIO16_PWM0_OUT,
184 /* BRIGHTNESS */
185 GPIO17_PWM1_OUT,
187 /* LCD */
188 GPIO58_LCD_LDD_0,
189 GPIO59_LCD_LDD_1,
190 GPIO60_LCD_LDD_2,
191 GPIO61_LCD_LDD_3,
192 GPIO62_LCD_LDD_4,
193 GPIO63_LCD_LDD_5,
194 GPIO64_LCD_LDD_6,
195 GPIO65_LCD_LDD_7,
196 GPIO66_LCD_LDD_8,
197 GPIO67_LCD_LDD_9,
198 GPIO68_LCD_LDD_10,
199 GPIO69_LCD_LDD_11,
200 GPIO70_LCD_LDD_12,
201 GPIO71_LCD_LDD_13,
202 GPIO72_LCD_LDD_14,
203 GPIO73_LCD_LDD_15,
204 GPIO74_LCD_FCLK,
205 GPIO75_LCD_LCLK,
206 GPIO76_LCD_PCLK,
207 #ifdef CONFIG_FB_PXA_SHARP_LQ043_PSP
208 /* DISP must be always high while screen is on */
209 /* Done below in verdex_init */
210 #else
211 GPIO77_LCD_BIAS,
212 #endif
216 #if defined(CONFIG_PCMCIA_PXA2XX) || defined(CONFIG_PCMCIA_PXA2XX_MODULE)
218 static unsigned long gpio_ntschg_0[] = {
219 GPIO104_GPIO, // pxa_gpio_mode(GPIO_GUMSTIX_nCD_0_MD);
222 static unsigned long gpio_ntschg_1[] = {
223 GPIO18_GPIO, // pxa_gpio_mode(GPIO_GUMSTIX_nSTSCHG_1_MD);
224 GPIO36_GPIO, // pxa_gpio_mode(GPIO_GUMSTIX_nCD_1_MD);
225 GPIO27_GPIO, // pxa_gpio_mode(GPIO_GUMSTIX_PRDY_nBSY_1_MD);
228 static unsigned long gpio_prdy_nbsy_old[] = {
229 GPIO111_GPIO, // pxa_gpio_mode(GPIO_GUMSTIX_nSTSCHG_0_MD);
230 GPIO109_GPIO, // pxa_gpio_mode(GPIO_GUMSTIX_PRDY_nBSY_0_OLD_MD);
233 static unsigned long gpio_prdy_nbsy[] = {
234 GPIO96_GPIO, // pxa_gpio_mode(GPIO_GUMSTIX_PRDY_nBSY_0_MD);
237 static unsigned long gpio_nhw_init[] = {
238 GPIO48_nPOE, // pxa_gpio_mode(GPIO_GUMSTIX_nPOE_MD);
239 GPIO102_nPCE_1, // pxa_gpio_mode(GPIO_GUMSTIX_nPCE_1_MD);
240 GPIO105_nPCE_2, // pxa_gpio_mode(GPIO_GUMSTIX_nPCE_2_MD);
241 GPIO104_GPIO, // pxa_gpio_mode(GPIO_GUMSTIX_nCD_0_MD);
243 GPIO49_nPWE, // pxa_gpio_mode(GPIO_GUMSTIX_nPWE_MD);
244 GPIO50_nPIOR, // pxa_gpio_mode(GPIO_GUMSTIX_nPIOR_MD);
245 GPIO51_nPIOW, // pxa_gpio_mode(GPIO_GUMSTIX_nPIOW_MD);
246 GPIO79_PSKTSEL, // pxa_gpio_mode(GPIO_GUMSTIX_pSKTSEL_MD);
247 GPIO55_nPREG, // pxa_gpio_mode(GPIO_GUMSTIX_nPREG_MD);
248 GPIO56_nPWAIT, // pxa_gpio_mode(GPIO_GUMSTIX_nPWAIT_MD);
249 GPIO57_nIOIS16, // pxa_gpio_mode(GPIO_GUMSTIX_nIOIS16_MD);
252 static int net_cf_vx_mode = 0;
253 static int pcmcia_cf_nr = 2;
255 inline void __init gumstix_pcmcia_cpld_clk(void)
257 GPCR(GPIO_GUMSTIX_nPOE) = GPIO_bit(GPIO_GUMSTIX_nPOE);
258 GPSR(GPIO_GUMSTIX_nPOE) = GPIO_bit(GPIO_GUMSTIX_nPOE);
261 inline unsigned char __init gumstix_pcmcia_cpld_read_bits(int bits)
263 unsigned char result = 0;
264 unsigned int shift = 0;
265 while(bits--)
267 result |= !!(GPLR(GPIO_GUMSTIX_nCD_0) & GPIO_bit(GPIO_GUMSTIX_nCD_0)) << shift;
268 shift ++;
269 gumstix_pcmcia_cpld_clk();
271 printk("CPLD responded with: %02x\n",result);
272 return result;
275 /* We use the CPLD on the CF-CF card to read a value from a shift register. If we can read that
276 * magic sequence, then we have 2 CF cards; otherwise we assume just one
277 * The CPLD will send the value of the shift register on GPIO11 (the CD line for slot 0)
278 * when RESET is held in reset. We use GPIO48 (nPOE) as a clock signal,
279 * GPIO52/53 (card enable for both cards) to control read/write to the shift register
281 static void __init gumstix_count_cards(void)
284 if ((gpio_request(GPIO_GUMSTIX_nPOE, "GPIO_GUMSTIX_nPOE") == 0) &&
285 (gpio_direction_output(GPIO_GUMSTIX_nPOE, 1) == 0))
286 gpio_export(GPIO_GUMSTIX_nPOE, 0);
287 else
288 printk(KERN_ERR "could not obtain gpio for GPIO_GUMSTIX_nPOE\n");
290 if ((gpio_request(GPIO_GUMSTIX_nPCE_1, "GPIO_GUMSTIX_nPCE_1") == 0) &&
291 (gpio_direction_output(GPIO_GUMSTIX_nPCE_1, 1) == 0))
292 gpio_export(GPIO_GUMSTIX_nPCE_1, 0);
293 else
294 printk(KERN_ERR "could not obtain gpio for GPIO_GUMSTIX_nPCE_1\n");
296 if ((gpio_request(GPIO_GUMSTIX_nPCE_2, "GPIO_GUMSTIX_nPCE_2") == 0) &&
297 (gpio_direction_output(GPIO_GUMSTIX_nPCE_2, 1) == 0))
298 gpio_export(GPIO_GUMSTIX_nPCE_2, 0);
299 else
300 printk(KERN_ERR "could not obtain gpio for GPIO_GUMSTIX_nPCE_2\n");
302 if ((gpio_request(GPIO_GUMSTIX_nCD_0, "GPIO_GUMSTIX_nCD_0") == 0) &&
303 (gpio_direction_input(GPIO_GUMSTIX_nCD_0) == 0))
304 gpio_export(GPIO_GUMSTIX_nCD_0, 0);
305 else
306 printk(KERN_ERR "could not obtain gpio for GPIO_GUMSTIX_nCD_0\n");
308 if (net_cf_vx_mode) {
309 if ((gpio_request(GPIO_GUMSTIX_CF_OLD_RESET, "GPIO_GUMSTIX_CF_OLD_RESET") == 0) &&
310 (gpio_direction_output(GPIO_GUMSTIX_CF_OLD_RESET, 1) == 0)) {
311 gpio_export(GPIO_GUMSTIX_CF_OLD_RESET, 0);
312 } else {
313 printk(KERN_ERR "could not obtain gpio for GPIO_GUMSTIX_CF_OLD_RESET\n");
315 } else {
316 if ((gpio_request(GPIO_GUMSTIX_CF_RESET, "GPIO_GUMSTIX_CF_RESET") == 0) &&
317 (gpio_direction_output(GPIO_GUMSTIX_CF_RESET, 1) == 0)) {
318 gpio_export(GPIO_GUMSTIX_CF_RESET, 0);
319 } else {
320 printk(KERN_ERR "could not obtain gpio for GPIO_GUMSTIX_CF_RESET\n");
324 // Setup the shift register
325 GPSR(GPIO_GUMSTIX_nPCE_1) = GPIO_bit(GPIO_GUMSTIX_nPCE_1);
326 GPCR(GPIO_GUMSTIX_nPCE_2) = GPIO_bit(GPIO_GUMSTIX_nPCE_2);
328 // Tick the clock to program the shift register
329 gumstix_pcmcia_cpld_clk();
331 // Now set shift register into read mode
332 GPCR(GPIO_GUMSTIX_nPCE_1) = GPIO_bit(GPIO_GUMSTIX_nPCE_1);
333 GPSR(GPIO_GUMSTIX_nPCE_2) = GPIO_bit(GPIO_GUMSTIX_nPCE_2);
335 // We can read the bits now -- 0xC2 means "Dual compact flash"
336 if(gumstix_pcmcia_cpld_read_bits(8) != 0xC2)
338 // We do not have 2 CF slots
339 pcmcia_cf_nr = 1;
342 udelay(50);
344 if (net_cf_vx_mode) {
345 gpio_set_value(GPIO_GUMSTIX_CF_OLD_RESET, 0);
346 gpio_free(GPIO_GUMSTIX_CF_OLD_RESET);
347 } else {
348 gpio_set_value(GPIO_GUMSTIX_CF_RESET, 0);
349 gpio_free(GPIO_GUMSTIX_CF_RESET);
352 printk(KERN_INFO "found %d CF slots\n", pcmcia_cf_nr);
354 gpio_free(GPIO_GUMSTIX_nPCE_2);
355 gpio_free(GPIO_GUMSTIX_nPCE_1);
356 gpio_free(GPIO_GUMSTIX_nPOE);
357 return;
360 #define SMC_IO_EXTENT 16
361 #define BANK_SELECT 14
363 static void __init verdex_pcmcia_pin_config(void)
365 struct resource *res;
366 void *network_controller_memory;
367 struct platform_device *pdev = &verdex_smsc911x_device;
369 printk(KERN_INFO "Initializing Gumstix verdex pcmcia\n");
371 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
372 if (res == NULL) {
373 printk(KERN_ERR "no memory resource defined\n");
374 goto err_done;
377 res = request_mem_region(res->start, SMC_IO_EXTENT, "smc91x probe");
378 if (res == NULL) {
379 printk(KERN_ERR "failed to request memory resource\n");
380 goto err_done;
383 // We check for the possibility of SMSC91c111 (reg base offset 0x300 from CS1 base)
384 network_controller_memory = ioremap(res->start + 0x300, SMC_IO_EXTENT);
385 if (network_controller_memory == NULL) {
386 printk(KERN_ERR "failed to ioremap() registers\n");
387 goto err_free_mem;
390 // Look for the special 91c111 value in the bank select register
391 if((0xff00 & readw(network_controller_memory+BANK_SELECT)) == 0x3300) {
392 printk(KERN_INFO "Detected netCF-vx board: pcmcia using older GPIO configuration\n");
393 net_cf_vx_mode = 1;
394 } else {
395 printk(KERN_INFO "Not netCF-vx board: pcmcia using newer GPIO configuration\n");
396 net_cf_vx_mode = 0;
399 iounmap(network_controller_memory);
400 err_free_mem:
401 release_mem_region(res->start, SMC_IO_EXTENT);
402 err_done:
404 gumstix_count_cards(); // this can update pcmcia_cf_nr
406 // If pcmcia_cf_nr is 1 then we do not have 2 CF slots
407 // Note: logic sequence was altered from previous kernel revs
408 // so that this works as intended now.
409 if (pcmcia_cf_nr != 0)
411 pxa2xx_mfp_config(ARRAY_AND_SIZE(gpio_ntschg_0));
413 if(net_cf_vx_mode)
414 pxa2xx_mfp_config(gpio_prdy_nbsy_old, 1);
415 else
416 pxa2xx_mfp_config(gpio_prdy_nbsy, 1);
418 } else {
419 // Note: this reconfigures pin GPIO18 to be GPIO-IN so make
420 // sure that this only gets done for the old dual slot board
421 // since that pin is an active AF1 out-mode signal (RDY) on
422 // newer boards and changing the pin mode on the newer boards
423 // would result in memory corruption for the NIC (and hang during
424 // PHY test).
425 pxa2xx_mfp_config(ARRAY_AND_SIZE(gpio_ntschg_1));
428 pxa2xx_mfp_config(ARRAY_AND_SIZE(gpio_nhw_init));
429 return;
432 int __init gumstix_get_cf_cards(void)
434 return pcmcia_cf_nr;
436 EXPORT_SYMBOL(gumstix_get_cf_cards);
438 #ifdef CONFIG_MACH_GUMSTIX_VERDEX
439 int __init gumstix_check_if_netCF_vx(void)
441 return net_cf_vx_mode;
443 EXPORT_SYMBOL(gumstix_check_if_netCF_vx);
444 #endif
446 #endif
448 #if defined(CONFIG_FB_PXA_SHARP_LQ043_PSP) || defined(CONFIG_FB_PXA_SAMSUNG_LTE430WQ_F0C)
449 static void gumstix_lcd_backlight(int on_or_off)
451 int err;
452 err = gpio_request(17, "LCD BACKLIGHT");
453 if (err) {
454 //pr_warning("Gumstix Verdex: Failed to request LCD Backlight gpio\n");
455 return;
458 if(on_or_off) {
459 gpio_direction_input(17);
460 } else {
461 GPCR(17) = GPIO_bit(17);
462 gpio_direction_output(17, 0);
463 GPCR(17) = GPIO_bit(17);
466 return;
468 #endif
470 #ifdef CONFIG_FB_PXA_ALPS_CDOLLAR
471 static struct pxafb_mode_info gumstix_fb_mode = {
472 .pixclock = 300000,
473 .xres = 240,
474 .yres = 320,
475 .bpp = 16,
476 .hsync_len = 2,
477 .left_margin = 1,
478 .right_margin = 1,
479 .vsync_len = 3,
480 .upper_margin = 0,
481 .lower_margin = 0,
482 .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
485 static struct pxafb_mach_info gumstix_fb_info = {
486 .modes = &gumstix_fb_mode,
487 .num_modes = 1,
488 .lccr0 = LCCR0_Pas | LCCR0_Sngl | LCCR0_Color,
489 .lccr3 = LCCR3_PixFlEdg,
491 #elif defined(CONFIG_FB_PXA_SHARP_LQ043_PSP)
492 static struct pxafb_mode_info gumstix_fb_mode = {
493 .pixclock = 110000,
494 .xres = 480,
495 .yres = 272,
496 .bpp = 16,
497 .hsync_len = 41,
498 .left_margin = 2,
499 .right_margin = 2,
500 .vsync_len = 10,
501 .upper_margin = 2,
502 .lower_margin = 2,
503 .sync = 0, // Hsync and Vsync both active low
506 static struct pxafb_mach_info gumstix_fb_info = {
507 .modes = &gumstix_fb_mode,
508 .num_modes = 1,
509 .lccr0 = LCCR0_Act | LCCR0_Sngl | LCCR0_Color,
510 .lccr3 = LCCR3_OutEnH | LCCR3_PixFlEdg | (0 << 30),
511 .pxafb_backlight_power = &gumstix_lcd_backlight,
513 #elif defined(CONFIG_FB_PXA_SAMSUNG_LTE430WQ_F0C)
514 static struct pxafb_mode_info gumstix_fb_mode = {
515 .pixclock = 108696, // 9.2MHz typical DOTCLK from datasheet
516 .xres = 480,
517 .hsync_len = 41, // HLW from datasheet: 41 typ
518 .left_margin = 4, // HBP - HLW from datasheet: 45 - 41 = 4
519 .right_margin = 8, // HFP from datasheet: 8 typ
520 .yres = 272,
521 .vsync_len = 10, // VLW from datasheet: 10 typ
522 .upper_margin = 2, // VBP - VLW from datasheet: 12 - 10 = 2
523 .lower_margin = 4, // VFP from datasheet: 4 typ
524 .bpp = 16,
525 .sync = 0, // Hsync and Vsync both active low
528 static struct pxafb_mach_info gumstix_fb_info = {
529 .modes = &gumstix_fb_mode,
530 .num_modes = 1,
531 .lccr0 = LCCR0_Act | LCCR0_Sngl | LCCR0_Color,
532 .lccr3 = LCCR3_OutEnH | LCCR3_PixFlEdg | (0 << 30),
533 .pxafb_backlight_power = &gumstix_lcd_backlight,
535 #endif
537 static struct platform_device verdex_audio_device = {
538 .name = "pxa2xx-ac97",
539 .id = -1,
542 static struct platform_device *devices[] __initdata = {
543 &verdex_audio_device,
546 /* PXA27x OHCI controller setup */
547 #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
548 static int ohci_verdex_init(struct device *dev)
550 // Turn on port 2 in host mode
551 UP2OCR = UP2OCR_HXS | UP2OCR_HXOE | UP2OCR_DPPDE | UP2OCR_DMPDE;
553 /* See drivers/usb/host/ohci-pxa27x.c for further details but
554 ENABLE_PORT_ALL flag is equivalent to using this old sequence:
555 UHCHR = (UHCHR) &
556 ~(UHCHR_SSEP1 | UHCHR_SSEP2 | UHCHR_SSEP3 | UHCHR_SSE);
558 return 0;
561 static struct pxaohci_platform_data verdex_ohci_platform_data = {
562 .port_mode = PMM_PERPORT_MODE,
563 .flags = ENABLE_PORT_ALL,
564 .init = ohci_verdex_init,
567 static void __init verdex_ohci_init(void)
569 pxa_set_ohci_info(&verdex_ohci_platform_data);
571 #else
572 static void __init verdex_ohci_init(void) {
573 printk(KERN_INFO "Gumstix verdex host usb ohci is disabled\n");
575 #endif
578 #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)
579 static struct pxamci_platform_data verdex_mci_platform_data;
581 static int verdex_mci_init(struct device *dev, irq_handler_t detect_int,
582 void *data)
584 /* GPIO setup for MMC on the 120-pin connector is done in verdex_init.
585 * There is no card detect on a uSD connector so no interrupt to register.
586 * There is no WP detect GPIO line either.
589 return 0;
592 static struct pxamci_platform_data verdex_mci_platform_data = {
593 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
594 .init = verdex_mci_init,
597 static void __init verdex_mmc_init(void)
599 pxa_set_mci_info(&verdex_mci_platform_data);
601 #else
602 static void __init verdex_mmc_init(void)
604 printk(KERN_INFO "Gumstix verdex mmc disabled\n");
606 #endif
608 #if defined(CONFIG_USB_GADGET_PXA2XX) || defined(CONFIG_USB_GADGET_PXA2XX_MODULE)
609 static struct pxa2xx_udc_mach_info verdex_udc_info __initdata = {
610 .gpio_vbus = GPIO35,
611 .gpio_pullup = GPIO41,
614 static void __init verdex_udc_init(void)
616 pxa_set_udc_info(&verdex_udc_info);
618 #else
619 static void __init verdex_udc_init(void)
621 printk(KERN_INFO "Gumstix verdex udc is disabled\n");
623 #endif
625 #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
627 #if defined(CONFIG_TOUCHSCREEN_TSC2003) || defined(CONFIG_TOUCHSCREEN_TSC2003_MODULE)
629 #define VERDEX_GPIO_PENDOWN 16
631 static int tsc2003_init_platform_hw(void)
633 return 0;
636 static void tsc2003_exit_platform_hw(void)
638 return;
641 static void tsc2003_clear_penirq(void)
643 return;
646 static int tsc2003_get_pendown_state(void)
648 return !gpio_get_value(VERDEX_GPIO_PENDOWN);
651 static struct tsc2007_platform_data tsc2003_config = {
652 .model = 2003,
653 .x_plate_ohms = 100,
654 .get_pendown_state = tsc2003_get_pendown_state,
655 .clear_penirq = tsc2003_clear_penirq,
656 .init_platform_hw = tsc2003_init_platform_hw,
657 .exit_platform_hw = tsc2003_exit_platform_hw,
659 #endif
661 static struct i2c_board_info __initdata verdex_i2c_board_info[] = {
662 #if defined(CONFIG_RTC_DRV_DS1307) || defined(CONFIG_RTC_DRV_DS1307_MODULE)
665 I2C_BOARD_INFO("rtc-ds1307", 0x68),
667 #endif
668 #if defined(CONFIG_TOUCHSCREEN_TSC2003) || defined(CONFIG_TOUCHSCREEN_TSC2003_MODULE)
670 I2C_BOARD_INFO("tsc2003", 0x48),
671 .platform_data = &tsc2003_config,
672 .irq = IRQ_GPIO(VERDEX_GPIO_PENDOWN),
674 #endif
677 static struct i2c_pxa_platform_data verdex_i2c_pwr_info = {
678 .fast_mode = 1,
681 static struct i2c_pxa_platform_data verdex_i2c_info = {
682 .fast_mode = 1,
685 static void __init verdex_i2c_init(void)
687 printk(KERN_INFO "Initializing Gumstix verdex i2c\n");
689 #if defined(CONFIG_TOUCHSCREEN_TSC2003) || defined(CONFIG_TOUCHSCREEN_TSC2003_MODULE)
690 if ((gpio_request(VERDEX_GPIO_PENDOWN, "TSC2003_PENDOWN") == 0) &&
691 (gpio_direction_input(VERDEX_GPIO_PENDOWN) == 0)) {
692 gpio_export(VERDEX_GPIO_PENDOWN, 0);
693 } else {
694 printk(KERN_ERR "could not obtain gpio for TSC2003_PENDOWN\n");
695 return;
697 #endif
699 i2c_register_board_info(0, verdex_i2c_board_info,
700 ARRAY_SIZE(verdex_i2c_board_info));
701 pxa_set_i2c_info(&verdex_i2c_info);
702 pxa27x_set_i2c_power_info(&verdex_i2c_pwr_info);
704 #else
705 static inline void verdex_i2c_init(void) {}
706 #endif
708 #if defined(CONFIG_PCMCIA_PXA2XX) || defined(CONFIG_PCMCIA_PXA2XX_MODULE)
709 static void __init verdex_pcmcia_init(void)
711 verdex_pcmcia_pin_config();
713 #else
714 static void __init verdex_pcmcia_init(void) {
715 printk(KERN_INFO "Gumstix verdex pcmcia is disabled\n");
717 #endif
720 static void __init verdex_init(void)
722 pxa2xx_mfp_config(ARRAY_AND_SIZE(verdex_pin_config));
724 #ifdef CONFIG_FB_PXA_SHARP_LQ043_PSP
725 /* DISP must be always high while screen is on */
726 gpio_direction_output(GPIO77, 0);
727 GPSR(GPIO77) = GPIO_bit(GPIO77);
728 #endif
729 verdex_udc_init();
730 verdex_mmc_init();
731 verdex_ohci_init();
732 verdex_i2c_init();
733 verdex_init_smsc911x();
734 verdex_pcmcia_init();
736 #if defined(CONFIG_FB_PXA_ALPS_CDOLLAR) || defined(CONFIG_FB_PXA_SHARP_LQ043_PSP) || defined(CONFIG_FB_PXA_SAMSUNG_LTE430WQ_F0C)
737 printk(KERN_INFO "Initializing Gumstix verdex FB info\n");
738 set_pxa_fb_info(&gumstix_fb_info);
739 #endif
740 printk(KERN_INFO "Initializing Gumstix platform_add_devices\n");
741 (void) platform_add_devices(devices, ARRAY_SIZE(devices));
744 MACHINE_START(GUMSTIX, "Gumstix verdex")
745 .phys_io = 0x40000000,
746 .boot_params = 0xa0000100, /* match u-boot bi_boot_params */
747 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
748 .map_io = pxa_map_io,
749 .init_irq = pxa27x_init_irq,
750 .timer = &pxa_timer,
751 .init_machine = verdex_init,
752 MACHINE_END