Root/target/linux/pxa/patches-3.3/001-gumstix_verdex_pro_arch_support.patch

1From 4f4bb58cba3a6c44e9f9f113609287d9d50be9c4 Mon Sep 17 00:00:00 2001
2From: Joseph Kortje <jpktech@rogers.com>
3Date: Wed, 28 Oct 2009 21:11:28 -0400
4Subject: [PATCH] [ARM] Gumstix Verdex Pro arch support
5
6add an option for Verdex Pro when ARCH_GUMSTIX is selected, and
7factor earlier Gumstix support into a seperate option
8
9Signed-off-by: Bobby Powers <bobbypowers@gmail.com>
10---
11 arch/arm/mach-pxa/Kconfig | 29 +-
12 arch/arm/mach-pxa/Makefile | 3 +-
13 arch/arm/mach-pxa/gumstix-verdex.c | 749 +++++++++++++++++++++++++++
14 arch/arm/mach-pxa/include/mach/mfp-pxa27x.h | 1 +
15 4 files changed, 772 insertions(+), 10 deletions(-)
16 create mode 100644 arch/arm/mach-pxa/gumstix-verdex.c
17
18--- a/arch/arm/mach-pxa/Kconfig
19+++ b/arch/arm/mach-pxa/Kconfig
20@@ -134,23 +134,34 @@ config MACH_CAPC7117
21     select PXA3xx
22 
23 config ARCH_GUMSTIX
24- bool "Gumstix XScale 255 boards"
25- select PXA25x
26+ bool "Gumstix boards"
27     help
28- Say Y here if you intend to run this kernel on
29- Basix, Connex, ws-200ax, ws-400ax systems
30+ Say Y here if you intend to run this kernel on a
31+ gumstix computer.
32 
33-choice
34- prompt "Gumstix Carrier/Expansion Board"
35     depends on ARCH_GUMSTIX
36 
37-config GUMSTIX_AM200EPD
38+config MACH_GUMSTIX_F
39+ bool "Gumstix Basix/Connex ..."
40+ depends on ARCH_GUMSTIX
41+ select PXA25x
42+
43+ choice
44+ prompt "Gumstix Carrier/Expansion Board"
45+ depends on MACH_GUMSTIX_F
46+
47+ config GUMSTIX_AM200EPD
48     bool "Enable AM200EPD board support"
49 
50-config GUMSTIX_AM300EPD
51+ config GUMSTIX_AM300EPD
52     bool "Enable AM300EPD board support"
53 
54-endchoice
55+ endchoice
56+
57+config MACH_GUMSTIX_VERDEX
58+ bool "Gumstix VERDEX ..."
59+ depends on ARCH_GUMSTIX
60+ select PXA27x
61 
62 config MACH_INTELMOTE2
63     bool "Intel Mote 2 Platform"
64--- a/arch/arm/mach-pxa/Makefile
65+++ b/arch/arm/mach-pxa/Makefile
66@@ -51,7 +51,8 @@ endif
67 obj-$(CONFIG_MACH_EM_X270) += em-x270.o
68 obj-$(CONFIG_MACH_CM_X300) += cm-x300.o
69 obj-$(CONFIG_MACH_CAPC7117) += capc7117.o mxm8x10.o
70-obj-$(CONFIG_ARCH_GUMSTIX) += gumstix.o
71+obj-$(CONFIG_MACH_GUMSTIX_F) += gumstix.o
72+obj-$(CONFIG_MACH_GUMSTIX_VERDEX) += gumstix-verdex.o
73 obj-$(CONFIG_GUMSTIX_AM200EPD) += am200epd.o
74 obj-$(CONFIG_GUMSTIX_AM300EPD) += am300epd.o
75 obj-$(CONFIG_MACH_INTELMOTE2) += stargate2.o
76--- /dev/null
77+++ b/arch/arm/mach-pxa/gumstix-verdex.c
78@@ -0,0 +1,794 @@
79+/*
80+ * linux/arch/arm/mach-pxa/gumstix-verdex.c
81+ *
82+ * Support for the Gumstix verdex motherboard.
83+ *
84+ * Original Author: Craig Hughes
85+ * Created: Feb 14, 2008
86+ * Copyright: Craig Hughes
87+ *
88+ * This program is free software; you can redistribute it and/or modify
89+ * it under the terms of the GNU General Public License version 2 as
90+ * published by the Free Software Foundation.
91+ *
92+ * Implemented based on lubbock.c by Nicolas Pitre and code from Craig
93+ * Hughes
94+ */
95+
96+#include <linux/module.h>
97+#include <linux/kernel.h>
98+#include <linux/init.h>
99+#include <linux/platform_device.h>
100+#include <linux/interrupt.h>
101+#include <linux/mtd/mtd.h>
102+#include <linux/mtd/partitions.h>
103+#include <linux/i2c/tsc2007.h>
104+#include <linux/i2c/pxa-i2c.h>
105+#include <linux/gpio.h>
106+#include <linux/gpio-pxa.h>
107+
108+#include <asm/setup.h>
109+#include <asm/memory.h>
110+#include <asm/mach-types.h>
111+#include <asm/irq.h>
112+#include <asm/sizes.h>
113+#include <asm/io.h>
114+
115+#include <asm/mach/arch.h>
116+#include <asm/mach/map.h>
117+#include <asm/mach/irq.h>
118+#include <asm/mach/flash.h>
119+
120+#include <mach/mmc.h>
121+#include <mach/udc.h>
122+#include <mach/pxafb.h>
123+#include <mach/ohci.h>
124+#include <mach/pxa27x.h>
125+#include <mach/pxa27x-udc.h>
126+#include <mach/gpio.h>
127+
128+#include <mach/gumstix.h>
129+
130+#include "generic.h"
131+
132+#include <linux/delay.h>
133+
134+static struct resource flash_resource = {
135+ .start = 0x00000000,
136+ .end = SZ_64M - 1,
137+ .flags = IORESOURCE_MEM,
138+};
139+
140+static struct mtd_partition gumstix_partitions[] = {
141+ {
142+ .name = "u-boot",
143+ .size = 0x00040000,
144+ .offset = 0,
145+ .mask_flags = MTD_WRITEABLE /* force read-only */
146+ } , {
147+ .name = "rootfs",
148+ .size = 0x01ec0000,
149+ .offset = 0x00040000
150+ } , {
151+ .name = "kernel",
152+ .size = 0x00100000,
153+ .offset = 0x01f00000
154+ }
155+};
156+
157+static struct flash_platform_data gumstix_flash_data = {
158+ .map_name = "cfi_probe",
159+ .parts = gumstix_partitions,
160+ .nr_parts = ARRAY_SIZE(gumstix_partitions),
161+ .width = 2,
162+};
163+
164+static struct platform_device gumstix_flash_device = {
165+ .name = "pxa2xx-flash",
166+ .id = 0,
167+ .dev = {
168+ .platform_data = &gumstix_flash_data,
169+ },
170+ .resource = &flash_resource,
171+ .num_resources = 1,
172+};
173+
174+#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE) \
175+ || defined(CONFIG_PCMCIA_PXA2XX) || defined(CONFIG_PCMCIA_PXA2XX_MODULE)
176+
177+#include <linux/smsc911x.h>
178+
179+static struct resource verdex_smsc911x_resources[] = {
180+ [0] = {
181+ .name = "smsc911x-memory",
182+ .start = PXA_CS1_PHYS,
183+ .end = PXA_CS1_PHYS + 0x000fffff,
184+ .flags = IORESOURCE_MEM,
185+ },
186+ [1] = {
187+ .start = PXA_GPIO_TO_IRQ(GPIO_GUMSTIX_ETH0),
188+ .end = PXA_GPIO_TO_IRQ(GPIO_GUMSTIX_ETH0),
189+ .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
190+ },
191+};
192+
193+static struct smsc911x_platform_config verdex_smsc911x_config = {
194+ .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
195+ .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
196+ .flags = SMSC911X_USE_16BIT | SMSC911X_SAVE_MAC_ADDRESS,
197+ .phy_interface = PHY_INTERFACE_MODE_MII,
198+};
199+
200+static struct platform_device verdex_smsc911x_device = {
201+ .name = "smsc911x",
202+ .id = -1,
203+ .num_resources = ARRAY_SIZE(verdex_smsc911x_resources),
204+ .resource = verdex_smsc911x_resources,
205+ .dev = {
206+ .platform_data = &verdex_smsc911x_config,
207+ },
208+};
209+#endif
210+
211+#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
212+static void __init verdex_init_smsc911x(void)
213+{
214+
215+ printk(KERN_INFO "Initializing Gumstix verdex smsc911x\n");
216+
217+ if (gpio_request(GPIO_GUMSTIX_ETH0_RST, "SMSC911x_ETH0_RST") != 0) {
218+ printk(KERN_ERR "could not obtain gpio for SMSC911x_ETH0_RST\n");
219+ goto err_request_gpio_eth0_rst;
220+ }
221+
222+ if (gpio_request(GPIO_GUMSTIX_ETH0, "SMSC911x_ETH0_IRQ") != 0) {
223+ printk(KERN_ERR "could not obtain gpio for SMSC911x_ETH0_IRQ\n");
224+ goto err_request_gpio_eth0_irq;
225+ }
226+
227+ if (gpio_direction_output(GPIO_GUMSTIX_ETH0_RST, 0) != 0) {
228+ printk(KERN_ERR "could not set SMSC911x_ETH0_RST pin to output\n");
229+ goto err_dir;
230+ }
231+
232+ gpio_set_value(GPIO_GUMSTIX_ETH0_RST, 0);
233+
234+ msleep(500); // Hold RESET for at least 200ms
235+
236+ gpio_set_value(GPIO_GUMSTIX_ETH0_RST, 1);
237+
238+ msleep(50);
239+
240+ if (gpio_direction_input(GPIO_GUMSTIX_ETH0) != 0) {
241+ printk(KERN_ERR "could not set SMSC911x_ETH0_IRQ pin to input\n");
242+ goto err_dir;
243+ }
244+
245+ gpio_export(GPIO_GUMSTIX_ETH0, 0);
246+ platform_device_register(&verdex_smsc911x_device);
247+ return;
248+
249+err_dir:
250+ gpio_free(GPIO_GUMSTIX_ETH0_RST);
251+
252+err_request_gpio_eth0_irq:
253+ gpio_free(GPIO_GUMSTIX_ETH0);
254+
255+err_request_gpio_eth0_rst:
256+ return;
257+}
258+
259+#else
260+static void __init verdex_init_smsc911x(void) { return; }
261+#endif
262+
263+static unsigned long verdex_pin_config[] = {
264+ /* MMC */
265+ GPIO32_MMC_CLK,
266+ GPIO112_MMC_CMD,
267+ GPIO92_MMC_DAT_0,
268+ GPIO109_MMC_DAT_1,
269+ GPIO110_MMC_DAT_2,
270+ GPIO111_MMC_DAT_3,
271+
272+ /* BTUART */
273+ GPIO42_BTUART_RXD,
274+ GPIO43_BTUART_TXD,
275+ GPIO44_BTUART_CTS,
276+ GPIO45_BTUART_RTS,
277+
278+ /* STUART */
279+ GPIO46_STUART_RXD,
280+ GPIO47_STUART_TXD,
281+
282+ /* FFUART */
283+ GPIO34_FFUART_RXD,
284+ GPIO39_FFUART_TXD,
285+
286+ /* SSP 2 */
287+ GPIO19_SSP2_SCLK,
288+ GPIO14_SSP2_SFRM,
289+ GPIO13_SSP2_TXD,
290+ GPIO11_SSP2_RXD,
291+
292+ /* SDRAM and local bus */
293+ GPIO49_nPWE,
294+ GPIO15_nCS_1,
295+
296+ /* I2C */
297+ GPIO117_I2C_SCL,
298+ GPIO118_I2C_SDA,
299+
300+ /* PWM 0 */
301+ GPIO16_PWM0_OUT,
302+
303+ /* BRIGHTNESS */
304+ GPIO17_PWM1_OUT,
305+
306+ /* LCD */
307+ GPIO58_LCD_LDD_0,
308+ GPIO59_LCD_LDD_1,
309+ GPIO60_LCD_LDD_2,
310+ GPIO61_LCD_LDD_3,
311+ GPIO62_LCD_LDD_4,
312+ GPIO63_LCD_LDD_5,
313+ GPIO64_LCD_LDD_6,
314+ GPIO65_LCD_LDD_7,
315+ GPIO66_LCD_LDD_8,
316+ GPIO67_LCD_LDD_9,
317+ GPIO68_LCD_LDD_10,
318+ GPIO69_LCD_LDD_11,
319+ GPIO70_LCD_LDD_12,
320+ GPIO71_LCD_LDD_13,
321+ GPIO72_LCD_LDD_14,
322+ GPIO73_LCD_LDD_15,
323+ GPIO74_LCD_FCLK,
324+ GPIO75_LCD_LCLK,
325+ GPIO76_LCD_PCLK,
326+#ifdef CONFIG_FB_PXA_SHARP_LQ043_PSP
327+ /* DISP must be always high while screen is on */
328+ /* Done below in verdex_init */
329+#else
330+ GPIO77_LCD_BIAS,
331+#endif
332+};
333+
334+#if defined(CONFIG_PCMCIA_PXA2XX) || defined(CONFIG_PCMCIA_PXA2XX_MODULE)
335+
336+static unsigned long gpio_ntschg_0[] = {
337+ GPIO104_GPIO, // pxa_gpio_mode(GPIO_GUMSTIX_nCD_0_MD);
338+};
339+
340+static unsigned long gpio_ntschg_1[] = {
341+ GPIO18_GPIO, // pxa_gpio_mode(GPIO_GUMSTIX_nSTSCHG_1_MD);
342+ GPIO36_GPIO, // pxa_gpio_mode(GPIO_GUMSTIX_nCD_1_MD);
343+ GPIO27_GPIO, // pxa_gpio_mode(GPIO_GUMSTIX_PRDY_nBSY_1_MD);
344+};
345+
346+static unsigned long gpio_prdy_nbsy_old[] = {
347+ GPIO111_GPIO, // pxa_gpio_mode(GPIO_GUMSTIX_nSTSCHG_0_MD);
348+ GPIO109_GPIO, // pxa_gpio_mode(GPIO_GUMSTIX_PRDY_nBSY_0_OLD_MD);
349+};
350+
351+static unsigned long gpio_prdy_nbsy[] = {
352+ GPIO96_GPIO, // pxa_gpio_mode(GPIO_GUMSTIX_PRDY_nBSY_0_MD);
353+};
354+
355+static unsigned long gpio_nhw_init[] = {
356+ GPIO48_nPOE, // pxa_gpio_mode(GPIO_GUMSTIX_nPOE_MD);
357+ GPIO102_nPCE_1, // pxa_gpio_mode(GPIO_GUMSTIX_nPCE_1_MD);
358+ GPIO105_nPCE_2, // pxa_gpio_mode(GPIO_GUMSTIX_nPCE_2_MD);
359+ GPIO104_GPIO, // pxa_gpio_mode(GPIO_GUMSTIX_nCD_0_MD);
360+
361+ GPIO49_nPWE, // pxa_gpio_mode(GPIO_GUMSTIX_nPWE_MD);
362+ GPIO50_nPIOR, // pxa_gpio_mode(GPIO_GUMSTIX_nPIOR_MD);
363+ GPIO51_nPIOW, // pxa_gpio_mode(GPIO_GUMSTIX_nPIOW_MD);
364+ GPIO79_PSKTSEL, // pxa_gpio_mode(GPIO_GUMSTIX_pSKTSEL_MD);
365+ GPIO55_nPREG, // pxa_gpio_mode(GPIO_GUMSTIX_nPREG_MD);
366+ GPIO56_nPWAIT, // pxa_gpio_mode(GPIO_GUMSTIX_nPWAIT_MD);
367+ GPIO57_nIOIS16, // pxa_gpio_mode(GPIO_GUMSTIX_nIOIS16_MD);
368+};
369+
370+static int net_cf_vx_mode = 0;
371+static int pcmcia_cf_nr = 2;
372+
373+inline void __init gumstix_pcmcia_cpld_clk(void)
374+{
375+ gpio_set_value(GPIO_GUMSTIX_nPOE, 0);
376+ gpio_set_value(GPIO_GUMSTIX_nPOE, 1);
377+}
378+
379+inline unsigned char __init gumstix_pcmcia_cpld_read_bits(int bits)
380+{
381+ unsigned char result = 0;
382+ unsigned int shift = 0;
383+ while(bits--)
384+ {
385+ result |= !!(gpio_get_value(GPIO_GUMSTIX_nCD_0) & GPIO_bit(GPIO_GUMSTIX_nCD_0)) << shift;
386+ shift ++;
387+ gumstix_pcmcia_cpld_clk();
388+ }
389+ printk("CPLD responded with: %02x\n",result);
390+ return result;
391+}
392+
393+/* We use the CPLD on the CF-CF card to read a value from a shift register. If we can read that
394+ * magic sequence, then we have 2 CF cards; otherwise we assume just one
395+ * The CPLD will send the value of the shift register on GPIO11 (the CD line for slot 0)
396+ * when RESET is held in reset. We use GPIO48 (nPOE) as a clock signal,
397+ * GPIO52/53 (card enable for both cards) to control read/write to the shift register
398+ */
399+static void __init gumstix_count_cards(void)
400+{
401+ if ((gpio_request(GPIO_GUMSTIX_nPOE, "GPIO_GUMSTIX_nPOE") == 0) &&
402+ (gpio_direction_output(GPIO_GUMSTIX_nPOE, 1) == 0))
403+ gpio_export(GPIO_GUMSTIX_nPOE, 0);
404+ else
405+ printk(KERN_ERR "could not obtain gpio for GPIO_GUMSTIX_nPOE\n");
406+
407+ if ((gpio_request(GPIO_GUMSTIX_nPCE_1, "GPIO_GUMSTIX_nPCE_1") == 0) &&
408+ (gpio_direction_output(GPIO_GUMSTIX_nPCE_1, 1) == 0))
409+ gpio_export(GPIO_GUMSTIX_nPCE_1, 0);
410+ else
411+ printk(KERN_ERR "could not obtain gpio for GPIO_GUMSTIX_nPCE_1\n");
412+
413+ if ((gpio_request(GPIO_GUMSTIX_nPCE_2, "GPIO_GUMSTIX_nPCE_2") == 0) &&
414+ (gpio_direction_output(GPIO_GUMSTIX_nPCE_2, 1) == 0))
415+ gpio_export(GPIO_GUMSTIX_nPCE_2, 0);
416+ else
417+ printk(KERN_ERR "could not obtain gpio for GPIO_GUMSTIX_nPCE_2\n");
418+
419+ if ((gpio_request(GPIO_GUMSTIX_nCD_0, "GPIO_GUMSTIX_nCD_0") == 0) &&
420+ (gpio_direction_input(GPIO_GUMSTIX_nCD_0) == 0))
421+ gpio_export(GPIO_GUMSTIX_nCD_0, 0);
422+ else
423+ printk(KERN_ERR "could not obtain gpio for GPIO_GUMSTIX_nCD_0\n");
424+
425+ if (net_cf_vx_mode) {
426+ if ((gpio_request(GPIO_GUMSTIX_CF_OLD_RESET, "GPIO_GUMSTIX_CF_OLD_RESET") == 0) &&
427+ (gpio_direction_output(GPIO_GUMSTIX_CF_OLD_RESET, 1) == 0)) {
428+ gpio_export(GPIO_GUMSTIX_CF_OLD_RESET, 0);
429+ } else {
430+ printk(KERN_ERR "could not obtain gpio for GPIO_GUMSTIX_CF_OLD_RESET\n");
431+ }
432+ } else {
433+ if ((gpio_request(GPIO_GUMSTIX_CF_RESET, "GPIO_GUMSTIX_CF_RESET") == 0) &&
434+ (gpio_direction_output(GPIO_GUMSTIX_CF_RESET, 1) == 0)) {
435+ gpio_export(GPIO_GUMSTIX_CF_RESET, 0);
436+ } else {
437+ printk(KERN_ERR "could not obtain gpio for GPIO_GUMSTIX_CF_RESET\n");
438+ }
439+ }
440+
441+ // Setup the shift register
442+ gpio_set_value(GPIO_GUMSTIX_nPCE_1, 1);
443+ gpio_set_value(GPIO_GUMSTIX_nPCE_2, 0);
444+
445+ // Tick the clock to program the shift register
446+ gumstix_pcmcia_cpld_clk();
447+
448+ // Now set shift register into read mode
449+ gpio_set_value(GPIO_GUMSTIX_nPCE_1, 0);
450+ gpio_set_value(GPIO_GUMSTIX_nPCE_2, 1);
451+
452+ // We can read the bits now -- 0xC2 means "Dual compact flash"
453+ if(gumstix_pcmcia_cpld_read_bits(8) != 0xC2)
454+ {
455+ // We do not have 2 CF slots
456+ pcmcia_cf_nr = 1;
457+ }
458+
459+ udelay(50);
460+
461+ if (net_cf_vx_mode) {
462+ gpio_set_value(GPIO_GUMSTIX_CF_OLD_RESET, 0);
463+ gpio_free(GPIO_GUMSTIX_CF_OLD_RESET);
464+ } else {
465+ gpio_set_value(GPIO_GUMSTIX_CF_RESET, 0);
466+ gpio_free(GPIO_GUMSTIX_CF_RESET);
467+ }
468+
469+ printk(KERN_INFO "found %d CF slots\n", pcmcia_cf_nr);
470+
471+ gpio_free(GPIO_GUMSTIX_nPCE_2);
472+ gpio_free(GPIO_GUMSTIX_nPCE_1);
473+ gpio_free(GPIO_GUMSTIX_nPOE);
474+ return;
475+}
476+
477+#define SMC_IO_EXTENT 16
478+#define BANK_SELECT 14
479+
480+static void __init verdex_pcmcia_pin_config(void)
481+{
482+ struct resource *res;
483+ void *network_controller_memory;
484+ struct platform_device *pdev = &verdex_smsc911x_device;
485+
486+ printk(KERN_INFO "Initializing Gumstix verdex pcmcia\n");
487+
488+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
489+ if (res == NULL) {
490+ printk(KERN_ERR "no memory resource defined\n");
491+ goto err_done;
492+ }
493+
494+ res = request_mem_region(res->start, SMC_IO_EXTENT, "smc91x probe");
495+ if (res == NULL) {
496+ printk(KERN_ERR "failed to request memory resource\n");
497+ goto err_done;
498+ }
499+
500+ // We check for the possibility of SMSC91c111 (reg base offset 0x300 from CS1 base)
501+ network_controller_memory = ioremap(res->start + 0x300, SMC_IO_EXTENT);
502+ if (network_controller_memory == NULL) {
503+ printk(KERN_ERR "failed to ioremap() registers\n");
504+ goto err_free_mem;
505+ }
506+
507+ // Look for the special 91c111 value in the bank select register
508+ if((0xff00 & readw(network_controller_memory+BANK_SELECT)) == 0x3300) {
509+ printk(KERN_INFO "Detected netCF-vx board: pcmcia using older GPIO configuration\n");
510+ net_cf_vx_mode = 1;
511+ } else {
512+ printk(KERN_INFO "Not netCF-vx board: pcmcia using newer GPIO configuration\n");
513+ net_cf_vx_mode = 0;
514+ }
515+
516+ iounmap(network_controller_memory);
517+err_free_mem:
518+ release_mem_region(res->start, SMC_IO_EXTENT);
519+err_done:
520+
521+ gumstix_count_cards(); // this can update pcmcia_cf_nr
522+
523+ // If pcmcia_cf_nr is 1 then we do not have 2 CF slots
524+ // Note: logic sequence was altered from previous kernel revs
525+ // so that this works as intended now.
526+ if (pcmcia_cf_nr != 0)
527+ {
528+ pxa2xx_mfp_config(ARRAY_AND_SIZE(gpio_ntschg_0));
529+
530+ if(net_cf_vx_mode)
531+ pxa2xx_mfp_config(gpio_prdy_nbsy_old, 1);
532+ else
533+ pxa2xx_mfp_config(gpio_prdy_nbsy, 1);
534+
535+ } else {
536+ // Note: this reconfigures pin GPIO18 to be GPIO-IN so make
537+ // sure that this only gets done for the old dual slot board
538+ // since that pin is an active AF1 out-mode signal (RDY) on
539+ // newer boards and changing the pin mode on the newer boards
540+ // would result in memory corruption for the NIC (and hang during
541+ // PHY test).
542+ pxa2xx_mfp_config(ARRAY_AND_SIZE(gpio_ntschg_1));
543+ }
544+
545+ pxa2xx_mfp_config(ARRAY_AND_SIZE(gpio_nhw_init));
546+ return;
547+}
548+
549+int __init gumstix_get_cf_cards(void)
550+{
551+ return pcmcia_cf_nr;
552+}
553+EXPORT_SYMBOL(gumstix_get_cf_cards);
554+
555+#ifdef CONFIG_MACH_GUMSTIX_VERDEX
556+int __init gumstix_check_if_netCF_vx(void)
557+{
558+ return net_cf_vx_mode;
559+}
560+EXPORT_SYMBOL(gumstix_check_if_netCF_vx);
561+#endif
562+
563+#endif
564+
565+#if defined(CONFIG_FB_PXA_SHARP_LQ043_PSP) || defined(CONFIG_FB_PXA_SAMSUNG_LTE430WQ_F0C)
566+static void gumstix_lcd_backlight(int on_or_off)
567+{
568+ int err;
569+ err = gpio_request(17, "LCD BACKLIGHT");
570+ if (err) {
571+ //pr_warning("Gumstix Verdex: Failed to request LCD Backlight gpio\n");
572+ return;
573+ }
574+
575+ if(on_or_off) {
576+ gpio_direction_input(17);
577+ } else {
578+ gpio_set_value(17, 0);
579+ gpio_direction_output(17, 0);
580+ gpio_set_value(17, 0);
581+ }
582+
583+ return;
584+}
585+#endif
586+
587+#ifdef CONFIG_FB_PXA_ALPS_CDOLLAR
588+static struct pxafb_mode_info gumstix_fb_mode = {
589+ .pixclock = 300000,
590+ .xres = 240,
591+ .yres = 320,
592+ .bpp = 16,
593+ .hsync_len = 2,
594+ .left_margin = 1,
595+ .right_margin = 1,
596+ .vsync_len = 3,
597+ .upper_margin = 0,
598+ .lower_margin = 0,
599+ .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
600+};
601+
602+static struct pxafb_mach_info gumstix_fb_info = {
603+ .modes = &gumstix_fb_mode,
604+ .num_modes = 1,
605+ .lccr0 = LCCR0_Pas | LCCR0_Sngl | LCCR0_Color,
606+ .lccr3 = LCCR3_PixFlEdg,
607+};
608+#elif defined(CONFIG_FB_PXA_SHARP_LQ043_PSP)
609+static struct pxafb_mode_info gumstix_fb_mode = {
610+ .pixclock = 110000,
611+ .xres = 480,
612+ .yres = 272,
613+ .bpp = 16,
614+ .hsync_len = 41,
615+ .left_margin = 2,
616+ .right_margin = 2,
617+ .vsync_len = 10,
618+ .upper_margin = 2,
619+ .lower_margin = 2,
620+ .sync = 0, // Hsync and Vsync both active low
621+};
622+
623+static struct pxafb_mach_info gumstix_fb_info = {
624+ .modes = &gumstix_fb_mode,
625+ .num_modes = 1,
626+ .lccr0 = LCCR0_Act | LCCR0_Sngl | LCCR0_Color,
627+ .lccr3 = LCCR3_OutEnH | LCCR3_PixFlEdg | (0 << 30),
628+ .pxafb_backlight_power = &gumstix_lcd_backlight,
629+};
630+#elif defined(CONFIG_FB_PXA_SAMSUNG_LTE430WQ_F0C)
631+static struct pxafb_mode_info gumstix_fb_mode = {
632+ .pixclock = 108696, // 9.2MHz typical DOTCLK from datasheet
633+ .xres = 480,
634+ .hsync_len = 41, // HLW from datasheet: 41 typ
635+ .left_margin = 4, // HBP - HLW from datasheet: 45 - 41 = 4
636+ .right_margin = 8, // HFP from datasheet: 8 typ
637+ .yres = 272,
638+ .vsync_len = 10, // VLW from datasheet: 10 typ
639+ .upper_margin = 2, // VBP - VLW from datasheet: 12 - 10 = 2
640+ .lower_margin = 4, // VFP from datasheet: 4 typ
641+ .bpp = 16,
642+ .sync = 0, // Hsync and Vsync both active low
643+};
644+
645+static struct pxafb_mach_info gumstix_fb_info = {
646+ .modes = &gumstix_fb_mode,
647+ .num_modes = 1,
648+ .lccr0 = LCCR0_Act | LCCR0_Sngl | LCCR0_Color,
649+ .lccr3 = LCCR3_OutEnH | LCCR3_PixFlEdg | (0 << 30),
650+ .pxafb_backlight_power = &gumstix_lcd_backlight,
651+};
652+#endif
653+
654+static struct platform_device verdex_audio_device = {
655+ .name = "pxa2xx-ac97",
656+ .id = -1,
657+};
658+
659+static struct platform_device *devices[] __initdata = {
660+ &gumstix_flash_device,
661+ &verdex_audio_device,
662+};
663+
664+/* PXA27x OHCI controller setup */
665+#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
666+static int ohci_verdex_init(struct device *dev)
667+{
668+ // Turn on port 2 in host mode
669+ UP2OCR = UP2OCR_HXS | UP2OCR_HXOE | UP2OCR_DPPDE | UP2OCR_DMPDE;
670+
671+ /* See drivers/usb/host/ohci-pxa27x.c for further details but
672+ ENABLE_PORT_ALL flag is equivalent to using this old sequence:
673+ UHCHR = (UHCHR) &
674+ ~(UHCHR_SSEP1 | UHCHR_SSEP2 | UHCHR_SSEP3 | UHCHR_SSE);
675+ */
676+ return 0;
677+}
678+
679+static struct pxaohci_platform_data verdex_ohci_platform_data = {
680+ .port_mode = PMM_PERPORT_MODE,
681+ .flags = ENABLE_PORT_ALL,
682+ .init = ohci_verdex_init,
683+};
684+
685+static void __init verdex_ohci_init(void)
686+{
687+ pxa_set_ohci_info(&verdex_ohci_platform_data);
688+}
689+#else
690+static void __init verdex_ohci_init(void) {
691+ printk(KERN_INFO "Gumstix verdex host usb ohci is disabled\n");
692+}
693+#endif
694+
695+
696+#if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)
697+static struct pxamci_platform_data verdex_mci_platform_data;
698+
699+static int verdex_mci_init(struct device *dev, irq_handler_t detect_int,
700+ void *data)
701+{
702+ /* GPIO setup for MMC on the 120-pin connector is done in verdex_init.
703+ * There is no card detect on a uSD connector so no interrupt to
704+ * register. There is no WP detect GPIO line either.
705+ */
706+
707+ return 0;
708+}
709+
710+static struct pxamci_platform_data verdex_mci_platform_data = {
711+ .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
712+ .init = verdex_mci_init,
713+ .gpio_card_detect = -1,
714+ .gpio_card_ro = -1,
715+ .gpio_power = -1,
716+};
717+
718+static void __init verdex_mmc_init(void)
719+{
720+ pxa_set_mci_info(&verdex_mci_platform_data);
721+}
722+#else
723+static void __init verdex_mmc_init(void)
724+{
725+ printk(KERN_INFO "Gumstix verdex mmc disabled\n");
726+}
727+#endif
728+
729+#if defined(CONFIG_USB_GADGET_PXA2XX) || defined(CONFIG_USB_GADGET_PXA2XX_MODULE)
730+static struct pxa2xx_udc_mach_info verdex_udc_info __initdata = {
731+ .gpio_vbus = GPIO35,
732+ .gpio_pullup = GPIO41,
733+};
734+
735+static void __init verdex_udc_init(void)
736+{
737+ pxa_set_udc_info(&verdex_udc_info);
738+}
739+#else
740+static void __init verdex_udc_init(void)
741+{
742+ printk(KERN_INFO "Gumstix verdex udc is disabled\n");
743+}
744+#endif
745+
746+#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
747+
748+#if defined(CONFIG_TOUCHSCREEN_TSC2003) || defined(CONFIG_TOUCHSCREEN_TSC2003_MODULE)
749+
750+#define VERDEX_GPIO_PENDOWN 16
751+
752+static int tsc2003_init_platform_hw(void)
753+{
754+ return 0;
755+}
756+
757+static void tsc2003_exit_platform_hw(void)
758+{
759+ return;
760+}
761+
762+static void tsc2003_clear_penirq(void)
763+{
764+ return;
765+}
766+
767+static int tsc2003_get_pendown_state(void)
768+{
769+ return !gpio_get_value(VERDEX_GPIO_PENDOWN);
770+}
771+
772+static struct tsc2007_platform_data tsc2003_config = {
773+ .model = 2003,
774+ .x_plate_ohms = 100,
775+ .get_pendown_state = tsc2003_get_pendown_state,
776+ .clear_penirq = tsc2003_clear_penirq,
777+ .init_platform_hw = tsc2003_init_platform_hw,
778+ .exit_platform_hw = tsc2003_exit_platform_hw,
779+};
780+#endif
781+
782+static struct i2c_board_info __initdata verdex_i2c_board_info[] = {
783+#if defined(CONFIG_RTC_DRV_DS1307) || defined(CONFIG_RTC_DRV_DS1307_MODULE)
784+ {
785+ I2C_BOARD_INFO("rtc-ds1307", 0x68),
786+ },
787+#endif
788+#if defined(CONFIG_TOUCHSCREEN_TSC2003) || defined(CONFIG_TOUCHSCREEN_TSC2003_MODULE)
789+ {
790+ I2C_BOARD_INFO("tsc2003", 0x48),
791+ .platform_data = &tsc2003_config,
792+ .irq = IRQ_GPIO(VERDEX_GPIO_PENDOWN),
793+ },
794+#endif
795+};
796+
797+static struct i2c_pxa_platform_data verdex_i2c_pwr_info = {
798+ .fast_mode = 1,
799+};
800+
801+static struct i2c_pxa_platform_data verdex_i2c_info = {
802+ .fast_mode = 1,
803+};
804+
805+static void __init verdex_i2c_init(void)
806+{
807+ printk(KERN_INFO "Initializing Gumstix verdex i2c\n");
808+
809+#if defined(CONFIG_TOUCHSCREEN_TSC2003) || defined(CONFIG_TOUCHSCREEN_TSC2003_MODULE)
810+ if ((gpio_request(VERDEX_GPIO_PENDOWN, "TSC2003_PENDOWN") == 0) &&
811+ (gpio_direction_input(VERDEX_GPIO_PENDOWN) == 0)) {
812+ gpio_export(VERDEX_GPIO_PENDOWN, 0);
813+ } else {
814+ printk(KERN_ERR "could not obtain gpio for TSC2003_PENDOWN\n");
815+ return;
816+ }
817+#endif
818+
819+ i2c_register_board_info(0, verdex_i2c_board_info,
820+ ARRAY_SIZE(verdex_i2c_board_info));
821+ pxa_set_i2c_info(&verdex_i2c_info);
822+ pxa27x_set_i2c_power_info(&verdex_i2c_pwr_info);
823+}
824+#else
825+static inline void verdex_i2c_init(void) {}
826+#endif
827+
828+#if defined(CONFIG_PCMCIA_PXA2XX) || defined(CONFIG_PCMCIA_PXA2XX_MODULE)
829+static void __init verdex_pcmcia_init(void)
830+{
831+ verdex_pcmcia_pin_config();
832+}
833+#else
834+static void __init verdex_pcmcia_init(void) {
835+ printk(KERN_INFO "Gumstix verdex pcmcia is disabled\n");
836+}
837+#endif
838+
839+
840+static void __init verdex_init(void)
841+{
842+ pxa2xx_mfp_config(ARRAY_AND_SIZE(verdex_pin_config));
843+
844+#ifdef CONFIG_FB_PXA_SHARP_LQ043_PSP
845+ /* DISP must be always high while screen is on */
846+ gpio_direction_output(GPIO77, 0);
847+ gpio_set_value(GPIO77, 1);
848+#endif
849+ verdex_udc_init();
850+ verdex_mmc_init();
851+ verdex_ohci_init();
852+ verdex_i2c_init();
853+ verdex_init_smsc911x();
854+ verdex_pcmcia_init();
855+
856+#if defined(CONFIG_FB_PXA_ALPS_CDOLLAR) || defined(CONFIG_FB_PXA_SHARP_LQ043_PSP) || defined(CONFIG_FB_PXA_SAMSUNG_LTE430WQ_F0C)
857+ printk(KERN_INFO "Initializing Gumstix verdex FB info\n");
858+ set_pxa_fb_info(&gumstix_fb_info);
859+#endif
860+ printk(KERN_INFO "Initializing Gumstix platform_add_devices\n");
861+ (void) platform_add_devices(devices, ARRAY_SIZE(devices));
862+}
863+
864+MACHINE_START(GUMSTIX, "Gumstix verdex")
865+ .atag_offset = 0x100, /* match u-boot bi_boot_params */
866+ .map_io = pxa27x_map_io,
867+ .init_irq = pxa27x_init_irq,
868+ .handle_irq = pxa27x_handle_irq,
869+ .timer = &pxa_timer,
870+ .init_machine = verdex_init,
871+ .restart = pxa_restart,
872+MACHINE_END
873--- a/arch/arm/mach-pxa/include/mach/mfp-pxa27x.h
874+++ b/arch/arm/mach-pxa/include/mach/mfp-pxa27x.h
875@@ -109,6 +109,7 @@
876 #define GPIO54_nPCE_2 MFP_CFG_OUT(GPIO54, AF2, DRIVE_HIGH)
877 #define GPIO78_nPCE_2 MFP_CFG_OUT(GPIO78, AF1, DRIVE_HIGH)
878 #define GPIO87_nPCE_2 MFP_CFG_IN(GPIO87, AF1)
879+#define GPIO105_nPCE_2 MFP_CFG_OUT(GPIO105, AF1, DRIVE_HIGH)
880 #define GPIO55_nPREG MFP_CFG_OUT(GPIO55, AF2, DRIVE_HIGH)
881 #define GPIO50_nPIOR MFP_CFG_OUT(GPIO50, AF2, DRIVE_HIGH)
882 #define GPIO51_nPIOW MFP_CFG_OUT(GPIO51, AF2, DRIVE_HIGH)
883

Archive Download this file



interactive