1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <device/mmio.h>
4 #include <bootblock_common.h>
5 #include <console/uart.h>
6 #include <soc/ti/am335x/clock.h>
7 #include <soc/ti/am335x/gpio.h>
8 #include <soc/ti/am335x/pinmux.h>
12 void bootblock_mainboard_early_init(void)
14 write32(&am335x_cm_wkup
->wkup_gpio0
, CM_ST_SW_WKUP
| CM_FCLK_EN
);
15 write32(&am335x_cm_per
->gpio1
, CM_ST_SW_WKUP
| CM_FCLK_EN
);
16 write32(&am335x_cm_per
->gpio2
, CM_ST_SW_WKUP
| CM_FCLK_EN
);
17 write32(&am335x_cm_per
->gpio3
, CM_ST_SW_WKUP
| CM_FCLK_EN
);
19 am335x_disable_gpio_irqs();
21 beaglebone_leds_init();
22 beaglebone_leds_set(BEAGLEBONE_LED_USR0
, 1);
23 beaglebone_leds_set(BEAGLEBONE_LED_USR1
, 0);
24 beaglebone_leds_set(BEAGLEBONE_LED_USR2
, 1);
25 beaglebone_leds_set(BEAGLEBONE_LED_USR3
, 0);
27 /* Set up the UART we're going to use */
28 if (CONFIG_UART_FOR_CONSOLE
== 0) {
29 am335x_pinmux_uart0();
30 write32(&am335x_cm_wkup
->wkup_uart0
, CM_ST_SW_WKUP
);
31 } else if (CONFIG_UART_FOR_CONSOLE
== 1) {
32 am335x_pinmux_uart1();
33 write32(&am335x_cm_per
->uart1
, CM_ST_SW_WKUP
);
34 } else if (CONFIG_UART_FOR_CONSOLE
== 2) {
35 am335x_pinmux_uart2();
36 write32(&am335x_cm_per
->uart2
, CM_ST_SW_WKUP
);
37 } else if (CONFIG_UART_FOR_CONSOLE
== 3) {
38 am335x_pinmux_uart3();
39 write32(&am335x_cm_per
->uart3
, CM_ST_SW_WKUP
);
40 } else if (CONFIG_UART_FOR_CONSOLE
== 4) {
41 am335x_pinmux_uart4();
42 write32(&am335x_cm_per
->uart4
, CM_ST_SW_WKUP
);
43 } else if (CONFIG_UART_FOR_CONSOLE
== 5) {
44 am335x_pinmux_uart5();
45 write32(&am335x_cm_per
->uart5
, CM_ST_SW_WKUP
);
48 /* Start monotonic timer */