Skip to content

sunxi: Control USB pins and supplies via DT regulators

Andre Przywara linux-sunxi u-boot 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 Latest8 patches 9 repliesIn review

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/8power: regulator: Add a driver for the AXP PMIC drivevbusdrivers/power/pmic/axp.c drivers/power/regulator/Kconfig drivers/power/regulator/Makefile +1 more+66 -02 replies
2/8sunxi: Enable PMIC drivevbus regulator support for USB suppliesconfigs/A33-OLinuXino_defconfig configs/Cubieboard4_defconfig configs/Cubietruck_plus_defconfig +16 more+19 -01 reply
3/8phy: sun4i-usb: Control supplies via the regulator uclassdrivers/phy/allwinner/phy-sun4i-usb.c+14 -211 reply
4/8sunxi: Remove obsolete USBx_VBUS_PIN Kconfig symbolsarch/arm/mach-sunxi/Kconfig configs/A10s-OLinuXino-M_defconfig configs/A13-OLinuXinoM_defconfig +84 more+0 -1441 reply
5/8gpio: axp: Remove virtual VBUS enable GPIOdrivers/gpio/axp_gpio.c drivers/gpio/sunxi_gpio.c include/axp221.h +3 more+22 -851 reply
6/8phy: sun4i-usb: Determine VBUS detection pin from devicetreedrivers/phy/allwinner/phy-sun4i-usb.c+9 -151 reply
7/8phy: sun4i-usb: Determine USB OTG detection pin from devicetreedrivers/phy/allwinner/phy-sun4i-usb.c+8 -271 reply
8/8sunxi: Kconfig: Remove obsolete USBx_* pin symbolsarch/arm/mach-sunxi/Kconfig configs/A13-OLinuXino_defconfig configs/A20-OLinuXino-Lime2-eMMC_defconfig +46 more+0 -761 reply

Reviews trailers per patch

All 8 patches have a Reviewed-by or Acked-by.

PatchJernej Skrabec
1/8R-b
2/8A-b
3/8R-b
4/8A-b
5/8R-b
6/8R-b
7/8R-b
8/8A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/8] sunxi: Control USB pins and supplies via DT regulators

This series removes some old custom non-DM code from the Allwinner USB PHY driver. So far we were relying on Kconfig specified GPIO names for the VBUS power supplies, USB ID detect pin and the VBUS detect pin.

The first 5 patches resurrect Samuel's series from 1.5 years ago, fixing one issue that prevented this series from being merged earlier (by using regulator_set_enable_if_allowed()). This involves adding a new regulator driver, for the AXP DRIVEVBUS functionality, then switching the USB PHY over to using DM compliant regulator calls. Eventually the old, no longer needed symbols are removed both from the Kconfig and the defconfig files.
This also fixes a lot of A20 boards (probably even more SoCs from this era), where USB was broken since v2025.01-rc1, due to conflicts between "regulator-boot-on" DT regulators and the same controlling GPIO being claimed by the current custom code.

The last three patches convert the currently Kconfig defined USB ID detect pins (to switch between host and device support on USB-OTG ports) and the VBUS detect pins (to detect external VBUS power supplied by the connected host) to DT based GPIO pins. This changes the driver in the first two patches, then removes the old symbols in the third one.

Please have a look and most importantly test USB host and device functionality on any boards you have access to.

Cheers,
Andre

Andre Przywara (3):
phy: sun4i-usb: Determine VBUS detection pin from devicetree
phy: sun4i-usb: Determine USB OTG detection pin from devicetree
sunxi: Kconfig: Remove obsolete USBx_* pin symbols

Samuel Holland (5):
power: regulator: Add a driver for the AXP PMIC drivevbus
sunxi: Enable PMIC drivevbus regulator support for USB supplies
phy: sun4i-usb: Control supplies via the regulator uclass
sunxi: Remove obsolete USBx_VBUS_PIN Kconfig symbols
gpio: axp: Remove virtual VBUS enable GPIO

 arch/arm/mach-sunxi/Kconfig                  | 43 ---------
 configs/A10s-OLinuXino-M_defconfig           |  1 -
 configs/A13-OLinuXinoM_defconfig             |  1 -
 configs/A13-OLinuXino_defconfig              |  2 -
 configs/A20-OLinuXino-Lime2-eMMC_defconfig   |  2 -
 configs/A20-OLinuXino-Lime2_defconfig        |  2 -
 configs/A20-Olimex-SOM-EVB_defconfig         |  2 -
 configs/A20-Olimex-SOM204-EVB-eMMC_defconfig |  2 -
 configs/A20-Olimex-SOM204-EVB_defconfig      |  2 -
 configs/A33-OLinuXino_defconfig              |  3 +-
 configs/Ainol_AW1_defconfig                  |  1 -
 configs/Ampe_A76_defconfig                   |  3 -
 configs/Auxtek-T003_defconfig                |  1 -
 configs/Auxtek-T004_defconfig                |  1 -
 configs/Bananapi_M2_Ultra_defconfig          |  2 -
 configs/Bananapi_m2m_defconfig               |  1 -
 configs/Bananapro_defconfig                  |  2 -
 configs/CHIP_defconfig                       |  1 -
 configs/CHIP_pro_defconfig                   |  1 -
 configs/CSQ_CS908_defconfig                  |  2 -
 configs/Chuwi_V7_CW0825_defconfig            |  3 -
 configs/Colombus_defconfig                   |  1 -
 configs/Cubieboard4_defconfig                |  5 +-
 configs/Cubietruck_defconfig                 |  3 -
 configs/Cubietruck_plus_defconfig            |  5 +-
 configs/Empire_electronix_d709_defconfig     |  3 -
 configs/Empire_electronix_m712_defconfig     |  3 -
 configs/Hummingbird_A31_defconfig            |  2 -
 configs/Hyundai_A7HD_defconfig               |  4 -
 configs/Linksprite_pcDuino3_Nano_defconfig   |  1 -
 configs/Linksprite_pcDuino_defconfig         |  2 -
 configs/MSI_Primo81_defconfig                |  2 +-
 configs/Mele_A1000G_quad_defconfig           |  2 -
 configs/Mele_I7_defconfig                    |  2 -
 configs/Mele_M9_defconfig                    |  2 -
 configs/Merrii_A80_Optimus_defconfig         |  5 +-
 configs/Mini-X_defconfig                     |  1 -
 configs/Orangepi_defconfig                   |  2 -
 configs/Orangepi_mini_defconfig              |  2 -
 configs/Sinlinx_SinA31s_defconfig            |  2 -
 configs/Sinlinx_SinA33_defconfig             |  1 -
 configs/Sinovoip_BPI_M2_defconfig            |  2 -
 configs/Sinovoip_BPI_M3_defconfig            |  4 +-
 configs/Sunchip_CX-A99_defconfig             |  3 -
 configs/UTOO_P66_defconfig                   |  3 -
 configs/Wexler_TAB7200_defconfig             |  2 -
 configs/Wobo_i5_defconfig                    |  1 -
 configs/Yones_Toptech_BD1078_defconfig       |  1 -
 configs/Yones_Toptech_BS1078_V2_defconfig    |  3 +-
 configs/ba10_tv_box_defconfig                |  2 -
 configs/bananapi_m2_berry_defconfig          |  1 -
 configs/colorfly_e708_q1_defconfig           |  3 +-
 configs/difrnce_dit4350_defconfig            |  3 -
 configs/dserve_dsrv9703c_defconfig           |  3 -
 configs/ga10h_v1_1_defconfig                 |  3 +-
 configs/gt90h_v4_defconfig                   |  3 +-
 configs/h8_homlet_v2_defconfig               |  2 -
 configs/iNet_3F_defconfig                    |  2 -
 configs/iNet_3W_defconfig                    |  2 -
 configs/iNet_86VS_defconfig                  |  2 -
 configs/iNet_D978_rev2_defconfig             |  3 +-
 configs/icnova-a20-swac_defconfig            |  3 -
 configs/inet1_defconfig                      |  3 -
 configs/inet86dz_defconfig                   |  3 +-
 configs/inet97fv2_defconfig                  |  3 -
 configs/inet98v_rev2_defconfig               |  3 -
 configs/inet9f_rev03_defconfig               |  3 -
 configs/inet_q972_defconfig                  |  3 +-
 configs/jesurun_q5_defconfig                 |  1 -
 configs/mixtile_loftq_defconfig              |  2 -
 configs/mk802_a10s_defconfig                 |  1 -
 configs/mk802_defconfig                      |  1 -
 configs/orangepi_2_defconfig                 |  1 -
 configs/orangepi_plus_defconfig              |  2 -
 configs/orangepi_zero2_defconfig             |  1 -
 configs/orangepi_zero3_defconfig             |  1 -
 configs/parrot_r16_defconfig                 |  2 -
 configs/pine_h64_defconfig                   |  1 -
 configs/polaroid_mid2407pxe03_defconfig      |  3 +-
 configs/polaroid_mid2809pxe04_defconfig      |  3 +-
 configs/pov_protab2_ips9_defconfig           |  3 -
 configs/q8_a13_tablet_defconfig              |  3 -
 configs/q8_a23_tablet_800x480_defconfig      |  3 +-
 configs/q8_a33_tablet_1024x600_defconfig     |  3 +-
 configs/q8_a33_tablet_800x480_defconfig      |  3 +-
 configs/r7-tv-dongle_defconfig               |  1 -
 configs/sun8i_a23_evb_defconfig              |  3 -
 configs/tbs_a711_defconfig                   |  3 +-
 configs/teres_i_defconfig                    |  1 -
 drivers/gpio/axp_gpio.c                      | 75 +++++----------
 drivers/gpio/sunxi_gpio.c                    | 12 +--
 drivers/phy/allwinner/phy-sun4i-usb.c        | 96 +++++++-------------
 drivers/power/pmic/axp.c                     |  1 +
 drivers/power/regulator/Kconfig              |  7 ++
 drivers/power/regulator/Makefile             |  1 +
 drivers/power/regulator/axp_drivevbus.c      | 57 ++++++++++++
 include/axp221.h                             |  4 -
 include/axp809.h                             |  4 -
 include/axp818.h                             |  4 -
 include/sunxi_gpio.h                         |  8 --
 100 files changed, 139 insertions(+), 369 deletions(-)
 create mode 100644 drivers/power/regulator/axp_drivevbus.c
Signature · 1 line
2.46.3