15 #define pr_fmt(fmt) "%s: " fmt, __func__
17 #include <linux/module.h>
18 #include <linux/kernel.h>
31 #include <linux/i2c.h>
46 #include <asm/setup.h>
63 #define CM_X300_ETH_PHYS 0x08000010
65 #define GPIO82_MMC_IRQ (82)
66 #define GPIO85_MMC_WP (85)
68 #define CM_X300_MMC_IRQ PXA_GPIO_TO_IRQ(GPIO82_MMC_IRQ)
70 #define GPIO95_RTC_CS (95)
71 #define GPIO96_RTC_WR (96)
72 #define GPIO97_RTC_RD (97)
73 #define GPIO98_RTC_IO (98)
75 #define GPIO_ULPI_PHY_RST (127)
198 GPIO30_ULPI_DATA_OUT_0,
199 GPIO31_ULPI_DATA_OUT_1,
200 GPIO32_ULPI_DATA_OUT_2,
201 GPIO33_ULPI_DATA_OUT_3,
202 GPIO34_ULPI_DATA_OUT_4,
203 GPIO35_ULPI_DATA_OUT_5,
204 GPIO36_ULPI_DATA_OUT_6,
205 GPIO37_ULPI_DATA_OUT_7,
220 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
221 static struct resource dm9000_resources[] = {
246 .num_resources =
ARRAY_SIZE(dm9000_resources),
247 .resource = dm9000_resources,
249 .platform_data = &cm_x300_dm9000_platdata,
254 static void __init cm_x300_init_dm9000(
void)
259 static inline void cm_x300_init_dm9000(
void) {}
263 #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
294 .
modes = cm_x300_lcd_modes,
299 static void __init cm_x300_init_lcd(
void)
304 static inline void cm_x300_init_lcd(
void) {}
307 #if defined(CONFIG_BACKLIGHT_PWM) || defined(CONFIG_BACKLIGHT_PWM_MODULE)
310 .max_brightness = 100,
311 .dft_brightness = 100,
312 .pwm_period_ns = 10000,
316 .
name =
"pwm-backlight",
319 .platform_data = &cm_x300_backlight_data,
323 static void cm_x300_init_bl(
void)
328 static inline void cm_x300_init_bl(
void) {}
331 #if defined(CONFIG_SPI_GPIO) || defined(CONFIG_SPI_GPIO_MODULE)
332 #define GPIO_LCD_BASE (144)
333 #define GPIO_LCD_DIN (GPIO_LCD_BASE + 8)
334 #define GPIO_LCD_DOUT (GPIO_LCD_BASE + 9)
335 #define GPIO_LCD_SCL (GPIO_LCD_BASE + 10)
336 #define GPIO_LCD_CS (GPIO_LCD_BASE + 11)
337 #define LCD_SPI_BUS_NUM (1)
341 .mosi = GPIO_LCD_DIN,
342 .miso = GPIO_LCD_DOUT,
348 .id = LCD_SPI_BUS_NUM,
350 .platform_data = &cm_x300_spi_gpio_pdata,
360 .modalias =
"tdo24m",
361 .max_speed_hz = 1000000,
362 .bus_num = LCD_SPI_BUS_NUM,
364 .controller_data = (
void *) GPIO_LCD_CS,
369 static void __init cm_x300_init_spi(
void)
376 static inline void cm_x300_init_spi(
void) {}
379 #if defined(CONFIG_SND_PXA2XX_LIB_AC97)
380 static void __init cm_x300_init_ac97(
void)
385 static inline void cm_x300_init_ac97(
void) {}
388 #if defined(CONFIG_MTD_NAND_PXA3xx) || defined(CONFIG_MTD_NAND_PXA3xx_MODULE)
403 .name =
"Environment",
429 .parts[0] = cm_x300_nand_partitions,
430 .nr_parts[0] =
ARRAY_SIZE(cm_x300_nand_partitions),
433 static void __init cm_x300_init_nand(
void)
438 static inline void cm_x300_init_nand(
void) {}
441 #if defined(CONFIG_MMC) || defined(CONFIG_MMC_MODULE)
452 static int cm_x300_mci2_init(
struct device *
dev,
459 static void cm_x300_mci2_exit(
struct device *
dev,
void *
data)
466 .init = cm_x300_mci2_init,
467 .exit = cm_x300_mci2_exit,
468 .gpio_card_detect = -1,
473 static void __init cm_x300_init_mmc(
void)
479 static inline void cm_x300_init_mmc(
void) {}
482 #if defined(CONFIG_PXA310_ULPI)
483 static struct clk *pout_clk;
485 static int cm_x300_ulpi_phy_reset(
void)
493 pr_err(
"failed to request ULPI reset GPIO: %d\n", err);
506 static inline int cm_x300_u2d_init(
struct device *
dev)
513 if (IS_ERR(pout_clk)) {
514 err = PTR_ERR(pout_clk);
515 pr_err(
"failed to get CLK_POUT: %d\n", err);
520 err = cm_x300_ulpi_phy_reset();
530 static void cm_x300_u2d_exit(
struct device *dev)
540 .init = cm_x300_u2d_init,
541 .exit = cm_x300_u2d_exit,
544 static void cm_x300_init_u2d(
void)
549 static inline void cm_x300_init_u2d(
void) {}
552 #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
553 static int cm_x300_ohci_init(
struct device *dev)
565 .init = cm_x300_ohci_init,
568 static void __init cm_x300_init_ohci(
void)
573 static inline void cm_x300_init_ohci(
void) {}
576 #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
577 static struct gpio_led cm_x300_leds[] = {
579 .
name =
"cm-x300:green",
580 .default_trigger =
"heartbeat",
587 .leds = cm_x300_leds,
594 .platform_data = &cm_x300_gpio_led_pdata,
598 static void __init cm_x300_init_leds(
void)
601 cm_x300_leds[0].
gpio = 79;
603 cm_x300_leds[0].
gpio = 76;
608 static inline void cm_x300_init_leds(
void) {}
611 #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
624 .platform_data = &cm_x300_gpio_ext_pdata_0,
628 .platform_data = &cm_x300_gpio_ext_pdata_1,
632 static void __init cm_x300_init_i2c(
void)
639 static inline void cm_x300_init_i2c(
void) {}
642 #if defined(CONFIG_RTC_DRV_V3020) || defined(CONFIG_RTC_DRV_V3020_MODULE)
655 .platform_data = &cm_x300_v3020_pdata,
659 static void __init cm_x300_init_rtc(
void)
664 static inline void cm_x300_init_rtc(
void) {}
671 .voltage_max_design = 4200000,
672 .voltage_min_design = 3000000,
676 static void cm_x300_battery_low(
void)
678 #if defined(CONFIG_APM_EMULATION)
683 static void cm_x300_battery_critical(
void)
685 #if defined(CONFIG_APM_EMULATION)
693 .charge_milliamp = 1000,
694 .charge_millivolt = 4200,
698 .vbat_charge_start = 4100,
699 .vbat_charge_stop = 4200,
700 .vbat_charge_restart = 4000,
709 .batmon_interval = 0,
711 .battery_low = cm_x300_battery_low,
712 .battery_critical = cm_x300_battery_critical,
729 .num_consumer_supplies =
ARRAY_SIZE(buck2_consumers),
730 .consumer_supplies = buck2_consumers,
736 .name =
"da903x-battery",
741 .name =
"da903x-regulator",
743 .platform_data = &buck2_data,
748 .num_subdevs =
ARRAY_SIZE(cm_x300_da9030_subdevs),
755 .platform_data = &cm_x300_da9030_info,
762 static void __init cm_x300_init_da9030(
void)
770 static struct gpio cm_x300_wi2wi_gpios[] __initdata = {
775 static void __init cm_x300_init_wi2wi(
void)
780 cm_x300_wi2wi_gpios[0].gpio = 77;
781 cm_x300_wi2wi_gpios[1].gpio = 78;
787 pr_err(
"failed to request wifi/bt gpios: %d\n", err);
800 static void __init cm_x300_init_mfp(
void)
814 static void __init cm_x300_init(
void)
823 cm_x300_init_da9030();
824 cm_x300_init_dm9000();
835 cm_x300_init_wi2wi();
845 tags->
u.
mem.start == 0x80000000) {
846 tags->
u.
mem.start = 0xa0000000;
852 .atag_offset = 0x100,
858 .init_machine = cm_x300_init,
859 .fixup = cm_x300_fixup,