18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * ARC HSDK Platform support code 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Copyright (C) 2017 Synopsys, Inc. (www.synopsys.com) 68c2ecf20Sopenharmony_ci */ 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci#include <linux/init.h> 98c2ecf20Sopenharmony_ci#include <linux/of_fdt.h> 108c2ecf20Sopenharmony_ci#include <linux/libfdt.h> 118c2ecf20Sopenharmony_ci#include <linux/smp.h> 128c2ecf20Sopenharmony_ci#include <asm/arcregs.h> 138c2ecf20Sopenharmony_ci#include <asm/io.h> 148c2ecf20Sopenharmony_ci#include <asm/mach_desc.h> 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_ciint arc_hsdk_axi_dmac_coherent __section(".data") = 0; 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ci#define ARC_CCM_UNUSED_ADDR 0x60000000 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci 218c2ecf20Sopenharmony_ci#define ARC_PERIPHERAL_BASE 0xf0000000 228c2ecf20Sopenharmony_ci#define CREG_BASE (ARC_PERIPHERAL_BASE + 0x1000) 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ci#define SDIO_BASE (ARC_PERIPHERAL_BASE + 0xA000) 258c2ecf20Sopenharmony_ci#define SDIO_UHS_REG_EXT (SDIO_BASE + 0x108) 268c2ecf20Sopenharmony_ci#define SDIO_UHS_REG_EXT_DIV_2 (2 << 30) 278c2ecf20Sopenharmony_ci 288c2ecf20Sopenharmony_ci#define HSDK_GPIO_INTC (ARC_PERIPHERAL_BASE + 0x3000) 298c2ecf20Sopenharmony_ci 308c2ecf20Sopenharmony_cistatic void __init hsdk_enable_gpio_intc_wire(void) 318c2ecf20Sopenharmony_ci{ 328c2ecf20Sopenharmony_ci /* 338c2ecf20Sopenharmony_ci * Peripherals on CPU Card are wired to cpu intc via intermediate 348c2ecf20Sopenharmony_ci * DW APB GPIO blocks (mainly for debouncing) 358c2ecf20Sopenharmony_ci * 368c2ecf20Sopenharmony_ci * --------------------- 378c2ecf20Sopenharmony_ci * | snps,archs-intc | 388c2ecf20Sopenharmony_ci * --------------------- 398c2ecf20Sopenharmony_ci * | 408c2ecf20Sopenharmony_ci * ---------------------- 418c2ecf20Sopenharmony_ci * | snps,archs-idu-intc | 428c2ecf20Sopenharmony_ci * ---------------------- 438c2ecf20Sopenharmony_ci * | | | | | 448c2ecf20Sopenharmony_ci * | [eth] [USB] [... other peripherals] 458c2ecf20Sopenharmony_ci * | 468c2ecf20Sopenharmony_ci * ------------------- 478c2ecf20Sopenharmony_ci * | snps,dw-apb-intc | 488c2ecf20Sopenharmony_ci * ------------------- 498c2ecf20Sopenharmony_ci * | | | | 508c2ecf20Sopenharmony_ci * [Bt] [HAPS] [... other peripherals] 518c2ecf20Sopenharmony_ci * 528c2ecf20Sopenharmony_ci * Current implementation of "irq-dw-apb-ictl" driver doesn't work well 538c2ecf20Sopenharmony_ci * with stacked INTCs. In particular problem happens if its master INTC 548c2ecf20Sopenharmony_ci * not yet instantiated. See discussion here - 558c2ecf20Sopenharmony_ci * https://lkml.org/lkml/2015/3/4/755 568c2ecf20Sopenharmony_ci * 578c2ecf20Sopenharmony_ci * So setup the first gpio block as a passive pass thru and hide it from 588c2ecf20Sopenharmony_ci * DT hardware topology - connect intc directly to cpu intc 598c2ecf20Sopenharmony_ci * The GPIO "wire" needs to be init nevertheless (here) 608c2ecf20Sopenharmony_ci * 618c2ecf20Sopenharmony_ci * One side adv is that peripheral interrupt handling avoids one nested 628c2ecf20Sopenharmony_ci * intc ISR hop 638c2ecf20Sopenharmony_ci * 648c2ecf20Sopenharmony_ci * According to HSDK User's Manual [1], "Table 2 Interrupt Mapping" 658c2ecf20Sopenharmony_ci * we have the following GPIO input lines used as sources of interrupt: 668c2ecf20Sopenharmony_ci * - GPIO[0] - Bluetooth interrupt of RS9113 module 678c2ecf20Sopenharmony_ci * - GPIO[2] - HAPS interrupt (on HapsTrak 3 connector) 688c2ecf20Sopenharmony_ci * - GPIO[3] - Audio codec (MAX9880A) interrupt 698c2ecf20Sopenharmony_ci * - GPIO[8-23] - Available on Arduino and PMOD_x headers 708c2ecf20Sopenharmony_ci * For now there's no use of Arduino and PMOD_x headers in Linux 718c2ecf20Sopenharmony_ci * use-case so we only enable lines 0, 2 and 3. 728c2ecf20Sopenharmony_ci * 738c2ecf20Sopenharmony_ci * [1] https://github.com/foss-for-synopsys-dwc-arc-processors/ARC-Development-Systems-Forum/wiki/docs/ARC_HSDK_User_Guide.pdf 748c2ecf20Sopenharmony_ci */ 758c2ecf20Sopenharmony_ci#define GPIO_INTEN (HSDK_GPIO_INTC + 0x30) 768c2ecf20Sopenharmony_ci#define GPIO_INTMASK (HSDK_GPIO_INTC + 0x34) 778c2ecf20Sopenharmony_ci#define GPIO_INTTYPE_LEVEL (HSDK_GPIO_INTC + 0x38) 788c2ecf20Sopenharmony_ci#define GPIO_INT_POLARITY (HSDK_GPIO_INTC + 0x3c) 798c2ecf20Sopenharmony_ci#define GPIO_INT_CONNECTED_MASK 0x0d 808c2ecf20Sopenharmony_ci 818c2ecf20Sopenharmony_ci iowrite32(0xffffffff, (void __iomem *) GPIO_INTMASK); 828c2ecf20Sopenharmony_ci iowrite32(~GPIO_INT_CONNECTED_MASK, (void __iomem *) GPIO_INTMASK); 838c2ecf20Sopenharmony_ci iowrite32(0x00000000, (void __iomem *) GPIO_INTTYPE_LEVEL); 848c2ecf20Sopenharmony_ci iowrite32(0xffffffff, (void __iomem *) GPIO_INT_POLARITY); 858c2ecf20Sopenharmony_ci iowrite32(GPIO_INT_CONNECTED_MASK, (void __iomem *) GPIO_INTEN); 868c2ecf20Sopenharmony_ci} 878c2ecf20Sopenharmony_ci 888c2ecf20Sopenharmony_cistatic int __init hsdk_tweak_node_coherency(const char *path, bool coherent) 898c2ecf20Sopenharmony_ci{ 908c2ecf20Sopenharmony_ci void *fdt = initial_boot_params; 918c2ecf20Sopenharmony_ci const void *prop; 928c2ecf20Sopenharmony_ci int node, ret; 938c2ecf20Sopenharmony_ci bool dt_coh_set; 948c2ecf20Sopenharmony_ci 958c2ecf20Sopenharmony_ci node = fdt_path_offset(fdt, path); 968c2ecf20Sopenharmony_ci if (node < 0) 978c2ecf20Sopenharmony_ci goto tweak_fail; 988c2ecf20Sopenharmony_ci 998c2ecf20Sopenharmony_ci prop = fdt_getprop(fdt, node, "dma-coherent", &ret); 1008c2ecf20Sopenharmony_ci if (!prop && ret != -FDT_ERR_NOTFOUND) 1018c2ecf20Sopenharmony_ci goto tweak_fail; 1028c2ecf20Sopenharmony_ci 1038c2ecf20Sopenharmony_ci dt_coh_set = ret != -FDT_ERR_NOTFOUND; 1048c2ecf20Sopenharmony_ci ret = 0; 1058c2ecf20Sopenharmony_ci 1068c2ecf20Sopenharmony_ci /* need to remove "dma-coherent" property */ 1078c2ecf20Sopenharmony_ci if (dt_coh_set && !coherent) 1088c2ecf20Sopenharmony_ci ret = fdt_delprop(fdt, node, "dma-coherent"); 1098c2ecf20Sopenharmony_ci 1108c2ecf20Sopenharmony_ci /* need to set "dma-coherent" property */ 1118c2ecf20Sopenharmony_ci if (!dt_coh_set && coherent) 1128c2ecf20Sopenharmony_ci ret = fdt_setprop(fdt, node, "dma-coherent", NULL, 0); 1138c2ecf20Sopenharmony_ci 1148c2ecf20Sopenharmony_ci if (ret < 0) 1158c2ecf20Sopenharmony_ci goto tweak_fail; 1168c2ecf20Sopenharmony_ci 1178c2ecf20Sopenharmony_ci return 0; 1188c2ecf20Sopenharmony_ci 1198c2ecf20Sopenharmony_citweak_fail: 1208c2ecf20Sopenharmony_ci pr_err("failed to tweak %s to %scoherent\n", path, coherent ? "" : "non"); 1218c2ecf20Sopenharmony_ci return -EFAULT; 1228c2ecf20Sopenharmony_ci} 1238c2ecf20Sopenharmony_ci 1248c2ecf20Sopenharmony_cienum hsdk_axi_masters { 1258c2ecf20Sopenharmony_ci M_HS_CORE = 0, 1268c2ecf20Sopenharmony_ci M_HS_RTT, 1278c2ecf20Sopenharmony_ci M_AXI_TUN, 1288c2ecf20Sopenharmony_ci M_HDMI_VIDEO, 1298c2ecf20Sopenharmony_ci M_HDMI_AUDIO, 1308c2ecf20Sopenharmony_ci M_USB_HOST, 1318c2ecf20Sopenharmony_ci M_ETHERNET, 1328c2ecf20Sopenharmony_ci M_SDIO, 1338c2ecf20Sopenharmony_ci M_GPU, 1348c2ecf20Sopenharmony_ci M_DMAC_0, 1358c2ecf20Sopenharmony_ci M_DMAC_1, 1368c2ecf20Sopenharmony_ci M_DVFS 1378c2ecf20Sopenharmony_ci}; 1388c2ecf20Sopenharmony_ci 1398c2ecf20Sopenharmony_ci#define UPDATE_VAL 1 1408c2ecf20Sopenharmony_ci 1418c2ecf20Sopenharmony_ci/* 1428c2ecf20Sopenharmony_ci * This is modified configuration of AXI bridge. Default settings 1438c2ecf20Sopenharmony_ci * are specified in "Table 111 CREG Address Decoder register reset values". 1448c2ecf20Sopenharmony_ci * 1458c2ecf20Sopenharmony_ci * AXI_M_m_SLV{0|1} - Slave Select register for master 'm'. 1468c2ecf20Sopenharmony_ci * Possible slaves are: 1478c2ecf20Sopenharmony_ci * - 0 => no slave selected 1488c2ecf20Sopenharmony_ci * - 1 => DDR controller port #1 1498c2ecf20Sopenharmony_ci * - 2 => SRAM controller 1508c2ecf20Sopenharmony_ci * - 3 => AXI tunnel 1518c2ecf20Sopenharmony_ci * - 4 => EBI controller 1528c2ecf20Sopenharmony_ci * - 5 => ROM controller 1538c2ecf20Sopenharmony_ci * - 6 => AXI2APB bridge 1548c2ecf20Sopenharmony_ci * - 7 => DDR controller port #2 1558c2ecf20Sopenharmony_ci * - 8 => DDR controller port #3 1568c2ecf20Sopenharmony_ci * - 9 => HS38x4 IOC 1578c2ecf20Sopenharmony_ci * - 10 => HS38x4 DMI 1588c2ecf20Sopenharmony_ci * AXI_M_m_OFFSET{0|1} - Addr Offset register for master 'm' 1598c2ecf20Sopenharmony_ci * 1608c2ecf20Sopenharmony_ci * Please read ARC HS Development IC Specification, section 17.2 for more 1618c2ecf20Sopenharmony_ci * information about apertures configuration. 1628c2ecf20Sopenharmony_ci * 1638c2ecf20Sopenharmony_ci * m master AXI_M_m_SLV0 AXI_M_m_SLV1 AXI_M_m_OFFSET0 AXI_M_m_OFFSET1 1648c2ecf20Sopenharmony_ci * 0 HS (CBU) 0x11111111 0x63111111 0xFEDCBA98 0x0E543210 1658c2ecf20Sopenharmony_ci * 1 HS (RTT) 0x77777777 0x77777777 0xFEDCBA98 0x76543210 1668c2ecf20Sopenharmony_ci * 2 AXI Tunnel 0x88888888 0x88888888 0xFEDCBA98 0x76543210 1678c2ecf20Sopenharmony_ci * 3 HDMI-VIDEO 0x77777777 0x77777777 0xFEDCBA98 0x76543210 1688c2ecf20Sopenharmony_ci * 4 HDMI-ADUIO 0x77777777 0x77777777 0xFEDCBA98 0x76543210 1698c2ecf20Sopenharmony_ci * 5 USB-HOST 0x77777777 0x77999999 0xFEDCBA98 0x76DCBA98 1708c2ecf20Sopenharmony_ci * 6 ETHERNET 0x77777777 0x77999999 0xFEDCBA98 0x76DCBA98 1718c2ecf20Sopenharmony_ci * 7 SDIO 0x77777777 0x77999999 0xFEDCBA98 0x76DCBA98 1728c2ecf20Sopenharmony_ci * 8 GPU 0x77777777 0x77777777 0xFEDCBA98 0x76543210 1738c2ecf20Sopenharmony_ci * 9 DMAC (port #1) 0x77777777 0x77777777 0xFEDCBA98 0x76543210 1748c2ecf20Sopenharmony_ci * 10 DMAC (port #2) 0x77777777 0x77777777 0xFEDCBA98 0x76543210 1758c2ecf20Sopenharmony_ci * 11 DVFS 0x00000000 0x60000000 0x00000000 0x00000000 1768c2ecf20Sopenharmony_ci */ 1778c2ecf20Sopenharmony_ci 1788c2ecf20Sopenharmony_ci#define CREG_AXI_M_SLV0(m) ((void __iomem *)(CREG_BASE + 0x20 * (m))) 1798c2ecf20Sopenharmony_ci#define CREG_AXI_M_SLV1(m) ((void __iomem *)(CREG_BASE + 0x20 * (m) + 0x04)) 1808c2ecf20Sopenharmony_ci#define CREG_AXI_M_OFT0(m) ((void __iomem *)(CREG_BASE + 0x20 * (m) + 0x08)) 1818c2ecf20Sopenharmony_ci#define CREG_AXI_M_OFT1(m) ((void __iomem *)(CREG_BASE + 0x20 * (m) + 0x0C)) 1828c2ecf20Sopenharmony_ci#define CREG_AXI_M_UPDT(m) ((void __iomem *)(CREG_BASE + 0x20 * (m) + 0x14)) 1838c2ecf20Sopenharmony_ci 1848c2ecf20Sopenharmony_ci#define CREG_AXI_M_HS_CORE_BOOT ((void __iomem *)(CREG_BASE + 0x010)) 1858c2ecf20Sopenharmony_ci 1868c2ecf20Sopenharmony_ci#define CREG_PAE ((void __iomem *)(CREG_BASE + 0x180)) 1878c2ecf20Sopenharmony_ci#define CREG_PAE_UPDT ((void __iomem *)(CREG_BASE + 0x194)) 1888c2ecf20Sopenharmony_ci 1898c2ecf20Sopenharmony_cistatic void __init hsdk_init_memory_bridge_axi_dmac(void) 1908c2ecf20Sopenharmony_ci{ 1918c2ecf20Sopenharmony_ci bool coherent = !!arc_hsdk_axi_dmac_coherent; 1928c2ecf20Sopenharmony_ci u32 axi_m_slv1, axi_m_oft1; 1938c2ecf20Sopenharmony_ci 1948c2ecf20Sopenharmony_ci /* 1958c2ecf20Sopenharmony_ci * Don't tweak memory bridge configuration if we failed to tweak DTB 1968c2ecf20Sopenharmony_ci * as we will end up in a inconsistent state. 1978c2ecf20Sopenharmony_ci */ 1988c2ecf20Sopenharmony_ci if (hsdk_tweak_node_coherency("/soc/dmac@80000", coherent)) 1998c2ecf20Sopenharmony_ci return; 2008c2ecf20Sopenharmony_ci 2018c2ecf20Sopenharmony_ci if (coherent) { 2028c2ecf20Sopenharmony_ci axi_m_slv1 = 0x77999999; 2038c2ecf20Sopenharmony_ci axi_m_oft1 = 0x76DCBA98; 2048c2ecf20Sopenharmony_ci } else { 2058c2ecf20Sopenharmony_ci axi_m_slv1 = 0x77777777; 2068c2ecf20Sopenharmony_ci axi_m_oft1 = 0x76543210; 2078c2ecf20Sopenharmony_ci } 2088c2ecf20Sopenharmony_ci 2098c2ecf20Sopenharmony_ci writel(0x77777777, CREG_AXI_M_SLV0(M_DMAC_0)); 2108c2ecf20Sopenharmony_ci writel(0xFEDCBA98, CREG_AXI_M_OFT0(M_DMAC_0)); 2118c2ecf20Sopenharmony_ci writel(axi_m_slv1, CREG_AXI_M_SLV1(M_DMAC_0)); 2128c2ecf20Sopenharmony_ci writel(axi_m_oft1, CREG_AXI_M_OFT1(M_DMAC_0)); 2138c2ecf20Sopenharmony_ci writel(UPDATE_VAL, CREG_AXI_M_UPDT(M_DMAC_0)); 2148c2ecf20Sopenharmony_ci 2158c2ecf20Sopenharmony_ci writel(0x77777777, CREG_AXI_M_SLV0(M_DMAC_1)); 2168c2ecf20Sopenharmony_ci writel(0xFEDCBA98, CREG_AXI_M_OFT0(M_DMAC_1)); 2178c2ecf20Sopenharmony_ci writel(axi_m_slv1, CREG_AXI_M_SLV1(M_DMAC_1)); 2188c2ecf20Sopenharmony_ci writel(axi_m_oft1, CREG_AXI_M_OFT1(M_DMAC_1)); 2198c2ecf20Sopenharmony_ci writel(UPDATE_VAL, CREG_AXI_M_UPDT(M_DMAC_1)); 2208c2ecf20Sopenharmony_ci} 2218c2ecf20Sopenharmony_ci 2228c2ecf20Sopenharmony_cistatic void __init hsdk_init_memory_bridge(void) 2238c2ecf20Sopenharmony_ci{ 2248c2ecf20Sopenharmony_ci u32 reg; 2258c2ecf20Sopenharmony_ci 2268c2ecf20Sopenharmony_ci /* 2278c2ecf20Sopenharmony_ci * M_HS_CORE has one unique register - BOOT. 2288c2ecf20Sopenharmony_ci * We need to clean boot mirror (BOOT[1:0]) bits in them to avoid first 2298c2ecf20Sopenharmony_ci * aperture to be masked by 'boot mirror'. 2308c2ecf20Sopenharmony_ci */ 2318c2ecf20Sopenharmony_ci reg = readl(CREG_AXI_M_HS_CORE_BOOT) & (~0x3); 2328c2ecf20Sopenharmony_ci writel(reg, CREG_AXI_M_HS_CORE_BOOT); 2338c2ecf20Sopenharmony_ci writel(0x11111111, CREG_AXI_M_SLV0(M_HS_CORE)); 2348c2ecf20Sopenharmony_ci writel(0x63111111, CREG_AXI_M_SLV1(M_HS_CORE)); 2358c2ecf20Sopenharmony_ci writel(0xFEDCBA98, CREG_AXI_M_OFT0(M_HS_CORE)); 2368c2ecf20Sopenharmony_ci writel(0x0E543210, CREG_AXI_M_OFT1(M_HS_CORE)); 2378c2ecf20Sopenharmony_ci writel(UPDATE_VAL, CREG_AXI_M_UPDT(M_HS_CORE)); 2388c2ecf20Sopenharmony_ci 2398c2ecf20Sopenharmony_ci writel(0x77777777, CREG_AXI_M_SLV0(M_HS_RTT)); 2408c2ecf20Sopenharmony_ci writel(0x77777777, CREG_AXI_M_SLV1(M_HS_RTT)); 2418c2ecf20Sopenharmony_ci writel(0xFEDCBA98, CREG_AXI_M_OFT0(M_HS_RTT)); 2428c2ecf20Sopenharmony_ci writel(0x76543210, CREG_AXI_M_OFT1(M_HS_RTT)); 2438c2ecf20Sopenharmony_ci writel(UPDATE_VAL, CREG_AXI_M_UPDT(M_HS_RTT)); 2448c2ecf20Sopenharmony_ci 2458c2ecf20Sopenharmony_ci writel(0x88888888, CREG_AXI_M_SLV0(M_AXI_TUN)); 2468c2ecf20Sopenharmony_ci writel(0x88888888, CREG_AXI_M_SLV1(M_AXI_TUN)); 2478c2ecf20Sopenharmony_ci writel(0xFEDCBA98, CREG_AXI_M_OFT0(M_AXI_TUN)); 2488c2ecf20Sopenharmony_ci writel(0x76543210, CREG_AXI_M_OFT1(M_AXI_TUN)); 2498c2ecf20Sopenharmony_ci writel(UPDATE_VAL, CREG_AXI_M_UPDT(M_AXI_TUN)); 2508c2ecf20Sopenharmony_ci 2518c2ecf20Sopenharmony_ci writel(0x77777777, CREG_AXI_M_SLV0(M_HDMI_VIDEO)); 2528c2ecf20Sopenharmony_ci writel(0x77777777, CREG_AXI_M_SLV1(M_HDMI_VIDEO)); 2538c2ecf20Sopenharmony_ci writel(0xFEDCBA98, CREG_AXI_M_OFT0(M_HDMI_VIDEO)); 2548c2ecf20Sopenharmony_ci writel(0x76543210, CREG_AXI_M_OFT1(M_HDMI_VIDEO)); 2558c2ecf20Sopenharmony_ci writel(UPDATE_VAL, CREG_AXI_M_UPDT(M_HDMI_VIDEO)); 2568c2ecf20Sopenharmony_ci 2578c2ecf20Sopenharmony_ci writel(0x77777777, CREG_AXI_M_SLV0(M_HDMI_AUDIO)); 2588c2ecf20Sopenharmony_ci writel(0x77777777, CREG_AXI_M_SLV1(M_HDMI_AUDIO)); 2598c2ecf20Sopenharmony_ci writel(0xFEDCBA98, CREG_AXI_M_OFT0(M_HDMI_AUDIO)); 2608c2ecf20Sopenharmony_ci writel(0x76543210, CREG_AXI_M_OFT1(M_HDMI_AUDIO)); 2618c2ecf20Sopenharmony_ci writel(UPDATE_VAL, CREG_AXI_M_UPDT(M_HDMI_AUDIO)); 2628c2ecf20Sopenharmony_ci 2638c2ecf20Sopenharmony_ci writel(0x77777777, CREG_AXI_M_SLV0(M_USB_HOST)); 2648c2ecf20Sopenharmony_ci writel(0x77999999, CREG_AXI_M_SLV1(M_USB_HOST)); 2658c2ecf20Sopenharmony_ci writel(0xFEDCBA98, CREG_AXI_M_OFT0(M_USB_HOST)); 2668c2ecf20Sopenharmony_ci writel(0x76DCBA98, CREG_AXI_M_OFT1(M_USB_HOST)); 2678c2ecf20Sopenharmony_ci writel(UPDATE_VAL, CREG_AXI_M_UPDT(M_USB_HOST)); 2688c2ecf20Sopenharmony_ci 2698c2ecf20Sopenharmony_ci writel(0x77777777, CREG_AXI_M_SLV0(M_ETHERNET)); 2708c2ecf20Sopenharmony_ci writel(0x77999999, CREG_AXI_M_SLV1(M_ETHERNET)); 2718c2ecf20Sopenharmony_ci writel(0xFEDCBA98, CREG_AXI_M_OFT0(M_ETHERNET)); 2728c2ecf20Sopenharmony_ci writel(0x76DCBA98, CREG_AXI_M_OFT1(M_ETHERNET)); 2738c2ecf20Sopenharmony_ci writel(UPDATE_VAL, CREG_AXI_M_UPDT(M_ETHERNET)); 2748c2ecf20Sopenharmony_ci 2758c2ecf20Sopenharmony_ci writel(0x77777777, CREG_AXI_M_SLV0(M_SDIO)); 2768c2ecf20Sopenharmony_ci writel(0x77999999, CREG_AXI_M_SLV1(M_SDIO)); 2778c2ecf20Sopenharmony_ci writel(0xFEDCBA98, CREG_AXI_M_OFT0(M_SDIO)); 2788c2ecf20Sopenharmony_ci writel(0x76DCBA98, CREG_AXI_M_OFT1(M_SDIO)); 2798c2ecf20Sopenharmony_ci writel(UPDATE_VAL, CREG_AXI_M_UPDT(M_SDIO)); 2808c2ecf20Sopenharmony_ci 2818c2ecf20Sopenharmony_ci writel(0x77777777, CREG_AXI_M_SLV0(M_GPU)); 2828c2ecf20Sopenharmony_ci writel(0x77777777, CREG_AXI_M_SLV1(M_GPU)); 2838c2ecf20Sopenharmony_ci writel(0xFEDCBA98, CREG_AXI_M_OFT0(M_GPU)); 2848c2ecf20Sopenharmony_ci writel(0x76543210, CREG_AXI_M_OFT1(M_GPU)); 2858c2ecf20Sopenharmony_ci writel(UPDATE_VAL, CREG_AXI_M_UPDT(M_GPU)); 2868c2ecf20Sopenharmony_ci 2878c2ecf20Sopenharmony_ci writel(0x00000000, CREG_AXI_M_SLV0(M_DVFS)); 2888c2ecf20Sopenharmony_ci writel(0x60000000, CREG_AXI_M_SLV1(M_DVFS)); 2898c2ecf20Sopenharmony_ci writel(0x00000000, CREG_AXI_M_OFT0(M_DVFS)); 2908c2ecf20Sopenharmony_ci writel(0x00000000, CREG_AXI_M_OFT1(M_DVFS)); 2918c2ecf20Sopenharmony_ci writel(UPDATE_VAL, CREG_AXI_M_UPDT(M_DVFS)); 2928c2ecf20Sopenharmony_ci 2938c2ecf20Sopenharmony_ci hsdk_init_memory_bridge_axi_dmac(); 2948c2ecf20Sopenharmony_ci 2958c2ecf20Sopenharmony_ci /* 2968c2ecf20Sopenharmony_ci * PAE remapping for DMA clients does not work due to an RTL bug, so 2978c2ecf20Sopenharmony_ci * CREG_PAE register must be programmed to all zeroes, otherwise it 2988c2ecf20Sopenharmony_ci * will cause problems with DMA to/from peripherals even if PAE40 is 2998c2ecf20Sopenharmony_ci * not used. 3008c2ecf20Sopenharmony_ci */ 3018c2ecf20Sopenharmony_ci writel(0x00000000, CREG_PAE); 3028c2ecf20Sopenharmony_ci writel(UPDATE_VAL, CREG_PAE_UPDT); 3038c2ecf20Sopenharmony_ci} 3048c2ecf20Sopenharmony_ci 3058c2ecf20Sopenharmony_cistatic void __init hsdk_init_early(void) 3068c2ecf20Sopenharmony_ci{ 3078c2ecf20Sopenharmony_ci hsdk_init_memory_bridge(); 3088c2ecf20Sopenharmony_ci 3098c2ecf20Sopenharmony_ci /* 3108c2ecf20Sopenharmony_ci * Switch SDIO external ciu clock divider from default div-by-8 to 3118c2ecf20Sopenharmony_ci * minimum possible div-by-2. 3128c2ecf20Sopenharmony_ci */ 3138c2ecf20Sopenharmony_ci iowrite32(SDIO_UHS_REG_EXT_DIV_2, (void __iomem *) SDIO_UHS_REG_EXT); 3148c2ecf20Sopenharmony_ci 3158c2ecf20Sopenharmony_ci hsdk_enable_gpio_intc_wire(); 3168c2ecf20Sopenharmony_ci} 3178c2ecf20Sopenharmony_ci 3188c2ecf20Sopenharmony_cistatic const char *hsdk_compat[] __initconst = { 3198c2ecf20Sopenharmony_ci "snps,hsdk", 3208c2ecf20Sopenharmony_ci NULL, 3218c2ecf20Sopenharmony_ci}; 3228c2ecf20Sopenharmony_ci 3238c2ecf20Sopenharmony_ciMACHINE_START(SIMULATION, "hsdk") 3248c2ecf20Sopenharmony_ci .dt_compat = hsdk_compat, 3258c2ecf20Sopenharmony_ci .init_early = hsdk_init_early, 3268c2ecf20Sopenharmony_ciMACHINE_END 327