76502 Commits

Author SHA1 Message Date
Samuel Holland
2d07ff2cac sunxi: Add iNet_U70B_rev1_defconfig
Signed-off-by: Samuel Holland <samuel@sholland.org>
2021-11-20 13:49:25 -06:00
Samuel Holland
b49722f214 Revert "ARM: dts: sun8i-a33-inet-u70b-rev1: Add UART0 for testing"
Signed-off-by: Samuel Holland <samuel@sholland.org>
2021-11-20 13:49:25 -06:00
Samuel Holland
4fb44ea648 ARM: dts: sun8i-a33-inet-u70b-rev1: Add UART0 for testing
Signed-off-by: Samuel Holland <samuel@sholland.org>
2021-11-20 13:49:25 -06:00
Samuel Holland
623238c07c ARM: dts: sun8i: A33: Add iNet U70B REV01
Signed-off-by: Samuel Holland <samuel@sholland.org>
2021-11-20 13:49:25 -06:00
Samuel Holland
ac7fe9f32a Revert "[DO NOT MERGE] sunxi: psci: Delegate PSCI to SCPI"
Signed-off-by: Samuel Holland <samuel@sholland.org>
2021-11-20 13:49:25 -06:00
Samuel Holland
f901a4b2ef Merge branch 'patch/axp-gpio' into allwinner 2021-11-20 13:48:45 -06:00
Samuel Holland
f64595453e Merge branch 'patch/axp-vbus' into allwinner 2021-11-20 13:48:23 -06:00
Samuel Holland
65845c59b4 Merge branch 'patch/dm-pinctrl' into allwinner 2021-11-20 13:48:01 -06:00
Samuel Holland
712c061d0f Merge branch 'patch/sunxi-gpio' into allwinner 2021-11-20 13:47:58 -06:00
Samuel Holland
fe65e4ea08 Merge branch 'patch/rtl8211e' into allwinner 2021-11-20 13:47:56 -06:00
Samuel Holland
c0e7e35414 Merge branch 'patch/mkimage-toc1' into allwinner 2021-11-20 13:47:54 -06:00
Samuel Holland
6355105a4d Merge branch 'patch/mkimage-toc0' into allwinner 2021-11-20 13:47:51 -06:00
Samuel Holland
488f2fdccb Merge branch 'patch/mkimage-riscv' into allwinner 2021-11-20 13:47:49 -06:00
Samuel Holland
ffaae1ae6e Merge branch 'patch/h6-dts' into allwinner 2021-11-20 13:47:47 -06:00
Samuel Holland
d28d006716 Merge branch 'patch/h3-scp' into allwinner 2021-11-20 13:47:44 -06:00
Samuel Holland
e1af8ab1a7 Merge branch 'patch/h3-fit' into allwinner 2021-11-20 13:47:40 -06:00
Samuel Holland
e7c84063bc Merge branch 'patch/dt-sync' into allwinner 2021-11-20 13:47:37 -06:00
Samuel Holland
4a4cdec696 gpio: axp: Add pull-down support for AXP22x/AXP8xx variant
The AXP221 and newer PMICs support a pull-down function on their GPIOs.
Add support for it.

Signed-off-by: Samuel Holland <samuel@sholland.org>
2021-11-20 13:47:06 -06:00
Samuel Holland
07be891f06 gpio: axp: Add support for getting the pin function
Implement the .get_function operation, so the gpio command can report
the current function. Since the GPIOF_FUNC (versus GPIOF_UNUSED) mux
values vary among the PMICs, report all non-GPIO mux values as UNKNOWN.

Signed-off-by: Samuel Holland <samuel@sholland.org>
2021-11-20 13:47:06 -06:00
Samuel Holland
bcb7a7e923 gpio: axp: Select variant from compatible at runtime
There are three major variants of the AXP PMIC GPIO functionality (plus
PMICs with no GPIOs at all). Except for GPIO3 on the AXP209, which uses
a different register layout, it is straightforward to support all three
variants with a single driver. Do this, and in the process remove the
GPIO-related definitions from the PMIC-specific headers, and therefore
the dependency on AXP_PMIC_BUS.

Signed-off-by: Samuel Holland <samuel@sholland.org>
2021-11-20 13:47:06 -06:00
Samuel Holland
c6addcc353 gpio: axp: Use DM_PMIC functions for register access
Now that the PMIC driver implements the DM_PMIC uclass, those functions
can be used instead of the platform-specific "pmic_bus" functions.

Since the driver still uses the single set of register definitions from
axpXXX.h (as selected by AXPxxx_POWER), it still depends on one of those
choices, and therefore also AXP_PMIC_BUS.

Signed-off-by: Samuel Holland <samuel@sholland.org>
2021-11-20 13:47:06 -06:00
Samuel Holland
cb3b23f82b gpio: axp: Bind via device tree
Now that the PMIC has a DM driver and binds device tree subnodes, the
GPIO device can be bound that way, instead of from inside board code.

Since the driver still uses the single set of register definitions from
axpXXX.h (as selected by AXPxxx_POWER), it does not differentiate among
the supported compatibles.

Signed-off-by: Samuel Holland <samuel@sholland.org>
2021-11-20 13:47:06 -06:00
Samuel Holland
b66fca56b2 gpio: axp: Consistently use the "axp_gpio" order
This is less confusing than half of the driver using "axp_gpio" and the
other half using "gpio_axp".

Signed-off-by: Samuel Holland <samuel@sholland.org>
2021-11-20 13:47:06 -06:00
Samuel Holland
ce6527a930 ARM: dts: sunxi: Add AXP221 and AXP809 GPIO nodes
These PMICs each have two GPIO pins, and are supported by the axp_gpio
driver. In order to convert the axp_gpio driver to probe using the
device tree, the corresponding device tree nodes must be present. Add
them, following the same binding as the AXP209 and AXP813.

Signed-off-by: Samuel Holland <samuel@sholland.org>
2021-11-20 13:47:06 -06:00
Samuel Holland
00f5a05a78 phy: sun4i-usb: Use DM_GPIO for id/vbus_det GPIOs
Now that the sunxi_gpio driver handles pull-up/down via the driver
model, we can switch to DM_GPIO for these pins with no loss in
functionality. Since the driver now gets its pin configuration from
the device tree, we can remove the Kconfig symbols.

Signed-off-by: Samuel Holland <samuel@sholland.org>
2021-11-20 13:47:03 -06:00
Samuel Holland
78a34aca1b gpio: axp/sunxi: Remove virtual VBUS enable GPIO
Now that this functionality is modeled using the device tree and
regulator uclass, the named GPIO is not referenced anywhere. Remove
it, along with the rest of the support for AXP virtual GPIOs.

Signed-off-by: Samuel Holland <samuel@sholland.org>
2021-11-20 13:47:03 -06:00
Samuel Holland
1357f2890d sunxi: Remove obsolete USBx_VBUS_PIN Kconfig symbols
Now that the USB PHY driver uses the device tree to get VBUS supply
regulators, these Kconfig symbols are unused. Remove them.

Signed-off-by: Samuel Holland <samuel@sholland.org>
2021-11-20 13:47:03 -06:00
Samuel Holland
ab483a495b phy: sun4i-usb: Control USB supplies via regulator uclass
The device tree binding for the PHY provides VBUS supplies as regulator
references. Now that all boards have the appropriate regulator uclass
drivers enabled, the PHY driver can switch to using them. This replaces
direct GPIO usage, which in some cases needed a special DM-incompatible
"virtual" GPIO from the PMIC.

The following boards provided a value for CONFIG_USB0_VBUS_PIN, but are
missing the "usb0_vbus-supply" property in their device tree. None of
them have the MUSB controller enabled in host or OTG mode, so they
should see no impact:
 - Ainol_AW1_defconfig / sun7i-a20-ainol-aw1
 - Ampe_A76_defconfig / sun5i-a13-ampe-a76
 - CHIP_pro_defconfig / sun5i-gr8-chip-pro
 - Cubieboard4_defconfig / sun9i-a80-cubieboard4
 - Merrii_A80_Optimus_defconfig / sun9i-a80-optimus
 - Sunchip_CX-A99_defconfig / sun9i-a80-cx-a99
 - Yones_Toptech_BD1078_defconfig / sun7i-a20-yones-toptech-bd1078
 - Yones_Toptech_BS1078_V2_defconfig /
   sun6i-a31s-yones-toptech-bs1078-v2
 - iNet_3F_defconfig / sun4i-a10-inet-3f
 - iNet_3W_defconfig / sun4i-a10-inet-3w
 - iNet_86VS_defconfig / sun5i-a13-inet-86vs
 - iNet_D978_rev2_defconfig / sun8i-a33-inet-d978-rev2
 - icnova-a20-swac_defconfig / sun7i-a20-icnova-swac
 - sun8i_a23_evb_defconfig / sun8i-a23-evb

Similarly, the following boards set CONFIG_USB1_VBUS_PIN, but do not
have "usb1_vbus-supply" in their device tree. Neither of them have USB
enabled at all, so again there should be no impact:
 - Cubieboard4_defconfig / sun9i-a80-cubieboard4 (also for USB3)
 - sun8i_a23_evb_defconfig / sun8i-a23-evb

The following boards use a different pin for USB1 VBUS between their
defconfig and their device tree. Depending on which is correct, they
may be broken:
 - Linksprite_pcDuino3_Nano_defconfig (PH11) /
   sun7i-a20-pcduino3-nano (PD2)
 - icnova-a20-swac_defconfig (PG10) / sun7i-a20-icnova-swac (PH6)

Finally, this board has conflicting pins given for its USB2 VBUS:
 - Lamobo_R1_defconfig (PH3) / sun7i-a20-lamobo-r1 (PH12)

Signed-off-by: Samuel Holland <samuel@sholland.org>
2021-11-20 13:47:03 -06:00
Samuel Holland
6a2a23660d sunxi: Enable fixed regulator support for USB supplies
On many boards, the USB ports are powered by a GPIO-controlled fixed
regulator. In preparation for switching the USB PHY driver to use the
regulator uclass instead of driving the GPIO directly, ensure these
boards have fixed regulator support enabled.

Signed-off-by: Samuel Holland <samuel@sholland.org>
2021-11-20 13:47:03 -06:00
Samuel Holland
12a448a6ba sunxi: Enable PMIC drivevbus regulator support for USB supplies
On many boards, the USB ports are powered by the PMIC's "drivevbus"
regulator. In preparation for switching the USB PHY driver to use the
regulator uclass instead of a virtual GPIO pin, ensure these boards
have AXP PMIC regulator support enabled.

Signed-off-by: Samuel Holland <samuel@sholland.org>
2021-11-20 13:47:03 -06:00
Samuel Holland
ee0d7a9696 power: pmic: axp: Probe the drivevbus regulator from the DT
Now that some regulator driver exists for this PMIC, add support for
probing regulator drivers from the device tree subnodes.

Signed-off-by: Samuel Holland <samuel@sholland.org>
2021-11-20 13:47:03 -06:00
Samuel Holland
386f47f9f5 power: regulator: Add a driver for the AXP PMIC drivevbus
The first AXP regulator converted to use the regulator uclass is the
drivevbus switch, since it is used by the USB PHY driver.

Signed-off-by: Samuel Holland <samuel@sholland.org>
2021-11-20 13:47:03 -06:00
Samuel Holland
de0ed80286 gpio: axp/sunxi: Remove virtual VBUS detection GPIO
Now that this functionality is modeled using the device tree and
regulator uclass, the named GPIO is not referenced anywhere. Remove it.

Signed-off-by: Samuel Holland <samuel@sholland.org>
2021-11-20 13:47:03 -06:00
Samuel Holland
844c9ccfc5 sunxi: Switch to PMIC USB power supply VBUS detection
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 six 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
 - Nintendo_NES_Classic_Edition_defconfig /
   sun8i-r16-nintendo-nes-classic-edition
 - Yones_Toptech_BD1078_defconfig / sun7i-a20-yones-toptech-bd1078
 - Yones_Toptech_BS1078_V2_defconfig /
   sun6i-a31s-yones-toptech-bs1078-v2

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

Signed-off-by: Samuel Holland <samuel@sholland.org>
2021-11-20 13:47:03 -06:00
Samuel Holland
9468272b0c power: regulator: Add a driver for the AXP USB power supply
This driver reports the presence/absence of voltage on the PMIC's USB
VBUS pin. This information is used by the USB PHY driver. The
corresponding Linux driver uses the power supply class, which does not
exist in U-Boot. UCLASS_REGULATOR seems to be the closest match.

Signed-off-by: Samuel Holland <samuel@sholland.org>
2021-11-20 13:47:02 -06:00
Samuel Holland
2fe43d3b77 ARM: dts: sun6i: mixtile-loftq: Add USB1 VBUS regulator
This board is configured with CONFIG_USB1_VBUS_PIN="PH24", but no
regulator exists in its device tree. Add the regulator, so USB will
continue to work when the PHY driver switches to using the regulator
uclass instead of a GPIO.

Update the device tree here because it does not exist in Linux.

Signed-off-by: Samuel Holland <samuel@sholland.org>
2021-11-20 13:47:02 -06:00
Samuel Holland
0bfe20312a spi: sun4i_spi: Remove non-DM pin setup
This is now handled automatically by the pinctrl driver.

Cover-letter:
sunxi: Add and use a pinctrl driver
This series resolves some longstanding TODOs by implementing a pinctrl
driver for sunxi platforms and converting DM drivers to use it.

I am sending this as RFC because I have only tested this on a limited
amount of hardware, and there are quite a few magic numbers involved,
so it is likely I missed something. Also, I'm not sure the how best to
split up the patches by subsystem, or if that is necessary.

This series depends on the sunxi-gpio series I just sent.
END
Series-to: sunxi
Series-to: sjg
Series-prefix: RFC
Signed-off-by: Samuel Holland <samuel@sholland.org>
2021-11-20 13:46:59 -06:00
Samuel Holland
76b66aa70a pinctrl: sunxi: Add SPI0 pinmuxes
Pin lists and mux values were taken from the Linux drivers.

Signed-off-by: Samuel Holland <samuel@sholland.org>
2021-11-20 13:46:59 -06:00
Samuel Holland
ccf31a3f4d pwm: sunxi: Remove non-DM pin setup
This is now handled automatically by the pinctrl driver.

Signed-off-by: Samuel Holland <samuel@sholland.org>
2021-11-20 13:46:59 -06:00
Samuel Holland
6ff4c32b72 pinctrl: sunxi: a64: Add the PWM pinmux
This is the only possible mux setting for the PWM peripheral.

Signed-off-by: Samuel Holland <samuel@sholland.org>
2021-11-20 13:46:59 -06:00
Samuel Holland
ea72ab5afd sunxi: Remove non-DM MMC pin setup
This is now handled automatically by the pinctrl driver.

Signed-off-by: Samuel Holland <samuel@sholland.org>
2021-11-20 13:46:59 -06:00
Samuel Holland
84504cb0fc pinctrl: sunxi: Add MMC pinmuxes
Pin lists and mux values were taken from the Linux drivers.

Signed-off-by: Samuel Holland <samuel@sholland.org>
2021-11-20 13:46:59 -06:00
Samuel Holland
9bd513bb10 i2c: sun8i_rsb: Only do non-DM pin setup for non-DM I2C
When the DM_I2C driver is loaded, the pin setup is done automatically
from the device tree by the pinctrl driver.

Clean up the code in the process: remove #ifdefs and recognize that the
pin configuration is the same for all sun8i/sun50i SoCs, not just those
which select CONFIG_MACH_SUN8I.

Signed-off-by: Samuel Holland <samuel@sholland.org>
2021-11-20 13:46:59 -06:00
Samuel Holland
8febe346ce i2c: sun8i_rsb: Add support for DM clocks and resets
Signed-off-by: Samuel Holland <samuel@sholland.org>
2021-11-20 13:46:59 -06:00
Samuel Holland
78343d2c1d i2c: sun6i_p2wi: Only do non-DM pin setup for non-DM I2C
When the DM_I2C driver is loaded, the pin setup is done automatically
from the device tree by the pinctrl driver.

Signed-off-by: Samuel Holland <samuel@sholland.org>
2021-11-20 13:46:59 -06:00
Samuel Holland
c949a02c8a i2c: sun6i_p2wi: Add support for DM clocks and resets
Signed-off-by: Samuel Holland <samuel@sholland.org>
2021-11-20 13:46:58 -06:00
Samuel Holland
11856181f3 sunxi: Remove non-DM I2C clock/pin setup from U-Boot
This is now handled automatically by the clock and pinctrl drivers.

SPL still calls this function because it needes the non-DM code.

Signed-off-by: Samuel Holland <samuel@sholland.org>
2021-11-20 13:46:58 -06:00
Samuel Holland
943a367392 sunxi: Remove options and setup code for I2C2-I2C4
These options are not currently enabled anywhere. Any new users should
use DM clocks and pinctrl.

Signed-off-by: Samuel Holland <samuel@sholland.org>
2021-11-20 13:46:58 -06:00
Samuel Holland
656d6c58dc pinctrl: sunxi: Add I2C pinmuxes
Where multiple options were available, the one matching board.c and the
device trees was chosen.

Pin lists and mux values were taken from the Linux drivers.

Signed-off-by: Samuel Holland <samuel@sholland.org>
2021-11-20 13:46:58 -06:00
Samuel Holland
a5d609f6ed net: sun8i_emac: Remove non-DM pin setup
This is now handled automatically by the pinctrl driver.

Signed-off-by: Samuel Holland <samuel@sholland.org>
2021-11-20 13:46:58 -06:00