1 // SPDX-License-Identifier: GPL-2.0+
3 * (C) Copyright 2020 - Cortina Access Inc.
12 #include <linux/compiler.h>
13 #include <configs/presidio_asic.h>
14 #include <linux/psci.h>
17 #include <asm/armv8/mmu.h>
19 DECLARE_GLOBAL_DATA_PTR;
21 #define CA_PERIPH_BASE 0xE0000000UL
22 #define CA_PERIPH_SIZE 0x20000000UL
23 #define CA_GLOBAL_BASE 0xf4320000
24 #define CA_GLOBAL_JTAG_ID 0xf4320000
25 #define CA_GLOBAL_BLOCK_RESET 0xf4320004
26 #define CA_GLOBAL_BLOCK_RESET_RESET_DMA BIT(16)
27 #define CA_DMA_SEC_SSP_BAUDRATE_CTRL 0xf7001b94
28 #define CA_DMA_SEC_SSP_ID 0xf7001b80
30 int print_cpuinfo(void)
32 printf("CPU: Cortina Presidio G3\n");
36 static struct mm_region presidio_mem_map[] = {
40 .size = PHYS_SDRAM_1_SIZE,
41 .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
45 .virt = CA_PERIPH_BASE,
46 .phys = CA_PERIPH_BASE,
47 .size = CA_PERIPH_SIZE,
48 .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
57 struct mm_region *mem_map = presidio_mem_map;
59 static noinline int invoke_psci_fn_smc(u64 function_id, u64 arg0, u64 arg1,
62 asm volatile("mov x0, %0\n"
68 : "r" (arg0), "r" (arg1), "r" (arg2)
74 int board_early_init_r(void)
82 unsigned int reg_data, jtag_id;
85 writel(1, CONFIG_SYS_TIMER_BASE);
87 /* Enable snoop in CCI400 slave port#4 */
88 writel(3, 0xF5595000);
90 jtag_id = readl(CA_GLOBAL_JTAG_ID);
92 /* If this is HGU variant then do not use
93 * the Saturn daughter card ref. clk
95 if (jtag_id == 0x1010D8F3) {
96 reg_data = readl(0xF3100064);
97 /* change multifunc. REF CLK pin to
100 reg_data |= (1 << 1);
101 writel(reg_data, 0xf3100064);
109 unsigned int ddr_size;
111 ddr_size = readl(0x111100c);
112 gd->ram_size = ddr_size * 0x100000;
116 void reset_cpu(ulong addr)
118 invoke_psci_fn_smc(PSCI_0_2_FN_SYSTEM_RESET, 0, 0, 0);
121 #ifdef CONFIG_LAST_STAGE_INIT
122 int last_stage_init(void)
126 val = readl(CA_GLOBAL_BLOCK_RESET);
127 val &= ~CA_GLOBAL_BLOCK_RESET_RESET_DMA;
128 writel(val, CA_GLOBAL_BLOCK_RESET);
130 /* reduce output pclk ~3.7Hz to save power consumption */
131 writel(0x000000FF, CA_DMA_SEC_SSP_BAUDRATE_CTRL);