[ARM] pxa: update defconfig for Verdex Pro
[linux-2.6/verdex.git] / arch / arm / mach-pxa / gumstix-verdex.c
blobcf5eab1dc6335717a13c41926823f7f7c62c1d4d
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>
54 #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
56 #include <linux/smsc911x.h>
58 static struct resource verdex_smsc911x_resources[] = {
59 [0] = {
60 .name = "smsc911x-memory",
61 .start = PXA_CS1_PHYS,
62 .end = PXA_CS1_PHYS + 0x000fffff,
63 .flags = IORESOURCE_MEM,
65 [1] = {
66 .start = IRQ_GPIO(GPIO_GUMSTIX_ETH0),
67 .end = IRQ_GPIO(GPIO_GUMSTIX_ETH0),
68 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
72 static struct smsc911x_platform_config verdex_smsc911x_config = {
73 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
74 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
75 .flags = SMSC911X_USE_16BIT | SMSC911X_SAVE_MAC_ADDRESS,
76 .phy_interface = PHY_INTERFACE_MODE_MII,
79 static struct platform_device verdex_smsc911x_device = {
80 .name = "smsc911x",
81 .id = -1,
82 .num_resources = ARRAY_SIZE(verdex_smsc911x_resources),
83 .resource = verdex_smsc911x_resources,
84 .dev = {
85 .platform_data = &verdex_smsc911x_config,
89 static void __init verdex_init_smsc911x(void)
92 printk(KERN_INFO "Initializing Gumstix verdex smsc911x\n");
94 if (gpio_request(GPIO_GUMSTIX_ETH0_RST, "SMSC911x_ETH0_RST") != 0) {
95 printk(KERN_ERR "could not obtain gpio for SMSC911x_ETH0_RST\n");
96 goto err_request_gpio_eth0_rst;
99 if (gpio_request(GPIO_GUMSTIX_ETH0, "SMSC911x_ETH0_IRQ") != 0) {
100 printk(KERN_ERR "could not obtain gpio for SMSC911x_ETH0_IRQ\n");
101 goto err_request_gpio_eth0_irq;
104 if (gpio_direction_output(GPIO_GUMSTIX_ETH0_RST, 0) != 0) {
105 printk(KERN_ERR "could not set SMSC911x_ETH0_RST pin to output\n");
106 goto err_dir;
109 gpio_set_value(GPIO_GUMSTIX_ETH0_RST, 0);
111 msleep(500); // Hold RESET for at least 200ms
113 gpio_set_value(GPIO_GUMSTIX_ETH0_RST, 1);
115 msleep(50);
117 if (gpio_direction_input(GPIO_GUMSTIX_ETH0) != 0) {
118 printk(KERN_ERR "could not set SMSC911x_ETH0_IRQ pin to input\n");
119 goto err_dir;
122 gpio_export(GPIO_GUMSTIX_ETH0, 0);
123 platform_device_register(&verdex_smsc911x_device);
124 return;
126 err_dir:
127 gpio_free(GPIO_GUMSTIX_ETH0_RST);
129 err_request_gpio_eth0_irq:
130 gpio_free(GPIO_GUMSTIX_ETH0);
132 err_request_gpio_eth0_rst:
133 return;
136 #else
137 static void __init verdex_init_smsc911x(void) { return; }
138 #endif
140 static unsigned long verdex_pin_config[] = {
141 /* MMC */
142 GPIO32_MMC_CLK,
143 GPIO112_MMC_CMD,
144 GPIO92_MMC_DAT_0,
145 GPIO109_MMC_DAT_1,
146 GPIO110_MMC_DAT_2,
147 GPIO111_MMC_DAT_3,
149 /* BTUART */
150 GPIO42_BTUART_RXD,
151 GPIO43_BTUART_TXD,
152 GPIO44_BTUART_CTS,
153 GPIO45_BTUART_RTS,
155 /* STUART */
156 GPIO46_STUART_RXD,
157 GPIO47_STUART_TXD,
159 /* FFUART */
160 GPIO34_FFUART_RXD,
161 GPIO39_FFUART_TXD,
163 /* SSP 2 */
164 GPIO19_SSP2_SCLK,
165 GPIO14_SSP2_SFRM,
166 GPIO13_SSP2_TXD,
167 GPIO11_SSP2_RXD,
169 /* SDRAM and local bus */
170 GPIO49_nPWE,
171 GPIO15_nCS_1,
173 /* I2C */
174 GPIO117_I2C_SCL,
175 GPIO118_I2C_SDA,
177 /* PWM 0 */
178 GPIO16_PWM0_OUT,
180 /* BRIGHTNESS */
181 GPIO17_PWM1_OUT,
183 /* LCD */
184 GPIO58_LCD_LDD_0,
185 GPIO59_LCD_LDD_1,
186 GPIO60_LCD_LDD_2,
187 GPIO61_LCD_LDD_3,
188 GPIO62_LCD_LDD_4,
189 GPIO63_LCD_LDD_5,
190 GPIO64_LCD_LDD_6,
191 GPIO65_LCD_LDD_7,
192 GPIO66_LCD_LDD_8,
193 GPIO67_LCD_LDD_9,
194 GPIO68_LCD_LDD_10,
195 GPIO69_LCD_LDD_11,
196 GPIO70_LCD_LDD_12,
197 GPIO71_LCD_LDD_13,
198 GPIO72_LCD_LDD_14,
199 GPIO73_LCD_LDD_15,
200 GPIO74_LCD_FCLK,
201 GPIO75_LCD_LCLK,
202 GPIO76_LCD_PCLK,
203 #ifdef CONFIG_FB_PXA_SHARP_LQ043_PSP
204 /* DISP must be always high while screen is on */
205 /* Done below in verdex_init */
206 #else
207 GPIO77_LCD_BIAS,
208 #endif
212 #if defined(CONFIG_PCMCIA_PXA2XX) || defined(CONFIG_PCMCIA_PXA2XX_MODULE)
214 static unsigned long gpio_ntschg_0[] = {
215 GPIO104_GPIO, // pxa_gpio_mode(GPIO_GUMSTIX_nCD_0_MD);
218 static unsigned long gpio_ntschg_1[] = {
219 GPIO18_GPIO, // pxa_gpio_mode(GPIO_GUMSTIX_nSTSCHG_1_MD);
220 GPIO36_GPIO, // pxa_gpio_mode(GPIO_GUMSTIX_nCD_1_MD);
221 GPIO27_GPIO, // pxa_gpio_mode(GPIO_GUMSTIX_PRDY_nBSY_1_MD);
224 static unsigned long gpio_prdy_nbsy_old[] = {
225 GPIO111_GPIO, // pxa_gpio_mode(GPIO_GUMSTIX_nSTSCHG_0_MD);
226 GPIO109_GPIO, // pxa_gpio_mode(GPIO_GUMSTIX_PRDY_nBSY_0_OLD_MD);
229 static unsigned long gpio_prdy_nbsy[] = {
230 GPIO96_GPIO, // pxa_gpio_mode(GPIO_GUMSTIX_PRDY_nBSY_0_MD);
233 static unsigned long gpio_nhw_init[] = {
234 GPIO48_nPOE, // pxa_gpio_mode(GPIO_GUMSTIX_nPOE_MD);
235 GPIO102_nPCE_1, // pxa_gpio_mode(GPIO_GUMSTIX_nPCE_1_MD);
236 GPIO105_nPCE_2, // pxa_gpio_mode(GPIO_GUMSTIX_nPCE_2_MD);
237 GPIO104_GPIO, // pxa_gpio_mode(GPIO_GUMSTIX_nCD_0_MD);
239 GPIO49_nPWE, // pxa_gpio_mode(GPIO_GUMSTIX_nPWE_MD);
240 GPIO50_nPIOR, // pxa_gpio_mode(GPIO_GUMSTIX_nPIOR_MD);
241 GPIO51_nPIOW, // pxa_gpio_mode(GPIO_GUMSTIX_nPIOW_MD);
242 GPIO79_PSKTSEL, // pxa_gpio_mode(GPIO_GUMSTIX_pSKTSEL_MD);
243 GPIO55_nPREG, // pxa_gpio_mode(GPIO_GUMSTIX_nPREG_MD);
244 GPIO56_nPWAIT, // pxa_gpio_mode(GPIO_GUMSTIX_nPWAIT_MD);
245 GPIO57_nIOIS16, // pxa_gpio_mode(GPIO_GUMSTIX_nIOIS16_MD);
248 static int net_cf_vx_mode = 0;
249 static int pcmcia_cf_nr = 2;
251 inline void __init gumstix_pcmcia_cpld_clk(void)
253 GPCR(GPIO_GUMSTIX_nPOE) = GPIO_bit(GPIO_GUMSTIX_nPOE);
254 GPSR(GPIO_GUMSTIX_nPOE) = GPIO_bit(GPIO_GUMSTIX_nPOE);
257 inline unsigned char __init gumstix_pcmcia_cpld_read_bits(int bits)
259 unsigned char result = 0;
260 unsigned int shift = 0;
261 while(bits--)
263 result |= !!(GPLR(GPIO_GUMSTIX_nCD_0) & GPIO_bit(GPIO_GUMSTIX_nCD_0)) << shift;
264 shift ++;
265 gumstix_pcmcia_cpld_clk();
267 printk("CPLD responded with: %02x\n",result);
268 return result;
271 /* We use the CPLD on the CF-CF card to read a value from a shift register. If we can read that
272 * magic sequence, then we have 2 CF cards; otherwise we assume just one
273 * The CPLD will send the value of the shift register on GPIO11 (the CD line for slot 0)
274 * when RESET is held in reset. We use GPIO48 (nPOE) as a clock signal,
275 * GPIO52/53 (card enable for both cards) to control read/write to the shift register
277 static void __init gumstix_count_cards(void)
280 if ((gpio_request(GPIO_GUMSTIX_nPOE, "GPIO_GUMSTIX_nPOE") == 0) &&
281 (gpio_direction_output(GPIO_GUMSTIX_nPOE, 1) == 0))
282 gpio_export(GPIO_GUMSTIX_nPOE, 0);
283 else
284 printk(KERN_ERR "could not obtain gpio for GPIO_GUMSTIX_nPOE\n");
286 if ((gpio_request(GPIO_GUMSTIX_nPCE_1, "GPIO_GUMSTIX_nPCE_1") == 0) &&
287 (gpio_direction_output(GPIO_GUMSTIX_nPCE_1, 1) == 0))
288 gpio_export(GPIO_GUMSTIX_nPCE_1, 0);
289 else
290 printk(KERN_ERR "could not obtain gpio for GPIO_GUMSTIX_nPCE_1\n");
292 if ((gpio_request(GPIO_GUMSTIX_nPCE_2, "GPIO_GUMSTIX_nPCE_2") == 0) &&
293 (gpio_direction_output(GPIO_GUMSTIX_nPCE_2, 1) == 0))
294 gpio_export(GPIO_GUMSTIX_nPCE_2, 0);
295 else
296 printk(KERN_ERR "could not obtain gpio for GPIO_GUMSTIX_nPCE_2\n");
298 if ((gpio_request(GPIO_GUMSTIX_nCD_0, "GPIO_GUMSTIX_nCD_0") == 0) &&
299 (gpio_direction_input(GPIO_GUMSTIX_nCD_0) == 0))
300 gpio_export(GPIO_GUMSTIX_nCD_0, 0);
301 else
302 printk(KERN_ERR "could not obtain gpio for GPIO_GUMSTIX_nCD_0\n");
304 if (net_cf_vx_mode) {
305 if ((gpio_request(GPIO_GUMSTIX_CF_OLD_RESET, "GPIO_GUMSTIX_CF_OLD_RESET") == 0) &&
306 (gpio_direction_output(GPIO_GUMSTIX_CF_OLD_RESET, 1) == 0)) {
307 gpio_export(GPIO_GUMSTIX_CF_OLD_RESET, 0);
308 } else {
309 printk(KERN_ERR "could not obtain gpio for GPIO_GUMSTIX_CF_OLD_RESET\n");
311 } else {
312 if ((gpio_request(GPIO_GUMSTIX_CF_RESET, "GPIO_GUMSTIX_CF_RESET") == 0) &&
313 (gpio_direction_output(GPIO_GUMSTIX_CF_RESET, 1) == 0)) {
314 gpio_export(GPIO_GUMSTIX_CF_RESET, 0);
315 } else {
316 printk(KERN_ERR "could not obtain gpio for GPIO_GUMSTIX_CF_RESET\n");
320 // Setup the shift register
321 GPSR(GPIO_GUMSTIX_nPCE_1) = GPIO_bit(GPIO_GUMSTIX_nPCE_1);
322 GPCR(GPIO_GUMSTIX_nPCE_2) = GPIO_bit(GPIO_GUMSTIX_nPCE_2);
324 // Tick the clock to program the shift register
325 gumstix_pcmcia_cpld_clk();
327 // Now set shift register into read mode
328 GPCR(GPIO_GUMSTIX_nPCE_1) = GPIO_bit(GPIO_GUMSTIX_nPCE_1);
329 GPSR(GPIO_GUMSTIX_nPCE_2) = GPIO_bit(GPIO_GUMSTIX_nPCE_2);
331 // We can read the bits now -- 0xC2 means "Dual compact flash"
332 if(gumstix_pcmcia_cpld_read_bits(8) != 0xC2)
334 // We do not have 2 CF slots
335 pcmcia_cf_nr = 1;
338 udelay(50);
340 if (net_cf_vx_mode) {
341 gpio_set_value(GPIO_GUMSTIX_CF_OLD_RESET, 0);
342 gpio_free(GPIO_GUMSTIX_CF_OLD_RESET);
343 } else {
344 gpio_set_value(GPIO_GUMSTIX_CF_RESET, 0);
345 gpio_free(GPIO_GUMSTIX_CF_RESET);
348 printk(KERN_INFO "found %d CF slots\n", pcmcia_cf_nr);
350 gpio_free(GPIO_GUMSTIX_nPCE_2);
351 gpio_free(GPIO_GUMSTIX_nPCE_1);
352 gpio_free(GPIO_GUMSTIX_nPOE);
353 return;
356 #define SMC_IO_EXTENT 16
357 #define BANK_SELECT 14
359 static void __init verdex_pcmcia_pin_config(void)
361 struct resource *res;
362 void *network_controller_memory;
363 struct platform_device *pdev = &verdex_smsc911x_device;
365 printk(KERN_INFO "Initializing Gumstix verdex pcmcia\n");
367 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
368 if (res == NULL) {
369 printk(KERN_ERR "no memory resource defined\n");
370 goto err_done;
373 res = request_mem_region(res->start, SMC_IO_EXTENT, "smc91x probe");
374 if (res == NULL) {
375 printk(KERN_ERR "failed to request memory resource\n");
376 goto err_done;
379 // We check for the possibility of SMSC91c111 (reg base offset 0x300 from CS1 base)
380 network_controller_memory = ioremap(res->start + 0x300, SMC_IO_EXTENT);
381 if (network_controller_memory == NULL) {
382 printk(KERN_ERR "failed to ioremap() registers\n");
383 goto err_free_mem;
386 // Look for the special 91c111 value in the bank select register
387 if((0xff00 & readw(network_controller_memory+BANK_SELECT)) == 0x3300) {
388 printk(KERN_INFO "Detected netCF-vx board: pcmcia using older GPIO configuration\n");
389 net_cf_vx_mode = 1;
390 } else {
391 printk(KERN_INFO "Not netCF-vx board: pcmcia using newer GPIO configuration\n");
392 net_cf_vx_mode = 0;
395 iounmap(network_controller_memory);
396 err_free_mem:
397 release_mem_region(res->start, SMC_IO_EXTENT);
398 err_done:
400 gumstix_count_cards(); // this can update pcmcia_cf_nr
402 // If pcmcia_cf_nr is 1 then we do not have 2 CF slots
403 // Note: logic sequence was altered from previous kernel revs
404 // so that this works as intended now.
405 if (pcmcia_cf_nr != 0)
407 pxa2xx_mfp_config(ARRAY_AND_SIZE(gpio_ntschg_0));
409 if(net_cf_vx_mode)
410 pxa2xx_mfp_config(gpio_prdy_nbsy_old, 1);
411 else
412 pxa2xx_mfp_config(gpio_prdy_nbsy, 1);
414 } else {
415 // Note: this reconfigures pin GPIO18 to be GPIO-IN so make
416 // sure that this only gets done for the old dual slot board
417 // since that pin is an active AF1 out-mode signal (RDY) on
418 // newer boards and changing the pin mode on the newer boards
419 // would result in memory corruption for the NIC (and hang during
420 // PHY test).
421 pxa2xx_mfp_config(ARRAY_AND_SIZE(gpio_ntschg_1));
424 pxa2xx_mfp_config(ARRAY_AND_SIZE(gpio_nhw_init));
425 return;
428 int __init gumstix_get_cf_cards(void)
430 return pcmcia_cf_nr;
432 EXPORT_SYMBOL(gumstix_get_cf_cards);
434 #ifdef CONFIG_MACH_GUMSTIX_VERDEX
435 int __init gumstix_check_if_netCF_vx(void)
437 return net_cf_vx_mode;
439 EXPORT_SYMBOL(gumstix_check_if_netCF_vx);
440 #endif
442 #endif
444 #if defined(CONFIG_FB_PXA_SHARP_LQ043_PSP) || defined(CONFIG_FB_PXA_SAMSUNG_LTE430WQ_F0C)
445 static void gumstix_lcd_backlight(int on_or_off)
447 int err;
448 err = gpio_request(17, "LCD BACKLIGHT");
449 if (err) {
450 //pr_warning("Gumstix Verdex: Failed to request LCD Backlight gpio\n");
451 return;
454 if(on_or_off) {
455 gpio_direction_input(17);
456 } else {
457 GPCR(17) = GPIO_bit(17);
458 gpio_direction_output(17, 0);
459 GPCR(17) = GPIO_bit(17);
462 return;
464 #endif
466 #ifdef CONFIG_FB_PXA_ALPS_CDOLLAR
467 static struct pxafb_mode_info gumstix_fb_mode = {
468 .pixclock = 300000,
469 .xres = 240,
470 .yres = 320,
471 .bpp = 16,
472 .hsync_len = 2,
473 .left_margin = 1,
474 .right_margin = 1,
475 .vsync_len = 3,
476 .upper_margin = 0,
477 .lower_margin = 0,
478 .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
481 static struct pxafb_mach_info gumstix_fb_info = {
482 .modes = &gumstix_fb_mode,
483 .num_modes = 1,
484 .lccr0 = LCCR0_Pas | LCCR0_Sngl | LCCR0_Color,
485 .lccr3 = LCCR3_PixFlEdg,
487 #elif defined(CONFIG_FB_PXA_SHARP_LQ043_PSP)
488 static struct pxafb_mode_info gumstix_fb_mode = {
489 .pixclock = 110000,
490 .xres = 480,
491 .yres = 272,
492 .bpp = 16,
493 .hsync_len = 41,
494 .left_margin = 2,
495 .right_margin = 2,
496 .vsync_len = 10,
497 .upper_margin = 2,
498 .lower_margin = 2,
499 .sync = 0, // Hsync and Vsync both active low
502 static struct pxafb_mach_info gumstix_fb_info = {
503 .modes = &gumstix_fb_mode,
504 .num_modes = 1,
505 .lccr0 = LCCR0_Act | LCCR0_Sngl | LCCR0_Color,
506 .lccr3 = LCCR3_OutEnH | LCCR3_PixFlEdg | (0 << 30),
507 .pxafb_backlight_power = &gumstix_lcd_backlight,
509 #elif defined(CONFIG_FB_PXA_SAMSUNG_LTE430WQ_F0C)
510 static struct pxafb_mode_info gumstix_fb_mode = {
511 .pixclock = 108696, // 9.2MHz typical DOTCLK from datasheet
512 .xres = 480,
513 .hsync_len = 41, // HLW from datasheet: 41 typ
514 .left_margin = 4, // HBP - HLW from datasheet: 45 - 41 = 4
515 .right_margin = 8, // HFP from datasheet: 8 typ
516 .yres = 272,
517 .vsync_len = 10, // VLW from datasheet: 10 typ
518 .upper_margin = 2, // VBP - VLW from datasheet: 12 - 10 = 2
519 .lower_margin = 4, // VFP from datasheet: 4 typ
520 .bpp = 16,
521 .sync = 0, // Hsync and Vsync both active low
524 static struct pxafb_mach_info gumstix_fb_info = {
525 .modes = &gumstix_fb_mode,
526 .num_modes = 1,
527 .lccr0 = LCCR0_Act | LCCR0_Sngl | LCCR0_Color,
528 .lccr3 = LCCR3_OutEnH | LCCR3_PixFlEdg | (0 << 30),
529 .pxafb_backlight_power = &gumstix_lcd_backlight,
531 #endif
533 static struct platform_device verdex_audio_device = {
534 .name = "pxa2xx-ac97",
535 .id = -1,
538 static struct platform_device *devices[] __initdata = {
539 &verdex_audio_device,
542 /* PXA27x OHCI controller setup */
543 #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
544 static int ohci_verdex_init(struct device *dev)
546 // Turn on port 2 in host mode
547 UP2OCR = UP2OCR_HXS | UP2OCR_HXOE | UP2OCR_DPPDE | UP2OCR_DMPDE;
549 /* See drivers/usb/host/ohci-pxa27x.c for further details but
550 ENABLE_PORT_ALL flag is equivalent to using this old sequence:
551 UHCHR = (UHCHR) &
552 ~(UHCHR_SSEP1 | UHCHR_SSEP2 | UHCHR_SSEP3 | UHCHR_SSE);
554 return 0;
557 static struct pxaohci_platform_data verdex_ohci_platform_data = {
558 .port_mode = PMM_PERPORT_MODE,
559 .flags = ENABLE_PORT_ALL,
560 .init = ohci_verdex_init,
563 static void __init verdex_ohci_init(void)
565 pxa_set_ohci_info(&verdex_ohci_platform_data);
567 #else
568 static void __init verdex_ohci_init(void) {
569 printk(KERN_INFO "Gumstix verdex host usb ohci is disabled\n");
571 #endif
574 #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)
575 static struct pxamci_platform_data verdex_mci_platform_data;
577 static int verdex_mci_init(struct device *dev, irq_handler_t detect_int,
578 void *data)
580 /* GPIO setup for MMC on the 120-pin connector is done in verdex_init.
581 * There is no card detect on a uSD connector so no interrupt to register.
582 * There is no WP detect GPIO line either.
585 return 0;
588 static struct pxamci_platform_data verdex_mci_platform_data = {
589 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
590 .init = verdex_mci_init,
591 .gpio_card_detect = -1,
592 .gpio_card_ro = -1,
593 .gpio_power = -1,
596 static void __init verdex_mmc_init(void)
598 pxa_set_mci_info(&verdex_mci_platform_data);
600 #else
601 static void __init verdex_mmc_init(void)
603 printk(KERN_INFO "Gumstix verdex mmc disabled\n");
605 #endif
607 #if defined(CONFIG_USB_GADGET_PXA2XX) || defined(CONFIG_USB_GADGET_PXA2XX_MODULE)
608 static struct pxa2xx_udc_mach_info verdex_udc_info __initdata = {
609 .gpio_vbus = GPIO35,
610 .gpio_pullup = GPIO41,
613 static void __init verdex_udc_init(void)
615 pxa_set_udc_info(&verdex_udc_info);
617 #else
618 static void __init verdex_udc_init(void)
620 printk(KERN_INFO "Gumstix verdex udc is disabled\n");
622 #endif
624 #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
626 #if defined(CONFIG_TOUCHSCREEN_TSC2003) || defined(CONFIG_TOUCHSCREEN_TSC2003_MODULE)
628 #define VERDEX_GPIO_PENDOWN 16
630 static int tsc2003_init_platform_hw(void)
632 return 0;
635 static void tsc2003_exit_platform_hw(void)
637 return;
640 static void tsc2003_clear_penirq(void)
642 return;
645 static int tsc2003_get_pendown_state(void)
647 return !gpio_get_value(VERDEX_GPIO_PENDOWN);
650 static struct tsc2007_platform_data tsc2003_config = {
651 .model = 2003,
652 .x_plate_ohms = 100,
653 .get_pendown_state = tsc2003_get_pendown_state,
654 .clear_penirq = tsc2003_clear_penirq,
655 .init_platform_hw = tsc2003_init_platform_hw,
656 .exit_platform_hw = tsc2003_exit_platform_hw,
658 #endif
660 static struct i2c_board_info __initdata verdex_i2c_board_info[] = {
661 #if defined(CONFIG_RTC_DRV_DS1307) || defined(CONFIG_RTC_DRV_DS1307_MODULE)
664 I2C_BOARD_INFO("rtc-ds1307", 0x68),
666 #endif
667 #if defined(CONFIG_TOUCHSCREEN_TSC2003) || defined(CONFIG_TOUCHSCREEN_TSC2003_MODULE)
669 I2C_BOARD_INFO("tsc2003", 0x48),
670 .platform_data = &tsc2003_config,
671 .irq = IRQ_GPIO(VERDEX_GPIO_PENDOWN),
673 #endif
676 static struct i2c_pxa_platform_data verdex_i2c_pwr_info = {
677 .fast_mode = 1,
680 static struct i2c_pxa_platform_data verdex_i2c_info = {
681 .fast_mode = 1,
684 static void __init verdex_i2c_init(void)
686 printk(KERN_INFO "Initializing Gumstix verdex i2c\n");
688 #if defined(CONFIG_TOUCHSCREEN_TSC2003) || defined(CONFIG_TOUCHSCREEN_TSC2003_MODULE)
689 if ((gpio_request(VERDEX_GPIO_PENDOWN, "TSC2003_PENDOWN") == 0) &&
690 (gpio_direction_input(VERDEX_GPIO_PENDOWN) == 0)) {
691 gpio_export(VERDEX_GPIO_PENDOWN, 0);
692 } else {
693 printk(KERN_ERR "could not obtain gpio for TSC2003_PENDOWN\n");
694 return;
696 #endif
698 i2c_register_board_info(0, verdex_i2c_board_info,
699 ARRAY_SIZE(verdex_i2c_board_info));
700 pxa_set_i2c_info(&verdex_i2c_info);
701 pxa27x_set_i2c_power_info(&verdex_i2c_pwr_info);
703 #else
704 static inline void verdex_i2c_init(void) {}
705 #endif
707 #if defined(CONFIG_PCMCIA_PXA2XX) || defined(CONFIG_PCMCIA_PXA2XX_MODULE)
708 static void __init verdex_pcmcia_init(void)
710 verdex_pcmcia_pin_config();
712 #else
713 static void __init verdex_pcmcia_init(void) {
714 printk(KERN_INFO "Gumstix verdex pcmcia is disabled\n");
716 #endif
719 static void __init verdex_init(void)
721 pxa2xx_mfp_config(ARRAY_AND_SIZE(verdex_pin_config));
723 #ifdef CONFIG_FB_PXA_SHARP_LQ043_PSP
724 /* DISP must be always high while screen is on */
725 gpio_direction_output(GPIO77, 0);
726 GPSR(GPIO77) = GPIO_bit(GPIO77);
727 #endif
728 verdex_udc_init();
729 verdex_mmc_init();
730 verdex_ohci_init();
731 verdex_i2c_init();
732 verdex_init_smsc911x();
733 verdex_pcmcia_init();
735 #if defined(CONFIG_FB_PXA_ALPS_CDOLLAR) || defined(CONFIG_FB_PXA_SHARP_LQ043_PSP) || defined(CONFIG_FB_PXA_SAMSUNG_LTE430WQ_F0C)
736 printk(KERN_INFO "Initializing Gumstix verdex FB info\n");
737 set_pxa_fb_info(&gumstix_fb_info);
738 #endif
739 printk(KERN_INFO "Initializing Gumstix platform_add_devices\n");
740 (void) platform_add_devices(devices, ARRAY_SIZE(devices));
743 MACHINE_START(GUMSTIX, "Gumstix verdex")
744 .phys_io = 0x40000000,
745 .boot_params = 0xa0000100, /* match u-boot bi_boot_params */
746 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
747 .map_io = pxa_map_io,
748 .init_irq = pxa27x_init_irq,
749 .timer = &pxa_timer,
750 .init_machine = verdex_init,
751 MACHINE_END