/* * sysmocom sysmobts v1 board support. * * Copyright (C) 2012 sysmocom s.f.m.c GmbH * Copyright (C) 2008 Lyrtech * * Based on SFF-SDR platform, original copyright follows: * Lyrtech SFFSDR board support. * * Copyright (C) 2008 Philip Balister, OpenSDR * Copyright (C) 2008 Lyrtech * * Based on DV-EVM platform, original copyright follows: * * Copyright (C) 2007 MontaVista Software, Inc. * * 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; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define SYSMOBTS_V1_PHY_ID "0:01" #define SYSMOBTS_V1_PHY_MASK (0x2) #define DAVINCI_ASYNC_EMIF_CONTROL_BASE 0x01e00000 #define DAVINCI_ASYNC_EMIF_DATA_CE0_BASE 0x02000000 #define DAVINCI_DSP_L1D_EMIF_BASE 0x11F04000 #define DAVINCI_DSP_L1D_EMIF_SIZE 0x00014000 #define DAVINCI_DSP_L1P_EMIF_BASE 0x11E08000 #define DAVINCI_DSP_L1P_EMIF_SIZE 0x00008000 #define DAVINCI_DSP_L2_EMIF_BASE 0x11800000 #define DAVINCI_DSP_L2_EMIF_SIZE 0x00010000 #define DAVINCI_DSP_DDR_EMIF_BASE 0x87800000 #define DAVINCI_DSP_DDR_EMIF_SIZE 0x00800000 #define SYSMOBTS_V1_GPIO_LED_DS6 GPIO(29) #define SYSMOBTS_V1_GPIO_LED_DS7 GPIO(31) #define SYSMOBTS_V1_FPGA_GPIO_BUSY GPIO(45) #define SYSMOBTS_V1_FPGA_GPIO_DONE GPIO(46) #define SYSMOBTS_V1_FPGA_GPIO_INIT_B GPIO(50) #define SYSMOBTS_V1_FPGA_GPIO_PROG_B GPIO(51) #define SYSMOBTS_V1_FPGA_SELECTMAP_BASE 0x04000000 #define FPGA_MEM_BASE (0x04000000) #define FPGA_MEM_SIZE (0x02000000) struct mtd_partition sysmobts_v1_nandflash_partition[] = { /* U-Boot Environment: Block 0 * UBL: Block 1 * U-Boot: Blocks 6-7 (256 kb) * Kernel: Blocks 8-31 (3 Mb) * Linux Root: Blocks 32-287 (32 Mb) * User Storage: Blocks 288-END */ { .name = "U-Boot Environment", .offset = 0, .size = SZ_128K, .mask_flags = MTD_WRITEABLE, /* force read-only */ }, { .name = "UBL", .offset = MTDPART_OFS_APPEND, .size = 5 * SZ_128K, .mask_flags = 0, }, { .name = "U-Boot", .offset = MTDPART_OFS_APPEND, .size = 2 * SZ_128K, .mask_flags = 0, }, { .name = "Kernel", .offset = MTDPART_OFS_APPEND, .size = 3 * SZ_1M, .mask_flags = 0 }, { .name = "RootFs", .offset = MTDPART_OFS_APPEND, .size = 32 * SZ_1M, .mask_flags = 0 }, { .name = "Storage", .offset = MTDPART_OFS_APPEND, .size = MTDPART_SIZ_FULL, .mask_flags = 0 } }; static struct davinci_nand_pdata sysmobts_v1_nandflash_data = { .parts = sysmobts_v1_nandflash_partition, .nr_parts = ARRAY_SIZE(sysmobts_v1_nandflash_partition), .ecc_mode = NAND_ECC_HW, .bbt_options = NAND_BBT_USE_FLASH, }; static struct resource sysmobts_v1_nandflash_resource[] = { { .start = DAVINCI_ASYNC_EMIF_DATA_CE0_BASE, .end = DAVINCI_ASYNC_EMIF_DATA_CE0_BASE + 0x1F, .flags = IORESOURCE_MEM, }, { .start = DAVINCI_ASYNC_EMIF_CONTROL_BASE, .end = DAVINCI_ASYNC_EMIF_CONTROL_BASE + SZ_4K - 1, .flags = IORESOURCE_MEM, }, }; static struct platform_device sysmobts_v1_nandflash_device = { .name = "davinci_nand", /* Name of driver */ .id = 0, .dev = { .platform_data = &sysmobts_v1_nandflash_data, }, .num_resources = ARRAY_SIZE(sysmobts_v1_nandflash_resource), .resource = sysmobts_v1_nandflash_resource, }; static struct at24_platform_data eeprom_info = { .byte_len = (64*1024) / 8, .page_size = 32, .flags = AT24_FLAG_ADDR16, .setup = davinci_get_mac_addr, .context = (void *)0x7f00, }; static struct i2c_board_info __initdata i2c_info[] = { { /* Ethernet EEPROM */ I2C_BOARD_INFO("24c64", 0x50), .platform_data = &eeprom_info, }, { /* Power Management IC */ I2C_BOARD_INFO("tps65023", 0x48), }, { /* Temperature Sensor (BBP) */ I2C_BOARD_INFO("tmp411", 0x4D), }, { /* Temperature Sensor (RF) */ I2C_BOARD_INFO("lm75a", 0x49), }, { /* Fan speed controler */ I2C_BOARD_INFO("ltc1695", 0x74), }, }; static struct davinci_i2c_platform_data i2c_pdata = { .bus_freq = 100 /* kHz */, .bus_delay = 0 /* usec */, }; static void __init sysmobts_v1_init_i2c(void) { davinci_init_i2c(&i2c_pdata); i2c_register_board_info(1, i2c_info, ARRAY_SIZE(i2c_info)); } static struct fpgadl_pdata_t sysmobts_v1_fpgadl_pdata = { .bitstream_max_size = 0x200000, .program_b = SYSMOBTS_V1_FPGA_GPIO_PROG_B, .done = SYSMOBTS_V1_FPGA_GPIO_DONE, .busy = SYSMOBTS_V1_FPGA_GPIO_BUSY, .init_b = SYSMOBTS_V1_FPGA_GPIO_INIT_B, }; static struct resource sysmobts_v1_fpgadl_resources[] = { { .name = "selectmap", .start = SYSMOBTS_V1_FPGA_SELECTMAP_BASE, .end = SYSMOBTS_V1_FPGA_SELECTMAP_BASE + 4 - 1, .flags = IORESOURCE_MEM, } }; static struct platform_device sysmobts_v1_fpgadl_device = { .name = "fpgadl_par", .id = 0, .dev = { .platform_data = &sysmobts_v1_fpgadl_pdata, }, .num_resources = ARRAY_SIZE(sysmobts_v1_fpgadl_resources), .resource = sysmobts_v1_fpgadl_resources, }; static struct resource sysmobts_v1_dspdl_resources[] = { { .name = "l1d", .start = DAVINCI_DSP_L1D_EMIF_BASE, .end = DAVINCI_DSP_L1D_EMIF_BASE + DAVINCI_DSP_L1D_EMIF_SIZE - 1, .flags = IORESOURCE_MEM, }, { .name = "l1p", .start = DAVINCI_DSP_L1P_EMIF_BASE, .end = DAVINCI_DSP_L1P_EMIF_BASE + DAVINCI_DSP_L1P_EMIF_SIZE - 1, .flags = IORESOURCE_MEM, }, { .name = "l2", .start = DAVINCI_DSP_L2_EMIF_BASE, .end = DAVINCI_DSP_L2_EMIF_BASE + DAVINCI_DSP_L2_EMIF_SIZE - 1, .flags = IORESOURCE_MEM, }, { .name = "ddr", .start = DAVINCI_DSP_DDR_EMIF_BASE, .end = DAVINCI_DSP_DDR_EMIF_BASE + DAVINCI_DSP_DDR_EMIF_SIZE - 1, .flags = IORESOURCE_MEM, } }; static struct platform_device sysmobts_v1_dspdl_device = { .name = "dspdl_dm644x", .id = 0, .num_resources = ARRAY_SIZE(sysmobts_v1_dspdl_resources), .resource = sysmobts_v1_dspdl_resources, }; static struct gpio_led sysmobts_v1_gpio_leds[] = { { .name = "activity_led", .gpio = SYSMOBTS_V1_GPIO_LED_DS6, }, { .name = "online_led", .gpio = SYSMOBTS_V1_GPIO_LED_DS7, }, }; static struct gpio_led_platform_data sysmobts_v1_gpio_leds_info = { .leds = sysmobts_v1_gpio_leds, .num_leds = ARRAY_SIZE(sysmobts_v1_gpio_leds), }; static struct platform_device sysmobts_v1_led_device = { .name = "leds-gpio", .id = -1, .dev = { .platform_data = &sysmobts_v1_gpio_leds_info, }, }; static struct platform_device *sysmobts_v1_devices[] __initdata = { &sysmobts_v1_led_device, &sysmobts_v1_fpgadl_device, &sysmobts_v1_dspdl_device, &sysmobts_v1_nandflash_device, }; static struct snd_platform_data sysmobts_v1_snd_data; static struct davinci_uart_config uart_config __initdata = { .enabled_uarts = (1 << 0) | (1 << 1), }; static void __init sysmobts_v1_map_io(void) { dm644x_init(); } static __init void sysmobts_v1_init(void) { struct davinci_soc_info *soc_info = &davinci_soc_info; platform_add_devices(sysmobts_v1_devices, ARRAY_SIZE(sysmobts_v1_devices)); sysmobts_v1_init_i2c(); davinci_serial_init(&uart_config); dm644x_init_asp(&sysmobts_v1_snd_data); soc_info->emac_pdata->phy_id = SYSMOBTS_V1_PHY_ID; } MACHINE_START(SYSMOBTS_V1, "sysmocom s.f.m.c. sysmobts v1") .atag_offset = 0x100, .map_io = sysmobts_v1_map_io, .init_irq = davinci_irq_init, .timer = &davinci_timer, .init_machine = sysmobts_v1_init, .dma_zone_size = SZ_128M, MACHINE_END