From 654d208053f60d5793b25ea354df80a8d2116779 Mon Sep 17 00:00:00 2001 From: Viacheslav Bocharov Date: Mon, 12 Feb 2024 09:54:39 +0300 Subject: [PATCH] JetHome: Update JetHub family Signed-off-by: Viacheslav Bocharov --- config/boards/jethubj200.conf | 10 + config/boards/jethubj200.wip | 20 - config/sources/families/jethub.conf | 4 +- packages/bsp/jethub/jethub-init | 6 +- packages/bsp/jethub/jethub_get_cmdline_arg.h | 1 + .../bsp/jethub/jethubj200/libjethubconfig.sh | 46 +- ...rm64-dts-jethub-j1xx-add-eeprom-node.patch | 10 +- .../dt/meson-sm1-jethome-jethub-j200.dts | 654 +++++++++++++++++ ...axg-add-support-for-JetHome-JetHub-D.patch | 669 ------------------ ...jethub-j200-add-meson64-reset-driver.patch | 33 - ...fi-options-for-JetHub-D1-H1.patch.disable} | 0 ...fi-options-for-JetHub-D1-H1.patch.disable} | 0 .../board_jethubj200/0003-fix-j200.patch | 30 - ...ACK-mmc-meson-gx-limit-to-24MHz.patch.diff | 29 - .../0001-Add-JetHub-D2.patch} | 428 ++++++++--- .../0002-Add-some-amlogic-sm-functions.patch} | 16 +- .../enable-DT-overlays-support.patch | 0 17 files changed, 1040 insertions(+), 916 deletions(-) create mode 100644 config/boards/jethubj200.conf delete mode 100644 config/boards/jethubj200.wip create mode 100644 patch/kernel/archive/meson64-6.9/dt/meson-sm1-jethome-jethub-j200.dts delete mode 100644 patch/kernel/archive/meson64-6.9/jethome-0004-arm64-dts-meson-axg-add-support-for-JetHome-JetHub-D.patch delete mode 100644 patch/kernel/archive/meson64-6.9/jethome-0005-jethub-j200-add-meson64-reset-driver.patch rename patch/u-boot/v2023.10/board_jethubj100/{0006-HACK-force-disable-efi-options-for-JetHub-D1-H1.patch => 0006-HACK-force-disable-efi-options-for-JetHub-D1-H1.patch.disable} (100%) rename patch/u-boot/v2023.10/board_jethubj80/{0006-HACK-force-disable-efi-options-for-JetHub-D1-H1.patch => 0006-HACK-force-disable-efi-options-for-JetHub-D1-H1.patch.disable} (100%) delete mode 100644 patch/u-boot/v2024.01/board_jethubj200/0003-fix-j200.patch delete mode 100644 patch/u-boot/v2024.01/board_jethubj200/0004-HACK-mmc-meson-gx-limit-to-24MHz.patch.diff rename patch/u-boot/{v2024.01/board_jethubj200/0002-jethub-D2-j200-add.patch => v2024.07/board_jethubj200/0001-Add-JetHub-D2.patch} (69%) rename patch/u-boot/{v2024.01/board_jethubj200/0001-Add-some-amlogic-sm-functions.patch => v2024.07/board_jethubj200/0002-Add-some-amlogic-sm-functions.patch} (95%) rename patch/u-boot/{v2024.01 => v2024.07}/board_jethubj200/enable-DT-overlays-support.patch (100%) diff --git a/config/boards/jethubj200.conf b/config/boards/jethubj200.conf new file mode 100644 index 000000000000..94c83a454d5c --- /dev/null +++ b/config/boards/jethubj200.conf @@ -0,0 +1,10 @@ +# Amlogic S905X3 quad core 4GB RAM SoC eMMC GBE USB2 SPI-NOR +BOARD_NAME="JetHub D2" +BOARDFAMILY="jethub" +BOARD_MAINTAINER="adeepn" +BOOTCONFIG="jethub_j200_defconfig" +KERNEL_TARGET="current,edge" +MODULES_BLACKLIST="simpledrm" # SimpleDRM conflicts with Panfrost +FULL_DESKTOP="yes" +SERIALCON="ttyAML0" +#BOOT_LOGO="desktop" diff --git a/config/boards/jethubj200.wip b/config/boards/jethubj200.wip deleted file mode 100644 index 3c2f60a3ade4..000000000000 --- a/config/boards/jethubj200.wip +++ /dev/null @@ -1,20 +0,0 @@ -# Amlogic S905X3 quad core 4GB RAM SoC eMMC GBE USB2 SPI -BOARD_NAME="JetHub D2 family" -BOARDFAMILY="jethub" -BOARD_MAINTAINER="adeepn" -BOOTCONFIG="jethub_j200_defconfig" -KERNEL_TARGET="current,edge" -MODULES_BLACKLIST="simpledrm" # SimpleDRM conflicts with Panfrost -FULL_DESKTOP="yes" -SERIALCON="ttyAML0" -#BOOT_LOGO="desktop" - -BOOTBRANCH_BOARD="tag:v2024.01" -BOOTPATCHDIR="v2024.01" - -BOOT_FDT_FILE="amlogic/meson-sm1-jethome-jethub-j200.dtb" - -# To enable the SPI NOR the -spi .dtb is required, because eMMC shares a pin with SPI on the D2. To use it: -# fdtfile=amlogic/meson-sm1-jethome-jethub-j200-spinor.dtb # in armbianEnv.txt and reboot, then run armbian-install -# After deploying to SPI-NOR/MTD, return back to the normal DTB, otherwise eMMC speed is impaired. -#UBOOT_TARGET_MAP="u-boot-dtb.img;;u-boot.bin.sd.bin:u-boot.bin u-boot-dtb.img u-boot.bin:u-boot-spi.bin" diff --git a/config/sources/families/jethub.conf b/config/sources/families/jethub.conf index 617928938bd3..e8149c55ac26 100644 --- a/config/sources/families/jethub.conf +++ b/config/sources/families/jethub.conf @@ -31,8 +31,8 @@ elif [[ "$BOARD" == "jethubj200" ]]; then ASOUND_STATE="${ASOUND_STATE:-"asound.state.meson64"}" CPUMIN=667000 CPUMAX=2100000 - BOOTBRANCH="tag:v2024.01" - BOOTPATCHDIR="v2024.01" + BOOTBRANCH="tag:v2024.07" + BOOTPATCHDIR="v2024.07" fi ######## diff --git a/packages/bsp/jethub/jethub-init b/packages/bsp/jethub/jethub-init index 273ca571b8d5..330f73009cb0 100755 --- a/packages/bsp/jethub/jethub-init +++ b/packages/bsp/jethub/jethub-init @@ -63,9 +63,9 @@ unexport_sysfs() { for i in /sys/class/gpio/gpio* ; do if ! echo "$i" | grep -q chip ; then - ii=$(echo "${i##*/}"| tr -d -c 0-9) - echo "$ii" > /sys/class/gpio/unexport - fi + ii=$(echo "${i##*/}"| tr -d -c 0-9) + echo "$ii" > /sys/class/gpio/unexport + fi done } diff --git a/packages/bsp/jethub/jethub_get_cmdline_arg.h b/packages/bsp/jethub/jethub_get_cmdline_arg.h index e5fc7b3bd026..9ca0b0ee2075 100644 --- a/packages/bsp/jethub/jethub_get_cmdline_arg.h +++ b/packages/bsp/jethub/jethub_get_cmdline_arg.h @@ -3,6 +3,7 @@ #include #include #include +#include std::string loadFileAsLine(const std::string& path) { std::string result; diff --git a/packages/bsp/jethub/jethubj200/libjethubconfig.sh b/packages/bsp/jethub/jethubj200/libjethubconfig.sh index 9b6412f205d5..8b3d3b3c6d09 100644 --- a/packages/bsp/jethub/jethubj200/libjethubconfig.sh +++ b/packages/bsp/jethub/jethubj200/libjethubconfig.sh @@ -1,10 +1,6 @@ #!/bin/bash # shellcheck disable=SC2034 -#TODO: empty now - -GPIOCHIPNUMBER=0 - GPIO_DIRECTION_OUTPUT=0 GPIO_DIRECTION_INPUT=1 @@ -12,6 +8,21 @@ GPIO_ACTIVE_LOW=0 GPIO_ACTIVE_HIGH=1 GPIOS=( + # Discrete inputs: 1, 2, 3 + "2 8 ${GPIO_DIRECTION_INPUT} ${GPIO_ACTIVE_HIGH}" + "2 9 ${GPIO_DIRECTION_INPUT} ${GPIO_ACTIVE_HIGH}" + "2 10 ${GPIO_DIRECTION_INPUT} ${GPIO_ACTIVE_HIGH}" + # Relays: 1, 2 + "2 0 ${GPIO_DIRECTION_OUTPUT} ${GPIO_ACTIVE_HIGH}" + "2 1 ${GPIO_DIRECTION_OUTPUT} ${GPIO_ACTIVE_HIGH}" + # UXM1 module: RESET, BOOT + "2 4 ${GPIO_DIRECTION_OUTPUT} ${GPIO_ACTIVE_HIGH}" + "2 5 ${GPIO_DIRECTION_OUTPUT} ${GPIO_ACTIVE_HIGH}" + # UXM2 module: RESET, BOOT + "2 6 ${GPIO_DIRECTION_OUTPUT} ${GPIO_ACTIVE_HIGH}" + "2 7 ${GPIO_DIRECTION_OUTPUT} ${GPIO_ACTIVE_HIGH}" + # Button + "1 10 ${GPIO_DIRECTION_INPUT} ${GPIO_ACTIVE_LOW}" ) @@ -20,5 +31,28 @@ LEDS=( ) - -ADDITIONALFUNC="" +reset_uxm1() { + echo "${0}: Reset UXM1 module ..." + gpio_set 2 5 1 ${GPIO_ACTIVE_HIGH} + gpio_set 2 6 1 ${GPIO_ACTIVE_HIGH} + sleep 1 + gpio_set 2 6 0 ${GPIO_ACTIVE_HIGH} +} + +reset_uxm2() { + echo "${0}: Reset UXM2 module ..." + gpio_set 2 7 1 ${GPIO_ACTIVE_HIGH} + gpio_set 2 6 1 ${GPIO_ACTIVE_HIGH} + sleep 1 + gpio_set 2 6 0 ${GPIO_ACTIVE_HIGH} +} + +config_1wire() { + echo "${0}: Configure 1-Wire ..." + if ! modprobe ds2482; then + echo "${0}: *** Error: Failed to load DS2482 kernel module" + exit 1 + fi +} + +ADDITIONALFUNC="reset_uxm1 reset_uxm2 config_1wire" diff --git a/patch/kernel/archive/meson64-6.6/jethome-0002-arm64-dts-jethub-j1xx-add-eeprom-node.patch b/patch/kernel/archive/meson64-6.6/jethome-0002-arm64-dts-jethub-j1xx-add-eeprom-node.patch index e52050d5338a..bb330c9001a0 100644 --- a/patch/kernel/archive/meson64-6.6/jethome-0002-arm64-dts-jethub-j1xx-add-eeprom-node.patch +++ b/patch/kernel/archive/meson64-6.6/jethome-0002-arm64-dts-jethub-j1xx-add-eeprom-node.patch @@ -41,13 +41,13 @@ index c2d22b00c1cd..6a5664d908d5 100644 +&i2c_AO { + /* EEPROM on base board */ + eeprompd: eeprom@56 { -+ compatible = "atmel,24c64"; -+ reg = <0x56>; -+ pagesize = <0x20>; ++ compatible = "atmel,24c64"; ++ reg = <0x56>; ++ pagesize = <0x20>; + label = "eeprompd"; + address-width = <0x10>; -+ vcc-supply = <&vddao_3v3>; -+ }; ++ vcc-supply = <&vddao_3v3>; ++ }; +}; -- 2.34.1 diff --git a/patch/kernel/archive/meson64-6.9/dt/meson-sm1-jethome-jethub-j200.dts b/patch/kernel/archive/meson64-6.9/dt/meson-sm1-jethome-jethub-j200.dts new file mode 100644 index 000000000000..3151a99974c2 --- /dev/null +++ b/patch/kernel/archive/meson64-6.9/dt/meson-sm1-jethome-jethub-j200.dts @@ -0,0 +1,654 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2024 JetHome + * Author: Viacheslav Bocharov + */ + +/dts-v1/; + +#include "meson-sm1.dtsi" + +#include +#include +#include + + +/ { + + compatible = "jethome,jethub-j200", "amlogic,sm1"; + model = "JetHome JetHub D2"; + + aliases { + serial0 = &uart_AO; + ethernet0 = ðmac; + rtc0 = &rtc; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + memory@0 { + device_type = "memory"; + reg = <0x0 0x0 0x0 0x40000000>; + }; + + emmc_pwrseq: emmc-pwrseq { + compatible = "mmc-pwrseq-emmc"; + reset-gpios = <&gpio BOOT_12 GPIO_ACTIVE_LOW>; + }; + + tflash_vdd: regulator-tflash_vdd { + compatible = "regulator-fixed"; + + regulator-name = "TFLASH_VDD"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + + gpio = <&gpio_ao GPIOAO_3 GPIO_OPEN_DRAIN>; + enable-active-high; + regulator-always-on; + }; + + tf_io: gpio-regulator-tf_io { + compatible = "regulator-gpio"; + + regulator-name = "TF_IO"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; + vin-supply = <&vcc_5v>; + + enable-gpios = <&gpio_ao GPIOE_2 GPIO_OPEN_DRAIN>; + enable-active-high; + regulator-always-on; + + gpios = <&gpio_ao GPIOAO_6 GPIO_OPEN_SOURCE>; + gpios-states = <0>; + + states = <3300000 0>, + <1800000 1>; + }; + + flash_1v8: regulator-flash_1v8 { + compatible = "regulator-fixed"; + regulator-name = "FLASH_1V8"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + vin-supply = <&vcc_3v3>; + regulator-always-on; + }; + + main_12v: regulator-main_12v { + compatible = "regulator-fixed"; + regulator-name = "12V"; + regulator-min-microvolt = <12000000>; + regulator-max-microvolt = <12000000>; + regulator-always-on; + }; + + vcc_5v: regulator-vcc_5v { + compatible = "regulator-fixed"; + regulator-name = "5V"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-always-on; + vin-supply = <&main_12v>; + gpio = <&gpio GPIOH_8 GPIO_OPEN_DRAIN>; + enable-active-high; + }; + + vcc_1v8: regulator-vcc_1v8 { + compatible = "regulator-fixed"; + regulator-name = "VCC_1V8"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + vin-supply = <&vcc_3v3>; + regulator-always-on; + }; + + vcc_3v3: regulator-vcc_3v3 { + compatible = "regulator-fixed"; + regulator-name = "VCC_3V3"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + vin-supply = <&vddao_3v3>; + regulator-always-on; + }; + + vddcpu: regulator-vddcpu { + /* + * MP8756GD Regulator. + */ + compatible = "pwm-regulator"; + + regulator-name = "VDDCPU"; + regulator-min-microvolt = <721000>; + regulator-max-microvolt = <1022000>; + + pwm-supply = <&main_12v>; + + pwms = <&pwm_AO_cd 1 1250 0>; + pwm-dutycycle-range = <100 0>; + + regulator-boot-on; + regulator-always-on; + }; + + usb_pwr_en: regulator-usb_pwr_en { + compatible = "regulator-fixed"; + regulator-name = "USB_PWR_EN"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&vcc_5v>; + + /* Connected to the internal USB-Hub */ + gpio = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>; + enable-active-high; + }; + + vddao_1v8: regulator-vddao_1v8 { + compatible = "regulator-fixed"; + regulator-name = "VDDAO_1V8"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + vin-supply = <&vddao_3v3>; + regulator-always-on; + }; + + vddao_3v3: regulator-vddao_3v3 { + compatible = "regulator-fixed"; + regulator-name = "VDDAO_3V3"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + vin-supply = <&main_12v>; + regulator-always-on; + }; + + hdmi-connector { + compatible = "hdmi-connector"; + type = "a"; + + port { + hdmi_connector_in: endpoint { + remote-endpoint = <&hdmi_tx_tmds_out>; + }; + }; + }; + + sound { + compatible = "amlogic,axg-sound-card"; + audio-aux-devs = <&tdmout_b>; + audio-routing = "TDM_B Playback", "TDMOUT_B OUT"; + + assigned-clocks = <&clkc CLKID_MPLL2>, + <&clkc CLKID_MPLL0>, + <&clkc CLKID_MPLL1>; + assigned-clock-parents = <0>, <0>, <0>; + assigned-clock-rates = <294912000>, + <270950400>, + <393216000>; + + /* 8ch hdmi interface */ + dai-link-0 { + sound-dai = <&tdmif_b>; + dai-format = "i2s"; + dai-tdm-slot-tx-mask-0 = <1 1>; + dai-tdm-slot-tx-mask-1 = <1 1>; + dai-tdm-slot-tx-mask-2 = <1 1>; + dai-tdm-slot-tx-mask-3 = <1 1>; + mclk-fs = <256>; + + codec { + sound-dai = <&tohdmitx TOHDMITX_I2S_IN_B>; + }; + }; + + /* hdmi glue */ + dai-link-1 { + sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>; + + codec { + sound-dai = <&hdmi_tx>; + }; + }; + }; + + meson64-reboot { + compatible = "meson64,reboot"; + sys_reset = <0x84000009>; + sys_poweroff = <0x84000008>; + + sd-vqen = <&gpio GPIOE_2 GPIO_ACTIVE_HIGH>; + sd-vqsw = <&gpio_ao GPIOAO_6 GPIO_ACTIVE_HIGH>; + sd-vmmc = <&gpio_ao GPIOAO_3 GPIO_ACTIVE_HIGH>; + }; + + leds { + compatible = "gpio-leds"; + + led-green { + color = ; + function = LED_FUNCTION_STATUS; + gpios = <&gpio_ao GPIOAO_11 GPIO_ACTIVE_LOW>; + linux,default-trigger = "heartbeat"; + panic-indicator; + }; + + led-red { + color = ; + function = LED_FUNCTION_POWER; + gpios = <&gpio GPIOH_5 GPIO_ACTIVE_LOW>; + default-state = "off"; + }; + + }; + + sound { + model = "JETHUB-D2"; + }; + +}; + +&arb { + status = "okay"; +}; + +&cec_AO { + pinctrl-0 = <&cec_ao_a_h_pins>; + pinctrl-names = "default"; + status = "disabled"; + hdmi-phandle = <&hdmi_tx>; +}; + +&cecb_AO { + pinctrl-0 = <&cec_ao_b_h_pins>; + pinctrl-names = "default"; + status = "okay"; + hdmi-phandle = <&hdmi_tx>; +}; + +&clkc_audio { + status = "okay"; +}; + +&cpu0 { + cpu-supply = <&vddcpu>; + operating-points-v2 = <&cpu_opp_table>; + clocks = <&clkc CLKID_CPU_CLK>; + clock-latency = <50000>; +}; + +&cpu1 { + cpu-supply = <&vddcpu>; + operating-points-v2 = <&cpu_opp_table>; + clocks = <&clkc CLKID_CPU1_CLK>; + clock-latency = <50000>; +}; + +&cpu2 { + cpu-supply = <&vddcpu>; + operating-points-v2 = <&cpu_opp_table>; + clocks = <&clkc CLKID_CPU2_CLK>; + clock-latency = <50000>; +}; + +&cpu3 { + cpu-supply = <&vddcpu>; + operating-points-v2 = <&cpu_opp_table>; + clocks = <&clkc CLKID_CPU3_CLK>; + clock-latency = <50000>; +}; + +&ext_mdio { + external_phy: ethernet-phy@0 { + /* Realtek RTL8211F (0x001cc916) */ + reg = <0>; + max-speed = <1000>; + + reset-assert-us = <10000>; + reset-deassert-us = <80000>; + reset-gpios = <&gpio GPIOZ_15 (GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN)>; + + interrupt-parent = <&gpio_intc>; + /* MAC_INTR on GPIOZ_14 */ + interrupts = ; + }; +}; + +ðmac { + pinctrl-0 = <ð_pins>, <ð_rgmii_pins>; + pinctrl-names = "default"; + status = "okay"; + phy-mode = "rgmii"; + phy-handle = <&external_phy>; + amlogic,tx-delay-ns = <2>; +}; + +&gpio { + gpio-line-names = + /* GPIOZ */ + "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", + /* GPIOH */ + "", "", "", "", + "HUB_RESET", /* GPIOH_4 */ + "LED_RED", /* GPIOH_5 */ + "I2C_SDA_MODULES", /* GPIOH_6 */ + "I2C_SCL_MODULES", /* GPIOH_7 */ + "", + /* BOOT */ + "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", + /* GPIOC */ + "", "", "", "", "", "", "", "", + /* GPIOA */ + "", "", "", "", "", "", "", "", + "", "", "", "", "", "", + "I2C_SDA_SYSBUS", /* GPIOA_14 */ + "I2C_SCL_SYSBUS", /* GPIOA_15 */ + /* GPIOX */ + "", /* GPIOX_0 */ + "", /* GPIOX_1 */ + "", /* GPIOX_2 */ + "", /* GPIOX_3 */ + "", /* GPIOX_4 */ + "", /* GPIOX_5 */ + "RS485_TX", /* GPIOX_6 */ + "RS485_RX", /* GPIOX_7 */ + "", /* GPIOX_8 */ + "", /* GPIOX_9 */ + "", /* GPIOX_10 */ + "", /* GPIOX_11 */ + "", /* GPIOX_12 */ + "", /* GPIOX_13 */ + "", /* GPIOX_14 */ + "", /* GPIOX_15 */ + "", /* GPIOX_16 */ + "I2C_SDA_LCDBUS", /* GPIOX_17 */ + "I2C_SCL_LCDBUS", /* GPIOX_18 */ + ""; /* GPIOX_19 */ + /* + * WARNING: The USB Hub needs a reset signal to be turned low in + * order to be detected by the USB Controller. This signal should + * be handled by a USB specific power sequence to reset the Hub + * when the USB bus is powered down. + */ + usb-hub-hog { + gpio-hog; + gpios = ; + output-low; + line-name = "usb-hub-reset"; + }; + +}; + +&gpio_ao { + gpio-line-names = + /* GPIOAO */ + "", "", + "USB_PWRON", /* GPIOAO_2 */ + "", + "MCU_RESET", /* GPIOAO_4 */ + "POWER_GOOD", /* GPIOAO_5 */ + "", + "GPIO_EXPANDER", /* GPIOAO_7 */ + "MCU_UART_TX", /* GPIOAO_8 */ + "MCU_UART_RX", /* GPIOAO_9 */ + "BUTTON_USR", /* GPIOAO_10 */ + "LED_GREEN", /* GPIOAO_11 */ + /* GPIOE */ + "", "", ""; +}; + +&hdmi_tx { + status = "okay"; + pinctrl-0 = <&hdmitx_hpd_pins>, <&hdmitx_ddc_pins>; + pinctrl-names = "default"; + hdmi-supply = <&vcc_5v>; +}; + +&hdmi_tx_tmds_port { + hdmi_tx_tmds_out: endpoint { + remote-endpoint = <&hdmi_connector_in>; + }; +}; + +&pwm_AO_cd { + pinctrl-0 = <&pwm_ao_d_e_pins>; // GPIOE_1 + pinctrl-names = "default"; + clocks = <&xtal>; + clock-names = "clkin1"; + status = "okay"; +}; + +&saradc { + status = "okay"; +}; + +/* SD card */ +&sd_emmc_b { + status = "okay"; + pinctrl-0 = <&sdcard_c_pins>; + pinctrl-1 = <&sdcard_clk_gate_c_pins>; + pinctrl-names = "default", "clk-gate"; + + bus-width = <4>; + cap-sd-highspeed; + max-frequency = <200000000>; + sd-uhs-sdr12; + sd-uhs-sdr25; + sd-uhs-sdr50; + sd-uhs-sdr104; + disable-wp; + + cd-gpios = <&gpio GPIOC_6 GPIO_ACTIVE_LOW>; + vmmc-supply = <&tflash_vdd>; + vqmmc-supply = <&tf_io>; +}; + +/* eMMC */ +&sd_emmc_c { + status = "okay"; + pinctrl-0 = <&emmc_ctrl_pins>, <&emmc_data_8b_pins>, <&emmc_ds_pins>; + pinctrl-1 = <&emmc_clk_gate_pins>; + pinctrl-names = "default", "clk-gate"; + + bus-width = <8>; + cap-mmc-highspeed; + mmc-ddr-1_8v; + mmc-hs200-1_8v; + max-frequency = <200000000>; + disable-wp; + + mmc-pwrseq = <&emmc_pwrseq>; + vmmc-supply = <&vcc_3v3>; + vqmmc-supply = <&flash_1v8>; +}; + +&spifc { + status = "disabled"; + pinctrl-0 = <&nor_pins>; + pinctrl-names = "default"; + + flash: nor-flash@0 { + compatible = "sst,w25q256", "jedec,spi-nor"; + #address-cells = <1>; + #size-cells = <1>; + reg = <0>; + /*spi-max-frequency = <4000000>;*/ /* 4MHz */ + /*spi-max-frequency = <104000000>;*/ + spi-max-frequency = <30000000>; + }; +}; + +&tdmif_b { + status = "okay"; +}; + +&tdmout_b { + status = "okay"; +}; + +&tohdmitx { + status = "okay"; +}; + +&uart_AO { + status = "okay"; + pinctrl-0 = <&uart_ao_a_pins>; + pinctrl-names = "default"; +}; + +&uart_AO_B { + status = "okay"; + pinctrl-0 = <&uart_ao_b_8_9_pins>; + pinctrl-names = "default"; +}; + +&uart_B { + status = "okay"; + pinctrl-0 = <&uart_b_pins>; + pinctrl-names = "default"; +}; + + +&usb { + status = "okay"; + vbus-supply = <&usb_pwr_en>; +}; + +&usb2_phy0 { + phy-supply = <&vcc_5v>; +}; + + +/* I2C for modules */ +&i2c1 { + status = "okay"; + pinctrl-0 = <&i2c1_sda_h6_pins>, <&i2c1_sck_h7_pins>; + pinctrl-names = "default"; + + /* GPIO expander */ + u9: gpio@22 { + compatible = "nxp,pca9535"; + reg = <0x22>; + gpio-controller; + #gpio-cells = <2>; + interrupt-controller; + #interrupt-cells = <2>; + interrupt-parent = <&gpio_intc>; + interrupts = ; + + gpio-line-names = + "RELAY_1", "RELAY_2", + "", "", + "UXM1_RESET", "UXM1_BOOT", + "UXM2_RESET", "UXM2_BOOT", + "DIN_1", "DIN_2", "DIN_3", + "","","","",""; + }; + + /* 1-wire */ + w1: onewire@18 { + compatible = "maxim,ds2482"; + reg = <0x18>; + }; + +}; + + +/* I2C for lcd/etc */ +&i2c2 { + status = "okay"; + pinctrl-0 = <&i2c2_sda_x_pins>, <&i2c2_sck_x_pins>; + pinctrl-names = "default"; +}; + +/* I2C_EE_M3: I2C for CPU board */ +&i2c3 { + status = "okay"; + pinctrl-0 = <&i2c3_sda_a_pins>, <&i2c3_sck_a_pins>; + pinctrl-names = "default"; + + /* I2C for rtc */ + rtc: rtc@51 { + status = "okay"; + compatible = "nxp,pcf8563"; + reg = <0x51>; + wakeup-source; + }; + + /* FRAM on base board */ + fram: eeprom@52 { + compatible = "atmel,24c64"; + reg = <0x52>; + pagesize = <0x20>; + label = "fram"; + address-width = <0x10>; + vcc-supply = <&vddao_3v3>; + }; + + /* EEPROM on CPU board */ + eepromc: eeprom@54 { + compatible = "atmel,24c64"; + reg = <0x54>; + pagesize = <0x20>; + label = "eepromc"; + address-width = <0x10>; + vcc-supply = <&vddao_3v3>; + }; + + /* EEPROM on base board */ + eeprompd: eeprom@56 { + compatible = "atmel,24c64"; + reg = <0x56>; + pagesize = <0x20>; + label = "eeprompd"; + address-width = <0x10>; + vcc-supply = <&vddao_3v3>; + }; + + /* EEPROM on power module */ + eeprompm: eeprom@57 { + compatible = "atmel,24c64"; + reg = <0x57>; + pagesize = <0x20>; + label = "eeprompm"; + address-width = <0x10>; + vcc-supply = <&vddao_3v3>; + }; + + /* temperature sensors */ + temp1: tmp102@48 { + compatible = "ti,tmp102"; + reg = <0x48>; + }; + + temp2: tmp102@49 { + compatible = "ti,tmp102"; + reg = <0x49>; + }; + +}; + +&efuse { + eth_mac: eth-mac@0 { + reg = <0x0 0x6>; + }; + + bt_mac: bt-mac@6 { + reg = <0x6 0x6>; + }; + + wifi_mac: wifi-mac@c { + reg = <0xc 0x6>; + }; + + bid: bid@12 { + reg = <0x12 0x20>; + }; + + sn: sn@32 { + reg = <0x32 0x20>; + }; +}; diff --git a/patch/kernel/archive/meson64-6.9/jethome-0004-arm64-dts-meson-axg-add-support-for-JetHome-JetHub-D.patch b/patch/kernel/archive/meson64-6.9/jethome-0004-arm64-dts-meson-axg-add-support-for-JetHome-JetHub-D.patch deleted file mode 100644 index 0d1c51cb30fd..000000000000 --- a/patch/kernel/archive/meson64-6.9/jethome-0004-arm64-dts-meson-axg-add-support-for-JetHome-JetHub-D.patch +++ /dev/null @@ -1,669 +0,0 @@ -From 44819c568dc6156d8a15b48af4dec3f20d484408 Mon Sep 17 00:00:00 2001 -From: Viacheslav Bocharov -Date: Thu, 16 May 2024 15:14:08 +0300 -Subject: [PATCH 2/2] arm64: dts: meson-axg: add support for JetHome JetHub D2 - (j200) - -JetHome Jethub D2 is a home automation controller with the following -features: - - DIN Rail Mounting - - Amlogic S905X3 (ARM Cortex-A55) quad-core - - micro-HDMI video out - - 4GB LPDDR4 - - 32GB eMMC flash - - 1 x USB 2.0 - - 1 x 10/100/1000Mbps ethernet - - two module slots for radio/wire interface cards - - 2 x gpio LEDS - - 1 x 1-Wire - - 1 x RS-485 - - 3 x dry contact digital GPIO inputs - - 2 x relay GPIO outputs - - DC 9-36V power source with battery UPS on board option - -Signed-off-by: Viacheslav Bocharov ---- - arch/arm64/boot/dts/amlogic/Makefile | 1 + - .../amlogic/meson-sm1-jethome-jethub-j200.dts | 618 ++++++++++++++++++ - 2 files changed, 619 insertions(+) - create mode 100644 arch/arm64/boot/dts/amlogic/meson-sm1-jethome-jethub-j200.dts - -diff --git a/arch/arm64/boot/dts/amlogic/Makefile b/arch/arm64/boot/dts/amlogic/Makefile -index 0f29517da5ec..d007b59497d4 100644 ---- a/arch/arm64/boot/dts/amlogic/Makefile -+++ b/arch/arm64/boot/dts/amlogic/Makefile -@@ -79,6 +79,7 @@ dtb-$(CONFIG_ARCH_MESON) += meson-sm1-a95xf3-air.dtb - dtb-$(CONFIG_ARCH_MESON) += meson-sm1-bananapi-m2-pro.dtb - dtb-$(CONFIG_ARCH_MESON) += meson-sm1-bananapi-m5.dtb - dtb-$(CONFIG_ARCH_MESON) += meson-sm1-h96-max.dtb -+dtb-$(CONFIG_ARCH_MESON) += meson-sm1-jethome-jethub-j200.dtb - dtb-$(CONFIG_ARCH_MESON) += meson-sm1-khadas-vim3l.dtb - dtb-$(CONFIG_ARCH_MESON) += meson-sm1-khadas-vim3l-ts050.dtb - dtb-$(CONFIG_ARCH_MESON) += meson-sm1-s905d3-libretech-cc.dtb -diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1-jethome-jethub-j200.dts b/arch/arm64/boot/dts/amlogic/meson-sm1-jethome-jethub-j200.dts -new file mode 100644 -index 000000000000..c309f25374b3 ---- /dev/null -+++ b/arch/arm64/boot/dts/amlogic/meson-sm1-jethome-jethub-j200.dts -@@ -0,0 +1,618 @@ -+// SPDX-License-Identifier: (GPL-2.0+ OR MIT) -+/* -+ * Copyright (c) 2024 JetHome -+ * Author: Viacheslav Bocharov -+ */ -+ -+/dts-v1/; -+ -+#include "meson-sm1.dtsi" -+ -+#include -+#include -+#include -+ -+ -+/ { -+ -+ compatible = "jethome,jethub-j200", "amlogic,sm1"; -+ model = "JetHome JetHub D2"; -+ -+ aliases { -+ serial0 = &uart_AO; -+ ethernet0 = ðmac; -+ rtc0 = &rtc; -+ }; -+ -+ chosen { -+ stdout-path = "serial0:115200n8"; -+ }; -+ -+ memory@0 { -+ device_type = "memory"; -+ reg = <0x0 0x0 0x0 0x40000000>; -+ }; -+ -+ emmc_pwrseq: emmc-pwrseq { -+ compatible = "mmc-pwrseq-emmc"; -+ reset-gpios = <&gpio BOOT_12 GPIO_ACTIVE_LOW>; -+ }; -+ -+ tflash_vdd: regulator-tflash_vdd { -+ compatible = "regulator-fixed"; -+ -+ regulator-name = "TFLASH_VDD"; -+ regulator-min-microvolt = <3300000>; -+ regulator-max-microvolt = <3300000>; -+ -+ gpio = <&gpio_ao GPIOAO_3 GPIO_OPEN_DRAIN>; -+ enable-active-high; -+ regulator-always-on; -+ }; -+ -+ tf_io: gpio-regulator-tf_io { -+ compatible = "regulator-gpio"; -+ -+ regulator-name = "TF_IO"; -+ regulator-min-microvolt = <1800000>; -+ regulator-max-microvolt = <3300000>; -+ vin-supply = <&vcc_5v>; -+ -+ enable-gpios = <&gpio_ao GPIOE_2 GPIO_OPEN_DRAIN>; -+ enable-active-high; -+ regulator-always-on; -+ -+ gpios = <&gpio_ao GPIOAO_6 GPIO_OPEN_SOURCE>; -+ gpios-states = <0>; -+ -+ states = <3300000 0>, -+ <1800000 1>; -+ }; -+ -+ flash_1v8: regulator-flash_1v8 { -+ compatible = "regulator-fixed"; -+ regulator-name = "FLASH_1V8"; -+ regulator-min-microvolt = <1800000>; -+ regulator-max-microvolt = <1800000>; -+ vin-supply = <&vcc_3v3>; -+ regulator-always-on; -+ }; -+ -+ main_12v: regulator-main_12v { -+ compatible = "regulator-fixed"; -+ regulator-name = "12V"; -+ regulator-min-microvolt = <12000000>; -+ regulator-max-microvolt = <12000000>; -+ regulator-always-on; -+ }; -+ -+ vcc_5v: regulator-vcc_5v { -+ compatible = "regulator-fixed"; -+ regulator-name = "5V"; -+ regulator-min-microvolt = <5000000>; -+ regulator-max-microvolt = <5000000>; -+ regulator-always-on; -+ vin-supply = <&main_12v>; -+ gpio = <&gpio GPIOH_8 GPIO_OPEN_DRAIN>; -+ enable-active-high; -+ }; -+ -+ vcc_1v8: regulator-vcc_1v8 { -+ compatible = "regulator-fixed"; -+ regulator-name = "VCC_1V8"; -+ regulator-min-microvolt = <1800000>; -+ regulator-max-microvolt = <1800000>; -+ vin-supply = <&vcc_3v3>; -+ regulator-always-on; -+ }; -+ -+ vcc_3v3: regulator-vcc_3v3 { -+ compatible = "regulator-fixed"; -+ regulator-name = "VCC_3V3"; -+ regulator-min-microvolt = <3300000>; -+ regulator-max-microvolt = <3300000>; -+ vin-supply = <&vddao_3v3>; -+ regulator-always-on; -+ }; -+ -+ vddcpu: regulator-vddcpu { -+ /* -+ * MP8756GD Regulator. -+ */ -+ compatible = "pwm-regulator"; -+ -+ regulator-name = "VDDCPU"; -+ regulator-min-microvolt = <721000>; -+ regulator-max-microvolt = <1022000>; -+ -+ pwm-supply = <&main_12v>; -+ -+ pwms = <&pwm_AO_cd 1 1250 0>; -+ pwm-dutycycle-range = <100 0>; -+ -+ regulator-boot-on; -+ regulator-always-on; -+ }; -+ -+ usb_pwr_en: regulator-usb_pwr_en { -+ compatible = "regulator-fixed"; -+ regulator-name = "USB_PWR_EN"; -+ regulator-min-microvolt = <5000000>; -+ regulator-max-microvolt = <5000000>; -+ vin-supply = <&vcc_5v>; -+ -+ /* Connected to the microUSB port power enable */ -+ gpio = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>; -+ enable-active-high; -+ }; -+ -+ vddao_1v8: regulator-vddao_1v8 { -+ compatible = "regulator-fixed"; -+ regulator-name = "VDDAO_1V8"; -+ regulator-min-microvolt = <1800000>; -+ regulator-max-microvolt = <1800000>; -+ vin-supply = <&vddao_3v3>; -+ regulator-always-on; -+ }; -+ -+ vddao_3v3: regulator-vddao_3v3 { -+ compatible = "regulator-fixed"; -+ regulator-name = "VDDAO_3V3"; -+ regulator-min-microvolt = <3300000>; -+ regulator-max-microvolt = <3300000>; -+ vin-supply = <&main_12v>; -+ regulator-always-on; -+ }; -+ -+ hdmi-connector { -+ compatible = "hdmi-connector"; -+ type = "a"; -+ -+ port { -+ hdmi_connector_in: endpoint { -+ remote-endpoint = <&hdmi_tx_tmds_out>; -+ }; -+ }; -+ }; -+ -+ sound { -+ compatible = "amlogic,axg-sound-card"; -+ audio-aux-devs = <&tdmout_b>; -+ audio-routing = "TDM_B Playback", "TDMOUT_B OUT"; -+ -+ assigned-clocks = <&clkc CLKID_MPLL2>, -+ <&clkc CLKID_MPLL0>, -+ <&clkc CLKID_MPLL1>; -+ assigned-clock-parents = <0>, <0>, <0>; -+ assigned-clock-rates = <294912000>, -+ <270950400>, -+ <393216000>; -+ -+ /* 8ch hdmi interface */ -+ dai-link-0 { -+ sound-dai = <&tdmif_b>; -+ dai-format = "i2s"; -+ dai-tdm-slot-tx-mask-0 = <1 1>; -+ dai-tdm-slot-tx-mask-1 = <1 1>; -+ dai-tdm-slot-tx-mask-2 = <1 1>; -+ dai-tdm-slot-tx-mask-3 = <1 1>; -+ mclk-fs = <256>; -+ -+ codec { -+ sound-dai = <&tohdmitx TOHDMITX_I2S_IN_B>; -+ }; -+ }; -+ -+ /* hdmi glue */ -+ dai-link-1 { -+ sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>; -+ -+ codec { -+ sound-dai = <&hdmi_tx>; -+ }; -+ }; -+ }; -+ -+ leds { -+ compatible = "gpio-leds"; -+ -+ led-green { -+ color = ; -+ function = LED_FUNCTION_STATUS; -+ gpios = <&gpio_ao GPIOAO_11 GPIO_ACTIVE_LOW>; -+ linux,default-trigger = "heartbeat"; -+ panic-indicator; -+ }; -+ -+ led-red { -+ color = ; -+ function = LED_FUNCTION_POWER; -+ gpios = <&gpio GPIOH_5 GPIO_ACTIVE_HIGH>; -+ default-state = "on"; -+ }; -+ -+ }; -+ -+ sound { -+ model = "JETHUB-D2"; -+ }; -+ -+ usb-hub { -+ dr_mode = "host"; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ /* USB 2.0 hub with reset gpio */ -+ hub_2_0: hub@1 { -+ compatible = "usb5e3,610"; -+ reg = <1>; -+ reset-gpios = <&gpio GPIOH_4 GPIO_ACTIVE_LOW>; -+ vdd-supply = <&vcc_5v>; -+ }; -+ }; -+ -+}; -+ -+&arb { -+ status = "okay"; -+}; -+ -+&cec_AO { -+ pinctrl-0 = <&cec_ao_a_h_pins>; -+ pinctrl-names = "default"; -+ status = "disabled"; -+ hdmi-phandle = <&hdmi_tx>; -+}; -+ -+&cecb_AO { -+ pinctrl-0 = <&cec_ao_b_h_pins>; -+ pinctrl-names = "default"; -+ status = "okay"; -+ hdmi-phandle = <&hdmi_tx>; -+}; -+ -+&clkc_audio { -+ status = "okay"; -+}; -+ -+&cpu0 { -+ cpu-supply = <&vddcpu>; -+ operating-points-v2 = <&cpu_opp_table>; -+ clocks = <&clkc CLKID_CPU_CLK>; -+ clock-latency = <50000>; -+}; -+ -+&cpu1 { -+ cpu-supply = <&vddcpu>; -+ operating-points-v2 = <&cpu_opp_table>; -+ clocks = <&clkc CLKID_CPU1_CLK>; -+ clock-latency = <50000>; -+}; -+ -+&cpu2 { -+ cpu-supply = <&vddcpu>; -+ operating-points-v2 = <&cpu_opp_table>; -+ clocks = <&clkc CLKID_CPU2_CLK>; -+ clock-latency = <50000>; -+}; -+ -+&cpu3 { -+ cpu-supply = <&vddcpu>; -+ operating-points-v2 = <&cpu_opp_table>; -+ clocks = <&clkc CLKID_CPU3_CLK>; -+ clock-latency = <50000>; -+}; -+ -+&ext_mdio { -+ external_phy: ethernet-phy@0 { -+ /* Realtek RTL8211F (0x001cc916) */ -+ reg = <0>; -+ max-speed = <1000>; -+ -+ reset-assert-us = <10000>; -+ reset-deassert-us = <80000>; -+ reset-gpios = <&gpio GPIOZ_15 (GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN)>; -+ -+ interrupt-parent = <&gpio_intc>; -+ /* MAC_INTR on GPIOZ_14 */ -+ interrupts = ; -+ }; -+}; -+ -+ðmac { -+ pinctrl-0 = <ð_pins>, <ð_rgmii_pins>; -+ pinctrl-names = "default"; -+ status = "okay"; -+ phy-mode = "rgmii"; -+ phy-handle = <&external_phy>; -+ amlogic,tx-delay-ns = <2>; -+}; -+ -+&gpio { -+ gpio-line-names = -+ /* GPIOZ */ -+ "", "", "", "", "", "", "", "", -+ "", "", "", "", "", "", "", "", -+ /* GPIOH */ -+ "", "", "", "", "", -+ "LED_RED", /* GPIOH_5 */ -+ "I2C_SDA_MODULES", /* GPIOH_6 */ -+ "I2C_SCL_MODULES", /* GPIOH_7 */ -+ "", -+ /* BOOT */ -+ "", "", "", "", "", "", "", "", -+ "", "", "", "", "", "", "", "", -+ /* GPIOC */ -+ "", "", "", "", "", "", "", "", -+ /* GPIOA */ -+ "", "", "", "", "", "", "", "", -+ "", "", "", "", "", "", -+ "I2C_SDA_SYSBUS", /* GPIOA_14 */ -+ "I2C_SCL_SYSBUS", /* GPIOA_15 */ -+ /* GPIOX */ -+ "", /* GPIOX_0 */ -+ "", /* GPIOX_1 */ -+ "", /* GPIOX_2 */ -+ "", /* GPIOX_3 */ -+ "", /* GPIOX_4 */ -+ "", /* GPIOX_5 */ -+ "RS485_TX", /* GPIOX_6 */ -+ "RS485_RX", /* GPIOX_7 */ -+ "", /* GPIOX_8 */ -+ "", /* GPIOX_9 */ -+ "", /* GPIOX_10 */ -+ "", /* GPIOX_11 */ -+ "", /* GPIOX_12 */ -+ "", /* GPIOX_13 */ -+ "", /* GPIOX_14 */ -+ "", /* GPIOX_15 */ -+ "", /* GPIOX_16 */ -+ "I2C_SDA_LCDBUS", /* GPIOX_17 */ -+ "I2C_SCL_LCDBUS", /* GPIOX_18 */ -+ ""; /* GPIOX_19 */ -+}; -+ -+&gpio_ao { -+ gpio-line-names = -+ /* GPIOAO */ -+ "", "", "", "", -+ "MCU_RESET", /* GPIOAO_4 */ -+ "POWER_GOOD", /* GPIOAO_5 */ -+ "", -+ "GPIO_EXPANDER", /* GPIOAO_7 */ -+ "MCU_UART_TX", /* GPIOAO_8 */ -+ "MCU_UART_RX", /* GPIOAO_9 */ -+ "BUTTON_USR", /* GPIOAO_10 */ -+ "LED_GREEN", /* GPIOAO_11 */ -+ /* GPIOE */ -+ "", "", ""; -+}; -+ -+&hdmi_tx { -+ status = "okay"; -+ pinctrl-0 = <&hdmitx_hpd_pins>, <&hdmitx_ddc_pins>; -+ pinctrl-names = "default"; -+ hdmi-supply = <&vcc_5v>; -+}; -+ -+&hdmi_tx_tmds_port { -+ hdmi_tx_tmds_out: endpoint { -+ remote-endpoint = <&hdmi_connector_in>; -+ }; -+}; -+ -+&pwm_AO_cd { -+ pinctrl-0 = <&pwm_ao_d_e_pins>; // GPIOE_1 -+ pinctrl-names = "default"; -+ clocks = <&xtal>; -+ clock-names = "clkin1"; -+ status = "okay"; -+}; -+ -+&saradc { -+ status = "okay"; -+}; -+ -+/* SD card */ -+&sd_emmc_b { -+ status = "okay"; -+ pinctrl-0 = <&sdcard_c_pins>; -+ pinctrl-1 = <&sdcard_clk_gate_c_pins>; -+ pinctrl-names = "default", "clk-gate"; -+ -+ bus-width = <4>; -+ cap-sd-highspeed; -+ max-frequency = <200000000>; -+ sd-uhs-sdr12; -+ sd-uhs-sdr25; -+ sd-uhs-sdr50; -+ sd-uhs-sdr104; -+ disable-wp; -+ -+ cd-gpios = <&gpio GPIOC_6 GPIO_ACTIVE_LOW>; -+ vmmc-supply = <&tflash_vdd>; -+ vqmmc-supply = <&tf_io>; -+}; -+ -+/* eMMC */ -+&sd_emmc_c { -+ status = "okay"; -+ pinctrl-0 = <&emmc_ctrl_pins>, <&emmc_data_8b_pins>, <&emmc_ds_pins>; -+ pinctrl-1 = <&emmc_clk_gate_pins>; -+ pinctrl-names = "default", "clk-gate"; -+ -+ bus-width = <8>; -+ cap-mmc-highspeed; -+ mmc-ddr-1_8v; -+ mmc-hs200-1_8v; -+ max-frequency = <200000000>; -+ disable-wp; -+ -+ mmc-pwrseq = <&emmc_pwrseq>; -+ vmmc-supply = <&vcc_3v3>; -+ vqmmc-supply = <&flash_1v8>; -+}; -+ -+&spifc { -+ status = "disabled"; -+ pinctrl-0 = <&nor_pins>; -+ pinctrl-names = "default"; -+ -+ flash@0 { -+ #address-cells = <1>; -+ #size-cells = <1>; -+ compatible = "jedec,spi-nor"; -+ reg = <0>; -+ spi-max-frequency = <104000000>; -+ }; -+}; -+ -+&tdmif_b { -+ status = "okay"; -+}; -+ -+&tdmout_b { -+ status = "okay"; -+}; -+ -+&tohdmitx { -+ status = "okay"; -+}; -+ -+&uart_AO { -+ status = "okay"; -+ pinctrl-0 = <&uart_ao_a_pins>; -+ pinctrl-names = "default"; -+}; -+ -+&uart_AO_B { -+ status = "okay"; -+ pinctrl-0 = <&uart_ao_b_8_9_pins>; -+ pinctrl-names = "default"; -+}; -+ -+&uart_B { -+ status = "okay"; -+ pinctrl-0 = <&uart_b_pins>; -+ pinctrl-names = "default"; -+}; -+ -+ -+&usb { -+ status = "okay"; -+ vbus-supply = <&usb_pwr_en>; -+}; -+ -+&usb2_phy0 { -+ phy-supply = <&vcc_5v>; -+}; -+ -+ -+/* I2C for modules */ -+&i2c1 { -+ status = "okay"; -+ pinctrl-0 = <&i2c1_sda_h6_pins>, <&i2c1_sck_h7_pins>; -+ pinctrl-names = "default"; -+ -+ /* GPIO expander */ -+ u9: gpio@22 { -+ compatible = "nxp,pca9535"; -+ reg = <0x22>; -+ gpio-controller; -+ #gpio-cells = <2>; -+ interrupt-controller; -+ #interrupt-cells = <2>; -+ interrupt-parent = <&gpio_intc>; -+ interrupts = ; -+ -+ gpio-line-names = -+ "RELAY_1", "RELAY_2", -+ "", "", -+ "UXM1_RESET", "UXM1_BOOT", -+ "UXM2_RESET", "UXM2_BOOT", -+ "DIN_1", "DIN_2", "DIN_3", -+ "","","","",""; -+ }; -+ -+ /* 1-wire */ -+ w1: onewire@18 { -+ compatible = "maxim,ds2482"; -+ reg = <0x18>; -+ }; -+ -+}; -+ -+ -+/* I2C for lcd/etc */ -+&i2c2 { -+ status = "okay"; -+ pinctrl-0 = <&i2c2_sda_x_pins>, <&i2c2_sck_x_pins>; -+ pinctrl-names = "default"; -+}; -+ -+/* I2C_EE_M3: I2C for CPU board */ -+&i2c3 { -+ status = "okay"; -+ pinctrl-0 = <&i2c3_sda_a_pins>, <&i2c3_sck_a_pins>; -+ pinctrl-names = "default"; -+ -+ /* I2C for rtc */ -+ rtc: rtc@51 { -+ status = "okay"; -+ compatible = "nxp,pcf8563"; -+ reg = <0x51>; -+ wakeup-source; -+ }; -+ -+ /* FRAM on base board */ -+ fram: eeprom@52 { -+ compatible = "atmel,24c64"; -+ reg = <0x52>; -+ pagesize = <0x20>; -+ label = "fram"; -+ address-width = <0x10>; -+ vcc-supply = <&vddao_3v3>; -+ }; -+ -+ /* EEPROM on CPU board */ -+ eepromc: eeprom@54 { -+ compatible = "atmel,24c64"; -+ reg = <0x54>; -+ pagesize = <0x20>; -+ label = "eepromc"; -+ address-width = <0x10>; -+ vcc-supply = <&vddao_3v3>; -+ }; -+ -+ /* EEPROM on base board */ -+ eeprompd: eeprom@56 { -+ compatible = "atmel,24c64"; -+ reg = <0x56>; -+ pagesize = <0x20>; -+ label = "eeprompd"; -+ address-width = <0x10>; -+ vcc-supply = <&vddao_3v3>; -+ }; -+ -+ /* EEPROM on power module */ -+ eeprompm: eeprom@57 { -+ compatible = "atmel,24c64"; -+ reg = <0x57>; -+ pagesize = <0x20>; -+ label = "eeprompm"; -+ address-width = <0x10>; -+ vcc-supply = <&vddao_3v3>; -+ }; -+ -+ /* temperature sensors */ -+ temp1: tmp102@48 { -+ compatible = "ti,tmp102"; -+ reg = <0x48>; -+ }; -+ -+ temp2: tmp102@49 { -+ compatible = "ti,tmp102"; -+ reg = <0x49>; -+ }; -+ -+}; --- -2.45.2 - diff --git a/patch/kernel/archive/meson64-6.9/jethome-0005-jethub-j200-add-meson64-reset-driver.patch b/patch/kernel/archive/meson64-6.9/jethome-0005-jethub-j200-add-meson64-reset-driver.patch deleted file mode 100644 index 2543377a400d..000000000000 --- a/patch/kernel/archive/meson64-6.9/jethome-0005-jethub-j200-add-meson64-reset-driver.patch +++ /dev/null @@ -1,33 +0,0 @@ -From d2a9ccf69cfc856f873372784a46b5088dd2aada Mon Sep 17 00:00:00 2001 -From: Viacheslav Bocharov -Date: Thu, 13 Jun 2024 10:17:07 +0300 -Subject: [PATCH 3/3] add meson64-reset driver - ---- - .../boot/dts/amlogic/meson-sm1-jethome-jethub-j200.dts | 10 ++++++++++ - 1 file changed, 10 insertions(+) - -diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1-jethome-jethub-j200.dts b/arch/arm64/boot/dts/amlogic/meson-sm1-jethome-jethub-j200.dts -index c309f25374b3..4c84ed0db1cc 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-sm1-jethome-jethub-j200.dts -+++ b/arch/arm64/boot/dts/amlogic/meson-sm1-jethome-jethub-j200.dts -@@ -213,6 +213,16 @@ codec { - }; - }; - -+ meson64-reboot { -+ compatible = "meson64,reboot"; -+ sys_reset = <0x84000009>; -+ sys_poweroff = <0x84000008>; -+ -+ sd-vqen = <&gpio GPIOE_2 GPIO_ACTIVE_HIGH>; -+ sd-vqsw = <&gpio_ao GPIOAO_6 GPIO_ACTIVE_HIGH>; -+ sd-vmmc = <&gpio_ao GPIOAO_3 GPIO_ACTIVE_HIGH>; -+ }; -+ - leds { - compatible = "gpio-leds"; - --- -2.45.2 - diff --git a/patch/u-boot/v2023.10/board_jethubj100/0006-HACK-force-disable-efi-options-for-JetHub-D1-H1.patch b/patch/u-boot/v2023.10/board_jethubj100/0006-HACK-force-disable-efi-options-for-JetHub-D1-H1.patch.disable similarity index 100% rename from patch/u-boot/v2023.10/board_jethubj100/0006-HACK-force-disable-efi-options-for-JetHub-D1-H1.patch rename to patch/u-boot/v2023.10/board_jethubj100/0006-HACK-force-disable-efi-options-for-JetHub-D1-H1.patch.disable diff --git a/patch/u-boot/v2023.10/board_jethubj80/0006-HACK-force-disable-efi-options-for-JetHub-D1-H1.patch b/patch/u-boot/v2023.10/board_jethubj80/0006-HACK-force-disable-efi-options-for-JetHub-D1-H1.patch.disable similarity index 100% rename from patch/u-boot/v2023.10/board_jethubj80/0006-HACK-force-disable-efi-options-for-JetHub-D1-H1.patch rename to patch/u-boot/v2023.10/board_jethubj80/0006-HACK-force-disable-efi-options-for-JetHub-D1-H1.patch.disable diff --git a/patch/u-boot/v2024.01/board_jethubj200/0003-fix-j200.patch b/patch/u-boot/v2024.01/board_jethubj200/0003-fix-j200.patch deleted file mode 100644 index 9f86d1b8c5e0..000000000000 --- a/patch/u-boot/v2024.01/board_jethubj200/0003-fix-j200.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 0673b2022ab73c4620896ba2510093bc9a81699a Mon Sep 17 00:00:00 2001 -From: Viacheslav Bocharov -Date: Tue, 23 Jan 2024 12:22:47 +0300 -Subject: [PATCH 3/3] fix j200 - ---- - configs/jethub_j200_defconfig | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/configs/jethub_j200_defconfig b/configs/jethub_j200_defconfig -index 340fbb10da..4d3e9d384b 100644 ---- a/configs/jethub_j200_defconfig -+++ b/configs/jethub_j200_defconfig -@@ -45,6 +45,7 @@ CONFIG_DFU_RAM=y - CONFIG_DM_I2C=y - CONFIG_SYS_I2C_MESON=y - CONFIG_MMC_MESON_GX=y -+CONFIG_MTD_UBI=y - CONFIG_PHY_REALTEK=y - CONFIG_DM_MDIO=y - CONFIG_DM_MDIO_MUX=y -@@ -98,3 +99,5 @@ CONFIG_DM_REGULATOR_GPIO=y - CONFIG_SPI=y - CONFIG_DM_SPI=y - CONFIG_MESON_SPIFC=y -+CONFIG_RANDOM_UUID=y -+CONFIG_CMD_PART=y --- -2.34.1 - diff --git a/patch/u-boot/v2024.01/board_jethubj200/0004-HACK-mmc-meson-gx-limit-to-24MHz.patch.diff b/patch/u-boot/v2024.01/board_jethubj200/0004-HACK-mmc-meson-gx-limit-to-24MHz.patch.diff deleted file mode 100644 index 865ba5022f9a..000000000000 --- a/patch/u-boot/v2024.01/board_jethubj200/0004-HACK-mmc-meson-gx-limit-to-24MHz.patch.diff +++ /dev/null @@ -1,29 +0,0 @@ ---- /dev/null -+++ b/patch/u-boot/v2024.01/board_jethubj200/0004-HACK-mmc-meson-gx-limit-to-24MHz.patch -@@ -0,0 +1,26 @@ -+From 212179dba7d0cd2d932b086c6c8e440372248ada Mon Sep 17 00:00:00 2001 -+From: Neil Armstrong -+Date: Mon, 2 Sep 2019 15:42:04 +0200 -+Subject: [PATCH 04/20] HACK: mmc: meson-gx: limit to 24MHz -+ -+Signed-off-by: Neil Armstrong -+--- -+ drivers/mmc/meson_gx_mmc.c | 2 +- -+ 1 file changed, 1 insertion(+), 1 deletion(-) -+ -+diff --git a/drivers/mmc/meson_gx_mmc.c b/drivers/mmc/meson_gx_mmc.c -+index fcf4f03d1e2..6ded4b619bf 100644 -+--- a/drivers/mmc/meson_gx_mmc.c -++++ b/drivers/mmc/meson_gx_mmc.c -+@@ -279,7 +279,7 @@ static int meson_mmc_probe(struct udevice *dev) -+ cfg->host_caps = MMC_MODE_8BIT | MMC_MODE_4BIT | -+ MMC_MODE_HS_52MHz | MMC_MODE_HS; -+ cfg->f_min = DIV_ROUND_UP(SD_EMMC_CLKSRC_24M, CLK_MAX_DIV); -+- cfg->f_max = 100000000; /* 100 MHz */ -++ cfg->f_max = SD_EMMC_CLKSRC_24M; -+ cfg->b_max = 511; /* max 512 - 1 blocks */ -+ cfg->name = dev->name; -+ -+-- -+2.45.1 -+ diff --git a/patch/u-boot/v2024.01/board_jethubj200/0002-jethub-D2-j200-add.patch b/patch/u-boot/v2024.07/board_jethubj200/0001-Add-JetHub-D2.patch similarity index 69% rename from patch/u-boot/v2024.01/board_jethubj200/0002-jethub-D2-j200-add.patch rename to patch/u-boot/v2024.07/board_jethubj200/0001-Add-JetHub-D2.patch index dfeed8dad31d..e77a23b72d6c 100644 --- a/patch/u-boot/v2024.01/board_jethubj200/0002-jethub-D2-j200-add.patch +++ b/patch/u-boot/v2024.07/board_jethubj200/0001-Add-JetHub-D2.patch @@ -1,43 +1,71 @@ -From 7160af7b3b2a2a7fedb9104bcdefddf114467358 Mon Sep 17 00:00:00 2001 +From 7c0d110e84f30723172475e018294b45a0db58ee Mon Sep 17 00:00:00 2001 From: Viacheslav Bocharov -Date: Mon, 22 Jan 2024 18:38:08 +0300 -Subject: [PATCH 2/2] jethub D2 j200 add +Date: Thu, 27 Jun 2024 16:20:54 +0300 +Subject: [PATCH 1/2] Add JetHub D2 --- - arch/arm/dts/Makefile | 1 + - .../arm/dts/meson-sm1-jethome-jethub-j200.dts | 614 ++++++++++++++++++ + arch/arm/dts/Makefile | 3 +- + .../meson-sm1-jethome-jethub-j200-u-boot.dtsi | 13 + + .../arm/dts/meson-sm1-jethome-jethub-j200.dts | 654 ++++++++++++++++++ board/amlogic/jethub-j200/MAINTAINERS | 8 + board/amlogic/jethub-j200/Makefile | 6 + - board/amlogic/jethub-j200/jethub-j200.c | 76 +++ - configs/jethub_j200_defconfig | 100 +++ - 6 files changed, 805 insertions(+) + board/amlogic/jethub-j200/jethub-j200.c | 89 +++ + configs/jethub_j200_defconfig | 119 ++++ + doc/board/amlogic/index.rst | 1 + + doc/board/amlogic/jethub-j200.rst | 50 ++ + drivers/power/regulator/regulator-uclass.c | 2 +- + include/configs/jethub.h | 8 + + 11 files changed, 951 insertions(+), 2 deletions(-) + create mode 100644 arch/arm/dts/meson-sm1-jethome-jethub-j200-u-boot.dtsi create mode 100644 arch/arm/dts/meson-sm1-jethome-jethub-j200.dts create mode 100644 board/amlogic/jethub-j200/MAINTAINERS create mode 100644 board/amlogic/jethub-j200/Makefile create mode 100644 board/amlogic/jethub-j200/jethub-j200.c create mode 100644 configs/jethub_j200_defconfig + create mode 100644 doc/board/amlogic/jethub-j200.rst diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile -index b5c588c336..33b5afe133 100644 +index 8fb6a8a1f17..701bf093259 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile -@@ -249,6 +249,7 @@ dtb-$(CONFIG_ARCH_MESON) += \ - meson-g12b-radxa-zero2.dtb \ - meson-sm1-bananapi-m2-pro.dtb \ - meson-sm1-bananapi-m5.dtb \ -+ meson-sm1-jethome-jethub-j200.dtb \ - meson-sm1-khadas-vim3l.dtb \ - meson-sm1-odroid-c4.dtb \ - meson-sm1-odroid-hc4.dtb \ +@@ -100,7 +100,8 @@ dtb-$(CONFIG_ARCH_S5P4418) += \ + s5p4418-nanopi2.dtb + + dtb-$(CONFIG_ARCH_MESON) += \ +- meson-a1-ad401.dtb ++ meson-a1-ad401.dtb \ ++ meson-sm1-jethome-jethub-j200.dtb + + dtb-$(CONFIG_ARCH_TEGRA) += tegra20-harmony.dtb \ + tegra20-medcom-wide.dtb \ +diff --git a/arch/arm/dts/meson-sm1-jethome-jethub-j200-u-boot.dtsi b/arch/arm/dts/meson-sm1-jethome-jethub-j200-u-boot.dtsi +new file mode 100644 +index 00000000000..a6f11e8cdfb +--- /dev/null ++++ b/arch/arm/dts/meson-sm1-jethome-jethub-j200-u-boot.dtsi +@@ -0,0 +1,13 @@ ++// SPDX-License-Identifier: (GPL-2.0+ OR MIT) ++ ++/* ++ * Replace emmc_data_8b_pins to emmc_data_4b_pins from sd_emmc_c pinctrl-0, and change bus-width to 4 then spifc can be enabled. ++ */ ++&sd_emmc_c { ++ pinctrl-0 = <&emmc_ctrl_pins>, <&emmc_data_4b_pins>, <&emmc_ds_pins>; ++ bus-width = <4>; ++}; ++ ++&spifc { ++ status = "okay"; ++}; diff --git a/arch/arm/dts/meson-sm1-jethome-jethub-j200.dts b/arch/arm/dts/meson-sm1-jethome-jethub-j200.dts new file mode 100644 -index 0000000000..9ebe3effb6 +index 00000000000..3151a99974c --- /dev/null +++ b/arch/arm/dts/meson-sm1-jethome-jethub-j200.dts -@@ -0,0 +1,614 @@ +@@ -0,0 +1,654 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* -+ * Copyright (c) 2020 JetHome ++ * Copyright (c) 2024 JetHome + * Author: Viacheslav Bocharov + */ + @@ -51,13 +79,14 @@ index 0000000000..9ebe3effb6 + + +/ { -+ ++ + compatible = "jethome,jethub-j200", "amlogic,sm1"; + model = "JetHome JetHub D2"; + + aliases { + serial0 = &uart_AO; + ethernet0 = ðmac; ++ rtc0 = &rtc; + }; + + chosen { @@ -81,7 +110,7 @@ index 0000000000..9ebe3effb6 + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + -+ gpio = <&gpio_ao GPIOAO_3 GPIO_OPEN_DRAIN>; // #TODO: check ++ gpio = <&gpio_ao GPIOAO_3 GPIO_OPEN_DRAIN>; + enable-active-high; + regulator-always-on; + }; @@ -98,7 +127,7 @@ index 0000000000..9ebe3effb6 + enable-active-high; + regulator-always-on; + -+ gpios = <&gpio_ao GPIOAO_6 GPIO_OPEN_SOURCE>; // #TODO: check ++ gpios = <&gpio_ao GPIOAO_6 GPIO_OPEN_SOURCE>; + gpios-states = <0>; + + states = <3300000 0>, @@ -129,7 +158,7 @@ index 0000000000..9ebe3effb6 + regulator-max-microvolt = <5000000>; + regulator-always-on; + vin-supply = <&main_12v>; -+ gpio = <&gpio GPIOH_8 GPIO_OPEN_DRAIN>; // #TODO: check ++ gpio = <&gpio GPIOH_8 GPIO_OPEN_DRAIN>; + enable-active-high; + }; + @@ -149,7 +178,6 @@ index 0000000000..9ebe3effb6 + regulator-max-microvolt = <3300000>; + vin-supply = <&vddao_3v3>; + regulator-always-on; -+ /* FIXME: actually controlled by VDDCPU_B_EN */ + }; + + vddcpu: regulator-vddcpu { @@ -178,7 +206,7 @@ index 0000000000..9ebe3effb6 + regulator-max-microvolt = <5000000>; + vin-supply = <&vcc_5v>; + -+ /* Connected to the microUSB port power enable */ ++ /* Connected to the internal USB-Hub */ + gpio = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>; + enable-active-high; + }; @@ -255,7 +283,7 @@ index 0000000000..9ebe3effb6 + sys_reset = <0x84000009>; + sys_poweroff = <0x84000008>; + -+ sd-vqen = <&gpio_ao GPIOE_2 GPIO_ACTIVE_HIGH>; ++ sd-vqen = <&gpio GPIOE_2 GPIO_ACTIVE_HIGH>; + sd-vqsw = <&gpio_ao GPIOAO_6 GPIO_ACTIVE_HIGH>; + sd-vmmc = <&gpio_ao GPIOAO_3 GPIO_ACTIVE_HIGH>; + }; @@ -263,22 +291,21 @@ index 0000000000..9ebe3effb6 + leds { + compatible = "gpio-leds"; + -+ led-red { -+ color = ; ++ led-green { ++ color = ; + function = LED_FUNCTION_STATUS; + gpios = <&gpio_ao GPIOAO_11 GPIO_ACTIVE_LOW>; + linux,default-trigger = "heartbeat"; + panic-indicator; + }; -+ /* ++ + led-red { + color = ; + function = LED_FUNCTION_POWER; -+ gpios = <&gpio_ao GPIOAO_7 GPIO_ACTIVE_HIGH>; -+ default-state = "on"; ++ gpios = <&gpio GPIOH_5 GPIO_ACTIVE_LOW>; ++ default-state = "off"; + }; + -+ */ + }; + + sound { @@ -287,7 +314,6 @@ index 0000000000..9ebe3effb6 + +}; + -+ +&arb { + status = "okay"; +}; @@ -350,8 +376,7 @@ index 0000000000..9ebe3effb6 + + interrupt-parent = <&gpio_intc>; + /* MAC_INTR on GPIOZ_14 */ -+ interrupts = <26 IRQ_TYPE_LEVEL_LOW>; -+ /* interrupts = ;*/ ++ interrupts = ; + }; +}; + @@ -370,7 +395,8 @@ index 0000000000..9ebe3effb6 + "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", + /* GPIOH */ -+ "", "", "", "", "", ++ "", "", "", "", ++ "HUB_RESET", /* GPIOH_4 */ + "LED_RED", /* GPIOH_5 */ + "I2C_SDA_MODULES", /* GPIOH_6 */ + "I2C_SCL_MODULES", /* GPIOH_7 */ @@ -406,20 +432,35 @@ index 0000000000..9ebe3effb6 + "I2C_SDA_LCDBUS", /* GPIOX_17 */ + "I2C_SCL_LCDBUS", /* GPIOX_18 */ + ""; /* GPIOX_19 */ ++ /* ++ * WARNING: The USB Hub needs a reset signal to be turned low in ++ * order to be detected by the USB Controller. This signal should ++ * be handled by a USB specific power sequence to reset the Hub ++ * when the USB bus is powered down. ++ */ ++ usb-hub-hog { ++ gpio-hog; ++ gpios = ; ++ output-low; ++ line-name = "usb-hub-reset"; ++ }; ++ +}; + +&gpio_ao { + gpio-line-names = + /* GPIOAO */ -+ "", "", "", "", ++ "", "", ++ "USB_PWRON", /* GPIOAO_2 */ ++ "", + "MCU_RESET", /* GPIOAO_4 */ + "POWER_GOOD", /* GPIOAO_5 */ + "", -+ "MCU_BOOT", /* GPIOAO_7 */ ++ "GPIO_EXPANDER", /* GPIOAO_7 */ + "MCU_UART_TX", /* GPIOAO_8 */ + "MCU_UART_RX", /* GPIOAO_9 */ + "BUTTON_USR", /* GPIOAO_10 */ -+ "LED_SYSTEM", /* GPIOAO_11 */ ++ "LED_GREEN", /* GPIOAO_11 */ + /* GPIOE */ + "", "", ""; +}; @@ -489,26 +530,21 @@ index 0000000000..9ebe3effb6 + vqmmc-supply = <&flash_1v8>; +}; + -+/* -+&sd_emmc_c { -+ pinctrl-0 = <&emmc_ctrl_pins>, <&emmc_data_4b_pins>, <&emmc_ds_pins>; -+ bus-width = <4>; -+}; -+ +&spifc { -+ status = "okay"; ++ status = "disabled"; + pinctrl-0 = <&nor_pins>; + pinctrl-names = "default"; + -+ flash@0 { ++ flash: nor-flash@0 { ++ compatible = "sst,w25q256", "jedec,spi-nor"; + #address-cells = <1>; + #size-cells = <1>; -+ compatible = "jedec,spi-nor"; + reg = <0>; -+ spi-max-frequency = <104000000>; ++ /*spi-max-frequency = <4000000>;*/ /* 4MHz */ ++ /*spi-max-frequency = <104000000>;*/ ++ spi-max-frequency = <30000000>; + }; +}; -+*/ + +&tdmif_b { + status = "okay"; @@ -546,19 +582,6 @@ index 0000000000..9ebe3effb6 + vbus-supply = <&usb_pwr_en>; +}; + -+&dwc2 { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ /* USB 2.0 hub on otg port */ -+ hub_2_0: hub@1 { -+ compatible = "usb4b4,6504"; /* use 10000us timeout for reset */ -+ reg = <1>; -+ reset-gpios = <&gpio GPIOH_4 GPIO_ACTIVE_LOW>; -+ vdd-supply = <&vcc_5v>; -+ }; -+}; -+ +&usb2_phy0 { + phy-supply = <&vcc_5v>; +}; @@ -569,6 +592,33 @@ index 0000000000..9ebe3effb6 + status = "okay"; + pinctrl-0 = <&i2c1_sda_h6_pins>, <&i2c1_sck_h7_pins>; + pinctrl-names = "default"; ++ ++ /* GPIO expander */ ++ u9: gpio@22 { ++ compatible = "nxp,pca9535"; ++ reg = <0x22>; ++ gpio-controller; ++ #gpio-cells = <2>; ++ interrupt-controller; ++ #interrupt-cells = <2>; ++ interrupt-parent = <&gpio_intc>; ++ interrupts = ; ++ ++ gpio-line-names = ++ "RELAY_1", "RELAY_2", ++ "", "", ++ "UXM1_RESET", "UXM1_BOOT", ++ "UXM2_RESET", "UXM2_BOOT", ++ "DIN_1", "DIN_2", "DIN_3", ++ "","","","",""; ++ }; ++ ++ /* 1-wire */ ++ w1: onewire@18 { ++ compatible = "maxim,ds2482"; ++ reg = <0x18>; ++ }; ++ +}; + + @@ -579,27 +629,12 @@ index 0000000000..9ebe3effb6 + pinctrl-names = "default"; +}; + -+/* I2C for CPU board */ ++/* I2C_EE_M3: I2C for CPU board */ +&i2c3 { + status = "okay"; + pinctrl-0 = <&i2c3_sda_a_pins>, <&i2c3_sck_a_pins>; + pinctrl-names = "default"; + -+ u9: gpio@20 { -+ compatible = "nxp,pca9535"; -+ reg = <0x20>; -+ gpio-controller; -+ #gpio-cells = <2>; -+ -+ gpio-line-names = -+ "RELAY_1", "RELAY_2", -+ "", "", -+ "UXM1_RESET", "UXM1_BOOT", -+ "UXM2_RESET", "UXM2_BOOT", -+ "DIN_1", "DIN_2", "DIN_3", -+ "","","","",""; -+ }; -+ + /* I2C for rtc */ + rtc: rtc@51 { + status = "okay"; @@ -648,11 +683,43 @@ index 0000000000..9ebe3effb6 + vcc-supply = <&vddao_3v3>; + }; + ++ /* temperature sensors */ ++ temp1: tmp102@48 { ++ compatible = "ti,tmp102"; ++ reg = <0x48>; ++ }; ++ ++ temp2: tmp102@49 { ++ compatible = "ti,tmp102"; ++ reg = <0x49>; ++ }; ++ ++}; ++ ++&efuse { ++ eth_mac: eth-mac@0 { ++ reg = <0x0 0x6>; ++ }; ++ ++ bt_mac: bt-mac@6 { ++ reg = <0x6 0x6>; ++ }; ++ ++ wifi_mac: wifi-mac@c { ++ reg = <0xc 0x6>; ++ }; ++ ++ bid: bid@12 { ++ reg = <0x12 0x20>; ++ }; ++ ++ sn: sn@32 { ++ reg = <0x32 0x20>; ++ }; +}; -\ No newline at end of file diff --git a/board/amlogic/jethub-j200/MAINTAINERS b/board/amlogic/jethub-j200/MAINTAINERS new file mode 100644 -index 0000000000..82f4e1c40f +index 00000000000..82f4e1c40fd --- /dev/null +++ b/board/amlogic/jethub-j200/MAINTAINERS @@ -0,0 +1,8 @@ @@ -666,7 +733,7 @@ index 0000000000..82f4e1c40f +F: include/configs/jethub.h diff --git a/board/amlogic/jethub-j200/Makefile b/board/amlogic/jethub-j200/Makefile new file mode 100644 -index 0000000000..cb1f5cbcb2 +index 00000000000..cb1f5cbcb26 --- /dev/null +++ b/board/amlogic/jethub-j200/Makefile @@ -0,0 +1,6 @@ @@ -678,10 +745,10 @@ index 0000000000..cb1f5cbcb2 +obj-y := jethub-j200.o diff --git a/board/amlogic/jethub-j200/jethub-j200.c b/board/amlogic/jethub-j200/jethub-j200.c new file mode 100644 -index 0000000000..d8b6d96356 +index 00000000000..8fed8a7a1d9 --- /dev/null +++ b/board/amlogic/jethub-j200/jethub-j200.c -@@ -0,0 +1,76 @@ +@@ -0,0 +1,89 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2024 JetHome @@ -695,10 +762,12 @@ index 0000000000..d8b6d96356 +#include +#include +#include ++#include +#include +#include +#include +#include ++#include + +#define EFUSE_SN_OFFSET 50 +#define EFUSE_SN_SIZE 32 @@ -707,7 +776,6 @@ index 0000000000..d8b6d96356 +#define EFUSE_USID_OFFSET 18 +#define EFUSE_USID_SIZE 32 + -+// #TODO: recheck this +int mmc_get_env_dev(void) +{ + if (meson_get_boot_device() == BOOT_DEVICE_EMMC) @@ -715,22 +783,42 @@ index 0000000000..d8b6d96356 + return 0; +} + ++static void init_board_power(void) ++{ ++ struct gpio_desc *usb_hog; ++ int ret = 0; ++ ++ ret = gpio_hog_lookup_name("usb-hub-hog", &usb_hog); ++ if (ret) ++ goto err; ++ ++ ret = dm_gpio_set_value(usb_hog, false); ++ if (ret && ret != -EALREADY) ++ goto err; ++ ++ return; ++err: ++ printf("%s: Failed to init USB power %i\n", __func__, ret); ++} ++ +int misc_init_r(void) +{ + u8 mac_addr[EFUSE_MAC_SIZE]; + char serial[EFUSE_SN_SIZE]; + char usid[EFUSE_USID_SIZE]; + ssize_t len; -+ /* unsigned int adcval;*/ -+ /* int ret;*/ ++ ++ init_board_power(); + + if (!eth_env_get_enetaddr("ethaddr", mac_addr)) { + len = meson_sm_read_efuse(EFUSE_MAC_OFFSET, + mac_addr, EFUSE_MAC_SIZE); + if (len == EFUSE_MAC_SIZE && is_valid_ethaddr(mac_addr)) + eth_env_set_enetaddr("ethaddr", mac_addr); -+ else ++ else { ++ printf("eFuse MAC address is not valid\n"); + meson_generate_serial_ethaddr(); ++ } + } + + if (!env_get("serial")) { @@ -747,23 +835,16 @@ index 0000000000..d8b6d96356 + env_set("usid", usid); + } + -+/* #TODO: rewrite to read gpio GPIOAO_10 -+ ret = adc_channel_single_shot("adc@8680", 0, &adcval); -+ if (adcval < 3000) -+ env_set("userbutton", "true"); -+ else -+ env_set("userbutton", "false"); -+ -+*/ -+ + return 0; +} ++ diff --git a/configs/jethub_j200_defconfig b/configs/jethub_j200_defconfig new file mode 100644 -index 0000000000..340fbb10da +index 00000000000..3ae5d885c58 --- /dev/null +++ b/configs/jethub_j200_defconfig -@@ -0,0 +1,100 @@ +@@ -0,0 +1,119 @@ ++CONFIG_OF_UPSTREAM=n +CONFIG_ARM=y +CONFIG_SYS_BOARD="jethub-j200" +CONFIG_SYS_CONFIG_NAME="jethub" @@ -781,7 +862,7 @@ index 0000000000..340fbb10da +CONFIG_DEBUG_UART_BASE=0xff803000 +CONFIG_DEBUG_UART_CLOCK=24000000 +CONFIG_IDENT_STRING=" jethubj200" -+CONFIG_SYS_LOAD_ADDR=0x01000000 ++CONFIG_SYS_LOAD_ADDR=0x1000000 +CONFIG_DEBUG_UART=y +CONFIG_REMAKE_ELF=y +CONFIG_FIT=y @@ -802,15 +883,23 @@ index 0000000000..340fbb10da +CONFIG_CMD_MMC=y +CONFIG_CMD_USB=y +CONFIG_CMD_USB_MASS_STORAGE=y ++CONFIG_CMD_SETEXPR=y +CONFIG_CMD_RTC=y +CONFIG_CMD_REGULATOR=y +CONFIG_PARTITION_TYPE_GUID=y +CONFIG_OF_CONTROL=y +CONFIG_SYS_RELOC_GD_ENV_ADDR=y ++CONFIG_ADC=y ++CONFIG_SARADC_MESON=y +CONFIG_DFU_RAM=y +CONFIG_DM_I2C=y +CONFIG_SYS_I2C_MESON=y +CONFIG_MMC_MESON_GX=y ++CONFIG_MTD=y ++CONFIG_DM_MTD=y ++CONFIG_DM_SPI_FLASH=y ++CONFIG_SPI_FLASH_WINBOND=y ++CONFIG_SPI_FLASH_XTX=y +CONFIG_PHY_REALTEK=y +CONFIG_DM_MDIO=y +CONFIG_DM_MDIO_MUX=y @@ -823,11 +912,17 @@ index 0000000000..340fbb10da +CONFIG_MESON_EE_POWER_DOMAIN=y +CONFIG_DM_REGULATOR=y +CONFIG_DM_REGULATOR_FIXED=y ++CONFIG_DM_REGULATOR_GPIO=y +CONFIG_DM_RTC=y +CONFIG_RTC_PCF8563=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 @@ -855,15 +950,126 @@ index 0000000000..340fbb10da +CONFIG_BMP_24BPP=y +CONFIG_BMP_32BPP=y + -+CONFIG_MTD=y -+CONFIG_MTD_UBI=y -+CONFIG_DM_MTD=y -+CONFIG_DM_SPI_FLASH=y -+CONFIG_SPI_FLASH_XTX=y -+CONFIG_DM_REGULATOR_GPIO=y -+CONFIG_SPI=y -+CONFIG_DM_SPI=y -+CONFIG_MESON_SPIFC=y ++#CONFIG_MTD_UBI=y ++CONFIG_RANDOM_UUID=y ++CONFIG_CMD_PART=y ++ ++CONFIG_AML_DRIVER=y ++CONFIG_UNIFY_KEY_MANAGE=y ++CONFIG_SECURE_STORAGE=y ++CONFIG_AML_STORAGE=y ++CONFIG_EFUSE=y ++CONFIG_AML_PARTITION=y ++ ++CONFIG_GPIO_HOG=y ++CONFIG_CMD_SPI=y +diff --git a/doc/board/amlogic/index.rst b/doc/board/amlogic/index.rst +index 46f44bf34ec..855fc7d2852 100644 +--- a/doc/board/amlogic/index.rst ++++ b/doc/board/amlogic/index.rst +@@ -95,6 +95,7 @@ Board Documentation + beelink-gtkingpro + jethub-j80 + jethub-j100 ++ jethub-j200 + khadas-vim + khadas-vim2 + khadas-vim3 +diff --git a/doc/board/amlogic/jethub-j200.rst b/doc/board/amlogic/jethub-j200.rst +new file mode 100644 +index 00000000000..9441cf99bf8 +--- /dev/null ++++ b/doc/board/amlogic/jethub-j200.rst +@@ -0,0 +1,50 @@ ++.. SPDX-License-Identifier: GPL-2.0+ ++ ++U-Boot for JetHub D2 (J200) ++=================================== ++ ++JetHome Jethub D2 (http://jethome.ru/jethub-d2) is a home automation controller device ++manufactured by JetHome with the following specifications: ++ ++ - Amlogic S905X3 (ARM Cortex-A55) quad-core up to 2.1GHz ++ - micro-HDMI video out ++ - 4Gb DDR4 RAM ++ - 32GB eMMC flash ++ - 1 x USB 2.0 Type-C ++ - 1 x 10/100/1000Mbps ethernet ++ - two module slots (JXM format) ++ - 2 x gpio LEDS ++ - GPIO user Button ++ - DC source with a voltage of 9 to 36V (variable via power module) ++ - DIN Rail Mounting case ++ - 1 x 1-Wire ++ - 1 x RS-485 ++ - 3 x dry contact digital GPIO inputs ++ - 2 x relay GPIO outputs ++ ++U-Boot Compilation ++------------------ ++ ++.. code-block:: bash ++ ++ $ export CROSS_COMPILE=aarch64-none-elf- ++ $ make jethub_j200_defconfig ++ $ make ++ ++U-Boot Signing with Pre-Built FIP repo ++-------------------------------------- ++ ++.. code-block:: bash ++ ++ $ git clone https://github.com/LibreELEC/amlogic-boot-fip --depth=1 ++ $ cd amlogic-boot-fip ++ $ mkdir my-output-dir ++ $ ./build-fip.sh jethub-j200 /path/to/u-boot/u-boot.bin my-output-dir ++ ++Then write U-Boot to SD or eMMC with: ++ ++.. code-block:: bash ++ ++ $ DEV=/dev/boot_device ++ $ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=512 skip=1 seek=1 ++ $ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=440 +diff --git a/drivers/power/regulator/regulator-uclass.c b/drivers/power/regulator/regulator-uclass.c +index d9e1fb68295..2a34d00110d 100644 +--- a/drivers/power/regulator/regulator-uclass.c ++++ b/drivers/power/regulator/regulator-uclass.c +@@ -186,7 +186,7 @@ int regulator_set_enable(struct udevice *dev, bool enable) + } + } + } +- ++ printf("%s: %s, enable=%d, r=%d\n", __func__, dev->name, enable, ret); + return ret; + } + +diff --git a/include/configs/jethub.h b/include/configs/jethub.h +index 2c44bfc853e..58fb10f2430 100644 +--- a/include/configs/jethub.h ++++ b/include/configs/jethub.h +@@ -2,6 +2,7 @@ + /* + * Configuration for JetHome devices + * Copyright (C) 2021 Vyacheslav Bocharov ++ * Copyright (C) 2024 JetHome + * Author: Vyacheslav Bocharov + */ + +@@ -15,6 +16,13 @@ + "run bootcmd_mmc0; " \ + "run bootcmd_usb0;" \ + "fi;\0" ++#elif defined(CONFIG_MESON_G12A) ++#define BOOTENV_DEV_RESCUE(devtypeu, devtypel, instance) \ ++ "bootcmd_rescue=" \ ++ "if gpio input aobus-banks10; then " \ ++ "run bootcmd_mmc0; " \ ++ "run bootcmd_usb0;" \ ++ "fi;\0" + #else + #define BOOTENV_DEV_RESCUE(devtypeu, devtypel, instance) \ + "bootcmd_rescue=" \ -- -2.34.1 +2.45.2 diff --git a/patch/u-boot/v2024.01/board_jethubj200/0001-Add-some-amlogic-sm-functions.patch b/patch/u-boot/v2024.07/board_jethubj200/0002-Add-some-amlogic-sm-functions.patch similarity index 95% rename from patch/u-boot/v2024.01/board_jethubj200/0001-Add-some-amlogic-sm-functions.patch rename to patch/u-boot/v2024.07/board_jethubj200/0002-Add-some-amlogic-sm-functions.patch index a3959078b299..b4ca942beaf0 100644 --- a/patch/u-boot/v2024.01/board_jethubj200/0001-Add-some-amlogic-sm-functions.patch +++ b/patch/u-boot/v2024.07/board_jethubj200/0002-Add-some-amlogic-sm-functions.patch @@ -1,7 +1,7 @@ -From 166c1ab03acbfaafd90d2013eda6ff0a84ab0a91 Mon Sep 17 00:00:00 2001 +From e66a7f0f9cf2d73840668c06cae52c3858da0604 Mon Sep 17 00:00:00 2001 From: Viacheslav Bocharov Date: Tue, 31 Oct 2023 12:16:43 +0300 -Subject: [PATCH 1/2] Add some amlogic sm functions +Subject: [PATCH 2/2] Add some amlogic sm functions --- arch/arm/include/asm/arch-meson/sm.h | 18 ++++++++++ @@ -12,7 +12,7 @@ Subject: [PATCH 1/2] Add some amlogic sm functions 5 files changed, 109 insertions(+), 1 deletion(-) diff --git a/arch/arm/include/asm/arch-meson/sm.h b/arch/arm/include/asm/arch-meson/sm.h -index 4b1d564bc4..57ab90ab1c 100644 +index 4b1d564bc48..57ab90ab1c9 100644 --- a/arch/arm/include/asm/arch-meson/sm.h +++ b/arch/arm/include/asm/arch-meson/sm.h @@ -26,7 +26,16 @@ ssize_t meson_sm_read_efuse(uintptr_t offset, void *buffer, size_t size); @@ -49,7 +49,7 @@ index 4b1d564bc4..57ab90ab1c 100644 REBOOT_REASON_COLD = 0, REBOOT_REASON_NORMAL = 1, diff --git a/arch/arm/mach-meson/sm.c b/arch/arm/mach-meson/sm.c -index 914fd11c98..6f4861a30c 100644 +index 914fd11c989..6f4861a30c0 100644 --- a/arch/arm/mach-meson/sm.c +++ b/arch/arm/mach-meson/sm.c @@ -77,7 +77,26 @@ ssize_t meson_sm_write_efuse(uintptr_t offset, void *buffer, size_t size) @@ -109,7 +109,7 @@ index 914fd11c98..6f4861a30c 100644 #define REBOOT_REASON_MASK GENMASK(15, 12) diff --git a/cmd/meson/sm.c b/cmd/meson/sm.c -index de9a242e17..faa7240621 100644 +index de9a242e17f..faa7240621d 100644 --- a/cmd/meson/sm.c +++ b/cmd/meson/sm.c @@ -33,6 +33,25 @@ static int do_sm_serial(struct cmd_tbl *cmdtp, int flag, int argc, @@ -190,7 +190,7 @@ index de9a242e17..faa7240621 100644 + "sm getmax [name] - get max size of user accesible efuse and store to environment\n" ); diff --git a/drivers/sm/meson-sm.c b/drivers/sm/meson-sm.c -index 15b3b0e267..c98af83a67 100644 +index 15b3b0e2672..c98af83a67b 100644 --- a/drivers/sm/meson-sm.c +++ b/drivers/sm/meson-sm.c @@ -167,6 +167,7 @@ static const struct meson_sm_data meson_sm_gxbb_data = { @@ -202,7 +202,7 @@ index 15b3b0e267..c98af83a67 100644 SET_CMD(MESON_SMC_CMD_EFUSE_WRITE, 0x82000031), SET_CMD(MESON_SMC_CMD_CHIP_ID_GET, 0x82000044), diff --git a/include/meson/sm.h b/include/meson/sm.h -index fbaab1f1ee..99da308fb9 100644 +index fbaab1f1ee0..99da308fb95 100644 --- a/include/meson/sm.h +++ b/include/meson/sm.h @@ -9,6 +9,7 @@ @@ -214,5 +214,5 @@ index fbaab1f1ee..99da308fb9 100644 MESON_SMC_CMD_EFUSE_WRITE, /* write efuse memory */ MESON_SMC_CMD_CHIP_ID_GET, /* readh chip unique id */ -- -2.34.1 +2.45.2 diff --git a/patch/u-boot/v2024.01/board_jethubj200/enable-DT-overlays-support.patch b/patch/u-boot/v2024.07/board_jethubj200/enable-DT-overlays-support.patch similarity index 100% rename from patch/u-boot/v2024.01/board_jethubj200/enable-DT-overlays-support.patch rename to patch/u-boot/v2024.07/board_jethubj200/enable-DT-overlays-support.patch