18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * Hawkboard.org based on TI's OMAP-L138 Platform 38c2ecf20Sopenharmony_ci * 48c2ecf20Sopenharmony_ci * Initial code: Syed Mohammed Khasim 58c2ecf20Sopenharmony_ci * 68c2ecf20Sopenharmony_ci * Copyright (C) 2009 Texas Instruments Incorporated - https://www.ti.com 78c2ecf20Sopenharmony_ci * 88c2ecf20Sopenharmony_ci * This file is licensed under the terms of the GNU General Public License 98c2ecf20Sopenharmony_ci * version 2. This program is licensed "as is" without any warranty of 108c2ecf20Sopenharmony_ci * any kind, whether express or implied. 118c2ecf20Sopenharmony_ci */ 128c2ecf20Sopenharmony_ci#include <linux/kernel.h> 138c2ecf20Sopenharmony_ci#include <linux/init.h> 148c2ecf20Sopenharmony_ci#include <linux/console.h> 158c2ecf20Sopenharmony_ci#include <linux/interrupt.h> 168c2ecf20Sopenharmony_ci#include <linux/gpio.h> 178c2ecf20Sopenharmony_ci#include <linux/gpio/machine.h> 188c2ecf20Sopenharmony_ci#include <linux/mtd/partitions.h> 198c2ecf20Sopenharmony_ci#include <linux/mtd/rawnand.h> 208c2ecf20Sopenharmony_ci#include <linux/platform_data/gpio-davinci.h> 218c2ecf20Sopenharmony_ci#include <linux/platform_data/mtd-davinci.h> 228c2ecf20Sopenharmony_ci#include <linux/platform_data/mtd-davinci-aemif.h> 238c2ecf20Sopenharmony_ci#include <linux/platform_data/ti-aemif.h> 248c2ecf20Sopenharmony_ci#include <linux/regulator/fixed.h> 258c2ecf20Sopenharmony_ci#include <linux/regulator/machine.h> 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ci#include <asm/mach-types.h> 288c2ecf20Sopenharmony_ci#include <asm/mach/arch.h> 298c2ecf20Sopenharmony_ci 308c2ecf20Sopenharmony_ci#include <mach/common.h> 318c2ecf20Sopenharmony_ci#include <mach/da8xx.h> 328c2ecf20Sopenharmony_ci#include <mach/mux.h> 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_ci#define HAWKBOARD_PHY_ID "davinci_mdio-0:07" 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_ci#define DA850_USB1_VBUS_PIN GPIO_TO_PIN(2, 4) 378c2ecf20Sopenharmony_ci#define DA850_USB1_OC_PIN GPIO_TO_PIN(6, 13) 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_cistatic short omapl138_hawk_mii_pins[] __initdata = { 408c2ecf20Sopenharmony_ci DA850_MII_TXEN, DA850_MII_TXCLK, DA850_MII_COL, DA850_MII_TXD_3, 418c2ecf20Sopenharmony_ci DA850_MII_TXD_2, DA850_MII_TXD_1, DA850_MII_TXD_0, DA850_MII_RXER, 428c2ecf20Sopenharmony_ci DA850_MII_CRS, DA850_MII_RXCLK, DA850_MII_RXDV, DA850_MII_RXD_3, 438c2ecf20Sopenharmony_ci DA850_MII_RXD_2, DA850_MII_RXD_1, DA850_MII_RXD_0, DA850_MDIO_CLK, 448c2ecf20Sopenharmony_ci DA850_MDIO_D, 458c2ecf20Sopenharmony_ci -1 468c2ecf20Sopenharmony_ci}; 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_cistatic __init void omapl138_hawk_config_emac(void) 498c2ecf20Sopenharmony_ci{ 508c2ecf20Sopenharmony_ci void __iomem *cfgchip3 = DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP3_REG); 518c2ecf20Sopenharmony_ci int ret; 528c2ecf20Sopenharmony_ci u32 val; 538c2ecf20Sopenharmony_ci struct davinci_soc_info *soc_info = &davinci_soc_info; 548c2ecf20Sopenharmony_ci 558c2ecf20Sopenharmony_ci val = __raw_readl(cfgchip3); 568c2ecf20Sopenharmony_ci val &= ~BIT(8); 578c2ecf20Sopenharmony_ci ret = davinci_cfg_reg_list(omapl138_hawk_mii_pins); 588c2ecf20Sopenharmony_ci if (ret) { 598c2ecf20Sopenharmony_ci pr_warn("%s: CPGMAC/MII mux setup failed: %d\n", __func__, ret); 608c2ecf20Sopenharmony_ci return; 618c2ecf20Sopenharmony_ci } 628c2ecf20Sopenharmony_ci 638c2ecf20Sopenharmony_ci /* configure the CFGCHIP3 register for MII */ 648c2ecf20Sopenharmony_ci __raw_writel(val, cfgchip3); 658c2ecf20Sopenharmony_ci pr_info("EMAC: MII PHY configured\n"); 668c2ecf20Sopenharmony_ci 678c2ecf20Sopenharmony_ci soc_info->emac_pdata->phy_id = HAWKBOARD_PHY_ID; 688c2ecf20Sopenharmony_ci 698c2ecf20Sopenharmony_ci ret = da8xx_register_emac(); 708c2ecf20Sopenharmony_ci if (ret) 718c2ecf20Sopenharmony_ci pr_warn("%s: EMAC registration failed: %d\n", __func__, ret); 728c2ecf20Sopenharmony_ci} 738c2ecf20Sopenharmony_ci 748c2ecf20Sopenharmony_ci/* 758c2ecf20Sopenharmony_ci * The following EDMA channels/slots are not being used by drivers (for 768c2ecf20Sopenharmony_ci * example: Timer, GPIO, UART events etc) on da850/omap-l138 EVM/Hawkboard, 778c2ecf20Sopenharmony_ci * hence they are being reserved for codecs on the DSP side. 788c2ecf20Sopenharmony_ci */ 798c2ecf20Sopenharmony_cistatic const s16 da850_dma0_rsv_chans[][2] = { 808c2ecf20Sopenharmony_ci /* (offset, number) */ 818c2ecf20Sopenharmony_ci { 8, 6}, 828c2ecf20Sopenharmony_ci {24, 4}, 838c2ecf20Sopenharmony_ci {30, 2}, 848c2ecf20Sopenharmony_ci {-1, -1} 858c2ecf20Sopenharmony_ci}; 868c2ecf20Sopenharmony_ci 878c2ecf20Sopenharmony_cistatic const s16 da850_dma0_rsv_slots[][2] = { 888c2ecf20Sopenharmony_ci /* (offset, number) */ 898c2ecf20Sopenharmony_ci { 8, 6}, 908c2ecf20Sopenharmony_ci {24, 4}, 918c2ecf20Sopenharmony_ci {30, 50}, 928c2ecf20Sopenharmony_ci {-1, -1} 938c2ecf20Sopenharmony_ci}; 948c2ecf20Sopenharmony_ci 958c2ecf20Sopenharmony_cistatic const s16 da850_dma1_rsv_chans[][2] = { 968c2ecf20Sopenharmony_ci /* (offset, number) */ 978c2ecf20Sopenharmony_ci { 0, 28}, 988c2ecf20Sopenharmony_ci {30, 2}, 998c2ecf20Sopenharmony_ci {-1, -1} 1008c2ecf20Sopenharmony_ci}; 1018c2ecf20Sopenharmony_ci 1028c2ecf20Sopenharmony_cistatic const s16 da850_dma1_rsv_slots[][2] = { 1038c2ecf20Sopenharmony_ci /* (offset, number) */ 1048c2ecf20Sopenharmony_ci { 0, 28}, 1058c2ecf20Sopenharmony_ci {30, 90}, 1068c2ecf20Sopenharmony_ci {-1, -1} 1078c2ecf20Sopenharmony_ci}; 1088c2ecf20Sopenharmony_ci 1098c2ecf20Sopenharmony_cistatic struct edma_rsv_info da850_edma_cc0_rsv = { 1108c2ecf20Sopenharmony_ci .rsv_chans = da850_dma0_rsv_chans, 1118c2ecf20Sopenharmony_ci .rsv_slots = da850_dma0_rsv_slots, 1128c2ecf20Sopenharmony_ci}; 1138c2ecf20Sopenharmony_ci 1148c2ecf20Sopenharmony_cistatic struct edma_rsv_info da850_edma_cc1_rsv = { 1158c2ecf20Sopenharmony_ci .rsv_chans = da850_dma1_rsv_chans, 1168c2ecf20Sopenharmony_ci .rsv_slots = da850_dma1_rsv_slots, 1178c2ecf20Sopenharmony_ci}; 1188c2ecf20Sopenharmony_ci 1198c2ecf20Sopenharmony_cistatic struct edma_rsv_info *da850_edma_rsv[2] = { 1208c2ecf20Sopenharmony_ci &da850_edma_cc0_rsv, 1218c2ecf20Sopenharmony_ci &da850_edma_cc1_rsv, 1228c2ecf20Sopenharmony_ci}; 1238c2ecf20Sopenharmony_ci 1248c2ecf20Sopenharmony_cistatic const short hawk_mmcsd0_pins[] = { 1258c2ecf20Sopenharmony_ci DA850_MMCSD0_DAT_0, DA850_MMCSD0_DAT_1, DA850_MMCSD0_DAT_2, 1268c2ecf20Sopenharmony_ci DA850_MMCSD0_DAT_3, DA850_MMCSD0_CLK, DA850_MMCSD0_CMD, 1278c2ecf20Sopenharmony_ci DA850_GPIO3_12, DA850_GPIO3_13, 1288c2ecf20Sopenharmony_ci -1 1298c2ecf20Sopenharmony_ci}; 1308c2ecf20Sopenharmony_ci 1318c2ecf20Sopenharmony_ci#define DA850_HAWK_MMCSD_CD_PIN GPIO_TO_PIN(3, 12) 1328c2ecf20Sopenharmony_ci#define DA850_HAWK_MMCSD_WP_PIN GPIO_TO_PIN(3, 13) 1338c2ecf20Sopenharmony_ci 1348c2ecf20Sopenharmony_cistatic struct gpiod_lookup_table mmc_gpios_table = { 1358c2ecf20Sopenharmony_ci .dev_id = "da830-mmc.0", 1368c2ecf20Sopenharmony_ci .table = { 1378c2ecf20Sopenharmony_ci GPIO_LOOKUP("davinci_gpio", DA850_HAWK_MMCSD_CD_PIN, "cd", 1388c2ecf20Sopenharmony_ci GPIO_ACTIVE_LOW), 1398c2ecf20Sopenharmony_ci GPIO_LOOKUP("davinci_gpio", DA850_HAWK_MMCSD_WP_PIN, "wp", 1408c2ecf20Sopenharmony_ci GPIO_ACTIVE_LOW), 1418c2ecf20Sopenharmony_ci }, 1428c2ecf20Sopenharmony_ci}; 1438c2ecf20Sopenharmony_ci 1448c2ecf20Sopenharmony_cistatic struct davinci_mmc_config da850_mmc_config = { 1458c2ecf20Sopenharmony_ci .wires = 4, 1468c2ecf20Sopenharmony_ci .max_freq = 50000000, 1478c2ecf20Sopenharmony_ci .caps = MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED, 1488c2ecf20Sopenharmony_ci}; 1498c2ecf20Sopenharmony_ci 1508c2ecf20Sopenharmony_cistatic __init void omapl138_hawk_mmc_init(void) 1518c2ecf20Sopenharmony_ci{ 1528c2ecf20Sopenharmony_ci int ret; 1538c2ecf20Sopenharmony_ci 1548c2ecf20Sopenharmony_ci ret = davinci_cfg_reg_list(hawk_mmcsd0_pins); 1558c2ecf20Sopenharmony_ci if (ret) { 1568c2ecf20Sopenharmony_ci pr_warn("%s: MMC/SD0 mux setup failed: %d\n", __func__, ret); 1578c2ecf20Sopenharmony_ci return; 1588c2ecf20Sopenharmony_ci } 1598c2ecf20Sopenharmony_ci 1608c2ecf20Sopenharmony_ci gpiod_add_lookup_table(&mmc_gpios_table); 1618c2ecf20Sopenharmony_ci 1628c2ecf20Sopenharmony_ci ret = da8xx_register_mmcsd0(&da850_mmc_config); 1638c2ecf20Sopenharmony_ci if (ret) { 1648c2ecf20Sopenharmony_ci pr_warn("%s: MMC/SD0 registration failed: %d\n", __func__, ret); 1658c2ecf20Sopenharmony_ci goto mmc_setup_mmcsd_fail; 1668c2ecf20Sopenharmony_ci } 1678c2ecf20Sopenharmony_ci 1688c2ecf20Sopenharmony_ci return; 1698c2ecf20Sopenharmony_ci 1708c2ecf20Sopenharmony_cimmc_setup_mmcsd_fail: 1718c2ecf20Sopenharmony_ci gpiod_remove_lookup_table(&mmc_gpios_table); 1728c2ecf20Sopenharmony_ci} 1738c2ecf20Sopenharmony_ci 1748c2ecf20Sopenharmony_cistatic struct mtd_partition omapl138_hawk_nandflash_partition[] = { 1758c2ecf20Sopenharmony_ci { 1768c2ecf20Sopenharmony_ci .name = "u-boot env", 1778c2ecf20Sopenharmony_ci .offset = 0, 1788c2ecf20Sopenharmony_ci .size = SZ_128K, 1798c2ecf20Sopenharmony_ci .mask_flags = MTD_WRITEABLE, 1808c2ecf20Sopenharmony_ci }, 1818c2ecf20Sopenharmony_ci { 1828c2ecf20Sopenharmony_ci .name = "u-boot", 1838c2ecf20Sopenharmony_ci .offset = MTDPART_OFS_APPEND, 1848c2ecf20Sopenharmony_ci .size = SZ_512K, 1858c2ecf20Sopenharmony_ci .mask_flags = MTD_WRITEABLE, 1868c2ecf20Sopenharmony_ci }, 1878c2ecf20Sopenharmony_ci { 1888c2ecf20Sopenharmony_ci .name = "free space", 1898c2ecf20Sopenharmony_ci .offset = MTDPART_OFS_APPEND, 1908c2ecf20Sopenharmony_ci .size = MTDPART_SIZ_FULL, 1918c2ecf20Sopenharmony_ci .mask_flags = 0, 1928c2ecf20Sopenharmony_ci }, 1938c2ecf20Sopenharmony_ci}; 1948c2ecf20Sopenharmony_ci 1958c2ecf20Sopenharmony_cistatic struct davinci_aemif_timing omapl138_hawk_nandflash_timing = { 1968c2ecf20Sopenharmony_ci .wsetup = 24, 1978c2ecf20Sopenharmony_ci .wstrobe = 21, 1988c2ecf20Sopenharmony_ci .whold = 14, 1998c2ecf20Sopenharmony_ci .rsetup = 19, 2008c2ecf20Sopenharmony_ci .rstrobe = 50, 2018c2ecf20Sopenharmony_ci .rhold = 0, 2028c2ecf20Sopenharmony_ci .ta = 20, 2038c2ecf20Sopenharmony_ci}; 2048c2ecf20Sopenharmony_ci 2058c2ecf20Sopenharmony_cistatic struct davinci_nand_pdata omapl138_hawk_nandflash_data = { 2068c2ecf20Sopenharmony_ci .core_chipsel = 1, 2078c2ecf20Sopenharmony_ci .parts = omapl138_hawk_nandflash_partition, 2088c2ecf20Sopenharmony_ci .nr_parts = ARRAY_SIZE(omapl138_hawk_nandflash_partition), 2098c2ecf20Sopenharmony_ci .engine_type = NAND_ECC_ENGINE_TYPE_ON_HOST, 2108c2ecf20Sopenharmony_ci .ecc_bits = 4, 2118c2ecf20Sopenharmony_ci .bbt_options = NAND_BBT_USE_FLASH, 2128c2ecf20Sopenharmony_ci .options = NAND_BUSWIDTH_16, 2138c2ecf20Sopenharmony_ci .timing = &omapl138_hawk_nandflash_timing, 2148c2ecf20Sopenharmony_ci .mask_chipsel = 0, 2158c2ecf20Sopenharmony_ci .mask_ale = 0, 2168c2ecf20Sopenharmony_ci .mask_cle = 0, 2178c2ecf20Sopenharmony_ci}; 2188c2ecf20Sopenharmony_ci 2198c2ecf20Sopenharmony_cistatic struct resource omapl138_hawk_nandflash_resource[] = { 2208c2ecf20Sopenharmony_ci { 2218c2ecf20Sopenharmony_ci .start = DA8XX_AEMIF_CS3_BASE, 2228c2ecf20Sopenharmony_ci .end = DA8XX_AEMIF_CS3_BASE + SZ_32M, 2238c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 2248c2ecf20Sopenharmony_ci }, 2258c2ecf20Sopenharmony_ci { 2268c2ecf20Sopenharmony_ci .start = DA8XX_AEMIF_CTL_BASE, 2278c2ecf20Sopenharmony_ci .end = DA8XX_AEMIF_CTL_BASE + SZ_32K, 2288c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 2298c2ecf20Sopenharmony_ci }, 2308c2ecf20Sopenharmony_ci}; 2318c2ecf20Sopenharmony_ci 2328c2ecf20Sopenharmony_cistatic struct resource omapl138_hawk_aemif_resource[] = { 2338c2ecf20Sopenharmony_ci { 2348c2ecf20Sopenharmony_ci .start = DA8XX_AEMIF_CTL_BASE, 2358c2ecf20Sopenharmony_ci .end = DA8XX_AEMIF_CTL_BASE + SZ_32K, 2368c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 2378c2ecf20Sopenharmony_ci } 2388c2ecf20Sopenharmony_ci}; 2398c2ecf20Sopenharmony_ci 2408c2ecf20Sopenharmony_cistatic struct aemif_abus_data omapl138_hawk_aemif_abus_data[] = { 2418c2ecf20Sopenharmony_ci { 2428c2ecf20Sopenharmony_ci .cs = 3, 2438c2ecf20Sopenharmony_ci } 2448c2ecf20Sopenharmony_ci}; 2458c2ecf20Sopenharmony_ci 2468c2ecf20Sopenharmony_cistatic struct platform_device omapl138_hawk_aemif_devices[] = { 2478c2ecf20Sopenharmony_ci { 2488c2ecf20Sopenharmony_ci .name = "davinci_nand", 2498c2ecf20Sopenharmony_ci .id = -1, 2508c2ecf20Sopenharmony_ci .dev = { 2518c2ecf20Sopenharmony_ci .platform_data = &omapl138_hawk_nandflash_data, 2528c2ecf20Sopenharmony_ci }, 2538c2ecf20Sopenharmony_ci .resource = omapl138_hawk_nandflash_resource, 2548c2ecf20Sopenharmony_ci .num_resources = ARRAY_SIZE(omapl138_hawk_nandflash_resource), 2558c2ecf20Sopenharmony_ci } 2568c2ecf20Sopenharmony_ci}; 2578c2ecf20Sopenharmony_ci 2588c2ecf20Sopenharmony_cistatic struct aemif_platform_data omapl138_hawk_aemif_pdata = { 2598c2ecf20Sopenharmony_ci .cs_offset = 2, 2608c2ecf20Sopenharmony_ci .abus_data = omapl138_hawk_aemif_abus_data, 2618c2ecf20Sopenharmony_ci .num_abus_data = ARRAY_SIZE(omapl138_hawk_aemif_abus_data), 2628c2ecf20Sopenharmony_ci .sub_devices = omapl138_hawk_aemif_devices, 2638c2ecf20Sopenharmony_ci .num_sub_devices = ARRAY_SIZE(omapl138_hawk_aemif_devices), 2648c2ecf20Sopenharmony_ci}; 2658c2ecf20Sopenharmony_ci 2668c2ecf20Sopenharmony_cistatic struct platform_device omapl138_hawk_aemif_device = { 2678c2ecf20Sopenharmony_ci .name = "ti-aemif", 2688c2ecf20Sopenharmony_ci .id = -1, 2698c2ecf20Sopenharmony_ci .dev = { 2708c2ecf20Sopenharmony_ci .platform_data = &omapl138_hawk_aemif_pdata, 2718c2ecf20Sopenharmony_ci }, 2728c2ecf20Sopenharmony_ci .resource = omapl138_hawk_aemif_resource, 2738c2ecf20Sopenharmony_ci .num_resources = ARRAY_SIZE(omapl138_hawk_aemif_resource), 2748c2ecf20Sopenharmony_ci}; 2758c2ecf20Sopenharmony_ci 2768c2ecf20Sopenharmony_cistatic const short omapl138_hawk_nand_pins[] = { 2778c2ecf20Sopenharmony_ci DA850_EMA_WAIT_1, DA850_NEMA_OE, DA850_NEMA_WE, DA850_NEMA_CS_3, 2788c2ecf20Sopenharmony_ci DA850_EMA_D_0, DA850_EMA_D_1, DA850_EMA_D_2, DA850_EMA_D_3, 2798c2ecf20Sopenharmony_ci DA850_EMA_D_4, DA850_EMA_D_5, DA850_EMA_D_6, DA850_EMA_D_7, 2808c2ecf20Sopenharmony_ci DA850_EMA_D_8, DA850_EMA_D_9, DA850_EMA_D_10, DA850_EMA_D_11, 2818c2ecf20Sopenharmony_ci DA850_EMA_D_12, DA850_EMA_D_13, DA850_EMA_D_14, DA850_EMA_D_15, 2828c2ecf20Sopenharmony_ci DA850_EMA_A_1, DA850_EMA_A_2, 2838c2ecf20Sopenharmony_ci -1 2848c2ecf20Sopenharmony_ci}; 2858c2ecf20Sopenharmony_ci 2868c2ecf20Sopenharmony_cistatic int omapl138_hawk_register_aemif(void) 2878c2ecf20Sopenharmony_ci{ 2888c2ecf20Sopenharmony_ci int ret; 2898c2ecf20Sopenharmony_ci 2908c2ecf20Sopenharmony_ci ret = davinci_cfg_reg_list(omapl138_hawk_nand_pins); 2918c2ecf20Sopenharmony_ci if (ret) 2928c2ecf20Sopenharmony_ci pr_warn("%s: NAND mux setup failed: %d\n", __func__, ret); 2938c2ecf20Sopenharmony_ci 2948c2ecf20Sopenharmony_ci return platform_device_register(&omapl138_hawk_aemif_device); 2958c2ecf20Sopenharmony_ci} 2968c2ecf20Sopenharmony_ci 2978c2ecf20Sopenharmony_cistatic const short da850_hawk_usb11_pins[] = { 2988c2ecf20Sopenharmony_ci DA850_GPIO2_4, DA850_GPIO6_13, 2998c2ecf20Sopenharmony_ci -1 3008c2ecf20Sopenharmony_ci}; 3018c2ecf20Sopenharmony_ci 3028c2ecf20Sopenharmony_cistatic struct regulator_consumer_supply hawk_usb_supplies[] = { 3038c2ecf20Sopenharmony_ci REGULATOR_SUPPLY("vbus", NULL), 3048c2ecf20Sopenharmony_ci}; 3058c2ecf20Sopenharmony_ci 3068c2ecf20Sopenharmony_cistatic struct regulator_init_data hawk_usb_vbus_data = { 3078c2ecf20Sopenharmony_ci .consumer_supplies = hawk_usb_supplies, 3088c2ecf20Sopenharmony_ci .num_consumer_supplies = ARRAY_SIZE(hawk_usb_supplies), 3098c2ecf20Sopenharmony_ci .constraints = { 3108c2ecf20Sopenharmony_ci .valid_ops_mask = REGULATOR_CHANGE_STATUS, 3118c2ecf20Sopenharmony_ci }, 3128c2ecf20Sopenharmony_ci}; 3138c2ecf20Sopenharmony_ci 3148c2ecf20Sopenharmony_cistatic struct fixed_voltage_config hawk_usb_vbus = { 3158c2ecf20Sopenharmony_ci .supply_name = "vbus", 3168c2ecf20Sopenharmony_ci .microvolts = 3300000, 3178c2ecf20Sopenharmony_ci .init_data = &hawk_usb_vbus_data, 3188c2ecf20Sopenharmony_ci}; 3198c2ecf20Sopenharmony_ci 3208c2ecf20Sopenharmony_cistatic struct platform_device hawk_usb_vbus_device = { 3218c2ecf20Sopenharmony_ci .name = "reg-fixed-voltage", 3228c2ecf20Sopenharmony_ci .id = 0, 3238c2ecf20Sopenharmony_ci .dev = { 3248c2ecf20Sopenharmony_ci .platform_data = &hawk_usb_vbus, 3258c2ecf20Sopenharmony_ci }, 3268c2ecf20Sopenharmony_ci}; 3278c2ecf20Sopenharmony_ci 3288c2ecf20Sopenharmony_cistatic struct gpiod_lookup_table hawk_usb_oc_gpio_lookup = { 3298c2ecf20Sopenharmony_ci .dev_id = "ohci-da8xx", 3308c2ecf20Sopenharmony_ci .table = { 3318c2ecf20Sopenharmony_ci GPIO_LOOKUP("davinci_gpio", DA850_USB1_OC_PIN, "oc", 0), 3328c2ecf20Sopenharmony_ci { } 3338c2ecf20Sopenharmony_ci }, 3348c2ecf20Sopenharmony_ci}; 3358c2ecf20Sopenharmony_ci 3368c2ecf20Sopenharmony_cistatic struct gpiod_lookup_table hawk_usb_vbus_gpio_lookup = { 3378c2ecf20Sopenharmony_ci .dev_id = "reg-fixed-voltage.0", 3388c2ecf20Sopenharmony_ci .table = { 3398c2ecf20Sopenharmony_ci GPIO_LOOKUP("davinci_gpio", DA850_USB1_VBUS_PIN, NULL, 0), 3408c2ecf20Sopenharmony_ci { } 3418c2ecf20Sopenharmony_ci }, 3428c2ecf20Sopenharmony_ci}; 3438c2ecf20Sopenharmony_ci 3448c2ecf20Sopenharmony_cistatic struct gpiod_lookup_table *hawk_usb_gpio_lookups[] = { 3458c2ecf20Sopenharmony_ci &hawk_usb_oc_gpio_lookup, 3468c2ecf20Sopenharmony_ci &hawk_usb_vbus_gpio_lookup, 3478c2ecf20Sopenharmony_ci}; 3488c2ecf20Sopenharmony_ci 3498c2ecf20Sopenharmony_cistatic struct da8xx_ohci_root_hub omapl138_hawk_usb11_pdata = { 3508c2ecf20Sopenharmony_ci /* TPS2087 switch @ 5V */ 3518c2ecf20Sopenharmony_ci .potpgt = (3 + 1) / 2, /* 3 ms max */ 3528c2ecf20Sopenharmony_ci}; 3538c2ecf20Sopenharmony_ci 3548c2ecf20Sopenharmony_cistatic __init void omapl138_hawk_usb_init(void) 3558c2ecf20Sopenharmony_ci{ 3568c2ecf20Sopenharmony_ci int ret; 3578c2ecf20Sopenharmony_ci 3588c2ecf20Sopenharmony_ci ret = davinci_cfg_reg_list(da850_hawk_usb11_pins); 3598c2ecf20Sopenharmony_ci if (ret) { 3608c2ecf20Sopenharmony_ci pr_warn("%s: USB 1.1 PinMux setup failed: %d\n", __func__, ret); 3618c2ecf20Sopenharmony_ci return; 3628c2ecf20Sopenharmony_ci } 3638c2ecf20Sopenharmony_ci 3648c2ecf20Sopenharmony_ci ret = da8xx_register_usb_phy_clocks(); 3658c2ecf20Sopenharmony_ci if (ret) 3668c2ecf20Sopenharmony_ci pr_warn("%s: USB PHY CLK registration failed: %d\n", 3678c2ecf20Sopenharmony_ci __func__, ret); 3688c2ecf20Sopenharmony_ci 3698c2ecf20Sopenharmony_ci gpiod_add_lookup_tables(hawk_usb_gpio_lookups, 3708c2ecf20Sopenharmony_ci ARRAY_SIZE(hawk_usb_gpio_lookups)); 3718c2ecf20Sopenharmony_ci 3728c2ecf20Sopenharmony_ci ret = da8xx_register_usb_phy(); 3738c2ecf20Sopenharmony_ci if (ret) 3748c2ecf20Sopenharmony_ci pr_warn("%s: USB PHY registration failed: %d\n", 3758c2ecf20Sopenharmony_ci __func__, ret); 3768c2ecf20Sopenharmony_ci 3778c2ecf20Sopenharmony_ci ret = platform_device_register(&hawk_usb_vbus_device); 3788c2ecf20Sopenharmony_ci if (ret) { 3798c2ecf20Sopenharmony_ci pr_warn("%s: Unable to register the vbus supply\n", __func__); 3808c2ecf20Sopenharmony_ci return; 3818c2ecf20Sopenharmony_ci } 3828c2ecf20Sopenharmony_ci 3838c2ecf20Sopenharmony_ci ret = da8xx_register_usb11(&omapl138_hawk_usb11_pdata); 3848c2ecf20Sopenharmony_ci if (ret) 3858c2ecf20Sopenharmony_ci pr_warn("%s: USB 1.1 registration failed: %d\n", __func__, ret); 3868c2ecf20Sopenharmony_ci 3878c2ecf20Sopenharmony_ci return; 3888c2ecf20Sopenharmony_ci} 3898c2ecf20Sopenharmony_ci 3908c2ecf20Sopenharmony_cistatic __init void omapl138_hawk_init(void) 3918c2ecf20Sopenharmony_ci{ 3928c2ecf20Sopenharmony_ci int ret; 3938c2ecf20Sopenharmony_ci 3948c2ecf20Sopenharmony_ci da850_register_clocks(); 3958c2ecf20Sopenharmony_ci 3968c2ecf20Sopenharmony_ci ret = da850_register_gpio(); 3978c2ecf20Sopenharmony_ci if (ret) 3988c2ecf20Sopenharmony_ci pr_warn("%s: GPIO init failed: %d\n", __func__, ret); 3998c2ecf20Sopenharmony_ci 4008c2ecf20Sopenharmony_ci davinci_serial_init(da8xx_serial_device); 4018c2ecf20Sopenharmony_ci 4028c2ecf20Sopenharmony_ci omapl138_hawk_config_emac(); 4038c2ecf20Sopenharmony_ci 4048c2ecf20Sopenharmony_ci ret = da850_register_edma(da850_edma_rsv); 4058c2ecf20Sopenharmony_ci if (ret) 4068c2ecf20Sopenharmony_ci pr_warn("%s: EDMA registration failed: %d\n", __func__, ret); 4078c2ecf20Sopenharmony_ci 4088c2ecf20Sopenharmony_ci omapl138_hawk_mmc_init(); 4098c2ecf20Sopenharmony_ci 4108c2ecf20Sopenharmony_ci omapl138_hawk_usb_init(); 4118c2ecf20Sopenharmony_ci 4128c2ecf20Sopenharmony_ci ret = omapl138_hawk_register_aemif(); 4138c2ecf20Sopenharmony_ci if (ret) 4148c2ecf20Sopenharmony_ci pr_warn("%s: aemif registration failed: %d\n", __func__, ret); 4158c2ecf20Sopenharmony_ci 4168c2ecf20Sopenharmony_ci ret = da8xx_register_watchdog(); 4178c2ecf20Sopenharmony_ci if (ret) 4188c2ecf20Sopenharmony_ci pr_warn("%s: watchdog registration failed: %d\n", 4198c2ecf20Sopenharmony_ci __func__, ret); 4208c2ecf20Sopenharmony_ci 4218c2ecf20Sopenharmony_ci ret = da8xx_register_rproc(); 4228c2ecf20Sopenharmony_ci if (ret) 4238c2ecf20Sopenharmony_ci pr_warn("%s: dsp/rproc registration failed: %d\n", 4248c2ecf20Sopenharmony_ci __func__, ret); 4258c2ecf20Sopenharmony_ci 4268c2ecf20Sopenharmony_ci regulator_has_full_constraints(); 4278c2ecf20Sopenharmony_ci} 4288c2ecf20Sopenharmony_ci 4298c2ecf20Sopenharmony_ci#ifdef CONFIG_SERIAL_8250_CONSOLE 4308c2ecf20Sopenharmony_cistatic int __init omapl138_hawk_console_init(void) 4318c2ecf20Sopenharmony_ci{ 4328c2ecf20Sopenharmony_ci if (!machine_is_omapl138_hawkboard()) 4338c2ecf20Sopenharmony_ci return 0; 4348c2ecf20Sopenharmony_ci 4358c2ecf20Sopenharmony_ci return add_preferred_console("ttyS", 2, "115200"); 4368c2ecf20Sopenharmony_ci} 4378c2ecf20Sopenharmony_ciconsole_initcall(omapl138_hawk_console_init); 4388c2ecf20Sopenharmony_ci#endif 4398c2ecf20Sopenharmony_ci 4408c2ecf20Sopenharmony_cistatic void __init omapl138_hawk_map_io(void) 4418c2ecf20Sopenharmony_ci{ 4428c2ecf20Sopenharmony_ci da850_init(); 4438c2ecf20Sopenharmony_ci} 4448c2ecf20Sopenharmony_ci 4458c2ecf20Sopenharmony_ciMACHINE_START(OMAPL138_HAWKBOARD, "AM18x/OMAP-L138 Hawkboard") 4468c2ecf20Sopenharmony_ci .atag_offset = 0x100, 4478c2ecf20Sopenharmony_ci .map_io = omapl138_hawk_map_io, 4488c2ecf20Sopenharmony_ci .init_irq = da850_init_irq, 4498c2ecf20Sopenharmony_ci .init_time = da850_init_time, 4508c2ecf20Sopenharmony_ci .init_machine = omapl138_hawk_init, 4518c2ecf20Sopenharmony_ci .init_late = davinci_init_late, 4528c2ecf20Sopenharmony_ci .dma_zone_size = SZ_128M, 4538c2ecf20Sopenharmony_ci .reserve = da8xx_rproc_reserve_cma, 4548c2ecf20Sopenharmony_ciMACHINE_END 455