diff --git a/u-boot/0001-rk3399-pinebook-fix-sdcard-boot-from-emmc.patch b/u-boot/0001-rk3399-pinebook-fix-sdcard-boot-from-emmc.patch new file mode 100644 index 0000000..11b76a9 --- /dev/null +++ b/u-boot/0001-rk3399-pinebook-fix-sdcard-boot-from-emmc.patch @@ -0,0 +1,46 @@ +From 2778aa7cb70946c4729ed6ae13dea5bd1cc688dc Mon Sep 17 00:00:00 2001 +From: dhivael +Date: Sat, 11 Jan 2020 15:02:44 +0100 +Subject: [PATCH 1/6] rk3399: pinebook: fix sdcard boot from emmc + +booting from emmc does not set all DT properties required for the sd +slot to function properly. this is a copy of the linux DT configuration +for the slot now. +--- + arch/arm/dts/rk3399-pinebook-pro.dts | 12 +++++++++++- + 1 file changed, 11 insertions(+), 1 deletion(-) + +diff --git a/arch/arm/dts/rk3399-pinebook-pro.dts b/arch/arm/dts/rk3399-pinebook-pro.dts +index 85ce0206d74..1234f715c1e 100644 +--- a/arch/arm/dts/rk3399-pinebook-pro.dts ++++ b/arch/arm/dts/rk3399-pinebook-pro.dts +@@ -65,6 +65,8 @@ + clock-names = "ext_clock"; + pinctrl-names = "default"; + pinctrl-0 = <&wifi_enable_h>; ++ power-off-delay-us = <500000>; ++ post-power-on-delay-ms = <100>; + + /* + * On the module itself this is one of these (depending +@@ -503,8 +505,16 @@ + + &sdmmc { + bus-width = <4>; +- status = "okay"; ++ cap-mmc-highspeed; ++ cap-sd-highspeed; ++ cd-gpios = <&gpio0 RK_PA7 GPIO_ACTIVE_LOW>; ++ disable-wp; ++ sd-uhs-sdr104; + max-frequency = <20000000>; ++ vqmmc-supply = <&vcc_sdio>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_bus4>; ++ status = "okay"; + }; + + &sdhci { +-- +2.23.1 + diff --git a/u-boot/0003-rk3399-light-pinebook-power-and-standby-leds-during-.patch b/u-boot/0003-rk3399-light-pinebook-power-and-standby-leds-during-.patch new file mode 100644 index 0000000..cea16b2 --- /dev/null +++ b/u-boot/0003-rk3399-light-pinebook-power-and-standby-leds-during-.patch @@ -0,0 +1,52 @@ +From 1a01021c9361c4e017cb5b032300f5555c393710 Mon Sep 17 00:00:00 2001 +From: dhivael +Date: Sat, 11 Jan 2020 15:04:46 +0100 +Subject: [PATCH 3/6] rk3399: light pinebook power and standby leds during + early boot + +this is a hack, but it works for now. +--- + arch/arm/mach-rockchip/rk3399/rk3399.c | 12 +++++++++++- + 1 file changed, 11 insertions(+), 1 deletion(-) + +diff --git a/arch/arm/mach-rockchip/rk3399/rk3399.c b/arch/arm/mach-rockchip/rk3399/rk3399.c +index 863024d0710..cf37129d557 100644 +--- a/arch/arm/mach-rockchip/rk3399/rk3399.c ++++ b/arch/arm/mach-rockchip/rk3399/rk3399.c +@@ -15,6 +15,8 @@ + #include + #include + #include ++#include ++#include + + DECLARE_GLOBAL_DATA_PTR; + +@@ -115,8 +117,8 @@ void board_debug_uart_init(void) + 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 ++ struct rockchip_gpio_regs * const gpio = (void *)GPIO0_BASE; + + #if defined(CONFIG_DEBUG_UART_BASE) && (CONFIG_DEBUG_UART_BASE == 0xff180000) + /* Enable early UART0 on the RK3399 */ +@@ -149,6 +151,14 @@ void board_debug_uart_init(void) + spl_gpio_set_pull(&pmugrf->gpio0_p, GPIO(BANK_B, 4), GPIO_PULL_NORMAL); + #endif /* CONFIG_TARGET_CHROMEBOOK_BOB */ + ++ { ++ // set GPIO0_A2/B3 to GPIO_ACTIVE_HIGH ++ // set GPIO0_A2/B3 to OUTPUT ++ int mask = (1UL << RK_PA2) | (1UL << RK_PB3); ++ setbits_le32(&gpio->swport_dr, mask); ++ setbits_le32(&gpio->swport_ddr, mask); ++ } ++ + /* Enable early UART2 channel C on the RK3399 */ + rk_clrsetreg(&grf->gpio4c_iomux, + GRF_GPIO4C3_SEL_MASK, +-- +2.23.1 + diff --git a/u-boot/0004-reduce-pinebook_pro-bootdelay-to-1.patch b/u-boot/0004-reduce-pinebook_pro-bootdelay-to-1.patch new file mode 100644 index 0000000..9582187 --- /dev/null +++ b/u-boot/0004-reduce-pinebook_pro-bootdelay-to-1.patch @@ -0,0 +1,25 @@ +From b3e8d27cca05508cddeda534956f13e88f2428cd Mon Sep 17 00:00:00 2001 +From: dhivael +Date: Sat, 11 Jan 2020 15:12:34 +0100 +Subject: [PATCH 4/6] reduce pinebook_pro bootdelay to 1 + +--- + configs/pinebook_pro-rk3399_defconfig | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/configs/pinebook_pro-rk3399_defconfig b/configs/pinebook_pro-rk3399_defconfig +index 28577256e70..a11a10243c5 100644 +--- a/configs/pinebook_pro-rk3399_defconfig ++++ b/configs/pinebook_pro-rk3399_defconfig +@@ -36,7 +36,7 @@ CONFIG_DEFAULT_DEVICE_TREE="rk3399-pinebook-pro" + CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents" + CONFIG_ROCKCHIP_GPIO=y + CONFIG_SYS_I2C_ROCKCHIP=y +-CONFIG_BOOTDELAY=3 ++CONFIG_BOOTDELAY=1 + CONFIG_LED=y + CONFIG_LED_GPIO=y + CONFIG_MISC=y +-- +2.23.1 + diff --git a/u-boot/0005-PBP-Add-regulator-needed-for-usb.patch b/u-boot/0005-PBP-Add-regulator-needed-for-usb.patch new file mode 100644 index 0000000..9039990 --- /dev/null +++ b/u-boot/0005-PBP-Add-regulator-needed-for-usb.patch @@ -0,0 +1,76 @@ +From fd41e9330cf1635fa3bf4dabdfac42ee1bba963c Mon Sep 17 00:00:00 2001 +From: Emmanuel Vadot +Date: Tue, 31 Dec 2019 22:13:03 +0100 +Subject: [PATCH 5/6] PBP: Add regulator needed for usb + +The schematics indicate that the vcc3v3_s0 voltage is controlled by +the LDO2 of the RK808 but this isn't true. +It's controller by a gpio (named lcdvcc_en). +Remove the name from the RK808 regulator and add a regulator-fixed +controller by this gpio. + +Signed-off-by: Emmanuel Vadot +--- + arch/arm/dts/rk3399-pinebook-pro.dts | 21 +++++++++++++++++++-- + 1 file changed, 19 insertions(+), 2 deletions(-) + +diff --git a/arch/arm/dts/rk3399-pinebook-pro.dts b/arch/arm/dts/rk3399-pinebook-pro.dts +index 1234f715c1e..f334f9e8ef2 100644 +--- a/arch/arm/dts/rk3399-pinebook-pro.dts ++++ b/arch/arm/dts/rk3399-pinebook-pro.dts +@@ -125,6 +125,16 @@ + regulator-always-on; + }; + ++ vcc3v3_s0: vcc3v3-s0-regulator { ++ compatible = "regulator-fixed"; ++ enable-active-high; ++ gpio = <&gpio1 RK_PC6 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&lcdvcc_en>; ++ regulator-name = "vcc3v3_s0"; ++ regulator-always-on; ++ }; ++ + vcc_sys: vcc-sys { + compatible = "regulator-fixed"; + regulator-name = "vcc_sys"; +@@ -347,8 +357,8 @@ + }; + }; + +- vcc3v3_s0: SWITCH_REG2 { +- regulator-name = "vcc3v3_s0"; ++ unused: SWITCH_REG2 { ++ regulator-name = "SWITCH_REG2"; + regulator-always-on; + regulator-boot-on; + regulator-state-mem { +@@ -484,6 +494,11 @@ + host_usb3_drv: host-usb3-drv { + rockchip,pins = <1 RK_PB5 RK_FUNC_GPIO &pcfg_pull_none>; + }; ++ ++ /* Shared between LCD and usb */ ++ lcdvcc_en: lcdvcc-en { ++ rockchip,pins = <1 RK_PC6 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; + }; + }; + +@@ -581,10 +596,12 @@ + }; + + &usb_host1_ehci { ++ phy-supply = <&vcc3v3_s0>; + status = "okay"; + }; + + &usb_host1_ohci { ++ phy-supply = <&vcc3v3_s0>; + status = "okay"; + }; + +-- +2.23.1 + diff --git a/u-boot/default.nix b/u-boot/default.nix index 25693ff..0756dea 100644 --- a/u-boot/default.nix +++ b/u-boot/default.nix @@ -38,6 +38,15 @@ in (pw "1194524" "071rval4r683d1wxh75nbf22qs554spq8rk0499z6zac0x8q1qvc") (pw "1194525" "0biiwimjp25abxqazqbpxx2wh90zgy3k786h484x9wsdvnv4yjl6") (pw "1203678" "0l3l88cc9xkxkraql82pfgpx6nqn4dj7cvfaagh5pzfwkxyw0n3p") + + # Patches from this fork: + # https://git.eno.space/pbp-uboot.git + ./0001-rk3399-pinebook-fix-sdcard-boot-from-emmc.patch + ./0003-rk3399-light-pinebook-power-and-standby-leds-during-.patch + ./0004-reduce-pinebook_pro-bootdelay-to-1.patch + ./0005-PBP-Add-regulator-needed-for-usb.patch + + # My own patch ./0001-HACK-Add-changing-LEDs-signal-at-boot-on-pinebook-pr.patch ]; })