1031542fcSKonstantin Porotchkin /* 2031542fcSKonstantin Porotchkin * Copyright (C) 2018 Marvell International Ltd. 3031542fcSKonstantin Porotchkin * 4031542fcSKonstantin Porotchkin * SPDX-License-Identifier: BSD-3-Clause 5031542fcSKonstantin Porotchkin * https://spdx.org/licenses 6031542fcSKonstantin Porotchkin */ 7031542fcSKonstantin Porotchkin 8031542fcSKonstantin Porotchkin /* AP807 Marvell SoC driver */ 9031542fcSKonstantin Porotchkin 1009d40e0eSAntonio Nino Diaz #include <common/debug.h> 1109d40e0eSAntonio Nino Diaz #include <drivers/marvell/cache_llc.h> 1209d40e0eSAntonio Nino Diaz #include <drivers/marvell/ccu.h> 1309d40e0eSAntonio Nino Diaz #include <drivers/marvell/io_win.h> 14c3c51b32SGrzegorz Jaszczyk #include <drivers/marvell/iob.h> 1509d40e0eSAntonio Nino Diaz #include <drivers/marvell/mci.h> 1609d40e0eSAntonio Nino Diaz #include <drivers/marvell/mochi/ap_setup.h> 1709d40e0eSAntonio Nino Diaz #include <lib/mmio.h> 18*c82cf21dSKonstantin Porotchkin #include <lib/utils_def.h> 1909d40e0eSAntonio Nino Diaz 20*c82cf21dSKonstantin Porotchkin #include <a8k_plat_def.h> 21031542fcSKonstantin Porotchkin 22031542fcSKonstantin Porotchkin #define SMMU_sACR (MVEBU_SMMU_BASE + 0x10) 23031542fcSKonstantin Porotchkin #define SMMU_sACR_PG_64K (1 << 16) 24031542fcSKonstantin Porotchkin 25031542fcSKonstantin Porotchkin #define CCU_GSPMU_CR (MVEBU_CCU_BASE(MVEBU_AP0) \ 26031542fcSKonstantin Porotchkin + 0x3F0) 27031542fcSKonstantin Porotchkin #define GSPMU_CPU_CONTROL (0x1 << 0) 28031542fcSKonstantin Porotchkin 29031542fcSKonstantin Porotchkin #define CCU_HTC_CR (MVEBU_CCU_BASE(MVEBU_AP0) \ 30031542fcSKonstantin Porotchkin + 0x200) 31031542fcSKonstantin Porotchkin #define CCU_SET_POC_OFFSET 5 32031542fcSKonstantin Porotchkin 33031542fcSKonstantin Porotchkin #define DSS_CR0 (MVEBU_RFU_BASE + 0x100) 34031542fcSKonstantin Porotchkin #define DVM_48BIT_VA_ENABLE (1 << 21) 35031542fcSKonstantin Porotchkin 362da75ae1SGrzegorz Jaszczyk 372da75ae1SGrzegorz Jaszczyk /* SoC RFU / IHBx4 Control */ 382da75ae1SGrzegorz Jaszczyk #define MCIX4_807_REG_START_ADDR_REG(unit_id) (MVEBU_RFU_BASE + \ 392da75ae1SGrzegorz Jaszczyk 0x4258 + (unit_id * 0x4)) 402da75ae1SGrzegorz Jaszczyk 41031542fcSKonstantin Porotchkin /* Secure MoChi incoming access */ 42031542fcSKonstantin Porotchkin #define SEC_MOCHI_IN_ACC_REG (MVEBU_RFU_BASE + 0x4738) 43031542fcSKonstantin Porotchkin #define SEC_MOCHI_IN_ACC_IHB0_EN (1) 44031542fcSKonstantin Porotchkin #define SEC_MOCHI_IN_ACC_IHB1_EN (1 << 3) 45031542fcSKonstantin Porotchkin #define SEC_MOCHI_IN_ACC_IHB2_EN (1 << 6) 46031542fcSKonstantin Porotchkin #define SEC_MOCHI_IN_ACC_PIDI_EN (1 << 9) 47031542fcSKonstantin Porotchkin #define SEC_IN_ACCESS_ENA_ALL_MASTERS (SEC_MOCHI_IN_ACC_IHB0_EN | \ 48031542fcSKonstantin Porotchkin SEC_MOCHI_IN_ACC_IHB1_EN | \ 49031542fcSKonstantin Porotchkin SEC_MOCHI_IN_ACC_IHB2_EN | \ 50031542fcSKonstantin Porotchkin SEC_MOCHI_IN_ACC_PIDI_EN) 5111e6ed09SKonstantin Porotchkin #define MOCHI_IN_ACC_LEVEL_FORCE_NONSEC (0) 5211e6ed09SKonstantin Porotchkin #define MOCHI_IN_ACC_LEVEL_FORCE_SEC (1) 5311e6ed09SKonstantin Porotchkin #define MOCHI_IN_ACC_LEVEL_LEAVE_ORIG (2) 5411e6ed09SKonstantin Porotchkin #define MOCHI_IN_ACC_LEVEL_MASK_ALL (3) 5511e6ed09SKonstantin Porotchkin #define SEC_MOCHI_IN_ACC_IHB0_LEVEL(l) ((l) << 1) 5611e6ed09SKonstantin Porotchkin #define SEC_MOCHI_IN_ACC_IHB1_LEVEL(l) ((l) << 4) 5711e6ed09SKonstantin Porotchkin #define SEC_MOCHI_IN_ACC_PIDI_LEVEL(l) ((l) << 10) 5811e6ed09SKonstantin Porotchkin 59031542fcSKonstantin Porotchkin 60031542fcSKonstantin Porotchkin /* SYSRST_OUTn Config definitions */ 61031542fcSKonstantin Porotchkin #define MVEBU_SYSRST_OUT_CONFIG_REG (MVEBU_MISC_SOC_BASE + 0x4) 62031542fcSKonstantin Porotchkin #define WD_MASK_SYS_RST_OUT (1 << 2) 63031542fcSKonstantin Porotchkin 64031542fcSKonstantin Porotchkin /* DSS PHY for DRAM */ 65031542fcSKonstantin Porotchkin #define DSS_SCR_REG (MVEBU_RFU_BASE + 0x208) 66031542fcSKonstantin Porotchkin #define DSS_PPROT_OFFS 4 67031542fcSKonstantin Porotchkin #define DSS_PPROT_MASK 0x7 68031542fcSKonstantin Porotchkin #define DSS_PPROT_PRIV_SECURE_DATA 0x1 69031542fcSKonstantin Porotchkin 70031542fcSKonstantin Porotchkin /* Used for Units of AP-807 (e.g. SDIO and etc) */ 71031542fcSKonstantin Porotchkin #define MVEBU_AXI_ATTR_BASE (MVEBU_REGS_BASE + 0x6F4580) 72031542fcSKonstantin Porotchkin #define MVEBU_AXI_ATTR_REG(index) (MVEBU_AXI_ATTR_BASE + \ 73031542fcSKonstantin Porotchkin 0x4 * index) 74031542fcSKonstantin Porotchkin 75*c82cf21dSKonstantin Porotchkin #define XOR_STREAM_ID_REG(ch) (MVEBU_REGS_BASE + 0x410010 + (ch) * 0x20000) 76*c82cf21dSKonstantin Porotchkin #define XOR_STREAM_ID_MASK 0xFFFF 77*c82cf21dSKonstantin Porotchkin #define SDIO_STREAM_ID_REG (MVEBU_RFU_BASE + 0x4600) 78*c82cf21dSKonstantin Porotchkin #define SDIO_STREAM_ID_MASK 0xFF 79*c82cf21dSKonstantin Porotchkin 80*c82cf21dSKonstantin Porotchkin /* Do not use the default Stream ID 0 */ 81*c82cf21dSKonstantin Porotchkin #define A807_STREAM_ID_BASE (0x1) 82*c82cf21dSKonstantin Porotchkin 83*c82cf21dSKonstantin Porotchkin static uintptr_t stream_id_reg[] = { 84*c82cf21dSKonstantin Porotchkin XOR_STREAM_ID_REG(0), 85*c82cf21dSKonstantin Porotchkin XOR_STREAM_ID_REG(1), 86*c82cf21dSKonstantin Porotchkin XOR_STREAM_ID_REG(2), 87*c82cf21dSKonstantin Porotchkin XOR_STREAM_ID_REG(3), 88*c82cf21dSKonstantin Porotchkin SDIO_STREAM_ID_REG, 89*c82cf21dSKonstantin Porotchkin 0 90*c82cf21dSKonstantin Porotchkin }; 91*c82cf21dSKonstantin Porotchkin 92031542fcSKonstantin Porotchkin enum axi_attr { 93031542fcSKonstantin Porotchkin AXI_SDIO_ATTR = 0, 94031542fcSKonstantin Porotchkin AXI_DFX_ATTR, 95031542fcSKonstantin Porotchkin AXI_MAX_ATTR, 96031542fcSKonstantin Porotchkin }; 97031542fcSKonstantin Porotchkin 98031542fcSKonstantin Porotchkin static void ap_sec_masters_access_en(uint32_t enable) 99031542fcSKonstantin Porotchkin { 100031542fcSKonstantin Porotchkin /* Open/Close incoming access for all masters. 101031542fcSKonstantin Porotchkin * The access is disabled in trusted boot mode 102031542fcSKonstantin Porotchkin * Could only be done in EL3 103031542fcSKonstantin Porotchkin */ 10411e6ed09SKonstantin Porotchkin if (enable != 0) { 10511e6ed09SKonstantin Porotchkin mmio_clrsetbits_32(SEC_MOCHI_IN_ACC_REG, 0x0U, /* no clear */ 106031542fcSKonstantin Porotchkin SEC_IN_ACCESS_ENA_ALL_MASTERS); 10711e6ed09SKonstantin Porotchkin #if LLC_SRAM 10811e6ed09SKonstantin Porotchkin /* Do not change access security level 10911e6ed09SKonstantin Porotchkin * for PIDI masters 11011e6ed09SKonstantin Porotchkin */ 11111e6ed09SKonstantin Porotchkin mmio_clrsetbits_32(SEC_MOCHI_IN_ACC_REG, 11211e6ed09SKonstantin Porotchkin SEC_MOCHI_IN_ACC_PIDI_LEVEL( 11311e6ed09SKonstantin Porotchkin MOCHI_IN_ACC_LEVEL_MASK_ALL), 11411e6ed09SKonstantin Porotchkin SEC_MOCHI_IN_ACC_PIDI_LEVEL( 11511e6ed09SKonstantin Porotchkin MOCHI_IN_ACC_LEVEL_LEAVE_ORIG)); 11611e6ed09SKonstantin Porotchkin #endif 11711e6ed09SKonstantin Porotchkin } else { 11811e6ed09SKonstantin Porotchkin mmio_clrsetbits_32(SEC_MOCHI_IN_ACC_REG, 11911e6ed09SKonstantin Porotchkin SEC_IN_ACCESS_ENA_ALL_MASTERS, 12011e6ed09SKonstantin Porotchkin 0x0U /* no set */); 12111e6ed09SKonstantin Porotchkin #if LLC_SRAM 12211e6ed09SKonstantin Porotchkin /* Return PIDI access level to the default */ 12311e6ed09SKonstantin Porotchkin mmio_clrsetbits_32(SEC_MOCHI_IN_ACC_REG, 12411e6ed09SKonstantin Porotchkin SEC_MOCHI_IN_ACC_PIDI_LEVEL( 12511e6ed09SKonstantin Porotchkin MOCHI_IN_ACC_LEVEL_MASK_ALL), 12611e6ed09SKonstantin Porotchkin SEC_MOCHI_IN_ACC_PIDI_LEVEL( 12711e6ed09SKonstantin Porotchkin MOCHI_IN_ACC_LEVEL_FORCE_NONSEC)); 12811e6ed09SKonstantin Porotchkin #endif 12911e6ed09SKonstantin Porotchkin } 130031542fcSKonstantin Porotchkin } 131031542fcSKonstantin Porotchkin 132031542fcSKonstantin Porotchkin static void setup_smmu(void) 133031542fcSKonstantin Porotchkin { 134031542fcSKonstantin Porotchkin uint32_t reg; 135031542fcSKonstantin Porotchkin 136031542fcSKonstantin Porotchkin /* Set the SMMU page size to 64 KB */ 137031542fcSKonstantin Porotchkin reg = mmio_read_32(SMMU_sACR); 138031542fcSKonstantin Porotchkin reg |= SMMU_sACR_PG_64K; 139031542fcSKonstantin Porotchkin mmio_write_32(SMMU_sACR, reg); 140031542fcSKonstantin Porotchkin } 141031542fcSKonstantin Porotchkin 142031542fcSKonstantin Porotchkin static void init_aurora2(void) 143031542fcSKonstantin Porotchkin { 144031542fcSKonstantin Porotchkin uint32_t reg; 145031542fcSKonstantin Porotchkin 146031542fcSKonstantin Porotchkin /* Enable GSPMU control by CPU */ 147031542fcSKonstantin Porotchkin reg = mmio_read_32(CCU_GSPMU_CR); 148031542fcSKonstantin Porotchkin reg |= GSPMU_CPU_CONTROL; 149031542fcSKonstantin Porotchkin mmio_write_32(CCU_GSPMU_CR, reg); 150031542fcSKonstantin Porotchkin 151031542fcSKonstantin Porotchkin #if LLC_ENABLE 152031542fcSKonstantin Porotchkin /* Enable LLC for AP807 in exclusive mode */ 153031542fcSKonstantin Porotchkin llc_enable(0, 1); 154031542fcSKonstantin Porotchkin 155031542fcSKonstantin Porotchkin /* Set point of coherency to DDR. 156031542fcSKonstantin Porotchkin * This is required by units which have 157031542fcSKonstantin Porotchkin * SW cache coherency 158031542fcSKonstantin Porotchkin */ 159031542fcSKonstantin Porotchkin reg = mmio_read_32(CCU_HTC_CR); 160031542fcSKonstantin Porotchkin reg |= (0x1 << CCU_SET_POC_OFFSET); 161031542fcSKonstantin Porotchkin mmio_write_32(CCU_HTC_CR, reg); 162031542fcSKonstantin Porotchkin #endif /* LLC_ENABLE */ 1635e4c97d0SStefan Chulski 1645e4c97d0SStefan Chulski errata_wa_init(); 165031542fcSKonstantin Porotchkin } 166031542fcSKonstantin Porotchkin 167031542fcSKonstantin Porotchkin 168031542fcSKonstantin Porotchkin /* MCIx indirect access register are based by default at 0xf4000000/0xf6000000 169031542fcSKonstantin Porotchkin * to avoid conflict of internal registers of units connected via MCIx, which 170031542fcSKonstantin Porotchkin * can be based on the same address (i.e CP1 base is also 0xf4000000), 171031542fcSKonstantin Porotchkin * the following routines remaps the MCIx indirect bases to another domain 172031542fcSKonstantin Porotchkin */ 173031542fcSKonstantin Porotchkin static void mci_remap_indirect_access_base(void) 174031542fcSKonstantin Porotchkin { 175031542fcSKonstantin Porotchkin uint32_t mci; 176031542fcSKonstantin Porotchkin 177031542fcSKonstantin Porotchkin for (mci = 0; mci < MCI_MAX_UNIT_ID; mci++) 1782da75ae1SGrzegorz Jaszczyk mmio_write_32(MCIX4_807_REG_START_ADDR_REG(mci), 179031542fcSKonstantin Porotchkin MVEBU_MCI_REG_BASE_REMAP(mci) >> 180031542fcSKonstantin Porotchkin MCI_REMAP_OFF_SHIFT); 181031542fcSKonstantin Porotchkin } 182031542fcSKonstantin Porotchkin 183*c82cf21dSKonstantin Porotchkin /* Set a unique stream id for all DMA capable devices */ 184*c82cf21dSKonstantin Porotchkin static void ap807_stream_id_init(void) 185*c82cf21dSKonstantin Porotchkin { 186*c82cf21dSKonstantin Porotchkin uint32_t i; 187*c82cf21dSKonstantin Porotchkin 188*c82cf21dSKonstantin Porotchkin for (i = 0; 189*c82cf21dSKonstantin Porotchkin stream_id_reg[i] != 0 && i < ARRAY_SIZE(stream_id_reg); i++) { 190*c82cf21dSKonstantin Porotchkin uint32_t mask = stream_id_reg[i] == SDIO_STREAM_ID_REG ? 191*c82cf21dSKonstantin Porotchkin SDIO_STREAM_ID_MASK : XOR_STREAM_ID_MASK; 192*c82cf21dSKonstantin Porotchkin 193*c82cf21dSKonstantin Porotchkin mmio_clrsetbits_32(stream_id_reg[i], mask, 194*c82cf21dSKonstantin Porotchkin i + A807_STREAM_ID_BASE); 195*c82cf21dSKonstantin Porotchkin } 196*c82cf21dSKonstantin Porotchkin } 197*c82cf21dSKonstantin Porotchkin 198031542fcSKonstantin Porotchkin static void ap807_axi_attr_init(void) 199031542fcSKonstantin Porotchkin { 200031542fcSKonstantin Porotchkin uint32_t index, data; 201031542fcSKonstantin Porotchkin 202031542fcSKonstantin Porotchkin /* Initialize AXI attributes for AP807 */ 203031542fcSKonstantin Porotchkin /* Go over the AXI attributes and set Ax-Cache and Ax-Domain */ 204031542fcSKonstantin Porotchkin for (index = 0; index < AXI_MAX_ATTR; index++) { 205031542fcSKonstantin Porotchkin switch (index) { 206031542fcSKonstantin Porotchkin /* DFX works with no coherent only - 207031542fcSKonstantin Porotchkin * there's no option to configure the Ax-Cache and Ax-Domain 208031542fcSKonstantin Porotchkin */ 209031542fcSKonstantin Porotchkin case AXI_DFX_ATTR: 210031542fcSKonstantin Porotchkin continue; 211031542fcSKonstantin Porotchkin default: 212031542fcSKonstantin Porotchkin /* Set Ax-Cache as cacheable, no allocate, modifiable, 213031542fcSKonstantin Porotchkin * bufferable. 214031542fcSKonstantin Porotchkin * The values are different because Read & Write 215031542fcSKonstantin Porotchkin * definition is different in Ax-Cache 216031542fcSKonstantin Porotchkin */ 217031542fcSKonstantin Porotchkin data = mmio_read_32(MVEBU_AXI_ATTR_REG(index)); 218031542fcSKonstantin Porotchkin data &= ~MVEBU_AXI_ATTR_ARCACHE_MASK; 219031542fcSKonstantin Porotchkin data |= (CACHE_ATTR_WRITE_ALLOC | 220031542fcSKonstantin Porotchkin CACHE_ATTR_CACHEABLE | 221031542fcSKonstantin Porotchkin CACHE_ATTR_BUFFERABLE) << 222031542fcSKonstantin Porotchkin MVEBU_AXI_ATTR_ARCACHE_OFFSET; 223031542fcSKonstantin Porotchkin data &= ~MVEBU_AXI_ATTR_AWCACHE_MASK; 224031542fcSKonstantin Porotchkin data |= (CACHE_ATTR_READ_ALLOC | 225031542fcSKonstantin Porotchkin CACHE_ATTR_CACHEABLE | 226031542fcSKonstantin Porotchkin CACHE_ATTR_BUFFERABLE) << 227031542fcSKonstantin Porotchkin MVEBU_AXI_ATTR_AWCACHE_OFFSET; 228031542fcSKonstantin Porotchkin /* Set Ax-Domain as Outer domain */ 229031542fcSKonstantin Porotchkin data &= ~MVEBU_AXI_ATTR_ARDOMAIN_MASK; 230031542fcSKonstantin Porotchkin data |= DOMAIN_OUTER_SHAREABLE << 231031542fcSKonstantin Porotchkin MVEBU_AXI_ATTR_ARDOMAIN_OFFSET; 232031542fcSKonstantin Porotchkin data &= ~MVEBU_AXI_ATTR_AWDOMAIN_MASK; 233031542fcSKonstantin Porotchkin data |= DOMAIN_OUTER_SHAREABLE << 234031542fcSKonstantin Porotchkin MVEBU_AXI_ATTR_AWDOMAIN_OFFSET; 235031542fcSKonstantin Porotchkin mmio_write_32(MVEBU_AXI_ATTR_REG(index), data); 236031542fcSKonstantin Porotchkin } 237031542fcSKonstantin Porotchkin } 238031542fcSKonstantin Porotchkin } 239031542fcSKonstantin Porotchkin 240031542fcSKonstantin Porotchkin static void misc_soc_configurations(void) 241031542fcSKonstantin Porotchkin { 242031542fcSKonstantin Porotchkin uint32_t reg; 243031542fcSKonstantin Porotchkin 244031542fcSKonstantin Porotchkin /* Enable 48-bit VA */ 245031542fcSKonstantin Porotchkin mmio_setbits_32(DSS_CR0, DVM_48BIT_VA_ENABLE); 246031542fcSKonstantin Porotchkin 247031542fcSKonstantin Porotchkin /* Un-mask Watchdog reset from influencing the SYSRST_OUTn. 248031542fcSKonstantin Porotchkin * Otherwise, upon WD timeout, the WD reset signal won't trigger reset 249031542fcSKonstantin Porotchkin */ 250031542fcSKonstantin Porotchkin reg = mmio_read_32(MVEBU_SYSRST_OUT_CONFIG_REG); 251031542fcSKonstantin Porotchkin reg &= ~(WD_MASK_SYS_RST_OUT); 252031542fcSKonstantin Porotchkin mmio_write_32(MVEBU_SYSRST_OUT_CONFIG_REG, reg); 253031542fcSKonstantin Porotchkin } 254031542fcSKonstantin Porotchkin 255c3c51b32SGrzegorz Jaszczyk /* 256c3c51b32SGrzegorz Jaszczyk * By default all external CPs start with configuration address space set to 257c3c51b32SGrzegorz Jaszczyk * 0xf200_0000. To overcome this issue, go in the loop and initialize the 258c3c51b32SGrzegorz Jaszczyk * CP one by one, using temporary window configuration which allows to access 259c3c51b32SGrzegorz Jaszczyk * each CP and update its configuration space according to decoding 260c3c51b32SGrzegorz Jaszczyk * windows scheme defined for each platform. 261c3c51b32SGrzegorz Jaszczyk */ 262c3c51b32SGrzegorz Jaszczyk void update_cp110_default_win(int cp_id) 263c3c51b32SGrzegorz Jaszczyk { 264c3c51b32SGrzegorz Jaszczyk int mci_id = cp_id - 1; 265c3c51b32SGrzegorz Jaszczyk uintptr_t cp110_base, cp110_temp_base; 266c3c51b32SGrzegorz Jaszczyk 267c3c51b32SGrzegorz Jaszczyk /* CP110 default configuration address space */ 268c3c51b32SGrzegorz Jaszczyk cp110_temp_base = MVEBU_AP_IO_BASE(MVEBU_AP0); 269c3c51b32SGrzegorz Jaszczyk 270c3c51b32SGrzegorz Jaszczyk struct addr_map_win iowin_temp_win = { 271c3c51b32SGrzegorz Jaszczyk .base_addr = cp110_temp_base, 272c3c51b32SGrzegorz Jaszczyk .win_size = MVEBU_CP_OFFSET, 273c3c51b32SGrzegorz Jaszczyk }; 274c3c51b32SGrzegorz Jaszczyk 275c3c51b32SGrzegorz Jaszczyk iowin_temp_win.target_id = mci_id; 276c3c51b32SGrzegorz Jaszczyk iow_temp_win_insert(0, &iowin_temp_win, 1); 277c3c51b32SGrzegorz Jaszczyk 278c3c51b32SGrzegorz Jaszczyk /* Calculate the new CP110 - base address */ 279c3c51b32SGrzegorz Jaszczyk cp110_base = MVEBU_CP_REGS_BASE(cp_id); 280c3c51b32SGrzegorz Jaszczyk /* Go and update the CP110 configuration address space */ 281c3c51b32SGrzegorz Jaszczyk iob_cfg_space_update(0, cp_id, cp110_temp_base, cp110_base); 282c3c51b32SGrzegorz Jaszczyk 283c3c51b32SGrzegorz Jaszczyk /* Remove the temporary IO-WIN window */ 284c3c51b32SGrzegorz Jaszczyk iow_temp_win_remove(0, &iowin_temp_win, 1); 285c3c51b32SGrzegorz Jaszczyk } 286c3c51b32SGrzegorz Jaszczyk 287031542fcSKonstantin Porotchkin void ap_init(void) 288031542fcSKonstantin Porotchkin { 289031542fcSKonstantin Porotchkin /* Setup Aurora2. */ 290031542fcSKonstantin Porotchkin init_aurora2(); 291031542fcSKonstantin Porotchkin 292031542fcSKonstantin Porotchkin /* configure MCI mapping */ 293031542fcSKonstantin Porotchkin mci_remap_indirect_access_base(); 294031542fcSKonstantin Porotchkin 295031542fcSKonstantin Porotchkin /* configure IO_WIN windows */ 296031542fcSKonstantin Porotchkin init_io_win(MVEBU_AP0); 297031542fcSKonstantin Porotchkin 298031542fcSKonstantin Porotchkin /* configure CCU windows */ 299031542fcSKonstantin Porotchkin init_ccu(MVEBU_AP0); 300031542fcSKonstantin Porotchkin 301*c82cf21dSKonstantin Porotchkin /* Set the stream IDs for DMA masters */ 302*c82cf21dSKonstantin Porotchkin ap807_stream_id_init(); 303*c82cf21dSKonstantin Porotchkin 304031542fcSKonstantin Porotchkin /* configure the SMMU */ 305031542fcSKonstantin Porotchkin setup_smmu(); 306031542fcSKonstantin Porotchkin 307031542fcSKonstantin Porotchkin /* Open AP incoming access for all masters */ 308031542fcSKonstantin Porotchkin ap_sec_masters_access_en(1); 309031542fcSKonstantin Porotchkin 310031542fcSKonstantin Porotchkin /* configure axi for AP */ 311031542fcSKonstantin Porotchkin ap807_axi_attr_init(); 312031542fcSKonstantin Porotchkin 313031542fcSKonstantin Porotchkin /* misc configuration of the SoC */ 314031542fcSKonstantin Porotchkin misc_soc_configurations(); 315031542fcSKonstantin Porotchkin } 316031542fcSKonstantin Porotchkin 317031542fcSKonstantin Porotchkin static void ap807_dram_phy_access_config(void) 318031542fcSKonstantin Porotchkin { 319031542fcSKonstantin Porotchkin uint32_t reg_val; 320031542fcSKonstantin Porotchkin /* Update DSS port access permission to DSS_PHY */ 321031542fcSKonstantin Porotchkin reg_val = mmio_read_32(DSS_SCR_REG); 322031542fcSKonstantin Porotchkin reg_val &= ~(DSS_PPROT_MASK << DSS_PPROT_OFFS); 323031542fcSKonstantin Porotchkin reg_val |= ((DSS_PPROT_PRIV_SECURE_DATA & DSS_PPROT_MASK) << 324031542fcSKonstantin Porotchkin DSS_PPROT_OFFS); 325031542fcSKonstantin Porotchkin mmio_write_32(DSS_SCR_REG, reg_val); 326031542fcSKonstantin Porotchkin } 327031542fcSKonstantin Porotchkin 328031542fcSKonstantin Porotchkin void ap_ble_init(void) 329031542fcSKonstantin Porotchkin { 330031542fcSKonstantin Porotchkin /* Enable DSS port */ 331031542fcSKonstantin Porotchkin ap807_dram_phy_access_config(); 332031542fcSKonstantin Porotchkin } 333031542fcSKonstantin Porotchkin 334031542fcSKonstantin Porotchkin int ap_get_count(void) 335031542fcSKonstantin Porotchkin { 336031542fcSKonstantin Porotchkin return 1; 337031542fcSKonstantin Porotchkin } 338031542fcSKonstantin Porotchkin 339031542fcSKonstantin Porotchkin 340