Merge tag 'signed-efi-next' of git://github.com/agraf/u-boot
[oweals/u-boot.git] / arch / arm / mach-rockchip / rk322x-board.c
index 1e79c19309656cc76ba7b708975f4887cb117b19..dcd8cf805fe51aa2a1d2fa25aefdb6a3e37a758b 100644 (file)
@@ -7,6 +7,7 @@
 #include <clk.h>
 #include <dm.h>
 #include <ram.h>
+#include <syscon.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/periph.h>
@@ -67,16 +68,26 @@ int board_init(void)
                     CON_IOMUX_UART2SEL_MASK,
                     CON_IOMUX_UART2SEL_21 << CON_IOMUX_UART2SEL_SHIFT);
 
+       /*
+       * The integrated macphy is enabled by default, disable it
+       * for saving power consuming.
+       */
+       rk_clrsetreg(&grf->macphy_con[0],
+                    MACPHY_CFG_ENABLE_MASK,
+                    0 << MACPHY_CFG_ENABLE_SHIFT);
+
        return 0;
 }
 
 int dram_init_banksize(void)
 {
-       /* Reserve 0x200000 for OPTEE */
-       gd->bd->bi_dram[0].start = 0x60000000;
+       gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
        gd->bd->bi_dram[0].size = 0x8400000;
-       gd->bd->bi_dram[1].start = 0x6a400000;
-       gd->bd->bi_dram[1].size = gd->ram_size - gd->bd->bi_dram[1].start;
+       /* Reserve 0x200000 for OPTEE */
+       gd->bd->bi_dram[1].start = CONFIG_SYS_SDRAM_BASE
+                               + gd->bd->bi_dram[0].size + 0x200000;
+       gd->bd->bi_dram[1].size = gd->bd->bi_dram[0].start
+                               + gd->ram_size - gd->bd->bi_dram[1].start;
 
        return 0;
 }
@@ -134,3 +145,17 @@ int board_usb_cleanup(int index, enum usb_init_type init)
        return 0;
 }
 #endif
+
+#if defined(CONFIG_USB_FUNCTION_FASTBOOT)
+int fb_set_reboot_flag(void)
+{
+       struct rk322x_grf *grf;
+
+       printf("Setting reboot to fastboot flag ...\n");
+       grf = syscon_get_first_range(ROCKCHIP_SYSCON_GRF);
+       /* Set boot mode to fastboot */
+       writel(BOOT_FASTBOOT, &grf->os_reg[0]);
+
+       return 0;
+}
+#endif