2009-06-04 09:41:53 +08:00
|
|
|
/*
|
|
|
|
* TI DA830/OMAP L137 EVM board
|
|
|
|
*
|
|
|
|
* Author: Mark A. Greer <mgreer@mvista.com>
|
|
|
|
* Derived from: arch/arm/mach-davinci/board-dm644x-evm.c
|
|
|
|
*
|
|
|
|
* 2007, 2009 (c) MontaVista Software, Inc. This file is licensed under
|
|
|
|
* the terms of the GNU General Public License version 2. This program
|
|
|
|
* is licensed "as is" without any warranty of any kind, whether express
|
|
|
|
* or implied.
|
|
|
|
*/
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/console.h>
|
2009-09-16 09:15:06 +08:00
|
|
|
#include <linux/gpio.h>
|
2009-06-04 09:41:53 +08:00
|
|
|
#include <linux/i2c.h>
|
2009-09-16 09:15:06 +08:00
|
|
|
#include <linux/i2c/pcf857x.h>
|
2009-06-04 09:41:53 +08:00
|
|
|
#include <linux/i2c/at24.h>
|
|
|
|
|
|
|
|
#include <asm/mach-types.h>
|
|
|
|
#include <asm/mach/arch.h>
|
|
|
|
|
|
|
|
#include <mach/common.h>
|
|
|
|
#include <mach/irqs.h>
|
|
|
|
#include <mach/cp_intc.h>
|
2009-08-29 06:05:21 +08:00
|
|
|
#include <mach/mux.h>
|
2009-09-16 09:10:20 +08:00
|
|
|
#include <mach/gpio.h>
|
2009-06-04 09:41:53 +08:00
|
|
|
#include <mach/da8xx.h>
|
2009-08-12 05:01:59 +08:00
|
|
|
#include <mach/asp.h>
|
2009-06-04 09:41:53 +08:00
|
|
|
|
|
|
|
#define DA830_EVM_PHY_MASK 0x0
|
|
|
|
#define DA830_EVM_MDIO_FREQUENCY 2200000 /* PHY bus frequency */
|
|
|
|
|
|
|
|
static struct at24_platform_data da830_evm_i2c_eeprom_info = {
|
|
|
|
.byte_len = SZ_256K / 8,
|
|
|
|
.page_size = 64,
|
|
|
|
.flags = AT24_FLAG_ADDR16,
|
|
|
|
.setup = davinci_get_mac_addr,
|
|
|
|
.context = (void *)0x7f00,
|
|
|
|
};
|
|
|
|
|
2009-09-16 09:15:06 +08:00
|
|
|
static int da830_evm_ui_expander_setup(struct i2c_client *client, int gpio,
|
|
|
|
unsigned ngpio, void *context)
|
|
|
|
{
|
|
|
|
gpio_request(gpio + 6, "MUX_MODE");
|
|
|
|
#ifdef CONFIG_DA830_UI_LCD
|
|
|
|
gpio_direction_output(gpio + 6, 0);
|
|
|
|
#else /* Must be NAND or NOR */
|
|
|
|
gpio_direction_output(gpio + 6, 1);
|
|
|
|
#endif
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int da830_evm_ui_expander_teardown(struct i2c_client *client, int gpio,
|
|
|
|
unsigned ngpio, void *context)
|
|
|
|
{
|
|
|
|
gpio_free(gpio + 6);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct pcf857x_platform_data da830_evm_ui_expander_info = {
|
|
|
|
.gpio_base = DAVINCI_N_GPIO,
|
|
|
|
.setup = da830_evm_ui_expander_setup,
|
|
|
|
.teardown = da830_evm_ui_expander_teardown,
|
|
|
|
};
|
|
|
|
|
2009-06-04 09:41:53 +08:00
|
|
|
static struct i2c_board_info __initdata da830_evm_i2c_devices[] = {
|
|
|
|
{
|
|
|
|
I2C_BOARD_INFO("24c256", 0x50),
|
|
|
|
.platform_data = &da830_evm_i2c_eeprom_info,
|
|
|
|
},
|
2009-08-25 20:20:05 +08:00
|
|
|
{
|
|
|
|
I2C_BOARD_INFO("tlv320aic3x", 0x18),
|
2009-09-16 09:15:06 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
I2C_BOARD_INFO("pcf8574", 0x3f),
|
|
|
|
.platform_data = &da830_evm_ui_expander_info,
|
|
|
|
},
|
2009-06-04 09:41:53 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
static struct davinci_i2c_platform_data da830_evm_i2c_0_pdata = {
|
|
|
|
.bus_freq = 100, /* kHz */
|
|
|
|
.bus_delay = 0, /* usec */
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct davinci_uart_config da830_evm_uart_config __initdata = {
|
|
|
|
.enabled_uarts = 0x7,
|
|
|
|
};
|
|
|
|
|
2009-08-29 06:05:21 +08:00
|
|
|
static const short da830_evm_mcasp1_pins[] = {
|
|
|
|
DA830_AHCLKX1, DA830_ACLKX1, DA830_AFSX1, DA830_AHCLKR1, DA830_AFSR1,
|
|
|
|
DA830_AMUTE1, DA830_AXR1_0, DA830_AXR1_1, DA830_AXR1_2, DA830_AXR1_5,
|
|
|
|
DA830_ACLKR1, DA830_AXR1_6, DA830_AXR1_7, DA830_AXR1_8, DA830_AXR1_10,
|
|
|
|
DA830_AXR1_11,
|
|
|
|
-1
|
|
|
|
};
|
|
|
|
|
2009-08-12 05:01:59 +08:00
|
|
|
static u8 da830_iis_serializer_direction[] = {
|
|
|
|
RX_MODE, INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE,
|
|
|
|
INACTIVE_MODE, TX_MODE, INACTIVE_MODE, INACTIVE_MODE,
|
|
|
|
INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct snd_platform_data da830_evm_snd_data = {
|
|
|
|
.tx_dma_offset = 0x2000,
|
|
|
|
.rx_dma_offset = 0x2000,
|
|
|
|
.op_mode = DAVINCI_MCASP_IIS_MODE,
|
|
|
|
.num_serializer = ARRAY_SIZE(da830_iis_serializer_direction),
|
|
|
|
.tdm_slots = 2,
|
|
|
|
.serial_dir = da830_iis_serializer_direction,
|
|
|
|
.eventq_no = EVENTQ_0,
|
|
|
|
.version = MCASP_VERSION_2,
|
|
|
|
.txnumevt = 1,
|
|
|
|
.rxnumevt = 1,
|
|
|
|
};
|
|
|
|
|
2009-09-16 09:10:20 +08:00
|
|
|
/*
|
|
|
|
* GPIO2[1] is used as MMC_SD_WP and GPIO2[2] as MMC_SD_INS.
|
|
|
|
*/
|
|
|
|
static const short da830_evm_mmc_sd_pins[] = {
|
|
|
|
DA830_MMCSD_DAT_0, DA830_MMCSD_DAT_1, DA830_MMCSD_DAT_2,
|
|
|
|
DA830_MMCSD_DAT_3, DA830_MMCSD_DAT_4, DA830_MMCSD_DAT_5,
|
|
|
|
DA830_MMCSD_DAT_6, DA830_MMCSD_DAT_7, DA830_MMCSD_CLK,
|
|
|
|
DA830_MMCSD_CMD, DA830_GPIO2_1, DA830_GPIO2_2,
|
|
|
|
-1
|
|
|
|
};
|
|
|
|
|
|
|
|
#define DA830_MMCSD_WP_PIN GPIO_TO_PIN(2, 1)
|
|
|
|
|
|
|
|
static int da830_evm_mmc_get_ro(int index)
|
|
|
|
{
|
|
|
|
return gpio_get_value(DA830_MMCSD_WP_PIN);
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct davinci_mmc_config da830_evm_mmc_config = {
|
|
|
|
.get_ro = da830_evm_mmc_get_ro,
|
|
|
|
.wires = 4,
|
|
|
|
.version = MMC_CTLR_VERSION_2,
|
|
|
|
};
|
|
|
|
|
|
|
|
static inline void da830_evm_init_mmc(void)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
ret = da8xx_pinmux_setup(da830_evm_mmc_sd_pins);
|
|
|
|
if (ret) {
|
|
|
|
pr_warning("da830_evm_init: mmc/sd mux setup failed: %d\n",
|
|
|
|
ret);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = gpio_request(DA830_MMCSD_WP_PIN, "MMC WP");
|
|
|
|
if (ret) {
|
|
|
|
pr_warning("da830_evm_init: can not open GPIO %d\n",
|
|
|
|
DA830_MMCSD_WP_PIN);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
gpio_direction_input(DA830_MMCSD_WP_PIN);
|
|
|
|
|
|
|
|
ret = da8xx_register_mmcsd0(&da830_evm_mmc_config);
|
|
|
|
if (ret) {
|
|
|
|
pr_warning("da830_evm_init: mmc/sd registration failed: %d\n",
|
|
|
|
ret);
|
|
|
|
gpio_free(DA830_MMCSD_WP_PIN);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-06-04 09:41:53 +08:00
|
|
|
static __init void da830_evm_init(void)
|
|
|
|
{
|
|
|
|
struct davinci_soc_info *soc_info = &davinci_soc_info;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
ret = da8xx_register_edma();
|
|
|
|
if (ret)
|
|
|
|
pr_warning("da830_evm_init: edma registration failed: %d\n",
|
|
|
|
ret);
|
|
|
|
|
2009-07-16 17:45:32 +08:00
|
|
|
ret = da8xx_pinmux_setup(da830_i2c0_pins);
|
2009-06-04 09:41:53 +08:00
|
|
|
if (ret)
|
|
|
|
pr_warning("da830_evm_init: i2c0 mux setup failed: %d\n",
|
|
|
|
ret);
|
|
|
|
|
|
|
|
ret = da8xx_register_i2c(0, &da830_evm_i2c_0_pdata);
|
|
|
|
if (ret)
|
|
|
|
pr_warning("da830_evm_init: i2c0 registration failed: %d\n",
|
|
|
|
ret);
|
|
|
|
|
|
|
|
soc_info->emac_pdata->phy_mask = DA830_EVM_PHY_MASK;
|
|
|
|
soc_info->emac_pdata->mdio_max_freq = DA830_EVM_MDIO_FREQUENCY;
|
|
|
|
soc_info->emac_pdata->rmii_en = 1;
|
|
|
|
|
2009-07-16 17:45:32 +08:00
|
|
|
ret = da8xx_pinmux_setup(da830_cpgmac_pins);
|
2009-06-04 09:41:53 +08:00
|
|
|
if (ret)
|
|
|
|
pr_warning("da830_evm_init: cpgmac mux setup failed: %d\n",
|
|
|
|
ret);
|
|
|
|
|
|
|
|
ret = da8xx_register_emac();
|
|
|
|
if (ret)
|
|
|
|
pr_warning("da830_evm_init: emac registration failed: %d\n",
|
|
|
|
ret);
|
|
|
|
|
|
|
|
ret = da8xx_register_watchdog();
|
|
|
|
if (ret)
|
|
|
|
pr_warning("da830_evm_init: watchdog registration failed: %d\n",
|
|
|
|
ret);
|
|
|
|
|
|
|
|
davinci_serial_init(&da830_evm_uart_config);
|
|
|
|
i2c_register_board_info(1, da830_evm_i2c_devices,
|
|
|
|
ARRAY_SIZE(da830_evm_i2c_devices));
|
2009-08-12 05:01:59 +08:00
|
|
|
|
2009-08-29 06:05:21 +08:00
|
|
|
ret = da8xx_pinmux_setup(da830_evm_mcasp1_pins);
|
2009-08-12 05:01:59 +08:00
|
|
|
if (ret)
|
|
|
|
pr_warning("da830_evm_init: mcasp1 mux setup failed: %d\n",
|
|
|
|
ret);
|
|
|
|
|
2009-08-29 06:05:02 +08:00
|
|
|
da8xx_register_mcasp(1, &da830_evm_snd_data);
|
2009-09-16 09:10:20 +08:00
|
|
|
|
|
|
|
da830_evm_init_mmc();
|
2009-09-16 09:15:06 +08:00
|
|
|
|
|
|
|
#ifdef CONFIG_DA830_UI_LCD
|
|
|
|
ret = da8xx_pinmux_setup(da830_lcdcntl_pins);
|
|
|
|
if (ret)
|
|
|
|
pr_warning("da830_evm_init: lcdcntl mux setup failed: %d\n",
|
|
|
|
ret);
|
|
|
|
|
|
|
|
ret = da8xx_register_lcdc(&sharp_lcd035q3dg01_pdata);
|
|
|
|
if (ret)
|
|
|
|
pr_warning("da830_evm_init: lcd setup failed: %d\n", ret);
|
|
|
|
#endif
|
2009-06-04 09:41:53 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef CONFIG_SERIAL_8250_CONSOLE
|
|
|
|
static int __init da830_evm_console_init(void)
|
|
|
|
{
|
|
|
|
return add_preferred_console("ttyS", 2, "115200");
|
|
|
|
}
|
|
|
|
console_initcall(da830_evm_console_init);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static __init void da830_evm_irq_init(void)
|
|
|
|
{
|
|
|
|
struct davinci_soc_info *soc_info = &davinci_soc_info;
|
|
|
|
|
|
|
|
cp_intc_init((void __iomem *)DA8XX_CP_INTC_VIRT, DA830_N_CP_INTC_IRQ,
|
|
|
|
soc_info->intc_irq_prios);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void __init da830_evm_map_io(void)
|
|
|
|
{
|
|
|
|
da830_init();
|
|
|
|
}
|
|
|
|
|
2009-07-08 23:32:27 +08:00
|
|
|
MACHINE_START(DAVINCI_DA830_EVM, "DaVinci DA830/OMAP L137 EVM")
|
2009-06-04 09:41:53 +08:00
|
|
|
.phys_io = IO_PHYS,
|
|
|
|
.io_pg_offst = (__IO_ADDRESS(IO_PHYS) >> 18) & 0xfffc,
|
|
|
|
.boot_params = (DA8XX_DDR_BASE + 0x100),
|
|
|
|
.map_io = da830_evm_map_io,
|
|
|
|
.init_irq = da830_evm_irq_init,
|
|
|
|
.timer = &davinci_timer,
|
|
|
|
.init_machine = da830_evm_init,
|
|
|
|
MACHINE_END
|