18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * TI DaVinci DM646x chip specific setup 38c2ecf20Sopenharmony_ci * 48c2ecf20Sopenharmony_ci * Author: Kevin Hilman, Deep Root Systems, LLC 58c2ecf20Sopenharmony_ci * 68c2ecf20Sopenharmony_ci * 2007 (c) Deep Root Systems, LLC. This file is licensed under 78c2ecf20Sopenharmony_ci * the terms of the GNU General Public License version 2. This program 88c2ecf20Sopenharmony_ci * is licensed "as is" without any warranty of any kind, whether express 98c2ecf20Sopenharmony_ci * or implied. 108c2ecf20Sopenharmony_ci */ 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_ci#include <linux/clk-provider.h> 138c2ecf20Sopenharmony_ci#include <linux/clk/davinci.h> 148c2ecf20Sopenharmony_ci#include <linux/clkdev.h> 158c2ecf20Sopenharmony_ci#include <linux/dma-mapping.h> 168c2ecf20Sopenharmony_ci#include <linux/dmaengine.h> 178c2ecf20Sopenharmony_ci#include <linux/init.h> 188c2ecf20Sopenharmony_ci#include <linux/io.h> 198c2ecf20Sopenharmony_ci#include <linux/irqchip/irq-davinci-aintc.h> 208c2ecf20Sopenharmony_ci#include <linux/platform_data/edma.h> 218c2ecf20Sopenharmony_ci#include <linux/platform_data/gpio-davinci.h> 228c2ecf20Sopenharmony_ci#include <linux/platform_device.h> 238c2ecf20Sopenharmony_ci#include <linux/serial_8250.h> 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_ci#include <asm/mach/map.h> 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ci#include <mach/common.h> 288c2ecf20Sopenharmony_ci#include <mach/cputype.h> 298c2ecf20Sopenharmony_ci#include <mach/mux.h> 308c2ecf20Sopenharmony_ci#include <mach/serial.h> 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_ci#include <clocksource/timer-davinci.h> 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_ci#include "asp.h" 358c2ecf20Sopenharmony_ci#include "davinci.h" 368c2ecf20Sopenharmony_ci#include "irqs.h" 378c2ecf20Sopenharmony_ci#include "mux.h" 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_ci#define DAVINCI_VPIF_BASE (0x01C12000) 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_ci#define VDD3P3V_VID_MASK (BIT_MASK(3) | BIT_MASK(2) | BIT_MASK(1) |\ 428c2ecf20Sopenharmony_ci BIT_MASK(0)) 438c2ecf20Sopenharmony_ci#define VSCLKDIS_MASK (BIT_MASK(11) | BIT_MASK(10) | BIT_MASK(9) |\ 448c2ecf20Sopenharmony_ci BIT_MASK(8)) 458c2ecf20Sopenharmony_ci 468c2ecf20Sopenharmony_ci#define DM646X_EMAC_BASE 0x01c80000 478c2ecf20Sopenharmony_ci#define DM646X_EMAC_MDIO_BASE (DM646X_EMAC_BASE + 0x4000) 488c2ecf20Sopenharmony_ci#define DM646X_EMAC_CNTRL_OFFSET 0x0000 498c2ecf20Sopenharmony_ci#define DM646X_EMAC_CNTRL_MOD_OFFSET 0x1000 508c2ecf20Sopenharmony_ci#define DM646X_EMAC_CNTRL_RAM_OFFSET 0x2000 518c2ecf20Sopenharmony_ci#define DM646X_EMAC_CNTRL_RAM_SIZE 0x2000 528c2ecf20Sopenharmony_ci 538c2ecf20Sopenharmony_cistatic struct emac_platform_data dm646x_emac_pdata = { 548c2ecf20Sopenharmony_ci .ctrl_reg_offset = DM646X_EMAC_CNTRL_OFFSET, 558c2ecf20Sopenharmony_ci .ctrl_mod_reg_offset = DM646X_EMAC_CNTRL_MOD_OFFSET, 568c2ecf20Sopenharmony_ci .ctrl_ram_offset = DM646X_EMAC_CNTRL_RAM_OFFSET, 578c2ecf20Sopenharmony_ci .ctrl_ram_size = DM646X_EMAC_CNTRL_RAM_SIZE, 588c2ecf20Sopenharmony_ci .version = EMAC_VERSION_2, 598c2ecf20Sopenharmony_ci}; 608c2ecf20Sopenharmony_ci 618c2ecf20Sopenharmony_cistatic struct resource dm646x_emac_resources[] = { 628c2ecf20Sopenharmony_ci { 638c2ecf20Sopenharmony_ci .start = DM646X_EMAC_BASE, 648c2ecf20Sopenharmony_ci .end = DM646X_EMAC_BASE + SZ_16K - 1, 658c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 668c2ecf20Sopenharmony_ci }, 678c2ecf20Sopenharmony_ci { 688c2ecf20Sopenharmony_ci .start = DAVINCI_INTC_IRQ(IRQ_DM646X_EMACRXTHINT), 698c2ecf20Sopenharmony_ci .end = DAVINCI_INTC_IRQ(IRQ_DM646X_EMACRXTHINT), 708c2ecf20Sopenharmony_ci .flags = IORESOURCE_IRQ, 718c2ecf20Sopenharmony_ci }, 728c2ecf20Sopenharmony_ci { 738c2ecf20Sopenharmony_ci .start = DAVINCI_INTC_IRQ(IRQ_DM646X_EMACRXINT), 748c2ecf20Sopenharmony_ci .end = DAVINCI_INTC_IRQ(IRQ_DM646X_EMACRXINT), 758c2ecf20Sopenharmony_ci .flags = IORESOURCE_IRQ, 768c2ecf20Sopenharmony_ci }, 778c2ecf20Sopenharmony_ci { 788c2ecf20Sopenharmony_ci .start = DAVINCI_INTC_IRQ(IRQ_DM646X_EMACTXINT), 798c2ecf20Sopenharmony_ci .end = DAVINCI_INTC_IRQ(IRQ_DM646X_EMACTXINT), 808c2ecf20Sopenharmony_ci .flags = IORESOURCE_IRQ, 818c2ecf20Sopenharmony_ci }, 828c2ecf20Sopenharmony_ci { 838c2ecf20Sopenharmony_ci .start = DAVINCI_INTC_IRQ(IRQ_DM646X_EMACMISCINT), 848c2ecf20Sopenharmony_ci .end = DAVINCI_INTC_IRQ(IRQ_DM646X_EMACMISCINT), 858c2ecf20Sopenharmony_ci .flags = IORESOURCE_IRQ, 868c2ecf20Sopenharmony_ci }, 878c2ecf20Sopenharmony_ci}; 888c2ecf20Sopenharmony_ci 898c2ecf20Sopenharmony_cistatic struct platform_device dm646x_emac_device = { 908c2ecf20Sopenharmony_ci .name = "davinci_emac", 918c2ecf20Sopenharmony_ci .id = 1, 928c2ecf20Sopenharmony_ci .dev = { 938c2ecf20Sopenharmony_ci .platform_data = &dm646x_emac_pdata, 948c2ecf20Sopenharmony_ci }, 958c2ecf20Sopenharmony_ci .num_resources = ARRAY_SIZE(dm646x_emac_resources), 968c2ecf20Sopenharmony_ci .resource = dm646x_emac_resources, 978c2ecf20Sopenharmony_ci}; 988c2ecf20Sopenharmony_ci 998c2ecf20Sopenharmony_cistatic struct resource dm646x_mdio_resources[] = { 1008c2ecf20Sopenharmony_ci { 1018c2ecf20Sopenharmony_ci .start = DM646X_EMAC_MDIO_BASE, 1028c2ecf20Sopenharmony_ci .end = DM646X_EMAC_MDIO_BASE + SZ_4K - 1, 1038c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 1048c2ecf20Sopenharmony_ci }, 1058c2ecf20Sopenharmony_ci}; 1068c2ecf20Sopenharmony_ci 1078c2ecf20Sopenharmony_cistatic struct platform_device dm646x_mdio_device = { 1088c2ecf20Sopenharmony_ci .name = "davinci_mdio", 1098c2ecf20Sopenharmony_ci .id = 0, 1108c2ecf20Sopenharmony_ci .num_resources = ARRAY_SIZE(dm646x_mdio_resources), 1118c2ecf20Sopenharmony_ci .resource = dm646x_mdio_resources, 1128c2ecf20Sopenharmony_ci}; 1138c2ecf20Sopenharmony_ci 1148c2ecf20Sopenharmony_ci/* 1158c2ecf20Sopenharmony_ci * Device specific mux setup 1168c2ecf20Sopenharmony_ci * 1178c2ecf20Sopenharmony_ci * soc description mux mode mode mux dbg 1188c2ecf20Sopenharmony_ci * reg offset mask mode 1198c2ecf20Sopenharmony_ci */ 1208c2ecf20Sopenharmony_cistatic const struct mux_config dm646x_pins[] = { 1218c2ecf20Sopenharmony_ci#ifdef CONFIG_DAVINCI_MUX 1228c2ecf20Sopenharmony_ciMUX_CFG(DM646X, ATAEN, 0, 0, 5, 1, true) 1238c2ecf20Sopenharmony_ci 1248c2ecf20Sopenharmony_ciMUX_CFG(DM646X, AUDCK1, 0, 29, 1, 0, false) 1258c2ecf20Sopenharmony_ci 1268c2ecf20Sopenharmony_ciMUX_CFG(DM646X, AUDCK0, 0, 28, 1, 0, false) 1278c2ecf20Sopenharmony_ci 1288c2ecf20Sopenharmony_ciMUX_CFG(DM646X, CRGMUX, 0, 24, 7, 5, true) 1298c2ecf20Sopenharmony_ci 1308c2ecf20Sopenharmony_ciMUX_CFG(DM646X, STSOMUX_DISABLE, 0, 22, 3, 0, true) 1318c2ecf20Sopenharmony_ci 1328c2ecf20Sopenharmony_ciMUX_CFG(DM646X, STSIMUX_DISABLE, 0, 20, 3, 0, true) 1338c2ecf20Sopenharmony_ci 1348c2ecf20Sopenharmony_ciMUX_CFG(DM646X, PTSOMUX_DISABLE, 0, 18, 3, 0, true) 1358c2ecf20Sopenharmony_ci 1368c2ecf20Sopenharmony_ciMUX_CFG(DM646X, PTSIMUX_DISABLE, 0, 16, 3, 0, true) 1378c2ecf20Sopenharmony_ci 1388c2ecf20Sopenharmony_ciMUX_CFG(DM646X, STSOMUX, 0, 22, 3, 2, true) 1398c2ecf20Sopenharmony_ci 1408c2ecf20Sopenharmony_ciMUX_CFG(DM646X, STSIMUX, 0, 20, 3, 2, true) 1418c2ecf20Sopenharmony_ci 1428c2ecf20Sopenharmony_ciMUX_CFG(DM646X, PTSOMUX_PARALLEL, 0, 18, 3, 2, true) 1438c2ecf20Sopenharmony_ci 1448c2ecf20Sopenharmony_ciMUX_CFG(DM646X, PTSIMUX_PARALLEL, 0, 16, 3, 2, true) 1458c2ecf20Sopenharmony_ci 1468c2ecf20Sopenharmony_ciMUX_CFG(DM646X, PTSOMUX_SERIAL, 0, 18, 3, 3, true) 1478c2ecf20Sopenharmony_ci 1488c2ecf20Sopenharmony_ciMUX_CFG(DM646X, PTSIMUX_SERIAL, 0, 16, 3, 3, true) 1498c2ecf20Sopenharmony_ci#endif 1508c2ecf20Sopenharmony_ci}; 1518c2ecf20Sopenharmony_ci 1528c2ecf20Sopenharmony_cistatic u8 dm646x_default_priorities[DAVINCI_N_AINTC_IRQ] = { 1538c2ecf20Sopenharmony_ci [IRQ_DM646X_VP_VERTINT0] = 7, 1548c2ecf20Sopenharmony_ci [IRQ_DM646X_VP_VERTINT1] = 7, 1558c2ecf20Sopenharmony_ci [IRQ_DM646X_VP_VERTINT2] = 7, 1568c2ecf20Sopenharmony_ci [IRQ_DM646X_VP_VERTINT3] = 7, 1578c2ecf20Sopenharmony_ci [IRQ_DM646X_VP_ERRINT] = 7, 1588c2ecf20Sopenharmony_ci [IRQ_DM646X_RESERVED_1] = 7, 1598c2ecf20Sopenharmony_ci [IRQ_DM646X_RESERVED_2] = 7, 1608c2ecf20Sopenharmony_ci [IRQ_DM646X_WDINT] = 7, 1618c2ecf20Sopenharmony_ci [IRQ_DM646X_CRGENINT0] = 7, 1628c2ecf20Sopenharmony_ci [IRQ_DM646X_CRGENINT1] = 7, 1638c2ecf20Sopenharmony_ci [IRQ_DM646X_TSIFINT0] = 7, 1648c2ecf20Sopenharmony_ci [IRQ_DM646X_TSIFINT1] = 7, 1658c2ecf20Sopenharmony_ci [IRQ_DM646X_VDCEINT] = 7, 1668c2ecf20Sopenharmony_ci [IRQ_DM646X_USBINT] = 7, 1678c2ecf20Sopenharmony_ci [IRQ_DM646X_USBDMAINT] = 7, 1688c2ecf20Sopenharmony_ci [IRQ_DM646X_PCIINT] = 7, 1698c2ecf20Sopenharmony_ci [IRQ_CCINT0] = 7, /* dma */ 1708c2ecf20Sopenharmony_ci [IRQ_CCERRINT] = 7, /* dma */ 1718c2ecf20Sopenharmony_ci [IRQ_TCERRINT0] = 7, /* dma */ 1728c2ecf20Sopenharmony_ci [IRQ_TCERRINT] = 7, /* dma */ 1738c2ecf20Sopenharmony_ci [IRQ_DM646X_TCERRINT2] = 7, 1748c2ecf20Sopenharmony_ci [IRQ_DM646X_TCERRINT3] = 7, 1758c2ecf20Sopenharmony_ci [IRQ_DM646X_IDE] = 7, 1768c2ecf20Sopenharmony_ci [IRQ_DM646X_HPIINT] = 7, 1778c2ecf20Sopenharmony_ci [IRQ_DM646X_EMACRXTHINT] = 7, 1788c2ecf20Sopenharmony_ci [IRQ_DM646X_EMACRXINT] = 7, 1798c2ecf20Sopenharmony_ci [IRQ_DM646X_EMACTXINT] = 7, 1808c2ecf20Sopenharmony_ci [IRQ_DM646X_EMACMISCINT] = 7, 1818c2ecf20Sopenharmony_ci [IRQ_DM646X_MCASP0TXINT] = 7, 1828c2ecf20Sopenharmony_ci [IRQ_DM646X_MCASP0RXINT] = 7, 1838c2ecf20Sopenharmony_ci [IRQ_DM646X_RESERVED_3] = 7, 1848c2ecf20Sopenharmony_ci [IRQ_DM646X_MCASP1TXINT] = 7, 1858c2ecf20Sopenharmony_ci [IRQ_TINT0_TINT12] = 7, /* clockevent */ 1868c2ecf20Sopenharmony_ci [IRQ_TINT0_TINT34] = 7, /* clocksource */ 1878c2ecf20Sopenharmony_ci [IRQ_TINT1_TINT12] = 7, /* DSP timer */ 1888c2ecf20Sopenharmony_ci [IRQ_TINT1_TINT34] = 7, /* system tick */ 1898c2ecf20Sopenharmony_ci [IRQ_PWMINT0] = 7, 1908c2ecf20Sopenharmony_ci [IRQ_PWMINT1] = 7, 1918c2ecf20Sopenharmony_ci [IRQ_DM646X_VLQINT] = 7, 1928c2ecf20Sopenharmony_ci [IRQ_I2C] = 7, 1938c2ecf20Sopenharmony_ci [IRQ_UARTINT0] = 7, 1948c2ecf20Sopenharmony_ci [IRQ_UARTINT1] = 7, 1958c2ecf20Sopenharmony_ci [IRQ_DM646X_UARTINT2] = 7, 1968c2ecf20Sopenharmony_ci [IRQ_DM646X_SPINT0] = 7, 1978c2ecf20Sopenharmony_ci [IRQ_DM646X_SPINT1] = 7, 1988c2ecf20Sopenharmony_ci [IRQ_DM646X_DSP2ARMINT] = 7, 1998c2ecf20Sopenharmony_ci [IRQ_DM646X_RESERVED_4] = 7, 2008c2ecf20Sopenharmony_ci [IRQ_DM646X_PSCINT] = 7, 2018c2ecf20Sopenharmony_ci [IRQ_DM646X_GPIO0] = 7, 2028c2ecf20Sopenharmony_ci [IRQ_DM646X_GPIO1] = 7, 2038c2ecf20Sopenharmony_ci [IRQ_DM646X_GPIO2] = 7, 2048c2ecf20Sopenharmony_ci [IRQ_DM646X_GPIO3] = 7, 2058c2ecf20Sopenharmony_ci [IRQ_DM646X_GPIO4] = 7, 2068c2ecf20Sopenharmony_ci [IRQ_DM646X_GPIO5] = 7, 2078c2ecf20Sopenharmony_ci [IRQ_DM646X_GPIO6] = 7, 2088c2ecf20Sopenharmony_ci [IRQ_DM646X_GPIO7] = 7, 2098c2ecf20Sopenharmony_ci [IRQ_DM646X_GPIOBNK0] = 7, 2108c2ecf20Sopenharmony_ci [IRQ_DM646X_GPIOBNK1] = 7, 2118c2ecf20Sopenharmony_ci [IRQ_DM646X_GPIOBNK2] = 7, 2128c2ecf20Sopenharmony_ci [IRQ_DM646X_DDRINT] = 7, 2138c2ecf20Sopenharmony_ci [IRQ_DM646X_AEMIFINT] = 7, 2148c2ecf20Sopenharmony_ci [IRQ_COMMTX] = 7, 2158c2ecf20Sopenharmony_ci [IRQ_COMMRX] = 7, 2168c2ecf20Sopenharmony_ci [IRQ_EMUINT] = 7, 2178c2ecf20Sopenharmony_ci}; 2188c2ecf20Sopenharmony_ci 2198c2ecf20Sopenharmony_ci/*----------------------------------------------------------------------*/ 2208c2ecf20Sopenharmony_ci 2218c2ecf20Sopenharmony_ci/* Four Transfer Controllers on DM646x */ 2228c2ecf20Sopenharmony_cistatic s8 dm646x_queue_priority_mapping[][2] = { 2238c2ecf20Sopenharmony_ci /* {event queue no, Priority} */ 2248c2ecf20Sopenharmony_ci {0, 4}, 2258c2ecf20Sopenharmony_ci {1, 0}, 2268c2ecf20Sopenharmony_ci {2, 5}, 2278c2ecf20Sopenharmony_ci {3, 1}, 2288c2ecf20Sopenharmony_ci {-1, -1}, 2298c2ecf20Sopenharmony_ci}; 2308c2ecf20Sopenharmony_ci 2318c2ecf20Sopenharmony_cistatic const struct dma_slave_map dm646x_edma_map[] = { 2328c2ecf20Sopenharmony_ci { "davinci-mcasp.0", "tx", EDMA_FILTER_PARAM(0, 6) }, 2338c2ecf20Sopenharmony_ci { "davinci-mcasp.0", "rx", EDMA_FILTER_PARAM(0, 9) }, 2348c2ecf20Sopenharmony_ci { "davinci-mcasp.1", "tx", EDMA_FILTER_PARAM(0, 12) }, 2358c2ecf20Sopenharmony_ci { "spi_davinci", "tx", EDMA_FILTER_PARAM(0, 16) }, 2368c2ecf20Sopenharmony_ci { "spi_davinci", "rx", EDMA_FILTER_PARAM(0, 17) }, 2378c2ecf20Sopenharmony_ci}; 2388c2ecf20Sopenharmony_ci 2398c2ecf20Sopenharmony_cistatic struct edma_soc_info dm646x_edma_pdata = { 2408c2ecf20Sopenharmony_ci .queue_priority_mapping = dm646x_queue_priority_mapping, 2418c2ecf20Sopenharmony_ci .default_queue = EVENTQ_1, 2428c2ecf20Sopenharmony_ci .slave_map = dm646x_edma_map, 2438c2ecf20Sopenharmony_ci .slavecnt = ARRAY_SIZE(dm646x_edma_map), 2448c2ecf20Sopenharmony_ci}; 2458c2ecf20Sopenharmony_ci 2468c2ecf20Sopenharmony_cistatic struct resource edma_resources[] = { 2478c2ecf20Sopenharmony_ci { 2488c2ecf20Sopenharmony_ci .name = "edma3_cc", 2498c2ecf20Sopenharmony_ci .start = 0x01c00000, 2508c2ecf20Sopenharmony_ci .end = 0x01c00000 + SZ_64K - 1, 2518c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 2528c2ecf20Sopenharmony_ci }, 2538c2ecf20Sopenharmony_ci { 2548c2ecf20Sopenharmony_ci .name = "edma3_tc0", 2558c2ecf20Sopenharmony_ci .start = 0x01c10000, 2568c2ecf20Sopenharmony_ci .end = 0x01c10000 + SZ_1K - 1, 2578c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 2588c2ecf20Sopenharmony_ci }, 2598c2ecf20Sopenharmony_ci { 2608c2ecf20Sopenharmony_ci .name = "edma3_tc1", 2618c2ecf20Sopenharmony_ci .start = 0x01c10400, 2628c2ecf20Sopenharmony_ci .end = 0x01c10400 + SZ_1K - 1, 2638c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 2648c2ecf20Sopenharmony_ci }, 2658c2ecf20Sopenharmony_ci { 2668c2ecf20Sopenharmony_ci .name = "edma3_tc2", 2678c2ecf20Sopenharmony_ci .start = 0x01c10800, 2688c2ecf20Sopenharmony_ci .end = 0x01c10800 + SZ_1K - 1, 2698c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 2708c2ecf20Sopenharmony_ci }, 2718c2ecf20Sopenharmony_ci { 2728c2ecf20Sopenharmony_ci .name = "edma3_tc3", 2738c2ecf20Sopenharmony_ci .start = 0x01c10c00, 2748c2ecf20Sopenharmony_ci .end = 0x01c10c00 + SZ_1K - 1, 2758c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 2768c2ecf20Sopenharmony_ci }, 2778c2ecf20Sopenharmony_ci { 2788c2ecf20Sopenharmony_ci .name = "edma3_ccint", 2798c2ecf20Sopenharmony_ci .start = DAVINCI_INTC_IRQ(IRQ_CCINT0), 2808c2ecf20Sopenharmony_ci .flags = IORESOURCE_IRQ, 2818c2ecf20Sopenharmony_ci }, 2828c2ecf20Sopenharmony_ci { 2838c2ecf20Sopenharmony_ci .name = "edma3_ccerrint", 2848c2ecf20Sopenharmony_ci .start = DAVINCI_INTC_IRQ(IRQ_CCERRINT), 2858c2ecf20Sopenharmony_ci .flags = IORESOURCE_IRQ, 2868c2ecf20Sopenharmony_ci }, 2878c2ecf20Sopenharmony_ci /* not using TC*_ERR */ 2888c2ecf20Sopenharmony_ci}; 2898c2ecf20Sopenharmony_ci 2908c2ecf20Sopenharmony_cistatic const struct platform_device_info dm646x_edma_device __initconst = { 2918c2ecf20Sopenharmony_ci .name = "edma", 2928c2ecf20Sopenharmony_ci .id = 0, 2938c2ecf20Sopenharmony_ci .dma_mask = DMA_BIT_MASK(32), 2948c2ecf20Sopenharmony_ci .res = edma_resources, 2958c2ecf20Sopenharmony_ci .num_res = ARRAY_SIZE(edma_resources), 2968c2ecf20Sopenharmony_ci .data = &dm646x_edma_pdata, 2978c2ecf20Sopenharmony_ci .size_data = sizeof(dm646x_edma_pdata), 2988c2ecf20Sopenharmony_ci}; 2998c2ecf20Sopenharmony_ci 3008c2ecf20Sopenharmony_cistatic struct resource dm646x_mcasp0_resources[] = { 3018c2ecf20Sopenharmony_ci { 3028c2ecf20Sopenharmony_ci .name = "mpu", 3038c2ecf20Sopenharmony_ci .start = DAVINCI_DM646X_MCASP0_REG_BASE, 3048c2ecf20Sopenharmony_ci .end = DAVINCI_DM646X_MCASP0_REG_BASE + (SZ_1K << 1) - 1, 3058c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 3068c2ecf20Sopenharmony_ci }, 3078c2ecf20Sopenharmony_ci { 3088c2ecf20Sopenharmony_ci .name = "tx", 3098c2ecf20Sopenharmony_ci .start = DAVINCI_DM646X_DMA_MCASP0_AXEVT0, 3108c2ecf20Sopenharmony_ci .end = DAVINCI_DM646X_DMA_MCASP0_AXEVT0, 3118c2ecf20Sopenharmony_ci .flags = IORESOURCE_DMA, 3128c2ecf20Sopenharmony_ci }, 3138c2ecf20Sopenharmony_ci { 3148c2ecf20Sopenharmony_ci .name = "rx", 3158c2ecf20Sopenharmony_ci .start = DAVINCI_DM646X_DMA_MCASP0_AREVT0, 3168c2ecf20Sopenharmony_ci .end = DAVINCI_DM646X_DMA_MCASP0_AREVT0, 3178c2ecf20Sopenharmony_ci .flags = IORESOURCE_DMA, 3188c2ecf20Sopenharmony_ci }, 3198c2ecf20Sopenharmony_ci { 3208c2ecf20Sopenharmony_ci .name = "tx", 3218c2ecf20Sopenharmony_ci .start = DAVINCI_INTC_IRQ(IRQ_DM646X_MCASP0TXINT), 3228c2ecf20Sopenharmony_ci .flags = IORESOURCE_IRQ, 3238c2ecf20Sopenharmony_ci }, 3248c2ecf20Sopenharmony_ci { 3258c2ecf20Sopenharmony_ci .name = "rx", 3268c2ecf20Sopenharmony_ci .start = DAVINCI_INTC_IRQ(IRQ_DM646X_MCASP0RXINT), 3278c2ecf20Sopenharmony_ci .flags = IORESOURCE_IRQ, 3288c2ecf20Sopenharmony_ci }, 3298c2ecf20Sopenharmony_ci}; 3308c2ecf20Sopenharmony_ci 3318c2ecf20Sopenharmony_ci/* DIT mode only, rx is not supported */ 3328c2ecf20Sopenharmony_cistatic struct resource dm646x_mcasp1_resources[] = { 3338c2ecf20Sopenharmony_ci { 3348c2ecf20Sopenharmony_ci .name = "mpu", 3358c2ecf20Sopenharmony_ci .start = DAVINCI_DM646X_MCASP1_REG_BASE, 3368c2ecf20Sopenharmony_ci .end = DAVINCI_DM646X_MCASP1_REG_BASE + (SZ_1K << 1) - 1, 3378c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 3388c2ecf20Sopenharmony_ci }, 3398c2ecf20Sopenharmony_ci { 3408c2ecf20Sopenharmony_ci .name = "tx", 3418c2ecf20Sopenharmony_ci .start = DAVINCI_DM646X_DMA_MCASP1_AXEVT1, 3428c2ecf20Sopenharmony_ci .end = DAVINCI_DM646X_DMA_MCASP1_AXEVT1, 3438c2ecf20Sopenharmony_ci .flags = IORESOURCE_DMA, 3448c2ecf20Sopenharmony_ci }, 3458c2ecf20Sopenharmony_ci { 3468c2ecf20Sopenharmony_ci .name = "tx", 3478c2ecf20Sopenharmony_ci .start = DAVINCI_INTC_IRQ(IRQ_DM646X_MCASP1TXINT), 3488c2ecf20Sopenharmony_ci .flags = IORESOURCE_IRQ, 3498c2ecf20Sopenharmony_ci }, 3508c2ecf20Sopenharmony_ci}; 3518c2ecf20Sopenharmony_ci 3528c2ecf20Sopenharmony_cistatic struct platform_device dm646x_mcasp0_device = { 3538c2ecf20Sopenharmony_ci .name = "davinci-mcasp", 3548c2ecf20Sopenharmony_ci .id = 0, 3558c2ecf20Sopenharmony_ci .num_resources = ARRAY_SIZE(dm646x_mcasp0_resources), 3568c2ecf20Sopenharmony_ci .resource = dm646x_mcasp0_resources, 3578c2ecf20Sopenharmony_ci}; 3588c2ecf20Sopenharmony_ci 3598c2ecf20Sopenharmony_cistatic struct platform_device dm646x_mcasp1_device = { 3608c2ecf20Sopenharmony_ci .name = "davinci-mcasp", 3618c2ecf20Sopenharmony_ci .id = 1, 3628c2ecf20Sopenharmony_ci .num_resources = ARRAY_SIZE(dm646x_mcasp1_resources), 3638c2ecf20Sopenharmony_ci .resource = dm646x_mcasp1_resources, 3648c2ecf20Sopenharmony_ci}; 3658c2ecf20Sopenharmony_ci 3668c2ecf20Sopenharmony_cistatic struct platform_device dm646x_dit_device = { 3678c2ecf20Sopenharmony_ci .name = "spdif-dit", 3688c2ecf20Sopenharmony_ci .id = -1, 3698c2ecf20Sopenharmony_ci}; 3708c2ecf20Sopenharmony_ci 3718c2ecf20Sopenharmony_cistatic u64 vpif_dma_mask = DMA_BIT_MASK(32); 3728c2ecf20Sopenharmony_ci 3738c2ecf20Sopenharmony_cistatic struct resource vpif_resource[] = { 3748c2ecf20Sopenharmony_ci { 3758c2ecf20Sopenharmony_ci .start = DAVINCI_VPIF_BASE, 3768c2ecf20Sopenharmony_ci .end = DAVINCI_VPIF_BASE + 0x03ff, 3778c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 3788c2ecf20Sopenharmony_ci } 3798c2ecf20Sopenharmony_ci}; 3808c2ecf20Sopenharmony_ci 3818c2ecf20Sopenharmony_cistatic struct platform_device vpif_dev = { 3828c2ecf20Sopenharmony_ci .name = "vpif", 3838c2ecf20Sopenharmony_ci .id = -1, 3848c2ecf20Sopenharmony_ci .dev = { 3858c2ecf20Sopenharmony_ci .dma_mask = &vpif_dma_mask, 3868c2ecf20Sopenharmony_ci .coherent_dma_mask = DMA_BIT_MASK(32), 3878c2ecf20Sopenharmony_ci }, 3888c2ecf20Sopenharmony_ci .resource = vpif_resource, 3898c2ecf20Sopenharmony_ci .num_resources = ARRAY_SIZE(vpif_resource), 3908c2ecf20Sopenharmony_ci}; 3918c2ecf20Sopenharmony_ci 3928c2ecf20Sopenharmony_cistatic struct resource vpif_display_resource[] = { 3938c2ecf20Sopenharmony_ci { 3948c2ecf20Sopenharmony_ci .start = DAVINCI_INTC_IRQ(IRQ_DM646X_VP_VERTINT2), 3958c2ecf20Sopenharmony_ci .end = DAVINCI_INTC_IRQ(IRQ_DM646X_VP_VERTINT2), 3968c2ecf20Sopenharmony_ci .flags = IORESOURCE_IRQ, 3978c2ecf20Sopenharmony_ci }, 3988c2ecf20Sopenharmony_ci { 3998c2ecf20Sopenharmony_ci .start = DAVINCI_INTC_IRQ(IRQ_DM646X_VP_VERTINT3), 4008c2ecf20Sopenharmony_ci .end = DAVINCI_INTC_IRQ(IRQ_DM646X_VP_VERTINT3), 4018c2ecf20Sopenharmony_ci .flags = IORESOURCE_IRQ, 4028c2ecf20Sopenharmony_ci }, 4038c2ecf20Sopenharmony_ci}; 4048c2ecf20Sopenharmony_ci 4058c2ecf20Sopenharmony_cistatic struct platform_device vpif_display_dev = { 4068c2ecf20Sopenharmony_ci .name = "vpif_display", 4078c2ecf20Sopenharmony_ci .id = -1, 4088c2ecf20Sopenharmony_ci .dev = { 4098c2ecf20Sopenharmony_ci .dma_mask = &vpif_dma_mask, 4108c2ecf20Sopenharmony_ci .coherent_dma_mask = DMA_BIT_MASK(32), 4118c2ecf20Sopenharmony_ci }, 4128c2ecf20Sopenharmony_ci .resource = vpif_display_resource, 4138c2ecf20Sopenharmony_ci .num_resources = ARRAY_SIZE(vpif_display_resource), 4148c2ecf20Sopenharmony_ci}; 4158c2ecf20Sopenharmony_ci 4168c2ecf20Sopenharmony_cistatic struct resource vpif_capture_resource[] = { 4178c2ecf20Sopenharmony_ci { 4188c2ecf20Sopenharmony_ci .start = DAVINCI_INTC_IRQ(IRQ_DM646X_VP_VERTINT0), 4198c2ecf20Sopenharmony_ci .end = DAVINCI_INTC_IRQ(IRQ_DM646X_VP_VERTINT0), 4208c2ecf20Sopenharmony_ci .flags = IORESOURCE_IRQ, 4218c2ecf20Sopenharmony_ci }, 4228c2ecf20Sopenharmony_ci { 4238c2ecf20Sopenharmony_ci .start = DAVINCI_INTC_IRQ(IRQ_DM646X_VP_VERTINT1), 4248c2ecf20Sopenharmony_ci .end = DAVINCI_INTC_IRQ(IRQ_DM646X_VP_VERTINT1), 4258c2ecf20Sopenharmony_ci .flags = IORESOURCE_IRQ, 4268c2ecf20Sopenharmony_ci }, 4278c2ecf20Sopenharmony_ci}; 4288c2ecf20Sopenharmony_ci 4298c2ecf20Sopenharmony_cistatic struct platform_device vpif_capture_dev = { 4308c2ecf20Sopenharmony_ci .name = "vpif_capture", 4318c2ecf20Sopenharmony_ci .id = -1, 4328c2ecf20Sopenharmony_ci .dev = { 4338c2ecf20Sopenharmony_ci .dma_mask = &vpif_dma_mask, 4348c2ecf20Sopenharmony_ci .coherent_dma_mask = DMA_BIT_MASK(32), 4358c2ecf20Sopenharmony_ci }, 4368c2ecf20Sopenharmony_ci .resource = vpif_capture_resource, 4378c2ecf20Sopenharmony_ci .num_resources = ARRAY_SIZE(vpif_capture_resource), 4388c2ecf20Sopenharmony_ci}; 4398c2ecf20Sopenharmony_ci 4408c2ecf20Sopenharmony_cistatic struct resource dm646x_gpio_resources[] = { 4418c2ecf20Sopenharmony_ci { /* registers */ 4428c2ecf20Sopenharmony_ci .start = DAVINCI_GPIO_BASE, 4438c2ecf20Sopenharmony_ci .end = DAVINCI_GPIO_BASE + SZ_4K - 1, 4448c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 4458c2ecf20Sopenharmony_ci }, 4468c2ecf20Sopenharmony_ci { /* interrupt */ 4478c2ecf20Sopenharmony_ci .start = DAVINCI_INTC_IRQ(IRQ_DM646X_GPIOBNK0), 4488c2ecf20Sopenharmony_ci .end = DAVINCI_INTC_IRQ(IRQ_DM646X_GPIOBNK0), 4498c2ecf20Sopenharmony_ci .flags = IORESOURCE_IRQ, 4508c2ecf20Sopenharmony_ci }, 4518c2ecf20Sopenharmony_ci { 4528c2ecf20Sopenharmony_ci .start = DAVINCI_INTC_IRQ(IRQ_DM646X_GPIOBNK1), 4538c2ecf20Sopenharmony_ci .end = DAVINCI_INTC_IRQ(IRQ_DM646X_GPIOBNK1), 4548c2ecf20Sopenharmony_ci .flags = IORESOURCE_IRQ, 4558c2ecf20Sopenharmony_ci }, 4568c2ecf20Sopenharmony_ci { 4578c2ecf20Sopenharmony_ci .start = DAVINCI_INTC_IRQ(IRQ_DM646X_GPIOBNK2), 4588c2ecf20Sopenharmony_ci .end = DAVINCI_INTC_IRQ(IRQ_DM646X_GPIOBNK2), 4598c2ecf20Sopenharmony_ci .flags = IORESOURCE_IRQ, 4608c2ecf20Sopenharmony_ci }, 4618c2ecf20Sopenharmony_ci}; 4628c2ecf20Sopenharmony_ci 4638c2ecf20Sopenharmony_cistatic struct davinci_gpio_platform_data dm646x_gpio_platform_data = { 4648c2ecf20Sopenharmony_ci .no_auto_base = true, 4658c2ecf20Sopenharmony_ci .base = 0, 4668c2ecf20Sopenharmony_ci .ngpio = 43, 4678c2ecf20Sopenharmony_ci}; 4688c2ecf20Sopenharmony_ci 4698c2ecf20Sopenharmony_ciint __init dm646x_gpio_register(void) 4708c2ecf20Sopenharmony_ci{ 4718c2ecf20Sopenharmony_ci return davinci_gpio_register(dm646x_gpio_resources, 4728c2ecf20Sopenharmony_ci ARRAY_SIZE(dm646x_gpio_resources), 4738c2ecf20Sopenharmony_ci &dm646x_gpio_platform_data); 4748c2ecf20Sopenharmony_ci} 4758c2ecf20Sopenharmony_ci/*----------------------------------------------------------------------*/ 4768c2ecf20Sopenharmony_ci 4778c2ecf20Sopenharmony_cistatic struct map_desc dm646x_io_desc[] = { 4788c2ecf20Sopenharmony_ci { 4798c2ecf20Sopenharmony_ci .virtual = IO_VIRT, 4808c2ecf20Sopenharmony_ci .pfn = __phys_to_pfn(IO_PHYS), 4818c2ecf20Sopenharmony_ci .length = IO_SIZE, 4828c2ecf20Sopenharmony_ci .type = MT_DEVICE 4838c2ecf20Sopenharmony_ci }, 4848c2ecf20Sopenharmony_ci}; 4858c2ecf20Sopenharmony_ci 4868c2ecf20Sopenharmony_ci/* Contents of JTAG ID register used to identify exact cpu type */ 4878c2ecf20Sopenharmony_cistatic struct davinci_id dm646x_ids[] = { 4888c2ecf20Sopenharmony_ci { 4898c2ecf20Sopenharmony_ci .variant = 0x0, 4908c2ecf20Sopenharmony_ci .part_no = 0xb770, 4918c2ecf20Sopenharmony_ci .manufacturer = 0x017, 4928c2ecf20Sopenharmony_ci .cpu_id = DAVINCI_CPU_ID_DM6467, 4938c2ecf20Sopenharmony_ci .name = "dm6467_rev1.x", 4948c2ecf20Sopenharmony_ci }, 4958c2ecf20Sopenharmony_ci { 4968c2ecf20Sopenharmony_ci .variant = 0x1, 4978c2ecf20Sopenharmony_ci .part_no = 0xb770, 4988c2ecf20Sopenharmony_ci .manufacturer = 0x017, 4998c2ecf20Sopenharmony_ci .cpu_id = DAVINCI_CPU_ID_DM6467, 5008c2ecf20Sopenharmony_ci .name = "dm6467_rev3.x", 5018c2ecf20Sopenharmony_ci }, 5028c2ecf20Sopenharmony_ci}; 5038c2ecf20Sopenharmony_ci 5048c2ecf20Sopenharmony_ci/* 5058c2ecf20Sopenharmony_ci * Bottom half of timer0 is used for clockevent, top half is used for 5068c2ecf20Sopenharmony_ci * clocksource. 5078c2ecf20Sopenharmony_ci */ 5088c2ecf20Sopenharmony_cistatic const struct davinci_timer_cfg dm646x_timer_cfg = { 5098c2ecf20Sopenharmony_ci .reg = DEFINE_RES_IO(DAVINCI_TIMER0_BASE, SZ_4K), 5108c2ecf20Sopenharmony_ci .irq = { 5118c2ecf20Sopenharmony_ci DEFINE_RES_IRQ(DAVINCI_INTC_IRQ(IRQ_TINT0_TINT12)), 5128c2ecf20Sopenharmony_ci DEFINE_RES_IRQ(DAVINCI_INTC_IRQ(IRQ_TINT0_TINT34)), 5138c2ecf20Sopenharmony_ci }, 5148c2ecf20Sopenharmony_ci}; 5158c2ecf20Sopenharmony_ci 5168c2ecf20Sopenharmony_cistatic struct plat_serial8250_port dm646x_serial0_platform_data[] = { 5178c2ecf20Sopenharmony_ci { 5188c2ecf20Sopenharmony_ci .mapbase = DAVINCI_UART0_BASE, 5198c2ecf20Sopenharmony_ci .irq = DAVINCI_INTC_IRQ(IRQ_UARTINT0), 5208c2ecf20Sopenharmony_ci .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | 5218c2ecf20Sopenharmony_ci UPF_IOREMAP, 5228c2ecf20Sopenharmony_ci .iotype = UPIO_MEM32, 5238c2ecf20Sopenharmony_ci .regshift = 2, 5248c2ecf20Sopenharmony_ci }, 5258c2ecf20Sopenharmony_ci { 5268c2ecf20Sopenharmony_ci .flags = 0, 5278c2ecf20Sopenharmony_ci } 5288c2ecf20Sopenharmony_ci}; 5298c2ecf20Sopenharmony_cistatic struct plat_serial8250_port dm646x_serial1_platform_data[] = { 5308c2ecf20Sopenharmony_ci { 5318c2ecf20Sopenharmony_ci .mapbase = DAVINCI_UART1_BASE, 5328c2ecf20Sopenharmony_ci .irq = DAVINCI_INTC_IRQ(IRQ_UARTINT1), 5338c2ecf20Sopenharmony_ci .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | 5348c2ecf20Sopenharmony_ci UPF_IOREMAP, 5358c2ecf20Sopenharmony_ci .iotype = UPIO_MEM32, 5368c2ecf20Sopenharmony_ci .regshift = 2, 5378c2ecf20Sopenharmony_ci }, 5388c2ecf20Sopenharmony_ci { 5398c2ecf20Sopenharmony_ci .flags = 0, 5408c2ecf20Sopenharmony_ci } 5418c2ecf20Sopenharmony_ci}; 5428c2ecf20Sopenharmony_cistatic struct plat_serial8250_port dm646x_serial2_platform_data[] = { 5438c2ecf20Sopenharmony_ci { 5448c2ecf20Sopenharmony_ci .mapbase = DAVINCI_UART2_BASE, 5458c2ecf20Sopenharmony_ci .irq = DAVINCI_INTC_IRQ(IRQ_DM646X_UARTINT2), 5468c2ecf20Sopenharmony_ci .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | 5478c2ecf20Sopenharmony_ci UPF_IOREMAP, 5488c2ecf20Sopenharmony_ci .iotype = UPIO_MEM32, 5498c2ecf20Sopenharmony_ci .regshift = 2, 5508c2ecf20Sopenharmony_ci }, 5518c2ecf20Sopenharmony_ci { 5528c2ecf20Sopenharmony_ci .flags = 0, 5538c2ecf20Sopenharmony_ci } 5548c2ecf20Sopenharmony_ci}; 5558c2ecf20Sopenharmony_ci 5568c2ecf20Sopenharmony_cistruct platform_device dm646x_serial_device[] = { 5578c2ecf20Sopenharmony_ci { 5588c2ecf20Sopenharmony_ci .name = "serial8250", 5598c2ecf20Sopenharmony_ci .id = PLAT8250_DEV_PLATFORM, 5608c2ecf20Sopenharmony_ci .dev = { 5618c2ecf20Sopenharmony_ci .platform_data = dm646x_serial0_platform_data, 5628c2ecf20Sopenharmony_ci } 5638c2ecf20Sopenharmony_ci }, 5648c2ecf20Sopenharmony_ci { 5658c2ecf20Sopenharmony_ci .name = "serial8250", 5668c2ecf20Sopenharmony_ci .id = PLAT8250_DEV_PLATFORM1, 5678c2ecf20Sopenharmony_ci .dev = { 5688c2ecf20Sopenharmony_ci .platform_data = dm646x_serial1_platform_data, 5698c2ecf20Sopenharmony_ci } 5708c2ecf20Sopenharmony_ci }, 5718c2ecf20Sopenharmony_ci { 5728c2ecf20Sopenharmony_ci .name = "serial8250", 5738c2ecf20Sopenharmony_ci .id = PLAT8250_DEV_PLATFORM2, 5748c2ecf20Sopenharmony_ci .dev = { 5758c2ecf20Sopenharmony_ci .platform_data = dm646x_serial2_platform_data, 5768c2ecf20Sopenharmony_ci } 5778c2ecf20Sopenharmony_ci }, 5788c2ecf20Sopenharmony_ci { 5798c2ecf20Sopenharmony_ci } 5808c2ecf20Sopenharmony_ci}; 5818c2ecf20Sopenharmony_ci 5828c2ecf20Sopenharmony_cistatic const struct davinci_soc_info davinci_soc_info_dm646x = { 5838c2ecf20Sopenharmony_ci .io_desc = dm646x_io_desc, 5848c2ecf20Sopenharmony_ci .io_desc_num = ARRAY_SIZE(dm646x_io_desc), 5858c2ecf20Sopenharmony_ci .jtag_id_reg = 0x01c40028, 5868c2ecf20Sopenharmony_ci .ids = dm646x_ids, 5878c2ecf20Sopenharmony_ci .ids_num = ARRAY_SIZE(dm646x_ids), 5888c2ecf20Sopenharmony_ci .pinmux_base = DAVINCI_SYSTEM_MODULE_BASE, 5898c2ecf20Sopenharmony_ci .pinmux_pins = dm646x_pins, 5908c2ecf20Sopenharmony_ci .pinmux_pins_num = ARRAY_SIZE(dm646x_pins), 5918c2ecf20Sopenharmony_ci .emac_pdata = &dm646x_emac_pdata, 5928c2ecf20Sopenharmony_ci .sram_dma = 0x10010000, 5938c2ecf20Sopenharmony_ci .sram_len = SZ_32K, 5948c2ecf20Sopenharmony_ci}; 5958c2ecf20Sopenharmony_ci 5968c2ecf20Sopenharmony_civoid __init dm646x_init_mcasp0(struct snd_platform_data *pdata) 5978c2ecf20Sopenharmony_ci{ 5988c2ecf20Sopenharmony_ci dm646x_mcasp0_device.dev.platform_data = pdata; 5998c2ecf20Sopenharmony_ci platform_device_register(&dm646x_mcasp0_device); 6008c2ecf20Sopenharmony_ci} 6018c2ecf20Sopenharmony_ci 6028c2ecf20Sopenharmony_civoid __init dm646x_init_mcasp1(struct snd_platform_data *pdata) 6038c2ecf20Sopenharmony_ci{ 6048c2ecf20Sopenharmony_ci dm646x_mcasp1_device.dev.platform_data = pdata; 6058c2ecf20Sopenharmony_ci platform_device_register(&dm646x_mcasp1_device); 6068c2ecf20Sopenharmony_ci platform_device_register(&dm646x_dit_device); 6078c2ecf20Sopenharmony_ci} 6088c2ecf20Sopenharmony_ci 6098c2ecf20Sopenharmony_civoid dm646x_setup_vpif(struct vpif_display_config *display_config, 6108c2ecf20Sopenharmony_ci struct vpif_capture_config *capture_config) 6118c2ecf20Sopenharmony_ci{ 6128c2ecf20Sopenharmony_ci unsigned int value; 6138c2ecf20Sopenharmony_ci 6148c2ecf20Sopenharmony_ci value = __raw_readl(DAVINCI_SYSMOD_VIRT(SYSMOD_VSCLKDIS)); 6158c2ecf20Sopenharmony_ci value &= ~VSCLKDIS_MASK; 6168c2ecf20Sopenharmony_ci __raw_writel(value, DAVINCI_SYSMOD_VIRT(SYSMOD_VSCLKDIS)); 6178c2ecf20Sopenharmony_ci 6188c2ecf20Sopenharmony_ci value = __raw_readl(DAVINCI_SYSMOD_VIRT(SYSMOD_VDD3P3VPWDN)); 6198c2ecf20Sopenharmony_ci value &= ~VDD3P3V_VID_MASK; 6208c2ecf20Sopenharmony_ci __raw_writel(value, DAVINCI_SYSMOD_VIRT(SYSMOD_VDD3P3VPWDN)); 6218c2ecf20Sopenharmony_ci 6228c2ecf20Sopenharmony_ci davinci_cfg_reg(DM646X_STSOMUX_DISABLE); 6238c2ecf20Sopenharmony_ci davinci_cfg_reg(DM646X_STSIMUX_DISABLE); 6248c2ecf20Sopenharmony_ci davinci_cfg_reg(DM646X_PTSOMUX_DISABLE); 6258c2ecf20Sopenharmony_ci davinci_cfg_reg(DM646X_PTSIMUX_DISABLE); 6268c2ecf20Sopenharmony_ci 6278c2ecf20Sopenharmony_ci vpif_display_dev.dev.platform_data = display_config; 6288c2ecf20Sopenharmony_ci vpif_capture_dev.dev.platform_data = capture_config; 6298c2ecf20Sopenharmony_ci platform_device_register(&vpif_dev); 6308c2ecf20Sopenharmony_ci platform_device_register(&vpif_display_dev); 6318c2ecf20Sopenharmony_ci platform_device_register(&vpif_capture_dev); 6328c2ecf20Sopenharmony_ci} 6338c2ecf20Sopenharmony_ci 6348c2ecf20Sopenharmony_ciint __init dm646x_init_edma(struct edma_rsv_info *rsv) 6358c2ecf20Sopenharmony_ci{ 6368c2ecf20Sopenharmony_ci struct platform_device *edma_pdev; 6378c2ecf20Sopenharmony_ci 6388c2ecf20Sopenharmony_ci dm646x_edma_pdata.rsv = rsv; 6398c2ecf20Sopenharmony_ci 6408c2ecf20Sopenharmony_ci edma_pdev = platform_device_register_full(&dm646x_edma_device); 6418c2ecf20Sopenharmony_ci return PTR_ERR_OR_ZERO(edma_pdev); 6428c2ecf20Sopenharmony_ci} 6438c2ecf20Sopenharmony_ci 6448c2ecf20Sopenharmony_civoid __init dm646x_init(void) 6458c2ecf20Sopenharmony_ci{ 6468c2ecf20Sopenharmony_ci davinci_common_init(&davinci_soc_info_dm646x); 6478c2ecf20Sopenharmony_ci davinci_map_sysmod(); 6488c2ecf20Sopenharmony_ci} 6498c2ecf20Sopenharmony_ci 6508c2ecf20Sopenharmony_civoid __init dm646x_init_time(unsigned long ref_clk_rate, 6518c2ecf20Sopenharmony_ci unsigned long aux_clkin_rate) 6528c2ecf20Sopenharmony_ci{ 6538c2ecf20Sopenharmony_ci void __iomem *pll1, *psc; 6548c2ecf20Sopenharmony_ci struct clk *clk; 6558c2ecf20Sopenharmony_ci int rv; 6568c2ecf20Sopenharmony_ci 6578c2ecf20Sopenharmony_ci clk_register_fixed_rate(NULL, "ref_clk", NULL, 0, ref_clk_rate); 6588c2ecf20Sopenharmony_ci clk_register_fixed_rate(NULL, "aux_clkin", NULL, 0, aux_clkin_rate); 6598c2ecf20Sopenharmony_ci 6608c2ecf20Sopenharmony_ci pll1 = ioremap(DAVINCI_PLL1_BASE, SZ_1K); 6618c2ecf20Sopenharmony_ci dm646x_pll1_init(NULL, pll1, NULL); 6628c2ecf20Sopenharmony_ci 6638c2ecf20Sopenharmony_ci psc = ioremap(DAVINCI_PWR_SLEEP_CNTRL_BASE, SZ_4K); 6648c2ecf20Sopenharmony_ci dm646x_psc_init(NULL, psc); 6658c2ecf20Sopenharmony_ci 6668c2ecf20Sopenharmony_ci clk = clk_get(NULL, "timer0"); 6678c2ecf20Sopenharmony_ci if (WARN_ON(IS_ERR(clk))) { 6688c2ecf20Sopenharmony_ci pr_err("Unable to get the timer clock\n"); 6698c2ecf20Sopenharmony_ci return; 6708c2ecf20Sopenharmony_ci } 6718c2ecf20Sopenharmony_ci 6728c2ecf20Sopenharmony_ci rv = davinci_timer_register(clk, &dm646x_timer_cfg); 6738c2ecf20Sopenharmony_ci WARN(rv, "Unable to register the timer: %d\n", rv); 6748c2ecf20Sopenharmony_ci} 6758c2ecf20Sopenharmony_ci 6768c2ecf20Sopenharmony_cistatic struct resource dm646x_pll2_resources[] = { 6778c2ecf20Sopenharmony_ci { 6788c2ecf20Sopenharmony_ci .start = DAVINCI_PLL2_BASE, 6798c2ecf20Sopenharmony_ci .end = DAVINCI_PLL2_BASE + SZ_1K - 1, 6808c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 6818c2ecf20Sopenharmony_ci }, 6828c2ecf20Sopenharmony_ci}; 6838c2ecf20Sopenharmony_ci 6848c2ecf20Sopenharmony_cistatic struct platform_device dm646x_pll2_device = { 6858c2ecf20Sopenharmony_ci .name = "dm646x-pll2", 6868c2ecf20Sopenharmony_ci .id = -1, 6878c2ecf20Sopenharmony_ci .resource = dm646x_pll2_resources, 6888c2ecf20Sopenharmony_ci .num_resources = ARRAY_SIZE(dm646x_pll2_resources), 6898c2ecf20Sopenharmony_ci}; 6908c2ecf20Sopenharmony_ci 6918c2ecf20Sopenharmony_civoid __init dm646x_register_clocks(void) 6928c2ecf20Sopenharmony_ci{ 6938c2ecf20Sopenharmony_ci /* PLL1 and PSC are registered in dm646x_init_time() */ 6948c2ecf20Sopenharmony_ci platform_device_register(&dm646x_pll2_device); 6958c2ecf20Sopenharmony_ci} 6968c2ecf20Sopenharmony_ci 6978c2ecf20Sopenharmony_cistatic const struct davinci_aintc_config dm646x_aintc_config = { 6988c2ecf20Sopenharmony_ci .reg = { 6998c2ecf20Sopenharmony_ci .start = DAVINCI_ARM_INTC_BASE, 7008c2ecf20Sopenharmony_ci .end = DAVINCI_ARM_INTC_BASE + SZ_4K - 1, 7018c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 7028c2ecf20Sopenharmony_ci }, 7038c2ecf20Sopenharmony_ci .num_irqs = 64, 7048c2ecf20Sopenharmony_ci .prios = dm646x_default_priorities, 7058c2ecf20Sopenharmony_ci}; 7068c2ecf20Sopenharmony_ci 7078c2ecf20Sopenharmony_civoid __init dm646x_init_irq(void) 7088c2ecf20Sopenharmony_ci{ 7098c2ecf20Sopenharmony_ci davinci_aintc_init(&dm646x_aintc_config); 7108c2ecf20Sopenharmony_ci} 7118c2ecf20Sopenharmony_ci 7128c2ecf20Sopenharmony_cistatic int __init dm646x_init_devices(void) 7138c2ecf20Sopenharmony_ci{ 7148c2ecf20Sopenharmony_ci int ret = 0; 7158c2ecf20Sopenharmony_ci 7168c2ecf20Sopenharmony_ci if (!cpu_is_davinci_dm646x()) 7178c2ecf20Sopenharmony_ci return 0; 7188c2ecf20Sopenharmony_ci 7198c2ecf20Sopenharmony_ci platform_device_register(&dm646x_mdio_device); 7208c2ecf20Sopenharmony_ci platform_device_register(&dm646x_emac_device); 7218c2ecf20Sopenharmony_ci 7228c2ecf20Sopenharmony_ci ret = davinci_init_wdt(); 7238c2ecf20Sopenharmony_ci if (ret) 7248c2ecf20Sopenharmony_ci pr_warn("%s: watchdog init failed: %d\n", __func__, ret); 7258c2ecf20Sopenharmony_ci 7268c2ecf20Sopenharmony_ci return ret; 7278c2ecf20Sopenharmony_ci} 7288c2ecf20Sopenharmony_cipostcore_initcall(dm646x_init_devices); 729