[PATCH 17/31] rockchip: rk3399-puma: Sync DT from linux v6.8

Quentin Schulz quentin.schulz at theobroma-systems.com
Tue Apr 2 17:13:08 CEST 2024


Hi Jonas,

On 3/31/24 22:28, Jonas Karlman wrote:
> Sync rk3399-puma related device tree from linux v6.8.
> 
> SPL_MAX_SIZE is not adjusted to the now common 0x40000 (256 KiB) due to
> TPL+SPL combined (idbloader.img) is limited to max 224 KiB because of:
> 
>    SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x200
> 
> Because FIT payload is located at sector 0x200 instead of the more
> Rockchip common 0x4000, TPL+SPL cannot take up more than 224 KiB:
> 
>    (0x200 - 64) x 512 = 0x38000 (224 KiB)
> 
> Also adjust SPL_PAD_TO to match the 0x200 sector offset.
> 
> Signed-off-by: Jonas Karlman <jonas at kwiboo.se>
> ---
>   arch/arm/dts/rk3399-puma-haikou-u-boot.dtsi | 20 ++--------
>   arch/arm/dts/rk3399-puma-haikou.dts         | 42 ++++++++++++++++++---
>   arch/arm/dts/rk3399-puma.dtsi               | 17 ++++++++-
>   configs/puma-rk3399_defconfig               |  2 +-
>   4 files changed, 57 insertions(+), 24 deletions(-)
> 
> diff --git a/arch/arm/dts/rk3399-puma-haikou-u-boot.dtsi b/arch/arm/dts/rk3399-puma-haikou-u-boot.dtsi
> index f48d395f972a..65340f98d595 100644
> --- a/arch/arm/dts/rk3399-puma-haikou-u-boot.dtsi
> +++ b/arch/arm/dts/rk3399-puma-haikou-u-boot.dtsi
> @@ -30,18 +30,6 @@
>   	aliases {
>   		spi5 = &spi5;
>   	};
> -
> -	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>;
> -		regulator-init-microvolt = <950000>;
> -		vin-supply = <&vcc5v0_sys>;
> -	};
>   };
>   
>   &binman {
> @@ -87,10 +75,6 @@
>   	bootph-all;
>   };
>   
> -&haikou_pin_hog {
> -	bootph-all;
> -};
> -
>   &norflash {
>   	bootph-pre-ram;
>   	bootph-some-ram;
> @@ -111,3 +95,7 @@
>   &uart0_xfer {
>   	bootph-all;
>   };
> +
> +&vdd_log {
> +	regulator-init-microvolt = <950000>;
> +};
> diff --git a/arch/arm/dts/rk3399-puma-haikou.dts b/arch/arm/dts/rk3399-puma-haikou.dts
> index 115c14c0a3c6..18a98c4648ea 100644
> --- a/arch/arm/dts/rk3399-puma-haikou.dts
> +++ b/arch/arm/dts/rk3399-puma-haikou.dts
> @@ -5,6 +5,7 @@
>   
>   /dts-v1/;
>   #include "rk3399-puma.dtsi"
> +#include <dt-bindings/input/input.h>
>   
>   / {
>   	model = "Theobroma Systems RK3399-Q7 SoM";
> @@ -18,6 +19,38 @@
>   		stdout-path = "serial0:115200n8";
>   	};
>   
> +	gpio-keys {
> +		compatible = "gpio-keys";
> +		pinctrl-0 = <&haikou_keys_pin>;
> +		pinctrl-names = "default";
> +

To make sure we keep the same behavior, we would need to enable 
CONFIG_BUTTON_GPIO in the defconfig for it to do the pinmuxing.

The impact would be limited, so that's something we could deal with 
later on if you mind having a commit for that in this series.

> +		button-batlow-n {
> +			gpios = <&gpio0 RK_PB2 GPIO_ACTIVE_LOW>;
> +			label = "BATLOW#";
> +			linux,code = <KEY_BATTERY>;
> +		};
> +
> +		button-slp-btn-n {
> +			gpios = <&gpio0 RK_PB3 GPIO_ACTIVE_LOW>;
> +			label = "SLP_BTN#";
> +			linux,code = <KEY_SLEEP>;
> +		};
> +
> +		button-wake-n {
> +			gpios = <&gpio0 RK_PB1 GPIO_ACTIVE_LOW>;
> +			label = "WAKE#";
> +			linux,code = <KEY_WAKEUP>;
> +			wakeup-source;
> +		};
> +
> +		switch-lid-btn-n {
> +			gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_LOW>;
> +			label = "LID_BTN#";
> +			linux,code = <SW_LID>;
> +			linux,input-type = <EV_SW>;
> +		};
> +	};
> +
>   	leds {
>   		pinctrl-0 = <&module_led_pin>, <&sd_card_led_pin>;
>   
> @@ -165,11 +198,8 @@
>   };
>   
>   &pinctrl {
> -	pinctrl-names = "default";
> -	pinctrl-0 = <&haikou_pin_hog>;
> -
> -	hog {
> -		haikou_pin_hog: haikou-pin-hog {
> +	buttons {
> +		haikou_keys_pin: haikou-keys-pin {
>   			rockchip,pins =
>   			  /* LID_BTN */
>   			  <0 RK_PA4 RK_FUNC_GPIO &pcfg_pull_up>,
> @@ -177,7 +207,7 @@
>   			  <0 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>,
>   			  /* SLP_BTN# */
>   			  <0 RK_PB3 RK_FUNC_GPIO &pcfg_pull_up>,
> -			  /* BIOS_DISABLE# */
> +			  /* WAKE# */
>   			  <0 RK_PB1 RK_FUNC_GPIO &pcfg_pull_up>;
>   		};
>   	};
> diff --git a/arch/arm/dts/rk3399-puma.dtsi b/arch/arm/dts/rk3399-puma.dtsi
> index aa3e21bd6c8f..c08e69391c01 100644
> --- a/arch/arm/dts/rk3399-puma.dtsi
> +++ b/arch/arm/dts/rk3399-puma.dtsi
> @@ -9,6 +9,7 @@
>   
>   / {
>   	aliases {
> +		ethernet0 = &gmac;
>   		mmc0 = &sdhci;
>   	};
>   
> @@ -27,7 +28,7 @@
>   
>   	extcon_usb3: extcon-usb3 {
>   		compatible = "linux,extcon-usb-gpio";
> -		id-gpio = <&gpio1 RK_PC2 GPIO_ACTIVE_HIGH>;
> +		id-gpios = <&gpio1 RK_PC2 GPIO_ACTIVE_HIGH>;
>   		pinctrl-names = "default";
>   		pinctrl-0 = <&usb3_id>;
>   	};
> @@ -119,6 +120,20 @@
>   	drive-impedance-ohm = <33>;
>   };
>   
> +&gpio0 {
> +	/*
> +	 * The BIOS_DISABLE hog is a feedback pin for the actual status of the
> +	 * signal. This usually represents the state of a switch on the baseboard.
> +	 * The pin has a 10k pull-up resistor connected, so no pull-up setting is needed.
> +	 */
> +	bios-disable-hog {
> +		gpios = <RK_PB0 GPIO_ACTIVE_HIGH>;
> +		gpio-hog;
> +		input;
> +		line-name = "bios_disable";
> +	};
> +};
> +
>   &gmac {
>   	assigned-clocks = <&cru SCLK_RMII_SRC>;
>   	assigned-clock-parents = <&clkin_gmac>;
> diff --git a/configs/puma-rk3399_defconfig b/configs/puma-rk3399_defconfig
> index cc3d2cf3755d..26d524cabb06 100644
> --- a/configs/puma-rk3399_defconfig
> +++ b/configs/puma-rk3399_defconfig
> @@ -27,7 +27,7 @@ CONFIG_DEBUG_UART=y
>   CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-puma-haikou.dtb"
>   CONFIG_DISPLAY_BOARDINFO_LATE=y
>   CONFIG_SPL_MAX_SIZE=0x2e000
> -CONFIG_SPL_PAD_TO=0x7f8000
> +CONFIG_SPL_PAD_TO=0x38000

Those are unrelated changes, please in a different commit (but thanks 
for catching my mistakes :) ).

Reviewed-by: Quentin Schulz <quentin.schulz at theobroma-systems.com>

Thanks,
Quentin


More information about the U-Boot mailing list