Merge branch '2019-05-03-master-imports'
authorTom Rini <trini@konsulko.com>
Fri, 3 May 2019 11:30:55 +0000 (07:30 -0400)
committerTom Rini <trini@konsulko.com>
Fri, 3 May 2019 11:30:55 +0000 (07:30 -0400)
- Various btrfs fixes
- Various TI platform fixes
- Other fixes (cross build, taurus update, Kconfig help text)

149 files changed:
MAINTAINERS
arch/arm/Kconfig
arch/arm/cpu/armv8/start.S
arch/arm/dts/Makefile
arch/arm/dts/rk3399-evb.dts
arch/arm/dts/rk3399-firefly.dts
arch/arm/dts/rk3399-opp.dtsi [new file with mode: 0644]
arch/arm/dts/rk3399-orangepi-u-boot.dtsi [new file with mode: 0644]
arch/arm/dts/rk3399-orangepi.dts [new file with mode: 0644]
arch/arm/dts/rk3399-puma.dtsi
arch/arm/dts/rk3399-u-boot.dtsi [new file with mode: 0644]
arch/arm/include/asm/arch-rockchip/ddr_rk3188.h
arch/arm/include/asm/arch-rockchip/hardware.h
arch/arm/include/asm/gpio.h
arch/arm/lib/vectors.S
arch/arm/mach-rockchip/Kconfig
arch/arm/mach-rockchip/boot_mode.c
arch/arm/mach-rockchip/bootrom.c
arch/arm/mach-rockchip/rk3036-board-spl.c
arch/arm/mach-rockchip/rk3036-board.c
arch/arm/mach-rockchip/rk3036/Kconfig
arch/arm/mach-rockchip/rk3036/Makefile
arch/arm/mach-rockchip/rk3036/clk_rk3036.c
arch/arm/mach-rockchip/rk3036/rk3036.c [new file with mode: 0644]
arch/arm/mach-rockchip/rk3036/sdram_rk3036.c
arch/arm/mach-rockchip/rk3036/syscon_rk3036.c
arch/arm/mach-rockchip/rk3128-board.c
arch/arm/mach-rockchip/rk3128/Kconfig
arch/arm/mach-rockchip/rk3128/clk_rk3128.c
arch/arm/mach-rockchip/rk3128/syscon_rk3128.c
arch/arm/mach-rockchip/rk3188-board-spl.c
arch/arm/mach-rockchip/rk3188-board.c
arch/arm/mach-rockchip/rk3188/Kconfig
arch/arm/mach-rockchip/rk3188/Makefile
arch/arm/mach-rockchip/rk3188/clk_rk3188.c
arch/arm/mach-rockchip/rk3188/rk3188.c [new file with mode: 0644]
arch/arm/mach-rockchip/rk3188/syscon_rk3188.c
arch/arm/mach-rockchip/rk322x-board-spl.c
arch/arm/mach-rockchip/rk322x-board.c
arch/arm/mach-rockchip/rk322x/Kconfig
arch/arm/mach-rockchip/rk322x/Makefile
arch/arm/mach-rockchip/rk322x/clk_rk322x.c
arch/arm/mach-rockchip/rk322x/rk322x.c [new file with mode: 0644]
arch/arm/mach-rockchip/rk322x/syscon_rk322x.c
arch/arm/mach-rockchip/rk3288-board-spl.c
arch/arm/mach-rockchip/rk3288-board-tpl.c
arch/arm/mach-rockchip/rk3288-board.c
arch/arm/mach-rockchip/rk3288/Kconfig
arch/arm/mach-rockchip/rk3288/clk_rk3288.c
arch/arm/mach-rockchip/rk3288/rk3288.c
arch/arm/mach-rockchip/rk3288/syscon_rk3288.c
arch/arm/mach-rockchip/rk3328/Kconfig
arch/arm/mach-rockchip/rk3328/clk_rk3328.c
arch/arm/mach-rockchip/rk3328/rk3328.c
arch/arm/mach-rockchip/rk3328/syscon_rk3328.c
arch/arm/mach-rockchip/rk3368-board-spl.c
arch/arm/mach-rockchip/rk3368-board-tpl.c
arch/arm/mach-rockchip/rk3368/Kconfig
arch/arm/mach-rockchip/rk3368/clk_rk3368.c
arch/arm/mach-rockchip/rk3368/rk3368.c
arch/arm/mach-rockchip/rk3368/syscon_rk3368.c
arch/arm/mach-rockchip/rk3399-board-spl.c
arch/arm/mach-rockchip/rk3399-board.c
arch/arm/mach-rockchip/rk3399/Kconfig
arch/arm/mach-rockchip/rk3399/clk_rk3399.c
arch/arm/mach-rockchip/rk3399/rk3399.c
arch/arm/mach-rockchip/rk3399/syscon_rk3399.c
arch/arm/mach-rockchip/rk_timer.c
arch/arm/mach-rockchip/rv1108/Kconfig
arch/arm/mach-rockchip/rv1108/clk_rv1108.c
arch/arm/mach-rockchip/rv1108/syscon_rv1108.c
arch/arm/mach-rockchip/sdram_common.c
board/elgin/elgin_rv1108/elgin_rv1108.c
board/rockchip/evb_rk3036/evb_rk3036.c
board/rockchip/evb_rk3229/evb_rk3229.c
board/rockchip/evb_rk3399/MAINTAINERS
board/rockchip/evb_rk3399/evb-rk3399.c
board/rockchip/evb_rv1108/evb_rv1108.c
board/rockchip/kylin_rk3036/kylin_rk3036.c
board/rockchip/sheep_rk3368/sheep_rk3368.c
board/theobroma-systems/lion_rk3368/lion_rk3368.c
board/theobroma-systems/puma_rk3399/puma-rk3399.c
board/vamrs/rock960_rk3399/rock960-rk3399.c
cmd/bootefi.c
cmd/efidebug.c
cmd/gpt.c
cmd/nvedit_efi.c
cmd/rockusb.c
configs/kylin-rk3036_defconfig
configs/orangepi-rk3399_defconfig [new file with mode: 0644]
configs/puma-rk3399_defconfig
disk/part_efi.c
doc/git-mailrc
drivers/clk/rockchip/clk_rk3036.c
drivers/clk/rockchip/clk_rk3128.c
drivers/clk/rockchip/clk_rk3188.c
drivers/clk/rockchip/clk_rk322x.c
drivers/clk/rockchip/clk_rk3288.c
drivers/clk/rockchip/clk_rk3328.c
drivers/clk/rockchip/clk_rk3368.c
drivers/clk/rockchip/clk_rk3399.c
drivers/clk/rockchip/clk_rv1108.c
drivers/gpio/rk_gpio.c
drivers/i2c/rk_i2c.c
drivers/mmc/rockchip_dw_mmc.c
drivers/net/gmac_rockchip.c
drivers/pinctrl/pinctrl-uclass.c
drivers/pwm/rk_pwm.c
drivers/ram/rockchip/dmc-rk3368.c
drivers/ram/rockchip/sdram_rk3128.c
drivers/ram/rockchip/sdram_rk3188.c
drivers/ram/rockchip/sdram_rk322x.c
drivers/ram/rockchip/sdram_rk3288.c
drivers/ram/rockchip/sdram_rk3328.c
drivers/ram/rockchip/sdram_rk3399.c
drivers/reset/reset-rockchip.c
drivers/serial/serial_rockchip.c
drivers/sound/rockchip_sound.c
drivers/spi/rk_spi.c
drivers/sysreset/sysreset_rockchip.c
drivers/timer/rockchip_timer.c
drivers/usb/gadget/f_rockusb.c
drivers/video/rockchip/rk3288_hdmi.c
drivers/video/rockchip/rk3288_mipi.c
drivers/video/rockchip/rk3288_vop.c
drivers/video/rockchip/rk3399_hdmi.c
drivers/video/rockchip/rk3399_mipi.c
drivers/video/rockchip/rk3399_vop.c
drivers/video/rockchip/rk_edp.c
drivers/video/rockchip/rk_hdmi.c
drivers/video/rockchip/rk_lvds.c
drivers/video/rockchip/rk_mipi.c
drivers/video/rockchip/rk_vop.c
drivers/video/rockchip/rk_vop.h
include/configs/rk3036_common.h
include/configs/rk3188_common.h
include/configs/rk322x_common.h
include/configs/rk3288_common.h
include/configs/rk3368_common.h
include/configs/rv1108_common.h
include/efi_loader.h
include/efi_selftest.h
lib/efi_loader/efi_bootmgr.c
lib/efi_loader/efi_boottime.c
lib/efi_loader/efi_memory.c
lib/efi_loader/efi_setup.c
lib/efi_selftest/efi_selftest_miniapp_exit.c
lib/efi_selftest/efi_selftest_startimage_exit.c
lib/uuid.c

index 7552783..5891fd0 100644 (file)
@@ -239,6 +239,7 @@ F:  arch/arm/mach-rmobile/
 ARM ROCKCHIP
 M:     Simon Glass <sjg@chromium.org>
 M:     Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
+M:     Kever Yang <kever.yang@rock-chips.com>
 S:     Maintained
 T:     git git://git.denx.de/u-boot-rockchip.git
 F:     arch/arm/include/asm/arch-rockchip/
index e84f3d7..49f01f1 100644 (file)
@@ -1439,6 +1439,7 @@ config ARCH_ROCKCHIP
        select SYS_THUMB_BUILD if !ARM64
        imply ADC
        imply CMD_DM
+       imply DEBUG_UART_BOARD_INIT
        imply DISTRO_DEFAULTS
        imply FAT_WRITE
        imply SARADC_ROCKCHIP
index fe52166..ecee9e3 100644 (file)
@@ -26,7 +26,11 @@ _start:
  * order to boot, allow them to set that in their boot0.h file and then
  * use it here.
  */
+#ifdef CONFIG_ARCH_ROCKCHIP
+#include <asm/arch-rockchip/boot0.h>
+#else
 #include <asm/arch/boot0.h>
+#endif
 #else
        b       reset
 #endif
index 27d82ea..8e082f2 100644 (file)
@@ -74,6 +74,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += \
        rk3288-fennec.dtb \
        rk3288-firefly.dtb \
        rk3288-miqi.dtb \
+       rk3399-orangepi.dtb \
        rk3288-phycore-rdk.dtb \
        rk3288-popmetal.dtb \
        rk3288-rock2-square.dtb \
index ce004d0..9162f3d 100644 (file)
 };
 
 &sdmmc {
-       u-boot,dm-pre-reloc;
        bus-width = <4>;
        status = "okay";
 };
index f90e7e8..46f2ffa 100644 (file)
 };
 
 &sdmmc {
-       u-boot,dm-pre-reloc;
        bus-width = <4>;
        status = "okay";
 };
diff --git a/arch/arm/dts/rk3399-opp.dtsi b/arch/arm/dts/rk3399-opp.dtsi
new file mode 100644 (file)
index 0000000..d6f1095
--- /dev/null
@@ -0,0 +1,133 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2016-2017 Fuzhou Rockchip Electronics Co., Ltd
+ */
+
+/ {
+       cluster0_opp: opp-table0 {
+               compatible = "operating-points-v2";
+               opp-shared;
+
+               opp00 {
+                       opp-hz = /bits/ 64 <408000000>;
+                       opp-microvolt = <800000>;
+                       clock-latency-ns = <40000>;
+               };
+               opp01 {
+                       opp-hz = /bits/ 64 <600000000>;
+                       opp-microvolt = <800000>;
+               };
+               opp02 {
+                       opp-hz = /bits/ 64 <816000000>;
+                       opp-microvolt = <850000>;
+               };
+               opp03 {
+                       opp-hz = /bits/ 64 <1008000000>;
+                       opp-microvolt = <925000>;
+               };
+               opp04 {
+                       opp-hz = /bits/ 64 <1200000000>;
+                       opp-microvolt = <1000000>;
+               };
+               opp05 {
+                       opp-hz = /bits/ 64 <1416000000>;
+                       opp-microvolt = <1125000>;
+               };
+       };
+
+       cluster1_opp: opp-table1 {
+               compatible = "operating-points-v2";
+               opp-shared;
+
+               opp00 {
+                       opp-hz = /bits/ 64 <408000000>;
+                       opp-microvolt = <800000>;
+                       clock-latency-ns = <40000>;
+               };
+               opp01 {
+                       opp-hz = /bits/ 64 <600000000>;
+                       opp-microvolt = <800000>;
+               };
+               opp02 {
+                       opp-hz = /bits/ 64 <816000000>;
+                       opp-microvolt = <825000>;
+               };
+               opp03 {
+                       opp-hz = /bits/ 64 <1008000000>;
+                       opp-microvolt = <875000>;
+               };
+               opp04 {
+                       opp-hz = /bits/ 64 <1200000000>;
+                       opp-microvolt = <950000>;
+               };
+               opp05 {
+                       opp-hz = /bits/ 64 <1416000000>;
+                       opp-microvolt = <1025000>;
+               };
+               opp06 {
+                       opp-hz = /bits/ 64 <1608000000>;
+                       opp-microvolt = <1100000>;
+               };
+               opp07 {
+                       opp-hz = /bits/ 64 <1800000000>;
+                       opp-microvolt = <1200000>;
+               };
+       };
+
+       gpu_opp_table: opp-table2 {
+               compatible = "operating-points-v2";
+
+               opp00 {
+                       opp-hz = /bits/ 64 <200000000>;
+                       opp-microvolt = <800000>;
+               };
+               opp01 {
+                       opp-hz = /bits/ 64 <297000000>;
+                       opp-microvolt = <800000>;
+               };
+               opp02 {
+                       opp-hz = /bits/ 64 <400000000>;
+                       opp-microvolt = <825000>;
+               };
+               opp03 {
+                       opp-hz = /bits/ 64 <500000000>;
+                       opp-microvolt = <875000>;
+               };
+               opp04 {
+                       opp-hz = /bits/ 64 <600000000>;
+                       opp-microvolt = <925000>;
+               };
+               opp05 {
+                       opp-hz = /bits/ 64 <800000000>;
+                       opp-microvolt = <1100000>;
+               };
+       };
+};
+
+&cpu_l0 {
+       operating-points-v2 = <&cluster0_opp>;
+};
+
+&cpu_l1 {
+       operating-points-v2 = <&cluster0_opp>;
+};
+
+&cpu_l2 {
+       operating-points-v2 = <&cluster0_opp>;
+};
+
+&cpu_l3 {
+       operating-points-v2 = <&cluster0_opp>;
+};
+
+&cpu_b0 {
+       operating-points-v2 = <&cluster1_opp>;
+};
+
+&cpu_b1 {
+       operating-points-v2 = <&cluster1_opp>;
+};
+
+&gpu {
+       operating-points-v2 = <&gpu_opp_table>;
+};
diff --git a/arch/arm/dts/rk3399-orangepi-u-boot.dtsi b/arch/arm/dts/rk3399-orangepi-u-boot.dtsi
new file mode 100644 (file)
index 0000000..236b61d
--- /dev/null
@@ -0,0 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2019 Jagan Teki <jagan@amarulasolutions.com>
+ */
+
+#include "rk3399-u-boot.dtsi"
+#include "rk3399-sdram-ddr3-1333.dtsi"
diff --git a/arch/arm/dts/rk3399-orangepi.dts b/arch/arm/dts/rk3399-orangepi.dts
new file mode 100644 (file)
index 0000000..cf37b96
--- /dev/null
@@ -0,0 +1,771 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2017 Fuzhou Rockchip Electronics Co., Ltd.
+ */
+
+/dts-v1/;
+
+#include "dt-bindings/pwm/pwm.h"
+#include "dt-bindings/input/input.h"
+#include "rk3399.dtsi"
+#include "rk3399-opp.dtsi"
+
+/ {
+       model = "Orange Pi RK3399 Board";
+       compatible = "rockchip,rk3399-orangepi", "rockchip,rk3399";
+
+       chosen {
+               stdout-path = "serial2:1500000n8";
+       };
+
+       clkin_gmac: external-gmac-clock {
+               compatible = "fixed-clock";
+               clock-frequency = <125000000>;
+               clock-output-names = "clkin_gmac";
+               #clock-cells = <0>;
+       };
+
+       adc-keys {
+               compatible = "adc-keys";
+               io-channels = <&saradc 1>;
+               io-channel-names = "buttons";
+               keyup-threshold-microvolt = <1800000>;
+               poll-interval = <100>;
+
+               button-up {
+                       label = "Volume Up";
+                       linux,code = <KEY_VOLUMEUP>;
+                       press-threshold-microvolt = <100000>;
+               };
+
+               button-down {
+                       label = "Volume Down";
+                       linux,code = <KEY_VOLUMEDOWN>;
+                       press-threshold-microvolt = <300000>;
+               };
+
+               back {
+                       label = "Back";
+                       linux,code = <KEY_BACK>;
+                       press-threshold-microvolt = <985000>;
+               };
+
+               menu {
+                       label = "Menu";
+                       linux,code = <KEY_MENU>;
+                       press-threshold-microvolt = <1314000>;
+               };
+       };
+
+       dc_12v: dc-12v {
+               compatible = "regulator-fixed";
+               regulator-name = "dc_12v";
+               regulator-always-on;
+               regulator-boot-on;
+               regulator-min-microvolt = <12000000>;
+               regulator-max-microvolt = <12000000>;
+       };
+
+       keys: gpio-keys {
+               compatible = "gpio-keys";
+               autorepeat;
+
+               power {
+                       debounce-interval = <100>;
+                       gpios = <&gpio0 RK_PA5 GPIO_ACTIVE_LOW>;
+                       label = "GPIO Power";
+                       linux,code = <KEY_POWER>;
+                       linux,input-type = <1>;
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&pwr_btn>;
+                       wakeup-source;
+               };
+       };
+
+       sdio_pwrseq: sdio-pwrseq {
+               compatible = "mmc-pwrseq-simple";
+               clocks = <&rk808 1>;
+               clock-names = "ext_clock";
+               pinctrl-names = "default";
+               pinctrl-0 = <&wifi_reg_on_h>;
+               reset-gpios = <&gpio0 RK_PB2 GPIO_ACTIVE_LOW>;
+       };
+
+       /* switched by pmic_sleep */
+       vcc1v8_s3: vcca1v8_s3: vcc1v8-s3 {
+               compatible = "regulator-fixed";
+               regulator-name = "vcc1v8_s3";
+               regulator-always-on;
+               regulator-boot-on;
+               regulator-min-microvolt = <1800000>;
+               regulator-max-microvolt = <1800000>;
+               vin-supply = <&vcc_1v8>;
+       };
+
+       vcc3v0_sd: vcc3v0-sd {
+               compatible = "regulator-fixed";
+               enable-active-high;
+               gpio = <&gpio0 RK_PA1 GPIO_ACTIVE_HIGH>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&sdmmc0_pwr_h>;
+               regulator-boot-on;
+               regulator-max-microvolt = <3000000>;
+               regulator-min-microvolt = <3000000>;
+               regulator-name = "vcc3v0_sd";
+               vin-supply = <&vcc3v3_sys>;
+       };
+
+       vcc3v3_sys: vcc3v3-sys {
+               compatible = "regulator-fixed";
+               regulator-name = "vcc3v3_sys";
+               regulator-always-on;
+               regulator-boot-on;
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               vin-supply = <&vcc_sys>;
+       };
+
+       vcc5v0_host: vcc5v0-host-regulator {
+               compatible = "regulator-fixed";
+               enable-active-high;
+               gpio = <&gpio4 RK_PD1 GPIO_ACTIVE_HIGH>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&vcc5v0_host_en>;
+               regulator-name = "vcc5v0_host";
+               regulator-always-on;
+               vin-supply = <&vcc_sys>;
+       };
+
+       vcc5v0_typec0: vcc5v0-typec0-regulator {
+               compatible = "regulator-fixed";
+               enable-active-high;
+               gpio = <&gpio1 RK_PA3 GPIO_ACTIVE_HIGH>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&vcc5v0_typec0_en>;
+               regulator-name = "vcc5v0_typec0";
+               vin-supply = <&vcc_sys>;
+       };
+
+       vcc_sys: vcc-sys {
+               compatible = "regulator-fixed";
+               regulator-name = "vcc_sys";
+               regulator-always-on;
+               regulator-boot-on;
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               vin-supply = <&dc_12v>;
+       };
+
+       vdd_log: vdd-log {
+               compatible = "pwm-regulator";
+               pwms = <&pwm2 0 25000 1>;
+               regulator-name = "vdd_log";
+               regulator-always-on;
+               regulator-boot-on;
+               regulator-min-microvolt = <800000>;
+               regulator-max-microvolt = <1400000>;
+               vin-supply = <&vcc_sys>;
+       };
+};
+
+&cpu_l0 {
+       cpu-supply = <&vdd_cpu_l>;
+};
+
+&cpu_l1 {
+       cpu-supply = <&vdd_cpu_l>;
+};
+
+&cpu_l2 {
+       cpu-supply = <&vdd_cpu_l>;
+};
+
+&cpu_l3 {
+       cpu-supply = <&vdd_cpu_l>;
+};
+
+&cpu_b0 {
+       cpu-supply = <&vdd_cpu_b>;
+};
+
+&cpu_b1 {
+       cpu-supply = <&vdd_cpu_b>;
+};
+
+&emmc_phy {
+       status = "okay";
+};
+
+&gmac {
+       assigned-clocks = <&cru SCLK_RMII_SRC>;
+       assigned-clock-parents = <&clkin_gmac>;
+       clock_in_out = "input";
+       phy-supply = <&vcc3v3_s3>;
+       phy-mode = "rgmii";
+       pinctrl-names = "default";
+       pinctrl-0 = <&rgmii_pins>;
+       snps,reset-gpio = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>;
+       snps,reset-active-low;
+       snps,reset-delays-us = <0 10000 50000>;
+       tx_delay = <0x28>;
+       rx_delay = <0x11>;
+       status = "okay";
+};
+
+&gpu {
+       mali-supply = <&vdd_gpu>;
+       status = "okay";
+};
+
+&hdmi {
+       ddc-i2c-bus = <&i2c3>;
+       status = "okay";
+};
+
+&hdmi_sound {
+       status = "okay";
+};
+
+&i2c0 {
+       clock-frequency = <400000>;
+       i2c-scl-rising-time-ns = <168>;
+       i2c-scl-falling-time-ns = <4>;
+       status = "okay";
+
+       rk808: pmic@1b {
+               compatible = "rockchip,rk808";
+               reg = <0x1b>;
+               interrupt-parent = <&gpio1>;
+               interrupts = <21 IRQ_TYPE_LEVEL_LOW>;
+               #clock-cells = <1>;
+               clock-output-names = "rtc_clko_soc", "rtc_clko_wifi";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pmic_int_l>;
+               rockchip,system-power-controller;
+               wakeup-source;
+
+               vcc1-supply = <&vcc3v3_sys>;
+               vcc2-supply = <&vcc3v3_sys>;
+               vcc3-supply = <&vcc3v3_sys>;
+               vcc4-supply = <&vcc3v3_sys>;
+               vcc6-supply = <&vcc3v3_sys>;
+               vcc7-supply = <&vcc3v3_sys>;
+               vcc8-supply = <&vcc3v3_sys>;
+               vcc9-supply = <&vcc3v3_sys>;
+               vcc10-supply = <&vcc3v3_sys>;
+               vcc11-supply = <&vcc3v3_sys>;
+               vcc12-supply = <&vcc3v3_sys>;
+               vddio-supply = <&vcc_3v0>;
+
+               regulators {
+                       vdd_center: DCDC_REG1 {
+                               regulator-name = "vdd_center";
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-min-microvolt = <700000>;
+                               regulator-max-microvolt = <1500000>;
+                               regulator-ramp-delay = <6001>;
+                               regulator-state-mem {
+                                       regulator-off-in-suspend;
+                               };
+                       };
+
+                       vdd_cpu_l: DCDC_REG2 {
+                               regulator-name = "vdd_cpu_l";
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-min-microvolt = <700000>;
+                               regulator-max-microvolt = <1500000>;
+                               regulator-ramp-delay = <6001>;
+                               regulator-state-mem {
+                                       regulator-off-in-suspend;
+                               };
+                       };
+
+                       vcc_ddr: DCDC_REG3 {
+                               regulator-name = "vcc_ddr";
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-state-mem {
+                                       regulator-on-in-suspend;
+                               };
+                       };
+
+                       vcc_1v8: DCDC_REG4 {
+                               regulator-name = "vcc_1v8";
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-state-mem {
+                                       regulator-on-in-suspend;
+                                       regulator-suspend-microvolt = <1800000>;
+                               };
+                       };
+
+                       vcc1v8_dvp: LDO_REG1 {
+                               regulator-name = "vcc1v8_dvp";
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <3400000>;
+                               regulator-state-mem {
+                                       regulator-off-in-suspend;
+                               };
+                       };
+
+                       vcc3v0_tp: LDO_REG2 {
+                               regulator-name = "vcc3v0_tp";
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <3400000>;
+                               regulator-state-mem {
+                                       regulator-off-in-suspend;
+                               };
+                       };
+
+                       vcc1v8_pmupll: LDO_REG3 {
+                               regulator-name = "vcc1v8_pmupll";
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-min-microvolt = <800000>;
+                               regulator-max-microvolt = <2500000>;
+                               regulator-state-mem {
+                                       regulator-on-in-suspend;
+                                       regulator-suspend-microvolt = <1800000>;
+                               };
+                       };
+
+                       vcc_sdio: LDO_REG4 {
+                               regulator-name = "vcc_sdio";
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <3400000>;
+                               regulator-state-mem {
+                                       regulator-on-in-suspend;
+                                       regulator-suspend-microvolt = <3000000>;
+                               };
+                       };
+
+                       vcca3v0_codec: LDO_REG5 {
+                               regulator-name = "vcca3v0_codec";
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <3400000>;
+                               regulator-state-mem {
+                                       regulator-off-in-suspend;
+                               };
+                       };
+
+                       vcc_1v5: LDO_REG6 {
+                               regulator-name = "vcc_1v5";
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-min-microvolt = <800000>;
+                               regulator-max-microvolt = <2500000>;
+                               regulator-state-mem {
+                                       regulator-on-in-suspend;
+                                       regulator-suspend-microvolt = <1500000>;
+                               };
+                       };
+
+                       vcca1v8_codec: LDO_REG7 {
+                               regulator-name = "vcca1v8_codec";
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-min-microvolt = <800000>;
+                               regulator-max-microvolt = <2500000>;
+                               regulator-state-mem {
+                                       regulator-off-in-suspend;
+                               };
+                       };
+
+                       vcc_3v0: LDO_REG8 {
+                               regulator-name = "vcc_3v0";
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <3400000>;
+                               regulator-state-mem {
+                                       regulator-on-in-suspend;
+                                       regulator-suspend-microvolt = <3000000>;
+                               };
+                       };
+
+                       vcc3v3_s3: SWITCH_REG1 {
+                               regulator-name = "vcc3v3_s3";
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-state-mem {
+                                       regulator-off-in-suspend;
+                               };
+                       };
+
+                       vcc3v3_s0: SWITCH_REG2 {
+                               regulator-name = "vcc3v3_s0";
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-state-mem {
+                                       regulator-off-in-suspend;
+                               };
+                       };
+               };
+       };
+
+       vdd_cpu_b: regulator@40 {
+               compatible = "silergy,syr827";
+               reg = <0x40>;
+               fcs,suspend-voltage-selector = <1>;
+               regulator-name = "vdd_cpu_b";
+               regulator-min-microvolt = <712500>;
+               regulator-max-microvolt = <1500000>;
+               regulator-ramp-delay = <1000>;
+               regulator-always-on;
+               regulator-boot-on;
+               vin-supply = <&vcc3v3_sys>;
+
+               regulator-state-mem {
+                       regulator-off-in-suspend;
+               };
+       };
+
+       vdd_gpu: regulator@41 {
+               compatible = "silergy,syr828";
+               reg = <0x41>;
+               fcs,suspend-voltage-selector = <1>;
+               regulator-name = "vdd_gpu";
+               regulator-min-microvolt = <712500>;
+               regulator-max-microvolt = <1500000>;
+               regulator-ramp-delay = <1000>;
+               regulator-always-on;
+               regulator-boot-on;
+               vin-supply = <&vcc3v3_sys>;
+
+               regulator-state-mem {
+                       regulator-off-in-suspend;
+               };
+       };
+};
+
+&i2c1 {
+       i2c-scl-rising-time-ns = <450>;
+       i2c-scl-falling-time-ns = <15>;
+       status = "okay";
+};
+
+&i2c3 {
+       i2c-scl-rising-time-ns = <450>;
+       i2c-scl-falling-time-ns = <15>;
+       status = "okay";
+};
+
+&i2c4 {
+       clock-frequency = <400000>;
+       i2c-scl-rising-time-ns = <450>;
+       i2c-scl-falling-time-ns = <15>;
+       status = "okay";
+
+       ak09911@c {
+               compatible = "asahi-kasei,ak09911";
+               reg = <0x0c>;
+               vdd-supply = <&vcc3v3_s3>;
+       };
+
+       mpu6500@68 {
+               compatible = "invensense,mpu6500";
+               reg = <0x68>;
+               interrupt-parent = <&gpio1>;
+               interrupts = <RK_PC6 IRQ_TYPE_EDGE_RISING>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&gsensor_int_l>;
+               vddio-supply = <&vcc3v3_s3>;
+       };
+
+       lsm6ds3@6a {
+               compatible = "st,lsm6ds3";
+               reg = <0x6a>;
+               interrupt-parent = <&gpio1>;
+               interrupts = <RK_PD0 IRQ_TYPE_EDGE_RISING>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&gyr_int_l>;
+               vdd-supply = <&vcc3v3_s3>;
+               vddio-supply = <&vcc3v3_s3>;
+       };
+
+       cm32181@10 {
+               compatible = "capella,cm32181";
+               reg = <0x10>;
+               interrupt-parent = <&gpio4>;
+               interrupts = <RK_PD0 IRQ_TYPE_EDGE_RISING>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&light_int_l>;
+               vdd-supply = <&vcc3v3_s3>;
+       };
+};
+
+&io_domains {
+       status = "okay";
+       bt656-supply = <&vcc_3v0>;
+       audio-supply = <&vcca1v8_codec>;
+       sdmmc-supply = <&vcc_sdio>;
+       gpio1830-supply = <&vcc_3v0>;
+};
+
+&pmu_io_domains {
+       status = "okay";
+       pmu1830-supply = <&vcc_3v0>;
+};
+
+&pinctrl {
+       buttons {
+               pwr_btn: pwr-btn {
+                       rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>;
+               };
+       };
+
+       pmic {
+               pmic_int_l: pmic-int-l {
+                       rockchip,pins =
+                               <1 RK_PC5 RK_FUNC_GPIO &pcfg_pull_up>;
+               };
+       };
+
+       sd {
+               sdmmc0_pwr_h: sdmmc0-pwr-h {
+                       rockchip,pins =
+                               <RK_GPIO0 RK_PA1 RK_FUNC_GPIO &pcfg_pull_none>;
+               };
+       };
+
+       usb2 {
+               vcc5v0_host_en: vcc5v0-host-en {
+                       rockchip,pins =
+                               <4 RK_PD1 RK_FUNC_GPIO &pcfg_pull_none>;
+               };
+
+               vcc5v0_typec0_en: vcc5v0-typec0-en {
+                       rockchip,pins =
+                               <1 RK_PA3 RK_FUNC_GPIO &pcfg_pull_none>;
+               };
+       };
+
+       sdio-pwrseq {
+               wifi_reg_on_h: wifi-reg-on-h {
+                       rockchip,pins = <0 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>;
+               };
+       };
+
+       wifi {
+               wifi_host_wake_l: wifi-host-wake-l {
+                       rockchip,pins = <0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_none>;
+               };
+       };
+
+       bluetooth {
+               bt_reg_on_h: bt-enable-h {
+                       rockchip,pins = <0 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>;
+               };
+
+               bt_host_wake_l: bt-host-wake-l {
+                       rockchip,pins = <0 RK_PA4 RK_FUNC_GPIO &pcfg_pull_none>;
+               };
+
+               bt_wake_l: bt-wake-l {
+                       rockchip,pins = <2 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>;
+               };
+       };
+
+       mpu6500 {
+               gsensor_int_l: gsensor-int-l {
+                       rockchip,pins = <1 RK_PC6 RK_FUNC_GPIO &pcfg_pull_none>;
+               };
+       };
+
+       lsm6ds3 {
+               gyr_int_l: gyr-int-l {
+                       rockchip,pins = <1 RK_PD0 RK_FUNC_GPIO &pcfg_pull_none>;
+               };
+       };
+
+       cm32181 {
+               light_int_l: light-int-l {
+                       rockchip,pins = <4 RK_PD0 RK_FUNC_GPIO &pcfg_pull_none>;
+               };
+       };
+};
+
+&pwm0 {
+       status = "okay";
+};
+
+&pwm2 {
+       status = "okay";
+};
+
+&saradc {
+       vref-supply = <&vcca1v8_s3>;
+       status = "okay";
+};
+
+&sdhci {
+       bus-width = <8>;
+       mmc-hs400-1_8v;
+       mmc-hs400-enhanced-strobe;
+       non-removable;
+       status = "okay";
+};
+
+&sdio0 {
+       bus-width = <4>;
+       cap-sd-highspeed;
+       cap-sdio-irq;
+       clock-frequency = <50000000>;
+       disable-wp;
+       keep-power-in-suspend;
+       max-frequency = <50000000>;
+       mmc-pwrseq = <&sdio_pwrseq>;
+       non-removable;
+       pinctrl-names = "default";
+       pinctrl-0 = <&sdio0_bus4 &sdio0_cmd &sdio0_clk>;
+       sd-uhs-sdr104;
+       status = "okay";
+
+       brcmf: wifi@1 {
+               compatible = "brcm,bcm4329-fmac";
+               interrupt-parent = <&gpio0>;
+               interrupts = <RK_PA3 GPIO_ACTIVE_HIGH>;
+               interrupt-names = "host-wake";
+               pinctrl-names = "default";
+               pinctrl-0 = <&wifi_host_wake_l>;
+       };
+};
+
+&sdmmc {
+       bus-width = <4>;
+       cap-mmc-highspeed;
+       cap-sd-highspeed;
+       cd-gpios = <&gpio0 RK_PA7 GPIO_ACTIVE_LOW>;
+       clock-frequency = <150000000>;
+       disable-wp;
+       max-frequency = <150000000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_bus4>;
+       vmmc-supply = <&vcc3v0_sd>;
+       vqmmc-supply = <&vcc_sdio>;
+       status = "okay";
+};
+
+&tcphy0 {
+       status = "okay";
+};
+
+&tcphy1 {
+       status = "okay";
+};
+
+&tsadc {
+       rockchip,hw-tshut-mode = <1>;
+       rockchip,hw-tshut-polarity = <1>;
+       status = "okay";
+};
+
+&u2phy0 {
+       status = "okay";
+
+       u2phy0_otg: otg-port {
+               phy-supply = <&vcc5v0_typec0>;
+               status = "okay";
+       };
+
+       u2phy0_host: host-port {
+               phy-supply = <&vcc5v0_host>;
+               status = "okay";
+       };
+};
+
+&u2phy1 {
+       status = "okay";
+
+       u2phy1_otg: otg-port {
+               status = "okay";
+       };
+
+       u2phy1_host: host-port {
+               phy-supply = <&vcc5v0_host>;
+               status = "okay";
+       };
+};
+
+&uart0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&uart0_xfer &uart0_cts &uart0_rts>;
+       status = "okay";
+
+       bluetooth {
+               compatible = "brcm,bcm43438-bt";
+               clocks = <&rk808 1>;
+               clock-names = "ext_clock";
+               device-wakeup-gpios = <&gpio2 RK_PD2 GPIO_ACTIVE_HIGH>;
+               host-wakeup-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_HIGH>;
+               shutdown-gpios = <&gpio0 RK_PB1 GPIO_ACTIVE_HIGH>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&bt_host_wake_l &bt_wake_l &bt_reg_on_h>;
+       };
+};
+
+&uart2 {
+       status = "okay";
+};
+
+&usb_host0_ehci {
+       status = "okay";
+};
+
+&usb_host0_ohci {
+       status = "okay";
+};
+
+&usb_host1_ehci {
+       status = "okay";
+};
+
+&usb_host1_ohci {
+       status = "okay";
+};
+
+&usbdrd3_0 {
+       status = "okay";
+};
+
+&usbdrd_dwc3_0 {
+       status = "okay";
+       dr_mode = "otg";
+};
+
+&usbdrd3_1 {
+       status = "okay";
+};
+
+&usbdrd_dwc3_1 {
+       status = "okay";
+       dr_mode = "host";
+};
+
+&vopb {
+       status = "okay";
+};
+
+&vopb_mmu {
+       status = "okay";
+};
+
+&vopl {
+       status = "okay";
+};
+
+&vopl_mmu {
+       status = "okay";
+};
index aec13a2..319a610 100644 (file)
 };
 
 &sdmmc {
-       u-boot,dm-pre-reloc;
        clock-frequency = <150000000>;
        max-frequency = <40000000>;
        supports-sd;
diff --git a/arch/arm/dts/rk3399-u-boot.dtsi b/arch/arm/dts/rk3399-u-boot.dtsi
new file mode 100644 (file)
index 0000000..f533ed9
--- /dev/null
@@ -0,0 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2019 Jagan Teki <jagan@amarulasolutions.com>
+ */
+
+&sdmmc {
+       u-boot,dm-pre-reloc;
+};
index a6d66d1..db83d0e 100644 (file)
@@ -6,7 +6,7 @@
 #ifndef _ASM_ARCH_DDR_RK3188_H
 #define _ASM_ARCH_DDR_RK3188_H
 
-#include <asm/arch/ddr_rk3288.h>
+#include <asm/arch-rockchip/ddr_rk3288.h>
 
 /*
  * RK3188 Memory scheduler register map.
index cd94bdd..62e8bed 100644 (file)
@@ -10,8 +10,6 @@
 #define RK_SETBITS(set)                        RK_CLRSETBITS(0, set)
 #define RK_CLRBITS(clr)                        RK_CLRSETBITS(clr, 0)
 
-#define TIMER7_BASE            0xff810020
-
 #define rk_clrsetreg(addr, clr, set)   \
                                writel(((clr) | (set)) << 16 | (set), addr)
 #define rk_clrreg(addr, clr)           writel((clr) << 16, addr)
index 992a841..370031f 100644 (file)
@@ -1,6 +1,6 @@
 #if !defined(CONFIG_ARCH_UNIPHIER) && !defined(CONFIG_ARCH_STI) && \
        !defined(CONFIG_ARCH_K3) && !defined(CONFIG_ARCH_BCM6858) && \
-       !defined(CONFIG_ARCH_BCM63158)
+       !defined(CONFIG_ARCH_BCM63158) && !defined(CONFIG_ARCH_ROCKCHIP)
 #include <asm/arch/gpio.h>
 #endif
 #include <asm-generic/gpio.h>
index 2ca6e24..20f4851 100644 (file)
  *   (1) defines '_start:' as appropriate
  *   (2) inserts the vector table using ARM_VECTORS as appropriate
  */
+#ifdef CONFIG_ARCH_ROCKCHIP
+#include <asm/arch-rockchip/boot0.h>
+#else
 #include <asm/arch/boot0.h>
-
+#endif
 #else
 
 /*
index b9a026a..282d728 100644 (file)
@@ -34,7 +34,6 @@ config ROCKCHIP_RK3188
        select SPL_RAM
        select SPL_DRIVERS_MISC_SUPPORT
        select SPL_ROCKCHIP_EARLYRETURN_TO_BROM
-       select DEBUG_UART_BOARD_INIT
        select BOARD_LATE_INIT
        select ROCKCHIP_BROM_HELPER
        help
@@ -50,7 +49,6 @@ config ROCKCHIP_RK322X
        select SUPPORT_SPL
        select SPL
        select ROCKCHIP_BROM_HELPER
-       select DEBUG_UART_BOARD_INIT
        help
          The Rockchip RK3229 is a ARM-based SoC with a dual-core Cortex-A7
          including NEON and GPU, Mali-400 graphics, several DDR3 options
@@ -102,7 +100,6 @@ config ROCKCHIP_RK3368
        imply SPL_SEPARATE_BSS
        imply SPL_SERIAL_SUPPORT
        imply TPL_SERIAL_SUPPORT
-       select DEBUG_UART_BOARD_INIT
        help
          The Rockchip RK3368 is a ARM-based SoC with a octa-core (organised
          into a big and little cluster with 4 cores each) Cortex-A53 including
@@ -135,7 +132,6 @@ config ROCKCHIP_RK3399
        select SPL_SEPARATE_BSS
        select SPL_SERIAL_SUPPORT
        select SPL_DRIVERS_MISC_SUPPORT
-       select DEBUG_UART_BOARD_INIT
        select BOARD_LATE_INIT
        select ROCKCHIP_BROM_HELPER
        help
@@ -192,7 +188,7 @@ config ROCKCHIP_BOOT_MODE_REG
        default 0x10300580 if ROCKCHIP_RV1108
        default 0
        help
-         The Soc will enter to different boot mode(defined in asm/arch/boot_mode.h)
+         The Soc will enter to different boot mode(defined in asm/arch-rockchip/boot_mode.h)
          according to the value from this register.
 
 config ROCKCHIP_SPL_RESERVE_IRAM
index f32b3c4..08f80bd 100644 (file)
@@ -6,7 +6,7 @@
 #include <common.h>
 #include <adc.h>
 #include <asm/io.h>
-#include <asm/arch/boot_mode.h>
+#include <asm/arch-rockchip/boot_mode.h>
 
 #if (CONFIG_ROCKCHIP_BOOT_MODE_REG == 0)
 
index 2f2f73a..9ccb45e 100644 (file)
@@ -4,8 +4,8 @@
  */
 
 #include <common.h>
-#include <asm/arch/bootrom.h>
-#include <asm/arch/boot_mode.h>
+#include <asm/arch-rockchip/bootrom.h>
+#include <asm/arch-rockchip/boot_mode.h>
 #include <asm/io.h>
 #include <asm/setjmp.h>
 #include <asm/system.h>
index 5ec69f1..110d06d 100644 (file)
@@ -6,31 +6,13 @@
 #include <common.h>
 #include <debug_uart.h>
 #include <asm/io.h>
-#include <asm/arch/bootrom.h>
-#include <asm/arch/grf_rk3036.h>
-#include <asm/arch/hardware.h>
-#include <asm/arch/sdram_rk3036.h>
-#include <asm/arch/timer.h>
-#include <asm/arch/uart.h>
-
-#define GRF_BASE       0x20008000
-
-#define DEBUG_UART_BASE        0x20068000
+#include <asm/arch-rockchip/bootrom.h>
+#include <asm/arch-rockchip/sdram_rk3036.h>
+#include <asm/arch-rockchip/timer.h>
 
 void board_init_f(ulong dummy)
 {
-#ifdef EARLY_DEBUG
-       struct rk3036_grf * const grf = (void *)GRF_BASE;
-       /*
-        * NOTE: sd card and debug uart use same iomux in rk3036,
-        * so if you enable uart,
-        * you can not boot from sdcard
-        */
-       rk_clrsetreg(&grf->gpio1c_iomux,
-                    GPIO1C3_MASK << GPIO1C3_SHIFT |
-                    GPIO1C2_MASK << GPIO1C2_SHIFT,
-                    GPIO1C3_UART2_SOUT << GPIO1C3_SHIFT |
-                    GPIO1C2_UART2_SIN << GPIO1C2_SHIFT);
+#ifdef CONFIG_DEBUG_UART
        debug_uart_init();
 #endif
        rockchip_timer_init();
index 872bed9..2094a43 100644 (file)
@@ -9,11 +9,11 @@
 #include <ram.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
-#include <asm/arch/clock.h>
-#include <asm/arch/periph.h>
-#include <asm/arch/grf_rk3036.h>
-#include <asm/arch/boot_mode.h>
-#include <asm/arch/sdram_rk3036.h>
+#include <asm/arch-rockchip/clock.h>
+#include <asm/arch-rockchip/periph.h>
+#include <asm/arch-rockchip/grf_rk3036.h>
+#include <asm/arch-rockchip/boot_mode.h>
+#include <asm/arch-rockchip/sdram_rk3036.h>
 #include <dm/pinctrl.h>
 
 DECLARE_GLOBAL_DATA_PTR;
index c63db34..5e04d20 100644 (file)
@@ -9,7 +9,7 @@ config TARGET_KYLIN_RK3036
        select BOARD_LATE_INIT
 
 config SYS_SOC
-       default "rockchip"
+       default "rk3036"
 
 config SYS_MALLOC_F_LEN
        default 0x400
index 20d28f7..299fc50 100644 (file)
@@ -10,4 +10,5 @@ ifndef CONFIG_SPL_BUILD
 obj-y += syscon_rk3036.o
 endif
 
+obj-y += rk3036.o
 obj-y += sdram_rk3036.o
index 2145c59..20e2ed6 100644 (file)
@@ -7,8 +7,8 @@
 #include <common.h>
 #include <dm.h>
 #include <syscon.h>
-#include <asm/arch/clock.h>
-#include <asm/arch/cru_rk3036.h>
+#include <asm/arch-rockchip/clock.h>
+#include <asm/arch-rockchip/cru_rk3036.h>
 
 int rockchip_get_clk(struct udevice **devp)
 {
diff --git a/arch/arm/mach-rockchip/rk3036/rk3036.c b/arch/arm/mach-rockchip/rk3036/rk3036.c
new file mode 100644 (file)
index 0000000..481af8a
--- /dev/null
@@ -0,0 +1,38 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * (C) Copyright 2019 Rockchip Electronics Co., Ltd
+ */
+#include <asm/io.h>
+#include <asm/arch-rockchip/grf_rk3036.h>
+#include <asm/arch-rockchip/hardware.h>
+
+#ifdef CONFIG_DEBUG_UART_BOARD_INIT
+void board_debug_uart_init(void)
+{
+#define GRF_BASE       0x20008000
+       struct rk3036_grf * const grf = (void *)GRF_BASE;
+       enum {
+               GPIO1C3_SHIFT           = 6,
+               GPIO1C3_MASK            = 3 << GPIO1C3_SHIFT,
+               GPIO1C3_GPIO            = 0,
+               GPIO1C3_MMC0_D1,
+               GPIO1C3_UART2_SOUT,
+
+               GPIO1C2_SHIFT           = 4,
+               GPIO1C2_MASK            = 3 << GPIO1C2_SHIFT,
+               GPIO1C2_GPIO            = 0,
+               GPIO1C2_MMC0_D0,
+               GPIO1C2_UART2_SIN,
+       };
+       /*
+        * NOTE: sd card and debug uart use same iomux in rk3036,
+        * so if you enable uart,
+        * you can not boot from sdcard
+        */
+       rk_clrsetreg(&grf->gpio1c_iomux,
+                    GPIO1C3_MASK << GPIO1C3_SHIFT |
+                    GPIO1C2_MASK << GPIO1C2_SHIFT,
+                    GPIO1C3_UART2_SOUT << GPIO1C3_SHIFT |
+                    GPIO1C2_UART2_SIN << GPIO1C2_SHIFT);
+}
+#endif
index 2012d9f..1d940a0 100644 (file)
@@ -5,12 +5,12 @@
 #include <common.h>
 #include <asm/io.h>
 #include <asm/types.h>
-#include <asm/arch/cru_rk3036.h>
-#include <asm/arch/grf_rk3036.h>
-#include <asm/arch/hardware.h>
-#include <asm/arch/sdram_rk3036.h>
-#include <asm/arch/timer.h>
-#include <asm/arch/uart.h>
+#include <asm/arch-rockchip/cru_rk3036.h>
+#include <asm/arch-rockchip/grf_rk3036.h>
+#include <asm/arch-rockchip/hardware.h>
+#include <asm/arch-rockchip/sdram_rk3036.h>
+#include <asm/arch-rockchip/timer.h>
+#include <asm/arch-rockchip/uart.h>
 
 /*
  * we can not fit the code to access the device tree in SPL
index d3f4cc7..c2fd160 100644 (file)
@@ -6,7 +6,7 @@
 #include <common.h>
 #include <dm.h>
 #include <syscon.h>
-#include <asm/arch/clock.h>
+#include <asm/arch-rockchip/clock.h>
 
 static const struct udevice_id rk3036_syscon_ids[] = {
        { .compatible = "rockchip,rk3036-grf", .data = ROCKCHIP_SYSCON_GRF },
index 7fd667a..b1c6638 100644 (file)
@@ -8,11 +8,11 @@
 #include <ram.h>
 #include <syscon.h>
 #include <asm/io.h>
-#include <asm/arch/clock.h>
-#include <asm/arch/periph.h>
-#include <asm/arch/grf_rk3128.h>
-#include <asm/arch/boot_mode.h>
-#include <asm/arch/timer.h>
+#include <asm/arch-rockchip/clock.h>
+#include <asm/arch-rockchip/periph.h>
+#include <asm/arch-rockchip/grf_rk3128.h>
+#include <asm/arch-rockchip/boot_mode.h>
+#include <asm/arch-rockchip/timer.h>
 #include <power/regulator.h>
 
 DECLARE_GLOBAL_DATA_PTR;
index 40655a2..a82b7dc 100644 (file)
@@ -14,7 +14,7 @@ config TARGET_EVB_RK3128
 endchoice
 
 config SYS_SOC
-       default "rockchip"
+       default "rk3128"
 
 config SYS_MALLOC_F_LEN
        default 0x0800
index b9b0297..827750b 100644 (file)
@@ -6,8 +6,8 @@
 #include <common.h>
 #include <dm.h>
 #include <syscon.h>
-#include <asm/arch/clock.h>
-#include <asm/arch/cru_rk3128.h>
+#include <asm/arch-rockchip/clock.h>
+#include <asm/arch-rockchip/cru_rk3128.h>
 
 int rockchip_get_clk(struct udevice **devp)
 {
index 8117895..1406d5d 100644 (file)
@@ -6,7 +6,7 @@
 #include <common.h>
 #include <dm.h>
 #include <syscon.h>
-#include <asm/arch/clock.h>
+#include <asm/arch-rockchip/clock.h>
 
 static const struct udevice_id rk3128_syscon_ids[] = {
        { .compatible = "rockchip,rk3128-grf", .data = ROCKCHIP_SYSCON_GRF },
index 5c09b0e..77b9b36 100644 (file)
 #include <syscon.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
-#include <asm/arch/bootrom.h>
-#include <asm/arch/clock.h>
-#include <asm/arch/grf_rk3188.h>
-#include <asm/arch/hardware.h>
-#include <asm/arch/periph.h>
-#include <asm/arch/pmu_rk3188.h>
-#include <asm/arch/sdram.h>
-#include <asm/arch/timer.h>
+#include <asm/arch-rockchip/bootrom.h>
+#include <asm/arch-rockchip/clock.h>
+#include <asm/arch-rockchip/grf_rk3188.h>
+#include <asm/arch-rockchip/hardware.h>
+#include <asm/arch-rockchip/periph.h>
+#include <asm/arch-rockchip/pmu_rk3188.h>
+#include <asm/arch-rockchip/sdram.h>
+#include <asm/arch-rockchip/timer.h>
 #include <dm/pinctrl.h>
 #include <dm/root.h>
 #include <dm/test.h>
@@ -93,38 +93,12 @@ static int setup_arm_clock(void)
        return ret;
 }
 
-void board_debug_uart_init(void)
-{
-       /* Enable early UART on the RK3188 */
-#define GRF_BASE       0x20008000
-       struct rk3188_grf * const grf = (void *)GRF_BASE;
-       enum {
-               GPIO1B1_SHIFT           = 2,
-               GPIO1B1_MASK            = 3,
-               GPIO1B1_GPIO            = 0,
-               GPIO1B1_UART2_SOUT,
-
-               GPIO1B0_SHIFT           = 0,
-               GPIO1B0_MASK            = 3,
-               GPIO1B0_GPIO            = 0,
-               GPIO1B0_UART2_SIN,
-       };
-
-       /* Enable early UART on the RK3188 */
-       rk_clrsetreg(&grf->gpio1b_iomux,
-                    GPIO1B1_MASK << GPIO1B1_SHIFT |
-                    GPIO1B0_MASK << GPIO1B0_SHIFT,
-                    GPIO1B1_UART2_SOUT << GPIO1B1_SHIFT |
-                    GPIO1B0_UART2_SIN << GPIO1B0_SHIFT);
-}
-
 void board_init_f(ulong dummy)
 {
        struct udevice *dev;
        int ret;
 
-#define EARLY_UART
-#ifdef EARLY_UART
+#ifdef CONFIG_DEBUG_UART
        /*
         * Debug UART can be used from here if required:
         *
index 3802395..e03759f 100644 (file)
 #include <syscon.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
-#include <asm/arch/clock.h>
-#include <asm/arch/grf_rk3188.h>
-#include <asm/arch/periph.h>
-#include <asm/arch/pmu_rk3288.h>
-#include <asm/arch/boot_mode.h>
+#include <asm/arch-rockchip/clock.h>
+#include <asm/arch-rockchip/grf_rk3188.h>
+#include <asm/arch-rockchip/periph.h>
+#include <asm/arch-rockchip/pmu_rk3288.h>
+#include <asm/arch-rockchip/boot_mode.h>
 #include <dm/pinctrl.h>
 
 __weak int rk_board_late_init(void)
index 2bb3566..a6fc691 100644 (file)
@@ -10,7 +10,7 @@ config TARGET_ROCK
          UART and GPIOs.
 
 config SYS_SOC
-       default "rockchip"
+       default "rk3188"
 
 config SYS_MALLOC_F_LEN
        default 0x0800
index 7fa0104..7dc123a 100644 (file)
@@ -6,5 +6,6 @@
 
 ifndef CONFIG_TPL_BUILD
 obj-y += clk_rk3188.o
+obj-y += rk3188.o
 obj-y += syscon_rk3188.o
 endif
index e8fcec7..9d4fc37 100644 (file)
@@ -7,8 +7,8 @@
 #include <common.h>
 #include <dm.h>
 #include <syscon.h>
-#include <asm/arch/clock.h>
-#include <asm/arch/cru_rk3188.h>
+#include <asm/arch-rockchip/clock.h>
+#include <asm/arch-rockchip/cru_rk3188.h>
 
 int rockchip_get_clk(struct udevice **devp)
 {
diff --git a/arch/arm/mach-rockchip/rk3188/rk3188.c b/arch/arm/mach-rockchip/rk3188/rk3188.c
new file mode 100644 (file)
index 0000000..933484e
--- /dev/null
@@ -0,0 +1,36 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * (C) Copyright 2019 Rockchip Electronics Co., Ltd
+ */
+#include <common.h>
+#include <asm/io.h>
+#include <asm/arch-rockchip/grf_rk3188.h>
+#include <asm/arch-rockchip/hardware.h>
+
+#ifdef CONFIG_DEBUG_UART_BOARD_INIT
+void board_debug_uart_init(void)
+{
+       /* Enable early UART on the RK3188 */
+#define GRF_BASE       0x20008000
+       struct rk3188_grf * const grf = (void *)GRF_BASE;
+       enum {
+               GPIO1B1_SHIFT           = 2,
+               GPIO1B1_MASK            = 3,
+               GPIO1B1_GPIO            = 0,
+               GPIO1B1_UART2_SOUT,
+               GPIO1B1_JTAG_TDO,
+
+               GPIO1B0_SHIFT           = 0,
+               GPIO1B0_MASK            = 3,
+               GPIO1B0_GPIO            = 0,
+               GPIO1B0_UART2_SIN,
+               GPIO1B0_JTAG_TDI,
+       };
+
+       rk_clrsetreg(&grf->gpio1b_iomux,
+                    GPIO1B1_MASK << GPIO1B1_SHIFT |
+                    GPIO1B0_MASK << GPIO1B0_SHIFT,
+                    GPIO1B1_UART2_SOUT << GPIO1B1_SHIFT |
+                    GPIO1B0_UART2_SIN << GPIO1B0_SHIFT);
+}
+#endif
index 6572bfa..94f4ec7 100644 (file)
@@ -7,7 +7,7 @@
 #include <common.h>
 #include <dm.h>
 #include <syscon.h>
-#include <asm/arch/clock.h>
+#include <asm/arch-rockchip/clock.h>
 
 static const struct udevice_id rk3188_syscon_ids[] = {
        { .compatible = "rockchip,rk3188-noc", .data = ROCKCHIP_SYSCON_NOC },
index 1e718f2..888310e 100644 (file)
@@ -9,55 +9,14 @@
 #include <ram.h>
 #include <spl.h>
 #include <asm/io.h>
-#include <asm/arch/bootrom.h>
-#include <asm/arch/cru_rk322x.h>
-#include <asm/arch/grf_rk322x.h>
-#include <asm/arch/hardware.h>
-#include <asm/arch/timer.h>
-#include <asm/arch/uart.h>
+#include <asm/arch-rockchip/bootrom.h>
+#include <asm/arch-rockchip/hardware.h>
+#include <asm/arch-rockchip/timer.h>
 
 u32 spl_boot_device(void)
 {
        return BOOT_DEVICE_MMC1;
 }
-#define GRF_BASE       0x11000000
-#define SGRF_BASE      0x10140000
-
-#define DEBUG_UART_BASE        0x11030000
-
-void board_debug_uart_init(void)
-{
-       static struct rk322x_grf * const grf = (void *)GRF_BASE;
-       enum {
-               GPIO1B2_SHIFT           = 4,
-               GPIO1B2_MASK            = 3 << GPIO1B2_SHIFT,
-               GPIO1B2_GPIO            = 0,
-               GPIO1B2_UART1_SIN,
-               GPIO1B2_UART21_SIN,
-
-               GPIO1B1_SHIFT           = 2,
-               GPIO1B1_MASK            = 3 << GPIO1B1_SHIFT,
-               GPIO1B1_GPIO            = 0,
-               GPIO1B1_UART1_SOUT,
-               GPIO1B1_UART21_SOUT,
-       };
-       enum {
-               CON_IOMUX_UART2SEL_SHIFT= 8,
-               CON_IOMUX_UART2SEL_MASK = 1 << CON_IOMUX_UART2SEL_SHIFT,
-               CON_IOMUX_UART2SEL_2    = 0,
-               CON_IOMUX_UART2SEL_21,
-       };
-
-       /* Enable early UART2 channel 1 on the RK322x */
-       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);
-}
 
 #define SGRF_DDR_CON0 0x10150000
 void board_init_f(ulong dummy)
@@ -65,6 +24,7 @@ void board_init_f(ulong dummy)
        struct udevice *dev;
        int ret;
 
+#ifdef CONFIG_DEBUG_UART
        /*
         * Debug UART can be used from here if required:
         *
@@ -75,7 +35,7 @@ void board_init_f(ulong dummy)
         */
        debug_uart_init();
        printascii("SPL Init");
-
+#endif
        ret = spl_early_init();
        if (ret) {
                debug("spl_early_init() failed: %d\n", ret);
index 5659248..6170c76 100644 (file)
@@ -8,10 +8,10 @@
 #include <ram.h>
 #include <syscon.h>
 #include <asm/io.h>
-#include <asm/arch/boot_mode.h>
-#include <asm/arch/clock.h>
-#include <asm/arch/periph.h>
-#include <asm/arch/grf_rk322x.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;
 
@@ -29,37 +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;
-       enum {
-               GPIO1B2_SHIFT           = 4,
-               GPIO1B2_MASK            = 3 << GPIO1B2_SHIFT,
-               GPIO1B2_GPIO            = 0,
-               GPIO1B2_UART21_SIN,
-
-               GPIO1B1_SHIFT           = 2,
-               GPIO1B1_MASK            = 3 << GPIO1B1_SHIFT,
-               GPIO1B1_GPIO            = 0,
-               GPIO1B1_UART1_SOUT,
-               GPIO1B1_UART21_SOUT,
-       };
-       enum {
-               CON_IOMUX_UART2SEL_SHIFT= 8,
-               CON_IOMUX_UART2SEL_MASK = 1 << CON_IOMUX_UART2SEL_SHIFT,
-               CON_IOMUX_UART2SEL_2    = 0,
-               CON_IOMUX_UART2SEL_21,
-       };
-
-       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
index dc8071e..8a1f95f 100644 (file)
@@ -5,7 +5,7 @@ config TARGET_EVB_RK3229
        select BOARD_LATE_INIT
 
 config SYS_SOC
-       default "rockchip"
+       default "rk322x"
 
 config SYS_MALLOC_F_LEN
        default 0x400
index ecb3e8d..89b0fed 100644 (file)
@@ -4,6 +4,6 @@
 # SPDX-License-Identifier:     GPL-2.0+
 #
 
-
 obj-y += clk_rk322x.o
+obj-y += rk322x.o
 obj-y += syscon_rk322x.o
index accf944..958c7b8 100644 (file)
@@ -6,8 +6,8 @@
 #include <common.h>
 #include <dm.h>
 #include <syscon.h>
-#include <asm/arch/clock.h>
-#include <asm/arch/cru_rk322x.h>
+#include <asm/arch-rockchip/clock.h>
+#include <asm/arch-rockchip/cru_rk322x.h>
 
 int rockchip_get_clk(struct udevice **devp)
 {
diff --git a/arch/arm/mach-rockchip/rk322x/rk322x.c b/arch/arm/mach-rockchip/rk322x/rk322x.c
new file mode 100644 (file)
index 0000000..e5250bc
--- /dev/null
@@ -0,0 +1,44 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * (C) Copyright 2019 Rockchip Electronics Co., Ltd
+ */
+#include <asm/io.h>
+#include <asm/arch-rockchip/grf_rk322x.h>
+#include <asm/arch-rockchip/hardware.h>
+
+#ifdef CONFIG_DEBUG_UART_BOARD_INIT
+void board_debug_uart_init(void)
+{
+#define GRF_BASE       0x11000000
+       static struct rk322x_grf * const grf = (void *)GRF_BASE;
+       enum {
+               GPIO1B2_SHIFT           = 4,
+               GPIO1B2_MASK            = 3 << GPIO1B2_SHIFT,
+               GPIO1B2_GPIO            = 0,
+               GPIO1B2_UART1_SIN,
+               GPIO1B2_UART21_SIN,
+
+               GPIO1B1_SHIFT           = 2,
+               GPIO1B1_MASK            = 3 << GPIO1B1_SHIFT,
+               GPIO1B1_GPIO            = 0,
+               GPIO1B1_UART1_SOUT,
+               GPIO1B1_UART21_SOUT,
+       };
+       enum {
+               CON_IOMUX_UART2SEL_SHIFT = 8,
+               CON_IOMUX_UART2SEL_MASK = 1 << CON_IOMUX_UART2SEL_SHIFT,
+               CON_IOMUX_UART2SEL_2    = 0,
+               CON_IOMUX_UART2SEL_21,
+       };
+
+       /* Enable early UART2 channel 1 on the RK322x */
+       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);
+}
+#endif
index 9aa64f8..0d9dca8 100644 (file)
@@ -6,7 +6,7 @@
 #include <common.h>
 #include <dm.h>
 #include <syscon.h>
-#include <asm/arch/clock.h>
+#include <asm/arch-rockchip/clock.h>
 
 static const struct udevice_id rk322x_syscon_ids[] = {
        { .compatible = "rockchip,rk3228-grf", .data = ROCKCHIP_SYSCON_GRF },
index 93c7721..d8d215d 100644 (file)
 #include <spl.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
-#include <asm/arch/bootrom.h>
-#include <asm/arch/clock.h>
-#include <asm/arch/hardware.h>
-#include <asm/arch/periph.h>
-#include <asm/arch/pmu_rk3288.h>
-#include <asm/arch/sdram.h>
-#include <asm/arch/sdram_common.h>
-#include <asm/arch/sys_proto.h>
-#include <asm/arch/timer.h>
+#include <asm/arch-rockchip/bootrom.h>
+#include <asm/arch-rockchip/clock.h>
+#include <asm/arch-rockchip/hardware.h>
+#include <asm/arch-rockchip/periph.h>
+#include <asm/arch-rockchip/pmu_rk3288.h>
+#include <asm/arch-rockchip/sdram.h>
+#include <asm/arch-rockchip/sdram_common.h>
+#include <asm/arch-rockchip/sys_proto.h>
+#include <asm/arch-rockchip/timer.h>
 #include <dm/pinctrl.h>
 #include <dm/root.h>
 #include <dm/test.h>
@@ -109,16 +109,7 @@ void board_init_f(ulong dummy)
        struct udevice *dev;
        int ret;
 
-       /* Example code showing how to enable the debug UART on RK3288 */
-#include <asm/arch/grf_rk3288.h>
-       /* Enable early UART on the RK3288 */
-#define GRF_BASE       0xff770000
-       struct rk3288_grf * const grf = (void *)GRF_BASE;
-
-       rk_clrsetreg(&grf->gpio7ch_iomux, GPIO7C7_MASK << GPIO7C7_SHIFT |
-                    GPIO7C6_MASK << GPIO7C6_SHIFT,
-                    GPIO7C7_UART2DBG_SOUT << GPIO7C7_SHIFT |
-                    GPIO7C6_UART2DBG_SIN << GPIO7C6_SHIFT);
+#ifdef CONFIG_DEBUG_UART
        /*
         * Debug UART can be used from here if required:
         *
@@ -129,6 +120,7 @@ void board_init_f(ulong dummy)
         */
        debug_uart_init();
        debug("\nspl:debug uart enabled in %s\n", __func__);
+#endif
        ret = spl_early_init();
        if (ret) {
                debug("spl_early_init() failed: %d\n", ret);
index 2aa63f5..787129b 100644 (file)
 #include <spl.h>
 #include <version.h>
 #include <asm/io.h>
-#include <asm/arch/bootrom.h>
-#include <asm/arch/clock.h>
-#include <asm/arch/grf_rk3288.h>
-#include <asm/arch/periph.h>
-#include <asm/arch/pmu_rk3288.h>
-#include <asm/arch/sys_proto.h>
-#include <asm/arch/timer.h>
+#include <asm/arch-rockchip/bootrom.h>
+#include <asm/arch-rockchip/clock.h>
+#include <asm/arch-rockchip/sys_proto.h>
+#include <asm/arch-rockchip/timer.h>
 
-#define GRF_BASE               0xff770000
 void board_init_f(ulong dummy)
 {
        struct udevice *dev;
        int ret;
 
-       /* Example code showing how to enable the debug UART on RK3288 */
-       /* Enable early UART on the RK3288 */
-       struct rk3288_grf * const grf = (void *)GRF_BASE;
-
-       rk_clrsetreg(&grf->gpio7ch_iomux, GPIO7C7_MASK << GPIO7C7_SHIFT |
-                    GPIO7C6_MASK << GPIO7C6_SHIFT,
-                    GPIO7C7_UART2DBG_SOUT << GPIO7C7_SHIFT |
-                    GPIO7C6_UART2DBG_SIN << GPIO7C6_SHIFT);
+#ifdef CONFIG_DEBUG_UART
        /*
         * Debug UART can be used from here if required:
         *
@@ -41,7 +30,7 @@ void board_init_f(ulong dummy)
         * printascii("string");
         */
        debug_uart_init();
-
+#endif
        ret = spl_early_init();
        if (ret) {
                debug("spl_early_init() failed: %d\n", ret);
index 9c4f7f2..41e9786 100644 (file)
@@ -9,12 +9,12 @@
 #include <ram.h>
 #include <syscon.h>
 #include <asm/io.h>
-#include <asm/arch/clock.h>
-#include <asm/arch/cru_rk3288.h>
-#include <asm/arch/periph.h>
-#include <asm/arch/pmu_rk3288.h>
-#include <asm/arch/qos_rk3288.h>
-#include <asm/arch/boot_mode.h>
+#include <asm/arch-rockchip/clock.h>
+#include <asm/arch-rockchip/cru_rk3288.h>
+#include <asm/arch-rockchip/periph.h>
+#include <asm/arch-rockchip/pmu_rk3288.h>
+#include <asm/arch-rockchip/qos_rk3288.h>
+#include <asm/arch-rockchip/boot_mode.h>
 #include <asm/gpio.h>
 #include <dm/pinctrl.h>
 #include <dt-bindings/clock/rk3288-cru.h>
@@ -321,7 +321,6 @@ int board_early_init_f(void)
 {
        const uintptr_t GRF_SOC_CON0 = 0xff770244;
        const uintptr_t GRF_SOC_CON2 = 0xff77024c;
-       struct udevice *pinctrl;
        struct udevice *dev;
        int ret;
 
@@ -335,18 +334,7 @@ int board_early_init_f(void)
                debug("CLK init failed: %d\n", ret);
                return ret;
        }
-       ret = uclass_get_device(UCLASS_PINCTRL, 0, &pinctrl);
-       if (ret) {
-               debug("%s: Cannot find pinctrl device\n", __func__);
-               return ret;
-       }
 
-       /* Enable debug UART */
-       ret = pinctrl_request_noflags(pinctrl, PERIPH_ID_UART_DBG);
-       if (ret) {
-               debug("%s: Failed to set up console UART\n", __func__);
-               return ret;
-       }
        rk_setreg(GRF_SOC_CON2, 1 << 0);
 
        /*
index bce8023..50680ce 100644 (file)
@@ -148,7 +148,7 @@ config ROCKCHIP_FAST_SPL
          and have the required PMIC code.
 
 config SYS_SOC
-       default "rockchip"
+       default "rk3288"
 
 config SYS_MALLOC_F_LEN
        default 0x0800
index 6ca2271..e64ee86 100644 (file)
@@ -7,8 +7,8 @@
 #include <common.h>
 #include <dm.h>
 #include <syscon.h>
-#include <asm/arch/clock.h>
-#include <asm/arch/cru_rk3288.h>
+#include <asm/arch-rockchip/clock.h>
+#include <asm/arch-rockchip/cru_rk3288.h>
 
 int rockchip_get_clk(struct udevice **devp)
 {
index a725abc..7941ca6 100644 (file)
@@ -3,16 +3,31 @@
  * Copyright (c) 2016 Rockchip Electronics Co., Ltd
  */
 #include <asm/io.h>
-#include <asm/arch/hardware.h>
+#include <asm/arch-rockchip/hardware.h>
+#include <asm/arch-rockchip/grf_rk3288.h>
 
-#define GRF_SOC_CON2 0xff77024c
+#define GRF_BASE       0xff770000
 
 int arch_cpu_init(void)
 {
        /* We do some SoC one time setting here. */
+       struct rk3288_grf * const grf = (void *)GRF_BASE;
 
        /* Use rkpwm by default */
-       rk_setreg(GRF_SOC_CON2, 1 << 0);
+       rk_setreg(&grf->soc_con2, 1 << 0);
 
        return 0;
 }
+
+#ifdef CONFIG_DEBUG_UART_BOARD_INIT
+void board_debug_uart_init(void)
+{
+       /* Enable early UART on the RK3288 */
+       struct rk3288_grf * const grf = (void *)GRF_BASE;
+
+       rk_clrsetreg(&grf->gpio7ch_iomux, GPIO7C7_MASK << GPIO7C7_SHIFT |
+                    GPIO7C6_MASK << GPIO7C6_SHIFT,
+                    GPIO7C7_UART2DBG_SOUT << GPIO7C7_SHIFT |
+                    GPIO7C6_UART2DBG_SIN << GPIO7C6_SHIFT);
+}
+#endif
index 3bc8028..dff2caa 100644 (file)
@@ -7,7 +7,7 @@
 #include <common.h>
 #include <dm.h>
 #include <syscon.h>
-#include <asm/arch/clock.h>
+#include <asm/arch-rockchip/clock.h>
 
 static const struct udevice_id rk3288_syscon_ids[] = {
        { .compatible = "rockchip,rk3288-noc", .data = ROCKCHIP_SYSCON_NOC },
index 43afba2..6c5c430 100644 (file)
@@ -13,7 +13,7 @@ config TARGET_EVB_RK3328
 endchoice
 
 config SYS_SOC
-       default "rockchip"
+       default "rk3328"
 
 config SYS_MALLOC_F_LEN
        default 0x0800
index e5c2ce5..f64f0cb 100644 (file)
@@ -5,8 +5,8 @@
 
 #include <common.h>
 #include <dm.h>
-#include <asm/arch/clock.h>
-#include <asm/arch/cru_rk3328.h>
+#include <asm/arch-rockchip/clock.h>
+#include <asm/arch-rockchip/cru_rk3328.h>
 
 int rockchip_get_clk(struct udevice **devp)
 {
index a519f5f..1cf829d 100644 (file)
@@ -4,7 +4,7 @@
  */
 
 #include <common.h>
-#include <asm/arch/hardware.h>
+#include <asm/arch-rockchip/hardware.h>
 #include <asm/armv8/mmu.h>
 #include <asm/io.h>
 
index 28dd8cb..8a0eceb 100644 (file)
@@ -4,7 +4,7 @@
  */
 
 #include <common.h>
-#include <asm/arch/clock.h>
+#include <asm/arch-rockchip/clock.h>
 #include <dm.h>
 #include <syscon.h>
 
index 230850a..b055ed4 100644 (file)
@@ -9,17 +9,9 @@
 #include <ram.h>
 #include <spl.h>
 #include <asm/io.h>
-#include <asm/arch/cru_rk3368.h>
-#include <asm/arch/grf_rk3368.h>
-#include <asm/arch/hardware.h>
-#include <asm/arch/periph.h>
-#include <asm/arch/timer.h>
+#include <asm/arch-rockchip/periph.h>
 #include <dm/pinctrl.h>
 
-void board_debug_uart_init(void)
-{
-}
-
 void board_init_f(ulong dummy)
 {
        struct udevice *pinctrl;
index f90a1fd..dc65a02 100644 (file)
 #include <spl.h>
 #include <syscon.h>
 #include <asm/io.h>
-#include <asm/arch/bootrom.h>
-#include <asm/arch/clock.h>
-#include <asm/arch/cru_rk3368.h>
-#include <asm/arch/grf_rk3368.h>
-#include <asm/arch/hardware.h>
-#include <asm/arch/timer.h>
+#include <asm/arch-rockchip/bootrom.h>
+#include <asm/arch-rockchip/clock.h>
+#include <asm/arch-rockchip/cru_rk3368.h>
+#include <asm/arch-rockchip/hardware.h>
+#include <asm/arch-rockchip/timer.h>
 
 /*
  * The SPL (and also the full U-Boot stage on the RK3368) will run in
@@ -79,42 +78,12 @@ static void sgrf_init(void)
        rk_clrreg(&cru->softrst_con[4], DMA2_SRST_REQ);
 }
 
-void board_debug_uart_init(void)
-{
-       /*
-        * N.B.: This is called before the device-model has been
-        *       initialised. For this reason, we can not access
-        *       the GRF address range using the syscon API.
-        */
-       struct rk3368_grf * const grf =
-               (struct rk3368_grf * const)0xff770000;
-
-       enum {
-               GPIO2D1_MASK            = GENMASK(3, 2),
-               GPIO2D1_GPIO            = 0,
-               GPIO2D1_UART0_SOUT      = (1 << 2),
-
-               GPIO2D0_MASK            = GENMASK(1, 0),
-               GPIO2D0_GPIO            = 0,
-               GPIO2D0_UART0_SIN       = (1 << 0),
-       };
-
-#if defined(CONFIG_DEBUG_UART_BASE) && (CONFIG_DEBUG_UART_BASE == 0xff180000)
-       /* Enable early UART0 on the RK3368 */
-       rk_clrsetreg(&grf->gpio2d_iomux,
-                    GPIO2D0_MASK, GPIO2D0_UART0_SIN);
-       rk_clrsetreg(&grf->gpio2d_iomux,
-                    GPIO2D1_MASK, GPIO2D1_UART0_SOUT);
-#endif
-}
-
 void board_init_f(ulong dummy)
 {
        struct udevice *dev;
        int ret;
 
-#define EARLY_UART
-#ifdef EARLY_UART
+#ifdef CONFIG_DEBUG_UART
        /*
         * Debug UART can be used from here if required:
         *
index 7c9b722..325572a 100644 (file)
@@ -43,7 +43,7 @@ config TARGET_EVB_PX5
 endchoice
 
 config SYS_SOC
-       default "rockchip"
+       default "rk3368"
 
 source "board/theobroma-systems/lion_rk3368/Kconfig"
 source "board/rockchip/sheep_rk3368/Kconfig"
index 722160d..55e5dd7 100644 (file)
@@ -7,8 +7,8 @@
 #include <common.h>
 #include <dm.h>
 #include <syscon.h>
-#include <asm/arch/clock.h>
-#include <asm/arch/cru_rk3368.h>
+#include <asm/arch-rockchip/clock.h>
+#include <asm/arch-rockchip/cru_rk3368.h>
 
 int rockchip_get_clk(struct udevice **devp)
 {
index 6d5d4cc..1ed06c5 100644 (file)
@@ -7,9 +7,9 @@
 #include <common.h>
 #include <asm/armv8/mmu.h>
 #include <asm/io.h>
-#include <asm/arch/clock.h>
-#include <asm/arch/cru_rk3368.h>
-#include <asm/arch/grf_rk3368.h>
+#include <asm/arch-rockchip/clock.h>
+#include <asm/arch-rockchip/cru_rk3368.h>
+#include <asm/arch-rockchip/grf_rk3368.h>
 #include <syscon.h>
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -96,3 +96,34 @@ int arch_early_init_r(void)
        return mcu_init();
 }
 #endif
+
+#ifdef CONFIG_DEBUG_UART_BOARD_INIT
+void board_debug_uart_init(void)
+{
+       /*
+        * N.B.: This is called before the device-model has been
+        *       initialised. For this reason, we can not access
+        *       the GRF address range using the syscon API.
+        */
+#if defined(CONFIG_DEBUG_UART_BASE) && (CONFIG_DEBUG_UART_BASE == 0xff180000)
+       struct rk3368_grf * const grf =
+               (struct rk3368_grf * const)0xff770000;
+
+       enum {
+               GPIO2D1_MASK            = GENMASK(3, 2),
+               GPIO2D1_GPIO            = 0,
+               GPIO2D1_UART0_SOUT      = (1 << 2),
+
+               GPIO2D0_MASK            = GENMASK(1, 0),
+               GPIO2D0_GPIO            = 0,
+               GPIO2D0_UART0_SIN       = (1 << 0),
+       };
+
+       /* Enable early UART0 on the RK3368 */
+       rk_clrsetreg(&grf->gpio2d_iomux,
+                    GPIO2D0_MASK, GPIO2D0_UART0_SIN);
+       rk_clrsetreg(&grf->gpio2d_iomux,
+                    GPIO2D1_MASK, GPIO2D1_UART0_SOUT);
+#endif
+}
+#endif
index c08ce43..4ba94f2 100644 (file)
@@ -8,7 +8,7 @@
 #include <common.h>
 #include <dm.h>
 #include <syscon.h>
-#include <asm/arch/clock.h>
+#include <asm/arch-rockchip/clock.h>
 
 static const struct udevice_id rk3368_syscon_ids[] = {
        { .compatible = "rockchip,rk3368-grf",
index ccc136f..800ca80 100644 (file)
 #include <spl_gpio.h>
 #include <syscon.h>
 #include <asm/io.h>
-#include <asm/arch/bootrom.h>
-#include <asm/arch/clock.h>
-#include <asm/arch/grf_rk3399.h>
-#include <asm/arch/hardware.h>
-#include <asm/arch/periph.h>
-#include <asm/arch/sys_proto.h>
+#include <asm/arch-rockchip/bootrom.h>
+#include <asm/arch-rockchip/clock.h>
+#include <asm/arch-rockchip/grf_rk3399.h>
+#include <asm/arch-rockchip/hardware.h>
+#include <asm/arch-rockchip/periph.h>
+#include <asm/arch-rockchip/sys_proto.h>
 #include <dm/pinctrl.h>
 
 void board_return_to_bootrom(void)
@@ -127,53 +127,6 @@ void secure_timer_init(void)
        writel(TIMER_EN | TIMER_FMODE, TIMER_CHN10_BASE + TIMER_CONTROL_REG);
 }
 
-void board_debug_uart_init(void)
-{
-#define GRF_BASE       0xff770000
-#define GPIO0_BASE     0xff720000
-#define PMUGRF_BASE    0xff320000
-       struct rk3399_grf_regs * const grf = (void *)GRF_BASE;
-#ifdef CONFIG_TARGET_CHROMEBOOK_BOB
-       struct rk3399_pmugrf_regs * const pmugrf = (void *)PMUGRF_BASE;
-       struct rockchip_gpio_regs * const gpio = (void *)GPIO0_BASE;
-#endif
-
-#if defined(CONFIG_DEBUG_UART_BASE) && (CONFIG_DEBUG_UART_BASE == 0xff180000)
-       /* Enable early UART0 on the RK3399 */
-       rk_clrsetreg(&grf->gpio2c_iomux,
-                    GRF_GPIO2C0_SEL_MASK,
-                    GRF_UART0BT_SIN << GRF_GPIO2C0_SEL_SHIFT);
-       rk_clrsetreg(&grf->gpio2c_iomux,
-                    GRF_GPIO2C1_SEL_MASK,
-                    GRF_UART0BT_SOUT << GRF_GPIO2C1_SEL_SHIFT);
-#else
-# ifdef CONFIG_TARGET_CHROMEBOOK_BOB
-       rk_setreg(&grf->io_vsel, 1 << 0);
-
-       /*
-        * Let's enable these power rails here, we are already running the SPI
-        * Flash based code.
-        */
-       spl_gpio_output(gpio, GPIO(BANK_B, 2), 1);  /* PP1500_EN */
-       spl_gpio_set_pull(&pmugrf->gpio0_p, GPIO(BANK_B, 2), GPIO_PULL_NORMAL);
-
-       spl_gpio_output(gpio, GPIO(BANK_B, 4), 1);  /* PP3000_EN */
-       spl_gpio_set_pull(&pmugrf->gpio0_p, GPIO(BANK_B, 4), GPIO_PULL_NORMAL);
-#endif /* CONFIG_TARGET_CHROMEBOOK_BOB */
-
-       /* Enable early UART2 channel C on the RK3399 */
-       rk_clrsetreg(&grf->gpio4c_iomux,
-                    GRF_GPIO4C3_SEL_MASK,
-                    GRF_UART2DGBC_SIN << GRF_GPIO4C3_SEL_SHIFT);
-       rk_clrsetreg(&grf->gpio4c_iomux,
-                    GRF_GPIO4C4_SEL_MASK,
-                    GRF_UART2DBGC_SOUT << GRF_GPIO4C4_SEL_SHIFT);
-       /* Set channel C as UART2 input */
-       rk_clrsetreg(&grf->soc_con7,
-                    GRF_UART_DBG_SEL_MASK,
-                    GRF_UART_DBG_SEL_C << GRF_UART_DBG_SEL_SHIFT);
-#endif
-}
 
 void board_init_f(ulong dummy)
 {
@@ -183,8 +136,7 @@ void board_init_f(ulong dummy)
        struct rk3399_grf_regs *grf;
        int ret;
 
-#define EARLY_UART
-#ifdef EARLY_UART
+#ifdef CONFIG_DEBUG_UART
        debug_uart_init();
 
 # ifdef CONFIG_TARGET_CHROMEBOOK_BOB
index 137ec71..443c87c 100644 (file)
@@ -4,7 +4,7 @@
  */
 
 #include <common.h>
-#include <asm/arch/boot_mode.h>
+#include <asm/arch-rockchip/boot_mode.h>
 
 int board_late_init(void)
 {
index 2408adb..2c5c93c 100644 (file)
@@ -65,7 +65,7 @@ config TARGET_CHROMEBOOK_BOB
 endchoice
 
 config SYS_SOC
-       default "rockchip"
+       default "rk3399"
 
 config SYS_MALLOC_F_LEN
        default 0x0800
index 98f7482..f0411c0 100644 (file)
@@ -7,8 +7,8 @@
 #include <common.h>
 #include <dm.h>
 #include <syscon.h>
-#include <asm/arch/clock.h>
-#include <asm/arch/cru_rk3399.h>
+#include <asm/arch-rockchip/clock.h>
+#include <asm/arch-rockchip/cru_rk3399.h>
 
 static int rockchip_get_cruclk(struct udevice **devp)
 {
index d8467d7..a7ccd4f 100644 (file)
@@ -4,13 +4,17 @@
  */
 
 #include <common.h>
+#include <spl_gpio.h>
 #include <asm/armv8/mmu.h>
 #include <asm/io.h>
-#include <asm/arch/hardware.h>
+#include <asm/arch-rockchip/gpio.h>
+#include <asm/arch-rockchip/grf_rk3399.h>
+#include <asm/arch-rockchip/hardware.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
 #define GRF_EMMCCORE_CON11 0xff77f02c
+#define GRF_BASE       0xff770000
 
 static struct mm_region rk3399_mem_map[] = {
        {
@@ -48,9 +52,60 @@ int dram_init_banksize(void)
 int arch_cpu_init(void)
 {
        /* We do some SoC one time setting here. */
+       struct rk3399_grf_regs * const grf = (void *)GRF_BASE;
 
        /* Emmc clock generator: disable the clock multipilier */
-       rk_clrreg(GRF_EMMCCORE_CON11, 0x0ff);
+       rk_clrreg(&grf->emmccore_con[11], 0x0ff);
 
        return 0;
 }
+
+#ifdef CONFIG_DEBUG_UART_BOARD_INIT
+void board_debug_uart_init(void)
+{
+#define GRF_BASE       0xff770000
+#define GPIO0_BASE     0xff720000
+#define PMUGRF_BASE    0xff320000
+       struct rk3399_grf_regs * const grf = (void *)GRF_BASE;
+#ifdef CONFIG_TARGET_CHROMEBOOK_BOB
+       struct rk3399_pmugrf_regs * const pmugrf = (void *)PMUGRF_BASE;
+       struct rockchip_gpio_regs * const gpio = (void *)GPIO0_BASE;
+#endif
+
+#if defined(CONFIG_DEBUG_UART_BASE) && (CONFIG_DEBUG_UART_BASE == 0xff180000)
+       /* Enable early UART0 on the RK3399 */
+       rk_clrsetreg(&grf->gpio2c_iomux,
+                    GRF_GPIO2C0_SEL_MASK,
+                    GRF_UART0BT_SIN << GRF_GPIO2C0_SEL_SHIFT);
+       rk_clrsetreg(&grf->gpio2c_iomux,
+                    GRF_GPIO2C1_SEL_MASK,
+                    GRF_UART0BT_SOUT << GRF_GPIO2C1_SEL_SHIFT);
+#else
+# ifdef CONFIG_TARGET_CHROMEBOOK_BOB
+       rk_setreg(&grf->io_vsel, 1 << 0);
+
+       /*
+        * Let's enable these power rails here, we are already running the SPI
+        * Flash based code.
+        */
+       spl_gpio_output(gpio, GPIO(BANK_B, 2), 1);  /* PP1500_EN */
+       spl_gpio_set_pull(&pmugrf->gpio0_p, GPIO(BANK_B, 2), GPIO_PULL_NORMAL);
+
+       spl_gpio_output(gpio, GPIO(BANK_B, 4), 1);  /* PP3000_EN */
+       spl_gpio_set_pull(&pmugrf->gpio0_p, GPIO(BANK_B, 4), GPIO_PULL_NORMAL);
+#endif /* CONFIG_TARGET_CHROMEBOOK_BOB */
+
+       /* Enable early UART2 channel C on the RK3399 */
+       rk_clrsetreg(&grf->gpio4c_iomux,
+                    GRF_GPIO4C3_SEL_MASK,
+                    GRF_UART2DGBC_SIN << GRF_GPIO4C3_SEL_SHIFT);
+       rk_clrsetreg(&grf->gpio4c_iomux,
+                    GRF_GPIO4C4_SEL_MASK,
+                    GRF_UART2DBGC_SOUT << GRF_GPIO4C4_SEL_SHIFT);
+       /* Set channel C as UART2 input */
+       rk_clrsetreg(&grf->soc_con7,
+                    GRF_UART_DBG_SEL_MASK,
+                    GRF_UART_DBG_SEL_C << GRF_UART_DBG_SEL_SHIFT);
+#endif
+}
+#endif
index 98f4be9..a8bb5b1 100644 (file)
@@ -6,7 +6,7 @@
 #include <common.h>
 #include <dm.h>
 #include <syscon.h>
-#include <asm/arch/clock.h>
+#include <asm/arch-rockchip/clock.h>
 
 static const struct udevice_id rk3399_syscon_ids[] = {
        { .compatible = "rockchip,rk3399-grf", .data = ROCKCHIP_SYSCON_GRF },
index e751f29..f20e64f 100644 (file)
@@ -4,7 +4,7 @@
  */
 
 #include <common.h>
-#include <asm/arch/timer.h>
+#include <asm/arch-rockchip/timer.h>
 #include <asm/io.h>
 #include <linux/types.h>
 
index 8883aea..e3a63b8 100644 (file)
@@ -23,7 +23,7 @@ config TARGET_ELGIN_RV1108
          RV1108 ELGIN is a board based on the Rockchip RV1108.
 
 config SYS_SOC
-       default "rockchip"
+       default "rv1108"
 
 config SYS_MALLOC_F_LEN
        default 0x400
index 5f3705c..58a7e88 100644 (file)
@@ -7,8 +7,8 @@
 #include <common.h>
 #include <dm.h>
 #include <syscon.h>
-#include <asm/arch/clock.h>
-#include <asm/arch/cru_rv1108.h>
+#include <asm/arch-rockchip/clock.h>
+#include <asm/arch-rockchip/cru_rv1108.h>
 
 int rockchip_get_clk(struct udevice **devp)
 {
index 5a0f0a5..babdf57 100644 (file)
@@ -6,7 +6,7 @@
 #include <common.h>
 #include <dm.h>
 #include <syscon.h>
-#include <asm/arch/clock.h>
+#include <asm/arch-rockchip/clock.h>
 
 static const struct udevice_id rv1108_syscon_ids[] = {
        { .compatible = "rockchip,rv1108-grf", .data = ROCKCHIP_SYSCON_GRF },
index a271380..8684dbd 100644 (file)
@@ -7,7 +7,7 @@
 #include <dm.h>
 #include <ram.h>
 #include <asm/io.h>
-#include <asm/arch/sdram_common.h>
+#include <asm/arch-rockchip/sdram_common.h>
 #include <dm/uclass-internal.h>
 
 DECLARE_GLOBAL_DATA_PTR;
index 3abc514..0de1f42 100644 (file)
@@ -7,8 +7,8 @@
 #include <common.h>
 #include <asm/io.h>
 #include <fdtdec.h>
-#include <asm/arch/grf_rv1108.h>
-#include <asm/arch/hardware.h>
+#include <asm/arch-rockchip/grf_rv1108.h>
+#include <asm/arch-rockchip/hardware.h>
 #include <asm/gpio.h>
 
 DECLARE_GLOBAL_DATA_PTR;
index d5acc4f..8c60646 100644 (file)
@@ -6,8 +6,8 @@
 #include <common.h>
 #include <dm.h>
 #include <asm/io.h>
-#include <asm/arch/uart.h>
-#include <asm/arch/sdram_rk3036.h>
+#include <asm/arch-rockchip/uart.h>
+#include <asm/arch-rockchip/sdram_rk3036.h>
 
 void get_ddr_config(struct rk3036_ddr_config *config)
 {
index 63c84fc..c64c62f 100644 (file)
@@ -6,5 +6,5 @@
 #include <common.h>
 #include <dm.h>
 #include <asm/io.h>
-#include <asm/arch/uart.h>
+#include <asm/arch-rockchip/uart.h>
 
index caad306..07ee8ce 100644 (file)
@@ -5,3 +5,10 @@ F:      board/rockchip/evb_rk3399
 F:      include/configs/evb_rk3399.h
 F:      configs/evb-rk3399_defconfig
 F:      configs/firefly-rk3399_defconfig
+
+ORANGEPI-RK3399
+M:     Jagan Teki <jagan@amarulasolutions.com>
+S:     Maintained
+F:     configs/orangepi-rk3399_defconfig
+F:     arch/arm/dts/rk3399-u-boot.dtsi
+F:     arch/arm/dts/rk3399-orangepi-u-boot.dtsi
index 3e9e83f..bf2ad98 100644 (file)
@@ -7,7 +7,7 @@
 #include <dm.h>
 #include <dm/pinctrl.h>
 #include <dm/uclass-internal.h>
-#include <asm/arch/periph.h>
+#include <asm/arch-rockchip/periph.h>
 #include <power/regulator.h>
 #include <spl.h>
 
index 107929e..457b110 100644 (file)
@@ -7,8 +7,8 @@
 #include <common.h>
 #include <asm/io.h>
 #include <fdtdec.h>
-#include <asm/arch/grf_rv1108.h>
-#include <asm/arch/hardware.h>
+#include <asm/arch-rockchip/grf_rv1108.h>
+#include <asm/arch-rockchip/hardware.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
index 3a2f083..2faeab9 100644 (file)
@@ -6,8 +6,8 @@
 #include <common.h>
 #include <dm.h>
 #include <asm/io.h>
-#include <asm/arch/uart.h>
-#include <asm/arch/sdram_rk3036.h>
+#include <asm/arch-rockchip/uart.h>
+#include <asm/arch-rockchip/sdram_rk3036.h>
 #include <asm/gpio.h>
 
 void get_ddr_config(struct rk3036_ddr_config *config)
index ea22cb9..9bb93c7 100644 (file)
@@ -4,8 +4,8 @@
  */
 #include <common.h>
 #include <asm/io.h>
-#include <asm/arch/clock.h>
-#include <asm/arch/grf_rk3368.h>
+#include <asm/arch-rockchip/clock.h>
+#include <asm/arch-rockchip/grf_rk3368.h>
 #include <syscon.h>
 
 int mach_cpu_init(void)
index e207535..6cd5a5f 100644 (file)
@@ -6,9 +6,9 @@
 #include <dm.h>
 #include <ram.h>
 #include <asm/io.h>
-#include <asm/arch/clock.h>
-#include <asm/arch/grf_rk3368.h>
-#include <asm/arch/timer.h>
+#include <asm/arch-rockchip/clock.h>
+#include <asm/arch-rockchip/grf_rk3368.h>
+#include <asm/arch-rockchip/timer.h>
 #include <syscon.h>
 
 int mach_cpu_init(void)
index 573e691..c6b509c 100644 (file)
 #include <asm/io.h>
 #include <asm/gpio.h>
 #include <asm/setup.h>
-#include <asm/arch/clock.h>
-#include <asm/arch/cru_rk3399.h>
-#include <asm/arch/hardware.h>
-#include <asm/arch/grf_rk3399.h>
-#include <asm/arch/periph.h>
+#include <asm/arch-rockchip/clock.h>
+#include <asm/arch-rockchip/cru_rk3399.h>
+#include <asm/arch-rockchip/hardware.h>
+#include <asm/arch-rockchip/grf_rk3399.h>
+#include <asm/arch-rockchip/periph.h>
 #include <power/regulator.h>
 #include <u-boot/sha256.h>
 
index d3775b2..0f5ef3a 100644 (file)
@@ -7,7 +7,7 @@
 #include <dm.h>
 #include <dm/pinctrl.h>
 #include <dm/uclass-internal.h>
-#include <asm/arch/periph.h>
+#include <asm/arch-rockchip/periph.h>
 #include <power/regulator.h>
 #include <spl.h>
 
index efaa548..f1d7d8b 100644 (file)
@@ -297,18 +297,21 @@ static efi_status_t efi_install_fdt(const char *fdt_opt)
 static efi_status_t do_bootefi_exec(efi_handle_t handle)
 {
        efi_status_t ret;
+       efi_uintn_t exit_data_size = 0;
+       u16 *exit_data = NULL;
 
        /* Transfer environment variable as load options */
        ret = set_load_options(handle, "bootargs");
        if (ret != EFI_SUCCESS)
                return ret;
 
-       /* we don't support much: */
-       env_set("efi_8be4df61-93ca-11d2-aa0d-00e098032b8c_OsIndicationsSupported",
-               "{ro,boot}(blob)0000000000000000");
-
        /* Call our payload! */
-       ret = EFI_CALL(efi_start_image(handle, NULL, NULL));
+       ret = EFI_CALL(efi_start_image(handle, &exit_data_size, &exit_data));
+       printf("## Application terminated, r = %lu\n", ret & ~EFI_ERROR_MASK);
+       if (ret && exit_data) {
+               printf("## %ls\n", exit_data);
+               efi_free_pool(exit_data);
+       }
 
        efi_restore_gd();
 
@@ -361,7 +364,6 @@ static int do_efibootmgr(const char *fdt_opt)
        }
 
        ret = do_bootefi_exec(handle);
-       printf("## Application terminated, r = %lu\n", ret & ~EFI_ERROR_MASK);
 
        if (ret != EFI_SUCCESS)
                return CMD_RET_FAILURE;
@@ -476,7 +478,6 @@ static int do_bootefi_image(const char *image_opt, const char *fdt_opt)
                goto out;
 
        ret = do_bootefi_exec(handle);
-       printf("## Application terminated, r = %lu\n", ret & ~EFI_ERROR_MASK);
 
 out:
        if (mem_handle)
index a40c4f4..c4ac9dd 100644 (file)
@@ -11,6 +11,7 @@
 #include <efi_loader.h>
 #include <environment.h>
 #include <exports.h>
+#include <hexdump.h>
 #include <malloc.h>
 #include <search.h>
 #include <linux/ctype.h>
@@ -545,7 +546,10 @@ static int do_efi_boot_add(cmd_tbl_t *cmdtp, int flag,
                                + sizeof(struct efi_device_path); /* for END */
 
        /* optional data */
-       lo.optional_data = (u8 *)(argc == 6 ? "" : argv[6]);
+       if (argc < 6)
+               lo.optional_data = NULL;
+       else
+               lo.optional_data = (const u8 *)argv[6];
 
        size = efi_serialize_load_option(&lo, (u8 **)&data);
        if (!size) {
@@ -615,12 +619,13 @@ static int do_efi_boot_rm(cmd_tbl_t *cmdtp, int flag,
 /**
  * show_efi_boot_opt_data() - dump UEFI load option
  *
- * @id:                Load option number
- * @data:      Value of UEFI load option variable
+ * @id:                load option number
+ * @data:      value of UEFI load option variable
+ * @size:      size of the boot option
  *
  * Decode the value of UEFI load option variable and print information.
  */
-static void show_efi_boot_opt_data(int id, void *data)
+static void show_efi_boot_opt_data(int id, void *data, size_t size)
 {
        struct efi_load_option lo;
        char *label, *p;
@@ -638,7 +643,7 @@ static void show_efi_boot_opt_data(int id, void *data)
        utf16_utf8_strncpy(&p, lo.label, label_len16);
 
        printf("Boot%04X:\n", id);
-       printf("\tattributes: %c%c%c (0x%08x)\n",
+       printf("  attributes: %c%c%c (0x%08x)\n",
               /* ACTIVE */
               lo.attributes & LOAD_OPTION_ACTIVE ? 'A' : '-',
               /* FORCE RECONNECT */
@@ -646,14 +651,16 @@ static void show_efi_boot_opt_data(int id, void *data)
               /* HIDDEN */
               lo.attributes & LOAD_OPTION_HIDDEN ? 'H' : '-',
               lo.attributes);
-       printf("\tlabel: %s\n", label);
+       printf("  label: %s\n", label);
 
        dp_str = efi_dp_str(lo.file_path);
-       printf("\tfile_path: %ls\n", dp_str);
+       printf("  file_path: %ls\n", dp_str);
        efi_free_pool(dp_str);
 
-       printf("\tdata: %s\n", lo.optional_data);
-
+       printf("  data:\n");
+       print_hex_dump("    ", DUMP_PREFIX_OFFSET, 16, 1,
+                      lo.optional_data, size + (u8 *)data -
+                      (u8 *)lo.optional_data, true);
        free(label);
 }
 
@@ -686,13 +693,24 @@ static void show_efi_boot_opt(int id)
                                                data));
        }
        if (ret == EFI_SUCCESS)
-               show_efi_boot_opt_data(id, data);
+               show_efi_boot_opt_data(id, data, size);
        else if (ret == EFI_NOT_FOUND)
                printf("Boot%04X: not found\n", id);
 
        free(data);
 }
 
+static int u16_tohex(u16 c)
+{
+       if (c >= '0' && c <= '9')
+               return c - '0';
+       if (c >= 'A' && c <= 'F')
+               return c - 'A' + 10;
+
+       /* not hexadecimal */
+       return -1;
+}
+
 /**
  * show_efi_boot_dump() - dump all UEFI load options
  *
@@ -709,38 +727,58 @@ static void show_efi_boot_opt(int id)
 static int do_efi_boot_dump(cmd_tbl_t *cmdtp, int flag,
                            int argc, char * const argv[])
 {
-       char regex[256];
-       char * const regexlist[] = {regex};
-       char *variables = NULL, *boot, *value;
-       int len;
-       int id;
+       u16 *var_name16, *p;
+       efi_uintn_t buf_size, size;
+       efi_guid_t guid;
+       int id, i, digit;
+       efi_status_t ret;
 
        if (argc > 1)
                return CMD_RET_USAGE;
 
-       snprintf(regex, 256, "efi_.*-.*-.*-.*-.*_Boot[0-9A-F]+");
-
-       /* TODO: use GetNextVariableName? */
-       len = hexport_r(&env_htab, '\n', H_MATCH_REGEX | H_MATCH_KEY,
-                       &variables, 0, 1, regexlist);
-
-       if (!len)
-               return CMD_RET_SUCCESS;
-
-       if (len < 0)
+       buf_size = 128;
+       var_name16 = malloc(buf_size);
+       if (!var_name16)
                return CMD_RET_FAILURE;
 
-       boot = variables;
-       while (*boot) {
-               value = strstr(boot, "Boot") + 4;
-               id = (int)simple_strtoul(value, NULL, 16);
-               show_efi_boot_opt(id);
-               boot = strchr(boot, '\n');
-               if (!*boot)
+       var_name16[0] = 0;
+       for (;;) {
+               size = buf_size;
+               ret = EFI_CALL(efi_get_next_variable_name(&size, var_name16,
+                                                         &guid));
+               if (ret == EFI_NOT_FOUND)
                        break;
-               boot++;
+               if (ret == EFI_BUFFER_TOO_SMALL) {
+                       buf_size = size;
+                       p = realloc(var_name16, buf_size);
+                       if (!p) {
+                               free(var_name16);
+                               return CMD_RET_FAILURE;
+                       }
+                       var_name16 = p;
+                       ret = EFI_CALL(efi_get_next_variable_name(&size,
+                                                                 var_name16,
+                                                                 &guid));
+               }
+               if (ret != EFI_SUCCESS) {
+                       free(var_name16);
+                       return CMD_RET_FAILURE;
+               }
+
+               if (memcmp(var_name16, L"Boot", 8))
+                       continue;
+
+               for (id = 0, i = 0; i < 4; i++) {
+                       digit = u16_tohex(var_name16[4 + i]);
+                       if (digit < 0)
+                               break;
+                       id = (id << 4) + digit;
+               }
+               if (i == 4 && !var_name16[8])
+                       show_efi_boot_opt(id);
        }
-       free(variables);
+
+       free(var_name16);
 
        return CMD_RET_SUCCESS;
 }
index 6388703..33cda51 100644 (file)
--- a/cmd/gpt.c
+++ b/cmd/gpt.c
@@ -876,21 +876,21 @@ U_BOOT_CMD(gpt, CONFIG_SYS_MAXARGS, 1, do_gpt,
        " Example usage:\n"
        " gpt write mmc 0 $partitions\n"
        " gpt verify mmc 0 $partitions\n"
-       " read <interface> <dev>\n"
-       "    - read GPT into a data structure for manipulation\n"
-       " guid <interface> <dev>\n"
+       " gpt guid <interface> <dev>\n"
        "    - print disk GUID\n"
-       " guid <interface> <dev> <varname>\n"
+       " gpt guid <interface> <dev> <varname>\n"
        "    - set environment variable to disk GUID\n"
        " Example usage:\n"
        " gpt guid mmc 0\n"
        " gpt guid mmc 0 varname\n"
 #ifdef CONFIG_CMD_GPT_RENAME
        "gpt partition renaming commands:\n"
-       "gpt swap <interface> <dev> <name1> <name2>\n"
+       " gpt read <interface> <dev>\n"
+       "    - read GPT into a data structure for manipulation\n"
+       " gpt swap <interface> <dev> <name1> <name2>\n"
        "    - change all partitions named name1 to name2\n"
        "      and vice-versa\n"
-       "gpt rename <interface> <dev> <part> <name>\n"
+       " gpt rename <interface> <dev> <part> <name>\n"
        "    - rename the specified partition\n"
        " Example usage:\n"
        " gpt swap mmc 0 foo bar\n"
index e65b38d..2805e81 100644 (file)
@@ -291,8 +291,11 @@ static int append_value(char **bufp, size_t *sizep, char *data)
                if (!tmp_buf)
                        return -1;
 
-               if (hex2bin((u8 *)tmp_buf, data, len) < 0)
+               if (hex2bin((u8 *)tmp_buf, data, len) < 0) {
+                       printf("Error: illegal hexadecimal string\n");
+                       free(tmp_buf);
                        return -1;
+               }
 
                value = tmp_buf;
        } else { /* string */
index e0c1480..9b70c6a 100644 (file)
@@ -8,7 +8,7 @@
 #include <console.h>
 #include <g_dnl.h>
 #include <usb.h>
-#include <asm/arch/f_rockusb.h>
+#include <asm/arch-rockchip/f_rockusb.h>
 
 static int do_rockusb(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 {
index 393046e..f6a1874 100644 (file)
@@ -7,8 +7,11 @@ CONFIG_SPL_LIBGENERIC_SUPPORT=y
 CONFIG_ROCKCHIP_RK3036=y
 CONFIG_TARGET_KYLIN_RK3036=y
 CONFIG_SPL_SYS_MALLOC_F_LEN=0x0
-CONFIG_NR_DRAM_BANKS=1
+CONFIG_DEBUG_UART_BASE=0x20068000
+CONFIG_DEBUG_UART_CLOCK=24000000
 CONFIG_SPL_STACK_R_ADDR=0x80000
+CONFIG_DEBUG_UART=y
+CONFIG_NR_DRAM_BANKS=1
 # CONFIG_ANDROID_BOOT_IMAGE is not set
 CONFIG_DEFAULT_FDT_FILE="rk3036-kylin.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
@@ -46,6 +49,7 @@ CONFIG_SF_DEFAULT_SPEED=20000000
 CONFIG_PINCTRL=y
 CONFIG_DM_REGULATOR_FIXED=y
 # CONFIG_SPL_DM_SERIAL is not set
+CONFIG_DEBUG_UART_SHIFT=2
 CONFIG_SYSRESET=y
 CONFIG_USB=y
 CONFIG_USB_DWC2=y
diff --git a/configs/orangepi-rk3399_defconfig b/configs/orangepi-rk3399_defconfig
new file mode 100644 (file)
index 0000000..cdccf22
--- /dev/null
@@ -0,0 +1,75 @@
+CONFIG_ARM=y
+CONFIG_ARCH_ROCKCHIP=y
+CONFIG_SYS_TEXT_BASE=0x00200000
+CONFIG_SPL_LIBCOMMON_SUPPORT=y
+CONFIG_SPL_LIBGENERIC_SUPPORT=y
+CONFIG_SYS_MALLOC_F_LEN=0x4000
+CONFIG_ROCKCHIP_RK3399=y
+CONFIG_ROCKCHIP_SPL_RESERVE_IRAM=0x4000
+CONFIG_DEBUG_UART_BASE=0xFF1A0000
+CONFIG_DEBUG_UART_CLOCK=24000000
+CONFIG_SPL_STACK_R_ADDR=0x80000
+CONFIG_DEBUG_UART=y
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_FIT=y
+CONFIG_SPL_LOAD_FIT=y
+CONFIG_SPL_FIT_GENERATOR="arch/arm/mach-rockchip/make_fit_atf.py"
+CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-orangepi.dtb"
+# CONFIG_DISPLAY_CPUINFO is not set
+CONFIG_DISPLAY_BOARDINFO_LATE=y
+CONFIG_SPL_STACK_R=y
+CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x4000
+CONFIG_SPL_ATF=y
+CONFIG_SPL_ATF_NO_PLATFORM_PARAM=y
+CONFIG_CMD_BOOTZ=y
+CONFIG_CMD_GPT=y
+CONFIG_CMD_MMC=y
+CONFIG_CMD_SF=y
+CONFIG_CMD_USB=y
+# CONFIG_CMD_SETEXPR is not set
+CONFIG_CMD_TIME=y
+CONFIG_SPL_OF_CONTROL=y
+CONFIG_DEFAULT_DEVICE_TREE="rk3399-orangepi"
+CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents"
+CONFIG_ENV_IS_IN_MMC=y
+CONFIG_REGMAP=y
+CONFIG_SPL_REGMAP=y
+CONFIG_SYSCON=y
+CONFIG_SPL_SYSCON=y
+CONFIG_CLK=y
+CONFIG_SPL_CLK=y
+CONFIG_ROCKCHIP_GPIO=y
+CONFIG_SYS_I2C_ROCKCHIP=y
+CONFIG_MMC_DW=y
+CONFIG_MMC_DW_ROCKCHIP=y
+CONFIG_MMC_SDHCI=y
+CONFIG_MMC_SDHCI_ROCKCHIP=y
+CONFIG_DM_ETH=y
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_GMAC_ROCKCHIP=y
+CONFIG_PINCTRL=y
+CONFIG_SPL_PINCTRL=y
+CONFIG_DM_PMIC=y
+CONFIG_PMIC_RK8XX=y
+CONFIG_REGULATOR_PWM=y
+CONFIG_DM_REGULATOR_FIXED=y
+CONFIG_REGULATOR_RK8XX=y
+CONFIG_PWM_ROCKCHIP=y
+CONFIG_RAM=y
+CONFIG_SPL_RAM=y
+CONFIG_BAUDRATE=1500000
+CONFIG_DEBUG_UART_SHIFT=2
+CONFIG_SYSRESET=y
+CONFIG_USB=y
+CONFIG_USB_XHCI_HCD=y
+CONFIG_USB_XHCI_DWC3=y
+CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_EHCI_GENERIC=y
+CONFIG_USB_HOST_ETHER=y
+CONFIG_USB_ETHER_ASIX=y
+CONFIG_USB_ETHER_ASIX88179=y
+CONFIG_USB_ETHER_MCS7830=y
+CONFIG_USB_ETHER_RTL8152=y
+CONFIG_USB_ETHER_SMSC95XX=y
+CONFIG_USE_TINY_PRINTF=y
+CONFIG_ERRNO_STR=y
index f9f98c9..964464a 100644 (file)
@@ -69,6 +69,7 @@ CONFIG_MMC_SDHCI_SDMA=y
 CONFIG_MMC_SDHCI_ROCKCHIP=y
 CONFIG_SPI_FLASH=y
 CONFIG_SF_DEFAULT_SPEED=20000000
+CONFIG_SPI_FLASH_GIGADEVICE=y
 CONFIG_SPI_FLASH_WINBOND=y
 CONFIG_PHY_MICREL=y
 CONFIG_PHY_MICREL_KSZ90X1=y
index 239455b..c0fa753 100644 (file)
@@ -209,6 +209,8 @@ int get_disk_guid(struct blk_desc * dev_desc, char *guid)
        guid_bin = gpt_head->disk_guid.b;
        uuid_bin_to_str(guid_bin, guid, UUID_STR_FORMAT_GUID);
 
+       /* Remember to free pte */
+       free(gpt_pte);
        return 0;
 }
 
@@ -696,6 +698,10 @@ int gpt_verify_headers(struct blk_desc *dev_desc, gpt_header *gpt_head,
                       __func__);
                return -1;
        }
+
+       /* Free pte before allocating again */
+       free(*gpt_pte);
+
        if (is_gpt_valid(dev_desc, (dev_desc->lba - 1),
                         gpt_head, gpt_pte) != 1) {
                printf("%s: *** ERROR: Invalid Backup GPT ***\n",
index 7d0e8b5..a63b76b 100644 (file)
@@ -27,6 +27,7 @@ alias iwamatsu       Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
 alias jaehoon        Jaehoon Chung <jh80.chung@samsung.com>
 alias jagan          Jagan Teki <jagan@amarulasolutions.com>
 alias jhersh         Joe Hershberger <joe.hershberger@ni.com>
+alias kevery         Kever Yang <kever.yang@rock-chips.com>
 alias lukma          Lukasz Majewski <lukma@denx.de>
 alias macpaul        Macpaul Lin <macpaul@andestech.com>
 alias marex          Marek Vasut <marex@denx.de>
@@ -71,7 +72,7 @@ alias tegra2         tegra
 alias ti             uboot, trini
 alias uniphier       uboot, masahiro
 alias zynq           uboot, monstr
-alias rockchip       uboot, sjg, Kever Yang <kever.yang@rock-chips.com>, ptomsich
+alias rockchip       uboot, sjg, kevery, ptomsich
 
 alias m68k           uboot, alisonwang, angelo_ts
 alias coldfire       m68k
index 9c4e890..9bf9ced 100644 (file)
@@ -9,9 +9,9 @@
 #include <errno.h>
 #include <syscon.h>
 #include <asm/io.h>
-#include <asm/arch/clock.h>
-#include <asm/arch/cru_rk3036.h>
-#include <asm/arch/hardware.h>
+#include <asm/arch-rockchip/clock.h>
+#include <asm/arch-rockchip/cru_rk3036.h>
+#include <asm/arch-rockchip/hardware.h>
 #include <dm/lists.h>
 #include <dt-bindings/clock/rk3036-cru.h>
 #include <linux/log2.h>
index 7da785a..efda8c8 100644 (file)
@@ -9,9 +9,9 @@
 #include <errno.h>
 #include <syscon.h>
 #include <asm/io.h>
-#include <asm/arch/clock.h>
-#include <asm/arch/cru_rk3128.h>
-#include <asm/arch/hardware.h>
+#include <asm/arch-rockchip/clock.h>
+#include <asm/arch-rockchip/cru_rk3128.h>
+#include <asm/arch-rockchip/hardware.h>
 #include <bitfield.h>
 #include <dm/lists.h>
 #include <dt-bindings/clock/rk3128-cru.h>
index db7479a..9bb9959 100644 (file)
 #include <mapmem.h>
 #include <syscon.h>
 #include <asm/io.h>
-#include <asm/arch/clock.h>
-#include <asm/arch/cru_rk3188.h>
-#include <asm/arch/grf_rk3188.h>
-#include <asm/arch/hardware.h>
+#include <asm/arch-rockchip/clock.h>
+#include <asm/arch-rockchip/cru_rk3188.h>
+#include <asm/arch-rockchip/grf_rk3188.h>
+#include <asm/arch-rockchip/hardware.h>
 #include <dt-bindings/clock/rk3188-cru.h>
 #include <dm/device-internal.h>
 #include <dm/lists.h>
index 46a569c..48ed14b 100644 (file)
@@ -9,9 +9,9 @@
 #include <errno.h>
 #include <syscon.h>
 #include <asm/io.h>
-#include <asm/arch/clock.h>
-#include <asm/arch/cru_rk322x.h>
-#include <asm/arch/hardware.h>
+#include <asm/arch-rockchip/clock.h>
+#include <asm/arch-rockchip/cru_rk322x.h>
+#include <asm/arch-rockchip/hardware.h>
 #include <dm/lists.h>
 #include <dt-bindings/clock/rk3228-cru.h>
 #include <linux/log2.h>
index 930c99f..375d7f8 100644 (file)
 #include <mapmem.h>
 #include <syscon.h>
 #include <asm/io.h>
-#include <asm/arch/clock.h>
-#include <asm/arch/cru_rk3288.h>
-#include <asm/arch/grf_rk3288.h>
-#include <asm/arch/hardware.h>
+#include <asm/arch-rockchip/clock.h>
+#include <asm/arch-rockchip/cru_rk3288.h>
+#include <asm/arch-rockchip/grf_rk3288.h>
+#include <asm/arch-rockchip/hardware.h>
 #include <dt-bindings/clock/rk3288-cru.h>
 #include <dm/device-internal.h>
 #include <dm/lists.h>
index 106621f..a89e2ec 100644 (file)
@@ -9,10 +9,10 @@
 #include <dm.h>
 #include <errno.h>
 #include <syscon.h>
-#include <asm/arch/clock.h>
-#include <asm/arch/cru_rk3328.h>
-#include <asm/arch/hardware.h>
-#include <asm/arch/grf_rk3328.h>
+#include <asm/arch-rockchip/clock.h>
+#include <asm/arch-rockchip/cru_rk3328.h>
+#include <asm/arch-rockchip/hardware.h>
+#include <asm/arch-rockchip/grf_rk3328.h>
 #include <asm/io.h>
 #include <dm/lists.h>
 #include <dt-bindings/clock/rk3328-cru.h>
index 9492cc2..89cbae5 100644 (file)
@@ -13,9 +13,9 @@
 #include <mapmem.h>
 #include <syscon.h>
 #include <bitfield.h>
-#include <asm/arch/clock.h>
-#include <asm/arch/cru_rk3368.h>
-#include <asm/arch/hardware.h>
+#include <asm/arch-rockchip/clock.h>
+#include <asm/arch-rockchip/cru_rk3368.h>
+#include <asm/arch-rockchip/hardware.h>
 #include <asm/io.h>
 #include <dm/lists.h>
 #include <dt-bindings/clock/rk3368-cru.h>
index cab2bd9..93a652e 100644 (file)
@@ -13,9 +13,9 @@
 #include <syscon.h>
 #include <bitfield.h>
 #include <asm/io.h>
-#include <asm/arch/clock.h>
-#include <asm/arch/cru_rk3399.h>
-#include <asm/arch/hardware.h>
+#include <asm/arch-rockchip/clock.h>
+#include <asm/arch-rockchip/cru_rk3399.h>
+#include <asm/arch-rockchip/hardware.h>
 #include <dm/lists.h>
 #include <dt-bindings/clock/rk3399-cru.h>
 
index 914e2f4..3ebb007 100644 (file)
@@ -11,9 +11,9 @@
 #include <errno.h>
 #include <syscon.h>
 #include <asm/io.h>
-#include <asm/arch/clock.h>
-#include <asm/arch/cru_rv1108.h>
-#include <asm/arch/hardware.h>
+#include <asm/arch-rockchip/clock.h>
+#include <asm/arch-rockchip/cru_rv1108.h>
+#include <asm/arch-rockchip/hardware.h>
 #include <dm/lists.h>
 #include <dt-bindings/clock/rv1108-cru.h>
 
index 21df227..3d96678 100644 (file)
@@ -12,7 +12,8 @@
 #include <linux/errno.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
-#include <asm/arch/clock.h>
+#include <asm/arch-rockchip/clock.h>
+#include <asm/arch-rockchip/gpio.h>
 #include <dm/pinctrl.h>
 #include <dt-bindings/clock/rk3288-cru.h>
 
index f9a5796..cdd94bb 100644 (file)
@@ -12,9 +12,9 @@
 #include <errno.h>
 #include <i2c.h>
 #include <asm/io.h>
-#include <asm/arch/clock.h>
-#include <asm/arch/i2c.h>
-#include <asm/arch/periph.h>
+#include <asm/arch-rockchip/clock.h>
+#include <asm/arch-rockchip/i2c.h>
+#include <asm/arch-rockchip/periph.h>
 #include <dm/pinctrl.h>
 #include <linux/sizes.h>
 
index bf2d83a..b2a1201 100644 (file)
@@ -13,8 +13,8 @@
 #include <pwrseq.h>
 #include <syscon.h>
 #include <asm/gpio.h>
-#include <asm/arch/clock.h>
-#include <asm/arch/periph.h>
+#include <asm/arch-rockchip/clock.h>
+#include <asm/arch-rockchip/periph.h>
 #include <linux/err.h>
 
 struct rockchip_mmc_plat {
index c01ae75..26a6121 100644 (file)
 #include <phy.h>
 #include <syscon.h>
 #include <asm/io.h>
-#include <asm/arch/periph.h>
-#include <asm/arch/clock.h>
-#include <asm/arch/hardware.h>
-#include <asm/arch/grf_rk322x.h>
-#include <asm/arch/grf_rk3288.h>
-#include <asm/arch/grf_rk3328.h>
-#include <asm/arch/grf_rk3368.h>
-#include <asm/arch/grf_rk3399.h>
-#include <asm/arch/grf_rv1108.h>
+#include <asm/arch-rockchip/periph.h>
+#include <asm/arch-rockchip/clock.h>
+#include <asm/arch-rockchip/hardware.h>
+#include <asm/arch-rockchip/grf_rk322x.h>
+#include <asm/arch-rockchip/grf_rk3288.h>
+#include <asm/arch-rockchip/grf_rk3328.h>
+#include <asm/arch-rockchip/grf_rk3368.h>
+#include <asm/arch-rockchip/grf_rk3399.h>
+#include <asm/arch-rockchip/grf_rv1108.h>
 #include <dm/pinctrl.h>
 #include <dt-bindings/clock/rk3288-cru.h>
 #include "designware.h"
index 0e6c559..f01bc77 100644 (file)
@@ -116,6 +116,9 @@ static int pinconfig_post_bind(struct udevice *dev)
        ofnode node;
        int ret;
 
+       if (!dev_of_valid(dev))
+               return 0;
+
        dev_for_each_subnode(node, dev) {
                if (pre_reloc_only &&
                    !ofnode_pre_reloc(node))
index 9994cba..88db294 100644 (file)
@@ -12,7 +12,7 @@
 #include <regmap.h>
 #include <syscon.h>
 #include <asm/io.h>
-#include <asm/arch/pwm.h>
+#include <asm/arch-rockchip/pwm.h>
 #include <power/regulator.h>
 
 struct rk_pwm_priv {
index 8d1b9fa..92f584f 100644 (file)
 #include <regmap.h>
 #include <syscon.h>
 #include <asm/io.h>
-#include <asm/arch/clock.h>
-#include <asm/arch/cru_rk3368.h>
-#include <asm/arch/grf_rk3368.h>
-#include <asm/arch/ddr_rk3368.h>
-#include <asm/arch/sdram.h>
-#include <asm/arch/sdram_common.h>
+#include <asm/arch-rockchip/clock.h>
+#include <asm/arch-rockchip/cru_rk3368.h>
+#include <asm/arch-rockchip/grf_rk3368.h>
+#include <asm/arch-rockchip/ddr_rk3368.h>
+#include <asm/arch-rockchip/sdram.h>
+#include <asm/arch-rockchip/sdram_common.h>
 
 struct dram_info {
        struct ram_info info;
index df7b988..bfabc22 100644 (file)
@@ -7,9 +7,9 @@
 #include <dm.h>
 #include <ram.h>
 #include <syscon.h>
-#include <asm/arch/clock.h>
-#include <asm/arch/grf_rk3128.h>
-#include <asm/arch/sdram_common.h>
+#include <asm/arch-rockchip/clock.h>
+#include <asm/arch-rockchip/grf_rk3128.h>
+#include <asm/arch-rockchip/sdram_common.h>
 
 struct dram_info {
        struct ram_info info;
index fdd500a..00e52ec 100644 (file)
 #include <regmap.h>
 #include <syscon.h>
 #include <asm/io.h>
-#include <asm/arch/clock.h>
-#include <asm/arch/cru_rk3188.h>
-#include <asm/arch/ddr_rk3188.h>
-#include <asm/arch/grf_rk3188.h>
-#include <asm/arch/pmu_rk3188.h>
-#include <asm/arch/sdram.h>
-#include <asm/arch/sdram_common.h>
+#include <asm/arch-rockchip/clock.h>
+#include <asm/arch-rockchip/cru_rk3188.h>
+#include <asm/arch-rockchip/ddr_rk3188.h>
+#include <asm/arch-rockchip/grf_rk3188.h>
+#include <asm/arch-rockchip/pmu_rk3188.h>
+#include <asm/arch-rockchip/sdram.h>
+#include <asm/arch-rockchip/sdram_common.h>
 #include <linux/err.h>
 
 struct chan_info {
index 53835a9..c596523 100644 (file)
 #include <regmap.h>
 #include <syscon.h>
 #include <asm/io.h>
-#include <asm/arch/clock.h>
-#include <asm/arch/cru_rk322x.h>
-#include <asm/arch/grf_rk322x.h>
-#include <asm/arch/hardware.h>
-#include <asm/arch/sdram_rk322x.h>
-#include <asm/arch/timer.h>
-#include <asm/arch/uart.h>
-#include <asm/arch/sdram_common.h>
+#include <asm/arch-rockchip/clock.h>
+#include <asm/arch-rockchip/cru_rk322x.h>
+#include <asm/arch-rockchip/grf_rk322x.h>
+#include <asm/arch-rockchip/hardware.h>
+#include <asm/arch-rockchip/sdram_rk322x.h>
+#include <asm/arch-rockchip/timer.h>
+#include <asm/arch-rockchip/uart.h>
+#include <asm/arch-rockchip/sdram_common.h>
 #include <asm/types.h>
 #include <linux/err.h>
 
index d1e52d8..6bb025a 100644 (file)
 #include <regmap.h>
 #include <syscon.h>
 #include <asm/io.h>
-#include <asm/arch/clock.h>
-#include <asm/arch/cru_rk3288.h>
-#include <asm/arch/ddr_rk3288.h>
-#include <asm/arch/grf_rk3288.h>
-#include <asm/arch/pmu_rk3288.h>
-#include <asm/arch/sdram.h>
-#include <asm/arch/sdram_common.h>
+#include <asm/arch-rockchip/clock.h>
+#include <asm/arch-rockchip/cru_rk3288.h>
+#include <asm/arch-rockchip/ddr_rk3288.h>
+#include <asm/arch-rockchip/grf_rk3288.h>
+#include <asm/arch-rockchip/pmu_rk3288.h>
+#include <asm/arch-rockchip/sdram.h>
+#include <asm/arch-rockchip/sdram_common.h>
 #include <linux/err.h>
 #include <power/regulator.h>
 #include <power/rk8xx_pmic.h>
index e8b234d..f4e0b18 100644 (file)
@@ -7,9 +7,9 @@
 #include <dm.h>
 #include <ram.h>
 #include <syscon.h>
-#include <asm/arch/clock.h>
-#include <asm/arch/grf_rk3328.h>
-#include <asm/arch/sdram_common.h>
+#include <asm/arch-rockchip/clock.h>
+#include <asm/arch-rockchip/grf_rk3328.h>
+#include <asm/arch-rockchip/sdram_common.h>
 
 struct dram_info {
        struct ram_info info;
index 94dd011..05ec5fc 100644 (file)
 #include <regmap.h>
 #include <syscon.h>
 #include <asm/io.h>
-#include <asm/arch/clock.h>
-#include <asm/arch/sdram_common.h>
-#include <asm/arch/sdram_rk3399.h>
-#include <asm/arch/cru_rk3399.h>
-#include <asm/arch/grf_rk3399.h>
-#include <asm/arch/hardware.h>
+#include <asm/arch-rockchip/clock.h>
+#include <asm/arch-rockchip/sdram_common.h>
+#include <asm/arch-rockchip/sdram_rk3399.h>
+#include <asm/arch-rockchip/cru_rk3399.h>
+#include <asm/arch-rockchip/grf_rk3399.h>
+#include <asm/arch-rockchip/hardware.h>
 #include <linux/err.h>
 #include <time.h>
 
index af07134..3871fc0 100644 (file)
@@ -7,7 +7,7 @@
 #include <dm.h>
 #include <reset-uclass.h>
 #include <linux/io.h>
-#include <asm/arch/hardware.h>
+#include <asm/arch-rockchip/hardware.h>
 #include <dm/lists.h>
 /*
  * Each reg has 16 bits reset signal for devices
index 35fefd7..b1718f7 100644 (file)
@@ -9,7 +9,7 @@
 #include <dt-structs.h>
 #include <ns16550.h>
 #include <serial.h>
-#include <asm/arch/clock.h>
+#include <asm/arch-rockchip/clock.h>
 
 #if defined(CONFIG_ROCKCHIP_RK3188)
 struct rockchip_uart_platdata {
index e7fb9fb..a092dbc 100644 (file)
@@ -13,7 +13,7 @@
 #include <i2s.h>
 #include <misc.h>
 #include <sound.h>
-#include <asm/arch/periph.h>
+#include <asm/arch-rockchip/periph.h>
 #include <dm/pinctrl.h>
 
 static int rockchip_sound_setup(struct udevice *dev)
index 14437c0..a68553b 100644 (file)
@@ -2,6 +2,8 @@
 /*
  * spi driver for rockchip
  *
+ * (C) 2019 Theobroma Systems Design und Consulting GmbH
+ *
  * (C) Copyright 2015 Google, Inc
  *
  * (C) Copyright 2008-2013 Rockchip Electronics
 #include <spi.h>
 #include <linux/errno.h>
 #include <asm/io.h>
-#include <asm/arch/clock.h>
-#include <asm/arch/periph.h>
+#include <asm/arch-rockchip/clock.h>
+#include <asm/arch-rockchip/periph.h>
 #include <dm/pinctrl.h>
 #include "rk_spi.h"
 
 /* Change to 1 to output registers at the start of each transaction */
 #define DEBUG_RK_SPI   0
 
+struct rockchip_spi_params {
+       /* RXFIFO overruns and TXFIFO underruns stop the master clock */
+       bool master_manages_fifo;
+};
+
 struct rockchip_spi_platdata {
 #if CONFIG_IS_ENABLED(OF_PLATDATA)
        struct dtd_rockchip_rk3288_spi of_plat;
@@ -40,11 +47,8 @@ struct rockchip_spi_priv {
        unsigned int max_freq;
        unsigned int mode;
        ulong last_transaction_us;      /* Time of last transaction end */
-       u8 bits_per_word;               /* max 16 bits per word */
-       u8 n_bytes;
        unsigned int speed_hz;
        unsigned int last_speed_hz;
-       unsigned int tmode;
        uint input_rate;
 };
 
@@ -130,8 +134,13 @@ static void spi_cs_activate(struct udevice *dev, uint cs)
        if (plat->deactivate_delay_us && priv->last_transaction_us) {
                ulong delay_us;         /* The delay completed so far */
                delay_us = timer_get_us() - priv->last_transaction_us;
-               if (delay_us < plat->deactivate_delay_us)
-                       udelay(plat->deactivate_delay_us - delay_us);
+               if (delay_us < plat->deactivate_delay_us) {
+                       ulong additional_delay_us =
+                               plat->deactivate_delay_us - delay_us;
+                       debug("%s: delaying by %ld us\n",
+                             __func__, additional_delay_us);
+                       udelay(additional_delay_us);
+               }
        }
 
        debug("activate cs%u\n", cs);
@@ -263,8 +272,6 @@ static int rockchip_spi_probe(struct udevice *bus)
        }
        priv->input_rate = ret;
        debug("%s: rate = %u\n", __func__, priv->input_rate);
-       priv->bits_per_word = 8;
-       priv->tmode = TMOD_TR; /* Tx & Rx */
 
        return 0;
 }
@@ -274,28 +281,10 @@ static int rockchip_spi_claim_bus(struct udevice *dev)
        struct udevice *bus = dev->parent;
        struct rockchip_spi_priv *priv = dev_get_priv(bus);
        struct rockchip_spi *regs = priv->regs;
-       u8 spi_dfs, spi_tf;
        uint ctrlr0;
 
        /* Disable the SPI hardware */
-       rkspi_enable_chip(regs, 0);
-
-       switch (priv->bits_per_word) {
-       case 8:
-               priv->n_bytes = 1;
-               spi_dfs = DFS_8BIT;
-               spi_tf = HALF_WORD_OFF;
-               break;
-       case 16:
-               priv->n_bytes = 2;
-               spi_dfs = DFS_16BIT;
-               spi_tf = HALF_WORD_ON;
-               break;
-       default:
-               debug("%s: unsupported bits: %dbits\n", __func__,
-                     priv->bits_per_word);
-               return -EPROTONOSUPPORT;
-       }
+       rkspi_enable_chip(regs, false);
 
        if (priv->speed_hz != priv->last_speed_hz)
                rkspi_set_clk(priv, priv->speed_hz);
@@ -304,7 +293,7 @@ static int rockchip_spi_claim_bus(struct udevice *dev)
        ctrlr0 = OMOD_MASTER << OMOD_SHIFT;
 
        /* Data Frame Size */
-       ctrlr0 |= spi_dfs << DFS_SHIFT;
+       ctrlr0 |= DFS_8BIT << DFS_SHIFT;
 
        /* set SPI mode 0..3 */
        if (priv->mode & SPI_CPOL)
@@ -325,7 +314,7 @@ static int rockchip_spi_claim_bus(struct udevice *dev)
        ctrlr0 |= FBM_MSB << FBM_SHIFT;
 
        /* Byte and Halfword Transform */
-       ctrlr0 |= spi_tf << HALF_WORD_TX_SHIFT;
+       ctrlr0 |= HALF_WORD_OFF << HALF_WORD_TX_SHIFT;
 
        /* Rxd Sample Delay */
        ctrlr0 |= 0 << RXDSD_SHIFT;
@@ -334,7 +323,7 @@ static int rockchip_spi_claim_bus(struct udevice *dev)
        ctrlr0 |= FRF_SPI << FRF_SHIFT;
 
        /* Tx and Rx mode */
-       ctrlr0 |= (priv->tmode & TMOD_MASK) << TMOD_SHIFT;
+       ctrlr0 |= TMOD_TR << TMOD_SHIFT;
 
        writel(ctrlr0, &regs->ctrlr0);
 
@@ -351,6 +340,83 @@ static int rockchip_spi_release_bus(struct udevice *dev)
        return 0;
 }
 
+static inline int rockchip_spi_16bit_reader(struct udevice *dev,
+                                           u8 **din, int *len)
+{
+       struct udevice *bus = dev->parent;
+       const struct rockchip_spi_params * const data =
+               (void *)dev_get_driver_data(bus);
+       struct rockchip_spi_priv *priv = dev_get_priv(bus);
+       struct rockchip_spi *regs = priv->regs;
+       const u32 saved_ctrlr0 = readl(&regs->ctrlr0);
+#if defined(DEBUG)
+       u32 statistics_rxlevels[33] = { };
+#endif
+       u32 frames = *len / 2;
+       u8 *in = (u8 *)(*din);
+       u32 max_chunk_size = SPI_FIFO_DEPTH;
+
+       if (!frames)
+               return 0;
+
+       /*
+        * If we know that the hardware will manage RXFIFO overruns
+        * (i.e. stop the SPI clock until there's space in the FIFO),
+        * we the allow largest possible chunk size that can be
+        * represented in CTRLR1.
+        */
+       if (data && data->master_manages_fifo)
+               max_chunk_size = 0x10000;
+
+       // rockchip_spi_configure(dev, mode, size)
+       rkspi_enable_chip(regs, false);
+       clrsetbits_le32(&regs->ctrlr0,
+                       TMOD_MASK << TMOD_SHIFT,
+                       TMOD_RO << TMOD_SHIFT);
+       /* 16bit data frame size */
+       clrsetbits_le32(&regs->ctrlr0, DFS_MASK, DFS_16BIT);
+
+       /* Update caller's context */
+       const u32 bytes_to_process = 2 * frames;
+       *din += bytes_to_process;
+       *len -= bytes_to_process;
+
+       /* Process our frames */
+       while (frames) {
+               u32 chunk_size = min(frames, max_chunk_size);
+
+               frames -= chunk_size;
+
+               writew(chunk_size - 1, &regs->ctrlr1);
+               rkspi_enable_chip(regs, true);
+
+               do {
+                       u32 rx_level = readw(&regs->rxflr);
+#if defined(DEBUG)
+                       statistics_rxlevels[rx_level]++;
+#endif
+                       chunk_size -= rx_level;
+                       while (rx_level--) {
+                               u16 val = readw(regs->rxdr);
+                               *in++ = val & 0xff;
+                               *in++ = val >> 8;
+                       }
+               } while (chunk_size);
+
+               rkspi_enable_chip(regs, false);
+       }
+
+#if defined(DEBUG)
+       debug("%s: observed rx_level during processing:\n", __func__);
+       for (int i = 0; i <= 32; ++i)
+               if (statistics_rxlevels[i])
+                       debug("\t%2d: %d\n", i, statistics_rxlevels[i]);
+#endif
+       /* Restore the original transfer setup and return error-free. */
+       writel(saved_ctrlr0, &regs->ctrlr0);
+       return 0;
+}
+
 static int rockchip_spi_xfer(struct udevice *dev, unsigned int bitlen,
                           const void *dout, void *din, unsigned long flags)
 {
@@ -362,7 +428,7 @@ static int rockchip_spi_xfer(struct udevice *dev, unsigned int bitlen,
        const u8 *out = dout;
        u8 *in = din;
        int toread, towrite;
-       int ret;
+       int ret = 0;
 
        debug("%s: dout=%p, din=%p, len=%x, flags=%lx\n", __func__, dout, din,
              len, flags);
@@ -373,8 +439,18 @@ static int rockchip_spi_xfer(struct udevice *dev, unsigned int bitlen,
        if (flags & SPI_XFER_BEGIN)
                spi_cs_activate(dev, slave_plat->cs);
 
+       /*
+        * To ensure fast loading of firmware images (e.g. full U-Boot
+        * stage, ATF, Linux kernel) from SPI flash, we optimise the
+        * case of read-only transfers by using the full 16bits of each
+        * FIFO element.
+        */
+       if (!out)
+               ret = rockchip_spi_16bit_reader(dev, &in, &len);
+
+       /* This is the original 8bit reader/writer code */
        while (len > 0) {
-               int todo = min(len, 0xffff);
+               int todo = min(len, 0x10000);
 
                rkspi_enable_chip(regs, false);
                writel(todo - 1, &regs->ctrlr1);
@@ -397,9 +473,18 @@ static int rockchip_spi_xfer(struct udevice *dev, unsigned int bitlen,
                                toread--;
                        }
                }
-               ret = rkspi_wait_till_not_busy(regs);
-               if (ret)
-                       break;
+
+               /*
+                * In case that there's a transmit-component, we need to wait
+                * until the control goes idle before we can disable the SPI
+                * control logic (as this will implictly flush the FIFOs).
+                */
+               if (out) {
+                       ret = rkspi_wait_till_not_busy(regs);
+                       if (ret)
+                               break;
+               }
+
                len -= todo;
        }
 
@@ -446,10 +531,16 @@ static const struct dm_spi_ops rockchip_spi_ops = {
         */
 };
 
+const  struct rockchip_spi_params rk3399_spi_params = {
+       .master_manages_fifo = true,
+};
+
 static const struct udevice_id rockchip_spi_ids[] = {
        { .compatible = "rockchip,rk3288-spi" },
-       { .compatible = "rockchip,rk3368-spi" },
-       { .compatible = "rockchip,rk3399-spi" },
+       { .compatible = "rockchip,rk3368-spi",
+         .data = (ulong)&rk3399_spi_params },
+       { .compatible = "rockchip,rk3399-spi",
+         .data = (ulong)&rk3399_spi_params },
        { }
 };
 
index 93d7cfe..0fc6b68 100644 (file)
@@ -8,9 +8,9 @@
 #include <errno.h>
 #include <sysreset.h>
 #include <asm/io.h>
-#include <asm/arch/clock.h>
-#include <asm/arch/cru_rk3328.h>
-#include <asm/arch/hardware.h>
+#include <asm/arch-rockchip/clock.h>
+#include <asm/arch-rockchip/cru_rk3328.h>
+#include <asm/arch-rockchip/hardware.h>
 #include <linux/err.h>
 
 int rockchip_sysreset_request(struct udevice *dev, enum sysreset_t type)
index 6901974..54956e5 100644 (file)
@@ -7,7 +7,7 @@
 #include <dm.h>
 #include <dm/ofnode.h>
 #include <mapmem.h>
-#include <asm/arch/timer.h>
+#include <asm/arch-rockchip/timer.h>
 #include <dt-structs.h>
 #include <timer.h>
 #include <asm/io.h>
index e81eb16..f3d2477 100644 (file)
@@ -15,7 +15,7 @@
 #include <linux/compiler.h>
 #include <version.h>
 #include <g_dnl.h>
-#include <asm/arch/f_rockusb.h>
+#include <asm/arch-rockchip/f_rockusb.h>
 
 static inline struct f_rockusb *func_to_rockusb(struct usb_function *f)
 {
index eb3692c..315d3ad 100644 (file)
@@ -13,9 +13,9 @@
 #include <syscon.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
-#include <asm/arch/clock.h>
-#include <asm/arch/hardware.h>
-#include <asm/arch/grf_rk3288.h>
+#include <asm/arch-rockchip/clock.h>
+#include <asm/arch-rockchip/hardware.h>
+#include <asm/arch-rockchip/grf_rk3288.h>
 #include <power/regulator.h>
 #include "rk_hdmi.h"
 
index d268b46..7c4a4cc 100644 (file)
 #include "rk_mipi.h"
 #include <syscon.h>
 #include <asm/gpio.h>
-#include <asm/hardware.h>
 #include <asm/io.h>
 #include <dm/uclass-internal.h>
 #include <linux/kernel.h>
-#include <asm/arch/clock.h>
-#include <asm/arch/cru_rk3288.h>
-#include <asm/arch/grf_rk3288.h>
-#include <asm/arch/rockchip_mipi_dsi.h>
+#include <asm/arch-rockchip/clock.h>
+#include <asm/arch-rockchip/cru_rk3288.h>
+#include <asm/arch-rockchip/grf_rk3288.h>
+#include <asm/arch-rockchip/hardware.h>
+#include <asm/arch-rockchip/rockchip_mipi_dsi.h>
 
 #define MHz 1000000
 
index 7e953a6..0f91dab 100644 (file)
 #include <regmap.h>
 #include <syscon.h>
 #include <video.h>
-#include <asm/hardware.h>
 #include <asm/io.h>
-#include <asm/arch/clock.h>
-#include <asm/arch/grf_rk3288.h>
+#include <asm/arch-rockchip/clock.h>
+#include <asm/arch-rockchip/grf_rk3288.h>
+#include <asm/arch-rockchip/hardware.h>
 #include "rk_vop.h"
 
 DECLARE_GLOBAL_DATA_PTR;
index b75efe6..a62be98 100644 (file)
@@ -13,9 +13,9 @@
 #include <syscon.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
-#include <asm/arch/clock.h>
-#include <asm/arch/hardware.h>
-#include <asm/arch/grf_rk3399.h>
+#include <asm/arch-rockchip/clock.h>
+#include <asm/arch-rockchip/hardware.h>
+#include <asm/arch-rockchip/grf_rk3399.h>
 #include <power/regulator.h>
 #include "rk_hdmi.h"
 
index bb9007b..a93b734 100644 (file)
 #include "rk_mipi.h"
 #include <syscon.h>
 #include <asm/gpio.h>
-#include <asm/hardware.h>
 #include <asm/io.h>
 #include <dm/uclass-internal.h>
 #include <linux/kernel.h>
-#include <asm/arch/clock.h>
-#include <asm/arch/cru_rk3399.h>
-#include <asm/arch/grf_rk3399.h>
-#include <asm/arch/rockchip_mipi_dsi.h>
+#include <asm/arch-rockchip/clock.h>
+#include <asm/arch-rockchip/cru_rk3399.h>
+#include <asm/arch-rockchip/grf_rk3399.h>
+#include <asm/arch-rockchip/hardware.h>
+#include <asm/arch-rockchip/rockchip_mipi_dsi.h>
 
 /* Select mipi dsi source, big or little vop */
 static int rk_mipi_dsi_source_select(struct udevice *dev)
index 7a02221..81c122d 100644 (file)
@@ -10,7 +10,7 @@
 #include <dm.h>
 #include <regmap.h>
 #include <video.h>
-#include <asm/hardware.h>
+#include <asm/arch-rockchip/hardware.h>
 #include <asm/io.h>
 #include "rk_vop.h"
 
index e074107..4330725 100644 (file)
@@ -14,9 +14,9 @@
 #include <syscon.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
-#include <asm/arch/clock.h>
-#include <asm/arch/edp_rk3288.h>
-#include <asm/arch/grf_rk3288.h>
+#include <asm/arch-rockchip/clock.h>
+#include <asm/arch-rockchip/edp_rk3288.h>
+#include <asm/arch-rockchip/grf_rk3288.h>
 #include <dt-bindings/clock/rk3288-cru.h>
 
 #define MAX_CR_LOOP 5
index 13d07ee..51931ce 100644 (file)
 #include <regmap.h>
 #include <syscon.h>
 #include <asm/gpio.h>
-#include <asm/hardware.h>
 #include <asm/io.h>
-#include <asm/arch/clock.h>
-#include <asm/arch/hardware.h>
+#include <asm/arch-rockchip/clock.h>
+#include <asm/arch-rockchip/hardware.h>
 #include "rk_hdmi.h"
 #include "rk_vop.h" /* for rk_vop_probe_regulators */
 
index f0a528c..cf5c043 100644 (file)
@@ -12,9 +12,9 @@
 #include <syscon.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
-#include <asm/arch/clock.h>
-#include <asm/arch/lvds_rk3288.h>
-#include <asm/arch/grf_rk3288.h>
+#include <asm/arch-rockchip/clock.h>
+#include <asm/arch-rockchip/lvds_rk3288.h>
+#include <asm/arch-rockchip/grf_rk3288.h>
 #include <dt-bindings/clock/rk3288-cru.h>
 #include <dt-bindings/video/rk3288.h>
 
index 4f1a0f3..bcd039b 100644 (file)
 #include "rk_mipi.h"
 #include <syscon.h>
 #include <asm/gpio.h>
-#include <asm/hardware.h>
 #include <asm/io.h>
 #include <dm/uclass-internal.h>
 #include <linux/kernel.h>
-#include <asm/arch/clock.h>
-#include <asm/arch/cru_rk3399.h>
-#include <asm/arch/grf_rk3399.h>
-#include <asm/arch/rockchip_mipi_dsi.h>
+#include <asm/arch-rockchip/clock.h>
+#include <asm/arch-rockchip/cru_rk3399.h>
+#include <asm/arch-rockchip/grf_rk3399.h>
+#include <asm/arch-rockchip/rockchip_mipi_dsi.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
index faf4f24..b56c3f3 100644 (file)
 #include <syscon.h>
 #include <video.h>
 #include <asm/gpio.h>
-#include <asm/hardware.h>
 #include <asm/io.h>
-#include <asm/arch/clock.h>
-#include <asm/arch/edp_rk3288.h>
-#include <asm/arch/vop_rk3288.h>
+#include <asm/arch-rockchip/clock.h>
+#include <asm/arch-rockchip/edp_rk3288.h>
+#include <asm/arch-rockchip/vop_rk3288.h>
 #include <dm/device-internal.h>
 #include <dm/uclass-internal.h>
 #include <power/regulator.h>
index 828974d..8fa2f38 100644 (file)
@@ -6,7 +6,7 @@
 #ifndef __RK_VOP_H__
 #define __RK_VOP_H__
 
-#include <asm/arch/vop_rk3288.h>
+#include <asm/arch-rockchip/vop_rk3288.h>
 
 struct rk_vop_priv {
        void *grf;
index 6c02446..f5d09d1 100644 (file)
@@ -5,7 +5,7 @@
 #ifndef __CONFIG_RK3036_COMMON_H
 #define __CONFIG_RK3036_COMMON_H
 
-#include <asm/arch/hardware.h>
+#include <asm/arch-rockchip/hardware.h>
 #include "rockchip-common.h"
 
 #define CONFIG_SYS_MALLOC_LEN          (32 << 20)
index 4f6f4af..1d41702 100644 (file)
@@ -8,7 +8,7 @@
 
 #define CONFIG_SYS_CACHELINE_SIZE      64
 
-#include <asm/arch/hardware.h>
+#include <asm/arch-rockchip/hardware.h>
 #include "rockchip-common.h"
 
 #define CONFIG_SKIP_LOWLEVEL_INIT_ONLY
index 22eb064..3a96748 100644 (file)
@@ -5,7 +5,7 @@
 #ifndef __CONFIG_RK322X_COMMON_H
 #define __CONFIG_RK322X_COMMON_H
 
-#include <asm/arch/hardware.h>
+#include <asm/arch-rockchip/hardware.h>
 #include "rockchip-common.h"
 
 #define CONFIG_SKIP_LOWLEVEL_INIT
index 3a1cbf2..7c79ed6 100644 (file)
@@ -6,7 +6,7 @@
 #ifndef __CONFIG_RK3288_COMMON_H
 #define __CONFIG_RK3288_COMMON_H
 
-#include <asm/arch/hardware.h>
+#include <asm/arch-rockchip/hardware.h>
 #include "rockchip-common.h"
 
 #define CONFIG_SKIP_LOWLEVEL_INIT_ONLY
index cf51f25..bb2e96b 100644 (file)
@@ -10,7 +10,7 @@
 
 #define CONFIG_SYS_CACHELINE_SIZE      64
 
-#include <asm/arch/hardware.h>
+#include <asm/arch-rockchip/hardware.h>
 #include <linux/sizes.h>
 
 #define CONFIG_SYS_SDRAM_BASE          0
index 952ea9f..6f61f01 100644 (file)
@@ -5,7 +5,7 @@
 #ifndef __CONFIG_RV1108_COMMON_H
 #define __CONFIG_RV1108_COMMON_H
 
-#include <asm/arch/hardware.h>
+#include <asm/arch-rockchip/hardware.h>
 #include "rockchip-common.h"
 
 #define CONFIG_SYS_MALLOC_LEN          (32 << 20)
index 39ed8a6..7af3f16 100644 (file)
@@ -207,12 +207,17 @@ struct efi_object {
  * struct efi_loaded_image_obj - handle of a loaded image
  *
  * @header:            EFI object header
+ * @exit_status:       exit status passed to Exit()
+ * @exit_data_size:    exit data size passed to Exit()
+ * @exit_data:         exit data passed to Exit()
  * @exit_jmp:          long jump buffer for returning form started image
  * @entry:             entry address of the relocated image
  */
 struct efi_loaded_image_obj {
        struct efi_object header;
        efi_status_t exit_status;
+       efi_uintn_t *exit_data_size;
+       u16 **exit_data;
        struct jmp_buf_data exit_jmp;
        EFIAPI efi_status_t (*entry)(efi_handle_t image_handle,
                                     struct efi_system_table *st);
@@ -560,7 +565,7 @@ struct efi_load_option {
        u16 file_path_length;
        u16 *label;
        struct efi_device_path *file_path;
-       u8 *optional_data;
+       const u8 *optional_data;
 };
 
 void efi_deserialize_load_option(struct efi_load_option *lo, u8 *data);
index 49d3d6d..dd42e49 100644 (file)
@@ -16,7 +16,7 @@
 
 #define EFI_ST_SUCCESS 0
 #define EFI_ST_FAILURE 1
-
+#define EFI_ST_SUCCESS_STR L"SUCCESS"
 /*
  * Prints a message.
  */
index 4ccba22..7bf5187 100644 (file)
@@ -53,19 +53,20 @@ void efi_deserialize_load_option(struct efi_load_option *lo, u8 *data)
  */
 unsigned long efi_serialize_load_option(struct efi_load_option *lo, u8 **data)
 {
-       unsigned long label_len, option_len;
+       unsigned long label_len;
        unsigned long size;
        u8 *p;
 
        label_len = (u16_strlen(lo->label) + 1) * sizeof(u16);
-       option_len = strlen((char *)lo->optional_data);
 
        /* total size */
        size = sizeof(lo->attributes);
        size += sizeof(lo->file_path_length);
        size += label_len;
        size += lo->file_path_length;
-       size += option_len + 1;
+       if (lo->optional_data)
+               size += (utf8_utf16_strlen((const char *)lo->optional_data)
+                                          + 1) * sizeof(u16);
        p = malloc(size);
        if (!p)
                return 0;
@@ -84,10 +85,10 @@ unsigned long efi_serialize_load_option(struct efi_load_option *lo, u8 **data)
        memcpy(p, lo->file_path, lo->file_path_length);
        p += lo->file_path_length;
 
-       memcpy(p, lo->optional_data, option_len);
-       p += option_len;
-       *(char *)p = '\0';
-
+       if (lo->optional_data) {
+               utf8_utf16_strcpy((u16 **)&p, (const char *)lo->optional_data);
+               p += sizeof(u16); /* size of trailing \0 */
+       }
        return size;
 }
 
index 601b0a2..e5c46e9 100644 (file)
@@ -423,10 +423,12 @@ static efi_status_t EFIAPI efi_free_pool_ext(void *buffer)
 }
 
 /**
- * efi_add_handle() - add a new object to the object list
- * @obj: object to be added
+ * efi_add_handle() - add a new handle to the object list
  *
- * The protocols list is initialized. The object handle is set.
+ * @handle:    handle to be added
+ *
+ * The protocols list is initialized. The handle is added to the list of known
+ * UEFI objects.
  */
 void efi_add_handle(efi_handle_t handle)
 {
@@ -618,7 +620,7 @@ efi_status_t efi_create_event(uint32_t type, efi_uintn_t notify_tpl,
        }
 
        if ((type & (EVT_NOTIFY_WAIT | EVT_NOTIFY_SIGNAL)) &&
-           (is_valid_tpl(notify_tpl) != EFI_SUCCESS))
+           (!notify_function || is_valid_tpl(notify_tpl) != EFI_SUCCESS))
                return EFI_INVALID_PARAMETER;
 
        evt = calloc(1, sizeof(struct efi_event));
@@ -2626,6 +2628,9 @@ efi_status_t EFIAPI efi_start_image(efi_handle_t image_handle,
 
        efi_is_direct_boot = false;
 
+       image_obj->exit_data_size = exit_data_size;
+       image_obj->exit_data = exit_data;
+
        /* call the image! */
        if (setjmp(&image_obj->exit_jmp)) {
                /*
@@ -2669,6 +2674,41 @@ efi_status_t EFIAPI efi_start_image(efi_handle_t image_handle,
        return EFI_CALL(systab.boottime->exit(image_handle, ret, 0, NULL));
 }
 
+/**
+ * efi_update_exit_data() - fill exit data parameters of StartImage()
+ *
+ * @image_obj          image handle
+ * @exit_data_size     size of the exit data buffer
+ * @exit_data          buffer with data returned by UEFI payload
+ * Return:             status code
+ */
+static efi_status_t efi_update_exit_data(struct efi_loaded_image_obj *image_obj,
+                                        efi_uintn_t exit_data_size,
+                                        u16 *exit_data)
+{
+       efi_status_t ret;
+
+       /*
+        * If exit_data is not provided to StartImage(), exit_data_size must be
+        * ignored.
+        */
+       if (!image_obj->exit_data)
+               return EFI_SUCCESS;
+       if (image_obj->exit_data_size)
+               *image_obj->exit_data_size = exit_data_size;
+       if (exit_data_size && exit_data) {
+               ret = efi_allocate_pool(EFI_BOOT_SERVICES_DATA,
+                                       exit_data_size,
+                                       (void **)image_obj->exit_data);
+               if (ret != EFI_SUCCESS)
+                       return ret;
+               memcpy(*image_obj->exit_data, exit_data, exit_data_size);
+       } else {
+               image_obj->exit_data = NULL;
+       }
+       return EFI_SUCCESS;
+}
+
 /**
  * efi_exit() - leave an EFI application or driver
  * @image_handle:   handle of the application or driver that is exiting
@@ -2709,6 +2749,15 @@ static efi_status_t EFIAPI efi_exit(efi_handle_t image_handle,
        if (ret != EFI_SUCCESS)
                goto out;
 
+       /* Exit data is only foreseen in case of failure. */
+       if (exit_status != EFI_SUCCESS) {
+               ret = efi_update_exit_data(image_obj, exit_data_size,
+                                          exit_data);
+               /* Exiting has priority. Don't return error to caller. */
+               if (ret != EFI_SUCCESS)
+                       EFI_PRINT("%s: out of memory\n", __func__);
+       }
+
        /* Make sure entry/exit counts for EFI world cross-overs match */
        EFI_EXIT(exit_status);
 
index 987cc6d..776077c 100644 (file)
@@ -452,7 +452,7 @@ efi_status_t efi_free_pages(uint64_t memory, efi_uintn_t pages)
        uint64_t r = 0;
 
        /* Sanity check */
-       if (!memory || (memory & EFI_PAGE_MASK)) {
+       if (!memory || (memory & EFI_PAGE_MASK) || !pages) {
                printf("%s: illegal free 0x%llx, 0x%zx\n", __func__,
                       memory, pages);
                return EFI_INVALID_PARAMETER;
index b32a7b3..87db51c 100644 (file)
@@ -79,6 +79,7 @@ out:
  */
 efi_status_t efi_init_obj_list(void)
 {
+       u64 os_indications_supported = 0; /* None */
        efi_status_t ret = EFI_SUCCESS;
 
        /* Initialize once only */
@@ -90,6 +91,16 @@ efi_status_t efi_init_obj_list(void)
        if (ret != EFI_SUCCESS)
                goto out;
 
+       /* Indicate supported features */
+       ret = EFI_CALL(efi_set_variable(L"OsIndicationsSupported",
+                                       &efi_global_variable_guid,
+                                       EFI_VARIABLE_BOOTSERVICE_ACCESS |
+                                       EFI_VARIABLE_RUNTIME_ACCESS,
+                                       sizeof(os_indications_supported),
+                                       &os_indications_supported));
+       if (ret != EFI_SUCCESS)
+               goto out;
+
        /* Initialize system table */
        ret = efi_initialize_system_table();
        if (ret != EFI_SUCCESS)
index b3ca109..6b5cfb0 100644 (file)
@@ -9,7 +9,7 @@
  */
 
 #include <common.h>
-#include <efi_api.h>
+#include <efi_selftest.h>
 
 static efi_guid_t loaded_image_protocol_guid = EFI_LOADED_IMAGE_PROTOCOL_GUID;
 
@@ -66,15 +66,22 @@ efi_status_t EFIAPI efi_main(efi_handle_t handle,
                             struct efi_system_table *systable)
 {
        struct efi_simple_text_output_protocol *con_out = systable->con_out;
-       efi_status_t ret = EFI_UNSUPPORTED;
+       efi_status_t ret;
+       u16 text[] = EFI_ST_SUCCESS_STR;
 
        con_out->output_string(con_out, L"EFI application calling Exit\n");
 
-       if (check_loaded_image_protocol(handle, systable) != EFI_SUCCESS)
+       if (check_loaded_image_protocol(handle, systable) != EFI_SUCCESS) {
+               con_out->output_string(con_out,
+                                      L"Loaded image protocol missing\n");
                ret = EFI_NOT_FOUND;
+               goto out;
+       }
 
-       /* The return value is checked by the calling test */
-       systable->boottime->exit(handle, ret, 0, NULL);
+       /* This return value is expected by the calling test */
+       ret = EFI_UNSUPPORTED;
+out:
+       systable->boottime->exit(handle, ret, sizeof(text), text);
 
        /*
         * This statement should not be reached.
index fa4b7d4..96049de 100644 (file)
@@ -123,6 +123,9 @@ static int execute(void)
 {
        efi_status_t ret;
        efi_handle_t handle;
+       efi_uintn_t exit_data_size = 0;
+       u16 *exit_data = NULL;
+       u16 expected_text[] = EFI_ST_SUCCESS_STR;
 
        ret = boottime->load_image(false, image_handle, NULL, image,
                                   img.length, &handle);
@@ -130,11 +133,21 @@ static int execute(void)
                efi_st_error("Failed to load image\n");
                return EFI_ST_FAILURE;
        }
-       ret = boottime->start_image(handle, NULL, NULL);
+       ret = boottime->start_image(handle, &exit_data_size, &exit_data);
        if (ret != EFI_UNSUPPORTED) {
                efi_st_error("Wrong return value from application\n");
                return EFI_ST_FAILURE;
        }
+       if (!exit_data || exit_data_size != sizeof(expected_text) ||
+           efi_st_memcmp(exit_data, expected_text, sizeof(expected_text))) {
+               efi_st_error("Incorrect exit data\n");
+               return EFI_ST_FAILURE;
+       }
+       ret = boottime->free_pool(exit_data);
+       if (ret != EFI_SUCCESS) {
+               efi_st_error("Failed to free exit data\n");
+               return EFI_ST_FAILURE;
+       }
 
        return EFI_ST_SUCCESS;
 }
index fa20ee3..2d4d6ef 100644 (file)
@@ -238,6 +238,8 @@ void gen_rand_uuid(unsigned char *uuid_bin)
        unsigned int *ptr = (unsigned int *)&uuid;
        int i;
 
+       srand(get_ticks() + rand());
+
        /* Set all fields randomly */
        for (i = 0; i < sizeof(struct uuid) / sizeof(*ptr); i++)
                *(ptr + i) = cpu_to_be32(rand());