aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-pxa/cm-x300.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-pxa/cm-x300.c')
-rw-r--r--arch/arm/mach-pxa/cm-x300.c260
1 files changed, 249 insertions, 11 deletions
diff --git a/arch/arm/mach-pxa/cm-x300.c b/arch/arm/mach-pxa/cm-x300.c
index 102916f1e465..d37cfa132a65 100644
--- a/arch/arm/mach-pxa/cm-x300.c
+++ b/arch/arm/mach-pxa/cm-x300.c
@@ -3,9 +3,10 @@
3 * 3 *
4 * Support for the CompuLab CM-X300 modules 4 * Support for the CompuLab CM-X300 modules
5 * 5 *
6 * Copyright (C) 2008 CompuLab Ltd. 6 * Copyright (C) 2008,2009 CompuLab Ltd.
7 * 7 *
8 * Mike Rapoport <mike@compulab.co.il> 8 * Mike Rapoport <mike@compulab.co.il>
9 * Igor Grinberg <grinberg@compulab.co.il>
9 * 10 *
10 * This program is free software; you can redistribute it and/or modify 11 * 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 * it under the terms of the GNU General Public License version 2 as
@@ -16,30 +17,41 @@
16#include <linux/kernel.h> 17#include <linux/kernel.h>
17#include <linux/interrupt.h> 18#include <linux/interrupt.h>
18#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/delay.h>
19#include <linux/platform_device.h> 21#include <linux/platform_device.h>
20 22
21#include <linux/gpio.h> 23#include <linux/gpio.h>
22#include <linux/dm9000.h> 24#include <linux/dm9000.h>
23#include <linux/leds.h> 25#include <linux/leds.h>
24#include <linux/rtc-v3020.h> 26#include <linux/rtc-v3020.h>
27#include <linux/pwm_backlight.h>
25 28
26#include <linux/i2c.h> 29#include <linux/i2c.h>
27#include <linux/i2c/pca953x.h> 30#include <linux/i2c/pca953x.h>
28 31
32#include <linux/mfd/da903x.h>
33
34#include <linux/spi/spi.h>
35#include <linux/spi/spi_gpio.h>
36#include <linux/spi/tdo24m.h>
37
29#include <asm/mach-types.h> 38#include <asm/mach-types.h>
30#include <asm/mach/arch.h> 39#include <asm/mach/arch.h>
31#include <asm/setup.h> 40#include <asm/setup.h>
32 41
33#include <mach/pxa300.h> 42#include <mach/pxa300.h>
43#include <mach/pxa27x-udc.h>
34#include <mach/pxafb.h> 44#include <mach/pxafb.h>
35#include <mach/mmc.h> 45#include <mach/mmc.h>
36#include <mach/ohci.h> 46#include <mach/ohci.h>
37#include <plat/i2c.h> 47#include <plat/i2c.h>
38#include <mach/pxa3xx_nand.h> 48#include <plat/pxa3xx_nand.h>
49#include <mach/audio.h>
39 50
40#include <asm/mach/map.h> 51#include <asm/mach/map.h>
41 52
42#include "generic.h" 53#include "generic.h"
54#include "devices.h"
43 55
44#define CM_X300_ETH_PHYS 0x08000010 56#define CM_X300_ETH_PHYS 0x08000010
45 57
@@ -53,7 +65,7 @@
53#define GPIO97_RTC_RD (97) 65#define GPIO97_RTC_RD (97)
54#define GPIO98_RTC_IO (98) 66#define GPIO98_RTC_IO (98)
55 67
56static mfp_cfg_t cm_x300_mfp_cfg[] __initdata = { 68static mfp_cfg_t cm_x3xx_mfp_cfg[] __initdata = {
57 /* LCD */ 69 /* LCD */
58 GPIO54_LCD_LDD_0, 70 GPIO54_LCD_LDD_0,
59 GPIO55_LCD_LDD_1, 71 GPIO55_LCD_LDD_1,
@@ -137,7 +149,6 @@ static mfp_cfg_t cm_x300_mfp_cfg[] __initdata = {
137 GPIO36_UART1_DTR, 149 GPIO36_UART1_DTR,
138 150
139 /* GPIOs */ 151 /* GPIOs */
140 GPIO79_GPIO, /* LED */
141 GPIO82_GPIO | MFP_PULL_HIGH, /* MMC CD */ 152 GPIO82_GPIO | MFP_PULL_HIGH, /* MMC CD */
142 GPIO85_GPIO, /* MMC WP */ 153 GPIO85_GPIO, /* MMC WP */
143 GPIO99_GPIO, /* Ethernet IRQ */ 154 GPIO99_GPIO, /* Ethernet IRQ */
@@ -151,6 +162,50 @@ static mfp_cfg_t cm_x300_mfp_cfg[] __initdata = {
151 /* Standard I2C */ 162 /* Standard I2C */
152 GPIO21_I2C_SCL, 163 GPIO21_I2C_SCL,
153 GPIO22_I2C_SDA, 164 GPIO22_I2C_SDA,
165
166 /* PWM Backlight */
167 GPIO19_PWM2_OUT,
168};
169
170static mfp_cfg_t cm_x3xx_rev_lt130_mfp_cfg[] __initdata = {
171 /* GPIOs */
172 GPIO79_GPIO, /* LED */
173 GPIO77_GPIO, /* WiFi reset */
174 GPIO78_GPIO, /* BT reset */
175};
176
177static mfp_cfg_t cm_x3xx_rev_ge130_mfp_cfg[] __initdata = {
178 /* GPIOs */
179 GPIO76_GPIO, /* LED */
180 GPIO71_GPIO, /* WiFi reset */
181 GPIO70_GPIO, /* BT reset */
182};
183
184static mfp_cfg_t cm_x310_mfp_cfg[] __initdata = {
185 /* USB PORT 2 */
186 ULPI_STP,
187 ULPI_NXT,
188 ULPI_DIR,
189 GPIO30_ULPI_DATA_OUT_0,
190 GPIO31_ULPI_DATA_OUT_1,
191 GPIO32_ULPI_DATA_OUT_2,
192 GPIO33_ULPI_DATA_OUT_3,
193 GPIO34_ULPI_DATA_OUT_4,
194 GPIO35_ULPI_DATA_OUT_5,
195 GPIO36_ULPI_DATA_OUT_6,
196 GPIO37_ULPI_DATA_OUT_7,
197 GPIO38_ULPI_CLK,
198 /* external PHY reset pin */
199 GPIO127_GPIO,
200
201 /* USB PORT 3 */
202 GPIO77_USB_P3_1,
203 GPIO78_USB_P3_2,
204 GPIO79_USB_P3_3,
205 GPIO80_USB_P3_4,
206 GPIO81_USB_P3_5,
207 GPIO82_USB_P3_6,
208 GPIO0_2_USBH_PEN,
154}; 209};
155 210
156#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE) 211#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
@@ -195,17 +250,18 @@ static void __init cm_x300_init_dm9000(void)
195static inline void cm_x300_init_dm9000(void) {} 250static inline void cm_x300_init_dm9000(void) {}
196#endif 251#endif
197 252
253/* LCD */
198#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE) 254#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
199static struct pxafb_mode_info cm_x300_lcd_modes[] = { 255static struct pxafb_mode_info cm_x300_lcd_modes[] = {
200 [0] = { 256 [0] = {
201 .pixclock = 38000, 257 .pixclock = 38250,
202 .bpp = 16, 258 .bpp = 16,
203 .xres = 480, 259 .xres = 480,
204 .yres = 640, 260 .yres = 640,
205 .hsync_len = 8, 261 .hsync_len = 8,
206 .vsync_len = 2, 262 .vsync_len = 2,
207 .left_margin = 8, 263 .left_margin = 8,
208 .upper_margin = 0, 264 .upper_margin = 2,
209 .right_margin = 24, 265 .right_margin = 24,
210 .lower_margin = 4, 266 .lower_margin = 4,
211 .cmap_greyscale = 0, 267 .cmap_greyscale = 0,
@@ -227,7 +283,7 @@ static struct pxafb_mode_info cm_x300_lcd_modes[] = {
227 283
228static struct pxafb_mach_info cm_x300_lcd = { 284static struct pxafb_mach_info cm_x300_lcd = {
229 .modes = cm_x300_lcd_modes, 285 .modes = cm_x300_lcd_modes,
230 .num_modes = 2, 286 .num_modes = ARRAY_SIZE(cm_x300_lcd_modes),
231 .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL, 287 .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
232}; 288};
233 289
@@ -239,6 +295,87 @@ static void __init cm_x300_init_lcd(void)
239static inline void cm_x300_init_lcd(void) {} 295static inline void cm_x300_init_lcd(void) {}
240#endif 296#endif
241 297
298#if defined(CONFIG_BACKLIGHT_PWM) || defined(CONFIG_BACKLIGHT_PWM_MODULE)
299static struct platform_pwm_backlight_data cm_x300_backlight_data = {
300 .pwm_id = 2,
301 .max_brightness = 100,
302 .dft_brightness = 100,
303 .pwm_period_ns = 10000,
304};
305
306static struct platform_device cm_x300_backlight_device = {
307 .name = "pwm-backlight",
308 .dev = {
309 .parent = &pxa27x_device_pwm0.dev,
310 .platform_data = &cm_x300_backlight_data,
311 },
312};
313
314static void cm_x300_init_bl(void)
315{
316 platform_device_register(&cm_x300_backlight_device);
317}
318#else
319static inline void cm_x300_init_bl(void) {}
320#endif
321
322#if defined(CONFIG_SPI_GPIO) || defined(CONFIG_SPI_GPIO_MODULE)
323#define GPIO_LCD_BASE (144)
324#define GPIO_LCD_DIN (GPIO_LCD_BASE + 8) /* aux_gpio3_0 */
325#define GPIO_LCD_DOUT (GPIO_LCD_BASE + 9) /* aux_gpio3_1 */
326#define GPIO_LCD_SCL (GPIO_LCD_BASE + 10) /* aux_gpio3_2 */
327#define GPIO_LCD_CS (GPIO_LCD_BASE + 11) /* aux_gpio3_3 */
328#define LCD_SPI_BUS_NUM (1)
329
330static struct spi_gpio_platform_data cm_x300_spi_gpio_pdata = {
331 .sck = GPIO_LCD_SCL,
332 .mosi = GPIO_LCD_DIN,
333 .miso = GPIO_LCD_DOUT,
334 .num_chipselect = 1,
335};
336
337static struct platform_device cm_x300_spi_gpio = {
338 .name = "spi_gpio",
339 .id = LCD_SPI_BUS_NUM,
340 .dev = {
341 .platform_data = &cm_x300_spi_gpio_pdata,
342 },
343};
344
345static struct tdo24m_platform_data cm_x300_tdo24m_pdata = {
346 .model = TDO35S,
347};
348
349static struct spi_board_info cm_x300_spi_devices[] __initdata = {
350 {
351 .modalias = "tdo24m",
352 .max_speed_hz = 1000000,
353 .bus_num = LCD_SPI_BUS_NUM,
354 .chip_select = 0,
355 .controller_data = (void *) GPIO_LCD_CS,
356 .platform_data = &cm_x300_tdo24m_pdata,
357 },
358};
359
360static void __init cm_x300_init_spi(void)
361{
362 spi_register_board_info(cm_x300_spi_devices,
363 ARRAY_SIZE(cm_x300_spi_devices));
364 platform_device_register(&cm_x300_spi_gpio);
365}
366#else
367static inline void cm_x300_init_spi(void) {}
368#endif
369
370#if defined(CONFIG_SND_PXA2XX_LIB_AC97)
371static void __init cm_x300_init_ac97(void)
372{
373 pxa_set_ac97_info(NULL);
374}
375#else
376static inline void cm_x300_init_ac97(void) {}
377#endif
378
242#if defined(CONFIG_MTD_NAND_PXA3xx) || defined(CONFIG_MTD_NAND_PXA3xx_MODULE) 379#if defined(CONFIG_MTD_NAND_PXA3xx) || defined(CONFIG_MTD_NAND_PXA3xx_MODULE)
243static struct mtd_partition cm_x300_nand_partitions[] = { 380static struct mtd_partition cm_x300_nand_partitions[] = {
244 [0] = { 381 [0] = {
@@ -333,9 +470,19 @@ static inline void cm_x300_init_mmc(void) {}
333#endif 470#endif
334 471
335#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) 472#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
473static int cm_x300_ohci_init(struct device *dev)
474{
475 if (cpu_is_pxa300())
476 UP2OCR = UP2OCR_HXS
477 | UP2OCR_HXOE | UP2OCR_DMPDE | UP2OCR_DPPDE;
478
479 return 0;
480}
481
336static struct pxaohci_platform_data cm_x300_ohci_platform_data = { 482static struct pxaohci_platform_data cm_x300_ohci_platform_data = {
337 .port_mode = PMM_PERPORT_MODE, 483 .port_mode = PMM_PERPORT_MODE,
338 .flags = ENABLE_PORT1 | ENABLE_PORT2 | POWER_CONTROL_LOW, 484 .flags = ENABLE_PORT_ALL | POWER_CONTROL_LOW,
485 .init = cm_x300_ohci_init,
339}; 486};
340 487
341static void __init cm_x300_init_ohci(void) 488static void __init cm_x300_init_ohci(void)
@@ -351,7 +498,6 @@ static struct gpio_led cm_x300_leds[] = {
351 [0] = { 498 [0] = {
352 .name = "cm-x300:green", 499 .name = "cm-x300:green",
353 .default_trigger = "heartbeat", 500 .default_trigger = "heartbeat",
354 .gpio = 79,
355 .active_low = 1, 501 .active_low = 1,
356 }, 502 },
357}; 503};
@@ -371,6 +517,11 @@ static struct platform_device cm_x300_led_device = {
371 517
372static void __init cm_x300_init_leds(void) 518static void __init cm_x300_init_leds(void)
373{ 519{
520 if (system_rev < 130)
521 cm_x300_leds[0].gpio = 79;
522 else
523 cm_x300_leds[0].gpio = 76;
524
374 platform_device_register(&cm_x300_led_device); 525 platform_device_register(&cm_x300_led_device);
375} 526}
376#else 527#else
@@ -433,11 +584,94 @@ static void __init cm_x300_init_rtc(void)
433static inline void cm_x300_init_rtc(void) {} 584static inline void cm_x300_init_rtc(void) {}
434#endif 585#endif
435 586
436static void __init cm_x300_init(void) 587/* DA9030 */
588struct da903x_subdev_info cm_x300_da9030_subdevs[] = {
589 {
590 .name = "da903x-backlight",
591 .id = DA9030_ID_WLED,
592 }
593};
594
595static struct da903x_platform_data cm_x300_da9030_info = {
596 .num_subdevs = ARRAY_SIZE(cm_x300_da9030_subdevs),
597 .subdevs = cm_x300_da9030_subdevs,
598};
599
600static struct i2c_board_info cm_x300_pmic_info = {
601 I2C_BOARD_INFO("da9030", 0x49),
602 .irq = IRQ_GPIO(0),
603 .platform_data = &cm_x300_da9030_info,
604};
605
606static struct i2c_pxa_platform_data cm_x300_pwr_i2c_info = {
607 .use_pio = 1,
608};
609
610static void __init cm_x300_init_da9030(void)
611{
612 pxa3xx_set_i2c_power_info(&cm_x300_pwr_i2c_info);
613 i2c_register_board_info(1, &cm_x300_pmic_info, 1);
614}
615
616static void __init cm_x300_init_wi2wi(void)
617{
618 int bt_reset, wlan_en;
619 int err;
620
621 if (system_rev < 130) {
622 wlan_en = 77;
623 bt_reset = 78;
624 } else {
625 wlan_en = 71;
626 bt_reset = 70;
627 }
628
629 /* Libertas and CSR reset */
630 err = gpio_request(wlan_en, "wlan en");
631 if (err) {
632 pr_err("CM-X300: failed to request wlan en gpio: %d\n", err);
633 } else {
634 gpio_direction_output(wlan_en, 1);
635 gpio_free(wlan_en);
636 }
637
638 err = gpio_request(bt_reset, "bt reset");
639 if (err) {
640 pr_err("CM-X300: failed to request bt reset gpio: %d\n", err);
641 } else {
642 gpio_direction_output(bt_reset, 1);
643 udelay(10);
644 gpio_set_value(bt_reset, 0);
645 udelay(10);
646 gpio_set_value(bt_reset, 1);
647 gpio_free(bt_reset);
648 }
649}
650
651/* MFP */
652static void __init cm_x300_init_mfp(void)
437{ 653{
438 /* board-processor specific GPIO initialization */ 654 /* board-processor specific GPIO initialization */
439 pxa3xx_mfp_config(ARRAY_AND_SIZE(cm_x300_mfp_cfg)); 655 pxa3xx_mfp_config(ARRAY_AND_SIZE(cm_x3xx_mfp_cfg));
656
657 if (system_rev < 130)
658 pxa3xx_mfp_config(ARRAY_AND_SIZE(cm_x3xx_rev_lt130_mfp_cfg));
659 else
660 pxa3xx_mfp_config(ARRAY_AND_SIZE(cm_x3xx_rev_ge130_mfp_cfg));
661
662 if (cpu_is_pxa310())
663 pxa3xx_mfp_config(ARRAY_AND_SIZE(cm_x310_mfp_cfg));
664}
665
666static void __init cm_x300_init(void)
667{
668 cm_x300_init_mfp();
669
670 pxa_set_ffuart_info(NULL);
671 pxa_set_btuart_info(NULL);
672 pxa_set_stuart_info(NULL);
440 673
674 cm_x300_init_da9030();
441 cm_x300_init_dm9000(); 675 cm_x300_init_dm9000();
442 cm_x300_init_lcd(); 676 cm_x300_init_lcd();
443 cm_x300_init_ohci(); 677 cm_x300_init_ohci();
@@ -445,7 +679,11 @@ static void __init cm_x300_init(void)
445 cm_x300_init_nand(); 679 cm_x300_init_nand();
446 cm_x300_init_leds(); 680 cm_x300_init_leds();
447 cm_x300_init_i2c(); 681 cm_x300_init_i2c();
682 cm_x300_init_spi();
448 cm_x300_init_rtc(); 683 cm_x300_init_rtc();
684 cm_x300_init_ac97();
685 cm_x300_init_wi2wi();
686 cm_x300_init_bl();
449} 687}
450 688
451static void __init cm_x300_fixup(struct machine_desc *mdesc, struct tag *tags, 689static void __init cm_x300_fixup(struct machine_desc *mdesc, struct tag *tags,