]> git.ipfire.org Git - thirdparty/u-boot.git/blobdiff - arch/arm/mach-rockchip/rk322x-board.c
CONFIG_SPL_SYS_[DI]CACHE_OFF: add
[thirdparty/u-boot.git] / arch / arm / mach-rockchip / rk322x-board.c
index dcd8cf805fe51aa2a1d2fa25aefdb6a3e37a758b..e7a1e54874d6d01641c730d477e1b03f01283fb8 100644 (file)
@@ -1,7 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * (C) Copyright 2017 Rockchip Electronics Co., Ltd.
- *
- * SPDX-License-Identifier:     GPL-2.0+
  */
 #include <common.h>
 #include <clk.h>
@@ -9,37 +8,13 @@
 #include <ram.h>
 #include <syscon.h>
 #include <asm/io.h>
-#include <asm/arch/clock.h>
-#include <asm/arch/periph.h>
-#include <asm/arch/grf_rk322x.h>
-#include <asm/arch/boot_mode.h>
+#include <asm/arch-rockchip/boot_mode.h>
+#include <asm/arch-rockchip/clock.h>
+#include <asm/arch-rockchip/grf_rk322x.h>
+#include <asm/arch-rockchip/periph.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#define GRF_BASE       0x11000000
-
-static void setup_boot_mode(void)
-{
-       struct rk322x_grf *const grf = (void *)GRF_BASE;
-       int boot_mode = readl(&grf->os_reg[4]);
-
-       debug("boot mode %x.\n", boot_mode);
-
-       /* Clear boot mode */
-       writel(BOOT_NORMAL, &grf->os_reg[4]);
-
-       switch (boot_mode) {
-       case BOOT_FASTBOOT:
-               printf("enter fastboot!\n");
-               env_set("preboot", "setenv preboot; fastboot usb0");
-               break;
-       case BOOT_UMS:
-               printf("enter UMS!\n");
-               env_set("preboot", "setenv preboot; ums mmc 0");
-               break;
-       }
-}
-
 __weak int rk_board_late_init(void)
 {
        return 0;
@@ -54,19 +29,10 @@ int board_late_init(void)
 
 int board_init(void)
 {
-#include <asm/arch/grf_rk322x.h>
+#include <asm/arch-rockchip/grf_rk322x.h>
        /* Enable early UART2 channel 1 on the RK322x */
 #define GRF_BASE       0x11000000
-       struct rk322x_grf * const grf = (void *)GRF_BASE;
-
-       rk_clrsetreg(&grf->gpio1b_iomux,
-                    GPIO1B1_MASK | GPIO1B2_MASK,
-                    GPIO1B2_UART21_SIN << GPIO1B2_SHIFT |
-                    GPIO1B1_UART21_SOUT << GPIO1B1_SHIFT);
-       /* Set channel C as UART2 input */
-       rk_clrsetreg(&grf->con_iomux,
-                    CON_IOMUX_UART2SEL_MASK,
-                    CON_IOMUX_UART2SEL_21 << CON_IOMUX_UART2SEL_SHIFT);
+       static struct rk322x_grf * const grf = (void *)GRF_BASE;
 
        /*
        * The integrated macphy is enabled by default, disable it
@@ -92,7 +58,7 @@ int dram_init_banksize(void)
        return 0;
 }
 
-#ifndef CONFIG_SYS_DCACHE_OFF
+#if !CONFIG_IS_ENABLED(SYS_DCACHE_OFF)
 void enable_caches(void)
 {
        /* Enable D-cache. I-cache is already enabled in start.S */
@@ -146,8 +112,8 @@ int board_usb_cleanup(int index, enum usb_init_type init)
 }
 #endif
 
-#if defined(CONFIG_USB_FUNCTION_FASTBOOT)
-int fb_set_reboot_flag(void)
+#if CONFIG_IS_ENABLED(FASTBOOT)
+int fastboot_set_reboot_flag(void)
 {
        struct rk322x_grf *grf;