blob: fc443e1054342e3af7c16942253572f3579c8682 [file] [log] [blame]
/*
* Board support file for OMAP4430 based PandaBoard.
*
* Copyright (C) 2010 Texas Instruments
*
* Author: David Anders <x0132446@ti.com>
*
* Based on mach-omap2/board-4430sdp.c
*
* Author: Santosh Shilimkar <santosh.shilimkar@ti.com>
*
* Based on mach-omap2/board-3430sdp.c
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#define USE_15HZ
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/clk.h>
#include <linux/io.h>
#include <linux/leds.h>
#include <linux/gpio.h>
#include <linux/usb/otg.h>
#include <linux/i2c/twl.h>
#include <linux/gpio_keys.h>
#include <linux/regulator/machine.h>
#include <linux/regulator/fixed.h>
#include <linux/wl12xx.h>
#include <linux/netdevice.h>
#include <linux/if_ether.h>
#include <linux/ti_wilink_st.h>
#include <linux/omapfb.h>
#include <mach/hardware.h>
#include <mach/omap4-common.h>
#include <mach/dmm.h>
#include <mach/id.h>
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
#include <video/omapdss.h>
#include <plat/board.h>
#include <plat/common.h>
#include <plat/usb.h>
#include <plat/mmc.h>
#include <plat/dma-44xx.h>
#include <video/omap-panel-generic-dpi.h>
#include <video/omap-panel-nokia-dsi.h>
#include <linux/input/synaptics_rmi_dsx.h>
#include "hsmmc.h"
#include "control.h"
#include "mux.h"
#include "common-board-devices.h"
#include "pm.h"
#define GPIO_HUB_POWER 1
#define GPIO_HUB_NRESET 62
#define HDMI_GPIO_CT_CP_HPD 60
#define HDMI_GPIO_HPD 63 /* Hot plug pin for HDMI */
#define HDMI_GPIO_LS_OE 41 /* Level shifter for HDMI */
#define TPS62361_GPIO 7
#define GPIO_SDIO_EXP_ACT_N 43
#define GPIO_DISPLAY_MUX 159
#define GPIO_HDMI_SELECT 160
#define GPIO_WIFI_WAKE 4
#define GPIO_WIFI_IRQ 147
#define GPIO_V3P3_NN 168
#define GPIO_AUDIO_CLK_EN 169
#define GPIO_WAKE_BTN 30
#define GPIO_VOLUMEUP_BTN 27
#define GPIO_VOLUMEDOWN_BTN 28
#define GPIO_WAKE_FPGA_BTN 146
#define GPIO_VOLUMEUP_FPGA_BTN 165
#define GPIO_VOLUMEDOWN_FPGA_BTN 166
#define GPIO_BOARD_ID4 2
#define GPIO_BOARD_ID3 3
#define GPIO_BOARD_ID2 171
#define GPIO_BOARD_ID1 48
#define GPIO_BOARD_ID0 182
#define SYNAPTICS_DSX_I2C_NAME "synaptics_dsx_i2c"
#define SYNAPTICS_DSX_I2C_ADDR 0x20
#define SYNAPTICS_DSX_GPIO_IRQ 52
#define SYNAPTICS_DSX_RESET_GPIO 121
extern int synaptics_dsx_gpio_config(struct synaptics_dsx_platform_data *pdata,
bool enable);
static int omap4_tonka_is_dev(void)
{
return gpio_get_value(GPIO_BOARD_ID4);
}
static struct gpio_keys_button tonka_gpio_buttons[] = {
{
.desc = "Lock Button",
.type = EV_KEY,
.code = KEY_SCREENLOCK,
.gpio = GPIO_WAKE_BTN,
.active_low = 1,
.wakeup = 1,
},
{
.desc = "Volume Up Button",
.type = EV_KEY,
.code = KEY_VOLUMEUP,
.gpio = GPIO_VOLUMEUP_BTN,
.active_low = 1,
.wakeup = 0,
},
{
.desc = "Volume Down Button",
.type = EV_KEY,
.code = KEY_VOLUMEDOWN,
.gpio = GPIO_VOLUMEDOWN_BTN,
.active_low = 1,
.wakeup = 0,
},
};
static struct gpio_keys_platform_data tonka_gpio_buttons_data = {
.buttons = tonka_gpio_buttons,
.nbuttons = ARRAY_SIZE(tonka_gpio_buttons),
};
static struct platform_device tonka_gpio_buttons_device = {
.name = "gpio-keys",
.id = -1,
.dev = {
.platform_data = &tonka_gpio_buttons_data,
},
};
static struct gpio_keys_button tonka_gpio_buttons_fpga[] = {
{
.desc = "Lock Button",
.type = EV_KEY,
.code = KEY_SCREENLOCK,
.gpio = GPIO_WAKE_FPGA_BTN,
.active_low = 1,
.wakeup = 1,
},
{
.desc = "Volume Up Button",
.type = EV_KEY,
.code = KEY_VOLUMEUP,
.gpio = GPIO_VOLUMEUP_FPGA_BTN,
.active_low = 1,
.wakeup = 0,
},
{
.desc = "Volume Down Button",
.type = EV_KEY,
.code = KEY_VOLUMEDOWN,
.gpio = GPIO_VOLUMEDOWN_FPGA_BTN,
.active_low = 1,
.wakeup = 0,
},
};
static struct gpio_keys_platform_data tonka_gpio_buttons_fpga_data = {
.buttons = tonka_gpio_buttons_fpga,
.nbuttons = ARRAY_SIZE(tonka_gpio_buttons_fpga),
};
static struct platform_device tonka_gpio_buttons_fpga_device = {
.name = "gpio-keys",
.id = -1,
.dev = {
.platform_data = &tonka_gpio_buttons_fpga_data,
},
};
static void __init tonka_buttons_init(void)
{
if (omap4_tonka_is_dev()) {
omap_mux_init_gpio(GPIO_WAKE_BTN, OMAP_PIN_INPUT_PULLUP | OMAP_PIN_OFF_WAKEUPENABLE);
omap_mux_init_gpio(GPIO_VOLUMEUP_BTN, OMAP_PIN_INPUT_PULLUP);
omap_mux_init_gpio(GPIO_VOLUMEDOWN_BTN, OMAP_PIN_INPUT_PULLUP);
platform_device_register(&tonka_gpio_buttons_device);
} else {
omap_mux_init_gpio(GPIO_WAKE_FPGA_BTN, OMAP_PIN_INPUT_PULLUP | OMAP_PIN_OFF_WAKEUPENABLE);
omap_mux_init_gpio(GPIO_VOLUMEUP_FPGA_BTN, OMAP_PIN_INPUT_PULLUP);
omap_mux_init_gpio(GPIO_VOLUMEDOWN_FPGA_BTN, OMAP_PIN_INPUT_PULLUP);
platform_device_register(&tonka_gpio_buttons_fpga_device);
}
};
static struct gpio_led gpio_leds[] = {
{
.name = "pandaboard::status1",
.default_trigger = "heartbeat",
},
{
.name = "pandaboard::status2",
.default_trigger = "mmc0",
},
};
static struct gpio_led_platform_data gpio_led_info = {
.leds = gpio_leds,
.num_leds = ARRAY_SIZE(gpio_leds),
};
static struct platform_device leds_gpio = {
.name = "leds-gpio",
.id = -1,
.dev = {
.platform_data = &gpio_led_info,
},
};
static void __init panda_leds_init(void)
{
if (cpu_is_omap443x()) {
gpio_leds[0].gpio = 7;
gpio_leds[1].gpio = 8;
} else {
gpio_leds[0].gpio = 110;
gpio_leds[1].gpio = 8;
}
platform_device_register(&leds_gpio);
}
static const struct usbhs_omap_board_data usbhs_bdata __initconst = {
.port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
.port_mode[1] = OMAP_USBHS_PORT_MODE_UNUSED,
.port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
.phy_reset = false,
.reset_gpio_port[0] = -EINVAL,
.reset_gpio_port[1] = -EINVAL,
.reset_gpio_port[2] = -EINVAL
};
static struct gpio panda_ehci_gpios[] __initdata = {
{ GPIO_HUB_POWER, GPIOF_OUT_INIT_LOW, "hub_power" },
{ GPIO_HUB_NRESET, GPIOF_OUT_INIT_LOW, "hub_nreset" },
};
static void __init omap4_ehci_init(void)
{
int ret;
struct clk *phy_ref_clk;
/* FREF_CLK3 provides the 19.2 MHz reference clock to the PHY */
phy_ref_clk = clk_get(NULL, "auxclk3_ck");
if (IS_ERR(phy_ref_clk)) {
pr_err("Cannot request auxclk3\n");
return;
}
clk_set_rate(phy_ref_clk, 19200000);
clk_enable(phy_ref_clk);
/* disable the power to the usb hub prior to init and reset phy+hub */
ret = gpio_request_array(panda_ehci_gpios,
ARRAY_SIZE(panda_ehci_gpios));
if (ret) {
pr_err("Unable to initialize EHCI power/reset\n");
return;
}
gpio_export(GPIO_HUB_POWER, 0);
gpio_export(GPIO_HUB_NRESET, 0);
gpio_set_value(GPIO_HUB_NRESET, 1);
usbhs_init(&usbhs_bdata);
/* enable power to hub */
gpio_set_value(GPIO_HUB_POWER, 1);
}
static struct omap_musb_board_data musb_board_data = {
.interface_type = MUSB_INTERFACE_UTMI,
.mode = MUSB_OTG,
.power = 100,
};
static struct omap2_hsmmc_info mmc[] = {
{
.mmc = 1,
.caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
.gpio_wp = -EINVAL,
.gpio_cd = -EINVAL,
},
{
/* on AP dev board and FF board */
.name = "sd8787",
.mmc = 4,
.caps = MMC_CAP_4_BIT_DATA /*| MMC_CAP_POWER_OFF_CARD*/,
.gpio_wp = -EINVAL,
.gpio_cd = -EINVAL,
.ocr_mask = MMC_VDD_165_195 | MMC_VDD_20_21 | MMC_VDD_21_22 | MMC_VDD_22_23 | MMC_VDD_23_24 | MMC_VDD_24_25 | MMC_VDD_25_26 | MMC_VDD_26_27 | MMC_VDD_27_28 | MMC_VDD_28_29 | MMC_VDD_29_30 | MMC_VDD_30_31 | MMC_VDD_31_32 | MMC_VDD_32_33,
.nonremovable = true,
},
{} /* Terminator */
};
static struct regulator_consumer_supply tonka_vsdio_supply[] = {
REGULATOR_SUPPLY("vmmc", "omap_hsmmc.3"), /* Tonka */
};
static struct platform_device *panda_devices[] __initdata = {
};
static struct wl12xx_platform_data omap_panda_wlan_data __initdata = {
.irq = OMAP_GPIO_IRQ(GPIO_WIFI_IRQ),
.board_ref_clock = WL12XX_REFCLOCK_19,
};
static int omap4_twl6030_hsmmc_late_init(struct device *dev)
{
int ret = 0;
struct platform_device *pdev = container_of(dev,
struct platform_device, dev);
struct omap_mmc_platform_data *pdata = dev->platform_data;
if (!pdata) {
dev_err(dev, "%s: NULL platform data\n", __func__);
return -EINVAL;
}
/* Setting MMC1 Card detect Irq */
if (pdev->id == 0) {
ret = twl6030_mmc_card_detect_config();
if (ret)
dev_err(dev, "%s: Error card detect config(%d)\n",
__func__, ret);
else
pdata->slots[0].card_detect = twl6030_mmc_card_detect;
}
return ret;
}
static __init void omap4_twl6030_hsmmc_set_late_init(struct device *dev)
{
struct omap_mmc_platform_data *pdata;
/* dev can be null if CONFIG_MMC_OMAP_HS is not set */
if (!dev) {
pr_err("Failed omap4_twl6030_hsmmc_set_late_init\n");
return;
}
pdata = dev->platform_data;
pdata->init = omap4_twl6030_hsmmc_late_init;
}
static int __init omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers)
{
struct omap2_hsmmc_info *c;
omap2_hsmmc_init(controllers);
for (c = controllers; c->mmc; c++)
omap4_twl6030_hsmmc_set_late_init(c->dev);
return 0;
}
static struct regulator_init_data omap4_panda_vaux1 = {
.constraints = {
.min_uV = 1000000,
.max_uV = 3300000,
.apply_uV = true,
.valid_modes_mask = REGULATOR_MODE_NORMAL
| REGULATOR_MODE_STANDBY,
.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
| REGULATOR_CHANGE_MODE
| REGULATOR_CHANGE_STATUS,
},
.num_consumer_supplies = ARRAY_SIZE(tonka_vsdio_supply),
.consumer_supplies = tonka_vsdio_supply,
};
static struct regulator_init_data omap4_panda_vusim = {
.constraints = {
.min_uV = 1200000,
.max_uV = 2900000,
.apply_uV = true,
.valid_modes_mask = REGULATOR_MODE_NORMAL
| REGULATOR_MODE_STANDBY,
.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
| REGULATOR_CHANGE_MODE
| REGULATOR_CHANGE_STATUS,
},
};
static struct regulator_consumer_supply omap4_panda_vcxio_supply[] = {
OMAP_DSS_SUPPLIES,
};
static struct regulator_init_data omap4_panda_vcxio = {
.constraints = {
.min_uV = 1800000,
.max_uV = 1800000,
.valid_modes_mask = REGULATOR_MODE_NORMAL | REGULATOR_MODE_STANDBY,
.valid_ops_mask = REGULATOR_CHANGE_MODE | REGULATOR_CHANGE_STATUS,
.always_on = true,
},
.num_consumer_supplies = ARRAY_SIZE(omap4_panda_vcxio_supply),
.consumer_supplies = omap4_panda_vcxio_supply,
};
/* Panda board uses the common PMIC configuration */
static struct twl4030_platform_data omap4_panda_twldata = {
/* Regulators */
.vusim = &omap4_panda_vusim,
.vaux1 = &omap4_panda_vaux1,
.vcxio = &omap4_panda_vcxio,
};
static struct synaptics_dsx_platform_data synaptics_dsx_pdata = {
.irq_gpio = SYNAPTICS_DSX_GPIO_IRQ,
.reset_gpio = SYNAPTICS_DSX_RESET_GPIO,
.gpio_config = synaptics_dsx_gpio_config,
.normal_mode = true,
.one_touch_enabled = 1,
.reset_on_resume = 1,
.hw_reset = 1,
};
static struct i2c_board_info __initdata tonka_i2c2_info[] = {
{
I2C_BOARD_INFO(SYNAPTICS_DSX_I2C_NAME, SYNAPTICS_DSX_I2C_ADDR),
.platform_data = &synaptics_dsx_pdata,
.irq = OMAP_GPIO_IRQ(SYNAPTICS_DSX_GPIO_IRQ),
},
{
I2C_BOARD_INFO("tlv320aic23", 0x1B),
},
};
static struct i2c_board_info __initdata tonka_i2c3_info[] = {
{
I2C_BOARD_INFO("tlv320aic23", 0x1A),
},
};
static struct i2c_board_info __initdata tonka_i2c4_info[] = {
};
static int __init omap4_panda_i2c_init(void)
{
omap4_pmic_get_config(&omap4_panda_twldata, TWL_COMMON_PDATA_USB,
TWL_COMMON_REGULATOR_VDAC |
TWL_COMMON_REGULATOR_VAUX2 |
TWL_COMMON_REGULATOR_VAUX3 |
TWL_COMMON_REGULATOR_VMMC |
TWL_COMMON_REGULATOR_VPP |
TWL_COMMON_REGULATOR_VANA |
TWL_COMMON_REGULATOR_VCXIO |
TWL_COMMON_REGULATOR_VUSB |
TWL_COMMON_REGULATOR_CLK32KG);
if (!omap4_tonka_is_dev())
omap4_panda_vaux1.num_consumer_supplies = 0;
omap4_pmic_init("twl6030", &omap4_panda_twldata);
omap_register_i2c_bus(2, 400, tonka_i2c2_info,
ARRAY_SIZE(tonka_i2c2_info));
omap_register_i2c_bus(3, 400, tonka_i2c3_info,
ARRAY_SIZE(tonka_i2c3_info));
omap_register_i2c_bus(4, 400, tonka_i2c4_info,
ARRAY_SIZE(tonka_i2c4_info));
return 0;
}
#ifdef CONFIG_OMAP_MUX
static struct omap_board_mux board_mux[] __initdata = {
/* WLAN SDIO: enable */
// OMAP4_MUX(GPMC_A19, OMAP_MUX_MODE3 | OMAP_PIN_INPUT_PULLUP),
/* WLAN SDIO (Tonka) */
OMAP4_MUX(MCSPI4_CLK, OMAP_MUX_MODE1 | OMAP_PIN_INPUT_PULLUP), /* sdmmc4_cmd */
OMAP4_MUX(MCSPI4_SIMO, OMAP_MUX_MODE1 | OMAP_PIN_INPUT_PULLUP), /* sdmmc4_clk */
OMAP4_MUX(MCSPI4_SOMI, OMAP_MUX_MODE1 | OMAP_PIN_INPUT_PULLUP), /* sdmmc4_dat0 */
OMAP4_MUX(UART4_TX, OMAP_MUX_MODE1 | OMAP_PIN_INPUT_PULLUP), /* sdmmc4_dat1 */
OMAP4_MUX(UART4_RX, OMAP_MUX_MODE1 | OMAP_PIN_INPUT_PULLUP), /* sdmmc4_dat2 */
OMAP4_MUX(MCSPI4_CS0, OMAP_MUX_MODE1 | OMAP_PIN_INPUT_PULLUP), /* sdmmc4_dat3 */
{ .reg_offset = OMAP_MUX_TERMINATOR },
};
static struct omap_device_pad serial2_pads[] __initdata = {
OMAP_MUX_STATIC("uart2_cts.uart2_cts",
OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
OMAP_MUX_STATIC("uart2_rts.uart2_rts",
OMAP_PIN_OUTPUT | OMAP_MUX_MODE0),
OMAP_MUX_STATIC("uart2_rx.uart2_rx",
OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
OMAP_MUX_STATIC("uart2_tx.uart2_tx",
OMAP_PIN_OUTPUT | OMAP_MUX_MODE0),
};
static struct omap_device_pad serial3_pads[] __initdata = {
OMAP_MUX_STATIC("uart3_cts_rctx.uart3_cts_rctx",
OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
OMAP_MUX_STATIC("uart3_rts_sd.uart3_rts_sd",
OMAP_PIN_OUTPUT | OMAP_MUX_MODE0),
OMAP_MUX_STATIC("uart3_rx_irrx.uart3_rx_irrx",
OMAP_PIN_INPUT | OMAP_MUX_MODE0),
OMAP_MUX_STATIC("uart3_tx_irtx.uart3_tx_irtx",
OMAP_PIN_OUTPUT | OMAP_MUX_MODE0),
};
static struct omap_board_data serial2_data __initdata = {
.id = 1,
.pads = serial2_pads,
.pads_cnt = ARRAY_SIZE(serial2_pads),
};
static struct omap_board_data serial3_data __initdata = {
.id = 2,
.pads = serial3_pads,
.pads_cnt = ARRAY_SIZE(serial3_pads),
};
static inline void board_serial_init(void)
{
struct omap_board_data bdata;
bdata.flags = 0;
bdata.pads = NULL;
bdata.pads_cnt = 0;
bdata.id = 0;
/* pass dummy data for UART1 */
omap_serial_init_port(&bdata);
omap_serial_init_port(&serial2_data);
omap_serial_init_port(&serial3_data);
}
#else
#define board_mux NULL
static inline void board_serial_init(void)
{
omap_serial_init();
}
#endif
#if 1
/* Display DVI */
/* Using generic display panel */
static struct panel_generic_dpi_data omap4_dvi_panel = {
#if 0
.name = "generic_720p",
#else
.name = "dell_u2412m",
#endif
};
struct omap_dss_device omap4_panda_dvi_device = {
.type = OMAP_DISPLAY_TYPE_DPI,
.name = "dvi",
.driver_name = "generic_dpi_panel",
.data = &omap4_dvi_panel,
.phy.dpi.data_lines = 24,
.channel = OMAP_DSS_CHANNEL_LCD2,
};
#endif
static struct gpio panda_hdmi_gpios[] = {
{ HDMI_GPIO_CT_CP_HPD, GPIOF_OUT_INIT_HIGH, "hdmi_gpio_hpd" },
{ HDMI_GPIO_LS_OE, GPIOF_OUT_INIT_HIGH, "hdmi_gpio_ls_oe" },
};
static void omap4_panda_hdmi_mux_init(void)
{
u32 r;
int status;
/* PAD0_HDMI_HPD_PAD1_HDMI_CEC */
omap_mux_init_signal("hdmi_hpd.hdmi_hpd",
OMAP_PIN_INPUT_PULLUP);
omap_mux_init_signal("gpmc_wait2.gpio_100",
OMAP_PIN_INPUT_PULLDOWN);
omap_mux_init_signal("hdmi_cec.hdmi_cec",
OMAP_PIN_INPUT_PULLUP);
/* PAD0_HDMI_DDC_SCL_PAD1_HDMI_DDC_SDA */
omap_mux_init_signal("hdmi_ddc_scl.hdmi_ddc_scl",
OMAP_PIN_INPUT_PULLUP);
omap_mux_init_signal("hdmi_ddc_sda.hdmi_ddc_sda",
OMAP_PIN_INPUT_PULLUP);
/* strong pullup on DDC lines using unpublished register */
r = ((1 << 24) | (1 << 28)) ;
omap4_ctrl_pad_writel(r, OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_I2C_1);
gpio_request(HDMI_GPIO_HPD, NULL);
omap_mux_init_gpio(HDMI_GPIO_HPD, OMAP_PIN_INPUT | OMAP_PULL_ENA);
gpio_direction_input(HDMI_GPIO_HPD);
status = gpio_request_array(panda_hdmi_gpios,
ARRAY_SIZE(panda_hdmi_gpios));
if (status)
pr_err("Cannot request HDMI GPIOs\n");
}
static struct omap_dss_device omap4_panda_hdmi_device = {
.name = "hdmi",
.driver_name = "hdmi_panel",
.type = OMAP_DISPLAY_TYPE_HDMI,
.clocks = {
.dispc = {
.dispc_fclk_src = OMAP_DSS_CLK_SRC_FCK,
},
.hdmi = {
.regn = 15,
.regm2 = 1,
},
},
.hpd_gpio = HDMI_GPIO_HPD,
.channel = OMAP_DSS_CHANNEL_DIGIT,
};
static struct nokia_dsi_panel_data dsi1_panel = {
.name = "tonka",
.reset_gpio = 102,
.use_ext_te = true,
.ext_te_gpio = 101,
.esd_interval = 0,
};
static struct omap_dss_device omap4_panda_fpc_dsi_device = {
.name = "lcd",
.driver_name = "tonka",
.type = OMAP_DISPLAY_TYPE_DSI,
.data = &dsi1_panel,
.phy.dsi = {
.type = OMAP_DSS_DSI_TYPE_CMD_MODE,
.clk_lane = 1,
.clk_pol = 0,
.data1_lane = 2,
.data1_pol = 0,
.data2_lane = 3,
.data2_pol = 0,
.data3_lane = 4,
.data3_pol = 0,
.data4_lane = 5,
.data4_pol = 0,
},
.clocks = {
.dispc = {
.channel = {
.lck_div = 1,
#ifndef USE_15HZ
.pck_div = 3,
#else
.pck_div = 6,
#endif
.lcd_clk_src = OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC,
},
.dispc_fclk_src = OMAP_DSS_CLK_SRC_FCK,
},
.dsi = {
#ifndef USE_15HZ
.regn = 16, // Fint = 2.4 MHz
.regm = 180, // DDR clock = 216 MHz
.regm_dispc = 5, // PLL1_CLK1 = 172.8 MHz
.regm_dsi = 5, // PLL1_CLK2 = 172.8 MHz
.lp_clk_div = 10, // LP Clock = 8.64 MHz
#else
.regn = 16, // Fint = 2.4 MHz
.regm = 90, // DDR clock = 108 MHz
.regm_dispc = 5, // PLL1_CLK1 = 86.4 MHz
.regm_dsi = 5, // PLL1_CLK2 = 86.4 MHz
.lp_clk_div = 5, // LP Clock = 8.64 MHz
#endif
.dsi_fclk_src = OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI
},
},
.panel = {
.width_in_um = 57960,
.height_in_um = 103040,
},
.channel = OMAP_DSS_CHANNEL_LCD,
};
static struct omap_dss_device omap4_panda_fpga_dsi_device = {
.name = "lcd",
.driver_name = "tonka",
.type = OMAP_DISPLAY_TYPE_DSI,
.data = &dsi1_panel,
.phy.dsi = {
.type = OMAP_DSS_DSI_TYPE_CMD_MODE,
.clk_lane = 3,
.clk_pol = 0,
.data1_lane = 2,
.data1_pol = 0,
.data2_lane = 4,
.data2_pol = 0,
.data3_lane = 5,
.data3_pol = 0,
.data4_lane = 1,
.data4_pol = 0,
},
.clocks = {
.dispc = {
.channel = {
.lck_div = 1,
#ifndef USE_15HZ
.pck_div = 3,
#else
.pck_div = 6,
#endif
.lcd_clk_src = OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC,
},
.dispc_fclk_src = OMAP_DSS_CLK_SRC_FCK,
},
.dsi = {
#ifndef USE_15HZ
.regn = 16, // Fint = 2.4 MHz
.regm = 180, // DDR clock = 216 MHz
.regm_dispc = 5, // PLL1_CLK1 = 172.8 MHz
.regm_dsi = 5, // PLL1_CLK2 = 172.8 MHz
.lp_clk_div = 10, // LP Clock = 8.64 MHz
#else
.regn = 16, // Fint = 2.4 MHz
.regm = 90, // DDR clock = 108 MHz
.regm_dispc = 5, // PLL1_CLK1 = 86.4 MHz
.regm_dsi = 5, // PLL1_CLK2 = 86.4 MHz
.lp_clk_div = 5, // LP Clock = 8.64 MHz
#endif
.dsi_fclk_src = OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI
},
},
.panel = {
.width_in_um = 57960,
.height_in_um = 103040,
},
.channel = OMAP_DSS_CHANNEL_LCD,
};
static struct omap_dss_device omap4_panda_fpga_ff_dsi_device = {
.name = "lcd",
.driver_name = "tonka",
.type = OMAP_DISPLAY_TYPE_DSI,
.data = &dsi1_panel,
.phy.dsi = {
.type = OMAP_DSS_DSI_TYPE_CMD_MODE,
.clk_lane = 2,
.clk_pol = 0,
.data1_lane = 5,
.data1_pol = 0,
.data2_lane = 1,
.data2_pol = 0,
.data3_lane = 4,
.data3_pol = 0,
.data4_lane = 3,
.data4_pol = 0,
},
.clocks = {
.dispc = {
.channel = {
.lck_div = 1,
#ifndef USE_15HZ
.pck_div = 3,
#else
.pck_div = 6,
#endif
.lcd_clk_src = OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC,
},
.dispc_fclk_src = OMAP_DSS_CLK_SRC_FCK,
},
.dsi = {
#ifndef USE_15HZ
.regn = 16, // Fint = 2.4 MHz
.regm = 180, // DDR clock = 216 MHz
.regm_dispc = 5, // PLL1_CLK1 = 172.8 MHz
.regm_dsi = 5, // PLL1_CLK2 = 172.8 MHz
.lp_clk_div = 10, // LP Clock = 8.64 MHz
#else
.regn = 16, // Fint = 2.4 MHz
.regm = 90, // DDR clock = 108 MHz
.regm_dispc = 5, // PLL1_CLK1 = 86.4 MHz
.regm_dsi = 5, // PLL1_CLK2 = 86.4 MHz
.lp_clk_div = 5, // LP Clock = 8.64 MHz
#endif
.dsi_fclk_src = OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI
},
},
.panel = {
.width_in_um = 57960,
.height_in_um = 103040,
},
.channel = OMAP_DSS_CHANNEL_LCD,
};
static void omap4_panda_dsi_mux_init(void)
{
int rc;
unsigned int reg;
reg = omap4_ctrl_pad_readl(OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_DSIPHY);
reg &= ~OMAP4_DSI1_LANEENABLE_MASK;
reg |= (0x1f) << OMAP4_DSI1_LANEENABLE_SHIFT;
reg &= ~OMAP4_DSI1_PIPD_MASK;
reg |= (0x1f) << OMAP4_DSI1_PIPD_SHIFT;
omap4_ctrl_pad_writel(reg, OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_DSIPHY);
rc = gpio_request_one(dsi1_panel.reset_gpio,
GPIOF_DIR_OUT,
"lcd1_reset_gpio");
if (rc) {
pr_err("%s: Could not request lcd1 reset gpio\n", __func__);
}
}
static struct omap_dss_device *omap4_panda_hdmi_dss_devices[] = {
&omap4_panda_dvi_device,
&omap4_panda_hdmi_device,
};
static struct omap_dss_board_info omap4_panda_hdmi_dss_data = {
.num_devices = ARRAY_SIZE(omap4_panda_hdmi_dss_devices),
.devices = omap4_panda_hdmi_dss_devices,
.default_device = &omap4_panda_hdmi_device,
};
static struct omap_dss_device *omap4_panda_fpc_dss_devices[] = {
&omap4_panda_fpc_dsi_device,
};
static struct omap_dss_board_info omap4_panda_fpc_dss_data = {
.num_devices = ARRAY_SIZE(omap4_panda_fpc_dss_devices),
.devices = omap4_panda_fpc_dss_devices,
.default_device = &omap4_panda_fpc_dsi_device,
};
static struct omap_dss_device *omap4_panda_fpga_dss_devices[] = {
&omap4_panda_fpga_dsi_device,
};
static struct omap_dss_board_info omap4_panda_fpga_dss_data = {
.num_devices = ARRAY_SIZE(omap4_panda_fpga_dss_devices),
.devices = omap4_panda_fpga_dss_devices,
.default_device = &omap4_panda_fpga_dsi_device,
};
static struct omap_dss_device *omap4_panda_fpga_ff_dss_devices[] = {
&omap4_panda_fpga_ff_dsi_device,
};
static struct omap_dss_board_info omap4_panda_fpga_ff_dss_data = {
.num_devices = ARRAY_SIZE(omap4_panda_fpga_ff_dss_devices),
.devices = omap4_panda_fpga_ff_dss_devices,
.default_device = &omap4_panda_fpga_ff_dsi_device,
};
static struct gpio panda_dss_gpios[] __initdata = {
{ GPIO_HDMI_SELECT, GPIOF_IN, "hdmi_select" },
{ GPIO_DISPLAY_MUX, GPIOF_IN, "display_mux" },
{ GPIO_V3P3_NN, GPIOF_OUT_INIT_HIGH, "v3p3_nn" },
};
void omap4_panda_display_init(void)
{
int r;
omap4_panda_hdmi_mux_init();
omap4_panda_dsi_mux_init();
r = gpio_request_array(panda_dss_gpios, ARRAY_SIZE(panda_dss_gpios));
if (r)
pr_err("error mapping display GPIOs");
if (omap4_tonka_is_dev()) {
if (gpio_get_value(GPIO_HDMI_SELECT)) {
omap_display_init(&omap4_panda_hdmi_dss_data);
} else {
if (!gpio_get_value(GPIO_DISPLAY_MUX))
omap_display_init(&omap4_panda_fpc_dss_data);
else
omap_display_init(&omap4_panda_fpga_dss_data);
}
} else {
omap_display_init(&omap4_panda_fpga_ff_dss_data);
}
}
/*
* These device paths represent the onboard USB <-> Ethernet bridge, and
* the WLAN module on Panda, both of which need their random or all-zeros
* mac address replacing with a per-cpu stable generated one
*/
static const char * const panda_fixup_mac_device_paths[] = {
"usb1/1-1/1-1.1/1-1.1:1.0",
"mmc1:0001:2",
};
static int panda_device_path_need_mac(struct device *dev)
{
const char **try = (const char **)panda_fixup_mac_device_paths;
const char *path;
int count = ARRAY_SIZE(panda_fixup_mac_device_paths);
const char *p;
int len;
struct device *devn;
while (count--) {
p = *try + strlen(*try);
devn = dev;
while (devn) {
path = dev_name(devn);
len = strlen(path);
if ((p - *try) < len) {
devn = NULL;
continue;
}
p -= len;
if (strncmp(path, p, len)) {
devn = NULL;
continue;
}
devn = devn->parent;
if (p == *try)
return count;
if (devn != NULL && (p - *try) < 2)
devn = NULL;
p--;
if (devn != NULL && *p != '/')
devn = NULL;
}
try++;
}
return -ENOENT;
}
static int omap_panda_netdev_event(struct notifier_block *this,
unsigned long event, void *ptr)
{
struct net_device *dev = ptr;
struct sockaddr sa;
int n;
if (event != NETDEV_REGISTER)
return NOTIFY_DONE;
n = panda_device_path_need_mac(dev->dev.parent);
if (n >= 0) {
sa.sa_family = dev->type;
omap2_die_id_to_ethernet_mac(sa.sa_data, n);
dev->netdev_ops->ndo_set_mac_address(dev, &sa);
}
return NOTIFY_DONE;
}
static struct notifier_block omap_panda_netdev_notifier = {
.notifier_call = omap_panda_netdev_event,
.priority = 1,
};
#define PANDA_FB_RAM_SIZE SZ_16M /* 1920×1080*4 * 2 */
static struct omapfb_platform_data panda_fb_pdata = {
.mem_desc = {
.region_cnt = 1,
.region = {
[0] = {
.size = PANDA_FB_RAM_SIZE,
},
},
},
};
static void __init omap4_panda_init(void)
{
int status;
int package = OMAP_PACKAGE_CBS;
if (omap_rev() == OMAP4430_REV_ES1_0)
package = OMAP_PACKAGE_CBL;
omap4_mux_init(board_mux, NULL, package);
omap_mux_init_gpio(GPIO_WIFI_WAKE, OMAP_PIN_INPUT | OMAP_PIN_OFF_WAKEUPENABLE);
omap_mux_init_gpio(GPIO_WIFI_IRQ, OMAP_PIN_INPUT | OMAP_PIN_OFF_WAKEUPENABLE);
if (wl12xx_set_platform_data(&omap_panda_wlan_data))
pr_err("error setting wl12xx data\n");
omap_mux_init_gpio(SYNAPTICS_DSX_GPIO_IRQ, OMAP_PIN_INPUT_PULLUP);
omap_mux_init_gpio(SYNAPTICS_DSX_RESET_GPIO, OMAP_PIN_INPUT_PULLUP);
register_netdevice_notifier(&omap_panda_netdev_notifier);
omap4_panda_i2c_init();
omap_enable_smartreflex_on_init();
platform_add_devices(panda_devices, ARRAY_SIZE(panda_devices));
panda_leds_init();
board_serial_init();
omap_sdrc_init(NULL, NULL);
omap4_twl6030_hsmmc_init(mmc);
omap4_ehci_init();
usb_musb_init(&musb_board_data);
omap_dmm_init();
omapfb_set_platform_data(&panda_fb_pdata);
omap4_panda_display_init();
tonka_buttons_init();
if (cpu_is_omap446x()) {
/* Vsel0 = gpio, vsel1 = gnd */
status = omap_tps6236x_board_setup(true, TPS62361_GPIO, -1,
OMAP_PIN_OFF_OUTPUT_HIGH, -1);
if (status)
pr_err("TPS62361 initialization failed: %d\n", status);
}
}
static void __init omap4_panda_map_io(void)
{
omap2_set_globals_443x();
omap44xx_map_common_io();
}
static const char *omap4_panda_match[] __initdata = {
"ti,omap4-panda",
NULL,
};
MACHINE_START(OMAP4_PANDA, "OMAP4 Panda board")
/* Maintainer: David Anders - Texas Instruments Inc */
.atag_offset = 0x100,
.reserve = omap_reserve,
.map_io = omap4_panda_map_io,
.init_early = omap4430_init_early,
.init_irq = gic_init_irq,
.init_machine = omap4_panda_init,
.timer = &omap4_timer,
.dt_compat = omap4_panda_match,
#ifdef CONFIG_ZONE_DMA
.dma_zone_size = 500 * 1024 * 1024,
#endif
MACHINE_END