mb/starlabs/starlite_adl: Configure GPIO interrupt for Virtual Button
[coreboot2.git] / src / soc / nvidia / tegra124 / bootblock.c
blobcd8cf8537cdc5c6f6e3e28fe5e1acb04c5f68ee5
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <assert.h>
4 #include <arch/exception.h>
5 #include <arch/stages.h>
6 #include <bootblock_common.h>
7 #include <console/console.h>
8 #include <program_loading.h>
9 #include <soc/clock.h>
10 #include <soc/nvidia/tegra/apbmisc.h>
11 #include <soc/pinmux.h>
12 #include <soc/power.h>
13 #include <timestamp.h>
14 #include <vendorcode/google/chromeos/chromeos.h>
16 /* called from assembly in bootblock_asm.S */
17 void tegra124_main(void);
19 static void run_next_stage(void *entry)
21 ASSERT(entry);
22 clock_cpu0_config(entry);
24 power_enable_and_ungate_cpu();
26 /* Repair RAM on cluster0 and cluster1 after CPU is powered on. */
27 ram_repair();
29 clock_cpu0_remove_reset();
31 clock_halt_avp();
34 void tegra124_main(void)
36 // enable pinmux clamp inputs
37 clamp_tristate_inputs();
39 // enable JTAG at the earliest stage
40 enable_jtag();
42 clock_early_uart();
44 // Serial out, tristate off.
45 pinmux_set_config(PINMUX_KB_ROW9_INDEX, PINMUX_KB_ROW9_FUNC_UA3);
46 // Serial in, tristate_on.
47 pinmux_set_config(PINMUX_KB_ROW10_INDEX, PINMUX_KB_ROW10_FUNC_UA3 |
48 PINMUX_PULL_UP |
49 PINMUX_INPUT_ENABLE);
50 // Mux some pins away from uart A.
51 pinmux_set_config(PINMUX_UART2_CTS_N_INDEX,
52 PINMUX_UART2_CTS_N_FUNC_UB3 |
53 PINMUX_INPUT_ENABLE);
54 pinmux_set_config(PINMUX_UART2_RTS_N_INDEX,
55 PINMUX_UART2_RTS_N_FUNC_UB3);
57 if (CONFIG(BOOTBLOCK_CONSOLE)) {
58 console_init();
59 exception_init();
62 clock_init();
64 bootblock_mainboard_init();
66 pinmux_set_config(PINMUX_CORE_PWR_REQ_INDEX,
67 PINMUX_CORE_PWR_REQ_FUNC_PWRON);
68 pinmux_set_config(PINMUX_CPU_PWR_REQ_INDEX,
69 PINMUX_CPU_PWR_REQ_FUNC_CPU);
70 pinmux_set_config(PINMUX_PWR_INT_N_INDEX,
71 PINMUX_PWR_INT_N_FUNC_PMICINTR |
72 PINMUX_INPUT_ENABLE);
74 timestamp_init(0);
76 run_romstage();
79 void platform_prog_run(struct prog *prog)
81 run_next_stage(prog_entry(prog));