coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
ccplex.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <device/mmio.h>
4 #include <console/console.h>
5 #include <soc/addressmap.h>
6 #include <soc/clock.h>
7 #include <soc/clk_rst.h>
8 #include <soc/ccplex.h>
9 #include <soc/cpu.h>
10 #include <soc/flow.h>
11 #include <soc/mc.h>
12 #include <soc/pmc.h>
13 #include <soc/power.h>
14 #include <soc/romstage.h>
15 #include <timer.h>
16 
17 #define PMC_REGS (void *)(uintptr_t)(TEGRA_PMC_BASE)
18 
19 static void enable_cpu_clocks(void)
20 {
22  SET_CLK_ENB_CPULP_ENABLE, 0, 0, 0);
23 }
24 
25 static void enable_cpu_power_partitions(void)
26 {
27  /* Bring up fast cluster, non-CPU, CPU0, CPU1, CPU2 and CPU3 parts. */
31 
32  if (CONFIG(ARM64_USE_ARM_TRUSTED_FIRMWARE)) {
33  /*
34  * Deassert reset signal of all the secondary CPUs.
35  * PMC and flow controller will take over the power sequence
36  * controller in the ATF.
37  */
44  write32(CLK_RST_REG(rst_cpug_cmplx_clr), reg);
45  }
46 }
47 
48 static void request_ram_repair(void)
49 {
50  struct flow_ctlr * const flow = (void *)(uintptr_t)TEGRA_FLOW_BASE;
51  const uint32_t req = 1 << 0;
52  const uint32_t sts = 1 << 1;
53  uint32_t reg;
54  struct stopwatch sw;
55 
56  printk(BIOS_DEBUG, "Requesting RAM repair.\n");
57 
58  stopwatch_init(&sw);
59 
60  /* Perform RAM repair */
61  reg = read32(&flow->ram_repair);
62  reg |= req;
63  write32(&flow->ram_repair, reg);
64  while ((read32(&flow->ram_repair) & sts) != sts)
65  ;
66 
67  printk(BIOS_DEBUG, "RAM repair complete in %ld usecs.\n",
69 }
70 
72 {
73  uint32_t reg;
74 
75  reg = read32(CLK_RST_REG(cpu_softrst_ctrl2));
77  reg |= val;
78  write32(CLK_RST_REG(cpu_softrst_ctrl2), reg);
79 }
80 
82 {
84 
85  /*
86  * The POR value of CAR2PMC_CPU_ACK_WIDTH is 0x200.
87  * The recommended value is 0.
88  */
90 
92 
95 
97 }
98 
99 static void start_common_clocks(void)
100 {
101  /* Clear fast CPU partition reset. */
102  write32(CLK_RST_REG(rst_cpug_cmplx_clr), CRC_RST_CPUG_CLR_NONCPU);
103 
104  /* Clear reset of L2 and CoreSight components. */
105  write32(CLK_RST_REG(rst_cpug_cmplx_clr),
107 }
108 
109 void ccplex_cpu_start(void *entry_addr)
110 {
111  /* Enable common clocks for the shared resources between the cores. */
113 
114  start_cpu(0, entry_addr);
115 }
static void write32(void *addr, uint32_t val)
Definition: mmio.h:40
static uint32_t read32(const void *addr)
Definition: mmio.h:22
static void enable_cpu_clocks(void)
Definition: ccplex.c:19
static void request_ram_repair(void)
Definition: ccplex.c:48
static void set_cpu_ack_width(uint32_t val)
Definition: ccplex.c:71
static void start_common_clocks(void)
Definition: ccplex.c:99
void ccplex_cpu_start(void *entry_addr)
Definition: ccplex.c:109
void ccplex_cpu_prepare(void)
Definition: ccplex.c:81
static void enable_cpu_power_partitions(void)
Definition: ccplex.c:25
#define printk(level,...)
Definition: stdlib.h:16
@ CONFIG
Definition: dsi_common.h:201
static void stopwatch_init(struct stopwatch *sw)
Definition: timer.h:117
static long stopwatch_duration_usecs(struct stopwatch *sw)
Definition: timer.h:170
static int start_cpu(struct device *cpu)
#define BIOS_DEBUG
BIOS_DEBUG - Verbose output.
Definition: loglevel.h:128
void mainboard_enable_vdd_cpu(void)
Definition: romstage.c:19
void mainboard_configure_pmc(void)
Definition: romstage.c:15
@ POWER_PARTID_CE0
Definition: pmc.h:20
@ POWER_PARTID_C0NC
Definition: pmc.h:21
@ POWER_PARTID_CRAIL
Definition: pmc.h:9
static void power_ungate_partition(uint32_t id)
Definition: power.c:24
static struct flow_ctlr * flow
Definition: clock.c:18
@ TEGRA_FLOW_BASE
Definition: addressmap.h:22
#define clock_enable(l, h, u, v, w, x, y)
Definition: clock.h:333
unsigned int uint32_t
Definition: stdint.h:14
unsigned long uintptr_t
Definition: stdint.h:21
Definition: flow.h:6
u32 ram_repair
Definition: flow.h:23
u8 val
Definition: sys.c:300
#define CLK_ENB_CPU
Definition: clk_rst.h:295
@ CRC_RST_CPUG_CLR_NONCPU
Definition: clk_rst.h:522
@ CRC_RST_CPUG_CLR_CX2
Definition: clk_rst.h:519
@ CRC_RST_CPUG_CLR_CPU2
Definition: clk_rst.h:507
@ CRC_RST_CPUG_CLR_CORE2
Definition: clk_rst.h:515
@ CRC_RST_CPUG_CLR_L2
Definition: clk_rst.h:521
@ CRC_RST_CPUG_CLR_CORE1
Definition: clk_rst.h:514
@ CRC_RST_CPUG_CLR_DBG2
Definition: clk_rst.h:511
@ CRC_RST_CPUG_CLR_CX1
Definition: clk_rst.h:518
@ CRC_RST_CPUG_CLR_CPU1
Definition: clk_rst.h:506
@ CRC_RST_CPUG_CLR_CPU3
Definition: clk_rst.h:508
@ CRC_RST_CPUG_CLR_DBG3
Definition: clk_rst.h:512
@ CRC_RST_CPUG_CLR_CX3
Definition: clk_rst.h:520
@ CRC_RST_CPUG_CLR_PDBG
Definition: clk_rst.h:523
@ CRC_RST_CPUG_CLR_DBG1
Definition: clk_rst.h:510
@ CRC_RST_CPUG_CLR_CORE3
Definition: clk_rst.h:516
#define SET_CLK_ENB_CPULP_ENABLE
Definition: clk_rst.h:471
#define SET_CLK_ENB_CPUG_ENABLE
Definition: clk_rst.h:470
#define CAR2PMC_CPU_ACK_WIDTH_MASK
Definition: clk_rst.h:524
#define CLK_RST_REG(field_)
Definition: clk_rst.h:303