diff --git a/0010-Configure-USB-power-settings-for-PinePhone-Pro.patch b/0010-Configure-USB-power-settings-for-PinePhone-Pro.patch index 4df7d1277e39bf27fc657108d98180fc87dfda7f..608493e7b2be0158a3bc8cc80724ea95c56dd5ec 100644 --- a/0010-Configure-USB-power-settings-for-PinePhone-Pro.patch +++ b/0010-Configure-USB-power-settings-for-PinePhone-Pro.patch @@ -1,13 +1,14 @@ -From 93ef053e2af9eec9eece77e42b54da3e4675a719 Mon Sep 17 00:00:00 2001 +From a200f151ddbc93ad1ac0619ebee0e629c1326b33 Mon Sep 17 00:00:00 2001 From: Dragan Simic <dragan.simic@gmail.com> -Date: Wed, 22 Dec 2021 10:15:43 +0100 -Subject: [PATCH] Configure USB power settings for PinePhone Pro +Date: Thu, 30 Dec 2021 00:08:51 +0100 +Subject: [PATCH 1/2] Configure USB power settings for PinePhone Pro --- arch/arm/mach-rockchip/rk3399/rk3399.c | 5 ++ - .../pinephone-pro-rk3399.c | 50 +++++++++++++++++-- - configs/pinephone-pro-rk3399_defconfig | 5 ++ - 3 files changed, 55 insertions(+), 5 deletions(-) + .../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 c6434839..eeb77216 100644 @@ -29,18 +30,25 @@ index c6434839..eeb77216 100644 #if defined(SPL_GPIO_SUPPORT) 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 d7908461..aa10c11d 100644 +index d7908461..5a9cc400 100644 --- a/board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c +++ b/board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c -@@ -1,6 +1,7 @@ +@@ -1,8 +1,14 @@ // SPDX-License-Identifier: GPL-2.0+ /* * (C) Copyright 2019 Vasily Khoruzhick <anarsoul@gmail.com> + * (C) Copyright 2021 Dragan Simic <dsimic@buserror.io> */ ++/* ++ * TODO: Disable debugging ++ */ ++#define DEBUG ++ #include <common.h> -@@ -12,6 +13,8 @@ + #include <dm.h> + #include <init.h> +@@ -12,6 +18,8 @@ #include <asm/arch-rockchip/grf_rk3399.h> #include <asm/arch-rockchip/hardware.h> #include <asm/arch-rockchip/misc.h> @@ -49,7 +57,7 @@ index d7908461..aa10c11d 100644 #define GRF_IO_VSEL_BT565_SHIFT 0 #define PMUGRF_CON0_VSEL_SHIFT 8 -@@ -19,10 +22,8 @@ +@@ -19,15 +27,13 @@ #ifdef CONFIG_MISC_INIT_R static void setup_iodomain(void) { @@ -60,9 +68,16 @@ index d7908461..aa10c11d 100644 + 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.8v domain */ ++ /* BT565 is in 1.8 V domain */ rk_setreg(&grf->io_vsel, 1 << GRF_IO_VSEL_BT565_SHIFT); -@@ -52,5 +53,44 @@ int misc_init_r(void) + +- /* 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); + } + +@@ -52,5 +58,43 @@ int misc_init_r(void) return ret; } @@ -74,7 +89,8 @@ index d7908461..aa10c11d 100644 + * The same applies to CONFIG_SPL_I2C_SUPPORT. + */ + -+#if defined(CONFIG_SPL_BUILD) && !defined(CONFIG_SPL_OF_PLATDATA) && defined(CONFIG_SPL_POWER_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; @@ -84,7 +100,7 @@ index d7908461..aa10c11d 100644 + if (ret) + return ret; + -+ /* increase USB current limit to 2.5 A */ ++ /* set USB current limit to 2.5 A */ + ret = rk818_spl_configure_usb_input_current(pmic, 2500); + if (ret) + return ret; @@ -102,14 +118,12 @@ index d7908461..aa10c11d 100644 + int ret; + + ret = setup_usb_power(); -+ if (ret) { ++ if (ret) + debug("Failed to configure USB power settings: %d\n", ret); -+ return; -+ } +} -+#endif /* CONFIG_SPL_BUILD && !CONFIG_SPL_OF_PLATDATA && CONFIG_SPL_POWER_SUPPORT */ ++#endif /* CONFIG_SPL_BUILD && POWER_SUPPORT && !OF_PLATDATA */ diff --git a/configs/pinephone-pro-rk3399_defconfig b/configs/pinephone-pro-rk3399_defconfig -index ad4b5e0c..80305bf7 100644 +index ad4b5e0c..2477d10d 100644 --- a/configs/pinephone-pro-rk3399_defconfig +++ b/configs/pinephone-pro-rk3399_defconfig @@ -21,6 +21,11 @@ CONFIG_SPL_STACK_R=y @@ -124,6 +138,91 @@ index ad4b5e0c..80305bf7 100644 CONFIG_TPL=y CONFIG_CMD_BOOTZ=y CONFIG_CMD_GPIO=y +@@ -32,6 +37,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 a08e2151..e93d73d9 100644 +--- a/drivers/power/regulator/rk8xx.c ++++ b/drivers/power/regulator/rk8xx.c +@@ -16,14 +16,10 @@ + #include <power/pmic.h> + #include <power/regulator.h> + +-#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.33.1 diff --git a/PKGBUILD b/PKGBUILD index 6eb086974009fbeb56c69f7805a6b111ece9c10a..df046f4b34b7f713ad3095a929861b212eec49ad 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -35,7 +35,8 @@ source=("u-boot-$_commit.tar.gz::https://source.denx.de/u-boot/u-boot/-/archive/ "0007-u-boot.dtsi-fixes.patch" "0008-fix-boot-order.patch" "0009-Correct-boot-order-to-be-USB-SD-eMMC.patch" - "0010-Configure-USB-power-settings-for-PinePhone-Pro.patch") + "0010-Configure-USB-power-settings-for-PinePhone-Pro.patch" + "0011-Do-various-cleanups-in-U-Boot-as-spotted.patch") sha256sums=('6b196b6592fabed060b7c5b1fa05a743f9be131d11389b762b7d0e2beebbd381' '4e59f02ccb042d5d18c89c849701b96e6cf4b788709564405354b5d313d173f7' '4e356b3868c0c1ac061c2c15c7ba80c627e1743214680409f418f9b4c00eb3f7' @@ -52,7 +53,8 @@ sha256sums=('6b196b6592fabed060b7c5b1fa05a743f9be131d11389b762b7d0e2beebbd381' '3aa7c3b4aa1233d604cb9177fc9bc56f85714c5d69f9432690dc7c50e06c105b' '4aadc4f07f4ae62d5fe11cfabe1c5f917f77ce8014800ae3a107f9bcc551bc5b' '017d33aac55f8a5ed22170c97b4792ba755a4dad04f6c0cdd85119bbc81e87b3' - '983634eff9c283cd240ed6f737e9e58fe8467d9c113c362fee5cbd905fc61aef') + 'a4ba89dd7667171bf0beebdef266a67ab7ddbddd6f04def5cfe5a75745392d4d' + 'd2ab2877ae38f333ca5f25a0e67e8c368e8a23c6778467a0a83db0f16bc60b71') prepare() { cd u-boot-${_commit}