89757 Commits

Author SHA1 Message Date
Samuel Holland
2e89b706f5 sunxi: riscv: Add defconfigs for several boards
Signed-off-by: Samuel Holland <samuel@sholland.org>
2023-10-31 03:53:02 -05:00
Samuel Holland
22f9745805 sunxi: Add temporary RISC-V version of board code
Signed-off-by: Samuel Holland <samuel@sholland.org>
2023-10-31 03:53:02 -05:00
Samuel Holland
8d0a9492ae usb: musb-new: Hack up the driver for the D1
Signed-off-by: Samuel Holland <samuel@sholland.org>
2023-10-31 03:40:47 -05:00
Samuel Holland
ecba5c5d2d [BROKEN] spi: sunxi: Add support for the D1
Signed-off-by: Samuel Holland <samuel@sholland.org>
2023-10-31 03:40:47 -05:00
Samuel Holland
7c32c66728 spi: sunxi: Hack up the driver for the D1
Signed-off-by: Samuel Holland <samuel@sholland.org>
2023-10-31 03:40:47 -05:00
Samuel Holland
9e824a4cf1 regulator: Don't fail when already enabled
Signed-off-by: Samuel Holland <samuel@sholland.org>
2023-10-31 03:40:47 -05:00
Samuel Holland
a037e04e78 ram: sunxi: Hack up the driver for the D1
Signed-off-by: Samuel Holland <samuel@sholland.org>
2023-10-31 02:48:34 -05:00
Samuel Holland
120219bb05 mmc: sunxi: Hack up the driver for the D1
Signed-off-by: Samuel Holland <samuel@sholland.org>
2023-10-31 02:48:34 -05:00
Samuel Holland
b1107c0e34 clk: sunxi: d1: Set CPU frequency in SPL
Signed-off-by: Samuel Holland <samuel@sholland.org>
2023-10-31 02:48:34 -05:00
Samuel Holland
cf5606cc19 riscv: dts: Add Allwinner D1 devicetrees
This includes the U-boot overlay needed for binman and SPL.

Signed-off-by: Samuel Holland <samuel@sholland.org>
2023-10-31 02:48:34 -05:00
Samuel Holland
08bf21e4b0 riscv: Add CONFIG_TARGET_SUN20I
This target is used for Allwinner's sun20i series of RISC-V SoCs,
starting with the Allwinner D1 and D1s.

Signed-off-by: Samuel Holland <samuel@sholland.org>
2023-10-31 02:48:34 -05:00
Samuel Holland
260b52e2ca sunxi: Move SUNXI_GEN_NCAT2 to the board Kconfig
Generation options mostly deal with peripherals, not the CPU
architecture.

Signed-off-by: Samuel Holland <samuel@sholland.org>
2023-10-31 02:42:06 -05:00
Samuel Holland
ba648449b0 fixup! sunxi: Globally enable SUPPORT_SPL 2023-10-31 02:42:06 -05:00
Samuel Holland
4bee935b14 Merge branch 'bl808/cpu' into allwinner 2023-10-31 02:14:40 -05:00
Samuel Holland
5ee8735a33 Merge branch 'patch/sun8i-emac-gpio' into allwinner 2023-10-31 02:14:37 -05:00
Samuel Holland
b546187a1c Merge branch 'patch/riscv-weak' into allwinner 2023-10-31 02:14:28 -05:00
Samuel Holland
282a5bed00 Merge branch 'patch/riscv-kconfig' into allwinner 2023-10-31 02:14:26 -05:00
Samuel Holland
63d581d7d8 Merge branch 'patch/riscv-align' into allwinner 2023-10-31 02:14:23 -05:00
Samuel Holland
5ad59a7d8c Merge branch 'patch/h3-fit' into allwinner 2023-10-31 02:14:10 -05:00
Samuel Holland
403967b059 Merge branch 'patch/fdt-bounds-check' into allwinner 2023-10-31 02:13:33 -05:00
Samuel Holland
cb3ddfec67 Merge branch 'patch/d1-serial' into allwinner 2023-10-31 02:13:30 -05:00
Samuel Holland
16faf80ac3 Merge branch 'patch/d1-pinctrl' into allwinner 2023-10-31 02:13:28 -05:00
Samuel Holland
4da46aa8ac Merge branch 'patch/d1-mmc' into allwinner 2023-10-31 02:13:25 -05:00
Samuel Holland
9ad90287ae Merge branch 'patch/d1-kconfig' into allwinner 2023-10-31 02:13:18 -05:00
Samuel Holland
f5b523a85d Merge branch 'patch/d1-clk' into allwinner 2023-10-31 02:12:37 -05:00
Samuel Holland
ed8fe4d60e Merge branch 'patch/axp-gpio' into allwinner 2023-10-31 02:12:33 -05:00
Samuel Holland
0ffa433ea6 gpio: axp: Report the correct value for outputs
Signed-off-by: Samuel Holland <samuel@sholland.org>
2023-10-31 01:43:34 -05:00
Samuel Holland
0c91ce4c05 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>
2023-10-31 01:43:34 -05:00
Samuel Holland
071d04bb86 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>
2023-10-31 01:43:34 -05:00
Samuel Holland
eb5333ba3d 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>
2023-10-31 01:43:34 -05:00
Samuel Holland
45f64fb2e3 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>
2023-10-31 01:43:34 -05:00
Samuel Holland
eb95c5ff29 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>
2023-10-31 01:43:34 -05:00
Samuel Holland
7186c1a56f 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>
2023-10-31 01:43:34 -05:00
Samuel Holland
5d44510d79 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>
2023-10-31 01:41:51 -05:00
Samuel Holland
9882140622 gpio: axp: 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.

Series-to: Andre Przywara <andre.przywara@arm.com>
Series-to: Jagan Teki <jagan@amarulasolutions.com>
Series-cc: Chen-Yu Tsai <wens@csie.org>
Series-cc: Hans de Goede <hdegoede@redhat.com>
Series-cc: Icenowy Zheng <icenowy@aosc.xyz>
Series-cc: Maxime Ripard <mripard@kernel.org>
Series-cc: Adam Sampson <ats@offog.org>
Series-cc: Stefan Roese <sr@denx.de>
Series-cc: u-boot@lists.denx.de

Cover-letter:
sunxi: Control USB VBUS supplies via DT regulators
This series converts sunxi boards from controlling VBUS suppllies using
GPIO name strings in Kconfig to using regulator devices probed via the
devicetree. ARCH_SUNXI already implies DM_REGULATOR_FIXED, so the only
new driver needed is for the AXP PMIC drivevbus regulator. This is part
2 of 3 for removing the PHY driver's GPIO Kconfig options. Part 1 was
here[1]. Part 3 will finish converting the VBUS/ID detection GPIOs; it
requires adding some missing DT properties to a couple of boards, so it
will have to wait for at least the next DT sync from Linux.

I tried to verify (by inspection) every board affected by this change,
but there is some possibility that this could break some boards. See the
commit message for patch 3. I have CCed some relevant board maintaners;
please test this patch series if you have the opportunity.

[1]: https://lore.kernel.org/u-boot/20230122234623.1636-1-samuel@sholland.org/
END

Signed-off-by: Samuel Holland <samuel@sholland.org>
2023-10-31 01:39:10 -05:00
Samuel Holland
5d491a7f74 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>
2023-10-31 01:17:09 -05:00
Samuel Holland
5ea3e3e37e phy: sun4i-usb: Control supplies via the 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>
2023-10-31 01:16:50 -05:00
Samuel Holland
1c71f4fd1b 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>
2023-10-31 01:14:02 -05:00
Samuel Holland
967499870f power: regulator: Add a driver for the AXP PMIC drivevbus
AXP PMICs have a pin which can either report the USB VBUS state, or
driving a regulator that supplies USB VBUS. Add a regulator driver for
controlling this pin. The selection between input and output is done via
the x-powers,drive-vbus-en pin on the PMIC (parent) node.

Signed-off-by: Samuel Holland <samuel@sholland.org>
2023-10-31 01:07:16 -05:00
Samuel Holland
5e81022e53 riscv: Weakly define invalidate_icache_range()
Some RISC-V CPUs, such as the T-HEAD XuanTie series, have a
vendor-specific way to invalidate a portion of the instruction cache.
Allow them to override invalidate_icache_range().

Series-to: Rick Chen <rick@andestech.com>
Series-to: Leo <ycliang@andestech.com>
Series-cc: u-boot@lists.denx.de

Signed-off-by: Samuel Holland <samuel@sholland.org>
2023-10-31 00:36:42 -05:00
Samuel Holland
d38cb6f660 riscv: Align the trap handler to 64 bytes
This is required on CPUs which always operate in CLIC mode, such as the
T-HEAD E906 and E907. Per the CLIC specification: "In this mode, the
trap vector base address held in mtvec is constrained to be aligned on a
64-byte or larger power-of-two boundary."

Series-to: Rick Chen <rick@andestech.com>
Series-to: Leo <ycliang@andestech.com>
Series-cc: u-boot@lists.denx.de

Reported-by: Madushan Nishantha <jlmadushan@gmail.com>
Signed-off-by: Samuel Holland <samuel@sholland.org>
2023-10-31 00:35:34 -05:00
Samuel Holland
30f2292d3a riscv: Sort target configs alphabetically
Clean things up for the next time somebody adds a target.

Series-to: Rick Chen <rick@andestech.com>
Series-to: Leo <ycliang@andestech.com>
Series-cc: u-boot@lists.denx.de

Signed-off-by: Samuel Holland <samuel@sholland.org>
2023-10-31 00:31:42 -05:00
Samuel Holland
5b4f8fc6d0 net: sun8i_emac: Drop DM_GPIO checks
DM_GPIO is always enable in U-Boot proper for ARCH_SUNXI, and this
driver is never enabled in SPL, so the condition is always true.

Series-to: sunxi

Signed-off-by: Samuel Holland <samuel@sholland.org>
2023-10-31 00:25:23 -05:00
Samuel Holland
3e52b7216f sunxi: mmc: Move header to the driver directory
The MMC controller driver is (and ought to be) the only user of these
register definitions. Put them in a header next to the driver to remove
the dependency on a specific ARM platform's headers.

Due to the sunxi_mmc_init() prototype, the file was not renamed. None of
the register definitions were changed.

Series-to: sunxi

Signed-off-by: Samuel Holland <samuel@sholland.org>
2023-10-31 00:22:15 -05:00
Samuel Holland
c92012fe8d sunxi: mmc: Sort compatible strings numerically
commit 95168d77d391 ("sunxi: add Allwinner R528/T113 SoC support") added
the new entry out of order.

Signed-off-by: Samuel Holland <samuel@sholland.org>
2023-10-31 00:21:34 -05:00
Samuel Holland
11b7f4963a sunxi: Enable SPL FIT loading for 32-bit SoCs
Now that 32-bit SoCs can load U-Boot proper (and possibly other
firmware) from a FIT, use this method by default. SPL_FIT_IMAGE_TINY is
required to stay within the 24 or 32 KiB SPL size limit on early SoCs;
for consistency, enable it everywhere.

Series-to: Andre Przywara <andre.przywara@arm.com>
Series-to: Jagan Teki <jagan@amarulasolutions.com>
Series-cc: Icenowy Zheng <icenowy@aosc.io>
Series-cc: Jesse Taube <Mr.Bossman075@gmail.com>
Series-cc: u-boot@lists.denx.de

Series-version: 3

Commit-changes: 2
 - New patch for v2, split from the .dtsi changes

Cover-changes: 3
 - Rebased and collected tags

Cover-letter:
sunxi: SPL FIT support for 32-bit sunxi SoCs
This series makes the necessary changes so 32-bit sunxi SoCs can load
additional device trees or firmware from SPL along with U-Boot proper.
Crust (SCP firmware) has support for A33 and H3, and H3 also needs to
load an eGon blob to support CPU 0 hotplug (a silicon bug workaround).

FIT unlocks more features (signatures, multiple DTBs, etc.), so enable
it by default. A10 (sun4i) only has 24 KiB of SRAM A1, so it needs
SPL_FIT_IMAGE_TINY. For consistency, enable that option everywhere.

After this series is applied, we can increase SPL_MAX_SIZE for H6 and
newer SoCs, both 32-bit (e.g. A50, T113) and 64-bit. I did not do that
yet because there is some discussion to be had about the correct value:
it must be adjusted to guarantee return-to-FEL functionality, and the
exact adjustment depends on the sunxi-fel tool implementation.
END

Signed-off-by: Samuel Holland <samuel@sholland.org>
2023-10-31 00:14:52 -05:00
Samuel Holland
50ec5566a9 sunxi: binman: Support FIT generation for 32-bit SoCs
Some 32-bit SoCs can use SCP firmware to implement additional PSCI
functionality, such as system suspend. In order to load this firmware
from SPL, we need to generate and use a FIT instead of a legacy image.

Adjust the binman FIT definition so it does not rely on TF-A BL31, as
this is not used on 32-bit SoCs. Instead, after loading the firmware,
U-Boot proper is executed directly.

Series-changes: 2
 - Rely on binman min-size instead of using explicit offsets
 - Use Kconfig for firmware addresses instead of an #ifdef staircase

Signed-off-by: Samuel Holland <samuel@sholland.org>
2023-10-31 00:13:53 -05:00
Samuel Holland
fa31297e5f sunxi: binman: Move BL31 and SCP firmware addresses to Kconfig
This is easier to read than the #ifdef staircase, provides better
visibility into the memory map (alongside the other Kconfig
definitions), and allows these addresses to be reused from code.

Commit-changes: 2
 - New patch for v2, split from the .dtsi changes

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Samuel Holland <samuel@sholland.org>
2023-10-31 00:13:45 -05:00
Samuel Holland
0617377a25 serial: ns16550: Enable clocks during probe
If the UART bus or baud clock has a gate, it must be enabled before the
UART can be used.

Series-to: Tom Rini <trini@konsulko.com>
Series-cc: Stefan Roese <sr@denx.de>
Series-cc: Simon Glass <sjg@chromium.org>
Series-cc: u-boot@lists.denx.de

Series-prefix: RESEND
Series-version: 3

Series-changes: 2
 - Only enable the first clock, as using the clk_get_bulk() API pushes
   a board (phycore-rk3288) over its SPL size limit.

Series-changes: 3
 - Switch back to the original patch, now that the phycore-rk3288 build
   is fixed by enabling LTO.

Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Samuel Holland <samuel@sholland.org>
2023-10-31 00:02:19 -05:00
Samuel Holland
10fa64ec08 pinctrl: sunxi: Avoid using .bss for SPL
sunxi platforms put .bss in DRAM, so .bss is not available in SPL before
DRAM controller initialization. Therefore, this buffer must be placed in
the .data section.

Series-to: sunxi

Signed-off-by: Samuel Holland <samuel@sholland.org>
2023-10-30 23:56:53 -05:00