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