Path: blob/master/arch/arm/mach-davinci/board-neuros-osd2.c
10699 views
/*1* Neuros Technologies OSD2 board support2*3* Modified from original 644X-EVM board support.4* 2008 (c) Neuros Technology, LLC.5* 2009 (c) Jorge Luis Zapata Muga <[email protected]>6* 2009 (c) Andrey A. Porodko <[email protected]>7*8* The Neuros OSD 2.0 is the hardware component of the Neuros Open9* Internet Television Platform. Hardware is very close to TI10* DM644X-EVM board. It has:11* DM6446M02 module with 256MB NAND, 256MB RAM, TLV320AIC32 AIC,12* USB, Ethernet, SD/MMC, UART, THS8200, TVP7000 for video.13* Additionally realtime clock, IR remote control receiver,14* IR Blaster based on MSP430 (firmware although is different15* from used in DM644X-EVM), internal ATA-6 3.5” HDD drive16* with PATA interface, two muxed red-green leds.17*18* For more information please refer to19* http://wiki.neurostechnology.com/index.php/OSD_2.0_HD20*21* This file is licensed under the terms of the GNU General Public22* License version 2. This program is licensed "as is" without any23* warranty of any kind, whether express or implied.24*/25#include <linux/platform_device.h>26#include <linux/gpio.h>27#include <linux/mtd/partitions.h>2829#include <asm/mach-types.h>30#include <asm/mach/arch.h>3132#include <mach/dm644x.h>33#include <mach/common.h>34#include <mach/i2c.h>35#include <mach/serial.h>36#include <mach/mux.h>37#include <mach/nand.h>38#include <mach/mmc.h>39#include <mach/usb.h>4041#define NEUROS_OSD2_PHY_ID "0:01"42#define LXT971_PHY_ID 0x001378e243#define LXT971_PHY_MASK 0xfffffff04445#define NTOSD2_AUDIOSOC_I2C_ADDR 0x1846#define NTOSD2_MSP430_I2C_ADDR 0x5947#define NTOSD2_MSP430_IRQ 24849/* Neuros OSD2 has a Samsung 256 MByte NAND flash (Dev ID of 0xAA,50* 2048 blocks in the device, 64 pages per block, 2048 bytes per51* page.52*/5354#define NAND_BLOCK_SIZE SZ_128K5556static struct mtd_partition davinci_ntosd2_nandflash_partition[] = {57{58/* UBL (a few copies) plus U-Boot */59.name = "bootloader",60.offset = 0,61.size = 15 * NAND_BLOCK_SIZE,62.mask_flags = MTD_WRITEABLE, /* force read-only */63}, {64/* U-Boot environment */65.name = "params",66.offset = MTDPART_OFS_APPEND,67.size = 1 * NAND_BLOCK_SIZE,68.mask_flags = 0,69}, {70/* Kernel */71.name = "kernel",72.offset = MTDPART_OFS_APPEND,73.size = SZ_4M,74.mask_flags = 0,75}, {76/* File System */77.name = "filesystem",78.offset = MTDPART_OFS_APPEND,79.size = MTDPART_SIZ_FULL,80.mask_flags = 0,81}82/* A few blocks at end hold a flash Bad Block Table. */83};8485static struct davinci_nand_pdata davinci_ntosd2_nandflash_data = {86.parts = davinci_ntosd2_nandflash_partition,87.nr_parts = ARRAY_SIZE(davinci_ntosd2_nandflash_partition),88.ecc_mode = NAND_ECC_HW,89.options = NAND_USE_FLASH_BBT,90};9192static struct resource davinci_ntosd2_nandflash_resource[] = {93{94.start = DM644X_ASYNC_EMIF_DATA_CE0_BASE,95.end = DM644X_ASYNC_EMIF_DATA_CE0_BASE + SZ_16M - 1,96.flags = IORESOURCE_MEM,97}, {98.start = DM644X_ASYNC_EMIF_CONTROL_BASE,99.end = DM644X_ASYNC_EMIF_CONTROL_BASE + SZ_4K - 1,100.flags = IORESOURCE_MEM,101},102};103104static struct platform_device davinci_ntosd2_nandflash_device = {105.name = "davinci_nand",106.id = 0,107.dev = {108.platform_data = &davinci_ntosd2_nandflash_data,109},110.num_resources = ARRAY_SIZE(davinci_ntosd2_nandflash_resource),111.resource = davinci_ntosd2_nandflash_resource,112};113114static u64 davinci_fb_dma_mask = DMA_BIT_MASK(32);115116static struct platform_device davinci_fb_device = {117.name = "davincifb",118.id = -1,119.dev = {120.dma_mask = &davinci_fb_dma_mask,121.coherent_dma_mask = DMA_BIT_MASK(32),122},123.num_resources = 0,124};125126static struct snd_platform_data dm644x_ntosd2_snd_data;127128static struct gpio_led ntosd2_leds[] = {129{ .name = "led1_green", .gpio = GPIO(10), },130{ .name = "led1_red", .gpio = GPIO(11), },131{ .name = "led2_green", .gpio = GPIO(12), },132{ .name = "led2_red", .gpio = GPIO(13), },133};134135static struct gpio_led_platform_data ntosd2_leds_data = {136.num_leds = ARRAY_SIZE(ntosd2_leds),137.leds = ntosd2_leds,138};139140static struct platform_device ntosd2_leds_dev = {141.name = "leds-gpio",142.id = -1,143.dev = {144.platform_data = &ntosd2_leds_data,145},146};147148149static struct platform_device *davinci_ntosd2_devices[] __initdata = {150&davinci_fb_device,151&ntosd2_leds_dev,152};153154static struct davinci_uart_config uart_config __initdata = {155.enabled_uarts = (1 << 0),156};157158static void __init davinci_ntosd2_map_io(void)159{160dm644x_init();161}162163/*164I2C initialization165*/166static struct davinci_i2c_platform_data ntosd2_i2c_pdata = {167.bus_freq = 20 /* kHz */,168.bus_delay = 100 /* usec */,169};170171static struct i2c_board_info __initdata ntosd2_i2c_info[] = {172};173174static int ntosd2_init_i2c(void)175{176int status;177178davinci_init_i2c(&ntosd2_i2c_pdata);179status = gpio_request(NTOSD2_MSP430_IRQ, ntosd2_i2c_info[0].type);180if (status == 0) {181status = gpio_direction_input(NTOSD2_MSP430_IRQ);182if (status == 0) {183status = gpio_to_irq(NTOSD2_MSP430_IRQ);184if (status > 0) {185ntosd2_i2c_info[0].irq = status;186i2c_register_board_info(1,187ntosd2_i2c_info,188ARRAY_SIZE(ntosd2_i2c_info));189}190}191}192return status;193}194195static struct davinci_mmc_config davinci_ntosd2_mmc_config = {196.wires = 4,197.version = MMC_CTLR_VERSION_1198};199200201#if defined(CONFIG_BLK_DEV_PALMCHIP_BK3710) || \202defined(CONFIG_BLK_DEV_PALMCHIP_BK3710_MODULE)203#define HAS_ATA 1204#else205#define HAS_ATA 0206#endif207208#if defined(CONFIG_MTD_NAND_DAVINCI) || \209defined(CONFIG_MTD_NAND_DAVINCI_MODULE)210#define HAS_NAND 1211#else212#define HAS_NAND 0213#endif214215static __init void davinci_ntosd2_init(void)216{217struct clk *aemif_clk;218struct davinci_soc_info *soc_info = &davinci_soc_info;219int status;220221aemif_clk = clk_get(NULL, "aemif");222clk_enable(aemif_clk);223224if (HAS_ATA) {225if (HAS_NAND)226pr_warning("WARNING: both IDE and Flash are "227"enabled, but they share AEMIF pins.\n"228"\tDisable IDE for NAND/NOR support.\n");229davinci_init_ide();230} else if (HAS_NAND) {231davinci_cfg_reg(DM644X_HPIEN_DISABLE);232davinci_cfg_reg(DM644X_ATAEN_DISABLE);233234/* only one device will be jumpered and detected */235if (HAS_NAND)236platform_device_register(237&davinci_ntosd2_nandflash_device);238}239240platform_add_devices(davinci_ntosd2_devices,241ARRAY_SIZE(davinci_ntosd2_devices));242243/* Initialize I2C interface specific for this board */244status = ntosd2_init_i2c();245if (status < 0)246pr_warning("davinci_ntosd2_init: msp430 irq setup failed:"247" %d\n", status);248249davinci_serial_init(&uart_config);250dm644x_init_asp(&dm644x_ntosd2_snd_data);251252soc_info->emac_pdata->phy_id = NEUROS_OSD2_PHY_ID;253254davinci_setup_usb(1000, 8);255/*256* Mux the pins to be GPIOs, VLYNQEN is already done at startup.257* The AEAWx are five new AEAW pins that can be muxed by separately.258* They are a bitmask for GPIO management. According TI259* documentation (http://www.ti.com/lit/gpn/tms320dm6446) to employ260* gpio(10,11,12,13) for leds any combination of bits works except261* four last. So we are to reset all five.262*/263davinci_cfg_reg(DM644X_AEAW0);264davinci_cfg_reg(DM644X_AEAW1);265davinci_cfg_reg(DM644X_AEAW2);266davinci_cfg_reg(DM644X_AEAW3);267davinci_cfg_reg(DM644X_AEAW4);268269davinci_setup_mmc(0, &davinci_ntosd2_mmc_config);270}271272MACHINE_START(NEUROS_OSD2, "Neuros OSD2")273/* Maintainer: Neuros Technologies <[email protected]> */274.boot_params = (DAVINCI_DDR_BASE + 0x100),275.map_io = davinci_ntosd2_map_io,276.init_irq = davinci_irq_init,277.timer = &davinci_timer,278.init_machine = davinci_ntosd2_init,279MACHINE_END280281282