Repository navigation
allwinner: add the V3s and V851s - #72
Conversation
The -mmc images of the V3s and V851s hung before the console after an SD boot: the SPI flash fallback in env_get_location() was the V831's only, so env_init() found no location. It now applies with OPENIPC, whose images all keep the environment in the SPI NOR; other sunxi boards are unaffected, as before. v83x_boot_source() (source=fatload mmc 0 after an SD boot, not saved) moves to board.c as openipc_boot_source(), for every SoC.
Two more Allwinner camera SoCs, built as the V831/V833 are: an SPL and an LZMA U-Boot in the 256 KiB boot partition, the OpenIPC environment in the SPI NOR, -nor and -mmc images (build.sh v3s v851s). V3s: mainline's MACH_SUN8I_V3S and its DRAM driver as they are. Added: the SPI NOR SPL (the H3's SPI0), the EMAC and its internal PHY (sun8i_emac's V3s compatible, the EMAC/EPHY gates and resets in clk_v3s.c), sun8i-v3s-openipc.dts. V851s: the D1/T113 generation backported from mainline (2023-2024) as far as U-Boot uses it, alongside the SUN50I_GEN_H6 conditions as mainline has them: - SUNXI_GEN_NCAT2 and its memory map (cpu_sunxi_ncat2.h); clocks (PLL_CPU LDO, PLL_PERI0 P0, no AHB3, no resistor calibration); MMC calibration and new mode; the watchdog's 0x16AA key; - SUNXI_NEW_PINCTRL: PIO banks 0x30 apart, 4-bit drive fields; - the SPL's SPI0 at 0x04025000 on PC0-PC5, without the controller divider; spi-sunxi's R329 variant (no divider, normal sampling); - DRAM: dram_sun20i_d1.c as OpenIPC's hardware-tested V851s U-Boot (mainline 2024.10) carries it, non-DM, with its parameters as the Kconfig defaults; - sun8i-v851s.dtsi with what U-Boot uses (the CCU's gates are the H6's); the kernel is entered in HYP with PSCI from psci_v831.c. Shared: include/configs/v83x.h becomes openipc-sunxi.h (the DDR size per SoC); the SoC, device tree, PSCI and SPL stack move to the per-SoC fragments; ATAGs are built in for the kernels with an appended device tree; BINMAN is off with OPENIPC. Under qemu-bench every SoC's -nor and -mmc image passes the two-boot smoke test and reset; the SD unbricking path (run ub, then the NOR alone) works on the V3s and V851s. The V851s's DRAM, CCU and PRCM registers equal those left by the published OpenIPC u-boot-v851s-nor.bin (SMHC0's clock aside: this U-Boot probes the card), and the published OpenIPC V851s kernel and rootfs boot to a shell from the NOR and reboot.
PR Summary by QodoAdd OpenIPC boot images for Allwinner V3s and V851s
AI Description
Diagram
High-Level Assessment
Files changed (45)
|
Code Review by Qodo
1.
|
…PLL_DDR - The PSCI monitor stayed in relocated U-Boot at the top of the DDR, reserved only in a device tree; the V851s kernels boot with ATAGs. Their own tree keeps that region no-map (the RISC-V core's), but that is the RISC-V firmware's place. HAS_ARMV7_SECURE_BASE now copies it to SRAM A1 at 0x38000 (32 KiB, free once the SPL is done; U-Boot's early stack is below 0x28000). - spi-sunxi's R329 variant skipped sun4i_spi_set_speed_mode() whole, and with it CPOL/CPHA: only the divider is skipped now. - SUNXI_GPIO_DISABLE is 0xf with the new pinctrl layout (7 is a function there): the SPL's spi0_deinit() and pinctrl's status use it. - dram_sun20i_d1.c set bit 27, the output enable, on PLL_CPU's register after locking PLL_DDR (as mainline and awboot do; PLL_DDR's is set at reset, so it worked): PLL_DDR's now. clock_get_pll6() keeps mainline's NCAT2 m = 1 (see the PR). Every image passes the smoke test and reset again; the V851s kernel boots to a shell with the monitor in SRAM, and reboots.
Adds the V3s and V851s to
openipc-allwinner, built the same way as the V831/V833. Each SoC gets an SPL plus an LZMA U-Boot inside the 256 KiB boot partition, with the OpenIPC environment in the SPI NOR, asu-boot-<soc>-nor.binandu-boot-<soc>-mmc.bin(SD unbricking).bash build.shnow buildsv3s v831 v833 v851s.dram_sunxi_dw.cSUNXI_GEN_NCAT2)dram_sun20i_d1.cV3s: mainline's
MACH_SUN8I_V3Sand its DRAM driver as they are. This PR adds:sun8i_emac, and the EMAC/EPHY gates inclk_v3s.c;sun8i-v3s-openipc.dts.V851s: the D1 generation, backported from mainline 2023-2024 only as far as U-Boot uses it, next to the
SUN50I_GEN_H6conditions as mainline has them:0x04025000on PC0-PC5, plusspi-sunxi's R329 variant (no divider inside the controller);The DRAM driver is the copy carried by OpenIPC/u-boot-allwinner's hardware-tested V851s U-Boot, made non-DM, with its parameters as the Kconfig defaults.
Shared changes:
v83x.hbecomesopenipc-sunxi.h.SUPPORT_PASSING_ATAGS); without it bootm panics.OPENIPC, the SPI-flash env fallback andsource=fatload mmc 0after an SD boot now apply to every SoC. The V3s/V851s-mmcimages hung before the console without them.Verified under qemu-bench (machines from OpenIPC/qemu-bench#205):
-norand-mmcimage: the environment is saved and read back, andresetworks.run ubfrom the card onto an erased NOR, then a boot from the NOR alone.u-boot-v851s-nor.bin, the DRAM COM/PHY, CCU and PRCM registers are equal. The only difference is SMHC0's clock, because this U-Boot probes the card.uImage.v851s+rootfs.squashfs.v851sboot from the NOR to a shell (HYP, ATAGs, root onmtdblock3), andreboot -fcomes back through the SPL.Not run on a camera yet. For that reason the CI PR does not publish the V851s images over OpenIPC/firmware's camera-tested
u-boot-v851s-nor.bin. No OpenIPC V3s firmware exists to boot.