2009-11-19 10:41:09 +08:00
|
|
|
/*
|
|
|
|
* linux/arch/arm/mach-omap2/board-am3517evm.c
|
|
|
|
*
|
|
|
|
* Copyright (C) 2009 Texas Instruments Incorporated
|
|
|
|
* Author: Ranjith Lohithakshan <ranjithl@ti.com>
|
|
|
|
*
|
|
|
|
* Based on mach-omap2/board-omap3evm.c
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License as published by the
|
|
|
|
* Free Software Foundation version 2.
|
|
|
|
*
|
|
|
|
* This program is distributed "as is" WITHOUT ANY WARRANTY of any kind,
|
|
|
|
* whether express or implied; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/init.h>
|
2010-09-15 22:11:23 +08:00
|
|
|
#include <linux/clk.h>
|
2009-11-19 10:41:09 +08:00
|
|
|
#include <linux/platform_device.h>
|
|
|
|
#include <linux/gpio.h>
|
2010-02-13 19:47:57 +08:00
|
|
|
#include <linux/i2c/pca953x.h>
|
2010-05-11 05:29:16 +08:00
|
|
|
#include <linux/can/platform/ti_hecc.h>
|
2010-05-11 05:29:17 +08:00
|
|
|
#include <linux/davinci_emac.h>
|
2011-12-10 04:27:55 +08:00
|
|
|
#include <linux/mmc/host.h>
|
2012-10-25 05:26:19 +08:00
|
|
|
#include <linux/usb/musb.h>
|
2012-08-31 06:37:24 +08:00
|
|
|
#include <linux/platform_data/gpio-omap.h>
|
2009-11-19 10:41:09 +08:00
|
|
|
|
2012-09-21 02:40:52 +08:00
|
|
|
#include "am35xx.h"
|
2009-11-19 10:41:09 +08:00
|
|
|
#include <asm/mach-types.h>
|
|
|
|
#include <asm/mach/arch.h>
|
|
|
|
#include <asm/mach/map.h>
|
|
|
|
|
2011-11-11 05:45:17 +08:00
|
|
|
#include "common.h"
|
2011-05-11 19:05:07 +08:00
|
|
|
#include <video/omapdss.h>
|
2013-02-12 19:16:46 +08:00
|
|
|
#include <video/omap-panel-data.h>
|
2009-11-19 10:41:09 +08:00
|
|
|
|
2012-03-06 03:08:36 +08:00
|
|
|
#include "am35xx-emac.h"
|
2009-12-12 08:16:32 +08:00
|
|
|
#include "mux.h"
|
2010-10-09 01:40:20 +08:00
|
|
|
#include "control.h"
|
2011-12-10 04:27:55 +08:00
|
|
|
#include "hsmmc.h"
|
2009-12-12 08:16:32 +08:00
|
|
|
|
2010-01-13 19:47:10 +08:00
|
|
|
#define LCD_PANEL_PWR 176
|
|
|
|
#define LCD_PANEL_BKLIGHT_PWR 182
|
|
|
|
#define LCD_PANEL_PWM 181
|
|
|
|
|
2010-05-13 20:39:29 +08:00
|
|
|
static struct i2c_board_info __initdata am3517evm_i2c1_boardinfo[] = {
|
2010-02-13 19:47:56 +08:00
|
|
|
{
|
|
|
|
I2C_BOARD_INFO("s35390a", 0x30),
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* RTC - S35390A
|
|
|
|
*/
|
|
|
|
#define GPIO_RTCS35390A_IRQ 55
|
|
|
|
|
|
|
|
static void __init am3517_evm_rtc_init(void)
|
|
|
|
{
|
|
|
|
int r;
|
|
|
|
|
|
|
|
omap_mux_init_gpio(GPIO_RTCS35390A_IRQ, OMAP_PIN_INPUT_PULLUP);
|
2011-05-03 23:22:09 +08:00
|
|
|
|
|
|
|
r = gpio_request_one(GPIO_RTCS35390A_IRQ, GPIOF_IN, "rtcs35390a-irq");
|
2010-02-13 19:47:56 +08:00
|
|
|
if (r < 0) {
|
|
|
|
printk(KERN_WARNING "failed to request GPIO#%d\n",
|
|
|
|
GPIO_RTCS35390A_IRQ);
|
|
|
|
return;
|
|
|
|
}
|
2011-05-03 23:22:09 +08:00
|
|
|
|
2010-05-13 20:39:29 +08:00
|
|
|
am3517evm_i2c1_boardinfo[0].irq = gpio_to_irq(GPIO_RTCS35390A_IRQ);
|
2010-02-13 19:47:56 +08:00
|
|
|
}
|
|
|
|
|
2010-02-13 19:47:57 +08:00
|
|
|
/*
|
|
|
|
* I2C GPIO Expander - TCA6416
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Mounted on Base-Board */
|
|
|
|
static struct pca953x_platform_data am3517evm_gpio_expander_info_0 = {
|
|
|
|
.gpio_base = OMAP_MAX_GPIO_LINES,
|
|
|
|
};
|
2010-05-13 20:39:29 +08:00
|
|
|
static struct i2c_board_info __initdata am3517evm_i2c2_boardinfo[] = {
|
2011-03-08 23:13:24 +08:00
|
|
|
{
|
|
|
|
I2C_BOARD_INFO("tlv320aic23", 0x1A),
|
|
|
|
},
|
2010-02-13 19:47:57 +08:00
|
|
|
{
|
|
|
|
I2C_BOARD_INFO("tca6416", 0x21),
|
|
|
|
.platform_data = &am3517evm_gpio_expander_info_0,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Mounted on UI Card */
|
|
|
|
static struct pca953x_platform_data am3517evm_ui_gpio_expander_info_1 = {
|
|
|
|
.gpio_base = OMAP_MAX_GPIO_LINES + 16,
|
|
|
|
};
|
|
|
|
static struct pca953x_platform_data am3517evm_ui_gpio_expander_info_2 = {
|
|
|
|
.gpio_base = OMAP_MAX_GPIO_LINES + 32,
|
|
|
|
};
|
2010-05-13 20:39:29 +08:00
|
|
|
static struct i2c_board_info __initdata am3517evm_i2c3_boardinfo[] = {
|
2010-02-13 19:47:57 +08:00
|
|
|
{
|
|
|
|
I2C_BOARD_INFO("tca6416", 0x20),
|
|
|
|
.platform_data = &am3517evm_ui_gpio_expander_info_1,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
I2C_BOARD_INFO("tca6416", 0x21),
|
|
|
|
.platform_data = &am3517evm_ui_gpio_expander_info_2,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2010-02-18 06:09:28 +08:00
|
|
|
static int __init am3517_evm_i2c_init(void)
|
|
|
|
{
|
|
|
|
omap_register_i2c_bus(1, 400, NULL, 0);
|
2010-05-13 20:39:29 +08:00
|
|
|
omap_register_i2c_bus(2, 400, am3517evm_i2c2_boardinfo,
|
|
|
|
ARRAY_SIZE(am3517evm_i2c2_boardinfo));
|
|
|
|
omap_register_i2c_bus(3, 400, am3517evm_i2c3_boardinfo,
|
|
|
|
ARRAY_SIZE(am3517evm_i2c3_boardinfo));
|
2010-02-18 06:09:28 +08:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-11-17 21:34:34 +08:00
|
|
|
static struct panel_generic_dpi_data lcd_panel = {
|
|
|
|
.name = "sharp_lq",
|
2012-12-03 19:11:41 +08:00
|
|
|
.num_gpios = 3,
|
|
|
|
.gpios = {
|
|
|
|
LCD_PANEL_PWR,
|
|
|
|
LCD_PANEL_BKLIGHT_PWR,
|
|
|
|
LCD_PANEL_PWM,
|
|
|
|
},
|
2010-11-17 21:34:34 +08:00
|
|
|
};
|
|
|
|
|
2010-01-13 19:47:10 +08:00
|
|
|
static struct omap_dss_device am3517_evm_lcd_device = {
|
|
|
|
.type = OMAP_DISPLAY_TYPE_DPI,
|
|
|
|
.name = "lcd",
|
2010-11-17 21:34:34 +08:00
|
|
|
.driver_name = "generic_dpi_panel",
|
|
|
|
.data = &lcd_panel,
|
2010-01-13 19:47:10 +08:00
|
|
|
.phy.dpi.data_lines = 16,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct omap_dss_device am3517_evm_tv_device = {
|
|
|
|
.type = OMAP_DISPLAY_TYPE_VENC,
|
|
|
|
.name = "tv",
|
|
|
|
.driver_name = "venc",
|
|
|
|
.phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO,
|
|
|
|
};
|
|
|
|
|
2012-03-05 20:29:28 +08:00
|
|
|
static struct tfp410_platform_data dvi_panel = {
|
2012-02-17 19:30:27 +08:00
|
|
|
.power_down_gpio = -1,
|
OMAP: board-files: fix i2c_bus for tfp410
The i2c handling in tfp410 driver, which handles converting parallel RGB
to DVI, was changed in 958f2717b84e88bf833d996997fda8f73276f2af
(OMAPDSS: TFP410: pdata rewrite). The patch changed what value the
driver considers as invalid/undefined. Before the patch, 0 was the
invalid value, but as 0 is a valid bus number, the patch changed this to
-1.
However, the fact was missed that many board files do not define the bus
number at all, thus it's left to 0. This causes the driver to fail to
get the i2c bus, exiting from the driver's probe with an error, meaning
that the DVI output does not work for those boards.
This patch fixes the issue by changing the i2c_bus number field in the
driver's platform data from u16 to int, and setting the bus number to -1
in the board files for the boards that did not define the bus. The
exception is devkit8000, for which the bus is set to 1, which is the
correct bus for that board.
The bug exists in v3.5+ kernels.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Reported-by: Thomas Weber <thomas@tomweber.eu>
Cc: Thomas Weber <thomas@tomweber.eu>
Cc: <stable@vger.kernel.org> # v3.5+
Signed-off-by: Tony Lindgren <tony@atomide.com>
2012-11-22 16:39:56 +08:00
|
|
|
.i2c_bus_num = -1,
|
2010-11-17 21:34:34 +08:00
|
|
|
};
|
|
|
|
|
2010-01-13 19:47:10 +08:00
|
|
|
static struct omap_dss_device am3517_evm_dvi_device = {
|
|
|
|
.type = OMAP_DISPLAY_TYPE_DPI,
|
|
|
|
.name = "dvi",
|
2012-03-05 20:29:28 +08:00
|
|
|
.driver_name = "tfp410",
|
2010-11-17 21:34:34 +08:00
|
|
|
.data = &dvi_panel,
|
2010-01-13 19:47:10 +08:00
|
|
|
.phy.dpi.data_lines = 24,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct omap_dss_device *am3517_evm_dss_devices[] = {
|
|
|
|
&am3517_evm_lcd_device,
|
|
|
|
&am3517_evm_tv_device,
|
|
|
|
&am3517_evm_dvi_device,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct omap_dss_board_info am3517_evm_dss_data = {
|
|
|
|
.num_devices = ARRAY_SIZE(am3517_evm_dss_devices),
|
|
|
|
.devices = am3517_evm_dss_devices,
|
|
|
|
.default_device = &am3517_evm_lcd_device,
|
|
|
|
};
|
|
|
|
|
2009-11-19 10:41:09 +08:00
|
|
|
/*
|
|
|
|
* Board initialization
|
|
|
|
*/
|
|
|
|
|
2010-10-19 15:08:11 +08:00
|
|
|
static struct omap_musb_board_data musb_board_data = {
|
|
|
|
.interface_type = MUSB_INTERFACE_ULPI,
|
|
|
|
.mode = MUSB_OTG,
|
|
|
|
.power = 500,
|
2011-02-16 20:04:40 +08:00
|
|
|
.set_phy_power = am35x_musb_phy_power,
|
|
|
|
.clear_irq = am35x_musb_clear_irq,
|
2011-05-02 17:45:05 +08:00
|
|
|
.set_mode = am35x_set_mode,
|
2011-02-16 20:04:40 +08:00
|
|
|
.reset = am35x_musb_reset,
|
2010-10-19 15:08:11 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
static __init void am3517_evm_musb_init(void)
|
|
|
|
{
|
|
|
|
u32 devconf2;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Set up USB clock/mode in the DEVCONF2 register.
|
|
|
|
*/
|
|
|
|
devconf2 = omap_ctrl_readl(AM35XX_CONTROL_DEVCONF2);
|
|
|
|
|
|
|
|
/* USB2.0 PHY reference clock is 13 MHz */
|
|
|
|
devconf2 &= ~(CONF2_REFFREQ | CONF2_OTGMODE | CONF2_PHY_GPIOMODE);
|
|
|
|
devconf2 |= CONF2_REFFREQ_13MHZ | CONF2_SESENDEN | CONF2_VBDTCTEN
|
|
|
|
| CONF2_DATPOL;
|
|
|
|
|
|
|
|
omap_ctrl_writel(devconf2, AM35XX_CONTROL_DEVCONF2);
|
|
|
|
|
|
|
|
usb_musb_init(&musb_board_data);
|
|
|
|
}
|
|
|
|
|
2012-08-16 21:41:02 +08:00
|
|
|
static __init void am3517_evm_mcbsp1_init(void)
|
|
|
|
{
|
|
|
|
u32 devconf0;
|
|
|
|
|
|
|
|
/* McBSP1 CLKR/FSR signal to be connected to CLKX/FSX pin */
|
|
|
|
devconf0 = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0);
|
|
|
|
devconf0 |= OMAP2_MCBSP1_CLKR_MASK | OMAP2_MCBSP1_FSR_MASK;
|
|
|
|
omap_ctrl_writel(devconf0, OMAP2_CONTROL_DEVCONF0);
|
|
|
|
}
|
|
|
|
|
2013-03-20 23:44:47 +08:00
|
|
|
static struct usbhs_phy_data phy_data[] __initdata = {
|
|
|
|
{
|
|
|
|
.port = 1,
|
|
|
|
.reset_gpio = 57,
|
|
|
|
.vcc_gpio = -EINVAL,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2013-02-14 16:13:48 +08:00
|
|
|
static struct usbhs_omap_platform_data usbhs_bdata __initdata = {
|
2011-03-01 22:38:16 +08:00
|
|
|
.port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
|
2010-05-11 05:29:19 +08:00
|
|
|
#if defined(CONFIG_PANEL_SHARP_LQ043T1DG01) || \
|
|
|
|
defined(CONFIG_PANEL_SHARP_LQ043T1DG01_MODULE)
|
2011-03-01 22:38:16 +08:00
|
|
|
.port_mode[1] = OMAP_USBHS_PORT_MODE_UNUSED,
|
2010-05-11 05:29:19 +08:00
|
|
|
#else
|
2011-03-01 22:38:16 +08:00
|
|
|
.port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
|
2010-05-11 05:29:19 +08:00
|
|
|
#endif
|
2009-11-19 10:41:09 +08:00
|
|
|
};
|
|
|
|
|
2009-12-12 08:16:32 +08:00
|
|
|
#ifdef CONFIG_OMAP_MUX
|
|
|
|
static struct omap_board_mux board_mux[] __initdata = {
|
2010-10-19 15:08:11 +08:00
|
|
|
/* USB OTG DRVVBUS offset = 0x212 */
|
|
|
|
OMAP3_MUX(SAD2D_MCAD23, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLDOWN),
|
2009-12-12 08:16:32 +08:00
|
|
|
{ .reg_offset = OMAP_MUX_TERMINATOR },
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2010-05-11 05:29:16 +08:00
|
|
|
|
|
|
|
static struct resource am3517_hecc_resources[] = {
|
|
|
|
{
|
|
|
|
.start = AM35XX_IPSS_HECC_BASE,
|
|
|
|
.end = AM35XX_IPSS_HECC_BASE + 0x3FFF,
|
|
|
|
.flags = IORESOURCE_MEM,
|
|
|
|
},
|
|
|
|
{
|
2012-08-28 08:43:01 +08:00
|
|
|
.start = 24 + OMAP_INTC_START,
|
2010-05-11 05:29:16 +08:00
|
|
|
.flags = IORESOURCE_IRQ,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct platform_device am3517_hecc_device = {
|
|
|
|
.name = "ti_hecc",
|
|
|
|
.id = -1,
|
|
|
|
.num_resources = ARRAY_SIZE(am3517_hecc_resources),
|
|
|
|
.resource = am3517_hecc_resources,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct ti_hecc_platform_data am3517_evm_hecc_pdata = {
|
|
|
|
.scc_hecc_offset = AM35XX_HECC_SCC_HECC_OFFSET,
|
|
|
|
.scc_ram_offset = AM35XX_HECC_SCC_RAM_OFFSET,
|
|
|
|
.hecc_ram_offset = AM35XX_HECC_RAM_OFFSET,
|
|
|
|
.mbx_offset = AM35XX_HECC_MBOX_OFFSET,
|
|
|
|
.int_line = AM35XX_HECC_INT_LINE,
|
|
|
|
.version = AM35XX_HECC_VERSION,
|
|
|
|
};
|
|
|
|
|
|
|
|
static void am3517_evm_hecc_init(struct ti_hecc_platform_data *pdata)
|
|
|
|
{
|
|
|
|
am3517_hecc_device.dev.platform_data = pdata;
|
|
|
|
platform_device_register(&am3517_hecc_device);
|
|
|
|
}
|
|
|
|
|
2011-12-10 04:27:55 +08:00
|
|
|
static struct omap2_hsmmc_info mmc[] = {
|
|
|
|
{
|
|
|
|
.mmc = 1,
|
|
|
|
.caps = MMC_CAP_4_BIT_DATA,
|
|
|
|
.gpio_cd = 127,
|
|
|
|
.gpio_wp = 126,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.mmc = 2,
|
|
|
|
.caps = MMC_CAP_4_BIT_DATA,
|
|
|
|
.gpio_cd = 128,
|
|
|
|
.gpio_wp = 129,
|
|
|
|
},
|
|
|
|
{} /* Terminator */
|
|
|
|
};
|
|
|
|
|
2009-11-19 10:41:09 +08:00
|
|
|
static void __init am3517_evm_init(void)
|
|
|
|
{
|
2009-12-12 08:16:32 +08:00
|
|
|
omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
|
2010-04-20 14:33:29 +08:00
|
|
|
|
|
|
|
am3517_evm_i2c_init();
|
2011-02-22 17:24:50 +08:00
|
|
|
omap_display_init(&am3517_evm_dss_data);
|
2009-11-19 10:41:09 +08:00
|
|
|
omap_serial_init();
|
2011-08-23 14:57:23 +08:00
|
|
|
omap_sdrc_init(NULL, NULL);
|
2010-02-22 18:21:12 +08:00
|
|
|
|
|
|
|
/* Configure GPIO for EHCI port */
|
|
|
|
omap_mux_init_gpio(57, OMAP_PIN_OUTPUT);
|
2013-03-20 23:44:47 +08:00
|
|
|
|
|
|
|
usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data));
|
2011-03-01 22:38:19 +08:00
|
|
|
usbhs_init(&usbhs_bdata);
|
2010-05-11 05:29:16 +08:00
|
|
|
am3517_evm_hecc_init(&am3517_evm_hecc_pdata);
|
2010-02-13 19:47:56 +08:00
|
|
|
|
|
|
|
/* RTC - S35390A */
|
|
|
|
am3517_evm_rtc_init();
|
|
|
|
|
2010-05-13 20:39:29 +08:00
|
|
|
i2c_register_board_info(1, am3517evm_i2c1_boardinfo,
|
|
|
|
ARRAY_SIZE(am3517evm_i2c1_boardinfo));
|
2010-05-11 05:29:17 +08:00
|
|
|
/*Ethernet*/
|
2012-03-06 03:08:36 +08:00
|
|
|
am35xx_emac_init(AM35XX_DEFAULT_MDIO_FREQUENCY, 1);
|
2010-10-19 15:08:11 +08:00
|
|
|
|
|
|
|
/* MUSB */
|
|
|
|
am3517_evm_musb_init();
|
2011-12-10 04:27:55 +08:00
|
|
|
|
2012-08-16 21:41:02 +08:00
|
|
|
/* McBSP1 */
|
|
|
|
am3517_evm_mcbsp1_init();
|
|
|
|
|
2011-12-10 04:27:55 +08:00
|
|
|
/* MMC init function */
|
2012-02-21 01:43:29 +08:00
|
|
|
omap_hsmmc_init(mmc);
|
2009-11-19 10:41:09 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
MACHINE_START(OMAP3517EVM, "OMAP3517/AM3517 EVM")
|
2011-07-06 10:38:15 +08:00
|
|
|
.atag_offset = 0x100,
|
2010-05-23 17:18:16 +08:00
|
|
|
.reserve = omap_reserve,
|
2011-02-15 07:40:20 +08:00
|
|
|
.map_io = omap3_map_io,
|
2011-08-23 14:57:24 +08:00
|
|
|
.init_early = am35xx_init_early,
|
2011-05-17 18:51:26 +08:00
|
|
|
.init_irq = omap3_init_irq,
|
2011-09-06 17:23:45 +08:00
|
|
|
.handle_irq = omap3_intc_handle_irq,
|
2009-11-19 10:41:09 +08:00
|
|
|
.init_machine = am3517_evm_init,
|
2012-04-26 16:06:50 +08:00
|
|
|
.init_late = am35xx_init_late,
|
2012-11-09 03:40:59 +08:00
|
|
|
.init_time = omap3_sync32k_timer_init,
|
2012-10-30 10:56:12 +08:00
|
|
|
.restart = omap3xxx_restart,
|
2009-11-19 10:41:09 +08:00
|
|
|
MACHINE_END
|