18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-or-later 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * DA8XX/OMAP L1XX platform device data 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Copyright (c) 2007-2009, MontaVista Software, Inc. <source@mvista.com> 68c2ecf20Sopenharmony_ci * Derived from code that was: 78c2ecf20Sopenharmony_ci * Copyright (C) 2006 Komal Shah <komal_shah802003@yahoo.com> 88c2ecf20Sopenharmony_ci */ 98c2ecf20Sopenharmony_ci#include <linux/ahci_platform.h> 108c2ecf20Sopenharmony_ci#include <linux/clk-provider.h> 118c2ecf20Sopenharmony_ci#include <linux/clk.h> 128c2ecf20Sopenharmony_ci#include <linux/clkdev.h> 138c2ecf20Sopenharmony_ci#include <linux/dma-map-ops.h> 148c2ecf20Sopenharmony_ci#include <linux/dmaengine.h> 158c2ecf20Sopenharmony_ci#include <linux/init.h> 168c2ecf20Sopenharmony_ci#include <linux/io.h> 178c2ecf20Sopenharmony_ci#include <linux/platform_device.h> 188c2ecf20Sopenharmony_ci#include <linux/reboot.h> 198c2ecf20Sopenharmony_ci#include <linux/serial_8250.h> 208c2ecf20Sopenharmony_ci 218c2ecf20Sopenharmony_ci#include <mach/common.h> 228c2ecf20Sopenharmony_ci#include <mach/cputype.h> 238c2ecf20Sopenharmony_ci#include <mach/da8xx.h> 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_ci#include "asp.h" 268c2ecf20Sopenharmony_ci#include "cpuidle.h" 278c2ecf20Sopenharmony_ci#include "irqs.h" 288c2ecf20Sopenharmony_ci#include "sram.h" 298c2ecf20Sopenharmony_ci 308c2ecf20Sopenharmony_ci#define DA8XX_TPCC_BASE 0x01c00000 318c2ecf20Sopenharmony_ci#define DA8XX_TPTC0_BASE 0x01c08000 328c2ecf20Sopenharmony_ci#define DA8XX_TPTC1_BASE 0x01c08400 338c2ecf20Sopenharmony_ci#define DA8XX_WDOG_BASE 0x01c21000 /* DA8XX_TIMER64P1_BASE */ 348c2ecf20Sopenharmony_ci#define DA8XX_I2C0_BASE 0x01c22000 358c2ecf20Sopenharmony_ci#define DA8XX_RTC_BASE 0x01c23000 368c2ecf20Sopenharmony_ci#define DA8XX_PRUSS_MEM_BASE 0x01c30000 378c2ecf20Sopenharmony_ci#define DA8XX_MMCSD0_BASE 0x01c40000 388c2ecf20Sopenharmony_ci#define DA8XX_SPI0_BASE 0x01c41000 398c2ecf20Sopenharmony_ci#define DA830_SPI1_BASE 0x01e12000 408c2ecf20Sopenharmony_ci#define DA8XX_LCD_CNTRL_BASE 0x01e13000 418c2ecf20Sopenharmony_ci#define DA850_SATA_BASE 0x01e18000 428c2ecf20Sopenharmony_ci#define DA850_MMCSD1_BASE 0x01e1b000 438c2ecf20Sopenharmony_ci#define DA8XX_EMAC_CPPI_PORT_BASE 0x01e20000 448c2ecf20Sopenharmony_ci#define DA8XX_EMAC_CPGMACSS_BASE 0x01e22000 458c2ecf20Sopenharmony_ci#define DA8XX_EMAC_CPGMAC_BASE 0x01e23000 468c2ecf20Sopenharmony_ci#define DA8XX_EMAC_MDIO_BASE 0x01e24000 478c2ecf20Sopenharmony_ci#define DA8XX_I2C1_BASE 0x01e28000 488c2ecf20Sopenharmony_ci#define DA850_TPCC1_BASE 0x01e30000 498c2ecf20Sopenharmony_ci#define DA850_TPTC2_BASE 0x01e38000 508c2ecf20Sopenharmony_ci#define DA850_SPI1_BASE 0x01f0e000 518c2ecf20Sopenharmony_ci#define DA8XX_DDR2_CTL_BASE 0xb0000000 528c2ecf20Sopenharmony_ci 538c2ecf20Sopenharmony_ci#define DA8XX_EMAC_CTRL_REG_OFFSET 0x3000 548c2ecf20Sopenharmony_ci#define DA8XX_EMAC_MOD_REG_OFFSET 0x2000 558c2ecf20Sopenharmony_ci#define DA8XX_EMAC_RAM_OFFSET 0x0000 568c2ecf20Sopenharmony_ci#define DA8XX_EMAC_CTRL_RAM_SIZE SZ_8K 578c2ecf20Sopenharmony_ci 588c2ecf20Sopenharmony_civoid __iomem *da8xx_syscfg0_base; 598c2ecf20Sopenharmony_civoid __iomem *da8xx_syscfg1_base; 608c2ecf20Sopenharmony_ci 618c2ecf20Sopenharmony_cistatic struct plat_serial8250_port da8xx_serial0_pdata[] = { 628c2ecf20Sopenharmony_ci { 638c2ecf20Sopenharmony_ci .mapbase = DA8XX_UART0_BASE, 648c2ecf20Sopenharmony_ci .irq = DAVINCI_INTC_IRQ(IRQ_DA8XX_UARTINT0), 658c2ecf20Sopenharmony_ci .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | 668c2ecf20Sopenharmony_ci UPF_IOREMAP, 678c2ecf20Sopenharmony_ci .iotype = UPIO_MEM, 688c2ecf20Sopenharmony_ci .regshift = 2, 698c2ecf20Sopenharmony_ci }, 708c2ecf20Sopenharmony_ci { 718c2ecf20Sopenharmony_ci .flags = 0, 728c2ecf20Sopenharmony_ci } 738c2ecf20Sopenharmony_ci}; 748c2ecf20Sopenharmony_cistatic struct plat_serial8250_port da8xx_serial1_pdata[] = { 758c2ecf20Sopenharmony_ci { 768c2ecf20Sopenharmony_ci .mapbase = DA8XX_UART1_BASE, 778c2ecf20Sopenharmony_ci .irq = DAVINCI_INTC_IRQ(IRQ_DA8XX_UARTINT1), 788c2ecf20Sopenharmony_ci .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | 798c2ecf20Sopenharmony_ci UPF_IOREMAP, 808c2ecf20Sopenharmony_ci .iotype = UPIO_MEM, 818c2ecf20Sopenharmony_ci .regshift = 2, 828c2ecf20Sopenharmony_ci }, 838c2ecf20Sopenharmony_ci { 848c2ecf20Sopenharmony_ci .flags = 0, 858c2ecf20Sopenharmony_ci } 868c2ecf20Sopenharmony_ci}; 878c2ecf20Sopenharmony_cistatic struct plat_serial8250_port da8xx_serial2_pdata[] = { 888c2ecf20Sopenharmony_ci { 898c2ecf20Sopenharmony_ci .mapbase = DA8XX_UART2_BASE, 908c2ecf20Sopenharmony_ci .irq = DAVINCI_INTC_IRQ(IRQ_DA8XX_UARTINT2), 918c2ecf20Sopenharmony_ci .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | 928c2ecf20Sopenharmony_ci UPF_IOREMAP, 938c2ecf20Sopenharmony_ci .iotype = UPIO_MEM, 948c2ecf20Sopenharmony_ci .regshift = 2, 958c2ecf20Sopenharmony_ci }, 968c2ecf20Sopenharmony_ci { 978c2ecf20Sopenharmony_ci .flags = 0, 988c2ecf20Sopenharmony_ci } 998c2ecf20Sopenharmony_ci}; 1008c2ecf20Sopenharmony_ci 1018c2ecf20Sopenharmony_cistruct platform_device da8xx_serial_device[] = { 1028c2ecf20Sopenharmony_ci { 1038c2ecf20Sopenharmony_ci .name = "serial8250", 1048c2ecf20Sopenharmony_ci .id = PLAT8250_DEV_PLATFORM, 1058c2ecf20Sopenharmony_ci .dev = { 1068c2ecf20Sopenharmony_ci .platform_data = da8xx_serial0_pdata, 1078c2ecf20Sopenharmony_ci } 1088c2ecf20Sopenharmony_ci }, 1098c2ecf20Sopenharmony_ci { 1108c2ecf20Sopenharmony_ci .name = "serial8250", 1118c2ecf20Sopenharmony_ci .id = PLAT8250_DEV_PLATFORM1, 1128c2ecf20Sopenharmony_ci .dev = { 1138c2ecf20Sopenharmony_ci .platform_data = da8xx_serial1_pdata, 1148c2ecf20Sopenharmony_ci } 1158c2ecf20Sopenharmony_ci }, 1168c2ecf20Sopenharmony_ci { 1178c2ecf20Sopenharmony_ci .name = "serial8250", 1188c2ecf20Sopenharmony_ci .id = PLAT8250_DEV_PLATFORM2, 1198c2ecf20Sopenharmony_ci .dev = { 1208c2ecf20Sopenharmony_ci .platform_data = da8xx_serial2_pdata, 1218c2ecf20Sopenharmony_ci } 1228c2ecf20Sopenharmony_ci }, 1238c2ecf20Sopenharmony_ci { 1248c2ecf20Sopenharmony_ci } 1258c2ecf20Sopenharmony_ci}; 1268c2ecf20Sopenharmony_ci 1278c2ecf20Sopenharmony_cistatic s8 da8xx_queue_priority_mapping[][2] = { 1288c2ecf20Sopenharmony_ci /* {event queue no, Priority} */ 1298c2ecf20Sopenharmony_ci {0, 3}, 1308c2ecf20Sopenharmony_ci {1, 7}, 1318c2ecf20Sopenharmony_ci {-1, -1} 1328c2ecf20Sopenharmony_ci}; 1338c2ecf20Sopenharmony_ci 1348c2ecf20Sopenharmony_cistatic s8 da850_queue_priority_mapping[][2] = { 1358c2ecf20Sopenharmony_ci /* {event queue no, Priority} */ 1368c2ecf20Sopenharmony_ci {0, 3}, 1378c2ecf20Sopenharmony_ci {-1, -1} 1388c2ecf20Sopenharmony_ci}; 1398c2ecf20Sopenharmony_ci 1408c2ecf20Sopenharmony_cistatic struct edma_soc_info da8xx_edma0_pdata = { 1418c2ecf20Sopenharmony_ci .queue_priority_mapping = da8xx_queue_priority_mapping, 1428c2ecf20Sopenharmony_ci .default_queue = EVENTQ_1, 1438c2ecf20Sopenharmony_ci}; 1448c2ecf20Sopenharmony_ci 1458c2ecf20Sopenharmony_cistatic struct edma_soc_info da850_edma1_pdata = { 1468c2ecf20Sopenharmony_ci .queue_priority_mapping = da850_queue_priority_mapping, 1478c2ecf20Sopenharmony_ci .default_queue = EVENTQ_0, 1488c2ecf20Sopenharmony_ci}; 1498c2ecf20Sopenharmony_ci 1508c2ecf20Sopenharmony_cistatic struct resource da8xx_edma0_resources[] = { 1518c2ecf20Sopenharmony_ci { 1528c2ecf20Sopenharmony_ci .name = "edma3_cc", 1538c2ecf20Sopenharmony_ci .start = DA8XX_TPCC_BASE, 1548c2ecf20Sopenharmony_ci .end = DA8XX_TPCC_BASE + SZ_32K - 1, 1558c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 1568c2ecf20Sopenharmony_ci }, 1578c2ecf20Sopenharmony_ci { 1588c2ecf20Sopenharmony_ci .name = "edma3_tc0", 1598c2ecf20Sopenharmony_ci .start = DA8XX_TPTC0_BASE, 1608c2ecf20Sopenharmony_ci .end = DA8XX_TPTC0_BASE + SZ_1K - 1, 1618c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 1628c2ecf20Sopenharmony_ci }, 1638c2ecf20Sopenharmony_ci { 1648c2ecf20Sopenharmony_ci .name = "edma3_tc1", 1658c2ecf20Sopenharmony_ci .start = DA8XX_TPTC1_BASE, 1668c2ecf20Sopenharmony_ci .end = DA8XX_TPTC1_BASE + SZ_1K - 1, 1678c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 1688c2ecf20Sopenharmony_ci }, 1698c2ecf20Sopenharmony_ci { 1708c2ecf20Sopenharmony_ci .name = "edma3_ccint", 1718c2ecf20Sopenharmony_ci .start = DAVINCI_INTC_IRQ(IRQ_DA8XX_CCINT0), 1728c2ecf20Sopenharmony_ci .flags = IORESOURCE_IRQ, 1738c2ecf20Sopenharmony_ci }, 1748c2ecf20Sopenharmony_ci { 1758c2ecf20Sopenharmony_ci .name = "edma3_ccerrint", 1768c2ecf20Sopenharmony_ci .start = DAVINCI_INTC_IRQ(IRQ_DA8XX_CCERRINT), 1778c2ecf20Sopenharmony_ci .flags = IORESOURCE_IRQ, 1788c2ecf20Sopenharmony_ci }, 1798c2ecf20Sopenharmony_ci}; 1808c2ecf20Sopenharmony_ci 1818c2ecf20Sopenharmony_cistatic struct resource da850_edma1_resources[] = { 1828c2ecf20Sopenharmony_ci { 1838c2ecf20Sopenharmony_ci .name = "edma3_cc", 1848c2ecf20Sopenharmony_ci .start = DA850_TPCC1_BASE, 1858c2ecf20Sopenharmony_ci .end = DA850_TPCC1_BASE + SZ_32K - 1, 1868c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 1878c2ecf20Sopenharmony_ci }, 1888c2ecf20Sopenharmony_ci { 1898c2ecf20Sopenharmony_ci .name = "edma3_tc0", 1908c2ecf20Sopenharmony_ci .start = DA850_TPTC2_BASE, 1918c2ecf20Sopenharmony_ci .end = DA850_TPTC2_BASE + SZ_1K - 1, 1928c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 1938c2ecf20Sopenharmony_ci }, 1948c2ecf20Sopenharmony_ci { 1958c2ecf20Sopenharmony_ci .name = "edma3_ccint", 1968c2ecf20Sopenharmony_ci .start = DAVINCI_INTC_IRQ(IRQ_DA850_CCINT1), 1978c2ecf20Sopenharmony_ci .flags = IORESOURCE_IRQ, 1988c2ecf20Sopenharmony_ci }, 1998c2ecf20Sopenharmony_ci { 2008c2ecf20Sopenharmony_ci .name = "edma3_ccerrint", 2018c2ecf20Sopenharmony_ci .start = DAVINCI_INTC_IRQ(IRQ_DA850_CCERRINT1), 2028c2ecf20Sopenharmony_ci .flags = IORESOURCE_IRQ, 2038c2ecf20Sopenharmony_ci }, 2048c2ecf20Sopenharmony_ci}; 2058c2ecf20Sopenharmony_ci 2068c2ecf20Sopenharmony_cistatic const struct platform_device_info da8xx_edma0_device __initconst = { 2078c2ecf20Sopenharmony_ci .name = "edma", 2088c2ecf20Sopenharmony_ci .id = 0, 2098c2ecf20Sopenharmony_ci .dma_mask = DMA_BIT_MASK(32), 2108c2ecf20Sopenharmony_ci .res = da8xx_edma0_resources, 2118c2ecf20Sopenharmony_ci .num_res = ARRAY_SIZE(da8xx_edma0_resources), 2128c2ecf20Sopenharmony_ci .data = &da8xx_edma0_pdata, 2138c2ecf20Sopenharmony_ci .size_data = sizeof(da8xx_edma0_pdata), 2148c2ecf20Sopenharmony_ci}; 2158c2ecf20Sopenharmony_ci 2168c2ecf20Sopenharmony_cistatic const struct platform_device_info da850_edma1_device __initconst = { 2178c2ecf20Sopenharmony_ci .name = "edma", 2188c2ecf20Sopenharmony_ci .id = 1, 2198c2ecf20Sopenharmony_ci .dma_mask = DMA_BIT_MASK(32), 2208c2ecf20Sopenharmony_ci .res = da850_edma1_resources, 2218c2ecf20Sopenharmony_ci .num_res = ARRAY_SIZE(da850_edma1_resources), 2228c2ecf20Sopenharmony_ci .data = &da850_edma1_pdata, 2238c2ecf20Sopenharmony_ci .size_data = sizeof(da850_edma1_pdata), 2248c2ecf20Sopenharmony_ci}; 2258c2ecf20Sopenharmony_ci 2268c2ecf20Sopenharmony_cistatic const struct dma_slave_map da830_edma_map[] = { 2278c2ecf20Sopenharmony_ci { "davinci-mcasp.0", "rx", EDMA_FILTER_PARAM(0, 0) }, 2288c2ecf20Sopenharmony_ci { "davinci-mcasp.0", "tx", EDMA_FILTER_PARAM(0, 1) }, 2298c2ecf20Sopenharmony_ci { "davinci-mcasp.1", "rx", EDMA_FILTER_PARAM(0, 2) }, 2308c2ecf20Sopenharmony_ci { "davinci-mcasp.1", "tx", EDMA_FILTER_PARAM(0, 3) }, 2318c2ecf20Sopenharmony_ci { "davinci-mcasp.2", "rx", EDMA_FILTER_PARAM(0, 4) }, 2328c2ecf20Sopenharmony_ci { "davinci-mcasp.2", "tx", EDMA_FILTER_PARAM(0, 5) }, 2338c2ecf20Sopenharmony_ci { "spi_davinci.0", "rx", EDMA_FILTER_PARAM(0, 14) }, 2348c2ecf20Sopenharmony_ci { "spi_davinci.0", "tx", EDMA_FILTER_PARAM(0, 15) }, 2358c2ecf20Sopenharmony_ci { "da830-mmc.0", "rx", EDMA_FILTER_PARAM(0, 16) }, 2368c2ecf20Sopenharmony_ci { "da830-mmc.0", "tx", EDMA_FILTER_PARAM(0, 17) }, 2378c2ecf20Sopenharmony_ci { "spi_davinci.1", "rx", EDMA_FILTER_PARAM(0, 18) }, 2388c2ecf20Sopenharmony_ci { "spi_davinci.1", "tx", EDMA_FILTER_PARAM(0, 19) }, 2398c2ecf20Sopenharmony_ci}; 2408c2ecf20Sopenharmony_ci 2418c2ecf20Sopenharmony_ciint __init da830_register_edma(struct edma_rsv_info *rsv) 2428c2ecf20Sopenharmony_ci{ 2438c2ecf20Sopenharmony_ci struct platform_device *edma_pdev; 2448c2ecf20Sopenharmony_ci 2458c2ecf20Sopenharmony_ci da8xx_edma0_pdata.rsv = rsv; 2468c2ecf20Sopenharmony_ci 2478c2ecf20Sopenharmony_ci da8xx_edma0_pdata.slave_map = da830_edma_map; 2488c2ecf20Sopenharmony_ci da8xx_edma0_pdata.slavecnt = ARRAY_SIZE(da830_edma_map); 2498c2ecf20Sopenharmony_ci 2508c2ecf20Sopenharmony_ci edma_pdev = platform_device_register_full(&da8xx_edma0_device); 2518c2ecf20Sopenharmony_ci return PTR_ERR_OR_ZERO(edma_pdev); 2528c2ecf20Sopenharmony_ci} 2538c2ecf20Sopenharmony_ci 2548c2ecf20Sopenharmony_cistatic const struct dma_slave_map da850_edma0_map[] = { 2558c2ecf20Sopenharmony_ci { "davinci-mcasp.0", "rx", EDMA_FILTER_PARAM(0, 0) }, 2568c2ecf20Sopenharmony_ci { "davinci-mcasp.0", "tx", EDMA_FILTER_PARAM(0, 1) }, 2578c2ecf20Sopenharmony_ci { "davinci-mcbsp.0", "rx", EDMA_FILTER_PARAM(0, 2) }, 2588c2ecf20Sopenharmony_ci { "davinci-mcbsp.0", "tx", EDMA_FILTER_PARAM(0, 3) }, 2598c2ecf20Sopenharmony_ci { "davinci-mcbsp.1", "rx", EDMA_FILTER_PARAM(0, 4) }, 2608c2ecf20Sopenharmony_ci { "davinci-mcbsp.1", "tx", EDMA_FILTER_PARAM(0, 5) }, 2618c2ecf20Sopenharmony_ci { "spi_davinci.0", "rx", EDMA_FILTER_PARAM(0, 14) }, 2628c2ecf20Sopenharmony_ci { "spi_davinci.0", "tx", EDMA_FILTER_PARAM(0, 15) }, 2638c2ecf20Sopenharmony_ci { "da830-mmc.0", "rx", EDMA_FILTER_PARAM(0, 16) }, 2648c2ecf20Sopenharmony_ci { "da830-mmc.0", "tx", EDMA_FILTER_PARAM(0, 17) }, 2658c2ecf20Sopenharmony_ci { "spi_davinci.1", "rx", EDMA_FILTER_PARAM(0, 18) }, 2668c2ecf20Sopenharmony_ci { "spi_davinci.1", "tx", EDMA_FILTER_PARAM(0, 19) }, 2678c2ecf20Sopenharmony_ci}; 2688c2ecf20Sopenharmony_ci 2698c2ecf20Sopenharmony_cistatic const struct dma_slave_map da850_edma1_map[] = { 2708c2ecf20Sopenharmony_ci { "da830-mmc.1", "rx", EDMA_FILTER_PARAM(1, 28) }, 2718c2ecf20Sopenharmony_ci { "da830-mmc.1", "tx", EDMA_FILTER_PARAM(1, 29) }, 2728c2ecf20Sopenharmony_ci}; 2738c2ecf20Sopenharmony_ci 2748c2ecf20Sopenharmony_ciint __init da850_register_edma(struct edma_rsv_info *rsv[2]) 2758c2ecf20Sopenharmony_ci{ 2768c2ecf20Sopenharmony_ci struct platform_device *edma_pdev; 2778c2ecf20Sopenharmony_ci 2788c2ecf20Sopenharmony_ci if (rsv) { 2798c2ecf20Sopenharmony_ci da8xx_edma0_pdata.rsv = rsv[0]; 2808c2ecf20Sopenharmony_ci da850_edma1_pdata.rsv = rsv[1]; 2818c2ecf20Sopenharmony_ci } 2828c2ecf20Sopenharmony_ci 2838c2ecf20Sopenharmony_ci da8xx_edma0_pdata.slave_map = da850_edma0_map; 2848c2ecf20Sopenharmony_ci da8xx_edma0_pdata.slavecnt = ARRAY_SIZE(da850_edma0_map); 2858c2ecf20Sopenharmony_ci 2868c2ecf20Sopenharmony_ci edma_pdev = platform_device_register_full(&da8xx_edma0_device); 2878c2ecf20Sopenharmony_ci if (IS_ERR(edma_pdev)) { 2888c2ecf20Sopenharmony_ci pr_warn("%s: Failed to register eDMA0\n", __func__); 2898c2ecf20Sopenharmony_ci return PTR_ERR(edma_pdev); 2908c2ecf20Sopenharmony_ci } 2918c2ecf20Sopenharmony_ci 2928c2ecf20Sopenharmony_ci da850_edma1_pdata.slave_map = da850_edma1_map; 2938c2ecf20Sopenharmony_ci da850_edma1_pdata.slavecnt = ARRAY_SIZE(da850_edma1_map); 2948c2ecf20Sopenharmony_ci 2958c2ecf20Sopenharmony_ci edma_pdev = platform_device_register_full(&da850_edma1_device); 2968c2ecf20Sopenharmony_ci return PTR_ERR_OR_ZERO(edma_pdev); 2978c2ecf20Sopenharmony_ci} 2988c2ecf20Sopenharmony_ci 2998c2ecf20Sopenharmony_cistatic struct resource da8xx_i2c_resources0[] = { 3008c2ecf20Sopenharmony_ci { 3018c2ecf20Sopenharmony_ci .start = DA8XX_I2C0_BASE, 3028c2ecf20Sopenharmony_ci .end = DA8XX_I2C0_BASE + SZ_4K - 1, 3038c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 3048c2ecf20Sopenharmony_ci }, 3058c2ecf20Sopenharmony_ci { 3068c2ecf20Sopenharmony_ci .start = DAVINCI_INTC_IRQ(IRQ_DA8XX_I2CINT0), 3078c2ecf20Sopenharmony_ci .end = DAVINCI_INTC_IRQ(IRQ_DA8XX_I2CINT0), 3088c2ecf20Sopenharmony_ci .flags = IORESOURCE_IRQ, 3098c2ecf20Sopenharmony_ci }, 3108c2ecf20Sopenharmony_ci}; 3118c2ecf20Sopenharmony_ci 3128c2ecf20Sopenharmony_cistatic struct platform_device da8xx_i2c_device0 = { 3138c2ecf20Sopenharmony_ci .name = "i2c_davinci", 3148c2ecf20Sopenharmony_ci .id = 1, 3158c2ecf20Sopenharmony_ci .num_resources = ARRAY_SIZE(da8xx_i2c_resources0), 3168c2ecf20Sopenharmony_ci .resource = da8xx_i2c_resources0, 3178c2ecf20Sopenharmony_ci}; 3188c2ecf20Sopenharmony_ci 3198c2ecf20Sopenharmony_cistatic struct resource da8xx_i2c_resources1[] = { 3208c2ecf20Sopenharmony_ci { 3218c2ecf20Sopenharmony_ci .start = DA8XX_I2C1_BASE, 3228c2ecf20Sopenharmony_ci .end = DA8XX_I2C1_BASE + SZ_4K - 1, 3238c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 3248c2ecf20Sopenharmony_ci }, 3258c2ecf20Sopenharmony_ci { 3268c2ecf20Sopenharmony_ci .start = DAVINCI_INTC_IRQ(IRQ_DA8XX_I2CINT1), 3278c2ecf20Sopenharmony_ci .end = DAVINCI_INTC_IRQ(IRQ_DA8XX_I2CINT1), 3288c2ecf20Sopenharmony_ci .flags = IORESOURCE_IRQ, 3298c2ecf20Sopenharmony_ci }, 3308c2ecf20Sopenharmony_ci}; 3318c2ecf20Sopenharmony_ci 3328c2ecf20Sopenharmony_cistatic struct platform_device da8xx_i2c_device1 = { 3338c2ecf20Sopenharmony_ci .name = "i2c_davinci", 3348c2ecf20Sopenharmony_ci .id = 2, 3358c2ecf20Sopenharmony_ci .num_resources = ARRAY_SIZE(da8xx_i2c_resources1), 3368c2ecf20Sopenharmony_ci .resource = da8xx_i2c_resources1, 3378c2ecf20Sopenharmony_ci}; 3388c2ecf20Sopenharmony_ci 3398c2ecf20Sopenharmony_ciint __init da8xx_register_i2c(int instance, 3408c2ecf20Sopenharmony_ci struct davinci_i2c_platform_data *pdata) 3418c2ecf20Sopenharmony_ci{ 3428c2ecf20Sopenharmony_ci struct platform_device *pdev; 3438c2ecf20Sopenharmony_ci 3448c2ecf20Sopenharmony_ci if (instance == 0) 3458c2ecf20Sopenharmony_ci pdev = &da8xx_i2c_device0; 3468c2ecf20Sopenharmony_ci else if (instance == 1) 3478c2ecf20Sopenharmony_ci pdev = &da8xx_i2c_device1; 3488c2ecf20Sopenharmony_ci else 3498c2ecf20Sopenharmony_ci return -EINVAL; 3508c2ecf20Sopenharmony_ci 3518c2ecf20Sopenharmony_ci pdev->dev.platform_data = pdata; 3528c2ecf20Sopenharmony_ci return platform_device_register(pdev); 3538c2ecf20Sopenharmony_ci} 3548c2ecf20Sopenharmony_ci 3558c2ecf20Sopenharmony_cistatic struct resource da8xx_watchdog_resources[] = { 3568c2ecf20Sopenharmony_ci { 3578c2ecf20Sopenharmony_ci .start = DA8XX_WDOG_BASE, 3588c2ecf20Sopenharmony_ci .end = DA8XX_WDOG_BASE + SZ_4K - 1, 3598c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 3608c2ecf20Sopenharmony_ci }, 3618c2ecf20Sopenharmony_ci}; 3628c2ecf20Sopenharmony_ci 3638c2ecf20Sopenharmony_cistatic struct platform_device da8xx_wdt_device = { 3648c2ecf20Sopenharmony_ci .name = "davinci-wdt", 3658c2ecf20Sopenharmony_ci .id = -1, 3668c2ecf20Sopenharmony_ci .num_resources = ARRAY_SIZE(da8xx_watchdog_resources), 3678c2ecf20Sopenharmony_ci .resource = da8xx_watchdog_resources, 3688c2ecf20Sopenharmony_ci}; 3698c2ecf20Sopenharmony_ci 3708c2ecf20Sopenharmony_ciint __init da8xx_register_watchdog(void) 3718c2ecf20Sopenharmony_ci{ 3728c2ecf20Sopenharmony_ci return platform_device_register(&da8xx_wdt_device); 3738c2ecf20Sopenharmony_ci} 3748c2ecf20Sopenharmony_ci 3758c2ecf20Sopenharmony_cistatic struct resource da8xx_emac_resources[] = { 3768c2ecf20Sopenharmony_ci { 3778c2ecf20Sopenharmony_ci .start = DA8XX_EMAC_CPPI_PORT_BASE, 3788c2ecf20Sopenharmony_ci .end = DA8XX_EMAC_CPPI_PORT_BASE + SZ_16K - 1, 3798c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 3808c2ecf20Sopenharmony_ci }, 3818c2ecf20Sopenharmony_ci { 3828c2ecf20Sopenharmony_ci .start = DAVINCI_INTC_IRQ(IRQ_DA8XX_C0_RX_THRESH_PULSE), 3838c2ecf20Sopenharmony_ci .end = DAVINCI_INTC_IRQ(IRQ_DA8XX_C0_RX_THRESH_PULSE), 3848c2ecf20Sopenharmony_ci .flags = IORESOURCE_IRQ, 3858c2ecf20Sopenharmony_ci }, 3868c2ecf20Sopenharmony_ci { 3878c2ecf20Sopenharmony_ci .start = DAVINCI_INTC_IRQ(IRQ_DA8XX_C0_RX_PULSE), 3888c2ecf20Sopenharmony_ci .end = DAVINCI_INTC_IRQ(IRQ_DA8XX_C0_RX_PULSE), 3898c2ecf20Sopenharmony_ci .flags = IORESOURCE_IRQ, 3908c2ecf20Sopenharmony_ci }, 3918c2ecf20Sopenharmony_ci { 3928c2ecf20Sopenharmony_ci .start = DAVINCI_INTC_IRQ(IRQ_DA8XX_C0_TX_PULSE), 3938c2ecf20Sopenharmony_ci .end = DAVINCI_INTC_IRQ(IRQ_DA8XX_C0_TX_PULSE), 3948c2ecf20Sopenharmony_ci .flags = IORESOURCE_IRQ, 3958c2ecf20Sopenharmony_ci }, 3968c2ecf20Sopenharmony_ci { 3978c2ecf20Sopenharmony_ci .start = DAVINCI_INTC_IRQ(IRQ_DA8XX_C0_MISC_PULSE), 3988c2ecf20Sopenharmony_ci .end = DAVINCI_INTC_IRQ(IRQ_DA8XX_C0_MISC_PULSE), 3998c2ecf20Sopenharmony_ci .flags = IORESOURCE_IRQ, 4008c2ecf20Sopenharmony_ci }, 4018c2ecf20Sopenharmony_ci}; 4028c2ecf20Sopenharmony_ci 4038c2ecf20Sopenharmony_cistruct emac_platform_data da8xx_emac_pdata = { 4048c2ecf20Sopenharmony_ci .ctrl_reg_offset = DA8XX_EMAC_CTRL_REG_OFFSET, 4058c2ecf20Sopenharmony_ci .ctrl_mod_reg_offset = DA8XX_EMAC_MOD_REG_OFFSET, 4068c2ecf20Sopenharmony_ci .ctrl_ram_offset = DA8XX_EMAC_RAM_OFFSET, 4078c2ecf20Sopenharmony_ci .ctrl_ram_size = DA8XX_EMAC_CTRL_RAM_SIZE, 4088c2ecf20Sopenharmony_ci .version = EMAC_VERSION_2, 4098c2ecf20Sopenharmony_ci}; 4108c2ecf20Sopenharmony_ci 4118c2ecf20Sopenharmony_cistatic struct platform_device da8xx_emac_device = { 4128c2ecf20Sopenharmony_ci .name = "davinci_emac", 4138c2ecf20Sopenharmony_ci .id = 1, 4148c2ecf20Sopenharmony_ci .dev = { 4158c2ecf20Sopenharmony_ci .platform_data = &da8xx_emac_pdata, 4168c2ecf20Sopenharmony_ci }, 4178c2ecf20Sopenharmony_ci .num_resources = ARRAY_SIZE(da8xx_emac_resources), 4188c2ecf20Sopenharmony_ci .resource = da8xx_emac_resources, 4198c2ecf20Sopenharmony_ci}; 4208c2ecf20Sopenharmony_ci 4218c2ecf20Sopenharmony_cistatic struct resource da8xx_mdio_resources[] = { 4228c2ecf20Sopenharmony_ci { 4238c2ecf20Sopenharmony_ci .start = DA8XX_EMAC_MDIO_BASE, 4248c2ecf20Sopenharmony_ci .end = DA8XX_EMAC_MDIO_BASE + SZ_4K - 1, 4258c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 4268c2ecf20Sopenharmony_ci }, 4278c2ecf20Sopenharmony_ci}; 4288c2ecf20Sopenharmony_ci 4298c2ecf20Sopenharmony_cistatic struct platform_device da8xx_mdio_device = { 4308c2ecf20Sopenharmony_ci .name = "davinci_mdio", 4318c2ecf20Sopenharmony_ci .id = 0, 4328c2ecf20Sopenharmony_ci .num_resources = ARRAY_SIZE(da8xx_mdio_resources), 4338c2ecf20Sopenharmony_ci .resource = da8xx_mdio_resources, 4348c2ecf20Sopenharmony_ci}; 4358c2ecf20Sopenharmony_ci 4368c2ecf20Sopenharmony_ciint __init da8xx_register_emac(void) 4378c2ecf20Sopenharmony_ci{ 4388c2ecf20Sopenharmony_ci int ret; 4398c2ecf20Sopenharmony_ci 4408c2ecf20Sopenharmony_ci ret = platform_device_register(&da8xx_mdio_device); 4418c2ecf20Sopenharmony_ci if (ret < 0) 4428c2ecf20Sopenharmony_ci return ret; 4438c2ecf20Sopenharmony_ci 4448c2ecf20Sopenharmony_ci return platform_device_register(&da8xx_emac_device); 4458c2ecf20Sopenharmony_ci} 4468c2ecf20Sopenharmony_ci 4478c2ecf20Sopenharmony_cistatic struct resource da830_mcasp1_resources[] = { 4488c2ecf20Sopenharmony_ci { 4498c2ecf20Sopenharmony_ci .name = "mpu", 4508c2ecf20Sopenharmony_ci .start = DAVINCI_DA830_MCASP1_REG_BASE, 4518c2ecf20Sopenharmony_ci .end = DAVINCI_DA830_MCASP1_REG_BASE + (SZ_1K * 12) - 1, 4528c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 4538c2ecf20Sopenharmony_ci }, 4548c2ecf20Sopenharmony_ci /* TX event */ 4558c2ecf20Sopenharmony_ci { 4568c2ecf20Sopenharmony_ci .name = "tx", 4578c2ecf20Sopenharmony_ci .start = DAVINCI_DA830_DMA_MCASP1_AXEVT, 4588c2ecf20Sopenharmony_ci .end = DAVINCI_DA830_DMA_MCASP1_AXEVT, 4598c2ecf20Sopenharmony_ci .flags = IORESOURCE_DMA, 4608c2ecf20Sopenharmony_ci }, 4618c2ecf20Sopenharmony_ci /* RX event */ 4628c2ecf20Sopenharmony_ci { 4638c2ecf20Sopenharmony_ci .name = "rx", 4648c2ecf20Sopenharmony_ci .start = DAVINCI_DA830_DMA_MCASP1_AREVT, 4658c2ecf20Sopenharmony_ci .end = DAVINCI_DA830_DMA_MCASP1_AREVT, 4668c2ecf20Sopenharmony_ci .flags = IORESOURCE_DMA, 4678c2ecf20Sopenharmony_ci }, 4688c2ecf20Sopenharmony_ci { 4698c2ecf20Sopenharmony_ci .name = "common", 4708c2ecf20Sopenharmony_ci .start = DAVINCI_INTC_IRQ(IRQ_DA8XX_MCASPINT), 4718c2ecf20Sopenharmony_ci .flags = IORESOURCE_IRQ, 4728c2ecf20Sopenharmony_ci }, 4738c2ecf20Sopenharmony_ci}; 4748c2ecf20Sopenharmony_ci 4758c2ecf20Sopenharmony_cistatic struct platform_device da830_mcasp1_device = { 4768c2ecf20Sopenharmony_ci .name = "davinci-mcasp", 4778c2ecf20Sopenharmony_ci .id = 1, 4788c2ecf20Sopenharmony_ci .num_resources = ARRAY_SIZE(da830_mcasp1_resources), 4798c2ecf20Sopenharmony_ci .resource = da830_mcasp1_resources, 4808c2ecf20Sopenharmony_ci}; 4818c2ecf20Sopenharmony_ci 4828c2ecf20Sopenharmony_cistatic struct resource da830_mcasp2_resources[] = { 4838c2ecf20Sopenharmony_ci { 4848c2ecf20Sopenharmony_ci .name = "mpu", 4858c2ecf20Sopenharmony_ci .start = DAVINCI_DA830_MCASP2_REG_BASE, 4868c2ecf20Sopenharmony_ci .end = DAVINCI_DA830_MCASP2_REG_BASE + (SZ_1K * 12) - 1, 4878c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 4888c2ecf20Sopenharmony_ci }, 4898c2ecf20Sopenharmony_ci /* TX event */ 4908c2ecf20Sopenharmony_ci { 4918c2ecf20Sopenharmony_ci .name = "tx", 4928c2ecf20Sopenharmony_ci .start = DAVINCI_DA830_DMA_MCASP2_AXEVT, 4938c2ecf20Sopenharmony_ci .end = DAVINCI_DA830_DMA_MCASP2_AXEVT, 4948c2ecf20Sopenharmony_ci .flags = IORESOURCE_DMA, 4958c2ecf20Sopenharmony_ci }, 4968c2ecf20Sopenharmony_ci /* RX event */ 4978c2ecf20Sopenharmony_ci { 4988c2ecf20Sopenharmony_ci .name = "rx", 4998c2ecf20Sopenharmony_ci .start = DAVINCI_DA830_DMA_MCASP2_AREVT, 5008c2ecf20Sopenharmony_ci .end = DAVINCI_DA830_DMA_MCASP2_AREVT, 5018c2ecf20Sopenharmony_ci .flags = IORESOURCE_DMA, 5028c2ecf20Sopenharmony_ci }, 5038c2ecf20Sopenharmony_ci { 5048c2ecf20Sopenharmony_ci .name = "common", 5058c2ecf20Sopenharmony_ci .start = DAVINCI_INTC_IRQ(IRQ_DA8XX_MCASPINT), 5068c2ecf20Sopenharmony_ci .flags = IORESOURCE_IRQ, 5078c2ecf20Sopenharmony_ci }, 5088c2ecf20Sopenharmony_ci}; 5098c2ecf20Sopenharmony_ci 5108c2ecf20Sopenharmony_cistatic struct platform_device da830_mcasp2_device = { 5118c2ecf20Sopenharmony_ci .name = "davinci-mcasp", 5128c2ecf20Sopenharmony_ci .id = 2, 5138c2ecf20Sopenharmony_ci .num_resources = ARRAY_SIZE(da830_mcasp2_resources), 5148c2ecf20Sopenharmony_ci .resource = da830_mcasp2_resources, 5158c2ecf20Sopenharmony_ci}; 5168c2ecf20Sopenharmony_ci 5178c2ecf20Sopenharmony_cistatic struct resource da850_mcasp_resources[] = { 5188c2ecf20Sopenharmony_ci { 5198c2ecf20Sopenharmony_ci .name = "mpu", 5208c2ecf20Sopenharmony_ci .start = DAVINCI_DA8XX_MCASP0_REG_BASE, 5218c2ecf20Sopenharmony_ci .end = DAVINCI_DA8XX_MCASP0_REG_BASE + (SZ_1K * 12) - 1, 5228c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 5238c2ecf20Sopenharmony_ci }, 5248c2ecf20Sopenharmony_ci /* TX event */ 5258c2ecf20Sopenharmony_ci { 5268c2ecf20Sopenharmony_ci .name = "tx", 5278c2ecf20Sopenharmony_ci .start = DAVINCI_DA8XX_DMA_MCASP0_AXEVT, 5288c2ecf20Sopenharmony_ci .end = DAVINCI_DA8XX_DMA_MCASP0_AXEVT, 5298c2ecf20Sopenharmony_ci .flags = IORESOURCE_DMA, 5308c2ecf20Sopenharmony_ci }, 5318c2ecf20Sopenharmony_ci /* RX event */ 5328c2ecf20Sopenharmony_ci { 5338c2ecf20Sopenharmony_ci .name = "rx", 5348c2ecf20Sopenharmony_ci .start = DAVINCI_DA8XX_DMA_MCASP0_AREVT, 5358c2ecf20Sopenharmony_ci .end = DAVINCI_DA8XX_DMA_MCASP0_AREVT, 5368c2ecf20Sopenharmony_ci .flags = IORESOURCE_DMA, 5378c2ecf20Sopenharmony_ci }, 5388c2ecf20Sopenharmony_ci { 5398c2ecf20Sopenharmony_ci .name = "common", 5408c2ecf20Sopenharmony_ci .start = DAVINCI_INTC_IRQ(IRQ_DA8XX_MCASPINT), 5418c2ecf20Sopenharmony_ci .flags = IORESOURCE_IRQ, 5428c2ecf20Sopenharmony_ci }, 5438c2ecf20Sopenharmony_ci}; 5448c2ecf20Sopenharmony_ci 5458c2ecf20Sopenharmony_cistatic struct platform_device da850_mcasp_device = { 5468c2ecf20Sopenharmony_ci .name = "davinci-mcasp", 5478c2ecf20Sopenharmony_ci .id = 0, 5488c2ecf20Sopenharmony_ci .num_resources = ARRAY_SIZE(da850_mcasp_resources), 5498c2ecf20Sopenharmony_ci .resource = da850_mcasp_resources, 5508c2ecf20Sopenharmony_ci}; 5518c2ecf20Sopenharmony_ci 5528c2ecf20Sopenharmony_civoid __init da8xx_register_mcasp(int id, struct snd_platform_data *pdata) 5538c2ecf20Sopenharmony_ci{ 5548c2ecf20Sopenharmony_ci struct platform_device *pdev; 5558c2ecf20Sopenharmony_ci 5568c2ecf20Sopenharmony_ci switch (id) { 5578c2ecf20Sopenharmony_ci case 0: 5588c2ecf20Sopenharmony_ci /* Valid for DA830/OMAP-L137 or DA850/OMAP-L138 */ 5598c2ecf20Sopenharmony_ci pdev = &da850_mcasp_device; 5608c2ecf20Sopenharmony_ci break; 5618c2ecf20Sopenharmony_ci case 1: 5628c2ecf20Sopenharmony_ci /* Valid for DA830/OMAP-L137 only */ 5638c2ecf20Sopenharmony_ci if (!cpu_is_davinci_da830()) 5648c2ecf20Sopenharmony_ci return; 5658c2ecf20Sopenharmony_ci pdev = &da830_mcasp1_device; 5668c2ecf20Sopenharmony_ci break; 5678c2ecf20Sopenharmony_ci case 2: 5688c2ecf20Sopenharmony_ci /* Valid for DA830/OMAP-L137 only */ 5698c2ecf20Sopenharmony_ci if (!cpu_is_davinci_da830()) 5708c2ecf20Sopenharmony_ci return; 5718c2ecf20Sopenharmony_ci pdev = &da830_mcasp2_device; 5728c2ecf20Sopenharmony_ci break; 5738c2ecf20Sopenharmony_ci default: 5748c2ecf20Sopenharmony_ci return; 5758c2ecf20Sopenharmony_ci } 5768c2ecf20Sopenharmony_ci 5778c2ecf20Sopenharmony_ci pdev->dev.platform_data = pdata; 5788c2ecf20Sopenharmony_ci platform_device_register(pdev); 5798c2ecf20Sopenharmony_ci} 5808c2ecf20Sopenharmony_ci 5818c2ecf20Sopenharmony_cistatic struct resource da8xx_pruss_resources[] = { 5828c2ecf20Sopenharmony_ci { 5838c2ecf20Sopenharmony_ci .start = DA8XX_PRUSS_MEM_BASE, 5848c2ecf20Sopenharmony_ci .end = DA8XX_PRUSS_MEM_BASE + 0xFFFF, 5858c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 5868c2ecf20Sopenharmony_ci }, 5878c2ecf20Sopenharmony_ci { 5888c2ecf20Sopenharmony_ci .start = DAVINCI_INTC_IRQ(IRQ_DA8XX_EVTOUT0), 5898c2ecf20Sopenharmony_ci .end = DAVINCI_INTC_IRQ(IRQ_DA8XX_EVTOUT0), 5908c2ecf20Sopenharmony_ci .flags = IORESOURCE_IRQ, 5918c2ecf20Sopenharmony_ci }, 5928c2ecf20Sopenharmony_ci { 5938c2ecf20Sopenharmony_ci .start = DAVINCI_INTC_IRQ(IRQ_DA8XX_EVTOUT1), 5948c2ecf20Sopenharmony_ci .end = DAVINCI_INTC_IRQ(IRQ_DA8XX_EVTOUT1), 5958c2ecf20Sopenharmony_ci .flags = IORESOURCE_IRQ, 5968c2ecf20Sopenharmony_ci }, 5978c2ecf20Sopenharmony_ci { 5988c2ecf20Sopenharmony_ci .start = DAVINCI_INTC_IRQ(IRQ_DA8XX_EVTOUT2), 5998c2ecf20Sopenharmony_ci .end = DAVINCI_INTC_IRQ(IRQ_DA8XX_EVTOUT2), 6008c2ecf20Sopenharmony_ci .flags = IORESOURCE_IRQ, 6018c2ecf20Sopenharmony_ci }, 6028c2ecf20Sopenharmony_ci { 6038c2ecf20Sopenharmony_ci .start = DAVINCI_INTC_IRQ(IRQ_DA8XX_EVTOUT3), 6048c2ecf20Sopenharmony_ci .end = DAVINCI_INTC_IRQ(IRQ_DA8XX_EVTOUT3), 6058c2ecf20Sopenharmony_ci .flags = IORESOURCE_IRQ, 6068c2ecf20Sopenharmony_ci }, 6078c2ecf20Sopenharmony_ci { 6088c2ecf20Sopenharmony_ci .start = DAVINCI_INTC_IRQ(IRQ_DA8XX_EVTOUT4), 6098c2ecf20Sopenharmony_ci .end = DAVINCI_INTC_IRQ(IRQ_DA8XX_EVTOUT4), 6108c2ecf20Sopenharmony_ci .flags = IORESOURCE_IRQ, 6118c2ecf20Sopenharmony_ci }, 6128c2ecf20Sopenharmony_ci { 6138c2ecf20Sopenharmony_ci .start = DAVINCI_INTC_IRQ(IRQ_DA8XX_EVTOUT5), 6148c2ecf20Sopenharmony_ci .end = DAVINCI_INTC_IRQ(IRQ_DA8XX_EVTOUT5), 6158c2ecf20Sopenharmony_ci .flags = IORESOURCE_IRQ, 6168c2ecf20Sopenharmony_ci }, 6178c2ecf20Sopenharmony_ci { 6188c2ecf20Sopenharmony_ci .start = DAVINCI_INTC_IRQ(IRQ_DA8XX_EVTOUT6), 6198c2ecf20Sopenharmony_ci .end = DAVINCI_INTC_IRQ(IRQ_DA8XX_EVTOUT6), 6208c2ecf20Sopenharmony_ci .flags = IORESOURCE_IRQ, 6218c2ecf20Sopenharmony_ci }, 6228c2ecf20Sopenharmony_ci { 6238c2ecf20Sopenharmony_ci .start = DAVINCI_INTC_IRQ(IRQ_DA8XX_EVTOUT7), 6248c2ecf20Sopenharmony_ci .end = DAVINCI_INTC_IRQ(IRQ_DA8XX_EVTOUT7), 6258c2ecf20Sopenharmony_ci .flags = IORESOURCE_IRQ, 6268c2ecf20Sopenharmony_ci }, 6278c2ecf20Sopenharmony_ci}; 6288c2ecf20Sopenharmony_ci 6298c2ecf20Sopenharmony_cistatic struct uio_pruss_pdata da8xx_uio_pruss_pdata = { 6308c2ecf20Sopenharmony_ci .pintc_base = 0x4000, 6318c2ecf20Sopenharmony_ci}; 6328c2ecf20Sopenharmony_ci 6338c2ecf20Sopenharmony_cistatic struct platform_device da8xx_uio_pruss_dev = { 6348c2ecf20Sopenharmony_ci .name = "pruss_uio", 6358c2ecf20Sopenharmony_ci .id = -1, 6368c2ecf20Sopenharmony_ci .num_resources = ARRAY_SIZE(da8xx_pruss_resources), 6378c2ecf20Sopenharmony_ci .resource = da8xx_pruss_resources, 6388c2ecf20Sopenharmony_ci .dev = { 6398c2ecf20Sopenharmony_ci .coherent_dma_mask = DMA_BIT_MASK(32), 6408c2ecf20Sopenharmony_ci .platform_data = &da8xx_uio_pruss_pdata, 6418c2ecf20Sopenharmony_ci } 6428c2ecf20Sopenharmony_ci}; 6438c2ecf20Sopenharmony_ci 6448c2ecf20Sopenharmony_ciint __init da8xx_register_uio_pruss(void) 6458c2ecf20Sopenharmony_ci{ 6468c2ecf20Sopenharmony_ci da8xx_uio_pruss_pdata.sram_pool = sram_get_gen_pool(); 6478c2ecf20Sopenharmony_ci return platform_device_register(&da8xx_uio_pruss_dev); 6488c2ecf20Sopenharmony_ci} 6498c2ecf20Sopenharmony_ci 6508c2ecf20Sopenharmony_cistatic struct lcd_ctrl_config lcd_cfg = { 6518c2ecf20Sopenharmony_ci .panel_shade = COLOR_ACTIVE, 6528c2ecf20Sopenharmony_ci .bpp = 16, 6538c2ecf20Sopenharmony_ci}; 6548c2ecf20Sopenharmony_ci 6558c2ecf20Sopenharmony_cistruct da8xx_lcdc_platform_data sharp_lcd035q3dg01_pdata = { 6568c2ecf20Sopenharmony_ci .manu_name = "sharp", 6578c2ecf20Sopenharmony_ci .controller_data = &lcd_cfg, 6588c2ecf20Sopenharmony_ci .type = "Sharp_LCD035Q3DG01", 6598c2ecf20Sopenharmony_ci}; 6608c2ecf20Sopenharmony_ci 6618c2ecf20Sopenharmony_cistruct da8xx_lcdc_platform_data sharp_lk043t1dg01_pdata = { 6628c2ecf20Sopenharmony_ci .manu_name = "sharp", 6638c2ecf20Sopenharmony_ci .controller_data = &lcd_cfg, 6648c2ecf20Sopenharmony_ci .type = "Sharp_LK043T1DG01", 6658c2ecf20Sopenharmony_ci}; 6668c2ecf20Sopenharmony_ci 6678c2ecf20Sopenharmony_cistatic struct resource da8xx_lcdc_resources[] = { 6688c2ecf20Sopenharmony_ci [0] = { /* registers */ 6698c2ecf20Sopenharmony_ci .start = DA8XX_LCD_CNTRL_BASE, 6708c2ecf20Sopenharmony_ci .end = DA8XX_LCD_CNTRL_BASE + SZ_4K - 1, 6718c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 6728c2ecf20Sopenharmony_ci }, 6738c2ecf20Sopenharmony_ci [1] = { /* interrupt */ 6748c2ecf20Sopenharmony_ci .start = DAVINCI_INTC_IRQ(IRQ_DA8XX_LCDINT), 6758c2ecf20Sopenharmony_ci .end = DAVINCI_INTC_IRQ(IRQ_DA8XX_LCDINT), 6768c2ecf20Sopenharmony_ci .flags = IORESOURCE_IRQ, 6778c2ecf20Sopenharmony_ci }, 6788c2ecf20Sopenharmony_ci}; 6798c2ecf20Sopenharmony_ci 6808c2ecf20Sopenharmony_cistatic struct platform_device da8xx_lcdc_device = { 6818c2ecf20Sopenharmony_ci .name = "da8xx_lcdc", 6828c2ecf20Sopenharmony_ci .id = 0, 6838c2ecf20Sopenharmony_ci .num_resources = ARRAY_SIZE(da8xx_lcdc_resources), 6848c2ecf20Sopenharmony_ci .resource = da8xx_lcdc_resources, 6858c2ecf20Sopenharmony_ci .dev = { 6868c2ecf20Sopenharmony_ci .coherent_dma_mask = DMA_BIT_MASK(32), 6878c2ecf20Sopenharmony_ci } 6888c2ecf20Sopenharmony_ci}; 6898c2ecf20Sopenharmony_ci 6908c2ecf20Sopenharmony_ciint __init da8xx_register_lcdc(struct da8xx_lcdc_platform_data *pdata) 6918c2ecf20Sopenharmony_ci{ 6928c2ecf20Sopenharmony_ci da8xx_lcdc_device.dev.platform_data = pdata; 6938c2ecf20Sopenharmony_ci return platform_device_register(&da8xx_lcdc_device); 6948c2ecf20Sopenharmony_ci} 6958c2ecf20Sopenharmony_ci 6968c2ecf20Sopenharmony_cistatic struct resource da8xx_gpio_resources[] = { 6978c2ecf20Sopenharmony_ci { /* registers */ 6988c2ecf20Sopenharmony_ci .start = DA8XX_GPIO_BASE, 6998c2ecf20Sopenharmony_ci .end = DA8XX_GPIO_BASE + SZ_4K - 1, 7008c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 7018c2ecf20Sopenharmony_ci }, 7028c2ecf20Sopenharmony_ci { /* interrupt */ 7038c2ecf20Sopenharmony_ci .start = DAVINCI_INTC_IRQ(IRQ_DA8XX_GPIO0), 7048c2ecf20Sopenharmony_ci .end = DAVINCI_INTC_IRQ(IRQ_DA8XX_GPIO0), 7058c2ecf20Sopenharmony_ci .flags = IORESOURCE_IRQ, 7068c2ecf20Sopenharmony_ci }, 7078c2ecf20Sopenharmony_ci { 7088c2ecf20Sopenharmony_ci .start = DAVINCI_INTC_IRQ(IRQ_DA8XX_GPIO1), 7098c2ecf20Sopenharmony_ci .end = DAVINCI_INTC_IRQ(IRQ_DA8XX_GPIO1), 7108c2ecf20Sopenharmony_ci .flags = IORESOURCE_IRQ, 7118c2ecf20Sopenharmony_ci }, 7128c2ecf20Sopenharmony_ci { 7138c2ecf20Sopenharmony_ci .start = DAVINCI_INTC_IRQ(IRQ_DA8XX_GPIO2), 7148c2ecf20Sopenharmony_ci .end = DAVINCI_INTC_IRQ(IRQ_DA8XX_GPIO2), 7158c2ecf20Sopenharmony_ci .flags = IORESOURCE_IRQ, 7168c2ecf20Sopenharmony_ci }, 7178c2ecf20Sopenharmony_ci { 7188c2ecf20Sopenharmony_ci .start = DAVINCI_INTC_IRQ(IRQ_DA8XX_GPIO3), 7198c2ecf20Sopenharmony_ci .end = DAVINCI_INTC_IRQ(IRQ_DA8XX_GPIO3), 7208c2ecf20Sopenharmony_ci .flags = IORESOURCE_IRQ, 7218c2ecf20Sopenharmony_ci }, 7228c2ecf20Sopenharmony_ci { 7238c2ecf20Sopenharmony_ci .start = DAVINCI_INTC_IRQ(IRQ_DA8XX_GPIO4), 7248c2ecf20Sopenharmony_ci .end = DAVINCI_INTC_IRQ(IRQ_DA8XX_GPIO4), 7258c2ecf20Sopenharmony_ci .flags = IORESOURCE_IRQ, 7268c2ecf20Sopenharmony_ci }, 7278c2ecf20Sopenharmony_ci { 7288c2ecf20Sopenharmony_ci .start = DAVINCI_INTC_IRQ(IRQ_DA8XX_GPIO5), 7298c2ecf20Sopenharmony_ci .end = DAVINCI_INTC_IRQ(IRQ_DA8XX_GPIO5), 7308c2ecf20Sopenharmony_ci .flags = IORESOURCE_IRQ, 7318c2ecf20Sopenharmony_ci }, 7328c2ecf20Sopenharmony_ci { 7338c2ecf20Sopenharmony_ci .start = DAVINCI_INTC_IRQ(IRQ_DA8XX_GPIO6), 7348c2ecf20Sopenharmony_ci .end = DAVINCI_INTC_IRQ(IRQ_DA8XX_GPIO6), 7358c2ecf20Sopenharmony_ci .flags = IORESOURCE_IRQ, 7368c2ecf20Sopenharmony_ci }, 7378c2ecf20Sopenharmony_ci { 7388c2ecf20Sopenharmony_ci .start = DAVINCI_INTC_IRQ(IRQ_DA8XX_GPIO7), 7398c2ecf20Sopenharmony_ci .end = DAVINCI_INTC_IRQ(IRQ_DA8XX_GPIO7), 7408c2ecf20Sopenharmony_ci .flags = IORESOURCE_IRQ, 7418c2ecf20Sopenharmony_ci }, 7428c2ecf20Sopenharmony_ci { 7438c2ecf20Sopenharmony_ci .start = DAVINCI_INTC_IRQ(IRQ_DA8XX_GPIO8), 7448c2ecf20Sopenharmony_ci .end = DAVINCI_INTC_IRQ(IRQ_DA8XX_GPIO8), 7458c2ecf20Sopenharmony_ci .flags = IORESOURCE_IRQ, 7468c2ecf20Sopenharmony_ci }, 7478c2ecf20Sopenharmony_ci}; 7488c2ecf20Sopenharmony_ci 7498c2ecf20Sopenharmony_cistatic struct platform_device da8xx_gpio_device = { 7508c2ecf20Sopenharmony_ci .name = "davinci_gpio", 7518c2ecf20Sopenharmony_ci .id = -1, 7528c2ecf20Sopenharmony_ci .num_resources = ARRAY_SIZE(da8xx_gpio_resources), 7538c2ecf20Sopenharmony_ci .resource = da8xx_gpio_resources, 7548c2ecf20Sopenharmony_ci}; 7558c2ecf20Sopenharmony_ci 7568c2ecf20Sopenharmony_ciint __init da8xx_register_gpio(void *pdata) 7578c2ecf20Sopenharmony_ci{ 7588c2ecf20Sopenharmony_ci da8xx_gpio_device.dev.platform_data = pdata; 7598c2ecf20Sopenharmony_ci return platform_device_register(&da8xx_gpio_device); 7608c2ecf20Sopenharmony_ci} 7618c2ecf20Sopenharmony_ci 7628c2ecf20Sopenharmony_cistatic struct resource da8xx_mmcsd0_resources[] = { 7638c2ecf20Sopenharmony_ci { /* registers */ 7648c2ecf20Sopenharmony_ci .start = DA8XX_MMCSD0_BASE, 7658c2ecf20Sopenharmony_ci .end = DA8XX_MMCSD0_BASE + SZ_4K - 1, 7668c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 7678c2ecf20Sopenharmony_ci }, 7688c2ecf20Sopenharmony_ci { /* interrupt */ 7698c2ecf20Sopenharmony_ci .start = DAVINCI_INTC_IRQ(IRQ_DA8XX_MMCSDINT0), 7708c2ecf20Sopenharmony_ci .end = DAVINCI_INTC_IRQ(IRQ_DA8XX_MMCSDINT0), 7718c2ecf20Sopenharmony_ci .flags = IORESOURCE_IRQ, 7728c2ecf20Sopenharmony_ci }, 7738c2ecf20Sopenharmony_ci}; 7748c2ecf20Sopenharmony_ci 7758c2ecf20Sopenharmony_cistatic struct platform_device da8xx_mmcsd0_device = { 7768c2ecf20Sopenharmony_ci .name = "da830-mmc", 7778c2ecf20Sopenharmony_ci .id = 0, 7788c2ecf20Sopenharmony_ci .num_resources = ARRAY_SIZE(da8xx_mmcsd0_resources), 7798c2ecf20Sopenharmony_ci .resource = da8xx_mmcsd0_resources, 7808c2ecf20Sopenharmony_ci}; 7818c2ecf20Sopenharmony_ci 7828c2ecf20Sopenharmony_ciint __init da8xx_register_mmcsd0(struct davinci_mmc_config *config) 7838c2ecf20Sopenharmony_ci{ 7848c2ecf20Sopenharmony_ci da8xx_mmcsd0_device.dev.platform_data = config; 7858c2ecf20Sopenharmony_ci return platform_device_register(&da8xx_mmcsd0_device); 7868c2ecf20Sopenharmony_ci} 7878c2ecf20Sopenharmony_ci 7888c2ecf20Sopenharmony_ci#ifdef CONFIG_ARCH_DAVINCI_DA850 7898c2ecf20Sopenharmony_cistatic struct resource da850_mmcsd1_resources[] = { 7908c2ecf20Sopenharmony_ci { /* registers */ 7918c2ecf20Sopenharmony_ci .start = DA850_MMCSD1_BASE, 7928c2ecf20Sopenharmony_ci .end = DA850_MMCSD1_BASE + SZ_4K - 1, 7938c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 7948c2ecf20Sopenharmony_ci }, 7958c2ecf20Sopenharmony_ci { /* interrupt */ 7968c2ecf20Sopenharmony_ci .start = DAVINCI_INTC_IRQ(IRQ_DA850_MMCSDINT0_1), 7978c2ecf20Sopenharmony_ci .end = DAVINCI_INTC_IRQ(IRQ_DA850_MMCSDINT0_1), 7988c2ecf20Sopenharmony_ci .flags = IORESOURCE_IRQ, 7998c2ecf20Sopenharmony_ci }, 8008c2ecf20Sopenharmony_ci}; 8018c2ecf20Sopenharmony_ci 8028c2ecf20Sopenharmony_cistatic struct platform_device da850_mmcsd1_device = { 8038c2ecf20Sopenharmony_ci .name = "da830-mmc", 8048c2ecf20Sopenharmony_ci .id = 1, 8058c2ecf20Sopenharmony_ci .num_resources = ARRAY_SIZE(da850_mmcsd1_resources), 8068c2ecf20Sopenharmony_ci .resource = da850_mmcsd1_resources, 8078c2ecf20Sopenharmony_ci}; 8088c2ecf20Sopenharmony_ci 8098c2ecf20Sopenharmony_ciint __init da850_register_mmcsd1(struct davinci_mmc_config *config) 8108c2ecf20Sopenharmony_ci{ 8118c2ecf20Sopenharmony_ci da850_mmcsd1_device.dev.platform_data = config; 8128c2ecf20Sopenharmony_ci return platform_device_register(&da850_mmcsd1_device); 8138c2ecf20Sopenharmony_ci} 8148c2ecf20Sopenharmony_ci#endif 8158c2ecf20Sopenharmony_ci 8168c2ecf20Sopenharmony_cistatic struct resource da8xx_rproc_resources[] = { 8178c2ecf20Sopenharmony_ci { /* DSP boot address */ 8188c2ecf20Sopenharmony_ci .name = "host1cfg", 8198c2ecf20Sopenharmony_ci .start = DA8XX_SYSCFG0_BASE + DA8XX_HOST1CFG_REG, 8208c2ecf20Sopenharmony_ci .end = DA8XX_SYSCFG0_BASE + DA8XX_HOST1CFG_REG + 3, 8218c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 8228c2ecf20Sopenharmony_ci }, 8238c2ecf20Sopenharmony_ci { /* DSP interrupt registers */ 8248c2ecf20Sopenharmony_ci .name = "chipsig", 8258c2ecf20Sopenharmony_ci .start = DA8XX_SYSCFG0_BASE + DA8XX_CHIPSIG_REG, 8268c2ecf20Sopenharmony_ci .end = DA8XX_SYSCFG0_BASE + DA8XX_CHIPSIG_REG + 7, 8278c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 8288c2ecf20Sopenharmony_ci }, 8298c2ecf20Sopenharmony_ci { /* DSP L2 RAM */ 8308c2ecf20Sopenharmony_ci .name = "l2sram", 8318c2ecf20Sopenharmony_ci .start = DA8XX_DSP_L2_RAM_BASE, 8328c2ecf20Sopenharmony_ci .end = DA8XX_DSP_L2_RAM_BASE + SZ_256K - 1, 8338c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 8348c2ecf20Sopenharmony_ci }, 8358c2ecf20Sopenharmony_ci { /* DSP L1P RAM */ 8368c2ecf20Sopenharmony_ci .name = "l1pram", 8378c2ecf20Sopenharmony_ci .start = DA8XX_DSP_L1P_RAM_BASE, 8388c2ecf20Sopenharmony_ci .end = DA8XX_DSP_L1P_RAM_BASE + SZ_32K - 1, 8398c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 8408c2ecf20Sopenharmony_ci }, 8418c2ecf20Sopenharmony_ci { /* DSP L1D RAM */ 8428c2ecf20Sopenharmony_ci .name = "l1dram", 8438c2ecf20Sopenharmony_ci .start = DA8XX_DSP_L1D_RAM_BASE, 8448c2ecf20Sopenharmony_ci .end = DA8XX_DSP_L1D_RAM_BASE + SZ_32K - 1, 8458c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 8468c2ecf20Sopenharmony_ci }, 8478c2ecf20Sopenharmony_ci { /* dsp irq */ 8488c2ecf20Sopenharmony_ci .start = DAVINCI_INTC_IRQ(IRQ_DA8XX_CHIPINT0), 8498c2ecf20Sopenharmony_ci .end = DAVINCI_INTC_IRQ(IRQ_DA8XX_CHIPINT0), 8508c2ecf20Sopenharmony_ci .flags = IORESOURCE_IRQ, 8518c2ecf20Sopenharmony_ci }, 8528c2ecf20Sopenharmony_ci}; 8538c2ecf20Sopenharmony_ci 8548c2ecf20Sopenharmony_cistatic struct platform_device da8xx_dsp = { 8558c2ecf20Sopenharmony_ci .name = "davinci-rproc", 8568c2ecf20Sopenharmony_ci .dev = { 8578c2ecf20Sopenharmony_ci .coherent_dma_mask = DMA_BIT_MASK(32), 8588c2ecf20Sopenharmony_ci }, 8598c2ecf20Sopenharmony_ci .num_resources = ARRAY_SIZE(da8xx_rproc_resources), 8608c2ecf20Sopenharmony_ci .resource = da8xx_rproc_resources, 8618c2ecf20Sopenharmony_ci}; 8628c2ecf20Sopenharmony_ci 8638c2ecf20Sopenharmony_cistatic bool rproc_mem_inited __initdata; 8648c2ecf20Sopenharmony_ci 8658c2ecf20Sopenharmony_ci#if IS_ENABLED(CONFIG_DA8XX_REMOTEPROC) 8668c2ecf20Sopenharmony_ci 8678c2ecf20Sopenharmony_cistatic phys_addr_t rproc_base __initdata; 8688c2ecf20Sopenharmony_cistatic unsigned long rproc_size __initdata; 8698c2ecf20Sopenharmony_ci 8708c2ecf20Sopenharmony_cistatic int __init early_rproc_mem(char *p) 8718c2ecf20Sopenharmony_ci{ 8728c2ecf20Sopenharmony_ci char *endp; 8738c2ecf20Sopenharmony_ci 8748c2ecf20Sopenharmony_ci if (p == NULL) 8758c2ecf20Sopenharmony_ci return 0; 8768c2ecf20Sopenharmony_ci 8778c2ecf20Sopenharmony_ci rproc_size = memparse(p, &endp); 8788c2ecf20Sopenharmony_ci if (*endp == '@') 8798c2ecf20Sopenharmony_ci rproc_base = memparse(endp + 1, NULL); 8808c2ecf20Sopenharmony_ci 8818c2ecf20Sopenharmony_ci return 0; 8828c2ecf20Sopenharmony_ci} 8838c2ecf20Sopenharmony_ciearly_param("rproc_mem", early_rproc_mem); 8848c2ecf20Sopenharmony_ci 8858c2ecf20Sopenharmony_civoid __init da8xx_rproc_reserve_cma(void) 8868c2ecf20Sopenharmony_ci{ 8878c2ecf20Sopenharmony_ci struct cma *cma; 8888c2ecf20Sopenharmony_ci int ret; 8898c2ecf20Sopenharmony_ci 8908c2ecf20Sopenharmony_ci if (!rproc_base || !rproc_size) { 8918c2ecf20Sopenharmony_ci pr_err("%s: 'rproc_mem=nn@address' badly specified\n" 8928c2ecf20Sopenharmony_ci " 'nn' and 'address' must both be non-zero\n", 8938c2ecf20Sopenharmony_ci __func__); 8948c2ecf20Sopenharmony_ci 8958c2ecf20Sopenharmony_ci return; 8968c2ecf20Sopenharmony_ci } 8978c2ecf20Sopenharmony_ci 8988c2ecf20Sopenharmony_ci pr_info("%s: reserving 0x%lx @ 0x%lx...\n", 8998c2ecf20Sopenharmony_ci __func__, rproc_size, (unsigned long)rproc_base); 9008c2ecf20Sopenharmony_ci 9018c2ecf20Sopenharmony_ci ret = dma_contiguous_reserve_area(rproc_size, rproc_base, 0, &cma, 9028c2ecf20Sopenharmony_ci true); 9038c2ecf20Sopenharmony_ci if (ret) { 9048c2ecf20Sopenharmony_ci pr_err("%s: dma_contiguous_reserve_area failed %d\n", 9058c2ecf20Sopenharmony_ci __func__, ret); 9068c2ecf20Sopenharmony_ci return; 9078c2ecf20Sopenharmony_ci } 9088c2ecf20Sopenharmony_ci da8xx_dsp.dev.cma_area = cma; 9098c2ecf20Sopenharmony_ci rproc_mem_inited = true; 9108c2ecf20Sopenharmony_ci} 9118c2ecf20Sopenharmony_ci#else 9128c2ecf20Sopenharmony_ci 9138c2ecf20Sopenharmony_civoid __init da8xx_rproc_reserve_cma(void) 9148c2ecf20Sopenharmony_ci{ 9158c2ecf20Sopenharmony_ci} 9168c2ecf20Sopenharmony_ci 9178c2ecf20Sopenharmony_ci#endif 9188c2ecf20Sopenharmony_ci 9198c2ecf20Sopenharmony_ciint __init da8xx_register_rproc(void) 9208c2ecf20Sopenharmony_ci{ 9218c2ecf20Sopenharmony_ci int ret; 9228c2ecf20Sopenharmony_ci 9238c2ecf20Sopenharmony_ci if (!rproc_mem_inited) { 9248c2ecf20Sopenharmony_ci pr_warn("%s: memory not reserved for DSP, not registering DSP device\n", 9258c2ecf20Sopenharmony_ci __func__); 9268c2ecf20Sopenharmony_ci return -ENOMEM; 9278c2ecf20Sopenharmony_ci } 9288c2ecf20Sopenharmony_ci 9298c2ecf20Sopenharmony_ci ret = platform_device_register(&da8xx_dsp); 9308c2ecf20Sopenharmony_ci if (ret) 9318c2ecf20Sopenharmony_ci pr_err("%s: can't register DSP device: %d\n", __func__, ret); 9328c2ecf20Sopenharmony_ci 9338c2ecf20Sopenharmony_ci return ret; 9348c2ecf20Sopenharmony_ci}; 9358c2ecf20Sopenharmony_ci 9368c2ecf20Sopenharmony_cistatic struct resource da8xx_rtc_resources[] = { 9378c2ecf20Sopenharmony_ci { 9388c2ecf20Sopenharmony_ci .start = DA8XX_RTC_BASE, 9398c2ecf20Sopenharmony_ci .end = DA8XX_RTC_BASE + SZ_4K - 1, 9408c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 9418c2ecf20Sopenharmony_ci }, 9428c2ecf20Sopenharmony_ci { /* timer irq */ 9438c2ecf20Sopenharmony_ci .start = DAVINCI_INTC_IRQ(IRQ_DA8XX_RTC), 9448c2ecf20Sopenharmony_ci .end = DAVINCI_INTC_IRQ(IRQ_DA8XX_RTC), 9458c2ecf20Sopenharmony_ci .flags = IORESOURCE_IRQ, 9468c2ecf20Sopenharmony_ci }, 9478c2ecf20Sopenharmony_ci { /* alarm irq */ 9488c2ecf20Sopenharmony_ci .start = DAVINCI_INTC_IRQ(IRQ_DA8XX_RTC), 9498c2ecf20Sopenharmony_ci .end = DAVINCI_INTC_IRQ(IRQ_DA8XX_RTC), 9508c2ecf20Sopenharmony_ci .flags = IORESOURCE_IRQ, 9518c2ecf20Sopenharmony_ci }, 9528c2ecf20Sopenharmony_ci}; 9538c2ecf20Sopenharmony_ci 9548c2ecf20Sopenharmony_cistatic struct platform_device da8xx_rtc_device = { 9558c2ecf20Sopenharmony_ci .name = "da830-rtc", 9568c2ecf20Sopenharmony_ci .id = -1, 9578c2ecf20Sopenharmony_ci .num_resources = ARRAY_SIZE(da8xx_rtc_resources), 9588c2ecf20Sopenharmony_ci .resource = da8xx_rtc_resources, 9598c2ecf20Sopenharmony_ci}; 9608c2ecf20Sopenharmony_ci 9618c2ecf20Sopenharmony_ciint da8xx_register_rtc(void) 9628c2ecf20Sopenharmony_ci{ 9638c2ecf20Sopenharmony_ci return platform_device_register(&da8xx_rtc_device); 9648c2ecf20Sopenharmony_ci} 9658c2ecf20Sopenharmony_ci 9668c2ecf20Sopenharmony_cistatic void __iomem *da8xx_ddr2_ctlr_base; 9678c2ecf20Sopenharmony_civoid __iomem * __init da8xx_get_mem_ctlr(void) 9688c2ecf20Sopenharmony_ci{ 9698c2ecf20Sopenharmony_ci if (da8xx_ddr2_ctlr_base) 9708c2ecf20Sopenharmony_ci return da8xx_ddr2_ctlr_base; 9718c2ecf20Sopenharmony_ci 9728c2ecf20Sopenharmony_ci da8xx_ddr2_ctlr_base = ioremap(DA8XX_DDR2_CTL_BASE, SZ_32K); 9738c2ecf20Sopenharmony_ci if (!da8xx_ddr2_ctlr_base) 9748c2ecf20Sopenharmony_ci pr_warn("%s: Unable to map DDR2 controller", __func__); 9758c2ecf20Sopenharmony_ci 9768c2ecf20Sopenharmony_ci return da8xx_ddr2_ctlr_base; 9778c2ecf20Sopenharmony_ci} 9788c2ecf20Sopenharmony_ci 9798c2ecf20Sopenharmony_cistatic struct resource da8xx_cpuidle_resources[] = { 9808c2ecf20Sopenharmony_ci { 9818c2ecf20Sopenharmony_ci .start = DA8XX_DDR2_CTL_BASE, 9828c2ecf20Sopenharmony_ci .end = DA8XX_DDR2_CTL_BASE + SZ_32K - 1, 9838c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 9848c2ecf20Sopenharmony_ci }, 9858c2ecf20Sopenharmony_ci}; 9868c2ecf20Sopenharmony_ci 9878c2ecf20Sopenharmony_ci/* DA8XX devices support DDR2 power down */ 9888c2ecf20Sopenharmony_cistatic struct davinci_cpuidle_config da8xx_cpuidle_pdata = { 9898c2ecf20Sopenharmony_ci .ddr2_pdown = 1, 9908c2ecf20Sopenharmony_ci}; 9918c2ecf20Sopenharmony_ci 9928c2ecf20Sopenharmony_ci 9938c2ecf20Sopenharmony_cistatic struct platform_device da8xx_cpuidle_device = { 9948c2ecf20Sopenharmony_ci .name = "cpuidle-davinci", 9958c2ecf20Sopenharmony_ci .num_resources = ARRAY_SIZE(da8xx_cpuidle_resources), 9968c2ecf20Sopenharmony_ci .resource = da8xx_cpuidle_resources, 9978c2ecf20Sopenharmony_ci .dev = { 9988c2ecf20Sopenharmony_ci .platform_data = &da8xx_cpuidle_pdata, 9998c2ecf20Sopenharmony_ci }, 10008c2ecf20Sopenharmony_ci}; 10018c2ecf20Sopenharmony_ci 10028c2ecf20Sopenharmony_ciint __init da8xx_register_cpuidle(void) 10038c2ecf20Sopenharmony_ci{ 10048c2ecf20Sopenharmony_ci da8xx_cpuidle_pdata.ddr2_ctlr_base = da8xx_get_mem_ctlr(); 10058c2ecf20Sopenharmony_ci 10068c2ecf20Sopenharmony_ci return platform_device_register(&da8xx_cpuidle_device); 10078c2ecf20Sopenharmony_ci} 10088c2ecf20Sopenharmony_ci 10098c2ecf20Sopenharmony_cistatic struct resource da8xx_spi0_resources[] = { 10108c2ecf20Sopenharmony_ci [0] = { 10118c2ecf20Sopenharmony_ci .start = DA8XX_SPI0_BASE, 10128c2ecf20Sopenharmony_ci .end = DA8XX_SPI0_BASE + SZ_4K - 1, 10138c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 10148c2ecf20Sopenharmony_ci }, 10158c2ecf20Sopenharmony_ci [1] = { 10168c2ecf20Sopenharmony_ci .start = DAVINCI_INTC_IRQ(IRQ_DA8XX_SPINT0), 10178c2ecf20Sopenharmony_ci .end = DAVINCI_INTC_IRQ(IRQ_DA8XX_SPINT0), 10188c2ecf20Sopenharmony_ci .flags = IORESOURCE_IRQ, 10198c2ecf20Sopenharmony_ci }, 10208c2ecf20Sopenharmony_ci}; 10218c2ecf20Sopenharmony_ci 10228c2ecf20Sopenharmony_cistatic struct resource da8xx_spi1_resources[] = { 10238c2ecf20Sopenharmony_ci [0] = { 10248c2ecf20Sopenharmony_ci .start = DA830_SPI1_BASE, 10258c2ecf20Sopenharmony_ci .end = DA830_SPI1_BASE + SZ_4K - 1, 10268c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 10278c2ecf20Sopenharmony_ci }, 10288c2ecf20Sopenharmony_ci [1] = { 10298c2ecf20Sopenharmony_ci .start = DAVINCI_INTC_IRQ(IRQ_DA8XX_SPINT1), 10308c2ecf20Sopenharmony_ci .end = DAVINCI_INTC_IRQ(IRQ_DA8XX_SPINT1), 10318c2ecf20Sopenharmony_ci .flags = IORESOURCE_IRQ, 10328c2ecf20Sopenharmony_ci }, 10338c2ecf20Sopenharmony_ci}; 10348c2ecf20Sopenharmony_ci 10358c2ecf20Sopenharmony_cistatic struct davinci_spi_platform_data da8xx_spi_pdata[] = { 10368c2ecf20Sopenharmony_ci [0] = { 10378c2ecf20Sopenharmony_ci .version = SPI_VERSION_2, 10388c2ecf20Sopenharmony_ci .intr_line = 1, 10398c2ecf20Sopenharmony_ci .dma_event_q = EVENTQ_0, 10408c2ecf20Sopenharmony_ci .prescaler_limit = 2, 10418c2ecf20Sopenharmony_ci }, 10428c2ecf20Sopenharmony_ci [1] = { 10438c2ecf20Sopenharmony_ci .version = SPI_VERSION_2, 10448c2ecf20Sopenharmony_ci .intr_line = 1, 10458c2ecf20Sopenharmony_ci .dma_event_q = EVENTQ_0, 10468c2ecf20Sopenharmony_ci .prescaler_limit = 2, 10478c2ecf20Sopenharmony_ci }, 10488c2ecf20Sopenharmony_ci}; 10498c2ecf20Sopenharmony_ci 10508c2ecf20Sopenharmony_cistatic struct platform_device da8xx_spi_device[] = { 10518c2ecf20Sopenharmony_ci [0] = { 10528c2ecf20Sopenharmony_ci .name = "spi_davinci", 10538c2ecf20Sopenharmony_ci .id = 0, 10548c2ecf20Sopenharmony_ci .num_resources = ARRAY_SIZE(da8xx_spi0_resources), 10558c2ecf20Sopenharmony_ci .resource = da8xx_spi0_resources, 10568c2ecf20Sopenharmony_ci .dev = { 10578c2ecf20Sopenharmony_ci .platform_data = &da8xx_spi_pdata[0], 10588c2ecf20Sopenharmony_ci }, 10598c2ecf20Sopenharmony_ci }, 10608c2ecf20Sopenharmony_ci [1] = { 10618c2ecf20Sopenharmony_ci .name = "spi_davinci", 10628c2ecf20Sopenharmony_ci .id = 1, 10638c2ecf20Sopenharmony_ci .num_resources = ARRAY_SIZE(da8xx_spi1_resources), 10648c2ecf20Sopenharmony_ci .resource = da8xx_spi1_resources, 10658c2ecf20Sopenharmony_ci .dev = { 10668c2ecf20Sopenharmony_ci .platform_data = &da8xx_spi_pdata[1], 10678c2ecf20Sopenharmony_ci }, 10688c2ecf20Sopenharmony_ci }, 10698c2ecf20Sopenharmony_ci}; 10708c2ecf20Sopenharmony_ci 10718c2ecf20Sopenharmony_ciint __init da8xx_register_spi_bus(int instance, unsigned num_chipselect) 10728c2ecf20Sopenharmony_ci{ 10738c2ecf20Sopenharmony_ci if (instance < 0 || instance > 1) 10748c2ecf20Sopenharmony_ci return -EINVAL; 10758c2ecf20Sopenharmony_ci 10768c2ecf20Sopenharmony_ci da8xx_spi_pdata[instance].num_chipselect = num_chipselect; 10778c2ecf20Sopenharmony_ci 10788c2ecf20Sopenharmony_ci if (instance == 1 && cpu_is_davinci_da850()) { 10798c2ecf20Sopenharmony_ci da8xx_spi1_resources[0].start = DA850_SPI1_BASE; 10808c2ecf20Sopenharmony_ci da8xx_spi1_resources[0].end = DA850_SPI1_BASE + SZ_4K - 1; 10818c2ecf20Sopenharmony_ci } 10828c2ecf20Sopenharmony_ci 10838c2ecf20Sopenharmony_ci return platform_device_register(&da8xx_spi_device[instance]); 10848c2ecf20Sopenharmony_ci} 10858c2ecf20Sopenharmony_ci 10868c2ecf20Sopenharmony_ci#ifdef CONFIG_ARCH_DAVINCI_DA850 10878c2ecf20Sopenharmony_ciint __init da850_register_sata_refclk(int rate) 10888c2ecf20Sopenharmony_ci{ 10898c2ecf20Sopenharmony_ci struct clk *clk; 10908c2ecf20Sopenharmony_ci 10918c2ecf20Sopenharmony_ci clk = clk_register_fixed_rate(NULL, "sata_refclk", NULL, 0, rate); 10928c2ecf20Sopenharmony_ci if (IS_ERR(clk)) 10938c2ecf20Sopenharmony_ci return PTR_ERR(clk); 10948c2ecf20Sopenharmony_ci 10958c2ecf20Sopenharmony_ci return clk_register_clkdev(clk, "refclk", "ahci_da850"); 10968c2ecf20Sopenharmony_ci} 10978c2ecf20Sopenharmony_ci 10988c2ecf20Sopenharmony_cistatic struct resource da850_sata_resources[] = { 10998c2ecf20Sopenharmony_ci { 11008c2ecf20Sopenharmony_ci .start = DA850_SATA_BASE, 11018c2ecf20Sopenharmony_ci .end = DA850_SATA_BASE + 0x1fff, 11028c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 11038c2ecf20Sopenharmony_ci }, 11048c2ecf20Sopenharmony_ci { 11058c2ecf20Sopenharmony_ci .start = DA8XX_SYSCFG1_BASE + DA8XX_PWRDN_REG, 11068c2ecf20Sopenharmony_ci .end = DA8XX_SYSCFG1_BASE + DA8XX_PWRDN_REG + 0x3, 11078c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 11088c2ecf20Sopenharmony_ci }, 11098c2ecf20Sopenharmony_ci { 11108c2ecf20Sopenharmony_ci .start = DAVINCI_INTC_IRQ(IRQ_DA850_SATAINT), 11118c2ecf20Sopenharmony_ci .flags = IORESOURCE_IRQ, 11128c2ecf20Sopenharmony_ci }, 11138c2ecf20Sopenharmony_ci}; 11148c2ecf20Sopenharmony_ci 11158c2ecf20Sopenharmony_cistatic u64 da850_sata_dmamask = DMA_BIT_MASK(32); 11168c2ecf20Sopenharmony_ci 11178c2ecf20Sopenharmony_cistatic struct platform_device da850_sata_device = { 11188c2ecf20Sopenharmony_ci .name = "ahci_da850", 11198c2ecf20Sopenharmony_ci .id = -1, 11208c2ecf20Sopenharmony_ci .dev = { 11218c2ecf20Sopenharmony_ci .dma_mask = &da850_sata_dmamask, 11228c2ecf20Sopenharmony_ci .coherent_dma_mask = DMA_BIT_MASK(32), 11238c2ecf20Sopenharmony_ci }, 11248c2ecf20Sopenharmony_ci .num_resources = ARRAY_SIZE(da850_sata_resources), 11258c2ecf20Sopenharmony_ci .resource = da850_sata_resources, 11268c2ecf20Sopenharmony_ci}; 11278c2ecf20Sopenharmony_ci 11288c2ecf20Sopenharmony_ciint __init da850_register_sata(unsigned long refclkpn) 11298c2ecf20Sopenharmony_ci{ 11308c2ecf20Sopenharmony_ci int ret; 11318c2ecf20Sopenharmony_ci 11328c2ecf20Sopenharmony_ci ret = da850_register_sata_refclk(refclkpn); 11338c2ecf20Sopenharmony_ci if (ret) 11348c2ecf20Sopenharmony_ci return ret; 11358c2ecf20Sopenharmony_ci 11368c2ecf20Sopenharmony_ci return platform_device_register(&da850_sata_device); 11378c2ecf20Sopenharmony_ci} 11388c2ecf20Sopenharmony_ci#endif 11398c2ecf20Sopenharmony_ci 11408c2ecf20Sopenharmony_cistatic struct regmap *da8xx_cfgchip; 11418c2ecf20Sopenharmony_ci 11428c2ecf20Sopenharmony_cistatic const struct regmap_config da8xx_cfgchip_config __initconst = { 11438c2ecf20Sopenharmony_ci .name = "cfgchip", 11448c2ecf20Sopenharmony_ci .reg_bits = 32, 11458c2ecf20Sopenharmony_ci .val_bits = 32, 11468c2ecf20Sopenharmony_ci .reg_stride = 4, 11478c2ecf20Sopenharmony_ci .max_register = DA8XX_CFGCHIP4_REG - DA8XX_CFGCHIP0_REG, 11488c2ecf20Sopenharmony_ci}; 11498c2ecf20Sopenharmony_ci 11508c2ecf20Sopenharmony_ci/** 11518c2ecf20Sopenharmony_ci * da8xx_get_cfgchip - Lazy gets CFGCHIP as regmap 11528c2ecf20Sopenharmony_ci * 11538c2ecf20Sopenharmony_ci * This is for use on non-DT boards only. For DT boards, use 11548c2ecf20Sopenharmony_ci * syscon_regmap_lookup_by_compatible("ti,da830-cfgchip") 11558c2ecf20Sopenharmony_ci * 11568c2ecf20Sopenharmony_ci * Returns: Pointer to the CFGCHIP regmap or negative error code. 11578c2ecf20Sopenharmony_ci */ 11588c2ecf20Sopenharmony_cistruct regmap * __init da8xx_get_cfgchip(void) 11598c2ecf20Sopenharmony_ci{ 11608c2ecf20Sopenharmony_ci if (IS_ERR_OR_NULL(da8xx_cfgchip)) 11618c2ecf20Sopenharmony_ci da8xx_cfgchip = regmap_init_mmio(NULL, 11628c2ecf20Sopenharmony_ci DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP0_REG), 11638c2ecf20Sopenharmony_ci &da8xx_cfgchip_config); 11648c2ecf20Sopenharmony_ci 11658c2ecf20Sopenharmony_ci return da8xx_cfgchip; 11668c2ecf20Sopenharmony_ci} 1167