diff mbox series

[OpenWrt-Devel,7/9] sunxi: a53: add support for Olimex A64-Olinuxino eMMC

Message ID 20200318222713.1495-8-ynezz@true.cz
State Accepted
Delegated to: Petr Štetiar
Headers show
Series sunxi: add support for Olimex A64-Olinuxino | expand

Commit Message

Petr Štetiar March 18, 2020, 10:27 p.m. UTC
Specifications:

 SoC: Allwinner A64 (1.2 GHz Quad-Core ARM Cortex-A53 64-bit)
 RAM: 1GB or 2GB RAM DDR3L @ 672Mhz
 Flash: 0/4/16GB eMMC flash memory for storage and boot
 MicroSD card connector for cards up to 32GB
 Debug: serial UART debug header with 0.1" pins
 Wired connectivity: 10/100/1000Mbps GbE Ethernet
 Wireless connectivity: on-board RTL8723BS 1T1R 802.11bgn WiFi and
                        Bluetooth 4.0 module with built-in antenna
                        (only available in the A64-OLinuXino-1G4GW)

Flashing instructions:

 Standard sunxi SD card installation procedure - copy eMMC image to SD
 card, insert in into SD card slot on the device and boot. You should see
 something like following if the eMMC is detected correctly:

  mmcblk2: mmc2:0001 P1XXXX 3.60 GiB
  mmcblk2boot0: mmc2:0001 P1XXXX partition 1 16.0 MiB
  mmcblk2boot1: mmc2:0001 P1XXXX partition 2 16.0 MiB

 Then flash SD card eMMC image straight into the mmcblk2 device:

  dd if=/mnt/openwrt...a64-olinuxino-emmc-squashfs-sdcard.img of=/dev/mmcblk2

 It also possible to boot from boot0 partition[1]:

  1. Compile U-Boot with CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x40
     otherwise the U-Boot will get stuck in bootloop
  2. Configure eMMC to boot from boot0 partition inside U-Boot:

     mmc bootbus 1 1 0 0; mmc partconf 1 1 1 0

  3. echo 0 > /sys/block/mmcblk2boot0/force_ro
  4. Write U-Boot from offset 0 (not offset 8k as with SD card) into
     boot0 partition

     dd if=u-boot-sunxi-with-spl.bin of=/dev/mmcblk2boot0

Known issues:

 Wireless doesn't work properly via netifd.

1. https://linux-sunxi.org/index.php?title=Bootable_eMMC

Signed-off-by: Petr Štetiar <ynezz@true.cz>
---
 .../allwinner/sun50i-a64-olinuxino-emmc.dts   | 25 +++++++++++++++++++
 target/linux/sunxi/image/cortex-a53.mk        | 10 ++++++++
 ...ner-enable-sun50i-a64-olinuxino-emmc.patch | 25 +++++++++++++++++++
 3 files changed, 60 insertions(+)
 create mode 100644 target/linux/sunxi/files-4.19/arch/arm64/boot/dts/allwinner/sun50i-a64-olinuxino-emmc.dts
 create mode 100644 target/linux/sunxi/patches-4.19/410-arm64-dts-allwinner-enable-sun50i-a64-olinuxino-emmc.patch
diff mbox series

Patch

diff --git a/target/linux/sunxi/files-4.19/arch/arm64/boot/dts/allwinner/sun50i-a64-olinuxino-emmc.dts b/target/linux/sunxi/files-4.19/arch/arm64/boot/dts/allwinner/sun50i-a64-olinuxino-emmc.dts
new file mode 100644
index 000000000000..efb20846de49
--- /dev/null
+++ b/target/linux/sunxi/files-4.19/arch/arm64/boot/dts/allwinner/sun50i-a64-olinuxino-emmc.dts
@@ -0,0 +1,25 @@ 
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+// Copyright (C) 2018 Martin Ayotte <martinayotte@gmail.com>
+// Copyright (C) 2019 Sunil Mohan Adapa <sunil@medhas.org>
+
+#include "sun50i-a64-olinuxino.dts"
+
+/ {
+	model = "Olimex A64-Olinuxino-eMMC";
+	compatible = "olimex,a64-olinuxino-emmc", "allwinner,sun50i-a64";
+};
+
+&mmc2 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&mmc2_pins>;
+	vmmc-supply = <&reg_dcdc1>;
+	vqmmc-supply = <&reg_eldo1>;
+	bus-width = <8>;
+	non-removable;
+	cap-mmc-hw-reset;
+	status = "okay";
+};
+
+&pio {
+	vcc-pc-supply = <&reg_eldo1>;
+};
diff --git a/target/linux/sunxi/image/cortex-a53.mk b/target/linux/sunxi/image/cortex-a53.mk
index 96885cf92612..7a70de4dfff3 100644
--- a/target/linux/sunxi/image/cortex-a53.mk
+++ b/target/linux/sunxi/image/cortex-a53.mk
@@ -47,6 +47,16 @@  define Device/olimex_a64-olinuxino
 endef
 TARGET_DEVICES += olimex_a64-olinuxino
 
+define Device/olimex_a64-olinuxino-emmc
+  DEVICE_VENDOR := Olimex
+  DEVICE_MODEL := A64-Olinuxino
+  DEVICE_VARIANT := eMMC
+  DEVICE_PACKAGES := kmod-rtl8723bs rtl8723bs-firmware
+  $(Device/sun50i-a64)
+  SUNXI_DTS := $$(SUNXI_DTS_DIR)$$(SOC)-olinuxino-emmc
+endef
+TARGET_DEVICES += olimex_a64-olinuxino-emmc
+
 define Device/pine64_pine64-plus
   DEVICE_VENDOR := Pine64
   DEVICE_MODEL := Pine64+
diff --git a/target/linux/sunxi/patches-4.19/410-arm64-dts-allwinner-enable-sun50i-a64-olinuxino-emmc.patch b/target/linux/sunxi/patches-4.19/410-arm64-dts-allwinner-enable-sun50i-a64-olinuxino-emmc.patch
new file mode 100644
index 000000000000..e2c9abe707bd
--- /dev/null
+++ b/target/linux/sunxi/patches-4.19/410-arm64-dts-allwinner-enable-sun50i-a64-olinuxino-emmc.patch
@@ -0,0 +1,25 @@ 
+From 95610cc341e7fd577d7cd04a5afa091b548582a7 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Petr=20=C5=A0tetiar?= <ynezz@true.cz>
+Date: Wed, 18 Mar 2020 23:09:06 +0100
+Subject: [PATCH] arm64: dts: allwinner: enable sun50i-a64-olinuxino-emmc
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Signed-off-by: Petr Štetiar <ynezz@true.cz>
+---
+ arch/arm64/boot/dts/allwinner/Makefile | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/arch/arm64/boot/dts/allwinner/Makefile b/arch/arm64/boot/dts/allwinner/Makefile
+index 9ffa7a038791..c2f9c316e0e5 100644
+--- a/arch/arm64/boot/dts/allwinner/Makefile
++++ b/arch/arm64/boot/dts/allwinner/Makefile
+@@ -3,6 +3,7 @@ dtb-$(CONFIG_ARCH_SUNXI) += sun50i-a64-amarula-relic.dtb
+ dtb-$(CONFIG_ARCH_SUNXI) += sun50i-a64-bananapi-m64.dtb
+ dtb-$(CONFIG_ARCH_SUNXI) += sun50i-a64-nanopi-a64.dtb
+ dtb-$(CONFIG_ARCH_SUNXI) += sun50i-a64-olinuxino.dtb
++dtb-$(CONFIG_ARCH_SUNXI) += sun50i-a64-olinuxino-emmc.dtb
+ dtb-$(CONFIG_ARCH_SUNXI) += sun50i-a64-orangepi-win.dtb
+ dtb-$(CONFIG_ARCH_SUNXI) += sun50i-a64-pine64-plus.dtb sun50i-a64-pine64.dtb
+ dtb-$(CONFIG_ARCH_SUNXI) += sun50i-a64-pinebook.dtb