1 // SPDX-License-Identifier: GPL-2.0+
3 * (C) Copyright 2020 - Cortina Access Inc.
12 #include <linux/bitops.h>
13 #include <linux/compiler.h>
14 #include <configs/presidio_asic.h>
15 #include <linux/psci.h>
18 #include <asm/armv8/mmu.h>
20 DECLARE_GLOBAL_DATA_PTR;
22 #define CA_PERIPH_BASE 0xE0000000UL
23 #define CA_PERIPH_SIZE 0x20000000UL
24 #define CA_GLOBAL_BASE 0xf4320000
25 #define CA_GLOBAL_JTAG_ID 0xf4320000
26 #define CA_GLOBAL_BLOCK_RESET 0xf4320004
27 #define CA_GLOBAL_BLOCK_RESET_RESET_DMA BIT(16)
28 #define CA_DMA_SEC_SSP_BAUDRATE_CTRL 0xf7001b94
29 #define CA_DMA_SEC_SSP_ID 0xf7001b80
31 int print_cpuinfo(void)
33 printf("CPU: Cortina Presidio G3\n");
37 static struct mm_region presidio_mem_map[] = {
41 .size = PHYS_SDRAM_1_SIZE,
42 .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
46 .virt = CA_PERIPH_BASE,
47 .phys = CA_PERIPH_BASE,
48 .size = CA_PERIPH_SIZE,
49 .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
58 struct mm_region *mem_map = presidio_mem_map;
60 static noinline int invoke_psci_fn_smc(u64 function_id, u64 arg0, u64 arg1,
63 asm volatile("mov x0, %0\n"
69 : "r" (arg0), "r" (arg1), "r" (arg2)
75 int board_early_init_r(void)
83 unsigned int reg_data, jtag_id;
86 writel(1, CONFIG_SYS_TIMER_BASE);
88 /* Enable snoop in CCI400 slave port#4 */
89 writel(3, 0xF5595000);
91 jtag_id = readl(CA_GLOBAL_JTAG_ID);
93 /* If this is HGU variant then do not use
94 * the Saturn daughter card ref. clk
96 if (jtag_id == 0x1010D8F3) {
97 reg_data = readl(0xF3100064);
98 /* change multifunc. REF CLK pin to
101 reg_data |= (1 << 1);
102 writel(reg_data, 0xf3100064);
110 unsigned int ddr_size;
112 ddr_size = readl(0x111100c);
113 gd->ram_size = ddr_size * 0x100000;
117 void reset_cpu(ulong addr)
119 invoke_psci_fn_smc(PSCI_0_2_FN_SYSTEM_RESET, 0, 0, 0);
122 #ifdef CONFIG_LAST_STAGE_INIT
123 int last_stage_init(void)
127 val = readl(CA_GLOBAL_BLOCK_RESET);
128 val &= ~CA_GLOBAL_BLOCK_RESET_RESET_DMA;
129 writel(val, CA_GLOBAL_BLOCK_RESET);
131 /* reduce output pclk ~3.7Hz to save power consumption */
132 writel(0x000000FF, CA_DMA_SEC_SSP_BAUDRATE_CTRL);