Skip to contentSkip to conversation

Initial support for Allwinner A64 SoC

PATCH Applied Jules Maselbas 2 participants 8 messages Feb 12, 2025 – Feb 14, 2025

Subsystems (7)
lore
Share & tools
lore
#0 lore raw

v3 cover Initial support for Allwinner A64 SoC

This series adds an initial support for Allwinner, currently only targetting the Pine64+ board, based on the A64 SoC.

This first series is intented as a second boot image only, that can be started from u-boot. This series provides the bare minimal for barebox to load the next OS from sd/mmc.

v2 highlights:
The main change in the V2 series is the new "one-size fit all" clk driver only used right for the mmc0/mmc1/mmc2 clock source (composite with a gate, a mux, two divs plus a fixed post-div).

v3 highlights:
Rework of the timeouts in the mci driver.
Split the lowlevel documentation out of this serie and added a user documentation instead.
Replaced the sunxi_v8_defconfig with the multi_v8_defconfig

Jules Maselbas (6):
clk: divider: add error code propagation
clk: Add clock driver for sun50i-a64
pinctrl: Add sun50i-a64 pinctrl driver
mci: Add sunxi-mmc driver
ARM: sunxi: Introduce mach-sunxi
Documentation: sunxi: Add some documentation

 Documentation/boards/sunxi.rst             | 116 ++++
 arch/arm/Kconfig                           |  12 +
 arch/arm/Makefile                          |   1 +
 arch/arm/configs/multi_v8_defconfig        |   2 +
 arch/arm/mach-sunxi/Kconfig                |  13 +
 arch/arm/mach-sunxi/Makefile               |   1 +
 drivers/clk/Makefile                       |   1 +
 drivers/clk/clk-divider.c                  |   4 +-
 drivers/clk/sunxi/Makefile                 |   3 +
 drivers/clk/sunxi/clk-sun50i-a64.c         | 294 ++++++++++
 drivers/clk/sunxi/clk-sun50i-a64.h         |  62 +++
 drivers/clk/sunxi/clk-sunxi.c              | 348 ++++++++++++
 drivers/clk/sunxi/clk-sunxi.h              |  79 +++
 drivers/mci/Kconfig                        |   6 +
 drivers/mci/Makefile                       |   2 +
 drivers/mci/sunxi-mmc-common.c             | 238 +++++++++
 drivers/mci/sunxi-mmc-pbl.c                |  81 +++
 drivers/mci/sunxi-mmc.c                    | 176 ++++++
 drivers/mci/sunxi-mmc.h                    | 222 ++++++++
 drivers/pinctrl/Kconfig                    |   2 +
 drivers/pinctrl/Makefile                   |   1 +
 drivers/pinctrl/sunxi/Kconfig              |  13 +
 drivers/pinctrl/sunxi/Makefile             |   3 +
 drivers/pinctrl/sunxi/pinctrl-sun50i-a64.c | 594 +++++++++++++++++++++
 drivers/pinctrl/sunxi/pinctrl-sunxi.c      | 369 +++++++++++++
 drivers/pinctrl/sunxi/pinctrl-sunxi.h      | 224 ++++++++
 include/mach/sunxi/xload.h                 |  12 +
 27 files changed, 2878 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/boards/sunxi.rst
 create mode 100644 arch/arm/mach-sunxi/Kconfig
 create mode 100644 arch/arm/mach-sunxi/Makefile
 create mode 100644 drivers/clk/sunxi/Makefile
 create mode 100644 drivers/clk/sunxi/clk-sun50i-a64.c
 create mode 100644 drivers/clk/sunxi/clk-sun50i-a64.h
 create mode 100644 drivers/clk/sunxi/clk-sunxi.c
 create mode 100644 drivers/clk/sunxi/clk-sunxi.h
 create mode 100644 drivers/mci/sunxi-mmc-common.c
 create mode 100644 drivers/mci/sunxi-mmc-pbl.c
 create mode 100644 drivers/mci/sunxi-mmc.c
 create mode 100644 drivers/mci/sunxi-mmc.h
 create mode 100644 drivers/pinctrl/sunxi/Kconfig
 create mode 100644 drivers/pinctrl/sunxi/Makefile
 create mode 100644 drivers/pinctrl/sunxi/pinctrl-sun50i-a64.c
 create mode 100644 drivers/pinctrl/sunxi/pinctrl-sunxi.c
 create mode 100644 drivers/pinctrl/sunxi/pinctrl-sunxi.h
 create mode 100644 include/mach/sunxi/xload.h
Signature · 1 line
2.48.1
#1 lore raw

PATCH v3 1/6 clk: divider: add error code propagation

divider_get_val can return a negative error code and should not be used as a valid divider.

---
v1->v2:
- changed value to int and removed ret variable (Ahmad)
v2->v3: no change

 drivers/clk/clk-divider.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/clk/clk-divider.c +3 -1
index ccab70aecc..b0df34e858 100644
@@ -307,7 +307,7 @@ static int clk_divider_set_rate(struct clk_hw *hw, unsigned long rate,
 {
 	struct clk *clk = clk_hw_to_clk(hw);
 	struct clk_divider *divider = to_clk_divider(hw);
-	unsigned int value;
+	int value;
 	u32 val;
 
 	if (divider->flags & CLK_DIVIDER_READ_ONLY)
@@ -322,6 +322,8 @@ static int clk_divider_set_rate(struct clk_hw *hw, unsigned long rate,
 
 	value = divider_get_val(rate, parent_rate, divider->table,
 				divider->width, divider->flags);
+	if (value < 0)
+		return value;
 
 	val = readl(divider->reg);
 	val &= ~(clk_div_mask(divider->width) << divider->shift);
Signature · 1 line
2.48.1
#2 lore raw

PATCH v3 2/6 clk: Add clock driver for sun50i-a64

In reply to Jules Maselbas

Adds a "one size fit all" clock driver to be used for complex "composite" clock, composed of: a gate, a mux and severals dividers. This clk driver could be used to make SoC specific drivers easier to port from linux sources, but this is not the case yet.

The pll-cpux is set to 816MHz and pll-periph0-2x is set to 1.2GHz.

---
v1->v2:
- adds a new "one size fit all" clock driver
v2->v3:
- add volatile on nop_delay counter (Ahmad)
- removed trailing comma of clk_div_table div_apb1[] (Ahmad)

 drivers/clk/Makefile               |   1 +
 drivers/clk/sunxi/Makefile         |   3 +
 drivers/clk/sunxi/clk-sun50i-a64.c | 294 ++++++++++++++++++++++++
 drivers/clk/sunxi/clk-sun50i-a64.h |  62 +++++
 drivers/clk/sunxi/clk-sunxi.c      | 348 +++++++++++++++++++++++++++++
 drivers/clk/sunxi/clk-sunxi.h      |  79 +++++++
 6 files changed, 787 insertions(+)
 create mode 100644 drivers/clk/sunxi/Makefile
 create mode 100644 drivers/clk/sunxi/clk-sun50i-a64.c
 create mode 100644 drivers/clk/sunxi/clk-sun50i-a64.h
 create mode 100644 drivers/clk/sunxi/clk-sunxi.c
 create mode 100644 drivers/clk/sunxi/clk-sunxi.h
drivers/clk/Makefile +1 -0
index 8c3544c750..4fda2c1e0d 100644
@@ -25,6 +25,7 @@ obj-$(CONFIG_ARCH_LAYERSCAPE)	+= clk-qoric.o
 obj-y				+= analogbits/
 obj-$(CONFIG_CLK_SIFIVE)	+= sifive/
 obj-$(CONFIG_SOC_STARFIVE)	+= starfive/
+obj-$(CONFIG_ARCH_SUNXI)	+= sunxi/
 obj-$(CONFIG_COMMON_CLK_STM32F)		+= clk-stm32f4.o
 obj-$(CONFIG_MACH_RPI_COMMON)	+= clk-rpi.o
 obj-y				+= bcm/
drivers/clk/sunxi/Makefile new file +3 -0
new file mode 100644
index 0000000000..1c2214a2bc
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
+obj-y += clk-sunxi.o
+obj-$(CONFIG_ARCH_SUN50I_A64) += clk-sun50i-a64.o
drivers/clk/sunxi/clk-sun50i-a64.c new file +294 -0

294 lines not on this page · raw message

drivers/clk/sunxi/clk-sun50i-a64.h new file +62 -0

62 lines not on this page · raw message

drivers/clk/sunxi/clk-sunxi.c new file +348 -0

348 lines not on this page · raw message

drivers/clk/sunxi/clk-sunxi.h new file +79 -0

79 lines not on this page · raw message

Signature · 1 line
2.48.1
#3 lore raw

PATCH v3 3/6 pinctrl: Add sun50i-a64 pinctrl driver

In reply to Jules Maselbas

sunxi pinctrl driver, adapted from Linux, is split in two parts:
- pinctrl-sunxi.c that implements gpio, pinctrl and pinmux functions
- pinctrl-sun50i-a64.c that declare sun50i pins and their functions. This file only require minor adaptations and be easily copied from Linux.

The pin functions are needed for uart, SD/MMC, and likely for other controllers too.

---
v1->v2:
- removed !IS_ENABLED(CONFIG_PINCTRL) (Sacha)
v2->v3:
- use %pOF to print device-tree node full_name (Ahmad)

 drivers/pinctrl/Kconfig                    |   2 +
 drivers/pinctrl/Makefile                   |   1 +
 drivers/pinctrl/sunxi/Kconfig              |  13 +
 drivers/pinctrl/sunxi/Makefile             |   3 +
 drivers/pinctrl/sunxi/pinctrl-sun50i-a64.c | 594 +++++++++++++++++++++
 drivers/pinctrl/sunxi/pinctrl-sunxi.c      | 369 +++++++++++++
 drivers/pinctrl/sunxi/pinctrl-sunxi.h      | 224 ++++++++
 7 files changed, 1206 insertions(+)
 create mode 100644 drivers/pinctrl/sunxi/Kconfig
 create mode 100644 drivers/pinctrl/sunxi/Makefile
 create mode 100644 drivers/pinctrl/sunxi/pinctrl-sun50i-a64.c
 create mode 100644 drivers/pinctrl/sunxi/pinctrl-sunxi.c
 create mode 100644 drivers/pinctrl/sunxi/pinctrl-sunxi.h
drivers/pinctrl/Kconfig +2 -0
index ee15acdcdb..72ca79aa98 100644
@@ -106,6 +106,8 @@ config PINCTRL_STM32
 	select HAVE_GPIO_PINCONF
 	help
 	  Pinmux and GPIO controller found on STM32 family
+
+source "drivers/pinctrl/sunxi/Kconfig"
 endif
 
 endmenu
drivers/pinctrl/Makefile +1 -0
index f1a5fa5715..3bc718d355 100644
@@ -16,3 +16,4 @@ obj-$(CONFIG_PINCTRL_VF610) += pinctrl-vf610.o
 obj-$(CONFIG_PINCTRL_STM32) += pinctrl-stm32.o
 
 obj-$(CONFIG_ARCH_MVEBU) += mvebu/
+obj-$(CONFIG_ARCH_SUNXI) += sunxi/
drivers/pinctrl/sunxi/Kconfig new file +13 -0
new file mode 100644
index 0000000000..38d8894a7e
@@ -0,0 +1,13 @@
+# SPDX-License-Identifier: GPL-2.0-only
+if ARCH_SUNXI
+
+config PINCTRL_SUNXI
+	bool
+	select GPIOLIB
+
+config PINCTRL_SUN50I_A64
+	bool "Support for Allwinner A64 PIO"
+	default ARCH_SUNXI
+	select PINCTRL_SUNXI
+
+endif
drivers/pinctrl/sunxi/Makefile new file +3 -0
new file mode 100644
index 0000000000..db0ff5b50b
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0
+obj-$(CONFIG_ARCH_SUNXI)		+= pinctrl-sunxi.o
+obj-$(CONFIG_PINCTRL_SUN50I_A64)	+= pinctrl-sun50i-a64.o
drivers/pinctrl/sunxi/pinctrl-sun50i-a64.c new file +594 -0

594 lines not on this page · raw message

drivers/pinctrl/sunxi/pinctrl-sunxi.c new file +369 -0

369 lines not on this page · raw message

drivers/pinctrl/sunxi/pinctrl-sunxi.h new file +224 -0

224 lines not on this page · raw message

Signature · 1 line
2.48.1
#4 lore raw

PATCH v3 4/6 mci: Add sunxi-mmc driver

In reply to Jules Maselbas

This driver is adapted from different sources: Linux, u-boot and p-boot. The latter, p-boot (forked from u-boot), is a bootloader for pinephones.

It currently only support PIO xfer but could be further improved to also support DMA xfer. This driver is split in three files so it can be used by the PBL and barebox proper.

---
v1->v2:
- removed the /2 on the clk source (this is in fact done by the clk source)
- convert to gpiod (Ahmad)
v2->v3:
- reduced all the timeouts to 1000ms max
- make used of mci_cmd::busy_timeout (Ahmad)
- removed a duplicated wait on card busy stat

 drivers/mci/Kconfig            |   6 +
 drivers/mci/Makefile           |   2 +
 drivers/mci/sunxi-mmc-common.c | 238 +++++++++++++++++++++++++++++++++
 drivers/mci/sunxi-mmc-pbl.c    |  81 +++++++++++
 drivers/mci/sunxi-mmc.c        | 176 ++++++++++++++++++++++++
 drivers/mci/sunxi-mmc.h        | 222 ++++++++++++++++++++++++++++++
 include/mach/sunxi/xload.h     |  12 ++
 7 files changed, 737 insertions(+)
 create mode 100644 drivers/mci/sunxi-mmc-common.c
 create mode 100644 drivers/mci/sunxi-mmc-pbl.c
 create mode 100644 drivers/mci/sunxi-mmc.c
 create mode 100644 drivers/mci/sunxi-mmc.h
 create mode 100644 include/mach/sunxi/xload.h
drivers/mci/Kconfig +6 -0
index f760614725..4641e9cdcd 100644
@@ -92,6 +92,12 @@ config MCI_DW_PIO
 	help
 	  Use PIO mode (instead of IDMAC) in DW MMC driver.
 
+config MCI_SUNXI_SMHC
+	bool "Allwinner SD-MMC Memory Card Host Controller"
+	help
+	  Enable support for the Allwinner SD-MMC Memory Card Host Controller,
+	  this provides host support for SD and MMC interfaces, in PIO mode.
+
 config MCI_MXS
 	bool "i.MX23/i.MX28"
 	depends on ARCH_MXS
drivers/mci/Makefile +2 -0
index d8d7818a48..5e951d695f 100644
@@ -22,4 +22,6 @@ obj-$(CONFIG_MCI_DW)		+= dw_mmc.o
 obj-$(CONFIG_MCI_DWC_MSHC)	+= dwcmshc-sdhci.o
 obj-$(CONFIG_MCI_MMCI)		+= mmci.o
 obj-$(CONFIG_MCI_STM32_SDMMC2)	+= stm32_sdmmc2.o
+obj-$(CONFIG_MCI_SUNXI_SMHC)	+= sunxi-mmc.o
+pbl-$(CONFIG_MCI_SUNXI_SMHC)	+= sunxi-mmc-pbl.o
 obj-pbl-$(CONFIG_MCI_SDHCI)	+= sdhci.o
drivers/mci/sunxi-mmc-common.c new file +238 -0

238 lines not on this page · raw message

drivers/mci/sunxi-mmc-pbl.c new file +81 -0

81 lines not on this page · raw message

drivers/mci/sunxi-mmc.c new file +176 -0

176 lines not on this page · raw message

drivers/mci/sunxi-mmc.h new file +222 -0

222 lines not on this page · raw message

include/mach/sunxi/xload.h new file +12 -0
new file mode 100644
index 0000000000..f978db4951
@@ -0,0 +1,12 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#ifndef __MACH_XLOAD_H
+#define __MACH_XLOAD_H
+
+#include <linux/compiler.h>
+#include <pbl/bio.h>
+
+int sunxi_mmc_bio_init(struct pbl_bio *bio, void __iomem *base,
+		       unsigned int clock, unsigned int slot);
+
+#endif
Signature · 1 line
2.48.1
#5 lore raw

PATCH v3 5/6 ARM: sunxi: Introduce mach-sunxi

In reply to Jules Maselbas

Add some boilerplate, Makefiles, Kbuild.
A generic barebox-dt-2nd.img image can be build for A64 SoC using the multi_v8_defconfig.

This image can be booted from u-boot and has been tested on Pine64+, it should work on other A64 SoC such as the pinephone, and other Pine64 boards, it might also work on H6 SoC which uses the same sd/mmc controler.

---
v1->v2:
- removed RELOCATABLE and HAVE_PBL_MULTI_IMAGES from Kconfig (Ahmad)
- used __dummy__.o insead of an empty file (Ahmad)
- removed include/mach/sunxi/barebox-arm.h (Ahmad)
v2->v3:
- add arch sun50i-a64 + mci driver to the multi_v8_defconfig (Sascha)
- remove the sunxi_v8_defconfig

 arch/arm/Kconfig                    | 12 ++++++++++++
 arch/arm/Makefile                   |  1 +
 arch/arm/configs/multi_v8_defconfig |  2 ++
 arch/arm/mach-sunxi/Kconfig         | 13 +++++++++++++
 arch/arm/mach-sunxi/Makefile        |  1 +
 5 files changed, 29 insertions(+)
 create mode 100644 arch/arm/mach-sunxi/Kconfig
 create mode 100644 arch/arm/mach-sunxi/Makefile
arch/arm/Kconfig +12 -0
index 2e52ed7b50..3d8f2eeca7 100644
@@ -173,6 +173,17 @@ config ARCH_K3
 	select COMMON_CLK_OF_PROVIDER
 	select PM_GENERIC_DOMAINS
 
+config ARCH_SUNXI
+	bool "Allwinner (sunxi) SoCs"
+	depends on ARCH_MULTIARCH
+	select CLKDEV_LOOKUP
+	select COMMON_CLK
+	select COMMON_CLK_OF_PROVIDER
+	select GPIOLIB
+	select OFDEVICE
+	select OFTREE
+	select PINCTRL
+
 config ARCH_LAYERSCAPE
 	bool "NXP Layerscape based"
 	depends on ARCH_MULTIARCH
@@ -259,6 +270,7 @@ source "arch/arm/mach-omap/Kconfig"
 source "arch/arm/mach-pxa/Kconfig"
 source "arch/arm/mach-rockchip/Kconfig"
 source "arch/arm/mach-socfpga/Kconfig"
+source "arch/arm/mach-sunxi/Kconfig"
 source "arch/arm/mach-stm32mp/Kconfig"
 source "arch/arm/mach-versatile/Kconfig"
 source "arch/arm/mach-vexpress/Kconfig"
arch/arm/Makefile +1 -0
index 270f5dfdc1..e4041cf715 100644
@@ -102,6 +102,7 @@ machine-$(CONFIG_ARCH_ROCKCHIP)		+= rockchip
 machine-$(CONFIG_ARCH_SAMSUNG)		+= samsung
 machine-$(CONFIG_ARCH_SOCFPGA)		+= socfpga
 machine-$(CONFIG_ARCH_STM32MP)		+= stm32mp
+machine-$(CONFIG_ARCH_SUNXI)		+= sunxi
 machine-$(CONFIG_ARCH_VERSATILE)	+= versatile
 machine-$(CONFIG_ARCH_VEXPRESS)		+= vexpress
 machine-$(CONFIG_ARCH_TEGRA)		+= tegra
arch/arm/configs/multi_v8_defconfig +2 -0
index 20bd0575f5..b1e66e85f4 100644
@@ -3,6 +3,7 @@ CONFIG_ARCH_IMX=y
 CONFIG_ARCH_K3=y
 CONFIG_ARCH_LAYERSCAPE=y
 CONFIG_ARCH_ROCKCHIP=y
+CONFIG_ARCH_SUN50I_A64=y
 CONFIG_ARCH_ZYNQMP=y
 CONFIG_MACH_KOENIGBAUER_ALPHAJET=y
 CONFIG_MACH_INNOCOMM_WB15=y
@@ -207,6 +208,7 @@ CONFIG_MCI=y
 CONFIG_MCI_MMC_BOOT_PARTITIONS=y
 CONFIG_MCI_DW=y
 CONFIG_MCI_ROCKCHIP_DWCMSHC=y
+CONFIG_MCI_SUNXI_SMHC=y
 CONFIG_MCI_IMX_ESDHC=y
 CONFIG_MCI_ARASAN=y
 CONFIG_COMMON_CLK_SCMI=y
arch/arm/mach-sunxi/Kconfig new file +13 -0
new file mode 100644
index 0000000000..4fdd0877bf
@@ -0,0 +1,13 @@
+menu "Allwinner (sunxi) boards"
+        depends on ARCH_SUNXI
+
+config ARCH_SUN50I_A64
+	bool "Allwinner A64 SoC"
+	select CPU_V8
+	select CPU_SUPPORTS_64BIT_KERNEL
+	select CLOCKSOURCE_ARM_ARCHITECTED_TIMER
+	select PINCTRL_SUN50I_A64
+	depends on 64BIT
+	default y
+
+endmenu
arch/arm/mach-sunxi/Makefile new file +1 -0
new file mode 100644
index 0000000000..16a218658a
@@ -0,0 +1 @@
+obj- := __dummy__.o
Signature · 1 line
2.48.1
#6 lore raw

PATCH v3 6/6 Documentation: sunxi: Add some documentation

In reply to Jules Maselbas

Add some user documentation on how to build a second stage barebox image, and how to boot from u-boot.

---
 Documentation/boards/sunxi.rst | 116 +++++++++++++++++++++++++++++++++
 1 file changed, 116 insertions(+)
 create mode 100644 Documentation/boards/sunxi.rst
Documentation/boards/sunxi.rst new file +116 -0
new file mode 100644
index 0000000000..8d00507434
@@ -0,0 +1,116 @@
+.. SPDX-License-Identifier: GPL-2.0+
+
+Allwinner sunxi
+===============
+
+Boot process
+------------
+
+On power-up Allwinner SoC starts in boot ROM, aka BROM, which will search
+for a bootable image (eGON header): first from the SD card, then from eMMC.
+If no image is found then the boot ROM will enter into FEL mode that can be
+used for programming and recovery through USB.
+
+Some board may have a button to enter FEL mode at startup. If not, another
+way to enter FEL mode is to not have a valid bootable eGON image, this can
+be achieved by erasing existing eGON image headers.
+
+.. note::
+
+   Currently Barebox cannot boot directly on Allwinner sunxi SoC and can
+   only be used as a secondary bootloader, requiring u-boot to initialize
+   the SDRAM controller and starting the TF-A and optionally Crust.
+
+
+Building barebox second stage
+-----------------------------
+
+The generic ``barebox-dt-2nd.img`` armv8 image should enable all the needed
+drivers.
+
+To build the image do:
+
+.. code-block:: sh
+
+  export ARCH=arm CROSS_COMPILE=aarch64-linux-gnu-
+  make multi_v8_defconfig
+  make
+
+Installing barebox second stage
+-------------------------------
+
+Copy the built ``barebox-dt-2nd.img`` image into the first fat partition
+of the boot medium.
+
+.. code-block:: sh
+
+  # mount /dev/sdX1 /mnt/${mount_dir}
+  # cp ${build_dir}/images/barebox-dt-2nd.img /mnt/${mount_dir}
+  # umount /mnt/${mount_dir}
+
+
+Booting barebox from U-Boot
+---------------------------
+
+Currently Barebox can only be started as a second stage, and relies on
+U-Boot for the SDRAM initialisation and to start the TF-A.
+
+.. code-block:: console
+
+  # on u-boot console, `mmc 0:1` is the first partition on the sd card
+  fatload mmc 0:1 0x42000000 barebox-dt-2nd.img
+  fatload mmc 0:1 0x44000000 dtbs-lts/allwinner/sun50i-a64-pine64-plus.dtb
+  booti 0x42000000 - 0x44000000
+
+.. note::
+
+   A FIT image might be built and used instead of directly using the `barebox-dt-2nd.img`,
+   this hasn't been tested yet, but using a FIT image sound like a better option.
+
+See also the general documentation on :ref:`second_stage`.
+
+Building Arm Trusted Firmware (TF-A)
+------------------------------------
+
+.. note::
+
+   This step is currently only needed when building U-Boot.
+   This step is also documented in U-Boot documention.
+
+Boards using a 64-bit Soc (A64, H5, H6, H616, R329) require the BL31 stage of
+the Arm Trusted Firmware-A firmware. This provides the reference
+implementation of secure software for Armv8-A, offering PSCI and SMCCC
+services. Allwinner support is fully mainlined. To build bl31.bin:
+
+.. code-block:: sh
+
+  git clone https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git
+  cd trusted-firmware-a
+  make CROSS_COMPILE=aarch64-linux-gnu- PLAT=sun50i_a64 DEBUG=1
+  cp build/sun50i_a64/debug/bl31.bin ${barebox_dir}/firmware/sun50i-a64-bl31.bin
+
+The target platform (``PLAT=``) for A64 and H5 SoCs is sun50i_a64, for the H6
+sun50i_h6, for the H616 sun50i_h616, and for the R329 sun50i_r329.
+
+Building U-Boot image
+---------------------
+
+Please refere to the relevant U-Boot_ build documentation (or ``/doc/board/allwinner/sunxi.rst`` in u-boot src tree).
+
+.. _U-Boot: https://docs.u-boot.org/en/latest/board/allwinner/sunxi.html#building-the-u-boot-image
+
+
+Installing the first stage bootloader
+-------------------------------------
+
+Installing on a (micro-) SD card
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+The bootable image, a eGON header followed by the actual image, must be
+located at the fixed offset of 8192 bytes (8KB) from the start of the
+disk (sector 16).
+
+.. code-block:: sh
+
+  # copy the bootable fsbl image (including eGON header) into disk sdX
+  dd if=${fsbl.img} of=/dev/sdX bs=512 seek=16
Signature · 1 line
2.48.1
Applied
#7 lore raw
In reply to Jules Maselbas
Quoted 8 lines · Jules Maselbas

This series adds an initial support for Allwinner, currently only targetting the Pine64+ board, based on the A64 SoC.

This first series is intented as a second boot image only, that can be started from u-boot. This series provides the bare minimal for barebox to load the next OS from sd/mmc.

[...]

Applied, thanks!

[1/6] clk: divider: add error code propagation
https://git.pengutronix.de/cgit/barebox/commit/?id=2faf9ac88f41 (link may not be stable)
[2/6] clk: Add clock driver for sun50i-a64
https://git.pengutronix.de/cgit/barebox/commit/?id=8a8afdc9afe0 (link may not be stable)
[3/6] pinctrl: Add sun50i-a64 pinctrl driver
https://git.pengutronix.de/cgit/barebox/commit/?id=199f3e78b059 (link may not be stable)
[4/6] mci: Add sunxi-mmc driver
https://git.pengutronix.de/cgit/barebox/commit/?id=085180b15e4c (link may not be stable)
[5/6] ARM: sunxi: Introduce mach-sunxi
https://git.pengutronix.de/cgit/barebox/commit/?id=da8c77923696 (link may not be stable)
[6/6] Documentation: sunxi: Add some documentation

      https://git.pengutronix.de/cgit/barebox/commit/?id=0429625f4d83 (link may not be stable)

Best regards,

Signature · 1 line
Sascha Hauer <[email protected]>