Linux Audio

Check our new training course

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