ARM: OMAP: Remove unused old gpio-switch.h
[deliverable/linux.git] / arch / arm / mach-omap2 / board-omap3logic.c
CommitLineData
d40f3f15
TN
1/*
2 * linux/arch/arm/mach-omap2/board-omap3logic.c
3 *
4 * Copyright (C) 2010 Li-Pro.Net
5 * Stephan Linz <linz@li-pro.net>
6 *
44bb3198 7 * Copyright (C) 2010-2012 Logic Product Development, Inc.
d40f3f15 8 * Peter Barada <peter.barada@logicpd.com>
44bb3198 9 * Ashwin BIhari <ashwin.bihari@logicpd.com>
d40f3f15
TN
10 *
11 * Modified from Beagle, EVM, and RX51
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License version 2 as
15 * published by the Free Software Foundation.
16 */
17
18#include <linux/kernel.h>
19#include <linux/init.h>
20#include <linux/platform_device.h>
21#include <linux/delay.h>
22#include <linux/err.h>
23#include <linux/clk.h>
24#include <linux/io.h>
25#include <linux/gpio.h>
26
5b3689f4 27#include <linux/regulator/fixed.h>
d40f3f15
TN
28#include <linux/regulator/machine.h>
29
30#include <linux/i2c/twl.h>
8430281b 31#include <linux/mmc/host.h>
d40f3f15
TN
32
33#include <mach/hardware.h>
34#include <asm/mach-types.h>
35#include <asm/mach/arch.h>
36#include <asm/mach/map.h>
37
38#include "mux.h"
8430281b 39#include "hsmmc.h"
4814ced5 40#include "control.h"
fbd8071c 41#include "common-board-devices.h"
d40f3f15
TN
42
43#include <plat/mux.h>
4e65331c 44#include "common.h"
26428b5c 45#include <plat/gpmc-smsc911x.h>
d40f3f15 46#include <plat/gpmc.h>
d40f3f15 47#include <plat/sdrc.h>
44bb3198 48#include <plat/usb.h>
d40f3f15
TN
49
50#define OMAP3LOGIC_SMSC911X_CS 1
51
52#define OMAP3530_LV_SOM_MMC_GPIO_CD 110
53#define OMAP3530_LV_SOM_MMC_GPIO_WP 126
54#define OMAP3530_LV_SOM_SMSC911X_GPIO_IRQ 152
55
56#define OMAP3_TORPEDO_MMC_GPIO_CD 127
57#define OMAP3_TORPEDO_SMSC911X_GPIO_IRQ 129
58
786b01a8
OD
59static struct regulator_consumer_supply omap3logic_vmmc1_supply[] = {
60 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"),
d40f3f15
TN
61};
62
63/* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */
64static struct regulator_init_data omap3logic_vmmc1 = {
65 .constraints = {
66 .name = "VMMC1",
67 .min_uV = 1850000,
68 .max_uV = 3150000,
69 .valid_modes_mask = REGULATOR_MODE_NORMAL
70 | REGULATOR_MODE_STANDBY,
71 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
72 | REGULATOR_CHANGE_MODE
73 | REGULATOR_CHANGE_STATUS,
74 },
786b01a8
OD
75 .num_consumer_supplies = ARRAY_SIZE(omap3logic_vmmc1_supply),
76 .consumer_supplies = omap3logic_vmmc1_supply,
d40f3f15
TN
77};
78
79static struct twl4030_gpio_platform_data omap3logic_gpio_data = {
d40f3f15
TN
80 .use_leds = true,
81 .pullups = BIT(1),
82 .pulldowns = BIT(2) | BIT(6) | BIT(7) | BIT(8)
83 | BIT(13) | BIT(15) | BIT(16) | BIT(17),
84};
85
44bb3198
AB
86static struct twl4030_usb_data omap3logic_usb_data = {
87 .usb_mode = T2_USB_MODE_ULPI,
88};
89
90
d40f3f15 91static struct twl4030_platform_data omap3logic_twldata = {
d40f3f15
TN
92 /* platform_data for children goes here */
93 .gpio = &omap3logic_gpio_data,
8430281b 94 .vmmc1 = &omap3logic_vmmc1,
44bb3198 95 .usb = &omap3logic_usb_data,
d40f3f15
TN
96};
97
d40f3f15
TN
98static int __init omap3logic_i2c_init(void)
99{
fbd8071c 100 omap3_pmic_init("twl4030", &omap3logic_twldata);
d40f3f15
TN
101 return 0;
102}
103
8430281b
TN
104static struct omap2_hsmmc_info __initdata board_mmc_info[] = {
105 {
106 .name = "external",
107 .mmc = 1,
108 .caps = MMC_CAP_4_BIT_DATA,
109 .gpio_cd = -EINVAL,
110 .gpio_wp = -EINVAL,
111 },
112 {} /* Terminator */
113};
114
115static void __init board_mmc_init(void)
116{
117 if (machine_is_omap3530_lv_som()) {
118 /* OMAP3530 LV SOM board */
119 board_mmc_info[0].gpio_cd = OMAP3530_LV_SOM_MMC_GPIO_CD;
120 board_mmc_info[0].gpio_wp = OMAP3530_LV_SOM_MMC_GPIO_WP;
121 omap_mux_init_signal("gpio_110", OMAP_PIN_OUTPUT);
122 omap_mux_init_signal("gpio_126", OMAP_PIN_OUTPUT);
123 } else if (machine_is_omap3_torpedo()) {
124 /* OMAP3 Torpedo board */
125 board_mmc_info[0].gpio_cd = OMAP3_TORPEDO_MMC_GPIO_CD;
126 omap_mux_init_signal("gpio_127", OMAP_PIN_OUTPUT);
127 } else {
128 /* unsupported board */
129 printk(KERN_ERR "%s(): unknown machine type\n", __func__);
130 return;
131 }
132
3b972bf0 133 omap_hsmmc_init(board_mmc_info);
8430281b
TN
134}
135
26428b5c
TN
136static struct omap_smsc911x_platform_data __initdata board_smsc911x_data = {
137 .cs = OMAP3LOGIC_SMSC911X_CS,
138 .gpio_irq = -EINVAL,
139 .gpio_reset = -EINVAL,
26428b5c
TN
140};
141
142/* TODO/FIXME (comment by Peter Barada, LogicPD):
143 * Fix the PBIAS voltage for Torpedo MMC1 pins that
144 * are used for other needs (IRQs, etc). */
145static void omap3torpedo_fix_pbias_voltage(void)
146{
147 u16 control_pbias_offset = OMAP343X_CONTROL_PBIAS_LITE;
148 u32 reg;
149
150 if (machine_is_omap3_torpedo())
151 {
152 /* Set the bias for the pin */
153 reg = omap_ctrl_readl(control_pbias_offset);
154
155 reg &= ~OMAP343X_PBIASLITEPWRDNZ1;
156 omap_ctrl_writel(reg, control_pbias_offset);
157
158 /* 100ms delay required for PBIAS configuration */
159 msleep(100);
160
161 reg |= OMAP343X_PBIASLITEVMODE1;
162 reg |= OMAP343X_PBIASLITEPWRDNZ1;
163 omap_ctrl_writel(reg | 0x300, control_pbias_offset);
164 }
165}
166
167static inline void __init board_smsc911x_init(void)
168{
169 if (machine_is_omap3530_lv_som()) {
170 /* OMAP3530 LV SOM board */
171 board_smsc911x_data.gpio_irq =
172 OMAP3530_LV_SOM_SMSC911X_GPIO_IRQ;
173 omap_mux_init_signal("gpio_152", OMAP_PIN_INPUT);
174 } else if (machine_is_omap3_torpedo()) {
175 /* OMAP3 Torpedo board */
176 board_smsc911x_data.gpio_irq = OMAP3_TORPEDO_SMSC911X_GPIO_IRQ;
177 omap_mux_init_signal("gpio_129", OMAP_PIN_INPUT);
178 } else {
179 /* unsupported board */
180 printk(KERN_ERR "%s(): unknown machine type\n", __func__);
181 return;
182 }
183
184 gpmc_smsc911x_init(&board_smsc911x_data);
185}
186
26428b5c
TN
187#ifdef CONFIG_OMAP_MUX
188static struct omap_board_mux board_mux[] __initdata = {
44bb3198
AB
189 /* mUSB */
190 OMAP3_MUX(HSUSB0_CLK, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
191 OMAP3_MUX(HSUSB0_STP, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
192 OMAP3_MUX(HSUSB0_DIR, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
193 OMAP3_MUX(HSUSB0_NXT, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
194 OMAP3_MUX(HSUSB0_DATA0, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
195 OMAP3_MUX(HSUSB0_DATA1, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
196 OMAP3_MUX(HSUSB0_DATA2, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
197 OMAP3_MUX(HSUSB0_DATA3, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
198 OMAP3_MUX(HSUSB0_DATA4, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
199 OMAP3_MUX(HSUSB0_DATA5, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
200 OMAP3_MUX(HSUSB0_DATA6, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
201 OMAP3_MUX(HSUSB0_DATA7, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
202
26428b5c
TN
203 { .reg_offset = OMAP_MUX_TERMINATOR },
204};
26428b5c
TN
205#endif
206
5b3689f4
RD
207static struct regulator_consumer_supply dummy_supplies[] = {
208 REGULATOR_SUPPLY("vddvario", "smsc911x.0"),
209 REGULATOR_SUPPLY("vdd33a", "smsc911x.0"),
210};
211
d40f3f15
TN
212static void __init omap3logic_init(void)
213{
5b3689f4 214 regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies));
26428b5c
TN
215 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
216 omap3torpedo_fix_pbias_voltage();
d40f3f15
TN
217 omap3logic_i2c_init();
218 omap_serial_init();
a4ca9dbe 219 omap_sdrc_init(NULL, NULL);
8430281b 220 board_mmc_init();
26428b5c
TN
221 board_smsc911x_init();
222
44bb3198
AB
223 usb_musb_init(NULL);
224
d40f3f15
TN
225 /* Ensure SDRC pins are mux'd for self-refresh */
226 omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT);
227 omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT);
228}
229
230MACHINE_START(OMAP3_TORPEDO, "Logic OMAP3 Torpedo board")
5e52b435 231 .atag_offset = 0x100,
afbb1893 232 .reserve = omap_reserve,
d40f3f15 233 .map_io = omap3_map_io,
8f5b5a41 234 .init_early = omap35xx_init_early,
741e3a89 235 .init_irq = omap3_init_irq,
6b2f55d7 236 .handle_irq = omap3_intc_handle_irq,
d40f3f15 237 .init_machine = omap3logic_init,
bbd707ac 238 .init_late = omap35xx_init_late,
e74984e4 239 .timer = &omap3_timer,
baa95883 240 .restart = omap_prcm_restart,
d40f3f15
TN
241MACHINE_END
242
243MACHINE_START(OMAP3530_LV_SOM, "OMAP Logic 3530 LV SOM board")
5e52b435 244 .atag_offset = 0x100,
afbb1893 245 .reserve = omap_reserve,
d40f3f15 246 .map_io = omap3_map_io,
8f5b5a41 247 .init_early = omap35xx_init_early,
741e3a89 248 .init_irq = omap3_init_irq,
6b2f55d7 249 .handle_irq = omap3_intc_handle_irq,
d40f3f15 250 .init_machine = omap3logic_init,
bbd707ac 251 .init_late = omap35xx_init_late,
e74984e4 252 .timer = &omap3_timer,
baa95883 253 .restart = omap_prcm_restart,
d40f3f15 254MACHINE_END
This page took 0.113192 seconds and 5 git commands to generate.