2 * linux/arch/arm/mach-omap2/board-omap3logic.c
4 * Copyright (C) 2010 Li-Pro.Net
5 * Stephan Linz <linz@li-pro.net>
7 * Copyright (C) 2010 Logic Product Development, Inc.
8 * Peter Barada <peter.barada@logicpd.com>
10 * Modified from Beagle, EVM, and RX51
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License version 2 as
14 * published by the Free Software Foundation.
17 #include <linux/kernel.h>
18 #include <linux/init.h>
19 #include <linux/platform_device.h>
20 #include <linux/delay.h>
21 #include <linux/err.h>
22 #include <linux/clk.h>
24 #include <linux/gpio.h>
26 #include <linux/regulator/machine.h>
28 #include <linux/i2c/twl.h>
29 #include <linux/mmc/host.h>
31 #include <mach/hardware.h>
32 #include <asm/mach-types.h>
33 #include <asm/mach/arch.h>
34 #include <asm/mach/map.h>
40 #include <plat/board.h>
41 #include <plat/common.h>
42 #include <plat/gpmc.h>
43 #include <plat/timer-gp.h>
44 #include <plat/sdrc.h>
45 #include <plat/control.h>
47 #define OMAP3LOGIC_SMSC911X_CS 1
49 #define OMAP3530_LV_SOM_MMC_GPIO_CD 110
50 #define OMAP3530_LV_SOM_MMC_GPIO_WP 126
51 #define OMAP3530_LV_SOM_SMSC911X_GPIO_IRQ 152
53 #define OMAP3_TORPEDO_MMC_GPIO_CD 127
54 #define OMAP3_TORPEDO_SMSC911X_GPIO_IRQ 129
56 static struct regulator_consumer_supply omap3logic_vmmc1_supply
= {
60 /* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */
61 static struct regulator_init_data omap3logic_vmmc1
= {
66 .valid_modes_mask
= REGULATOR_MODE_NORMAL
67 | REGULATOR_MODE_STANDBY
,
68 .valid_ops_mask
= REGULATOR_CHANGE_VOLTAGE
69 | REGULATOR_CHANGE_MODE
70 | REGULATOR_CHANGE_STATUS
,
72 .num_consumer_supplies
= 1,
73 .consumer_supplies
= &omap3logic_vmmc1_supply
,
76 static struct twl4030_gpio_platform_data omap3logic_gpio_data
= {
77 .gpio_base
= OMAP_MAX_GPIO_LINES
,
78 .irq_base
= TWL4030_GPIO_IRQ_BASE
,
79 .irq_end
= TWL4030_GPIO_IRQ_END
,
82 .pulldowns
= BIT(2) | BIT(6) | BIT(7) | BIT(8)
83 | BIT(13) | BIT(15) | BIT(16) | BIT(17),
86 static struct twl4030_platform_data omap3logic_twldata
= {
87 .irq_base
= TWL4030_IRQ_BASE
,
88 .irq_end
= TWL4030_IRQ_END
,
90 /* platform_data for children goes here */
91 .gpio
= &omap3logic_gpio_data
,
92 .vmmc1
= &omap3logic_vmmc1
,
95 static struct i2c_board_info __initdata omap3logic_i2c_boardinfo
[] = {
97 I2C_BOARD_INFO("twl4030", 0x48),
98 .flags
= I2C_CLIENT_WAKE
,
99 .irq
= INT_34XX_SYS_NIRQ
,
100 .platform_data
= &omap3logic_twldata
,
104 static int __init
omap3logic_i2c_init(void)
106 omap_register_i2c_bus(1, 2600, omap3logic_i2c_boardinfo
,
107 ARRAY_SIZE(omap3logic_i2c_boardinfo
));
111 static struct omap2_hsmmc_info __initdata board_mmc_info
[] = {
115 .caps
= MMC_CAP_4_BIT_DATA
,
122 static void __init
board_mmc_init(void)
124 if (machine_is_omap3530_lv_som()) {
125 /* OMAP3530 LV SOM board */
126 board_mmc_info
[0].gpio_cd
= OMAP3530_LV_SOM_MMC_GPIO_CD
;
127 board_mmc_info
[0].gpio_wp
= OMAP3530_LV_SOM_MMC_GPIO_WP
;
128 omap_mux_init_signal("gpio_110", OMAP_PIN_OUTPUT
);
129 omap_mux_init_signal("gpio_126", OMAP_PIN_OUTPUT
);
130 } else if (machine_is_omap3_torpedo()) {
131 /* OMAP3 Torpedo board */
132 board_mmc_info
[0].gpio_cd
= OMAP3_TORPEDO_MMC_GPIO_CD
;
133 omap_mux_init_signal("gpio_127", OMAP_PIN_OUTPUT
);
135 /* unsupported board */
136 printk(KERN_ERR
"%s(): unknown machine type\n", __func__
);
140 omap2_hsmmc_init(board_mmc_info
);
141 /* link regulators to MMC adapters */
142 omap3logic_vmmc1_supply
.dev
= board_mmc_info
[0].dev
;
145 static void __init
omap3logic_init_irq(void)
147 omap2_init_common_hw(NULL
, NULL
);
152 static void __init
omap3logic_init(void)
154 omap3logic_i2c_init();
157 /* Ensure SDRC pins are mux'd for self-refresh */
158 omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT
);
159 omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT
);
162 MACHINE_START(OMAP3_TORPEDO
, "Logic OMAP3 Torpedo board")
163 .phys_io
= 0x48000000,
164 .io_pg_offst
= ((0xd8000000) >> 18) & 0xfffc,
165 .boot_params
= 0x80000100,
166 .map_io
= omap3_map_io
,
167 .init_irq
= omap3logic_init_irq
,
168 .init_machine
= omap3logic_init
,
169 .timer
= &omap_timer
,
172 MACHINE_START(OMAP3530_LV_SOM
, "OMAP Logic 3530 LV SOM board")
173 .phys_io
= 0x48000000,
174 .io_pg_offst
= ((0xd8000000) >> 18) & 0xfffc,
175 .boot_params
= 0x80000100,
176 .map_io
= omap3_map_io
,
177 .init_irq
= omap3logic_init_irq
,
178 .init_machine
= omap3logic_init
,
179 .timer
= &omap_timer
,