From 86b4a6db68b21f1122b01296ae281ba2fa3607f2 Mon Sep 17 00:00:00 2001 From: Kever Yang Date: Tue, 27 Aug 2019 11:43:32 +0800 Subject: rockchip: rk3399: dts: add boot order for rockpro64 The rk3399 rockpro64 board can boot from emmc and sdcard. TODO: add spiflash as boot device. Signed-off-by: Kever Yang --- arch/arm/dts/rk3399-rockpro64-u-boot.dtsi | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/arm/dts/rk3399-rockpro64-u-boot.dtsi b/arch/arm/dts/rk3399-rockpro64-u-boot.dtsi index f7f26d584f..a073ea25f5 100644 --- a/arch/arm/dts/rk3399-rockpro64-u-boot.dtsi +++ b/arch/arm/dts/rk3399-rockpro64-u-boot.dtsi @@ -5,6 +5,11 @@ #include "rk3399-u-boot.dtsi" #include "rk3399-sdram-lpddr4-100.dtsi" +/ { + chosen { + u-boot,spl-boot-order = "same-as-spl", &sdmmc, &sdhci; + }; +}; &vdd_log { regulator-init-microvolt = <950000>; -- cgit From 54a0c7b2e7a233aa3975771592afb8e0e2f6acc0 Mon Sep 17 00:00:00 2001 From: Kever Yang Date: Wed, 28 Aug 2019 16:23:46 +0800 Subject: usb: ehci-generic: don't probe fail if there is no clk_enable() ops Some clock driver do not have a clk_enable() call back, and we should not treat this as fail in ehci probe like other modules, eg. clk_enabl_bulk() do not return fail if ret value is '-ENOSYS' Signed-off-by: Kever Yang Reviewed-by: Patrice Chotard --- drivers/usb/host/ehci-generic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/host/ehci-generic.c b/drivers/usb/host/ehci-generic.c index 0270f3bc95..682a070306 100644 --- a/drivers/usb/host/ehci-generic.c +++ b/drivers/usb/host/ehci-generic.c @@ -96,7 +96,7 @@ static int ehci_usb_probe(struct udevice *dev) if (err < 0) break; err = clk_enable(&priv->clocks[i]); - if (err) { + if (err && err != -ENOSYS) { dev_err(dev, "failed to enable clock %d\n", i); clk_free(&priv->clocks[i]); goto clk_err; -- cgit From 6578db896113816e5b61d1914169fad5f06d7903 Mon Sep 17 00:00:00 2001 From: Kever Yang Date: Wed, 28 Aug 2019 16:23:47 +0800 Subject: usb: ohci-generic: don't probe fail if there is no clk_enable() ops Some clock driver do not have a clk_enable() call back, and we should not treat this as fail in ehci probe like other modules, eg. clk_enabl_bulk() do not return fail if ret value is '-ENOSYS' Signed-off-by: Kever Yang Reviewed-by: Patrice Chotard --- drivers/usb/host/ohci-generic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/host/ohci-generic.c b/drivers/usb/host/ohci-generic.c index 24b5c3156f..916ea0b955 100644 --- a/drivers/usb/host/ohci-generic.c +++ b/drivers/usb/host/ohci-generic.c @@ -95,7 +95,7 @@ static int ohci_usb_probe(struct udevice *dev) break; err = clk_enable(&priv->clocks[i]); - if (err) { + if (err && err != -ENOSYS) { dev_err(dev, "failed to enable clock %d\n", i); clk_free(&priv->clocks[i]); goto clk_err; -- cgit From c7ed19047e8119548fc65803bb9a24c66b5fc4e7 Mon Sep 17 00:00:00 2001 From: Kever Yang Date: Wed, 28 Aug 2019 16:23:48 +0800 Subject: rockchip: clk: rk3288: remove clk_enable() There is no real driver for clk enable/disable now, and we actually don't need it now, remove it so that not waste CPU cycles and code size. Signed-off-by: Kever Yang --- drivers/clk/rockchip/clk_rk3288.c | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/drivers/clk/rockchip/clk_rk3288.c b/drivers/clk/rockchip/clk_rk3288.c index 375d7f8acb..0122381633 100644 --- a/drivers/clk/rockchip/clk_rk3288.c +++ b/drivers/clk/rockchip/clk_rk3288.c @@ -940,35 +940,12 @@ static int __maybe_unused rk3288_clk_set_parent(struct clk *clk, struct clk *par return -ENOENT; } -static int rk3288_clk_enable(struct clk *clk) -{ - switch (clk->id) { - case HCLK_USBHOST0: - case HCLK_HSIC: - return 0; - - case SCLK_MAC: - case SCLK_MAC_RX: - case SCLK_MAC_TX: - case SCLK_MACREF: - case SCLK_MACREF_OUT: - case ACLK_GMAC: - case PCLK_GMAC: - /* Required to successfully probe the Designware GMAC driver */ - return 0; - } - - debug("%s: unsupported clk %ld\n", __func__, clk->id); - return -ENOENT; -} - static struct clk_ops rk3288_clk_ops = { .get_rate = rk3288_clk_get_rate, .set_rate = rk3288_clk_set_rate, #if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) .set_parent = rk3288_clk_set_parent, #endif - .enable = rk3288_clk_enable, }; static int rk3288_clk_ofdata_to_platdata(struct udevice *dev) -- cgit From 899c3b352390d5fc5beaff4f9fa9919b0ec329ec Mon Sep 17 00:00:00 2001 From: Kever Yang Date: Wed, 28 Aug 2019 16:23:49 +0800 Subject: rockchip: clk: rk3328: remove clk_enable() There is no real driver for clk enable/disable now, and we actually don't need it now, remove it so that not waste CPU cycles and code size. Signed-off-by: Kever Yang --- drivers/clk/rockchip/clk_rk3328.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/drivers/clk/rockchip/clk_rk3328.c b/drivers/clk/rockchip/clk_rk3328.c index 5957a00402..a89e2ecc4a 100644 --- a/drivers/clk/rockchip/clk_rk3328.c +++ b/drivers/clk/rockchip/clk_rk3328.c @@ -745,22 +745,10 @@ static int rk3328_clk_set_parent(struct clk *clk, struct clk *parent) return -ENOENT; } -static int rk3328_clk_enable(struct clk *clk) -{ - switch (clk->id) { - case HCLK_HOST0: - /* Required to successfully probe the ehci generic driver */ - return 0; - } - - return -ENOENT; -} - static struct clk_ops rk3328_clk_ops = { .get_rate = rk3328_clk_get_rate, .set_rate = rk3328_clk_set_rate, .set_parent = rk3328_clk_set_parent, - .enable = rk3328_clk_enable, }; static int rk3328_clk_probe(struct udevice *dev) -- cgit From 7be113ba79a1cbb79837d4c3dfa677ad21e14614 Mon Sep 17 00:00:00 2001 From: Kever Yang Date: Wed, 28 Aug 2019 16:23:50 +0800 Subject: rockchip: clk: rk3368: remove clk_enable() There is no real driver for clk enable/disable now, and we actually don't need it now, remove it so that not waste CPU cycles and code size. Signed-off-by: Kever Yang --- drivers/clk/rockchip/clk_rk3368.c | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/drivers/clk/rockchip/clk_rk3368.c b/drivers/clk/rockchip/clk_rk3368.c index 89cbae59c5..c1a867b2ed 100644 --- a/drivers/clk/rockchip/clk_rk3368.c +++ b/drivers/clk/rockchip/clk_rk3368.c @@ -566,31 +566,12 @@ static int __maybe_unused rk3368_clk_set_parent(struct clk *clk, struct clk *par return -ENOENT; } -static int rk3368_clk_enable(struct clk *clk) -{ - switch (clk->id) { - case SCLK_MAC: - case SCLK_MAC_RX: - case SCLK_MAC_TX: - case SCLK_MACREF: - case SCLK_MACREF_OUT: - case ACLK_GMAC: - case PCLK_GMAC: - /* Required to successfully probe the Designware GMAC driver */ - return 0; - } - - debug("%s: unsupported clk %ld\n", __func__, clk->id); - return -ENOENT; -} - static struct clk_ops rk3368_clk_ops = { .get_rate = rk3368_clk_get_rate, .set_rate = rk3368_clk_set_rate, #if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) .set_parent = rk3368_clk_set_parent, #endif - .enable = rk3368_clk_enable, }; static int rk3368_clk_probe(struct udevice *dev) -- cgit From 445f85fc8e5a7806b3b1e704463455dd8d6df8f9 Mon Sep 17 00:00:00 2001 From: Kever Yang Date: Wed, 28 Aug 2019 16:23:51 +0800 Subject: rockchip: clk: rk3399: remove clk_enable() There is no real driver for clk enable/disable now, and we actually don't need it now, remove it so that not waste CPU cycles and code size. Signed-off-by: Kever Yang --- drivers/clk/rockchip/clk_rk3399.c | 37 ------------------------------------- 1 file changed, 37 deletions(-) diff --git a/drivers/clk/rockchip/clk_rk3399.c b/drivers/clk/rockchip/clk_rk3399.c index d9950c159b..a273bd1beb 100644 --- a/drivers/clk/rockchip/clk_rk3399.c +++ b/drivers/clk/rockchip/clk_rk3399.c @@ -1062,49 +1062,12 @@ static int __maybe_unused rk3399_clk_set_parent(struct clk *clk, return -ENOENT; } -static int rk3399_clk_enable(struct clk *clk) -{ - switch (clk->id) { - case HCLK_HOST0: - case HCLK_HOST0_ARB: - case HCLK_HOST1: - case HCLK_HOST1_ARB: - return 0; - - case SCLK_MAC: - case SCLK_MAC_RX: - case SCLK_MAC_TX: - case SCLK_MACREF: - case SCLK_MACREF_OUT: - case ACLK_GMAC: - case PCLK_GMAC: - /* Required to successfully probe the Designware GMAC driver */ - return 0; - - case SCLK_USB3OTG0_REF: - case SCLK_USB3OTG1_REF: - case SCLK_USB3OTG0_SUSPEND: - case SCLK_USB3OTG1_SUSPEND: - case ACLK_USB3OTG0: - case ACLK_USB3OTG1: - case ACLK_USB3_RKSOC_AXI_PERF: - case ACLK_USB3: - case ACLK_USB3_GRF: - /* Required to successfully probe the Designware USB3 driver */ - return 0; - } - - debug("%s: unsupported clk %ld\n", __func__, clk->id); - return -ENOENT; -} - static struct clk_ops rk3399_clk_ops = { .get_rate = rk3399_clk_get_rate, .set_rate = rk3399_clk_set_rate, #if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) .set_parent = rk3399_clk_set_parent, #endif - .enable = rk3399_clk_enable, }; #ifdef CONFIG_SPL_BUILD -- cgit From 45f8b55ecaa38395b6aca7a31def629d6708f767 Mon Sep 17 00:00:00 2001 From: Kever Yang Date: Mon, 2 Sep 2019 15:59:03 +0800 Subject: rockchip: not depends on TPL_BUILD for rk3188 makefile including The rk3188/Makefile already depends on !TPL_BUILD, so no need to add this again in parent Makefile, remove it. Signed-off-by: Kever Yang --- arch/arm/mach-rockchip/Makefile | 2 -- 1 file changed, 2 deletions(-) diff --git a/arch/arm/mach-rockchip/Makefile b/arch/arm/mach-rockchip/Makefile index 207f900011..616dd8f0f2 100644 --- a/arch/arm/mach-rockchip/Makefile +++ b/arch/arm/mach-rockchip/Makefile @@ -31,9 +31,7 @@ endif obj-$(CONFIG_ROCKCHIP_RK3036) += rk3036/ obj-$(CONFIG_ROCKCHIP_RK3128) += rk3128/ -ifndef CONFIG_TPL_BUILD obj-$(CONFIG_ROCKCHIP_RK3188) += rk3188/ -endif obj-$(CONFIG_ROCKCHIP_RK322X) += rk322x/ obj-$(CONFIG_ROCKCHIP_RK3288) += rk3288/ obj-$(CONFIG_ROCKCHIP_RK3328) += rk3328/ -- cgit From c9ec5fe0185d9867afe18dc7bf01fd492db8c4a9 Mon Sep 17 00:00:00 2001 From: Kever Yang Date: Mon, 2 Sep 2019 15:59:04 +0800 Subject: rockchip: clean makefile for misc.c Use obj-$(config) instead of #ifdef $config to make the code looks clean, and move the misc_init for U-Boot proper only. Signed-off-by: Kever Yang --- arch/arm/mach-rockchip/Makefile | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/arch/arm/mach-rockchip/Makefile b/arch/arm/mach-rockchip/Makefile index 616dd8f0f2..45d9b06233 100644 --- a/arch/arm/mach-rockchip/Makefile +++ b/arch/arm/mach-rockchip/Makefile @@ -1,6 +1,7 @@ # SPDX-License-Identifier: GPL-2.0+ # # Copyright (c) 2014 Google, Inc +# Copyright (c) 2019 Rockchip Electronics Co., Ltd. # We don't want the bootrom-helper present in a full U-Boot build, as # this may have entered from ATF with the stack-pointer pointing to @@ -21,14 +22,11 @@ ifeq ($(CONFIG_SPL_BUILD)$(CONFIG_TPL_BUILD),) # meaning "turn it off". obj-y += boot_mode.o obj-$(CONFIG_ROCKCHIP_COMMON_BOARD) += board.o +obj-$(CONFIG_MISC_INIT_R) += misc.o endif obj-$(CONFIG_$(SPL_TPL_)RAM) += sdram_common.o -ifdef CONFIG_MISC_INIT_R -obj-y += misc.o -endif - obj-$(CONFIG_ROCKCHIP_RK3036) += rk3036/ obj-$(CONFIG_ROCKCHIP_RK3128) += rk3128/ obj-$(CONFIG_ROCKCHIP_RK3188) += rk3188/ -- cgit From 1b0a936b52606af87b6576817a0e939da731b6d9 Mon Sep 17 00:00:00 2001 From: "Matwey V. Kornilov" Date: Tue, 3 Sep 2019 19:29:01 +0300 Subject: rockchip, Makefile: add idbloader.img target Many Rockchip platforms require the same u-boot deploy procedure when TPL and SPL both enabled. The following examples are taken from doc/README.rockchip and board/theobroma-systems/lion_rk3368/README: RK3288: ./tools/mkimage -n rk3288 -T rksd -d ./tpl/u-boot-tpl.bin out cat ./spl/u-boot-spl-dtb.bin >> out sudo dd if=out of=/dev/mmcblk0 seek=64 RK3328: ./tools/mkimage -n rk3328 -T rksd -d ./tpl/u-boot-tpl.bin idbloader.img cat ./spl/u-boot-spl.bin >> idbloader.img sudo dd if=idbloader.img of=/dev/mmcblk0 seek=64 RK3368: ./tools/mkimage -n rk3368 -T rksd -d tpl/u-boot-tpl.bin spl-3368.img cat spl/u-boot-spl-dtb.bin >> spl-3368.img dd if=spl-3368.img of=/dev/sdb seek=64 RK3399: ./tools/mkimage -n rk3399 -T rksd -d ./tpl/u-boot-tpl-dtb.bin out cat ./spl/u-boot-spl-dtb.bin >> out sudo dd if=out of=/dev/sdc seek=64 Here, we introduce generic idbloader.img target which is the TPL image followed by the SPL binary. Signed-off-by: Matwey V. Kornilov Reviewed-by: Kever Yang --- Makefile | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Makefile b/Makefile index ae56e47b2c..57d0700227 100644 --- a/Makefile +++ b/Makefile @@ -882,6 +882,10 @@ ifeq ($(CONFIG_MPC85xx)$(CONFIG_OF_SEPARATE),yy) ALL-y += u-boot-with-dtb.bin endif +ifeq ($(CONFIG_ARCH_ROCKCHIP)$(CONFIG_SPL)$(CONFIG_TPL),yyy) +ALL-y += idbloader.img +endif + LDFLAGS_u-boot += $(LDFLAGS_FINAL) # Avoid 'Not enough room for program headers' error on binutils 2.28 onwards. @@ -1314,6 +1318,14 @@ OBJCOPYFLAGS_u-boot-with-spl.bin = -I binary -O binary \ u-boot-with-spl.bin: $(SPL_IMAGE) $(SPL_PAYLOAD) FORCE $(call if_changed,pad_cat) +ifeq ($(CONFIG_ARCH_ROCKCHIP),y) +MKIMAGEFLAGS_u-boot-tpl.img = -n $(CONFIG_SYS_SOC) -T rksd +tpl/u-boot-tpl.img: tpl/u-boot-tpl.bin FORCE + $(call if_changed,mkimage) +idbloader.img: tpl/u-boot-tpl.img spl/u-boot-spl.bin FORCE + $(call if_changed,cat) +endif + ifeq ($(CONFIG_ARCH_LPC32XX)$(CONFIG_SPL),yy) MKIMAGEFLAGS_lpc32xx-spl.img = -T lpc32xximage -a $(CONFIG_SPL_TEXT_BASE) -- cgit From 78af73efa0c67bcbc438ef1c75b22dc2090d1258 Mon Sep 17 00:00:00 2001 From: "Matwey V. Kornilov" Date: Tue, 3 Sep 2019 19:29:02 +0300 Subject: doc: rockchip: use idbloader.img for rk3288, rk3328, rk3399 Makefile now produces ready-to-deploy idbloader.img file. Signed-off-by: Matwey V. Kornilov Reviewed-by: Kever Yang --- doc/README.rockchip | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/doc/README.rockchip b/doc/README.rockchip index 531a062c9e..d17afeabdd 100644 --- a/doc/README.rockchip +++ b/doc/README.rockchip @@ -275,9 +275,7 @@ As of now TPL is added on Vyasa-RK3288 board. To write an image that boots from an SD card (assumed to be /dev/mmcblk0): - ./tools/mkimage -n rk3288 -T rksd -d ./tpl/u-boot-tpl.bin out && - cat ./spl/u-boot-spl-dtb.bin >> out && - sudo dd if=out of=/dev/mmcblk0 seek=64 && + sudo dd if=idbloader.img of=/dev/mmcblk0 seek=64 && sudo dd if=u-boot-dtb.img of=/dev/mmcblk0 seek=16384 Booting from an SD card on RK3188 @@ -310,11 +308,6 @@ Booting from an SD card on Pine64 Rock64 (RK3328) For Rock64 rk3328 board the following three parts are required: TPL, SPL, and the u-boot image tree blob. - - Create TPL/SPL image - - => tools/mkimage -n rk3328 -T rksd -d tpl/u-boot-tpl.bin idbloader.img - => cat spl/u-boot-spl.bin >> idbloader.img - - Write TPL/SPL image at 64 sector => sudo dd if=idbloader.img of=/dev/mmcblk0 seek=64 @@ -473,19 +466,9 @@ Hit any key to stop autoboot: 0 Option 3: Package the image with TPL: - - Prefix rk3399 header to TPL image - - => cd /path/to/u-boot - => ./tools/mkimage -n rk3399 -T rksd -d tpl/u-boot-tpl-dtb.bin out - - - Concatinate tpl with spl - - => cd /path/to/u-boot - => cat ./spl/u-boot-spl-dtb.bin >> out - - Write tpl+spl at 64th sector - => sudo dd if=out of=/dev/sdc seek=64 + => sudo dd if=idbloader.img of=/dev/sdc seek=64 - Write U-Boot proper at 16384 sector -- cgit From 326b2624192336c99ba18d5151b51d0c07c23193 Mon Sep 17 00:00:00 2001 From: "Matwey V. Kornilov" Date: Tue, 3 Sep 2019 19:29:03 +0300 Subject: doc: lion_rk3368: use idbloader.img for rk3368 Makefile now produces ready-to-deploy idbloader.img file. Signed-off-by: Matwey V. Kornilov Reviewed-by: Kever Yang --- board/theobroma-systems/lion_rk3368/README | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/board/theobroma-systems/lion_rk3368/README b/board/theobroma-systems/lion_rk3368/README index 83e4332984..ad3ac93bd4 100644 --- a/board/theobroma-systems/lion_rk3368/README +++ b/board/theobroma-systems/lion_rk3368/README @@ -18,8 +18,6 @@ Build the TPL/SPL stage ======================= > make CROSS_COMPILE=aarch64-unknown-elf- ARCH=arm - > tools/mkimage -n rk3368 -T rksd -d tpl/u-boot-tpl.bin spl-3368.img - > cat spl/u-boot-spl-dtb.bin >> spl-3368.img Build the full U-Boot and a FIT image including the ATF ======================================================= @@ -35,7 +33,7 @@ Copy the SPL to offset 32k and the FIT image containing the payloads SD-Card ------- - > dd if=spl-3368.img of=/dev/sdb seek=64 + > dd if=idbloader.img of=/dev/sdb seek=64 > dd if=u-boot.itb of=/dev/sdb seek=512 eMMC -- cgit