Add variants for both eMMC and NAND, add automatic eMMC upgrade script.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
Signed-off-by: Yilin Sun <imi415@imi.moe>
This commit is contained in:
parent
f7d56f4438
commit
a9e25ef8b9
|
@ -0,0 +1,295 @@
|
||||||
|
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
|
||||||
|
// Copyright (C) 2022 Arm Ltd.
|
||||||
|
/*
|
||||||
|
* Common peripherals and configurations for MangoPi MQ-R boards.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <dt-bindings/gpio/gpio.h>
|
||||||
|
#include <dt-bindings/leds/common.h>
|
||||||
|
|
||||||
|
/dts-v1/;
|
||||||
|
|
||||||
|
#include <arm/allwinner/sun8i-t113s.dtsi>
|
||||||
|
|
||||||
|
/ {
|
||||||
|
model = "Tronlong TLT113-MiniEVM";
|
||||||
|
compatible = "tronlong,tlt113-minievm", "allwinner,sun8i-t113i";
|
||||||
|
|
||||||
|
aliases {
|
||||||
|
serial2 = &uart2;
|
||||||
|
mmc0 = &mmc0;
|
||||||
|
mmc2 = &mmc2;
|
||||||
|
};
|
||||||
|
|
||||||
|
chosen {
|
||||||
|
stdout-path = "serial2:115200n8";
|
||||||
|
};
|
||||||
|
|
||||||
|
leds {
|
||||||
|
compatible = "gpio-leds";
|
||||||
|
|
||||||
|
led-0 {
|
||||||
|
color = <LED_COLOR_ID_GREEN>;
|
||||||
|
function = LED_FUNCTION_HEARTBEAT;
|
||||||
|
gpios = <&pio 2 0 GPIO_ACTIVE_HIGH>; /* PC0 */
|
||||||
|
linux,default-trigger = "heartbeat";
|
||||||
|
};
|
||||||
|
|
||||||
|
led-1 {
|
||||||
|
color = <LED_COLOR_ID_GREEN>;
|
||||||
|
function = LED_FUNCTION_DISK;
|
||||||
|
gpios = <&pio 2 1 GPIO_ACTIVE_HIGH>; /* PC1 */
|
||||||
|
linux,default-trigger = "mmc2";
|
||||||
|
};
|
||||||
|
|
||||||
|
led-2 {
|
||||||
|
color = <LED_COLOR_ID_GREEN>;
|
||||||
|
function = LED_FUNCTION_STATUS;
|
||||||
|
gpios = <&pio 6 11 GPIO_ACTIVE_HIGH>; /* PG11 */
|
||||||
|
linux,default-trigger = "default-on";
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
hdmi-connector {
|
||||||
|
compatible = "hdmi-connector";
|
||||||
|
ddc-i2c-bus = <&i2c0>;
|
||||||
|
label = "hdmi";
|
||||||
|
type = "a";
|
||||||
|
|
||||||
|
port {
|
||||||
|
hdmi_connector_in: endpoint {
|
||||||
|
remote-endpoint = <&bridge_hdmi_out>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
/* EC2232E DC/DC regulator on SoM */
|
||||||
|
reg_vcc5v: regulator-5v {
|
||||||
|
compatible = "regulator-fixed";
|
||||||
|
regulator-name = "vcc-5v";
|
||||||
|
regulator-min-microvolt = <5000000>;
|
||||||
|
regulator-max-microvolt = <5000000>;
|
||||||
|
regulator-always-on;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* EC2232E DC/DC regulator on SoM */
|
||||||
|
reg_3v3: regulator-3v3 {
|
||||||
|
compatible = "regulator-fixed";
|
||||||
|
regulator-name = "vcc-3v3";
|
||||||
|
regulator-min-microvolt = <3300000>;
|
||||||
|
regulator-max-microvolt = <3300000>;
|
||||||
|
vin-supply = <®_vcc5v>;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* EC2232E DC/DC regulator on SoM, also supplying VDD-SYS */
|
||||||
|
reg_vcc_core: regulator-core {
|
||||||
|
compatible = "regulator-fixed";
|
||||||
|
regulator-name = "vcc-core";
|
||||||
|
regulator-min-microvolt = <880000>;
|
||||||
|
regulator-max-microvolt = <880000>;
|
||||||
|
vin-supply = <®_vcc5v>;
|
||||||
|
};
|
||||||
|
|
||||||
|
reg_vbus_supply: regulator-vbus-otg {
|
||||||
|
compatible = "regulator-fixed";
|
||||||
|
regulator-name = "vbus-otg";
|
||||||
|
regulator-min-microvolt = <5000000>;
|
||||||
|
regulator-max-microvolt = <5000000>;
|
||||||
|
gpio = <&pio 1 12 GPIO_ACTIVE_HIGH>;
|
||||||
|
vin-supply = <®_vcc5v>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
&cpu0 {
|
||||||
|
cpu-supply = <®_vcc_core>;
|
||||||
|
};
|
||||||
|
|
||||||
|
&cpu1 {
|
||||||
|
cpu-supply = <®_vcc_core>;
|
||||||
|
};
|
||||||
|
|
||||||
|
&wdt {
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
|
&dcxo {
|
||||||
|
clock-frequency = <24000000>;
|
||||||
|
};
|
||||||
|
|
||||||
|
&ehci1 {
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
|
&ohci1 {
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
|
&pio {
|
||||||
|
vcc-pb-supply = <®_3v3>;
|
||||||
|
vcc-pd-supply = <®_3v3>;
|
||||||
|
vcc-pe-supply = <®_3v3>;
|
||||||
|
vcc-pf-supply = <®_3v3>;
|
||||||
|
vcc-pg-supply = <®_3v3>;
|
||||||
|
|
||||||
|
uart2_pg_pins: uart2-pg-pins {
|
||||||
|
pins = "PG17", "PG18";
|
||||||
|
function = "uart2";
|
||||||
|
};
|
||||||
|
|
||||||
|
rgmii_pg_pins: rgmii-pg-pins {
|
||||||
|
pins = "PG0", "PG1", "PG2", "PG3", "PG4",
|
||||||
|
"PG5", "PG6", "PG7", "PG8", "PG9",
|
||||||
|
"PG10", "PG12", "PG14", "PG15";
|
||||||
|
function = "emac";
|
||||||
|
};
|
||||||
|
|
||||||
|
i2c0_pins: i2c0-pins {
|
||||||
|
pins = "PB10", "PB11";
|
||||||
|
function = "i2c0";
|
||||||
|
};
|
||||||
|
|
||||||
|
i2c2_pins: i2c2-pins {
|
||||||
|
pins = "PE12", "PE13";
|
||||||
|
function = "i2c2";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
&uart2 {
|
||||||
|
pinctrl-names = "default";
|
||||||
|
pinctrl-0 = <&uart2_pg_pins>;
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
|
&mmc0 {
|
||||||
|
pinctrl-0 = <&mmc0_pins>;
|
||||||
|
pinctrl-names = "default";
|
||||||
|
vmmc-supply = <®_3v3>;
|
||||||
|
cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */
|
||||||
|
disable-wp;
|
||||||
|
bus-width = <4>;
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
|
&mmc2 {
|
||||||
|
pinctrl-0 = <&mmc2_pins>;
|
||||||
|
pinctrl-names = "default";
|
||||||
|
vmmc-supply = <®_3v3>;
|
||||||
|
non-removable;
|
||||||
|
disable-wp;
|
||||||
|
bus-width = <4>;
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
|
&emac {
|
||||||
|
pinctrl-0 = <&rgmii_pg_pins>;
|
||||||
|
pinctrl-names = "default";
|
||||||
|
status = "okay";
|
||||||
|
phy-handle = <&ephy>;
|
||||||
|
phy-mode = "rgmii-id";
|
||||||
|
allwinner,tx-delay-ps = <200>;
|
||||||
|
allwinner,rx-delay-ps = <0>;
|
||||||
|
phy-supply = <®_3v3>;
|
||||||
|
};
|
||||||
|
|
||||||
|
&mdio {
|
||||||
|
ephy: ethernet-phy@0 {
|
||||||
|
reg = <0>;
|
||||||
|
reset-gpios = <&pio 6 13 GPIO_ACTIVE_LOW>; /* PG13 */
|
||||||
|
rx-internal-delay-ps = <600>;
|
||||||
|
tx-internal-delay-ps = <450>;
|
||||||
|
reset-assert-us = <10000>;
|
||||||
|
reset-deassert-us = <1000000>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
&i2c0 {
|
||||||
|
pinctrl-names = "default";
|
||||||
|
pinctrl-0 = <&i2c0_pins>;
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
|
&i2c2 {
|
||||||
|
pinctrl-names = "default";
|
||||||
|
pinctrl-0 = <&i2c2_pins>;
|
||||||
|
status = "okay";
|
||||||
|
|
||||||
|
hdmi_lontium_lt8912: hdmi@48 {
|
||||||
|
compatible = "lontium,lt8912b";
|
||||||
|
reg = <0x48>;
|
||||||
|
reset-gpios = <&pio 4 11 GPIO_ACTIVE_LOW>; /* PE11 */
|
||||||
|
status = "okay";
|
||||||
|
|
||||||
|
ports {
|
||||||
|
#address-cells = <1>;
|
||||||
|
#size-cells = <0>;
|
||||||
|
port@0 {
|
||||||
|
reg = <0>;
|
||||||
|
bridge_dsi_in: endpoint {
|
||||||
|
data-lanes = <0 1 2 3>;
|
||||||
|
remote-endpoint = <&host_dsi_out>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
port@1 {
|
||||||
|
reg = <1>;
|
||||||
|
bridge_hdmi_out: endpoint {
|
||||||
|
remote-endpoint = <&hdmi_connector_in>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
tcpc@60 {
|
||||||
|
compatible = "willsemi,wusb3801";
|
||||||
|
reg = <0x60>;
|
||||||
|
interrupt-parent = <&pio>;
|
||||||
|
interrupts = <4 3 IRQ_TYPE_LEVEL_LOW>; /* PE3 */
|
||||||
|
|
||||||
|
connector {
|
||||||
|
compatible = "usb-c-connector";
|
||||||
|
label = "USB-C";
|
||||||
|
vbus-supply = <®_vbus_supply>;
|
||||||
|
power-role = "source";
|
||||||
|
data-role = "dual";
|
||||||
|
typec-power-opmode = "default";
|
||||||
|
pd-disable;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
&dsi {
|
||||||
|
status = "okay";
|
||||||
|
|
||||||
|
ports {
|
||||||
|
#address-cells = <1>;
|
||||||
|
#size-cells = <0>;
|
||||||
|
|
||||||
|
port {
|
||||||
|
host_dsi_out: endpoint {
|
||||||
|
remote-endpoint = <&bridge_dsi_in>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
&dphy {
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
|
&tcon_top {
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
|
&tcon_lcd0 {
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
|
&usb_otg {
|
||||||
|
dr_mode = "peripheral";
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
|
&usbphy {
|
||||||
|
usb1_vbus-supply = <®_vcc5v>;
|
||||||
|
status = "okay";
|
||||||
|
};
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
aliases {
|
aliases {
|
||||||
serial2 = &uart2;
|
serial2 = &uart2;
|
||||||
|
mmc0 = &mmc0;
|
||||||
};
|
};
|
||||||
|
|
||||||
chosen {
|
chosen {
|
||||||
|
@ -28,7 +29,7 @@
|
||||||
|
|
||||||
led-0 {
|
led-0 {
|
||||||
color = <LED_COLOR_ID_GREEN>;
|
color = <LED_COLOR_ID_GREEN>;
|
||||||
function = LED_FUNCTION_STATUS;
|
function = LED_FUNCTION_HEARTBEAT;
|
||||||
gpios = <&pio 2 0 GPIO_ACTIVE_HIGH>; /* PC0 */
|
gpios = <&pio 2 0 GPIO_ACTIVE_HIGH>; /* PC0 */
|
||||||
linux,default-trigger = "heartbeat";
|
linux,default-trigger = "heartbeat";
|
||||||
};
|
};
|
||||||
|
@ -42,7 +43,7 @@
|
||||||
|
|
||||||
led-2 {
|
led-2 {
|
||||||
color = <LED_COLOR_ID_GREEN>;
|
color = <LED_COLOR_ID_GREEN>;
|
||||||
function = LED_FUNCTION_HEARTBEAT;
|
function = LED_FUNCTION_STATUS;
|
||||||
gpios = <&pio 6 11 GPIO_ACTIVE_HIGH>; /* PG11 */
|
gpios = <&pio 6 11 GPIO_ACTIVE_HIGH>; /* PG11 */
|
||||||
linux,default-trigger = "default-on";
|
linux,default-trigger = "default-on";
|
||||||
};
|
};
|
||||||
|
@ -168,7 +169,7 @@
|
||||||
pinctrl-0 = <&mmc0_pins>;
|
pinctrl-0 = <&mmc0_pins>;
|
||||||
pinctrl-names = "default";
|
pinctrl-names = "default";
|
||||||
vmmc-supply = <®_3v3>;
|
vmmc-supply = <®_3v3>;
|
||||||
cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>;
|
cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */
|
||||||
disable-wp;
|
disable-wp;
|
||||||
bus-width = <4>;
|
bus-width = <4>;
|
||||||
status = "okay";
|
status = "okay";
|
|
@ -23,9 +23,14 @@ BR2_LINUX_KERNEL_PATCH="$(BR2_EXTERNAL_lwgw_PATH)/patches/kernel"
|
||||||
BR2_LINUX_KERNEL_DEFCONFIG="sunxi"
|
BR2_LINUX_KERNEL_DEFCONFIG="sunxi"
|
||||||
BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="$(BR2_EXTERNAL_lwgw_PATH)/board/t113i-minievm/linux.fragment"
|
BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="$(BR2_EXTERNAL_lwgw_PATH)/board/t113i-minievm/linux.fragment"
|
||||||
BR2_LINUX_KERNEL_DTS_SUPPORT=y
|
BR2_LINUX_KERNEL_DTS_SUPPORT=y
|
||||||
BR2_LINUX_KERNEL_CUSTOM_DTS_PATH="$(BR2_EXTERNAL_lwgw_PATH)/board/t113i-minievm/sun8i-t113i-tronlong-tlt113-minievm.dts"
|
BR2_LINUX_KERNEL_CUSTOM_DTS_PATH="$(BR2_EXTERNAL_lwgw_PATH)/board/t113i-minievm/sun8i-t113i-tronlong-tlt113-minievm-emmc.dts $(BR2_EXTERNAL_lwgw_PATH)/board/t113i-minievm/sun8i-t113i-tronlong-tlt113-minievm-nand.dts"
|
||||||
BR2_LINUX_KERNEL_DTB_OVERLAY_SUPPORT=y
|
BR2_LINUX_KERNEL_DTB_OVERLAY_SUPPORT=y
|
||||||
BR2_LINUX_KERNEL_INSTALL_TARGET=y
|
BR2_LINUX_KERNEL_INSTALL_TARGET=y
|
||||||
|
BR2_PACKAGE_DOSFSTOOLS=y
|
||||||
|
BR2_PACKAGE_DOSFSTOOLS_MKFS_FAT=y
|
||||||
|
BR2_PACKAGE_E2FSPROGS=y
|
||||||
|
BR2_PACKAGE_E2FSPROGS_E4DEFRAG=y
|
||||||
|
BR2_PACKAGE_E2FSPROGS_RESIZE2FS=y
|
||||||
BR2_PACKAGE_MTD=y
|
BR2_PACKAGE_MTD=y
|
||||||
BR2_PACKAGE_GPSD=y
|
BR2_PACKAGE_GPSD=y
|
||||||
BR2_PACKAGE_GPSD_USER=y
|
BR2_PACKAGE_GPSD_USER=y
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Execute SD Card upgrade
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
ExecStart=/opt/sdcard_upgrade.sh
|
||||||
|
StandardOutput=journal
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
|
@ -0,0 +1,73 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
set -x
|
||||||
|
|
||||||
|
LED_INDICATOR_NAME="green:status"
|
||||||
|
LED_INDICATOR_PATH="/sys/class/leds/${LED_INDICATOR_NAME}"
|
||||||
|
LED_INDICATOR_TRIG="none"
|
||||||
|
|
||||||
|
MMC_CARD_DEVICE="/dev/mmcblk0"
|
||||||
|
MMC_CARD_PART_USER="${MMC_CARD_DEVICE}p3"
|
||||||
|
|
||||||
|
MMC_EMMC_DEVICE="/dev/mmcblk2"
|
||||||
|
MMC_EMMC_PART_BOOT="${MMC_EMMC_DEVICE}p1"
|
||||||
|
MMC_EMMC_PART_ROOT="${MMC_EMMC_DEVICE}p2"
|
||||||
|
|
||||||
|
UPGRADE_PART_MOUNT_POINT="/mnt"
|
||||||
|
|
||||||
|
UPGRADE_ROOT_IMAGE_NAME="rootfs.ext2"
|
||||||
|
UPGRADE_ROOT_IMAGE_PATH="${UPGRADE_PART_MOUNT_POINT}/${UPGRADE_ROOT_IMAGE_NAME}"
|
||||||
|
|
||||||
|
UPGRADE_BOOT_IMAGE_NAME="u-boot-sunxi-with-spl.bin"
|
||||||
|
UPGRADE_BOOT_IMAGE_PATH="${UPGRADE_PART_MOUNT_POINT}/${UPGRADE_BOOT_IMAGE_NAME}"
|
||||||
|
|
||||||
|
if [ ! -b "${MMC_CARD_PART_USER}" ]; then
|
||||||
|
echo "No user partition present on SD card."
|
||||||
|
exit -1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Mount user partition on /mnt ..."
|
||||||
|
mount "${MMC_CARD_PART_USER}" /mnt
|
||||||
|
|
||||||
|
# Update eMMC ROOTFS partition
|
||||||
|
if [ -f "${UPGRADE_ROOT_IMAGE_PATH}" ]; then
|
||||||
|
echo "Flashing rootfs image to eMMC, please wait..."
|
||||||
|
dd if="${UPGRADE_ROOT_IMAGE_PATH}" of="${MMC_EMMC_PART_ROOT}" bs=4M
|
||||||
|
|
||||||
|
echo "Flash complete, resizing FS to fill the partition..."
|
||||||
|
resize2fs "${MMC_EMMC_PART_ROOT}"
|
||||||
|
|
||||||
|
echo "Finished updating rootfs."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Update eMMC BOOT partition
|
||||||
|
if [ -f "${UPGRADE_BOOT_IMAGE_PATH}" ]; then
|
||||||
|
echo "Flashing bootloader to eMMC, please wait..."
|
||||||
|
dd if="${UPGRADE_BOOT_IMAGE_PATH}" of="${MMC_EMMC_DEVICE}" bs=8k seek=1
|
||||||
|
|
||||||
|
echo "Finished updating bootloader."
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Syncing disks..."
|
||||||
|
sync
|
||||||
|
|
||||||
|
echo "Unmounting upgrade partition..."
|
||||||
|
umount "${MMC_CARD_PART_USER}"
|
||||||
|
|
||||||
|
echo "Flash completed, remove SD card and reboot."
|
||||||
|
|
||||||
|
if [ ! -f "${LED_INDICATOR_PATH}/trigger" ]; then
|
||||||
|
echo "Status LED not available, exiting..."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo none > "${LED_INDICATOR_PATH}/trigger"
|
||||||
|
|
||||||
|
# Blink STATUS LED (on base board)
|
||||||
|
while true; do
|
||||||
|
echo 0 > "${LED_INDICATOR_PATH}/brightness"
|
||||||
|
sleep 0.1
|
||||||
|
echo 1 > "${LED_INDICATOR_PATH}/brightness"
|
||||||
|
sleep 0.1
|
||||||
|
done
|
Loading…
Reference in New Issue