From 24938adafeea9cd158557891eb85ea0730b41852 Mon Sep 17 00:00:00 2001 From: Viacheslav Bocharov Date: Thu, 13 Jun 2024 09:25:44 +0300 Subject: [PATCH] JetHub D2 (j200) add u-boot 2024.01 patches --- .../0001-Add-some-amlogic-sm-functions.patch | 218 +++++ .../0002-jethub-D2-j200-add.patch | 869 ++++++++++++++++++ .../board_jethubj200/0003-fix-j200.patch | 30 + ...ACK-mmc-meson-gx-limit-to-24MHz.patch.diff | 29 + .../enable-DT-overlays-support.patch | 15 + 5 files changed, 1161 insertions(+) create mode 100644 patch/u-boot/v2024.01/board_jethubj200/0001-Add-some-amlogic-sm-functions.patch create mode 100644 patch/u-boot/v2024.01/board_jethubj200/0002-jethub-D2-j200-add.patch create mode 100644 patch/u-boot/v2024.01/board_jethubj200/0003-fix-j200.patch create mode 100644 patch/u-boot/v2024.01/board_jethubj200/0004-HACK-mmc-meson-gx-limit-to-24MHz.patch.diff create mode 100644 patch/u-boot/v2024.01/board_jethubj200/enable-DT-overlays-support.patch diff --git a/patch/u-boot/v2024.01/board_jethubj200/0001-Add-some-amlogic-sm-functions.patch b/patch/u-boot/v2024.01/board_jethubj200/0001-Add-some-amlogic-sm-functions.patch new file mode 100644 index 000000000000..a3959078b299 --- /dev/null +++ b/patch/u-boot/v2024.01/board_jethubj200/0001-Add-some-amlogic-sm-functions.patch @@ -0,0 +1,218 @@ +From 166c1ab03acbfaafd90d2013eda6ff0a84ab0a91 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 + +--- + arch/arm/include/asm/arch-meson/sm.h | 18 ++++++++++ + arch/arm/mach-meson/sm.c | 41 +++++++++++++++++++++++ + cmd/meson/sm.c | 49 +++++++++++++++++++++++++++- + drivers/sm/meson-sm.c | 1 + + include/meson/sm.h | 1 + + 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 +--- 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); + */ + ssize_t meson_sm_write_efuse(uintptr_t offset, void *buffer, size_t size); + ++/** ++ * meson_sm_getmax - get max size of user efuse ++ * @buffer: pointer to buffer ++ * @size: buffer size ++ * @return: size of user efuse or -errno on failure ++ */ ++ssize_t meson_sm_getmax(void *buffer, size_t size); ++ + #define SM_SERIAL_SIZE 12 ++#define SM_SERIAL2_SIZE 16 + + /** + * meson_sm_get_serial - read chip unique id into buffer +@@ -37,6 +46,15 @@ ssize_t meson_sm_write_efuse(uintptr_t offset, void *buffer, size_t size); + */ + int meson_sm_get_serial(void *buffer, size_t size); + ++/** ++ * meson_sm_get_serial2 - read chip unique id (ver.2) into buffer ++ * ++ * @buffer: pointer to buffer ++ * @size: buffer size. ++ * @return: zero on success or -errno on failure ++ */ ++int meson_sm_get_serial2(void *buffer, size_t size); ++ + enum { + 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 +--- 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) + return err; + } + ++ssize_t meson_sm_getmax(void *buffer, size_t size) ++{ ++ struct udevice *dev; ++ struct pt_regs regs = { 0 }; ++ int err; ++ ++ dev = meson_get_sm_device(); ++ if (IS_ERR(dev)) ++ return PTR_ERR(dev); ++ ++ err = sm_call_read(dev, buffer, size, ++ MESON_SMC_CMD_EFUSE_MAX, ®s); ++ if (err < 0) ++ pr_err("Failed to read max size of efuse memory (%d)\n", err); ++ ++ return err; ++} ++ + #define SM_CHIP_ID_LENGTH 119 ++#define SM_CHIP_ID_LENGTH2 128 + #define SM_CHIP_ID_OFFSET 4 + #define SM_CHIP_ID_SIZE 12 + +@@ -102,6 +121,28 @@ int meson_sm_get_serial(void *buffer, size_t size) + return 0; + } + ++int meson_sm_get_serial2(void *buffer, size_t size) ++{ ++ struct udevice *dev; ++ struct pt_regs regs = { 0 }; ++ regs.regs[1] = 2; ++ u8 id_buffer[SM_CHIP_ID_LENGTH2]; ++ int err; ++ ++ dev = meson_get_sm_device(); ++ if (IS_ERR(dev)) ++ return PTR_ERR(dev); ++ ++ err = sm_call_read(dev, id_buffer, SM_CHIP_ID_LENGTH, ++ MESON_SMC_CMD_CHIP_ID_GET, ®s); ++ if (err < 0) ++ pr_err("Failed to read serial number (%d)\n", err); ++ ++ memcpy(buffer, id_buffer + SM_CHIP_ID_OFFSET, size); ++ ++ return 0; ++} ++ + #define AO_SEC_SD_CFG15 0xfc + #define REBOOT_REASON_MASK GENMASK(15, 12) + +diff --git a/cmd/meson/sm.c b/cmd/meson/sm.c +index de9a242e17..faa7240621 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, + return CMD_RET_SUCCESS; + } + ++static int do_sm_serialv2(struct cmd_tbl *cmdtp, int flag, int argc, ++ char *const argv[]) ++{ ++ ulong address; ++ int ret; ++ ++ if (argc < 2) ++ return CMD_RET_USAGE; ++ ++ address = simple_strtoul(argv[1], NULL, 0); ++ ++ ret = meson_sm_get_serial2((void *)address, SM_SERIAL2_SIZE); ++ if (ret) ++ return CMD_RET_FAILURE; ++ ++ return CMD_RET_SUCCESS; ++} ++ ++ + #define MAX_REBOOT_REASONS 14 + + static const char *reboot_reasons[MAX_REBOOT_REASONS] = { +@@ -152,12 +171,38 @@ free_buffer: + return ret; + } + ++static int do_efuse_getmax(struct cmd_tbl *cmdtp, int flag, int argc, ++ char *const argv[]) ++{ ++ char efusesizeprint[32]; // this covers int64 (2^64), which is 20 digits long ++ char *destarg = NULL; ++ int efusesize; ++ ++ if (argc > 1) ++ destarg = argv[1]; ++ ++ efusesize = meson_sm_getmax(NULL, 0); // TODO: check if this is correct ++ if (efusesize < 0) ++ return CMD_RET_FAILURE; ++ ++ snprintf(efusesizeprint, sizeof(efusesizeprint), "%d", efusesize); ++ if (destarg) ++ env_set(destarg, efusesizeprint); ++ else ++ printf("%s\n", efusesizeprint); ++ ++ return CMD_RET_SUCCESS; ++} ++ + static struct cmd_tbl cmd_sm_sub[] = { + U_BOOT_CMD_MKENT(serial, 2, 1, do_sm_serial, "", ""), ++ U_BOOT_CMD_MKENT(serialv2, 2, 1, do_sm_serialv2, "", ""), + U_BOOT_CMD_MKENT(reboot_reason, 1, 1, do_sm_reboot_reason, "", ""), + U_BOOT_CMD_MKENT(efuseread, 4, 1, do_efuse_read, "", ""), + U_BOOT_CMD_MKENT(efusewrite, 4, 0, do_efuse_write, "", ""), + U_BOOT_CMD_MKENT(efusedump, 3, 1, do_efuse_dump, "", ""), ++ U_BOOT_CMD_MKENT(getmax, 2, 1, do_efuse_getmax, "", ""), ++ + }; + + static int do_sm(struct cmd_tbl *cmdtp, int flag, int argc, +@@ -184,8 +229,10 @@ U_BOOT_CMD( + sm, 5, 0, do_sm, + "Secure Monitor Control", + "serial
- read chip unique id to memory address\n" ++ "serialv2
- read chip unique id (ver 2) to memory address\n" + "sm reboot_reason [name] - get reboot reason and store to environment\n" + "sm efuseread
- read efuse to memory address\n" + "sm efusewrite
- write into efuse from memory address\n" +- "sm efusedump - dump efuse data range to console" ++ "sm efusedump - dump efuse data range to console\n" ++ "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 +--- 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 = { + .cmd_get_shmem_out = 0x82000021, + .shmem_size = SZ_4K, + .cmd = { ++ SET_CMD(MESON_SMC_CMD_EFUSE_MAX, 0x82000033), + SET_CMD(MESON_SMC_CMD_EFUSE_READ, 0x82000030), + 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 +--- a/include/meson/sm.h ++++ b/include/meson/sm.h +@@ -9,6 +9,7 @@ + #define __MESON_SM_CMD_H__ + + enum meson_smc_cmd { ++ MESON_SMC_CMD_EFUSE_MAX, /* get max size of user efuse */ + MESON_SMC_CMD_EFUSE_READ, /* read efuse memory */ + MESON_SMC_CMD_EFUSE_WRITE, /* write efuse memory */ + MESON_SMC_CMD_CHIP_ID_GET, /* readh chip unique id */ +-- +2.34.1 + diff --git a/patch/u-boot/v2024.01/board_jethubj200/0002-jethub-D2-j200-add.patch b/patch/u-boot/v2024.01/board_jethubj200/0002-jethub-D2-j200-add.patch new file mode 100644 index 000000000000..dfeed8dad31d --- /dev/null +++ b/patch/u-boot/v2024.01/board_jethubj200/0002-jethub-D2-j200-add.patch @@ -0,0 +1,869 @@ +From 7160af7b3b2a2a7fedb9104bcdefddf114467358 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 + +--- + arch/arm/dts/Makefile | 1 + + .../arm/dts/meson-sm1-jethome-jethub-j200.dts | 614 ++++++++++++++++++ + 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(+) + 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 + +diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile +index b5c588c336..33b5afe133 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 \ +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 +--- /dev/null ++++ b/arch/arm/dts/meson-sm1-jethome-jethub-j200.dts +@@ -0,0 +1,614 @@ ++// SPDX-License-Identifier: (GPL-2.0+ OR MIT) ++/* ++ * Copyright (c) 2020 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; ++ }; ++ ++ 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>; // #TODO: check ++ 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>; // #TODO: check ++ 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>; // #TODO: check ++ 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; ++ /* FIXME: actually controlled by VDDCPU_B_EN */ ++ }; ++ ++ 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>; ++ }; ++ }; ++ }; ++ ++ meson64-reboot { ++ compatible = "meson64,reboot"; ++ sys_reset = <0x84000009>; ++ sys_poweroff = <0x84000008>; ++ ++ sd-vqen = <&gpio_ao 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-red { ++ 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"; ++ }; ++ ++ */ ++ }; ++ ++ 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 = <26 IRQ_TYPE_LEVEL_LOW>; ++ /* 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 */ ++ "", ++ "MCU_BOOT", /* GPIOAO_7 */ ++ "MCU_UART_TX", /* GPIOAO_8 */ ++ "MCU_UART_RX", /* GPIOAO_9 */ ++ "BUTTON_USR", /* GPIOAO_10 */ ++ "LED_SYSTEM", /* 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>; ++}; ++ ++/* ++&sd_emmc_c { ++ pinctrl-0 = <&emmc_ctrl_pins>, <&emmc_data_4b_pins>, <&emmc_ds_pins>; ++ bus-width = <4>; ++}; ++ ++&spifc { ++ status = "okay"; ++ 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>; ++}; ++ ++&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>; ++}; ++ ++ ++/* I2C for modules */ ++&i2c1 { ++ status = "okay"; ++ pinctrl-0 = <&i2c1_sda_h6_pins>, <&i2c1_sck_h7_pins>; ++ pinctrl-names = "default"; ++}; ++ ++ ++/* I2C for lcd/etc */ ++&i2c2 { ++ status = "okay"; ++ pinctrl-0 = <&i2c2_sda_x_pins>, <&i2c2_sck_x_pins>; ++ pinctrl-names = "default"; ++}; ++ ++/* 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"; ++ 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>; ++ }; ++ ++}; +\ 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 +--- /dev/null ++++ b/board/amlogic/jethub-j200/MAINTAINERS +@@ -0,0 +1,8 @@ ++JetHome JetHub ++M: Viacheslav Bocharov ++S: Maintained ++L: u-boot-amlogic@groups.io ++F: board/amlogic/jethub-j200/ ++F: configs/jethub_j200_defconfig ++F: doc/board/amlogic/jethub-j200.rst ++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 +--- /dev/null ++++ b/board/amlogic/jethub-j200/Makefile +@@ -0,0 +1,6 @@ ++# SPDX-License-Identifier: GPL-2.0+ ++# ++# (C) Copyright 2024 JetHome ++# Author: Viacheslav Bocharov ++ ++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 +--- /dev/null ++++ b/board/amlogic/jethub-j200/jethub-j200.c +@@ -0,0 +1,76 @@ ++// SPDX-License-Identifier: GPL-2.0+ ++/* ++ * Copyright (C) 2024 JetHome ++ * Author: Viacheslav Bocharov ++ * ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define EFUSE_SN_OFFSET 50 ++#define EFUSE_SN_SIZE 32 ++#define EFUSE_MAC_OFFSET 0 ++#define EFUSE_MAC_SIZE 6 ++#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) ++ return 1; ++ return 0; ++} ++ ++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;*/ ++ ++ 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 ++ meson_generate_serial_ethaddr(); ++ } ++ ++ if (!env_get("serial")) { ++ len = meson_sm_read_efuse(EFUSE_SN_OFFSET, serial, ++ EFUSE_SN_SIZE); ++ if (len == EFUSE_SN_SIZE) ++ env_set("serial", serial); ++ } ++ ++ if (!env_get("usid")) { ++ len = meson_sm_read_efuse(EFUSE_USID_OFFSET, usid, ++ EFUSE_USID_SIZE); ++ if (len == EFUSE_USID_SIZE) ++ 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 +--- /dev/null ++++ b/configs/jethub_j200_defconfig +@@ -0,0 +1,100 @@ ++CONFIG_ARM=y ++CONFIG_SYS_BOARD="jethub-j200" ++CONFIG_SYS_CONFIG_NAME="jethub" ++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-sm1-jethome-jethub-j200" ++CONFIG_OF_LIBFDT_OVERLAY=y ++CONFIG_DM_RESET=y ++CONFIG_MESON_G12A=y ++CONFIG_DEBUG_UART_BASE=0xff803000 ++CONFIG_DEBUG_UART_CLOCK=24000000 ++CONFIG_IDENT_STRING=" jethubj200" ++CONFIG_SYS_LOAD_ADDR=0x01000000 ++CONFIG_DEBUG_UART=y ++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_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_EEPROM=y ++CONFIG_CMD_DFU=y ++CONFIG_CMD_GPIO=y ++CONFIG_CMD_I2C=y ++# CONFIG_CMD_LOADS is not set ++CONFIG_CMD_MMC=y ++CONFIG_CMD_USB=y ++CONFIG_CMD_USB_MASS_STORAGE=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_DFU_RAM=y ++CONFIG_DM_I2C=y ++CONFIG_SYS_I2C_MESON=y ++CONFIG_MMC_MESON_GX=y ++CONFIG_PHY_REALTEK=y ++CONFIG_DM_MDIO=y ++CONFIG_DM_MDIO_MUX=y ++CONFIG_ETH_DESIGNWARE_MESON8B=y ++CONFIG_MDIO_MUX_MESON_G12A=y ++CONFIG_MESON_G12A_USB_PHY=y ++CONFIG_PINCTRL=y ++CONFIG_PINCTRL_MESON_G12A=y ++CONFIG_POWER_DOMAIN=y ++CONFIG_MESON_EE_POWER_DOMAIN=y ++CONFIG_DM_REGULATOR=y ++CONFIG_DM_REGULATOR_FIXED=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_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_G12A=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_DWC2_OTG_PHY_BUS_WIDTH_8=y ++CONFIG_USB_GADGET_DOWNLOAD=y ++CONFIG_VIDEO=y ++# CONFIG_VIDEO_BPP8 is not set ++# CONFIG_VIDEO_BPP16 is not set ++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_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 +-- +2.34.1 + 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 new file mode 100644 index 000000000000..9f86d1b8c5e0 --- /dev/null +++ b/patch/u-boot/v2024.01/board_jethubj200/0003-fix-j200.patch @@ -0,0 +1,30 @@ +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 new file mode 100644 index 000000000000..865ba5022f9a --- /dev/null +++ b/patch/u-boot/v2024.01/board_jethubj200/0004-HACK-mmc-meson-gx-limit-to-24MHz.patch.diff @@ -0,0 +1,29 @@ +--- /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/enable-DT-overlays-support.patch b/patch/u-boot/v2024.01/board_jethubj200/enable-DT-overlays-support.patch new file mode 100644 index 000000000000..da5cc4420d7f --- /dev/null +++ b/patch/u-boot/v2024.01/board_jethubj200/enable-DT-overlays-support.patch @@ -0,0 +1,15 @@ +diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig +index 1f3fa15..3f23cc8 100644 +--- a/arch/arm/Kconfig ++++ b/arch/arm/Kconfig +@@ -652,8 +652,10 @@ config ARCH_OMAP2PLUS + + config ARCH_MESON + bool "Amlogic Meson" + select GPIO_EXTRA_HEADER ++ select OF_LIBFDT ++ select OF_LIBFDT_OVERLAY + imply DISTRO_DEFAULTS + imply DM_RNG + help + Support for the Meson SoC family developed by Amlogic Inc.,