From 63693c8986e666047f2608178ab27e109f12210a Mon Sep 17 00:00:00 2001 From: Ricardo Pardini Date: Sat, 18 May 2024 10:06:39 +0200 Subject: [PATCH] aml-t95z-plus: add board file (and u-boot 2024.04) for T95Z Plus Amlogic tvbox - we've had kernel patches/DT (from chewitt) for this in meson64 for a long time, but I never sent the board - uses blobs for the `tartiflette-s912` which is also an DDR3 S912 (VIM2's blobs are DDR4 and won't boot) - this adds `u-boot 2024.04` support, using chewitt's DT & `000.patching_config.yaml` & a specific BOOTPATCHDIR - this is a full board as-if it was an SBC, and expects to boot from mainline u-boot; - for that to work you've to wipe the eMMC and get rid of the vendor-supplied u-boot - if this is not what you want/need, you can use the aml tvbox "board" instead, together with Android u-boot --- config/boards/aml-t95z-plus.tvb | 25 +++ .../board_t95z/0000.patching_config.yaml | 5 + .../defconfig/meson-gxm-t95z-plus_defconfig | 98 +++++++++++ .../dt/meson-gxm-t95z-plus-u-boot.dtsi | 7 + .../board_t95z/dt/meson-gxm-t95z-plus.dts | 166 ++++++++++++++++++ 5 files changed, 301 insertions(+) create mode 100644 config/boards/aml-t95z-plus.tvb create mode 100644 patch/u-boot/v2024.04/board_t95z/0000.patching_config.yaml create mode 100644 patch/u-boot/v2024.04/board_t95z/defconfig/meson-gxm-t95z-plus_defconfig create mode 100644 patch/u-boot/v2024.04/board_t95z/dt/meson-gxm-t95z-plus-u-boot.dtsi create mode 100644 patch/u-boot/v2024.04/board_t95z/dt/meson-gxm-t95z-plus.dts diff --git a/config/boards/aml-t95z-plus.tvb b/config/boards/aml-t95z-plus.tvb new file mode 100644 index 0000000000..bd754753ce --- /dev/null +++ b/config/boards/aml-t95z-plus.tvb @@ -0,0 +1,25 @@ +# Amlogic S912 octa core 3Gb RAM SoC eMMC chinese clone +BOARD_NAME="T95Z Plus" # (a q201 Chinese clone with internal amlogic ethernet 1gbit, complete with a chunk of metal inside to delay thermal throttling) +BOOT_FDT_FILE="amlogic/meson-gxm-t95z-plus.dtb" # From chewitt's patches +BOARDFAMILY="meson-gxl" # s912's are actually meson-gxm, no harm done. +BOOTCONFIG="meson-gxm-t95z-plus_defconfig" # patched-in +KERNEL_TARGET="edge" +FULL_DESKTOP="yes" +BOOT_LOGO="desktop" + +# Newer u-boot +BOOTBRANCH_BOARD="tag:v2024.04" +BOOTPATCHDIR="v2024.04/board_t95z" # This has a 000.patching_config.yaml inside, to avoid null-patching, as only new files are added (defconfig/dts's) + +# Use extlinux and u-boot-menu extension +declare -g SRC_EXTLINUX="yes" +declare -g SRC_CMDLINE="loglevel=7 splash=verbose console=ttyAML0,115200" # Those boards are serial-debug only; 'root=LABEL=armbi_root' ? +enable_extension "u-boot-menu" # this generates the extlinux.conf + +# Use the blobs for not-exactly-matching SBCs which are also S912. Note: the VIM2 blobs expect DDR4 and fails with "DDR4 chl: Rank0+1 @ 1008MHz" last message. +function post_uboot_custom_postprocess__t95z_uboot() { + display_alert "Signing u-boot FIP" "${BOARD}" "info" + #uboot_gxl_postprocess_ng "${SRC}/cache/sources/amlogic-boot-fip/khadas-vim2" # DDR4, won't work + #uboot_gxl_postprocess_ng "${SRC}/cache/sources/amlogic-boot-fip/beelink-gt1" # untested, might work + uboot_gxl_postprocess_ng "${SRC}/cache/sources/amlogic-boot-fip/tartiflette-s912" # DDR3, works +} diff --git a/patch/u-boot/v2024.04/board_t95z/0000.patching_config.yaml b/patch/u-boot/v2024.04/board_t95z/0000.patching_config.yaml new file mode 100644 index 0000000000..719cf56a8c --- /dev/null +++ b/patch/u-boot/v2024.04/board_t95z/0000.patching_config.yaml @@ -0,0 +1,5 @@ +config: + + overlay-directories: + - { source: "defconfig", target: "configs" } # copies all files in defconfig dir to the configs/ dir in the u-boot source tree + - { source: "dt", target: "arch/arm/dts" } # copies all files in dt dir to the arch/arm/dts dir in the u-boot source tree diff --git a/patch/u-boot/v2024.04/board_t95z/defconfig/meson-gxm-t95z-plus_defconfig b/patch/u-boot/v2024.04/board_t95z/defconfig/meson-gxm-t95z-plus_defconfig new file mode 100644 index 0000000000..4884c1e468 --- /dev/null +++ b/patch/u-boot/v2024.04/board_t95z/defconfig/meson-gxm-t95z-plus_defconfig @@ -0,0 +1,98 @@ +CONFIG_ARM=y +CONFIG_ARCH_MESON=y +CONFIG_TEXT_BASE=0x01000000 +CONFIG_NR_DRAM_BANKS=1 +CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y +CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x20000000 +CONFIG_ENV_SIZE=0x2000 +CONFIG_DM_GPIO=y +CONFIG_DEFAULT_DEVICE_TREE="meson-gxm-t95z-plus" +CONFIG_OF_LIBFDT_OVERLAY=y +CONFIG_DM_RESET=y +CONFIG_MESON_GXM=y +CONFIG_DEBUG_UART_BASE=0xc81004c0 +CONFIG_DEBUG_UART_CLOCK=24000000 +CONFIG_IDENT_STRING=" t95z" +CONFIG_SYS_LOAD_ADDR=0x1000000 +CONFIG_DEBUG_UART=y +CONFIG_LOCALVERSION="-armbian" +# CONFIG_LOCALVERSION_AUTO is not set +CONFIG_REMAKE_ELF=y +CONFIG_FIT=y +CONFIG_FIT_SIGNATURE=y +CONFIG_FIT_VERBOSE=y +CONFIG_LEGACY_IMAGE_FORMAT=y +CONFIG_OF_BOARD_SETUP=y +CONFIG_USE_PREBOOT=y +CONFIG_LOGLEVEL=6 +# CONFIG_DISPLAY_CPUINFO is not set +CONFIG_MISC_INIT_R=y +CONFIG_SYS_MAXARGS=32 +# CONFIG_CMD_BDI is not set +# CONFIG_CMD_IMI is not set +CONFIG_CMD_ADC=y +CONFIG_CMD_DFU=y +CONFIG_CMD_GPIO=y +# CONFIG_CMD_LOADS is not set +CONFIG_CMD_MMC=y +CONFIG_CMD_SF_TEST=y +CONFIG_CMD_SPI=y +CONFIG_CMD_USB=y +CONFIG_CMD_USB_MASS_STORAGE=y +# CONFIG_CMD_SETEXPR is not set +CONFIG_CMD_REGULATOR=y +CONFIG_OF_CONTROL=y +CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_SARADC_MESON=y +CONFIG_DFU_RAM=y +CONFIG_MMC_MESON_GX=y +CONFIG_MTD=y +CONFIG_DM_MTD=y +CONFIG_DM_SPI_FLASH=y +CONFIG_SPI_FLASH_WINBOND=y +CONFIG_PHY_REALTEK=y +CONFIG_DM_MDIO=y +CONFIG_DM_MDIO_MUX=y +CONFIG_ETH_DESIGNWARE_MESON8B=y +CONFIG_MDIO_MUX_MESON_GXL=y +CONFIG_MESON_GXL_USB_PHY=y +CONFIG_PINCTRL=y +CONFIG_PINCTRL_MESON_GXL=y +CONFIG_POWER_DOMAIN=y +CONFIG_MESON_EE_POWER_DOMAIN=y +CONFIG_DM_REGULATOR=y +CONFIG_DM_REGULATOR_FIXED=y +CONFIG_DEBUG_UART_ANNOUNCE=y +CONFIG_DEBUG_UART_SKIP_INIT=y +CONFIG_MESON_SERIAL=y +CONFIG_SPI=y +CONFIG_DM_SPI=y +CONFIG_MESON_SPIFC=y +CONFIG_SYSINFO=y +CONFIG_SYSINFO_SMBIOS=y +CONFIG_USB=y +CONFIG_DM_USB_GADGET=y +CONFIG_USB_XHCI_HCD=y +CONFIG_USB_XHCI_DWC3=y +CONFIG_USB_DWC3=y +# CONFIG_USB_DWC3_GADGET is not set +CONFIG_USB_DWC3_MESON_GXL=y +CONFIG_USB_KEYBOARD=y +CONFIG_USB_GADGET=y +CONFIG_USB_GADGET_VENDOR_NUM=0x1b8e +CONFIG_USB_GADGET_PRODUCT_NUM=0xfada +CONFIG_USB_GADGET_DWC2_OTG=y +CONFIG_USB_GADGET_DOWNLOAD=y +CONFIG_VIDEO=y +CONFIG_SYS_WHITE_ON_BLACK=y +CONFIG_VIDEO_MESON=y +CONFIG_VIDEO_DT_SIMPLEFB=y +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASH_SCREEN_ALIGN=y +CONFIG_VIDEO_BMP_RLE8=y +CONFIG_BMP_16BPP=y +CONFIG_BMP_24BPP=y +CONFIG_BMP_32BPP=y +CONFIG_LZO=y +CONFIG_BZIP2=y +CONFIG_ZSTD=y diff --git a/patch/u-boot/v2024.04/board_t95z/dt/meson-gxm-t95z-plus-u-boot.dtsi b/patch/u-boot/v2024.04/board_t95z/dt/meson-gxm-t95z-plus-u-boot.dtsi new file mode 100644 index 0000000000..39270ea71c --- /dev/null +++ b/patch/u-boot/v2024.04/board_t95z/dt/meson-gxm-t95z-plus-u-boot.dtsi @@ -0,0 +1,7 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2019 BayLibre, SAS. + * Author: Neil Armstrong + */ + +#include "meson-gxl-u-boot.dtsi" diff --git a/patch/u-boot/v2024.04/board_t95z/dt/meson-gxm-t95z-plus.dts b/patch/u-boot/v2024.04/board_t95z/dt/meson-gxm-t95z-plus.dts new file mode 100644 index 0000000000..5f4bd19d5d --- /dev/null +++ b/patch/u-boot/v2024.04/board_t95z/dt/meson-gxm-t95z-plus.dts @@ -0,0 +1,166 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) Christian Hewitt + */ + +/dts-v1/; + +#include "meson-gxm.dtsi" +#include "meson-gx-p23x-q20x.dtsi" +#include +#include + +/ { + compatible = "sunvell,t95z-plus", "amlogic,s912", "amlogic,meson-gxm"; + model = "Sunvell T95Z Plus"; + + leds { + compatible = "gpio-leds"; + + led-green { + color = ; + function = LED_FUNCTION_POWER; + gpios = <&gpio_ao GPIOAO_9 GPIO_ACTIVE_HIGH>; + default-state = "on"; + }; + + led-blue { + color = ; + function = LED_FUNCTION_POWER; + gpios = <&gpio GPIODV_25 GPIO_ACTIVE_HIGH>; + default-state = "off"; + panic-indicator; + }; + }; + + adc-keys { + compatible = "adc-keys"; + io-channels = <&saradc 0>; + io-channel-names = "buttons"; + keyup-threshold-microvolt = <1710000>; + + button-function { + label = "update"; + linux,code = ; + press-threshold-microvolt = <10000>; + }; + }; + + spi { + compatible = "spi-gpio"; + + /* T95Z v1 (enabled) */ + sck-gpios = <&gpio GPIODV_22 GPIO_ACTIVE_HIGH>; + mosi-gpios = <&gpio GPIODV_23 GPIO_ACTIVE_HIGH>; + cs-gpios = <&gpio GPIODV_21 GPIO_ACTIVE_LOW>; + + /* T95Z v2 (disabled) + sck-gpios = <&gpio GPIODV_19 GPIO_ACTIVE_HIGH>; + mosi-gpios = <&gpio GPIODV_18 GPIO_ACTIVE_HIGH>; + cs-gpios = <&gpio GPIODV_20 GPIO_ACTIVE_LOW>; + */ + + num-chipselects = <1>; + #address-cells = <1>; + #size-cells = <0>; + + tm1628: led-controller@0 { + compatible = "titanmec,tm1628"; + reg = <0>; + spi-3wire; + spi-lsb-first; + spi-rx-delay-us = <1>; + spi-max-frequency = <500000>; + #address-cells = <2>; + #size-cells = <0>; + + titanmec,segment-mapping = /bits/ 8 <4 5 6 1 2 3 7>; + titanmec,grid = /bits/ 8 <2 3 4 5 1>; + + alarm@1,1 { + reg = <1 1>; + function = LED_FUNCTION_ALARM; + }; + + usb@1,2 { + reg = <1 2>; + function = LED_FUNCTION_USB; + }; + + play@1,3 { + reg = <1 3>; + function = "play"; + }; + + pause@1,4 { + reg = <1 4>; + function = "pause"; + }; + + colon@1,5 { + reg = <1 5>; + function = "colon"; + }; + + lan@1,6 { + reg = <1 6>; + function = LED_FUNCTION_LAN; + }; + + wlan@1,7 { + reg = <1 7>; + function = LED_FUNCTION_WLAN; + }; + }; + }; +}; + +ðmac { + pinctrl-0 = <ð_pins>; + pinctrl-names = "default"; + + phy-handle = <&external_phy>; + phy-mode = "rgmii"; + + amlogic,tx-delay-ns = <2>; +}; + +&external_mdio { + external_phy: ethernet-phy@1 { + /* ZTE ZX2AA500 */ + compatible = "ethernet-phy-id0381.5c11", + "ethernet-phy-ieee802.3-c22"; + reg = <1>; + max-speed = <1000>; + + reset-assert-us = <10000>; + reset-deassert-us = <80000>; + reset-gpios = <&gpio GPIOZ_14 GPIO_ACTIVE_LOW>; + + interrupt-parent = <&gpio_intc>; + /* MAC_INTR on GPIOZ_15 */ + interrupts = <25 IRQ_TYPE_LEVEL_LOW>; + }; +}; + +&sd_emmc_a { + brcmf: wifi@1 { + reg = <1>; + compatible = "brcm,bcm4329-fmac"; + }; +}; + +&uart_A { + status = "okay"; + pinctrl-0 = <&uart_a_pins>, <&uart_a_cts_rts_pins>; + pinctrl-names = "default"; + uart-has-rtscts; + + bluetooth { + compatible = "brcm,bcm43438-bt"; + shutdown-gpios = <&gpio GPIOX_17 GPIO_ACTIVE_HIGH>; + max-speed = <2000000>; + clocks = <&wifi32k>; + clock-names = "lpo"; + }; +};