diff --git a/dev-embedded/u-boot-pinephone-pro/Manifest b/dev-embedded/u-boot-pinephone-pro/Manifest index 864cd47..defbd1b 100644 --- a/dev-embedded/u-boot-pinephone-pro/Manifest +++ b/dev-embedded/u-boot-pinephone-pro/Manifest @@ -1,2 +1,2 @@ DIST trusted-firmware-a-2.6.tar.gz 6007293 BLAKE2B 860efad37acab15478b725692ebd3ae88205b0048869cc5f3381a465646f789f929480d04552d7b26b31672e636651a00378c41a77f275acaff73ee6a3eedbab SHA512 bfd7df42abd51907264359463c5ab483fc82241fce9344df51dd89e6a65fc8a5c5b3c1481830c60dede8356326bd25f66516d623fda5bc2a9913000b8865ab37 -DIST u-boot-2021.01_rc3.tar.gz 20895074 BLAKE2B 9841f9b6b7afdf4df24e085a0addcdd78230d0c1ec405b9d4e6c798cc085b77e60cf68d811f209f5214b742afeaa43035bc664844725b5be6261ed861d917bce SHA512 9b9ff1536770397d4a95b903d18724ef46c3d142d8bc79aa1a9afe830bcfb28614035bf610a4cc388e0d0935d2b3bbd53cf9aa4b66873d897c3da5baa6c1b717 +DIST u-boot-2022.01.tar.gz 22344932 BLAKE2B c3099f460496c9bc4af5f8b10c932e6a578fa666706513bfd611ce9821f0f1451f61134e3323802f1d5e217d2a62e330783380b03594fa6d2245b057944e7fdb SHA512 00e9c7c73f74f1147086c5cc72089e9143abec9f259413c9151967b10a1ef80578075b7cd92cf90c5f33e74fd878f646c56ec15124e81f9502138ff7f3380349 diff --git a/dev-embedded/u-boot-pinephone-pro/files/0001-PPP.patch b/dev-embedded/u-boot-pinephone-pro/files/0001-PPP.patch deleted file mode 100644 index f2326a6..0000000 --- a/dev-embedded/u-boot-pinephone-pro/files/0001-PPP.patch +++ /dev/null @@ -1,241 +0,0 @@ -From c4d3ac73a3f19d2372e3d35e833665b2ee1f11fa Mon Sep 17 00:00:00 2001 -From: Martijn Braam -Date: Sat, 12 Dec 2020 13:31:03 +0100 -Subject: [PATCH 1/8] PPP - ---- - arch/arm/mach-rockchip/rk3399/Kconfig | 7 ++ - board/pine64/pinephone-pro-rk3399/Kconfig | 15 +++ - board/pine64/pinephone-pro-rk3399/MAINTAINERS | 8 ++ - board/pine64/pinephone-pro-rk3399/Makefile | 1 + - .../pinephone-pro-rk3399.c | 56 +++++++++++ - configs/pinephone-pro-rk3399_defconfig | 92 +++++++++++++++++++ - 6 files changed, 179 insertions(+) - create mode 100644 board/pine64/pinephone-pro-rk3399/Kconfig - create mode 100644 board/pine64/pinephone-pro-rk3399/MAINTAINERS - create mode 100644 board/pine64/pinephone-pro-rk3399/Makefile - create mode 100644 board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c - create mode 100644 configs/pinephone-pro-rk3399_defconfig - -diff --git a/arch/arm/mach-rockchip/rk3399/Kconfig b/arch/arm/mach-rockchip/rk3399/Kconfig -index 17628f9171..35b1125906 100644 ---- a/arch/arm/mach-rockchip/rk3399/Kconfig -+++ b/arch/arm/mach-rockchip/rk3399/Kconfig -@@ -28,6 +28,13 @@ config TARGET_PINEBOOK_PRO_RK3399 - with 4Gb RAM, onboard eMMC, USB-C, a USB3 and USB2 port, - 1920*1080 screen and all the usual laptop features. - -+config TARGET_PINEPHONE_PRO_RK3399 -+ bool "PinePhone Pro" -+ help -+ PinePhone Pro is a phone based on the Rockchip rk3399 SoC -+ with 4Gb RAM, onboard eMMC, USB-C, a headphone jack, -+ 720x1440 screen and an external Quectel USB modem. -+ - config TARGET_PUMA_RK3399 - bool "Theobroma Systems RK3399-Q7 (Puma)" - help -diff --git a/board/pine64/pinephone-pro-rk3399/Kconfig b/board/pine64/pinephone-pro-rk3399/Kconfig -new file mode 100644 -index 0000000000..13d6465ae6 ---- /dev/null -+++ b/board/pine64/pinephone-pro-rk3399/Kconfig -@@ -0,0 +1,15 @@ -+if TARGET_PINEPHONE_PRO_RK3399 -+ -+config SYS_BOARD -+ default "pinephone-pro-rk3399" -+ -+config SYS_VENDOR -+ default "pine64" -+ -+config SYS_CONFIG_NAME -+ default "pinephone-pro-rk3399" -+ -+config BOARD_SPECIFIC_OPTIONS -+ def_bool y -+ -+endif -diff --git a/board/pine64/pinephone-pro-rk3399/MAINTAINERS b/board/pine64/pinephone-pro-rk3399/MAINTAINERS -new file mode 100644 -index 0000000000..227c1c0bea ---- /dev/null -+++ b/board/pine64/pinephone-pro-rk3399/MAINTAINERS -@@ -0,0 +1,8 @@ -+PINEBOOK_PRO -+M: Peter Robinson -+S: Maintained -+F: board/pine64/rk3399-pinebook-pro/ -+F: include/configs/rk3399-pinebook-pro.h -+F: arch/arm/dts/rk3399-pinebook-pro.dts -+F: arch/arm/dts/rk3399-pinebook-pro-u-boot.dtsi -+F: configs/pinebook-pro-rk3399_defconfig -diff --git a/board/pine64/pinephone-pro-rk3399/Makefile b/board/pine64/pinephone-pro-rk3399/Makefile -new file mode 100644 -index 0000000000..8d9203053e ---- /dev/null -+++ b/board/pine64/pinephone-pro-rk3399/Makefile -@@ -0,0 +1 @@ -+obj-y += pinephone-pro-rk3399.o -diff --git a/board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c b/board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c -new file mode 100644 -index 0000000000..d79084614f ---- /dev/null -+++ b/board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c -@@ -0,0 +1,56 @@ -+// SPDX-License-Identifier: GPL-2.0+ -+/* -+ * (C) Copyright 2019 Vasily Khoruzhick -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#define GRF_IO_VSEL_BT565_SHIFT 0 -+#define PMUGRF_CON0_VSEL_SHIFT 8 -+ -+#ifdef CONFIG_MISC_INIT_R -+static void setup_iodomain(void) -+{ -+ struct rk3399_grf_regs *grf = -+ syscon_get_first_range(ROCKCHIP_SYSCON_GRF); -+ struct rk3399_pmugrf_regs *pmugrf = -+ syscon_get_first_range(ROCKCHIP_SYSCON_PMUGRF); -+ -+ /* BT565 is in 1.8v domain */ -+ rk_setreg(&grf->io_vsel, 1 << GRF_IO_VSEL_BT565_SHIFT); -+ -+ /* Set GPIO1 1.8v/3.0v source select to PMU1830_VOL */ -+ rk_setreg(&pmugrf->soc_con0, 1 << PMUGRF_CON0_VSEL_SHIFT); -+} -+ -+int misc_init_r(void) -+{ -+ const u32 cpuid_offset = 0x7; -+ const u32 cpuid_length = 0x10; -+ u8 cpuid[cpuid_length]; -+ int ret; -+ -+ setup_iodomain(); -+ -+ ret = rockchip_cpuid_from_efuse(cpuid_offset, cpuid_length, cpuid); -+ if (ret) -+ return ret; -+ -+ ret = rockchip_cpuid_set(cpuid, cpuid_length); -+ if (ret) -+ return ret; -+ -+ ret = rockchip_setup_macaddr(); -+ -+ return ret; -+} -+ -+#endif -diff --git a/configs/pinephone-pro-rk3399_defconfig b/configs/pinephone-pro-rk3399_defconfig -new file mode 100644 -index 0000000000..320ce65ffb ---- /dev/null -+++ b/configs/pinephone-pro-rk3399_defconfig -@@ -0,0 +1,92 @@ -+CONFIG_ARM=y -+CONFIG_ARCH_ROCKCHIP=y -+CONFIG_SYS_TEXT_BASE=0x00200000 -+CONFIG_NR_DRAM_BANKS=1 -+CONFIG_ENV_SIZE=0x8000 -+CONFIG_ROCKCHIP_RK3399=y -+CONFIG_TARGET_PINEPHONE_PRO_RK3399=y -+CONFIG_DEBUG_UART_BASE=0xFF1A0000 -+CONFIG_DEBUG_UART_CLOCK=24000000 -+CONFIG_SPL_SPI_FLASH_SUPPORT=y -+CONFIG_SPL_SPI_SUPPORT=y -+CONFIG_DEFAULT_DEVICE_TREE="rk3399-pinephone-pro" -+CONFIG_DEBUG_UART=y -+CONFIG_BOOTDELAY=3 -+CONFIG_USE_PREBOOT=y -+CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-pinephone-pro.dtb" -+CONFIG_DISPLAY_BOARDINFO_LATE=y -+CONFIG_MISC_INIT_R=y -+# CONFIG_SPL_RAW_IMAGE_SUPPORT is not set -+CONFIG_SPL_STACK_R=y -+CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x10000 -+CONFIG_SPL_MTD_SUPPORT=y -+CONFIG_SPL_SPI_LOAD=y -+CONFIG_TPL=y -+CONFIG_CMD_BOOTZ=y -+CONFIG_CMD_GPIO=y -+CONFIG_CMD_GPT=y -+CONFIG_CMD_I2C=y -+CONFIG_CMD_MMC=y -+CONFIG_CMD_PCI=y -+CONFIG_CMD_USB=y -+# CONFIG_CMD_SETEXPR is not set -+CONFIG_CMD_TIME=y -+CONFIG_CMD_PMIC=y -+CONFIG_CMD_REGULATOR=y -+CONFIG_SPL_OF_CONTROL=y -+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_SPI_FLASH=y -+CONFIG_SYS_RELOC_GD_ENV_ADDR=y -+CONFIG_ROCKCHIP_GPIO=y -+CONFIG_SYS_I2C_ROCKCHIP=y -+CONFIG_DM_KEYBOARD=y -+CONFIG_LED=y -+CONFIG_LED_GPIO=y -+CONFIG_MISC=y -+CONFIG_ROCKCHIP_EFUSE=y -+CONFIG_MMC_DW=y -+CONFIG_MMC_DW_ROCKCHIP=y -+CONFIG_MMC_SDHCI=y -+CONFIG_MMC_SDHCI_SDMA=y -+CONFIG_MMC_SDHCI_ROCKCHIP=y -+CONFIG_SF_DEFAULT_SPEED=20000000 -+CONFIG_SPI_FLASH_GIGADEVICE=y -+CONFIG_SPI_FLASH_WINBOND=y -+CONFIG_DM_ETH=y -+CONFIG_NVME=y -+CONFIG_PCI=y -+CONFIG_PHY_ROCKCHIP_INNO_USB2=y -+CONFIG_PHY_ROCKCHIP_TYPEC=y -+CONFIG_DM_PMIC_FAN53555=y -+CONFIG_PMIC_RK8XX=y -+CONFIG_REGULATOR_PWM=y -+CONFIG_REGULATOR_RK8XX=y -+CONFIG_PWM_ROCKCHIP=y -+CONFIG_RAM_RK3399_LPDDR4=y -+CONFIG_DM_RESET=y -+CONFIG_DM_RNG=y -+CONFIG_RNG_ROCKCHIP=y -+CONFIG_BAUDRATE=1500000 -+CONFIG_DEBUG_UART_SHIFT=2 -+CONFIG_ROCKCHIP_SPI=y -+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_OHCI_HCD=y -+CONFIG_USB_OHCI_GENERIC=y -+CONFIG_USB_DWC3=y -+CONFIG_USB_DWC3_GENERIC=y -+CONFIG_USB_KEYBOARD=y -+CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE=y -+CONFIG_USB_HOST_ETHER=y -+CONFIG_USB_ETHER_ASIX=y -+CONFIG_USB_ETHER_RTL8152=y -+CONFIG_DM_VIDEO=y -+CONFIG_DISPLAY=y -+CONFIG_VIDEO_ROCKCHIP=y -+CONFIG_DISPLAY_ROCKCHIP_EDP=y -+CONFIG_SPL_TINY_MEMSET=y -+CONFIG_ERRNO_STR=y --- -2.33.0 diff --git a/dev-embedded/u-boot-pinephone-pro/files/0002-Add-ppp-dt.patch b/dev-embedded/u-boot-pinephone-pro/files/0001-rockchip-Add-initial-support-for-the-PinePhone-Pro.patch similarity index 55% rename from dev-embedded/u-boot-pinephone-pro/files/0002-Add-ppp-dt.patch rename to dev-embedded/u-boot-pinephone-pro/files/0001-rockchip-Add-initial-support-for-the-PinePhone-Pro.patch index 997d0aa..3e48d2e 100644 --- a/dev-embedded/u-boot-pinephone-pro/files/0002-Add-ppp-dt.patch +++ b/dev-embedded/u-boot-pinephone-pro/files/0001-rockchip-Add-initial-support-for-the-PinePhone-Pro.patch @@ -1,24 +1,65 @@ -From 98b43f8c80a3ce16363f6a386b23bda10a738ffa Mon Sep 17 00:00:00 2001 +From eea38c80ff858222e15ba4d79a0cb811adbdfc23 Mon Sep 17 00:00:00 2001 From: Martijn Braam -Date: Sun, 13 Dec 2020 19:21:12 +0100 -Subject: [PATCH 2/8] Add ppp dt +Date: Sat, 12 Dec 2020 13:31:03 +0100 +Subject: [PATCH] rockchip: Add initial support for the PinePhone Pro +This is a new device by PINE64 that's very similar to the Pinebook Pro +that's already supported. + +Specification: +- Rockchip RK3399 +- 4GB Dual-Channel LPDDR4 +- 128GB eMMC +- mSD card slot +- AP6255 for 802.11ac WiFi and Bluetooth +- 6 inch 720*1440 DSI display +- Quectel EG25g usb modem +- Type-C port with alt-mode display (DP 1.2) and PD charging. + +Signed-off-by: Martijn Braam --- - arch/arm/dts/rk3399-pinephone-pro-u-boot.dtsi | 43 ++ - arch/arm/dts/rk3399-pinephone-pro.dts | 520 +++++++++++++++++++ - 2 files changed, 563 insertions(+) + arch/arm/dts/Makefile | 1 + + arch/arm/dts/rk3399-pinephone-pro-u-boot.dtsi | 44 ++ + arch/arm/dts/rk3399-pinephone-pro.dts | 520 ++++++++++++++++++ + arch/arm/mach-rockchip/rk3399/Kconfig | 8 + + board/pine64/pinephone-pro-rk3399/Kconfig | 15 + + board/pine64/pinephone-pro-rk3399/MAINTAINERS | 8 + + board/pine64/pinephone-pro-rk3399/Makefile | 1 + + .../pinephone-pro-rk3399.c | 57 ++ + configs/pinephone-pro-rk3399_defconfig | 92 ++++ + include/configs/pinephone-pro-rk3399.h | 23 + + 10 files changed, 769 insertions(+) create mode 100644 arch/arm/dts/rk3399-pinephone-pro-u-boot.dtsi create mode 100644 arch/arm/dts/rk3399-pinephone-pro.dts + create mode 100644 board/pine64/pinephone-pro-rk3399/Kconfig + create mode 100644 board/pine64/pinephone-pro-rk3399/MAINTAINERS + create mode 100644 board/pine64/pinephone-pro-rk3399/Makefile + create mode 100644 board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c + create mode 100644 configs/pinephone-pro-rk3399_defconfig + create mode 100644 include/configs/pinephone-pro-rk3399.h +diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile +index aeaec713..6f123425 100644 +--- a/arch/arm/dts/Makefile ++++ b/arch/arm/dts/Makefile +@@ -145,6 +145,7 @@ dtb-$(CONFIG_ROCKCHIP_RK3399) += \ + rk3399-nanopi-r4s.dtb \ + rk3399-orangepi.dtb \ + rk3399-pinebook-pro.dtb \ ++ rk3399-pinephone-pro.dtb \ + rk3399-puma-haikou.dtb \ + rk3399-roc-pc.dtb \ + rk3399-roc-pc-mezzanine.dtb \ diff --git a/arch/arm/dts/rk3399-pinephone-pro-u-boot.dtsi b/arch/arm/dts/rk3399-pinephone-pro-u-boot.dtsi new file mode 100644 -index 0000000000..7a058477db +index 00000000..9d44db59 --- /dev/null +++ b/arch/arm/dts/rk3399-pinephone-pro-u-boot.dtsi -@@ -0,0 +1,43 @@ +@@ -0,0 +1,44 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2019 Peter Robinson ++ * Copyright (C) 2021 Martijn Braam + */ + +#include "rk3399-u-boot.dtsi" @@ -30,7 +71,7 @@ index 0000000000..7a058477db + }; + + chosen { -+ u-boot,spl-boot-order = "same-as-spl", &sdhci, &spiflash, &sdmmc; ++ u-boot,spl-boot-order = "same-as-spl", &sdhci, &sdmmc; + }; + + config { @@ -61,13 +102,13 @@ index 0000000000..7a058477db +}; diff --git a/arch/arm/dts/rk3399-pinephone-pro.dts b/arch/arm/dts/rk3399-pinephone-pro.dts new file mode 100644 -index 0000000000..78d4760c8e +index 00000000..3fe1845c --- /dev/null +++ b/arch/arm/dts/rk3399-pinephone-pro.dts @@ -0,0 +1,520 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* -+ * Copyright (c) 2020 Martijn Braam ++ * Copyright (c) 2021 Martijn Braam + */ + +/dts-v1/; @@ -75,8 +116,8 @@ index 0000000000..78d4760c8e +#include "rk3399-opp.dtsi" + +/ { -+ model = "Pine64 PinePhonePro"; -+ compatible = "pine64,pinephonepro", "rockchip,rk3399"; ++ model = "Pine64 PinePhone Pro"; ++ compatible = "pine64,pinephone-pro", "rockchip,rk3399"; + + chosen { + stdout-path = "serial2:1500000n8"; @@ -585,5 +626,264 @@ index 0000000000..78d4760c8e +&vopl_mmu { + status = "okay"; +}; +diff --git a/arch/arm/mach-rockchip/rk3399/Kconfig b/arch/arm/mach-rockchip/rk3399/Kconfig +index 17628f91..3ba603ca 100644 +--- a/arch/arm/mach-rockchip/rk3399/Kconfig ++++ b/arch/arm/mach-rockchip/rk3399/Kconfig +@@ -28,6 +28,13 @@ config TARGET_PINEBOOK_PRO_RK3399 + with 4Gb RAM, onboard eMMC, USB-C, a USB3 and USB2 port, + 1920*1080 screen and all the usual laptop features. + ++config TARGET_PINEPHONE_PRO_RK3399 ++ bool "PinePhone Pro" ++ help ++ PinePhone Pro is a phone based on the Rockchip rk3399 SoC ++ with 4Gb RAM, onboard eMMC, USB-C, a headphone jack, ++ 720x1440 screen and an external Quectel USB modem. ++ + config TARGET_PUMA_RK3399 + bool "Theobroma Systems RK3399-Q7 (Puma)" + help +@@ -154,6 +161,7 @@ endif # BOOTCOUNT_LIMIT + source "board/firefly/roc-pc-rk3399/Kconfig" + source "board/google/gru/Kconfig" + source "board/pine64/pinebook-pro-rk3399/Kconfig" ++source "board/pine64/pinephone-pro-rk3399/Kconfig" + source "board/pine64/rockpro64_rk3399/Kconfig" + source "board/rockchip/evb_rk3399/Kconfig" + source "board/theobroma-systems/puma_rk3399/Kconfig" +diff --git a/board/pine64/pinephone-pro-rk3399/Kconfig b/board/pine64/pinephone-pro-rk3399/Kconfig +new file mode 100644 +index 00000000..13d6465a +--- /dev/null ++++ b/board/pine64/pinephone-pro-rk3399/Kconfig +@@ -0,0 +1,15 @@ ++if TARGET_PINEPHONE_PRO_RK3399 ++ ++config SYS_BOARD ++ default "pinephone-pro-rk3399" ++ ++config SYS_VENDOR ++ default "pine64" ++ ++config SYS_CONFIG_NAME ++ default "pinephone-pro-rk3399" ++ ++config BOARD_SPECIFIC_OPTIONS ++ def_bool y ++ ++endif +diff --git a/board/pine64/pinephone-pro-rk3399/MAINTAINERS b/board/pine64/pinephone-pro-rk3399/MAINTAINERS +new file mode 100644 +index 00000000..9ca4fc4c +--- /dev/null ++++ b/board/pine64/pinephone-pro-rk3399/MAINTAINERS +@@ -0,0 +1,8 @@ ++PINEPHONE_PRO ++M: Martijn Braam ++S: Maintained ++F: board/pine64/rk3399-pinephone-pro/ ++F: include/configs/rk3399-pinephone-pro.h ++F: arch/arm/dts/rk3399-pinephone-pro.dts ++F: arch/arm/dts/rk3399-pinephone-pro-u-boot.dtsi ++F: configs/pinephone-pro-rk3399_defconfig +diff --git a/board/pine64/pinephone-pro-rk3399/Makefile b/board/pine64/pinephone-pro-rk3399/Makefile +new file mode 100644 +index 00000000..8d920305 +--- /dev/null ++++ b/board/pine64/pinephone-pro-rk3399/Makefile +@@ -0,0 +1 @@ ++obj-y += pinephone-pro-rk3399.o +diff --git a/board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c b/board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c +new file mode 100644 +index 00000000..8efeb6ea +--- /dev/null ++++ b/board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c +@@ -0,0 +1,57 @@ ++// SPDX-License-Identifier: GPL-2.0+ ++/* ++ * (C) Copyright 2019 Vasily Khoruzhick ++ * (C) Copyright 2021 Martijn Braam ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define GRF_IO_VSEL_BT565_SHIFT 0 ++#define PMUGRF_CON0_VSEL_SHIFT 8 ++ ++#ifdef CONFIG_MISC_INIT_R ++static void setup_iodomain(void) ++{ ++ struct rk3399_grf_regs *grf = ++ syscon_get_first_range(ROCKCHIP_SYSCON_GRF); ++ struct rk3399_pmugrf_regs *pmugrf = ++ syscon_get_first_range(ROCKCHIP_SYSCON_PMUGRF); ++ ++ /* BT565 is in 1.8v domain */ ++ rk_setreg(&grf->io_vsel, 1 << GRF_IO_VSEL_BT565_SHIFT); ++ ++ /* Set GPIO1 1.8v/3.0v source select to PMU1830_VOL */ ++ rk_setreg(&pmugrf->soc_con0, 1 << PMUGRF_CON0_VSEL_SHIFT); ++} ++ ++int misc_init_r(void) ++{ ++ const u32 cpuid_offset = 0x7; ++ const u32 cpuid_length = 0x10; ++ u8 cpuid[cpuid_length]; ++ int ret; ++ ++ setup_iodomain(); ++ ++ ret = rockchip_cpuid_from_efuse(cpuid_offset, cpuid_length, cpuid); ++ if (ret) ++ return ret; ++ ++ ret = rockchip_cpuid_set(cpuid, cpuid_length); ++ if (ret) ++ return ret; ++ ++ ret = rockchip_setup_macaddr(); ++ ++ return ret; ++} ++ ++#endif +diff --git a/configs/pinephone-pro-rk3399_defconfig b/configs/pinephone-pro-rk3399_defconfig +new file mode 100644 +index 00000000..2cf80f7d +--- /dev/null ++++ b/configs/pinephone-pro-rk3399_defconfig +@@ -0,0 +1,92 @@ ++CONFIG_ARM=y ++CONFIG_SKIP_LOWLEVEL_INIT=y ++CONFIG_ARCH_ROCKCHIP=y ++CONFIG_SYS_TEXT_BASE=0x00200000 ++CONFIG_NR_DRAM_BANKS=1 ++CONFIG_ENV_SIZE=0x8000 ++CONFIG_ROCKCHIP_RK3399=y ++CONFIG_TARGET_PINEPHONE_PRO_RK3399=y ++CONFIG_DEBUG_UART_BASE=0xFF1A0000 ++CONFIG_DEBUG_UART_CLOCK=24000000 ++CONFIG_SPL_SPI_FLASH_SUPPORT=y ++CONFIG_SPL_SPI_SUPPORT=y ++CONFIG_DEFAULT_DEVICE_TREE="rk3399-pinephone-pro" ++CONFIG_DEBUG_UART=y ++CONFIG_SYS_LOAD_ADDR=0x800800 ++CONFIG_BOOTDELAY=3 ++CONFIG_USE_PREBOOT=y ++CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-pinephone-pro.dtb" ++CONFIG_DISPLAY_BOARDINFO_LATE=y ++CONFIG_MISC_INIT_R=y ++# CONFIG_SPL_RAW_IMAGE_SUPPORT is not set ++CONFIG_SPL_STACK_R=y ++CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x10000 ++CONFIG_SPL_MTD_SUPPORT=y ++CONFIG_SPL_SPI_LOAD=y ++CONFIG_TPL=y ++CONFIG_CMD_BOOTZ=y ++CONFIG_CMD_GPIO=y ++CONFIG_CMD_GPT=y ++CONFIG_CMD_I2C=y ++CONFIG_CMD_MMC=y ++CONFIG_CMD_PCI=y ++CONFIG_CMD_USB=y ++# CONFIG_CMD_SETEXPR is not set ++CONFIG_CMD_TIME=y ++CONFIG_CMD_PMIC=y ++CONFIG_CMD_REGULATOR=y ++CONFIG_SPL_OF_CONTROL=y ++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_SPI_FLASH=y ++CONFIG_SYS_RELOC_GD_ENV_ADDR=y ++CONFIG_ROCKCHIP_GPIO=y ++CONFIG_SYS_I2C_ROCKCHIP=y ++CONFIG_DM_KEYBOARD=y ++CONFIG_LED=y ++CONFIG_LED_GPIO=y ++CONFIG_MISC=y ++CONFIG_ROCKCHIP_EFUSE=y ++CONFIG_MMC_DW=y ++CONFIG_MMC_DW_ROCKCHIP=y ++CONFIG_MMC_SDHCI=y ++CONFIG_MMC_SDHCI_SDMA=y ++CONFIG_MMC_SDHCI_ROCKCHIP=y ++CONFIG_SF_DEFAULT_SPEED=20000000 ++CONFIG_SPI_FLASH_GIGADEVICE=y ++CONFIG_SPI_FLASH_WINBOND=y ++CONFIG_DM_ETH=y ++CONFIG_PHY_ROCKCHIP_INNO_USB2=y ++CONFIG_PHY_ROCKCHIP_TYPEC=y ++CONFIG_DM_PMIC_FAN53555=y ++CONFIG_PMIC_RK8XX=y ++CONFIG_REGULATOR_PWM=y ++CONFIG_REGULATOR_RK8XX=y ++CONFIG_PWM_ROCKCHIP=y ++CONFIG_RAM_RK3399_LPDDR4=y ++CONFIG_DM_RESET=y ++CONFIG_DM_RNG=y ++CONFIG_RNG_ROCKCHIP=y ++CONFIG_BAUDRATE=1500000 ++CONFIG_DEBUG_UART_SHIFT=2 ++CONFIG_ROCKCHIP_SPI=y ++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_OHCI_HCD=y ++CONFIG_USB_OHCI_GENERIC=y ++CONFIG_USB_DWC3=y ++CONFIG_USB_DWC3_GENERIC=y ++CONFIG_USB_KEYBOARD=y ++CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE=y ++CONFIG_USB_HOST_ETHER=y ++CONFIG_USB_ETHER_ASIX=y ++CONFIG_USB_ETHER_RTL8152=y ++CONFIG_DM_VIDEO=y ++CONFIG_DISPLAY=y ++CONFIG_VIDEO_ROCKCHIP=y ++CONFIG_DISPLAY_ROCKCHIP_EDP=y ++CONFIG_SPL_TINY_MEMSET=y ++CONFIG_ERRNO_STR=y +diff --git a/include/configs/pinephone-pro-rk3399.h b/include/configs/pinephone-pro-rk3399.h +new file mode 100644 +index 00000000..fefa793f +--- /dev/null ++++ b/include/configs/pinephone-pro-rk3399.h +@@ -0,0 +1,23 @@ ++/* SPDX-License-Identifier: GPL-2.0+ */ ++/* ++ * Copyright (C) 2016 Rockchip Electronics Co., Ltd ++ * Copyright (C) 2020 Peter Robinson ++ * Copyright (C) 2021 Martijn Braam ++ */ ++ ++#ifndef __PINEPHONE_PRO_RK3399_H ++#define __PINEPHONE_PRO_RK3399_H ++ ++#define ROCKCHIP_DEVICE_SETTINGS \ ++ "stdin=serial,usbkbd\0" \ ++ "stdout=serial,vidconsole\0" \ ++ "stderr=serial,vidconsole\0" ++ ++#include ++ ++#define SDRAM_BANK_SIZE (2UL << 30) ++ ++#define CONFIG_USB_OHCI_NEW ++#define CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS 2 ++ ++#endif -- -2.33.0 +2.34.1 + diff --git a/dev-embedded/u-boot-pinephone-pro/files/0009-Correct-boot-order-to-be-USB-SD-eMMC.patch b/dev-embedded/u-boot-pinephone-pro/files/0002-Correct-boot-order-to-be-USB-SD-eMMC.patch similarity index 100% rename from dev-embedded/u-boot-pinephone-pro/files/0009-Correct-boot-order-to-be-USB-SD-eMMC.patch rename to dev-embedded/u-boot-pinephone-pro/files/0002-Correct-boot-order-to-be-USB-SD-eMMC.patch diff --git a/dev-embedded/u-boot-pinephone-pro/files/0003-Config-changes.patch b/dev-embedded/u-boot-pinephone-pro/files/0003-Config-changes.patch deleted file mode 100644 index da45a05..0000000 --- a/dev-embedded/u-boot-pinephone-pro/files/0003-Config-changes.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 6e64cdb39e4452315cf9a4d1e9e89691403c3089 Mon Sep 17 00:00:00 2001 -From: Martijn Braam -Date: Sun, 13 Dec 2020 19:36:14 +0100 -Subject: [PATCH 3/8] Config changes - ---- - configs/pinephone-pro-rk3399_defconfig | 2 -- - 1 file changed, 2 deletions(-) - -diff --git a/configs/pinephone-pro-rk3399_defconfig b/configs/pinephone-pro-rk3399_defconfig -index 320ce65ffb..1c2e7f278d 100644 ---- a/configs/pinephone-pro-rk3399_defconfig -+++ b/configs/pinephone-pro-rk3399_defconfig -@@ -53,8 +53,6 @@ CONFIG_SF_DEFAULT_SPEED=20000000 - CONFIG_SPI_FLASH_GIGADEVICE=y - CONFIG_SPI_FLASH_WINBOND=y - CONFIG_DM_ETH=y --CONFIG_NVME=y --CONFIG_PCI=y - CONFIG_PHY_ROCKCHIP_INNO_USB2=y - CONFIG_PHY_ROCKCHIP_TYPEC=y - CONFIG_DM_PMIC_FAN53555=y --- -2.33.0 - diff --git a/dev-embedded/u-boot-pinephone-pro/files/0003-Configure-USB-power-settings-for-PinePhone-Pro.patch b/dev-embedded/u-boot-pinephone-pro/files/0003-Configure-USB-power-settings-for-PinePhone-Pro.patch new file mode 100644 index 0000000..d2eb998 --- /dev/null +++ b/dev-embedded/u-boot-pinephone-pro/files/0003-Configure-USB-power-settings-for-PinePhone-Pro.patch @@ -0,0 +1,228 @@ +From 8ee2257dda6bed2f1ae117e614637036003785d4 Mon Sep 17 00:00:00 2001 +From: Dragan Simic +Date: Thu, 30 Dec 2021 00:08:51 +0100 +Subject: [PATCH] Configure USB power settings for PinePhone Pro + +--- + arch/arm/mach-rockchip/rk3399/rk3399.c | 5 ++ + .../pinephone-pro-rk3399.c | 58 ++++++++++++++++--- + configs/pinephone-pro-rk3399_defconfig | 6 ++ + drivers/power/regulator/rk8xx.c | 21 ++++--- + 4 files changed, 72 insertions(+), 18 deletions(-) + +diff --git a/arch/arm/mach-rockchip/rk3399/rk3399.c b/arch/arm/mach-rockchip/rk3399/rk3399.c +index d40969c8..644e4ab2 100644 +--- a/arch/arm/mach-rockchip/rk3399/rk3399.c ++++ b/arch/arm/mach-rockchip/rk3399/rk3399.c +@@ -248,9 +248,14 @@ void __weak led_setup(void) + { + } + ++void __weak power_setup(void) ++{ ++} ++ + void spl_board_init(void) + { + led_setup(); ++ power_setup(); + + #if defined(SPL_GPIO) + struct rockchip_cru *cru = rockchip_get_cru(); +diff --git a/board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c b/board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c +index 8efeb6ea..88583e31 100644 +--- a/board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c ++++ b/board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c +@@ -2,8 +2,14 @@ + /* + * (C) Copyright 2019 Vasily Khoruzhick + * (C) Copyright 2021 Martijn Braam ++ * (C) Copyright 2021 Dragan Simic + */ + ++/* ++ * TODO: Disable debugging ++ */ ++#define DEBUG ++ + #include + #include + #include +@@ -13,6 +19,8 @@ + #include + #include + #include ++#include ++#include + + #define GRF_IO_VSEL_BT565_SHIFT 0 + #define PMUGRF_CON0_VSEL_SHIFT 8 +@@ -20,15 +28,13 @@ + #ifdef CONFIG_MISC_INIT_R + static void setup_iodomain(void) + { +- struct rk3399_grf_regs *grf = +- syscon_get_first_range(ROCKCHIP_SYSCON_GRF); +- struct rk3399_pmugrf_regs *pmugrf = +- syscon_get_first_range(ROCKCHIP_SYSCON_PMUGRF); ++ struct rk3399_grf_regs *grf = syscon_get_first_range(ROCKCHIP_SYSCON_GRF); ++ struct rk3399_pmugrf_regs *pmugrf = syscon_get_first_range(ROCKCHIP_SYSCON_PMUGRF); + +- /* BT565 is in 1.8v domain */ ++ /* BT565 is in 1.8 V domain */ + rk_setreg(&grf->io_vsel, 1 << GRF_IO_VSEL_BT565_SHIFT); + +- /* Set GPIO1 1.8v/3.0v source select to PMU1830_VOL */ ++ /* Set GPIO1 1.8/3.0 V source select to PMU1830_VOL */ + rk_setreg(&pmugrf->soc_con0, 1 << PMUGRF_CON0_VSEL_SHIFT); + } + +@@ -53,5 +59,43 @@ int misc_init_r(void) + + return ret; + } ++#endif /* CONFIG_MISC_INIT_R */ + +-#endif ++/* ++ * TODO: Change CONFIG_SPL_POWER_SUPPORT to CONFIG_SPL_POWER, to match newer U-Boot versions. ++ * The same applies to CONFIG_SPL_I2C_SUPPORT. ++ */ ++ ++#if defined(CONFIG_SPL_BUILD) && \ ++ CONFIG_IS_ENABLED(POWER_SUPPORT) && !CONFIG_IS_ENABLED(OF_PLATDATA) ++static int setup_usb_power(void) ++{ ++ struct udevice *pmic; ++ int ret; ++ ++ ret = uclass_first_device_err(UCLASS_PMIC, &pmic); ++ if (ret) ++ return ret; ++ ++ /* set USB current limit to 2.5 A */ ++ ret = rk818_spl_configure_usb_input_current(pmic, 2500); ++ if (ret) ++ return ret; ++ ++ /* set USB low voltage threshold to 3.26 V */ ++ ret = rk818_spl_configure_usb_chrg_shutdown(pmic, 3260000); ++ if (ret) ++ return ret; ++ ++ return 0; ++} ++ ++void power_setup(void) ++{ ++ int ret; ++ ++ ret = setup_usb_power(); ++ if (ret) ++ debug("Failed to configure USB power settings: %d\n", ret); ++} ++#endif /* CONFIG_SPL_BUILD && POWER_SUPPORT && !OF_PLATDATA */ +diff --git a/configs/pinephone-pro-rk3399_defconfig b/configs/pinephone-pro-rk3399_defconfig +index 2cf80f7d..b7ca9317 100644 +--- a/configs/pinephone-pro-rk3399_defconfig ++++ b/configs/pinephone-pro-rk3399_defconfig +@@ -23,6 +23,11 @@ CONFIG_SPL_STACK_R=y + CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x10000 + CONFIG_SPL_MTD_SUPPORT=y + CONFIG_SPL_SPI_LOAD=y ++CONFIG_SPL_I2C_SUPPORT=y ++CONFIG_SPL_POWER_SUPPORT=y ++CONFIG_SPL_GPIO_SUPPORT=y ++CONFIG_SPL_DM=y ++CONFIG_SPL_DM_REGULATOR=y + CONFIG_TPL=y + CONFIG_CMD_BOOTZ=y + CONFIG_CMD_GPIO=y +@@ -34,6 +39,7 @@ CONFIG_CMD_USB=y + # CONFIG_CMD_SETEXPR is not set + CONFIG_CMD_TIME=y + CONFIG_CMD_PMIC=y ++# CONFIG_SPL_PMIC_CHILDREN is not set + CONFIG_CMD_REGULATOR=y + CONFIG_SPL_OF_CONTROL=y + CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents" +diff --git a/drivers/power/regulator/rk8xx.c b/drivers/power/regulator/rk8xx.c +index 0ee07ad2..9d42a6ca 100644 +--- a/drivers/power/regulator/rk8xx.c ++++ b/drivers/power/regulator/rk8xx.c +@@ -16,14 +16,10 @@ + #include + #include + +-#ifndef CONFIG_SPL_BUILD +-#define ENABLE_DRIVER +-#endif +- + /* Not used or exisit register and configure */ + #define NA 0xff + +-/* Field Definitions */ ++/* Field definitions */ + #define RK808_BUCK_VSEL_MASK 0x3f + #define RK808_BUCK4_VSEL_MASK 0xf + #define RK808_LDO_VSEL_MASK 0x1f +@@ -145,7 +141,7 @@ static const struct rk8xx_reg_info rk818_buck[] = { + { 1800000, 100000, REG_BUCK4_ON_VSEL, REG_BUCK4_SLP_VSEL, REG_BUCK4_CONFIG, RK818_BUCK4_VSEL_MASK, }, + }; + +-#ifdef ENABLE_DRIVER ++#if CONFIG_IS_ENABLED(PMIC_CHILDREN) + static const struct rk8xx_reg_info rk808_ldo[] = { + { 1800000, 100000, REG_LDO1_ON_VSEL, REG_LDO1_SLP_VSEL, NA, RK808_LDO_VSEL_MASK, }, + { 1800000, 100000, REG_LDO2_ON_VSEL, REG_LDO2_SLP_VSEL, NA, RK808_LDO_VSEL_MASK, }, +@@ -206,8 +202,9 @@ static const struct rk8xx_reg_info rk818_ldo[] = { + { 800000, 100000, REG_LDO7_ON_VSEL, REG_LDO7_SLP_VSEL, NA, RK818_LDO_VSEL_MASK, }, + { 1800000, 100000, REG_LDO8_ON_VSEL, REG_LDO8_SLP_VSEL, NA, RK818_LDO_VSEL_MASK, }, + }; +-#endif ++#endif /* PMIC_CHILDREN */ + ++#ifdef CONFIG_SPL_BUILD + static const u16 rk818_chrg_cur_input_array[] = { + 450, 800, 850, 1000, 1250, 1500, 1750, 2000, 2250, 2500, 2750, 3000 + }; +@@ -215,6 +212,7 @@ static const u16 rk818_chrg_cur_input_array[] = { + static const uint rk818_chrg_shutdown_vsel_array[] = { + 2780000, 2850000, 2920000, 2990000, 3060000, 3130000, 3190000, 3260000 + }; ++#endif /* CONFIG_SPL_BUILD */ + + static const struct rk8xx_reg_info *get_buck_reg(struct udevice *pmic, + int num, int uvolt) +@@ -357,7 +355,7 @@ static int _buck_set_enable(struct udevice *pmic, int buck, bool enable) + return ret; + } + +-#ifdef ENABLE_DRIVER ++#if CONFIG_IS_ENABLED(PMIC_CHILDREN) + static int _buck_set_suspend_value(struct udevice *pmic, int buck, int uvolt) + { + const struct rk8xx_reg_info *info = get_buck_reg(pmic, buck, uvolt); +@@ -1121,8 +1119,9 @@ U_BOOT_DRIVER(rk8xx_switch) = { + .ops = &rk8xx_switch_ops, + .probe = rk8xx_switch_probe, + }; +-#endif ++#endif /* PMIC_CHILDREN */ + ++#ifdef CONFIG_SPL_BUILD + int rk8xx_spl_configure_buck(struct udevice *pmic, int buck, int uvolt) + { + int ret; +@@ -1153,6 +1152,6 @@ int rk818_spl_configure_usb_chrg_shutdown(struct udevice *pmic, int uvolt) + if (uvolt <= rk818_chrg_shutdown_vsel_array[i]) + break; + +- return pmic_clrsetbits(pmic, REG_USB_CTRL, RK818_USB_CHG_SD_VSEL_MASK, +- i); ++ return pmic_clrsetbits(pmic, REG_USB_CTRL, RK818_USB_CHG_SD_VSEL_MASK, i); + } ++#endif /* CONFIG_SPL_BUILD */ +-- +2.34.1 + diff --git a/dev-embedded/u-boot-pinephone-pro/files/0004-Add-kconfig-include.patch b/dev-embedded/u-boot-pinephone-pro/files/0004-Add-kconfig-include.patch deleted file mode 100644 index efed2f7..0000000 --- a/dev-embedded/u-boot-pinephone-pro/files/0004-Add-kconfig-include.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 4101d635fb8d82a5f6e63decccddfcfdea9f081e Mon Sep 17 00:00:00 2001 -From: Martijn Braam -Date: Sun, 13 Dec 2020 19:48:37 +0100 -Subject: [PATCH 4/8] Add kconfig include - ---- - arch/arm/mach-rockchip/rk3399/Kconfig | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/arch/arm/mach-rockchip/rk3399/Kconfig b/arch/arm/mach-rockchip/rk3399/Kconfig -index 35b1125906..3ba603ca80 100644 ---- a/arch/arm/mach-rockchip/rk3399/Kconfig -+++ b/arch/arm/mach-rockchip/rk3399/Kconfig -@@ -161,6 +161,7 @@ endif # BOOTCOUNT_LIMIT - source "board/firefly/roc-pc-rk3399/Kconfig" - source "board/google/gru/Kconfig" - source "board/pine64/pinebook-pro-rk3399/Kconfig" -+source "board/pine64/pinephone-pro-rk3399/Kconfig" - source "board/pine64/rockpro64_rk3399/Kconfig" - source "board/rockchip/evb_rk3399/Kconfig" - source "board/theobroma-systems/puma_rk3399/Kconfig" --- -2.33.0 - diff --git a/dev-embedded/u-boot-pinephone-pro/files/0005-Add-pinephone-pro-rk3399.h.patch b/dev-embedded/u-boot-pinephone-pro/files/0005-Add-pinephone-pro-rk3399.h.patch deleted file mode 100644 index d28fba1..0000000 --- a/dev-embedded/u-boot-pinephone-pro/files/0005-Add-pinephone-pro-rk3399.h.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 13c8c6945856e57958fdf7e4ef338c21e1199f19 Mon Sep 17 00:00:00 2001 -From: Martijn Braam -Date: Sun, 13 Dec 2020 19:52:09 +0100 -Subject: [PATCH 5/8] Add pinephone-pro-rk3399.h - ---- - include/configs/pinephone-pro-rk3399.h | 22 ++++++++++++++++++++++ - 1 file changed, 22 insertions(+) - create mode 100644 include/configs/pinephone-pro-rk3399.h - -diff --git a/include/configs/pinephone-pro-rk3399.h b/include/configs/pinephone-pro-rk3399.h -new file mode 100644 -index 0000000000..aaaa344839 ---- /dev/null -+++ b/include/configs/pinephone-pro-rk3399.h -@@ -0,0 +1,22 @@ -+/* SPDX-License-Identifier: GPL-2.0+ */ -+/* -+ * Copyright (C) 2016 Rockchip Electronics Co., Ltd -+ * Copyright (C) 2020 Peter Robinson -+ */ -+ -+#ifndef __PINEPHONE_PRO_RK3399_H -+#define __PINEPHONE_PRO_RK3399_H -+ -+#define ROCKCHIP_DEVICE_SETTINGS \ -+ "stdin=serial,usbkbd\0" \ -+ "stdout=serial,vidconsole\0" \ -+ "stderr=serial,vidconsole\0" -+ -+#include -+ -+#define SDRAM_BANK_SIZE (2UL << 30) -+ -+#define CONFIG_USB_OHCI_NEW -+#define CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS 2 -+ -+#endif --- -2.33.0 - diff --git a/dev-embedded/u-boot-pinephone-pro/files/0006-Added-dts-to-makefile.patch b/dev-embedded/u-boot-pinephone-pro/files/0006-Added-dts-to-makefile.patch deleted file mode 100644 index f24e81e..0000000 --- a/dev-embedded/u-boot-pinephone-pro/files/0006-Added-dts-to-makefile.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 3e8d6e4d57dd15acf104a8f11ff18833f8d7adc7 Mon Sep 17 00:00:00 2001 -From: Martijn Braam -Date: Sun, 13 Dec 2020 19:57:49 +0100 -Subject: [PATCH 6/8] Added dts to makefile - ---- - arch/arm/dts/Makefile | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile -index e2e8a5fb7a..ff07ae0270 100644 ---- a/arch/arm/dts/Makefile -+++ b/arch/arm/dts/Makefile -@@ -135,6 +135,7 @@ dtb-$(CONFIG_ROCKCHIP_RK3399) += \ - rk3399-nanopi-r4s.dtb \ - rk3399-orangepi.dtb \ - rk3399-pinebook-pro.dtb \ -+ rk3399-pinephone-pro.dtb \ - rk3399-puma-haikou.dtb \ - rk3399-roc-pc.dtb \ - rk3399-roc-pc-mezzanine.dtb \ --- -2.33.0 diff --git a/dev-embedded/u-boot-pinephone-pro/files/0007-u-boot.dtsi-fixes.patch b/dev-embedded/u-boot-pinephone-pro/files/0007-u-boot.dtsi-fixes.patch deleted file mode 100644 index 9e09c0c..0000000 --- a/dev-embedded/u-boot-pinephone-pro/files/0007-u-boot.dtsi-fixes.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 19150d65b1bed6831ba92a4cf3e7262518f1049f Mon Sep 17 00:00:00 2001 -From: Martijn Braam -Date: Sun, 13 Dec 2020 20:02:56 +0100 -Subject: [PATCH 7/8] u-boot.dtsi fixes - ---- - arch/arm/dts/rk3399-pinephone-pro-u-boot.dtsi | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/arch/arm/dts/rk3399-pinephone-pro-u-boot.dtsi b/arch/arm/dts/rk3399-pinephone-pro-u-boot.dtsi -index 7a058477db..e52263aafe 100644 ---- a/arch/arm/dts/rk3399-pinephone-pro-u-boot.dtsi -+++ b/arch/arm/dts/rk3399-pinephone-pro-u-boot.dtsi -@@ -12,7 +12,7 @@ - }; - - chosen { -- u-boot,spl-boot-order = "same-as-spl", &sdhci, &spiflash, &sdmmc; -+ u-boot,spl-boot-order = "same-as-spl", &sdhci, &sdmmc; - }; - - config { --- -2.33.0 diff --git a/dev-embedded/u-boot-pinephone-pro/files/0008-fix-boot-order.patch b/dev-embedded/u-boot-pinephone-pro/files/0008-fix-boot-order.patch deleted file mode 100644 index a18a904..0000000 --- a/dev-embedded/u-boot-pinephone-pro/files/0008-fix-boot-order.patch +++ /dev/null @@ -1,44 +0,0 @@ -From b212ad24a604b00b240add35516b7381965deb31 Mon Sep 17 00:00:00 2001 -From: Alex Bee -Date: Thu, 17 Jun 2021 11:01:12 +0200 -Subject: [PATCH] rockchip: Fix MMC boot order - -Basically all, i.e. rk3036.dtsi, rk3128.dtsi, rk3xxx.dtsi, rk322x.dtsi, -rk3288.dtsi, rk3308-u-boot.dtsi, rk3328-u-boot.dtsi, rk3399-u-boot.dtsi -and px30-u-boot.dtsi Rockchip SoC devicetrees which have mmc indexes -are defining eMMC as mmc0 and sdmmc as mmc1. -This means that the rule to try to boot from the SD card first is ignored, -which as per comment is what we want and is important for distros, which -rely on that. - -Fix this by setting the correct mmc index, i.e. first from mmc1 (SD card), -second from mmc0 (eMMC). - -Signed-off-by: Alex Bee -Reviewed-by: Kever Yang ---- - include/configs/rockchip-common.h | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/include/configs/rockchip-common.h b/include/configs/rockchip-common.h -index 0b9e24d1db..ba7061a287 100644 ---- a/include/configs/rockchip-common.h -+++ b/include/configs/rockchip-common.h -@@ -14,11 +14,11 @@ - - #ifndef CONFIG_SPL_BUILD - --/* First try to boot from SD (index 0), then eMMC (index 1) */ -+/* First try to boot from SD (index 1), then eMMC (index 0) */ - #if CONFIG_IS_ENABLED(CMD_MMC) - #define BOOT_TARGET_MMC(func) \ -- func(MMC, mmc, 0) \ -- func(MMC, mmc, 1) -+ func(MMC, mmc, 1) \ -+ func(MMC, mmc, 0) - #else - #define BOOT_TARGET_MMC(func) - #endif --- -GitLab - diff --git a/dev-embedded/u-boot-pinephone-pro/files/boot.txt b/dev-embedded/u-boot-pinephone-pro/files/boot.txt new file mode 100644 index 0000000..d6ec5af --- /dev/null +++ b/dev-embedded/u-boot-pinephone-pro/files/boot.txt @@ -0,0 +1,37 @@ +# +# /boot/boot.txt +# After modifying, run "ppp-uboot-mkscr" to re-generate the U-Boot boot script. +# + +# +# This is the description of the GPIO lines used in this boot script: +# +# GPIO #105 is GPIO3_B1, or RK3399 ball C27, which controls the vibrator motor +# GPIO #154 is GPIO4_D2, or RK3399 ball AH3, which controls the red part of the multicolor LED +# GPIO #157 is GPIO4_D5, or RK3399 ball AJ3, which controls the green part of the multicolor LED +# GPIO #158 is GPIO4_D6, or RK3399 ball AG4, which controls the blue part of the multicolor LED +# + +gpio set 105 +gpio set 154 + +# Set root partition to the second partition of boot device +part uuid ${devtype} ${devnum}:1 uuid_boot +part uuid ${devtype} ${devnum}:2 uuid_root + +setenv bootargs loglevel=4 console=tty0 console=${console} earlycon=uart8250,mmio32,0xff1a0000 consoleblank=0 boot=PARTUUID=${uuid_boot} root=PARTUUID=${uuid_root} rw rootwait quiet audit=0 + +if load ${devtype} ${devnum}:${distro_bootpart} ${kernel_addr_r} /Image; then + gpio clear 105 + if load ${devtype} ${devnum}:${distro_bootpart} ${fdt_addr_r} /dtbs/${fdtfile}; then + if load ${devtype} ${devnum}:${distro_bootpart} ${ramdisk_addr_r} /initramfs-linux.img; then + gpio set 157 + booti ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr_r}; + else + gpio set 158 + booti ${kernel_addr_r} - ${fdt_addr_r}; + fi; + fi; +fi + +# EOF diff --git a/dev-embedded/u-boot-pinephone-pro/files/ppp-uboot-flash b/dev-embedded/u-boot-pinephone-pro/files/ppp-uboot-flash new file mode 100644 index 0000000..023abae --- /dev/null +++ b/dev-embedded/u-boot-pinephone-pro/files/ppp-uboot-flash @@ -0,0 +1,60 @@ +#!/bin/bash + +# +# /usr/bin/ppp-uboot-flash +# Utility that flashes selected U-Boot image to the boot device. +# + +# Check that we're running as root +if [[ ${EUID} != 0 ]]; then + echo "Flashing U-Boot image not possible, please execute this utility as root." + exit 1 +fi + +# Get the device that the root resides on, and remove "/dev/" from the device name +ROOT_DEV=`findmnt / -o source -n | cut -d "[" -f 1 | cut -d "/" -f 3` + +# Get the full real name of the root device, which is usually "/dev/mmcblk0" +ROOT_DEV_NAME="/dev/"`echo /sys/block/*/${ROOT_DEV} | cut -d "/" -f 4` + +# Verify that the determined root device is available, just in case +if [[ ! -r ${ROOT_DEV_NAME} ]]; then + echo "Flashing U-Boot not possible, device ${ROOT_DEV_NAME} not found. No changes made to U-Boot." + exit 1 +fi + +# Get the U-Boot component names and check that they exist +IDBLOADER_IMG="/boot/idbloader.img" +U_BOOT_ITB="/boot/u-boot.itb" +for COMPONENT in ${IDBLOADER_IMG} ${U_BOOT_ITB}; do + if [[ ! -r ${COMPONENT} ]]; then + echo "Flashing U-Boot not possible, file ${COMPONENT} not found. No changes made to U-Boot." + exit 1 + fi +done + +# Flash the first of the selected U-Boot components to the determined root device +echo -n "Flashing U-Boot components..." +dd if=${IDBLOADER_IMG} of=${ROOT_DEV_NAME} seek=64 conv=notrunc,fsync > /dev/null 2>&1 +STATUS_IMG=$? +STATUS_ITB=0 + +# Now flash the second U-Boot component, but only if the first one flashed successfully +if [[ ${STATUS_IMG} = 0 ]]; then + dd if=${U_BOOT_ITB} of=${ROOT_DEV_NAME} seek=16384 conv=notrunc,fsync > /dev/null 2>&1 + STATUS_ITB=$? +fi + +# At the end, display the final status message of the U-Boot flashing +if [[ ${STATUS_IMG} = 0 && ${STATUS_ITB} = 0 ]]; then + echo " done." + echo "Required U-Boot components flashed to ${ROOT_DEV_NAME} successfully." + echo "Please reboot your phone for the changes to take effect." +else + echo " failed." + echo "Flashing U-Boot components to ${ROOT_DEV_NAME} failed due to unknown reason." + echo "Please try flashing the U-Boot again, or your phone may no longer boot properly." + exit 1 +fi + +# EOF diff --git a/dev-embedded/u-boot-pinephone-pro/files/ppp-uboot-mkscr b/dev-embedded/u-boot-pinephone-pro/files/ppp-uboot-mkscr new file mode 100644 index 0000000..cd58572 --- /dev/null +++ b/dev-embedded/u-boot-pinephone-pro/files/ppp-uboot-mkscr @@ -0,0 +1,68 @@ +#!/bin/bash + +# +# /usr/bin/ppp-uboot-mkscr +# Utility that generates the U-Boot boot script. +# + +# Source and destination file paths +BOOT_TXT="/boot/boot.txt" +BOOT_SCR="/boot/boot.scr" + +# Boot script description +IMAGE_DESC="U-Boot boot script" + +# Determine the performed action +if [[ ! -r ${BOOT_SCR} ]]; then + ACTION="Generating" +else + ACTION="Re-generating" +fi + +# Check that we're running as root +if [[ ${EUID} != 0 ]]; then + echo "${ACTION} ${IMAGE_DESC} not possible, please execute this utility as root." + exit 1 +fi + +# Make sure that the required utility is available +if [[ ! -x /usr/bin/mkimage ]]; then + echo "${ACTION} ${IMAGE_DESC} not possible, mkimage utility not found." + echo "Please install the uboot-tools package, by running the following command:" + echo " emerge dev-embedded/uboot-pinephone-pro" + exit 1 +fi + +# Check that the source file exists +if [[ ! -r ${BOOT_TXT} ]]; then + echo "${ACTION} ${IMAGE_DESC} not possible, file ${BOOT_TXT} not found." + echo "Please reinstall the uboot-pinephone package, by running the following command:" + echo " emerge dev-embedded/uboot-pinephone-pro" + exit 1 +fi + +# Is this a quiet execution? +VERBOSE=true +while getopts "q" SWITCH; do + if [[ ${SWITCH} = "q" ]]; then + VERBOSE=false + fi +done + +# Generate the U-Boot boot script +echo -n "${ACTION} ${IMAGE_DESC} ${BOOT_SCR}..." +if [[ ${VERBOSE} = true ]]; then + echo + mkimage -A arm -O linux -T script -C none -n "${IMAGE_DESC}" -d ${BOOT_TXT} ${BOOT_SCR} +else + mkimage -A arm -O linux -T script -C none -n "${IMAGE_DESC}" -d ${BOOT_TXT} ${BOOT_SCR} > /dev/null 2>&1 + if [[ $? = 0 ]]; then + echo " done." + else + echo " failed." + echo "${ACTION} ${IMAGE_DESC} from ${BOOT_TXT} failed due to unknown reason." + echo "Please try generating the boot script again, or your phone may no longer boot properly." + fi +fi + +# EOF diff --git a/dev-embedded/u-boot-pinephone-pro/files/uboot-pinephonepro.install b/dev-embedded/u-boot-pinephone-pro/files/uboot-pinephonepro.install deleted file mode 100644 index 34689f1..0000000 --- a/dev-embedded/u-boot-pinephone-pro/files/uboot-pinephonepro.install +++ /dev/null @@ -1,39 +0,0 @@ -notice_uboot() { - echo "New version of U-Boot firmware can be flashed to your microSD card" - echo "or eMMC module. You can do that by running:" - echo "# dd if=/boot/idbloader.img of=/dev/mmcblkX seek=64 conv=notrunc,fsync" - echo "# dd if=/boot/u-boot.itb of=/dev/mmcblkX seek=16384 conv=notrunc,fsync" -} - -create_config() { - mkdir -p /boot/extlinux - echo "LABEL Gentoo Linux 5.16.0 RC3 -KERNEL /Image -FDT /dtbs/5.16.0-rc3/rockchip/rk3399-pinephone-pro.dtb -APPEND initrd=/initramfs-linux.img console=ttyS2,1500000 root=/dev/mmcblk2p3 rw rootwait quiet splash plymouth.ignore-serial-consoles" > /boot/extlinux/extlinux.conf -} - -post_install() { - notice_uboot - if [ -f /boot/extlinux/extlinux.conf.pacsave ]; then - mv /boot/extlinux/extlinux.conf.pacsave /boot/extlinux/extlinux.conf - fi - if [ -f /boot/extlinux/extlinux.conf ]; then - echo "Keeping old extlinux.conf file..." - else - create_config - fi -} - -post_upgrade() { - notice_uboot - if [ -f /boot/extlinux/extlinux.conf.pacsave ]; then - mv /boot/extlinux/extlinux.conf.pacsave /boot/extlinux/extlinux.conf - fi - if [ -f /boot/extlinux/extlinux.conf ]; then - echo "Keeping old extlinux.conf file..." - else - create_config - fi -} - diff --git a/dev-embedded/u-boot-pinephone-pro/u-boot-pinephone-pro-2021.01_rc3.ebuild b/dev-embedded/u-boot-pinephone-pro/u-boot-pinephone-pro-2022.01.ebuild similarity index 79% rename from dev-embedded/u-boot-pinephone-pro/u-boot-pinephone-pro-2021.01_rc3.ebuild rename to dev-embedded/u-boot-pinephone-pro/u-boot-pinephone-pro-2022.01.ebuild index 446a424..fd31b3e 100644 --- a/dev-embedded/u-boot-pinephone-pro/u-boot-pinephone-pro-2021.01_rc3.ebuild +++ b/dev-embedded/u-boot-pinephone-pro/u-boot-pinephone-pro-2022.01.ebuild @@ -1,4 +1,4 @@ -# Copyright 1999-2021 Gentoo Authors +# Copyright 1999-2022 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 @@ -7,7 +7,7 @@ inherit toolchain-funcs PKGREL="4" FIRMWAREVERSION="2.6" -COMMMIT="0719bf42931033c3109ecc6357e8adb567cb637b" +COMMMIT="d637294e264adfeb29f390dfc393106fd4d41b17" MY_P="u-boot-${COMMMIT}" DESCRIPTION="Das U-boot and utilities for working with Das U-Boot for the PinePhone Pro" HOMEPAGE="https://www.denx.de/wiki/U-Boot/WebHome" @@ -41,16 +41,11 @@ src_prepare() { tools/Makefile || die #Apply PinePhone Pro patches - eapply "${FILESDIR}"/0001-PPP.patch - eapply "${FILESDIR}"/0002-Add-ppp-dt.patch - eapply "${FILESDIR}"/0003-Config-changes.patch - eapply "${FILESDIR}"/0004-Add-kconfig-include.patch - eapply "${FILESDIR}"/0005-Add-pinephone-pro-rk3399.h.patch - eapply "${FILESDIR}"/0006-Added-dts-to-makefile.patch - eapply "${FILESDIR}"/0007-u-boot.dtsi-fixes.patch - eapply "${FILESDIR}"/0008-fix-boot-order.patch - eapply "${FILESDIR}"/0009-Correct-boot-order-to-be-USB-SD-eMMC.patch -} + eapply "${FILESDIR}/0001-rockchip-Add-initial-support-for-the-PinePhone-Pro.patch" + eapply "${FILESDIR}/0002-Correct-boot-order-to-be-USB-SD-eMMC.patch" + eapply "${FILESDIR}/0003-Configure-USB-power-settings-for-PinePhone-Pro.patch" + } + src_configure() { tc-export AR BUILD_CC CC PKG_CONFIG @@ -77,15 +72,15 @@ src_compile() { emake "${myemakeargs[@]}" pinephone-pro-rk3399_defconfig - echo 'CONFIG_IDENT_STRING=" Gentoo"' >> .config + echo 'CONFIG_IDENT_STRING=" Gentoo Linux"' >> .config + echo 'CONFIG_BOOTDELAY=0' >> .config echo 'CONFIG_USB_EHCI_HCD=n' >> .config echo 'CONFIG_USB_EHCI_GENERIC=n' >> .config echo 'CONFIG_USB_XHCI_HCD=n' >> .config echo 'CONFIG_USB_XHCI_DWC3=n' >> .config echo 'CONFIG_USB_DWC3=n' >> .config echo 'CONFIG_USB_DWC3_GENERIC=n' >> .config - - + emake "${myemakeargs[@]}" EXTRAVERSION=-${PKGREL} emake "${myemakeargs[@]}" \ @@ -99,13 +94,20 @@ src_compile() { src_test() { :; } src_install() { - mkdir /boot/extlinux - insinto /boot/ doins ${S}/u-boot.itb - + insinto /boot/ doins ${S}/idbloader.img + + insinto /boot/ + doins ${S}/boot.txt + + insinto /usr/bin/ + doins ${S}/ppp-uboot-flash + + insinto /usr/bin/ + doins ${S}/ppp-uboot-mkscr cd tools || die @@ -126,8 +128,9 @@ src_install() { pkg_postinst() { einfo "This U-Boot is only to be used for the PinePhone Pro." einfo "After compiling a new Gentoo kernel, copy the resulting Image from /usr/src/linux/arch/arm64/boot/Image to the boot partition (replacing the existing Image)." + einfo "Update /boot/boot.txt to your wishes and then run ppp-uboot-mkscr to create the config." einfo "New version of U-Boot firmware can be flashed to your microSD card or eMMC module." - einfo "You can do that by running:" + einfo "You can do that by running ppp-uboot-flash or by running:" einfo "# dd if=/boot/idbloader.img of=/dev/mmcblkX seek=64 conv=notrunc,fsync" einfo "# dd if=/boot/u-boot.itb of=/dev/mmcblkX seek=16384 conv=notrunc,fsync" }