Re: [PATCH 2/3] sunxi: Switch to PMIC USB power supply VBUS detection

2023-04-27 Thread Andre Przywara
On Sun, 22 Jan 2023 17:46:21 -0600
Samuel Holland  wrote:

> Update boards to use the USB power supply driver, as referenced in the
> device tree, instead of a virtual GPIO. This removes the need for some
> DM-incompatible special cases in the GPIO driver.

Confirmed that it replaces AXP0-VBUS-DETECT with
CONFIG_REGULATOR_AXP_USB_POWER for all 23 boards affected.

Reviewed-by: Andre Przywara 

Queued for sunxi/master.

Cheers,
Andre


> The following five boards used AXP0-VBUS-DETECT in their config, but are
> missing the "usb0_vbus_power-supply" property in their device tree:
>  - Ainol_AW1_defconfig / sun7i-a20-ainol-aw1
>  - Cubieboard4_defconfig / sun9i-a80-cubieboard4
>  - Merrii_A80_Optimus_defconfig / sun9i-a80-optimus
>  - Yones_Toptech_BD1078_defconfig / sun7i-a20-yones-toptech-bd1078
>  - Yones_Toptech_BS1078_V2_defconfig /
>sun6i-a31s-yones-toptech-bs1078-v2
> 
> None of those five boards have the MUSB controller (USB OTG) enabled in
> their device trees, so this change should not break anything for them.
> 
> Additionally, the following board intentionally omits the property
> because VBUS is always enabled:
>  - Nintendo_NES_Classic_Edition_defconfig /
>sun8i-r16-nintendo-nes-classic
> 
> The PHY driver already assumes VBUS is enabled when no detection method
> is available, so again this will not cause any problems.
> 
> Signed-off-by: Samuel Holland 
> ---
> 
>  configs/A33-OLinuXino_defconfig| 2 +-
>  configs/Ainol_AW1_defconfig| 2 +-
>  configs/Cubieboard4_defconfig  | 3 ++-
>  configs/Cubietruck_plus_defconfig  | 2 +-
>  configs/MSI_Primo81_defconfig  | 2 +-
>  configs/Merrii_A80_Optimus_defconfig   | 3 ++-
>  configs/Nintendo_NES_Classic_Edition_defconfig | 2 +-
>  configs/Sinovoip_BPI_M3_defconfig  | 2 +-
>  configs/Wexler_TAB7200_defconfig   | 2 +-
>  configs/Yones_Toptech_BD1078_defconfig | 2 +-
>  configs/Yones_Toptech_BS1078_V2_defconfig  | 2 +-
>  configs/colorfly_e708_q1_defconfig | 2 +-
>  configs/ga10h_v1_1_defconfig   | 2 +-
>  configs/gt90h_v4_defconfig | 2 +-
>  configs/iNet_D978_rev2_defconfig   | 2 +-
>  configs/inet86dz_defconfig | 2 +-
>  configs/inet_q972_defconfig| 2 +-
>  configs/polaroid_mid2407pxe03_defconfig| 2 +-
>  configs/polaroid_mid2809pxe04_defconfig| 2 +-
>  configs/q8_a23_tablet_800x480_defconfig| 2 +-
>  configs/q8_a33_tablet_1024x600_defconfig   | 2 +-
>  configs/q8_a33_tablet_800x480_defconfig| 2 +-
>  configs/tbs_a711_defconfig | 2 +-
>  23 files changed, 25 insertions(+), 23 deletions(-)
> 
> diff --git a/configs/A33-OLinuXino_defconfig b/configs/A33-OLinuXino_defconfig
> index 351a454339..896ddbb95f 100644
> --- a/configs/A33-OLinuXino_defconfig
> +++ b/configs/A33-OLinuXino_defconfig
> @@ -8,7 +8,6 @@ CONFIG_DRAM_ZQ=15291
>  CONFIG_DRAM_ODT_EN=y
>  CONFIG_MMC0_CD_PIN="PB4"
>  CONFIG_USB0_VBUS_PIN="AXP0-VBUS-ENABLE"
> -CONFIG_USB0_VBUS_DET="AXP0-VBUS-DETECT"
>  CONFIG_USB0_ID_DET="PB3"
>  CONFIG_AXP_GPIO=y
>  
> CONFIG_VIDEO_LCD_MODE="x:800,y:480,depth:18,pclk_khz:33000,le:16,ri:209,up:22,lo:22,hs:30,vs:1,sync:3,vmode:0"
> @@ -16,5 +15,6 @@ CONFIG_VIDEO_LCD_DCLK_PHASE=0
>  CONFIG_VIDEO_LCD_BL_EN="PB2"
>  CONFIG_VIDEO_LCD_BL_PWM="PH0"
>  # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
> +CONFIG_REGULATOR_AXP_USB_POWER=y
>  CONFIG_AXP_DCDC1_VOLT=3300
>  CONFIG_USB_MUSB_HOST=y
> diff --git a/configs/Ainol_AW1_defconfig b/configs/Ainol_AW1_defconfig
> index 9a18af8c6e..ec0c216413 100644
> --- a/configs/Ainol_AW1_defconfig
> +++ b/configs/Ainol_AW1_defconfig
> @@ -7,7 +7,6 @@ CONFIG_DRAM_CLK=432
>  CONFIG_DRAM_ZQ=123
>  CONFIG_MMC0_CD_PIN="PH1"
>  CONFIG_USB0_VBUS_PIN="PB9"
> -CONFIG_USB0_VBUS_DET="AXP0-VBUS-DETECT"
>  CONFIG_AXP_GPIO=y
>  
> CONFIG_VIDEO_LCD_MODE="x:800,y:480,depth:18,pclk_khz:4,le:87,ri:112,up:38,lo:141,hs:1,vs:1,sync:3,vmode:0"
>  CONFIG_VIDEO_LCD_POWER="PH8"
> @@ -18,4 +17,5 @@ CONFIG_SPL_I2C=y
>  CONFIG_SYS_I2C_MVTWSI=y
>  CONFIG_SYS_I2C_SLAVE=0x7f
>  CONFIG_SYS_I2C_SPEED=40
> +CONFIG_REGULATOR_AXP_USB_POWER=y
>  CONFIG_USB_MUSB_HOST=y
> diff --git a/configs/Cubieboard4_defconfig b/configs/Cubieboard4_defconfig
> index 04ed79afb6..82a8deac77 100644
> --- a/configs/Cubieboard4_defconfig
> +++ b/configs/Cubieboard4_defconfig
> @@ -7,10 +7,11 @@ CONFIG_DRAM_CLK=672
>  CONFIG_MMC0_CD_PIN="PH18"
>  CONFIG_MMC_SUNXI_SLOT_EXTRA=2
>  CONFIG_USB0_VBUS_PIN="AXP0-VBUS-ENABLE"
> -CONFIG_USB0_VBUS_DET="AXP0-VBUS-DETECT"
>  CONFIG_USB0_ID_DET="PH16"
>  CONFIG_USB1_VBUS_PIN="PH14"
>  CONFIG_USB3_VBUS_PIN="PH15"
>  CONFIG_AXP_GPIO=y
>  CONFIG_SYS_I2C_SUN8I_RSB=y
> +CONFIG_DM_REGULATOR=y
> +CONFIG_REGULATOR_AXP_USB_POWER=y
>  CONFIG_AXP809_POWER=y
> diff --git a/configs/Cubietruck_plus_defconfig 
> b/configs/Cubietruck_plus_defconfig
> index 13f958977b..29f4df2b81 

[PATCH 2/3] sunxi: Switch to PMIC USB power supply VBUS detection

2023-01-22 Thread Samuel Holland
Update boards to use the USB power supply driver, as referenced in the
device tree, instead of a virtual GPIO. This removes the need for some
DM-incompatible special cases in the GPIO driver.

The following five boards used AXP0-VBUS-DETECT in their config, but are
missing the "usb0_vbus_power-supply" property in their device tree:
 - Ainol_AW1_defconfig / sun7i-a20-ainol-aw1
 - Cubieboard4_defconfig / sun9i-a80-cubieboard4
 - Merrii_A80_Optimus_defconfig / sun9i-a80-optimus
 - Yones_Toptech_BD1078_defconfig / sun7i-a20-yones-toptech-bd1078
 - Yones_Toptech_BS1078_V2_defconfig /
   sun6i-a31s-yones-toptech-bs1078-v2

None of those five boards have the MUSB controller (USB OTG) enabled in
their device trees, so this change should not break anything for them.

Additionally, the following board intentionally omits the property
because VBUS is always enabled:
 - Nintendo_NES_Classic_Edition_defconfig /
   sun8i-r16-nintendo-nes-classic

The PHY driver already assumes VBUS is enabled when no detection method
is available, so again this will not cause any problems.

Signed-off-by: Samuel Holland 
---

 configs/A33-OLinuXino_defconfig| 2 +-
 configs/Ainol_AW1_defconfig| 2 +-
 configs/Cubieboard4_defconfig  | 3 ++-
 configs/Cubietruck_plus_defconfig  | 2 +-
 configs/MSI_Primo81_defconfig  | 2 +-
 configs/Merrii_A80_Optimus_defconfig   | 3 ++-
 configs/Nintendo_NES_Classic_Edition_defconfig | 2 +-
 configs/Sinovoip_BPI_M3_defconfig  | 2 +-
 configs/Wexler_TAB7200_defconfig   | 2 +-
 configs/Yones_Toptech_BD1078_defconfig | 2 +-
 configs/Yones_Toptech_BS1078_V2_defconfig  | 2 +-
 configs/colorfly_e708_q1_defconfig | 2 +-
 configs/ga10h_v1_1_defconfig   | 2 +-
 configs/gt90h_v4_defconfig | 2 +-
 configs/iNet_D978_rev2_defconfig   | 2 +-
 configs/inet86dz_defconfig | 2 +-
 configs/inet_q972_defconfig| 2 +-
 configs/polaroid_mid2407pxe03_defconfig| 2 +-
 configs/polaroid_mid2809pxe04_defconfig| 2 +-
 configs/q8_a23_tablet_800x480_defconfig| 2 +-
 configs/q8_a33_tablet_1024x600_defconfig   | 2 +-
 configs/q8_a33_tablet_800x480_defconfig| 2 +-
 configs/tbs_a711_defconfig | 2 +-
 23 files changed, 25 insertions(+), 23 deletions(-)

diff --git a/configs/A33-OLinuXino_defconfig b/configs/A33-OLinuXino_defconfig
index 351a454339..896ddbb95f 100644
--- a/configs/A33-OLinuXino_defconfig
+++ b/configs/A33-OLinuXino_defconfig
@@ -8,7 +8,6 @@ CONFIG_DRAM_ZQ=15291
 CONFIG_DRAM_ODT_EN=y
 CONFIG_MMC0_CD_PIN="PB4"
 CONFIG_USB0_VBUS_PIN="AXP0-VBUS-ENABLE"
-CONFIG_USB0_VBUS_DET="AXP0-VBUS-DETECT"
 CONFIG_USB0_ID_DET="PB3"
 CONFIG_AXP_GPIO=y
 
CONFIG_VIDEO_LCD_MODE="x:800,y:480,depth:18,pclk_khz:33000,le:16,ri:209,up:22,lo:22,hs:30,vs:1,sync:3,vmode:0"
@@ -16,5 +15,6 @@ CONFIG_VIDEO_LCD_DCLK_PHASE=0
 CONFIG_VIDEO_LCD_BL_EN="PB2"
 CONFIG_VIDEO_LCD_BL_PWM="PH0"
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
+CONFIG_REGULATOR_AXP_USB_POWER=y
 CONFIG_AXP_DCDC1_VOLT=3300
 CONFIG_USB_MUSB_HOST=y
diff --git a/configs/Ainol_AW1_defconfig b/configs/Ainol_AW1_defconfig
index 9a18af8c6e..ec0c216413 100644
--- a/configs/Ainol_AW1_defconfig
+++ b/configs/Ainol_AW1_defconfig
@@ -7,7 +7,6 @@ CONFIG_DRAM_CLK=432
 CONFIG_DRAM_ZQ=123
 CONFIG_MMC0_CD_PIN="PH1"
 CONFIG_USB0_VBUS_PIN="PB9"
-CONFIG_USB0_VBUS_DET="AXP0-VBUS-DETECT"
 CONFIG_AXP_GPIO=y
 
CONFIG_VIDEO_LCD_MODE="x:800,y:480,depth:18,pclk_khz:4,le:87,ri:112,up:38,lo:141,hs:1,vs:1,sync:3,vmode:0"
 CONFIG_VIDEO_LCD_POWER="PH8"
@@ -18,4 +17,5 @@ CONFIG_SPL_I2C=y
 CONFIG_SYS_I2C_MVTWSI=y
 CONFIG_SYS_I2C_SLAVE=0x7f
 CONFIG_SYS_I2C_SPEED=40
+CONFIG_REGULATOR_AXP_USB_POWER=y
 CONFIG_USB_MUSB_HOST=y
diff --git a/configs/Cubieboard4_defconfig b/configs/Cubieboard4_defconfig
index 04ed79afb6..82a8deac77 100644
--- a/configs/Cubieboard4_defconfig
+++ b/configs/Cubieboard4_defconfig
@@ -7,10 +7,11 @@ CONFIG_DRAM_CLK=672
 CONFIG_MMC0_CD_PIN="PH18"
 CONFIG_MMC_SUNXI_SLOT_EXTRA=2
 CONFIG_USB0_VBUS_PIN="AXP0-VBUS-ENABLE"
-CONFIG_USB0_VBUS_DET="AXP0-VBUS-DETECT"
 CONFIG_USB0_ID_DET="PH16"
 CONFIG_USB1_VBUS_PIN="PH14"
 CONFIG_USB3_VBUS_PIN="PH15"
 CONFIG_AXP_GPIO=y
 CONFIG_SYS_I2C_SUN8I_RSB=y
+CONFIG_DM_REGULATOR=y
+CONFIG_REGULATOR_AXP_USB_POWER=y
 CONFIG_AXP809_POWER=y
diff --git a/configs/Cubietruck_plus_defconfig 
b/configs/Cubietruck_plus_defconfig
index 13f958977b..29f4df2b81 100644
--- a/configs/Cubietruck_plus_defconfig
+++ b/configs/Cubietruck_plus_defconfig
@@ -8,7 +8,6 @@ CONFIG_DRAM_ZQ=15355
 CONFIG_DRAM_ODT_EN=y
 CONFIG_MMC_SUNXI_SLOT_EXTRA=2
 CONFIG_USB0_VBUS_PIN="AXP0-VBUS-ENABLE"
-CONFIG_USB0_VBUS_DET="AXP0-VBUS-DETECT"
 CONFIG_USB0_ID_DET="PH11"
 CONFIG_USB1_VBUS_PIN="PD29"
 CONFIG_USB2_VBUS_PIN="PL6"
@@ -22,6 +21,7 @@ CONFIG_SYS_I2C_SLAVE=0x7f
 CONFIG_SYS_I2C_SPEED=40
 CONFIG_PHY_REALTEK=y
 CONFIG_SUN8I_EMAC=y