From 70616df2bfbb4de675b93aa85e8aec744346fede Mon Sep 17 00:00:00 2001 From: Sandy Patterson Date: Mon, 29 Aug 2016 07:31:17 -0400 Subject: Enable ROCKCHIP_SPL_BACK_TO_BROM for rock2 board Rock2 has been tested with back to brom feature. The tricky part is that with this feature the default environment is inside u-boot, and it's defined for every rk3288 board independetly. So I just changed it for rock2 here if ROCKCHIP_SPL_BACK_TO_BROM. Solve by moving environment after u-boot before 1M boundary Signed-off-by: Sandy Patterson Acked-by: Simon Glass --- include/configs/rock2.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'include') diff --git a/include/configs/rock2.h b/include/configs/rock2.h index ee924c3816d..99d69155d21 100644 --- a/include/configs/rock2.h +++ b/include/configs/rock2.h @@ -16,11 +16,20 @@ #define CONFIG_ENV_IS_IN_MMC #define CONFIG_SYS_MMC_ENV_DEV 0 + +#ifdef CONFIG_ROCKCHIP_SPL_BACK_TO_BROM +/* SPL @ 32k for 34k + * u-boot directly after @ 68k for 400k or so + * ENV @ 992k + */ +#define CONFIG_ENV_OFFSET ((1024-32) * 1024) +#else /* SPL @ 32k for ~36k * ENV @ 96k * u-boot @ 128K */ #define CONFIG_ENV_OFFSET (96 * 1024) +#endif #define CONFIG_SYS_WHITE_ON_BLACK #define CONFIG_CONSOLE_SCROLL_LINES 10 -- cgit v1.3.1 From e73e5fcd8498b5db7bb604ef2223d636a54505ff Mon Sep 17 00:00:00 2001 From: "jacob2.chen" Date: Tue, 30 Aug 2016 01:26:14 +0800 Subject: rockchip: add usb mass storage feature support for rk3036 Enable ums feature for rk3036 boards, so that we can mount the mmc device to PC. Signed-off-by: jacob2.chen Acked-by: Simon Glass --- include/configs/rk3036_common.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include') diff --git a/include/configs/rk3036_common.h b/include/configs/rk3036_common.h index 4b266627441..1b411c06320 100644 --- a/include/configs/rk3036_common.h +++ b/include/configs/rk3036_common.h @@ -70,6 +70,10 @@ #define CONFIG_FASTBOOT_BUF_ADDR CONFIG_SYS_LOAD_ADDR #define CONFIG_FASTBOOT_BUF_SIZE 0x08000000 +/* usb mass storage */ +#define CONFIG_USB_FUNCTION_MASS_STORAGE +#define CONFIG_CMD_USB_MASS_STORAGE + #define CONFIG_USB_GADGET_DOWNLOAD #define CONFIG_G_DNL_MANUFACTURER "Rockchip" #define CONFIG_G_DNL_VENDOR_NUM 0x2207 -- cgit v1.3.1 From c12777a625544a6ac19c4496d255ff6010f3a8a8 Mon Sep 17 00:00:00 2001 From: Xu Ziyuan Date: Fri, 9 Sep 2016 21:44:50 +0800 Subject: rockchip: miniarm: remove eMMC support The latest rk3288-miniarm board doesn't have eMMC device, so remove it. Signed-off-by: Ziyuan Xu Acked-by: Simon Glass --- arch/arm/dts/rk3288-miniarm.dtsi | 12 ------------ board/rockchip/miniarm_rk3288/miniarm-rk3288.c | 8 -------- include/configs/miniarm_rk3288.h | 7 ++++++- 3 files changed, 6 insertions(+), 21 deletions(-) (limited to 'include') diff --git a/arch/arm/dts/rk3288-miniarm.dtsi b/arch/arm/dts/rk3288-miniarm.dtsi index b88987557a6..ceb4e2bdb19 100644 --- a/arch/arm/dts/rk3288-miniarm.dtsi +++ b/arch/arm/dts/rk3288-miniarm.dtsi @@ -116,18 +116,6 @@ cpu0-supply = <&vdd_cpu>; }; -&emmc { - broken-cd; - bus-width = <8>; - cap-mmc-highspeed; - disable-wp; - non-removable; - num-slots = <1>; - pinctrl-names = "default"; - pinctrl-0 = <&emmc_clk &emmc_cmd &emmc_pwr &emmc_bus8>; - status = "okay"; -}; - &sdmmc { bus-width = <4>; cap-mmc-highspeed; diff --git a/board/rockchip/miniarm_rk3288/miniarm-rk3288.c b/board/rockchip/miniarm_rk3288/miniarm-rk3288.c index aad74ef1095..79541a39394 100644 --- a/board/rockchip/miniarm_rk3288/miniarm-rk3288.c +++ b/board/rockchip/miniarm_rk3288/miniarm-rk3288.c @@ -5,11 +5,3 @@ */ #include -#include - -void board_boot_order(u32 *spl_boot_list) -{ - /* eMMC prior to sdcard */ - spl_boot_list[0] = BOOT_DEVICE_MMC2; - spl_boot_list[1] = BOOT_DEVICE_MMC1; -} diff --git a/include/configs/miniarm_rk3288.h b/include/configs/miniarm_rk3288.h index 390c243cae7..aa259dbefd3 100644 --- a/include/configs/miniarm_rk3288.h +++ b/include/configs/miniarm_rk3288.h @@ -10,8 +10,13 @@ #define ROCKCHIP_DEVICE_SETTINGS #include +#undef BOOT_TARGET_DEVICES + +#define BOOT_TARGET_DEVICES(func) \ + func(MMC, mmc, 0) + #define CONFIG_ENV_IS_IN_MMC -#define CONFIG_SYS_MMC_ENV_DEV 1 +#define CONFIG_SYS_MMC_ENV_DEV 0 /* SPL @ 32k for ~36k * ENV @ 96k * u-boot @ 128K -- cgit v1.3.1 From 73a85989713cce45a6999ea4305a5d09f0db25dd Mon Sep 17 00:00:00 2001 From: Jacob Chen Date: Mon, 19 Sep 2016 18:46:25 +0800 Subject: rockchip: move partitons define from 3036-kylin to 3036-common To keep it same with 3288. Signed-off-by: Jacob Chen Acked-by: Simon Glass --- include/configs/kylin_rk3036.h | 24 ------------------------ include/configs/rk3036_common.h | 10 ++++++++++ 2 files changed, 10 insertions(+), 24 deletions(-) (limited to 'include') diff --git a/include/configs/kylin_rk3036.h b/include/configs/kylin_rk3036.h index e8ca76dfcfa..39fb2393e36 100644 --- a/include/configs/kylin_rk3036.h +++ b/include/configs/kylin_rk3036.h @@ -23,30 +23,6 @@ #define CONFIG_ENV_OFFSET_REDUND (CONFIG_ENV_OFFSET + CONFIG_ENV_SIZE) #define CONFIG_SYS_REDUNDAND_ENVIRONMENT -/* Enable gpt partition table */ -#define CONFIG_CMD_GPT -#define CONFIG_RANDOM_UUID -#define PARTS_DEFAULT \ - "uuid_disk=${uuid_gpt_disk};" \ - "name=loader,start=32K,size=4000K,uuid=${uuid_gpt_loader};" \ - "name=reserved,size=64K,uuid=${uuid_gpt_reserved};" \ - "name=misc,size=4M,uuid=${uuid_gpt_misc};" \ - "name=recovery,size=32M,uuid=${uuid_gpt_recovery};" \ - "name=boot_a,size=32M,uuid=${uuid_gpt_boot_a};" \ - "name=boot_b,size=32M,uuid=${uuid_gpt_boot_b};" \ - "name=system_a,size=818M,uuid=${uuid_gpt_system_a};" \ - "name=system_b,size=818M,uuid=${uuid_gpt_system_b};" \ - "name=vendor_a,size=50M,uuid=${uuid_gpt_vendor_a};" \ - "name=vendor_b,size=50M,uuid=${uuid_gpt_vendor_b};" \ - "name=cache,size=100M,uuid=${uuid_gpt_cache};" \ - "name=metadata,size=16M,uuid=${uuid_gpt_metadata};" \ - "name=persist,size=4M,uuid=${uuid_gpt_persist};" \ - "name=userdata,size=-,uuid=${uuid_gpt_userdata};\0" \ - -#undef CONFIG_EXTRA_ENV_SETTINGS -#define CONFIG_EXTRA_ENV_SETTINGS \ - "partitions=" PARTS_DEFAULT \ - #endif #define CONFIG_BOARD_LATE_INIT diff --git a/include/configs/rk3036_common.h b/include/configs/rk3036_common.h index 1b411c06320..6ddf0d9f4b8 100644 --- a/include/configs/rk3036_common.h +++ b/include/configs/rk3036_common.h @@ -79,6 +79,9 @@ #define CONFIG_G_DNL_VENDOR_NUM 0x2207 #define CONFIG_G_DNL_PRODUCT_NUM 0x310a +/* Enable gpt partition table */ +#define CONFIG_CMD_GPT + #include #define ENV_MEM_LAYOUT_SETTINGS \ @@ -88,6 +91,12 @@ "kernel_addr_r=0x62000000\0" \ "ramdisk_addr_r=0x64000000\0" +#define CONFIG_RANDOM_UUID +#define PARTS_DEFAULT \ + "uuid_disk=${uuid_gpt_disk};" \ + "name=boot,start=8M,size=64M,bootable,uuid=${uuid_gpt_boot};" \ + "name=rootfs,size=-,uuid=${uuid_gpt_rootfs};\0" \ + /* First try to boot from SD (index 0), then eMMC (index 1 */ #define BOOT_TARGET_DEVICES(func) \ func(MMC, mmc, 0) \ @@ -99,6 +108,7 @@ * so limit the fdt reallocation to that */ #define CONFIG_EXTRA_ENV_SETTINGS \ "fdt_high=0x7fffffff\0" \ + "partitions=" PARTS_DEFAULT \ ENV_MEM_LAYOUT_SETTINGS \ BOOTENV #endif -- cgit v1.3.1 From 67171e13a3e0665b18c657a6704a22ca7900f4c3 Mon Sep 17 00:00:00 2001 From: Jacob Chen Date: Mon, 19 Sep 2016 18:46:28 +0800 Subject: rockchip: add boot-mode support for rk3288, rk3036 rockchip platform have a protocol to pass the the kernel reboot mode to bootloader by some special registers when system reboot. In bootloader we should read it and take action. We can only setup boot_mode in board_late_init becasue "setenv" need env setuped. So add CONFIG_BOARD_LATE_INIT to common header and use a entry "rk_board_late_init" to replace "board_late_init" in board file. Signed-off-by: Jacob Chen Acked-by: Simon Glass --- arch/arm/include/asm/arch-rockchip/boot_mode.h | 19 ++++++++++ arch/arm/mach-rockchip/rk3036-board.c | 39 ++++++++++++++++++++ arch/arm/mach-rockchip/rk3288-board.c | 50 +++++++++++++++++++++++--- board/rockchip/kylin_rk3036/kylin_rk3036.c | 14 ++------ include/configs/kylin_rk3036.h | 3 -- include/configs/rk3036_common.h | 3 ++ include/configs/rk3288_common.h | 3 ++ 7 files changed, 111 insertions(+), 20 deletions(-) create mode 100644 arch/arm/include/asm/arch-rockchip/boot_mode.h (limited to 'include') diff --git a/arch/arm/include/asm/arch-rockchip/boot_mode.h b/arch/arm/include/asm/arch-rockchip/boot_mode.h new file mode 100644 index 00000000000..bd65f60bf2b --- /dev/null +++ b/arch/arm/include/asm/arch-rockchip/boot_mode.h @@ -0,0 +1,19 @@ +#ifndef __REBOOT_MODE_H +#define __REBOOT_MODE_H + +/* high 24 bits is tag, low 8 bits is type */ +#define REBOOT_FLAG 0x5242C300 +/* normal boot */ +#define BOOT_NORMAL (REBOOT_FLAG + 0) +/* enter loader rockusb mode */ +#define BOOT_LOADER (REBOOT_FLAG + 1) +/* enter recovery */ +#define BOOT_RECOVERY (REBOOT_FLAG + 3) +/* enter fastboot mode */ +#define BOOT_FASTBOOT (REBOOT_FLAG + 9) +/* enter charging mode */ +#define BOOT_CHARGING (REBOOT_FLAG + 11) +/* enter usb mass storage mode */ +#define BOOT_UMS (REBOOT_FLAG + 12) + +#endif diff --git a/arch/arm/mach-rockchip/rk3036-board.c b/arch/arm/mach-rockchip/rk3036-board.c index b63f9c0dde6..bf2b268f8b2 100644 --- a/arch/arm/mach-rockchip/rk3036-board.c +++ b/arch/arm/mach-rockchip/rk3036-board.c @@ -11,11 +11,50 @@ #include #include #include +#include +#include +#include #include #include DECLARE_GLOBAL_DATA_PTR; +#define GRF_BASE 0x20008000 + +static void setup_boot_mode(void) +{ + struct rk3036_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"); + setenv("preboot", "setenv preboot; fastboot usb0"); + break; + case BOOT_UMS: + printf("enter UMS!\n"); + setenv("preboot", "setenv preboot; ums mmc 0"); + break; + } +} + +__weak int rk_board_late_init(void) +{ + return 0; +} + +int board_late_init(void) +{ + setup_boot_mode(); + + return rk_board_late_init(); +} + int board_init(void) { return 0; diff --git a/arch/arm/mach-rockchip/rk3288-board.c b/arch/arm/mach-rockchip/rk3288-board.c index 6c36bf93977..baf9522bcdd 100644 --- a/arch/arm/mach-rockchip/rk3288-board.c +++ b/arch/arm/mach-rockchip/rk3288-board.c @@ -8,25 +8,65 @@ #include #include #include +#include #include #include #include +#include +#include #include #include DECLARE_GLOBAL_DATA_PTR; +#define PMU_BASE 0xff730000 + +static void setup_boot_mode(void) +{ + struct rk3288_pmu *const pmu = (void *)PMU_BASE; + int boot_mode = readl(&pmu->sys_reg[0]); + + debug("boot mode %x.\n", boot_mode); + + /* Clear boot mode */ + writel(BOOT_NORMAL, &pmu->sys_reg[0]); + + switch (boot_mode) { + case BOOT_FASTBOOT: + printf("enter fastboot!\n"); + setenv("preboot", "setenv preboot; fastboot usb0"); + break; + case BOOT_UMS: + printf("enter UMS!\n"); + setenv("preboot", "setenv preboot; if mmc dev 0;" + "then ums mmc 0; else ums mmc 1;fi"); + break; + } +} + +__weak int rk_board_late_init(void) +{ + return 0; +} + +int board_late_init(void) +{ + setup_boot_mode(); + + return rk_board_late_init(); +} + int board_init(void) { #ifdef CONFIG_ROCKCHIP_SPL_BACK_TO_BROM struct udevice *pinctrl; int ret; - /* - * We need to implement sdcard iomux here for the further - * initlization, otherwise, it'll hit sdcard command sending - * timeout exception. - */ + /* + * We need to implement sdcard iomux here for the further + * initlization, otherwise, it'll hit sdcard command sending + * timeout exception. + */ ret = uclass_get_device(UCLASS_PINCTRL, 0, &pinctrl); if (ret) { debug("%s: Cannot find pinctrl device\n", __func__); diff --git a/board/rockchip/kylin_rk3036/kylin_rk3036.c b/board/rockchip/kylin_rk3036/kylin_rk3036.c index 848f23d1a6a..7e2edf4a566 100644 --- a/board/rockchip/kylin_rk3036/kylin_rk3036.c +++ b/board/rockchip/kylin_rk3036/kylin_rk3036.c @@ -8,14 +8,11 @@ #include #include #include -#include #include #include DECLARE_GLOBAL_DATA_PTR; -#define GRF_BASE 0x20008000 - void get_ddr_config(struct rk3036_ddr_config *config) { /* K4B4G1646Q config */ @@ -43,16 +40,9 @@ int fastboot_key_pressed(void) #define ROCKCHIP_BOOT_MODE_FASTBOOT 0x5242C309 -int board_late_init(void) +int rk_board_late_init(void) { - struct rk3036_grf * const grf = (void *)GRF_BASE; - int boot_mode = readl(&grf->os_reg[4]); - - /* Clear boot mode */ - writel(0, &grf->os_reg[4]); - - if (boot_mode == ROCKCHIP_BOOT_MODE_FASTBOOT || - fastboot_key_pressed()) { + if (fastboot_key_pressed()) { printf("enter fastboot!\n"); setenv("preboot", "setenv preboot; fastboot usb0"); } diff --git a/include/configs/kylin_rk3036.h b/include/configs/kylin_rk3036.h index 39fb2393e36..4f0bd84ad82 100644 --- a/include/configs/kylin_rk3036.h +++ b/include/configs/kylin_rk3036.h @@ -25,7 +25,4 @@ #endif -#define CONFIG_BOARD_LATE_INIT -#define CONFIG_PREBOOT - #endif diff --git a/include/configs/rk3036_common.h b/include/configs/rk3036_common.h index 6ddf0d9f4b8..73830e4aa53 100644 --- a/include/configs/rk3036_common.h +++ b/include/configs/rk3036_common.h @@ -113,4 +113,7 @@ BOOTENV #endif +#define CONFIG_BOARD_LATE_INIT +#define CONFIG_PREBOOT + #endif diff --git a/include/configs/rk3288_common.h b/include/configs/rk3288_common.h index e8bf9878f24..9ddfe1daeb6 100644 --- a/include/configs/rk3288_common.h +++ b/include/configs/rk3288_common.h @@ -132,4 +132,7 @@ BOOTENV #endif +#define CONFIG_BOARD_LATE_INIT +#define CONFIG_PREBOOT + #endif -- cgit v1.3.1