From 6e5bb13df720bedcb36e54e562387ab8bc94a29b Mon Sep 17 00:00:00 2001 From: Tobias Schramm Date: Sun, 26 May 2024 23:23:49 +0200 Subject: [PATCH] board: otter: ottercast-S3: update u-boot to v2024.04 Refresh patches and implement Ethernet support --- ...d-support-for-I2C1-on-V3s-based-SoCs.patch | 45 +++++ ...port-boot-console-on-uart1-for-sun8i.patch | 55 ------ ...t-Ethernet-clock-gates-and-resets-on.patch | 55 ++++++ ...p-Remove-AXP209-PMIC-from-devicetree.patch | 168 ----------------- ...dd-support-for-EMAC-on-V3s-based-SoC.patch | 41 +++++ ...xi-add-support-for-OtterCastAudioV2.patch} | 169 ++++++++---------- ...-sunxi-add-support-for-OttercastAmp.patch} | 61 ++++--- ...ort-for-TWI1-iomux-on-v3s-SoC-family.patch | 46 ----- ...st_amp_defconfig-configure-i2c-bus-1.patch | 30 ---- ...Cast-Amp-add-ethernet0-alias-to-emac.patch | 28 --- buildroot/configs/ottercast_s3_defconfig | 2 +- 11 files changed, 256 insertions(+), 444 deletions(-) create mode 100644 buildroot/board/otter/ottercast-S3/u-boot/patches/0001-arm-sunxi-add-support-for-I2C1-on-V3s-based-SoCs.patch delete mode 100644 buildroot/board/otter/ottercast-S3/u-boot/patches/0001-sunxi-Support-boot-console-on-uart1-for-sun8i.patch create mode 100644 buildroot/board/otter/ottercast-S3/u-boot/patches/0002-clk-sunxi-support-Ethernet-clock-gates-and-resets-on.patch delete mode 100644 buildroot/board/otter/ottercast-S3/u-boot/patches/0003-fixup-Remove-AXP209-PMIC-from-devicetree.patch create mode 100644 buildroot/board/otter/ottercast-S3/u-boot/patches/0003-net-sun8i_emac-add-support-for-EMAC-on-V3s-based-SoC.patch rename buildroot/board/otter/ottercast-S3/u-boot/patches/{0002-sunxi-Add-support-for-OtterCast-Audio-V2.patch => 0004-arm-sunxi-add-support-for-OtterCastAudioV2.patch} (51%) rename buildroot/board/otter/ottercast-S3/u-boot/patches/{0004-arm-sun8i-add-support-for-OtterCast-Amp.patch => 0005-arm-sunxi-add-support-for-OttercastAmp.patch} (75%) delete mode 100644 buildroot/board/otter/ottercast-S3/u-boot/patches/0005-sunxi-add-support-for-TWI1-iomux-on-v3s-SoC-family.patch delete mode 100644 buildroot/board/otter/ottercast-S3/u-boot/patches/0006-configs-ottercast_amp_defconfig-configure-i2c-bus-1.patch delete mode 100644 buildroot/board/otter/ottercast-S3/u-boot/patches/0007-arm-sun8i-OtterCast-Amp-add-ethernet0-alias-to-emac.patch diff --git a/buildroot/board/otter/ottercast-S3/u-boot/patches/0001-arm-sunxi-add-support-for-I2C1-on-V3s-based-SoCs.patch b/buildroot/board/otter/ottercast-S3/u-boot/patches/0001-arm-sunxi-add-support-for-I2C1-on-V3s-based-SoCs.patch new file mode 100644 index 0000000..05efd4e --- /dev/null +++ b/buildroot/board/otter/ottercast-S3/u-boot/patches/0001-arm-sunxi-add-support-for-I2C1-on-V3s-based-SoCs.patch @@ -0,0 +1,45 @@ +From 4952d2a7f66e7499cb43f0bb9566ce32ec344f51 Mon Sep 17 00:00:00 2001 +From: Tobias Schramm +Date: Sun, 26 May 2024 16:11:48 +0200 +Subject: [PATCH 1/5] arm: sunxi: add support for I2C1 on V3s-based SoCs + +Previously enabling I2C1 when using a V3s-based SoC had no effect. +Set pinmux on PE21 and PE22 to I2C1 function when enabling I2C1 on +V3s-based SoCs. + +Signed-off-by: Tobias Schramm +--- + board/sunxi/board.c | 4 ++++ + include/sunxi_gpio.h | 1 + + 2 files changed, 5 insertions(+) + +diff --git a/board/sunxi/board.c b/board/sunxi/board.c +index 8c12c8dead..78d54c0437 100644 +--- a/board/sunxi/board.c ++++ b/board/sunxi/board.c +@@ -98,6 +98,10 @@ void i2c_init_board(void) + sunxi_gpio_set_cfgpin(SUNXI_GPH(16), SUN6I_GPH_TWI1); + sunxi_gpio_set_cfgpin(SUNXI_GPH(17), SUN6I_GPH_TWI1); + clock_twi_onoff(1, 1); ++#elif defined(CONFIG_MACH_SUN8I_V3S) ++ sunxi_gpio_set_cfgpin(SUNXI_GPE(21), SUN8I_V3S_GPE_TWI1); ++ sunxi_gpio_set_cfgpin(SUNXI_GPE(22), SUN8I_V3S_GPE_TWI1); ++ clock_twi_onoff(1, 1); + #elif defined(CONFIG_MACH_SUN8I) + sunxi_gpio_set_cfgpin(SUNXI_GPH(4), SUN8I_GPH_TWI1); + sunxi_gpio_set_cfgpin(SUNXI_GPH(5), SUN8I_GPH_TWI1); +diff --git a/include/sunxi_gpio.h b/include/sunxi_gpio.h +index db3742c039..175b13a887 100644 +--- a/include/sunxi_gpio.h ++++ b/include/sunxi_gpio.h +@@ -113,6 +113,7 @@ enum sunxi_gpio_number { + #define SUN4I_GPB_TWI1 2 + #define SUN5I_GPB_TWI1 2 + #define SUN8I_V3S_GPB_TWI0 2 ++#define SUN8I_V3S_GPE_TWI1 3 + #define SUN4I_GPB_UART0 2 + #define SUN5I_GPB_UART0 2 + #define SUN8I_GPB_UART2 2 +-- +2.30.2 + diff --git a/buildroot/board/otter/ottercast-S3/u-boot/patches/0001-sunxi-Support-boot-console-on-uart1-for-sun8i.patch b/buildroot/board/otter/ottercast-S3/u-boot/patches/0001-sunxi-Support-boot-console-on-uart1-for-sun8i.patch deleted file mode 100644 index 32c5fdd..0000000 --- a/buildroot/board/otter/ottercast-S3/u-boot/patches/0001-sunxi-Support-boot-console-on-uart1-for-sun8i.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 3e30971556e20ffdea5b91a36a6c7e535749c16f Mon Sep 17 00:00:00 2001 -From: Tobias Schramm -Date: Wed, 10 Feb 2021 15:31:49 +0100 -Subject: [PATCH 1/6] sunxi: Support boot console on uart1 for sun8i - -Signed-off-by: Tobias Schramm ---- - arch/arm/include/asm/arch-sunxi/gpio.h | 1 + - arch/arm/mach-sunxi/board.c | 4 ++++ - include/configs/sunxi-common.h | 2 ++ - 3 files changed, 7 insertions(+) - -diff --git a/arch/arm/include/asm/arch-sunxi/gpio.h b/arch/arm/include/asm/arch-sunxi/gpio.h -index de77bf638e..2969a530ae 100644 ---- a/arch/arm/include/asm/arch-sunxi/gpio.h -+++ b/arch/arm/include/asm/arch-sunxi/gpio.h -@@ -190,6 +190,7 @@ enum sunxi_gpio_number { - #define SUN5I_GPG_SDC1 2 - #define SUN6I_GPG_SDC1 2 - #define SUN8I_GPG_SDC1 2 -+#define SUN8I_GPG_UART1 2 - #define SUN6I_GPG_TWI3 2 - #define SUN5I_GPG_UART1 4 - -diff --git a/arch/arm/mach-sunxi/board.c b/arch/arm/mach-sunxi/board.c -index ae6bc656d9..e76cb169b1 100644 ---- a/arch/arm/mach-sunxi/board.c -+++ b/arch/arm/mach-sunxi/board.c -@@ -144,6 +144,10 @@ static int gpio_init(void) - sunxi_gpio_set_cfgpin(SUNXI_GPL(2), SUN8I_GPL_R_UART); - sunxi_gpio_set_cfgpin(SUNXI_GPL(3), SUN8I_GPL_R_UART); - sunxi_gpio_set_pull(SUNXI_GPL(3), SUNXI_GPIO_PULL_UP); -+#elif CONFIG_CONS_INDEX == 2 && defined(CONFIG_MACH_SUN8I) -+ sunxi_gpio_set_cfgpin(SUNXI_GPG(6), SUN8I_GPG_UART1); -+ sunxi_gpio_set_cfgpin(SUNXI_GPG(7), SUN8I_GPG_UART1); -+ sunxi_gpio_set_pull(SUNXI_GPG(7), SUNXI_GPIO_PULL_UP); - #else - #error Unsupported console port number. Please fix pin mux settings in board.c - #endif -diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h -index 000f386470..19f0026888 100644 ---- a/include/configs/sunxi-common.h -+++ b/include/configs/sunxi-common.h -@@ -251,6 +251,8 @@ extern int soft_i2c_gpio_scl; - #define OF_STDOUT_PATH "/soc@01c00000/serial@01c28800:115200" - #elif CONFIG_CONS_INDEX == 5 && defined(CONFIG_MACH_SUN8I) - #define OF_STDOUT_PATH "/soc@01c00000/serial@01f02800:115200" -+#elif CONFIG_CONS_INDEX == 2 && defined(CONFIG_MACH_SUN8I) -+#define OF_STDOUT_PATH "/soc@01c00000/serial@01c28400:115200" - #else - #error Unsupported console port nr. Please fix stdout-path in sunxi-common.h. - #endif --- -2.30.1 - diff --git a/buildroot/board/otter/ottercast-S3/u-boot/patches/0002-clk-sunxi-support-Ethernet-clock-gates-and-resets-on.patch b/buildroot/board/otter/ottercast-S3/u-boot/patches/0002-clk-sunxi-support-Ethernet-clock-gates-and-resets-on.patch new file mode 100644 index 0000000..1d140bf --- /dev/null +++ b/buildroot/board/otter/ottercast-S3/u-boot/patches/0002-clk-sunxi-support-Ethernet-clock-gates-and-resets-on.patch @@ -0,0 +1,55 @@ +From 82fd7f9db8d0ad4c0f3468090da195acec9af873 Mon Sep 17 00:00:00 2001 +From: Tobias Schramm +Date: Sun, 26 May 2024 18:05:05 +0200 +Subject: [PATCH 2/5] clk: sunxi: support Ethernet clock gates and resets on + V3s-based SoC + +Previously Ethernet clock gates and resets were missing from the V3s CCU +driver. +Add the required clock gates and resets. + +Signed-off-by: Tobias Schramm +--- + drivers/clk/sunxi/clk_v3s.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/drivers/clk/sunxi/clk_v3s.c b/drivers/clk/sunxi/clk_v3s.c +index 6524c13540..0402d5ed19 100644 +--- a/drivers/clk/sunxi/clk_v3s.c ++++ b/drivers/clk/sunxi/clk_v3s.c +@@ -17,6 +17,7 @@ static struct ccu_clk_gate v3s_gates[] = { + [CLK_BUS_MMC0] = GATE(0x060, BIT(8)), + [CLK_BUS_MMC1] = GATE(0x060, BIT(9)), + [CLK_BUS_MMC2] = GATE(0x060, BIT(10)), ++ [CLK_BUS_EMAC] = GATE(0x060, BIT(17)), + [CLK_BUS_SPI0] = GATE(0x060, BIT(20)), + [CLK_BUS_OTG] = GATE(0x060, BIT(24)), + +@@ -31,6 +32,8 @@ static struct ccu_clk_gate v3s_gates[] = { + [CLK_BUS_UART1] = GATE(0x06c, BIT(17)), + [CLK_BUS_UART2] = GATE(0x06c, BIT(18)), + ++ [CLK_BUS_EPHY] = GATE(0x070, BIT(0)), ++ + [CLK_SPI0] = GATE(0x0a0, BIT(31)), + + [CLK_USB_PHY0] = GATE(0x0cc, BIT(8)), +@@ -45,12 +48,15 @@ static struct ccu_reset v3s_resets[] = { + [RST_BUS_MMC0] = RESET(0x2c0, BIT(8)), + [RST_BUS_MMC1] = RESET(0x2c0, BIT(9)), + [RST_BUS_MMC2] = RESET(0x2c0, BIT(10)), ++ [RST_BUS_EMAC] = RESET(0x2c0, BIT(17)), + [RST_BUS_SPI0] = RESET(0x2c0, BIT(20)), + [RST_BUS_OTG] = RESET(0x2c0, BIT(24)), + + [RST_BUS_TCON0] = RESET(0x2c4, BIT(4)), + [RST_BUS_DE] = RESET(0x2c4, BIT(12)), + ++ [RST_BUS_EPHY] = RESET(0x2c8, BIT(2)), ++ + [RST_BUS_I2C0] = RESET(0x2d8, BIT(0)), + [RST_BUS_I2C1] = RESET(0x2d8, BIT(1)), + [RST_BUS_UART0] = RESET(0x2d8, BIT(16)), +-- +2.30.2 + diff --git a/buildroot/board/otter/ottercast-S3/u-boot/patches/0003-fixup-Remove-AXP209-PMIC-from-devicetree.patch b/buildroot/board/otter/ottercast-S3/u-boot/patches/0003-fixup-Remove-AXP209-PMIC-from-devicetree.patch deleted file mode 100644 index 122aa7c..0000000 --- a/buildroot/board/otter/ottercast-S3/u-boot/patches/0003-fixup-Remove-AXP209-PMIC-from-devicetree.patch +++ /dev/null @@ -1,168 +0,0 @@ -From c5517a45540277a263b5831e5eda005f50018947 Mon Sep 17 00:00:00 2001 -From: Tobias Schramm -Date: Wed, 10 Feb 2021 19:15:44 +0100 -Subject: [PATCH 3/6] fixup: Remove AXP209 PMIC from devicetree - -While there is technically an AXP209 on the baord it is -not connected to any of the I2C busses. Thus it has been -replaced by a set of fixed voltage regulators. ---- - arch/arm/dts/sun8i-s3-ottercast-audio-v2.dts | 98 ++++++++------------ - configs/ottercast_audio_v2_defconfig | 7 -- - 2 files changed, 37 insertions(+), 68 deletions(-) - -diff --git a/arch/arm/dts/sun8i-s3-ottercast-audio-v2.dts b/arch/arm/dts/sun8i-s3-ottercast-audio-v2.dts -index 5442fa8208..a6896c3fdd 100644 ---- a/arch/arm/dts/sun8i-s3-ottercast-audio-v2.dts -+++ b/arch/arm/dts/sun8i-s3-ottercast-audio-v2.dts -@@ -35,6 +35,38 @@ - }; - }; - -+ dcdc_1v1: dcdc-1v1 { -+ compatible = "regulator-fixed"; -+ regulator-always-on; -+ regulator-name = "dcdc-3v3"; -+ regulator-min-microvolt = <1100000>; -+ regulator-max-microvolt = <1100000>; -+ }; -+ -+ dcdc_3v3: dcdc-3v3 { -+ compatible = "regulator-fixed"; -+ regulator-always-on; -+ regulator-name = "dcdc-3v3"; -+ regulator-min-microvolt = <3300000>; -+ regulator-max-microvolt = <3300000>; -+ }; -+ -+ ldo_rtc: ldo-rtc { -+ compatible = "regulator-fixed"; -+ regulator-always-on; -+ regulator-name = "ldo-rtc"; -+ regulator-min-microvolt = <3300000>; -+ regulator-max-microvolt = <3300000>; -+ }; -+ -+ ldo_3v0: ldo-3v0 { -+ compatible = "regulator-fixed"; -+ regulator-always-on; -+ regulator-name = "ldo-3v0"; -+ regulator-min-microvolt = <3000000>; -+ regulator-max-microvolt = <3000000>; -+ }; -+ - wifi_pwrseq: wifi_pwrseq { - compatible = "mmc-pwrseq-simple"; - reset-gpios = <&pio 4 19 GPIO_ACTIVE_LOW>; /* PE19 WL-PMU-EN */ -@@ -48,45 +80,20 @@ - status = "okay"; - }; - --&i2c0 { -- status = "okay"; -- -- axp209: pmic@34 { -- compatible = "x-powers,axp203", -- "x-powers,axp209"; -- reg = <0x34>; -- interrupt-controller; -- #interrupt-cells = <1>; -- }; --}; -- - &i2c1 { - status = "okay"; - }; - --&lradc { -- vref-supply = <®_ldo2>; -- status = "okay"; --/* -- button-200 { -- label = "Setup"; -- linux,code = ; -- channel = <0>; -- voltage = <190000>; -- }; --*/ --}; -- - &mmc0 { -- vmmc-supply = <®_dcdc3>; -+ vmmc-supply = <&dcdc_3v3>; - bus-width = <4>; - cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; - status = "okay"; - }; - - &mmc1 { -- vmmc-supply = <®_dcdc3>; -- vqmmc-supply = <®_dcdc3>; -+ vmmc-supply = <&dcdc_3v3>; -+ vqmmc-supply = <&dcdc_3v3>; - mmc-pwrseq = <&wifi_pwrseq>; - bus-width = <4>; - non-removable; -@@ -94,39 +101,8 @@ - }; - - &pio { -- vcc-pd-supply = <®_dcdc3>; -- vcc-pe-supply = <®_ldo3>; --}; -- --#include "axp209.dtsi" -- --&ac_power_supply { -- status = "okay"; --}; -- --®_dcdc2 { -- regulator-always-on; -- regulator-min-microvolt = <1100000>; -- regulator-max-microvolt = <1100000>; -- regulator-name = "vdd-sys-cpu-ephy"; --}; -- --®_dcdc3 { -- regulator-always-on; -- regulator-min-microvolt = <3300000>; -- regulator-max-microvolt = <3300000>; -- regulator-name = "vcc-3v3"; --}; -- --®_ldo1 { -- regulator-name = "vdd-rtc"; --}; -- --®_ldo2 { -- regulator-always-on; -- regulator-min-microvolt = <3000000>; -- regulator-max-microvolt = <3000000>; -- regulator-name = "avcc"; -+ vcc-pd-supply = <&dcdc_3v3>; -+ vcc-pe-supply = <&dcdc_3v3>; - }; - - &uart1 { -diff --git a/configs/ottercast_audio_v2_defconfig b/configs/ottercast_audio_v2_defconfig -index 9283e6ed0c..263e54811f 100644 ---- a/configs/ottercast_audio_v2_defconfig -+++ b/configs/ottercast_audio_v2_defconfig -@@ -5,13 +5,6 @@ CONFIG_MACH_SUN8I_V3S=y - CONFIG_SUNXI_DRAM_DDR3_1333=y - CONFIG_DRAM_CLK=504 - CONFIG_DRAM_ODT_EN=y --CONFIG_I2C0_ENABLE=y - CONFIG_DEFAULT_DEVICE_TREE="sun8i-s3-ottercast-audio-v2" --CONFIG_SPL_I2C_SUPPORT=y - # CONFIG_NETDEVICES is not set --CONFIG_AXP209_POWER=y --CONFIG_AXP_DCDC2_VOLT=1100 --CONFIG_AXP_DCDC3_VOLT=3300 --CONFIG_AXP_ALDO2_VOLT=3000 --CONFIG_AXP_ALDO3_VOLT=0 - CONFIG_CONS_INDEX=2 --- -2.30.1 - diff --git a/buildroot/board/otter/ottercast-S3/u-boot/patches/0003-net-sun8i_emac-add-support-for-EMAC-on-V3s-based-SoC.patch b/buildroot/board/otter/ottercast-S3/u-boot/patches/0003-net-sun8i_emac-add-support-for-EMAC-on-V3s-based-SoC.patch new file mode 100644 index 0000000..61c5a62 --- /dev/null +++ b/buildroot/board/otter/ottercast-S3/u-boot/patches/0003-net-sun8i_emac-add-support-for-EMAC-on-V3s-based-SoC.patch @@ -0,0 +1,41 @@ +From 5e75040a3552de7cb36711033aa56b678893d02a Mon Sep 17 00:00:00 2001 +From: Tobias Schramm +Date: Sun, 26 May 2024 16:20:55 +0200 +Subject: [PATCH 3/5] net: sun8i_emac: add support for EMAC on V3s-based SoCs + +The Allwinner V3s SoC and related SoCs feature an Ethernet MAC. +Add support for it. + +Signed-off-by: Tobias Schramm +--- + drivers/net/sun8i_emac.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/drivers/net/sun8i_emac.c b/drivers/net/sun8i_emac.c +index 8bff4fe9a9..d9d1825b69 100644 +--- a/drivers/net/sun8i_emac.c ++++ b/drivers/net/sun8i_emac.c +@@ -903,6 +903,11 @@ static const struct emac_variant emac_variant_h6 = { + .support_rmii = true, + }; + ++static const struct emac_variant emac_variant_v3s = { ++ .syscon_offset = 0x30, ++ .soc_has_internal_phy = true, ++}; ++ + static const struct udevice_id sun8i_emac_eth_ids[] = { + { .compatible = "allwinner,sun8i-a83t-emac", + .data = (ulong)&emac_variant_a83t }, +@@ -914,6 +919,8 @@ static const struct udevice_id sun8i_emac_eth_ids[] = { + .data = (ulong)&emac_variant_a64 }, + { .compatible = "allwinner,sun50i-h6-emac", + .data = (ulong)&emac_variant_h6 }, ++ { .compatible = "allwinner,sun8i-v3s-emac", ++ .data = (ulong)&emac_variant_v3s }, + { } + }; + +-- +2.30.2 + diff --git a/buildroot/board/otter/ottercast-S3/u-boot/patches/0002-sunxi-Add-support-for-OtterCast-Audio-V2.patch b/buildroot/board/otter/ottercast-S3/u-boot/patches/0004-arm-sunxi-add-support-for-OtterCastAudioV2.patch similarity index 51% rename from buildroot/board/otter/ottercast-S3/u-boot/patches/0002-sunxi-Add-support-for-OtterCast-Audio-V2.patch rename to buildroot/board/otter/ottercast-S3/u-boot/patches/0004-arm-sunxi-add-support-for-OtterCastAudioV2.patch index 0892758..0b34878 100644 --- a/buildroot/board/otter/ottercast-S3/u-boot/patches/0002-sunxi-Add-support-for-OtterCast-Audio-V2.patch +++ b/buildroot/board/otter/ottercast-S3/u-boot/patches/0004-arm-sunxi-add-support-for-OtterCastAudioV2.patch @@ -1,40 +1,49 @@ -From 226b897f8d3515da27dfabb945833e8b7ce637e5 Mon Sep 17 00:00:00 2001 -From: Tobias Schramm -Date: Wed, 10 Feb 2021 15:32:27 +0100 -Subject: [PATCH 2/6] sunxi: Add support for OtterCast Audio V2 +From 1575633c6589de5aeab53e50531b5fdbab4f21ec Mon Sep 17 00:00:00 2001 +From: Tobias Schramm +Date: Sun, 26 May 2024 16:26:53 +0200 +Subject: [PATCH 4/5] arm: sunxi: add support for OtterCastAudioV2 -The OtterCast Audio V2 is an Allwinner S3 based SBC designed by -Jana Marie Hemsing. It is primarily designed as a audio streaming -device, featuring a high quality I2S DAC, as well as a single fast -ethernet port, 2.4 GHz b/g/n WIFi and Bluetooth 4.2. +The OtterCastAudioV2 is a single board computer based on the +Sochip S3 SoC optimized for audio streaming applications. It features +an overall small footprint and an on-board high quality ADC and DAC for +audio out- and input. -Signed-off-by: Tobias Schramm +Specifications: + - SoC: Sochip S3 SiP + - RAM: 128MiB DDR3 (in-package) + - Storage: microSD card + - Power: 5V USB-C + - Ethernet: 100Mbit/s Ethernet + - WLAN & BT: AP6236 WLAN and Bluetooth module + - Audio: SSM2603 I2S codec + +Signed-off-by: Tobias Schramm --- arch/arm/dts/Makefile | 1 + - arch/arm/dts/sun8i-s3-ottercast-audio-v2.dts | 148 +++++++++++++++++++ - configs/ottercast_audio_v2_defconfig | 17 +++ - 3 files changed, 166 insertions(+) + arch/arm/dts/sun8i-s3-ottercast-audio-v2.dts | 123 +++++++++++++++++++ + configs/ottercast_audio_v2_defconfig | 14 +++ + 3 files changed, 138 insertions(+) create mode 100644 arch/arm/dts/sun8i-s3-ottercast-audio-v2.dts create mode 100644 configs/ottercast_audio_v2_defconfig diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile -index af2842a0f8..9aa29d2463 100644 +index b102ffb5f6..9eaf4b8b8e 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile -@@ -598,6 +598,7 @@ dtb-$(CONFIG_MACH_SUN8I_R40) += \ - sun8i-r40-bananapi-m2-ultra.dtb \ +@@ -810,6 +810,7 @@ dtb-$(CONFIG_MACH_SUN8I_R40) += \ sun8i-v40-bananapi-m2-berry.dtb dtb-$(CONFIG_MACH_SUN8I_V3S) += \ + sun8i-s3-elimo-initium.dtb \ + sun8i-s3-ottercast-audio-v2.dtb \ sun8i-s3-pinecube.dtb \ + sun8i-v3-sl631-imx179.dtb \ sun8i-v3s-licheepi-zero.dtb - dtb-$(CONFIG_MACH_SUN50I_H5) += \ diff --git a/arch/arm/dts/sun8i-s3-ottercast-audio-v2.dts b/arch/arm/dts/sun8i-s3-ottercast-audio-v2.dts new file mode 100644 -index 0000000000..5442fa8208 +index 0000000000..63a13ee2b2 --- /dev/null +++ b/arch/arm/dts/sun8i-s3-ottercast-audio-v2.dts -@@ -0,0 +1,148 @@ +@@ -0,0 +1,123 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR X11) +/* + * Copyright 2021 Tobias Schramm @@ -47,7 +56,7 @@ index 0000000000..5442fa8208 + +/ { + model = "OtterCast Audio V2"; -+ compatible = "jhh,ottercast-audio-v2", "allwinner,sun8i-s3"; ++ compatible = "ottercast,ottercast-audio-v2", "allwinner,sun8i-s3"; + + aliases { + serial0 = &uart1; @@ -72,6 +81,38 @@ index 0000000000..5442fa8208 + }; + }; + ++ dcdc_1v1: dcdc-1v1 { ++ compatible = "regulator-fixed"; ++ regulator-always-on; ++ regulator-name = "dcdc-3v3"; ++ regulator-min-microvolt = <1100000>; ++ regulator-max-microvolt = <1100000>; ++ }; ++ ++ dcdc_3v3: dcdc-3v3 { ++ compatible = "regulator-fixed"; ++ regulator-always-on; ++ regulator-name = "dcdc-3v3"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ }; ++ ++ ldo_rtc: ldo-rtc { ++ compatible = "regulator-fixed"; ++ regulator-always-on; ++ regulator-name = "ldo-rtc"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ }; ++ ++ ldo_3v0: ldo-3v0 { ++ compatible = "regulator-fixed"; ++ regulator-always-on; ++ regulator-name = "ldo-3v0"; ++ regulator-min-microvolt = <3000000>; ++ regulator-max-microvolt = <3000000>; ++ }; ++ + wifi_pwrseq: wifi_pwrseq { + compatible = "mmc-pwrseq-simple"; + reset-gpios = <&pio 4 19 GPIO_ACTIVE_LOW>; /* PE19 WL-PMU-EN */ @@ -85,45 +126,20 @@ index 0000000000..5442fa8208 + status = "okay"; +}; + -+&i2c0 { -+ status = "okay"; -+ -+ axp209: pmic@34 { -+ compatible = "x-powers,axp203", -+ "x-powers,axp209"; -+ reg = <0x34>; -+ interrupt-controller; -+ #interrupt-cells = <1>; -+ }; -+}; -+ +&i2c1 { + status = "okay"; +}; + -+&lradc { -+ vref-supply = <®_ldo2>; -+ status = "okay"; -+/* -+ button-200 { -+ label = "Setup"; -+ linux,code = ; -+ channel = <0>; -+ voltage = <190000>; -+ }; -+*/ -+}; -+ +&mmc0 { -+ vmmc-supply = <®_dcdc3>; ++ vmmc-supply = <&dcdc_3v3>; + bus-width = <4>; + cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; + status = "okay"; +}; + +&mmc1 { -+ vmmc-supply = <®_dcdc3>; -+ vqmmc-supply = <®_dcdc3>; ++ vmmc-supply = <&dcdc_3v3>; ++ vqmmc-supply = <&dcdc_3v3>; + mmc-pwrseq = <&wifi_pwrseq>; + bus-width = <4>; + non-removable; @@ -131,46 +147,14 @@ index 0000000000..5442fa8208 +}; + +&pio { -+ vcc-pd-supply = <®_dcdc3>; -+ vcc-pe-supply = <®_ldo3>; -+}; -+ -+#include "axp209.dtsi" -+ -+&ac_power_supply { -+ status = "okay"; -+}; -+ -+®_dcdc2 { -+ regulator-always-on; -+ regulator-min-microvolt = <1100000>; -+ regulator-max-microvolt = <1100000>; -+ regulator-name = "vdd-sys-cpu-ephy"; -+}; -+ -+®_dcdc3 { -+ regulator-always-on; -+ regulator-min-microvolt = <3300000>; -+ regulator-max-microvolt = <3300000>; -+ regulator-name = "vcc-3v3"; -+}; -+ -+®_ldo1 { -+ regulator-name = "vdd-rtc"; -+}; -+ -+®_ldo2 { -+ regulator-always-on; -+ regulator-min-microvolt = <3000000>; -+ regulator-max-microvolt = <3000000>; -+ regulator-name = "avcc"; ++ vcc-pd-supply = <&dcdc_3v3>; ++ vcc-pe-supply = <&dcdc_3v3>; +}; + +&uart1 { -+ status = "okay"; -+ + pinctrl-names = "default"; + pinctrl-0 = <&uart1_pg_pins>; ++ status = "okay"; +}; + +&uart2 { @@ -185,27 +169,24 @@ index 0000000000..5442fa8208 +}; diff --git a/configs/ottercast_audio_v2_defconfig b/configs/ottercast_audio_v2_defconfig new file mode 100644 -index 0000000000..9283e6ed0c +index 0000000000..3ba1ffdbc1 --- /dev/null +++ b/configs/ottercast_audio_v2_defconfig -@@ -0,0 +1,17 @@ +@@ -0,0 +1,14 @@ +CONFIG_ARM=y +CONFIG_ARCH_SUNXI=y ++CONFIG_DEFAULT_DEVICE_TREE="sun8i-s3-ottercast-audio-v2" +CONFIG_SPL=y +CONFIG_MACH_SUN8I_V3S=y +CONFIG_SUNXI_DRAM_DDR3_1333=y +CONFIG_DRAM_CLK=504 +CONFIG_DRAM_ODT_EN=y -+CONFIG_I2C0_ENABLE=y -+CONFIG_DEFAULT_DEVICE_TREE="sun8i-s3-ottercast-audio-v2" -+CONFIG_SPL_I2C_SUPPORT=y -+# CONFIG_NETDEVICES is not set -+CONFIG_AXP209_POWER=y -+CONFIG_AXP_DCDC2_VOLT=1100 -+CONFIG_AXP_DCDC3_VOLT=3300 -+CONFIG_AXP_ALDO2_VOLT=3000 -+CONFIG_AXP_ALDO3_VOLT=0 ++CONFIG_I2C1_ENABLE=y ++# CONFIG_HAS_ARMV7_SECURE_BASE is not set ++CONFIG_SYS_I2C_MVTWSI=y ++CONFIG_DM_ETH_PHY=y ++CONFIG_SUN8I_EMAC=y +CONFIG_CONS_INDEX=2 -- -2.30.1 +2.30.2 diff --git a/buildroot/board/otter/ottercast-S3/u-boot/patches/0004-arm-sun8i-add-support-for-OtterCast-Amp.patch b/buildroot/board/otter/ottercast-S3/u-boot/patches/0005-arm-sunxi-add-support-for-OttercastAmp.patch similarity index 75% rename from buildroot/board/otter/ottercast-S3/u-boot/patches/0004-arm-sun8i-add-support-for-OtterCast-Amp.patch rename to buildroot/board/otter/ottercast-S3/u-boot/patches/0005-arm-sunxi-add-support-for-OttercastAmp.patch index 56eeb6f..7329eee 100644 --- a/buildroot/board/otter/ottercast-S3/u-boot/patches/0004-arm-sun8i-add-support-for-OtterCast-Amp.patch +++ b/buildroot/board/otter/ottercast-S3/u-boot/patches/0005-arm-sunxi-add-support-for-OttercastAmp.patch @@ -1,34 +1,46 @@ -From 9bc9d3a4daf0bdebb1c3e9c7efeb54eb8e1c4e22 Mon Sep 17 00:00:00 2001 -From: Tobias Schramm -Date: Mon, 15 Mar 2021 12:23:41 +0100 -Subject: [PATCH 4/6] arm: sun8i: add support for OtterCast Amp +From 4a55eb2f3a040aba0e62b2637da0c3ccb1940dea Mon Sep 17 00:00:00 2001 +From: Tobias Schramm +Date: Sun, 26 May 2024 16:38:59 +0200 +Subject: [PATCH 5/5] arm: sunxi: add support for OttercastAmp -The OtterCast Amp is a S3 based SBC for audio streaming. It integrates two -TAS5825 class D amplifiers with builtin codec, fast ethernet via the internal -MAC and PHY and dual-band WLAN/BT through an AP6255 SDIO module. +The OttercastAmp is an audio streaming device based on the Sochip S3 SoC +with a builtin high power Class D audio amplifier. It also features an +analog audio input. + +Specifications: + - SoC: Sochip S3 SiP + - RAM: 128MiB DDR3 (in-package) + - Storage: microSD card, eMMC + - Power: USB-C PD (5V to 20V) + - Ethernet: 100Mbit/s Ethernet + - WLAN & BT: AP6236, AP6255 or AP6256 WLAN and Bluetooth module + - Audio: 2x TAS5825M smart amplifier with optional DSP + - Display: 340x800px IPS LCD + +Signed-off-by: Tobias Schramm --- arch/arm/dts/Makefile | 1 + arch/arm/dts/sun8i-s3-ottercast-amp.dts | 154 ++++++++++++++++++++++++ - configs/ottercast_amp_defconfig | 13 ++ - 3 files changed, 168 insertions(+) + configs/ottercast_amp_defconfig | 18 +++ + 3 files changed, 173 insertions(+) create mode 100644 arch/arm/dts/sun8i-s3-ottercast-amp.dts create mode 100644 configs/ottercast_amp_defconfig diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile -index 9aa29d2463..f3b0b53f06 100644 +index 9eaf4b8b8e..3bf528a0ed 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile -@@ -598,6 +598,7 @@ dtb-$(CONFIG_MACH_SUN8I_R40) += \ - sun8i-r40-bananapi-m2-ultra.dtb \ +@@ -810,6 +810,7 @@ dtb-$(CONFIG_MACH_SUN8I_R40) += \ sun8i-v40-bananapi-m2-berry.dtb dtb-$(CONFIG_MACH_SUN8I_V3S) += \ + sun8i-s3-elimo-initium.dtb \ + sun8i-s3-ottercast-amp.dtb \ sun8i-s3-ottercast-audio-v2.dtb \ sun8i-s3-pinecube.dtb \ - sun8i-v3s-licheepi-zero.dtb + sun8i-v3-sl631-imx179.dtb \ diff --git a/arch/arm/dts/sun8i-s3-ottercast-amp.dts b/arch/arm/dts/sun8i-s3-ottercast-amp.dts new file mode 100644 -index 0000000000..ed86554f30 +index 0000000000..533f5ebc0f --- /dev/null +++ b/arch/arm/dts/sun8i-s3-ottercast-amp.dts @@ -0,0 +1,154 @@ @@ -44,10 +56,11 @@ index 0000000000..ed86554f30 + +/ { + model = "OtterCast Amp"; -+ compatible = "otter,ottercast-amp", "allwinner,sun8i-s3"; ++ compatible = "ottercast,ottercast-amp", "allwinner,sun8i-s3"; + + aliases { + serial0 = &uart1; ++ ethernet0 = &emac; + }; + + chosen { @@ -170,10 +183,9 @@ index 0000000000..ed86554f30 +}; + +&uart1 { -+ status = "okay"; -+ + pinctrl-names = "default"; + pinctrl-0 = <&uart1_pg_pins>; ++ status = "okay"; +}; + +&uart2 { @@ -188,23 +200,28 @@ index 0000000000..ed86554f30 +}; diff --git a/configs/ottercast_amp_defconfig b/configs/ottercast_amp_defconfig new file mode 100644 -index 0000000000..707b83610d +index 0000000000..55e176ed90 --- /dev/null +++ b/configs/ottercast_amp_defconfig -@@ -0,0 +1,13 @@ +@@ -0,0 +1,18 @@ +CONFIG_ARM=y +CONFIG_ARCH_SUNXI=y ++CONFIG_DEFAULT_DEVICE_TREE="sun8i-s3-ottercast-amp" +CONFIG_SPL=y +CONFIG_MACH_SUN8I_V3S=y +CONFIG_SUNXI_DRAM_DDR3_1333=y +CONFIG_DRAM_CLK=504 +CONFIG_DRAM_ODT_EN=y -+CONFIG_DEFAULT_DEVICE_TREE="sun8i-s3-ottercast-amp" ++CONFIG_I2C1_ENABLE=y ++# CONFIG_HAS_ARMV7_SECURE_BASE is not set ++CONFIG_I2C_SET_DEFAULT_BUS_NUM=y ++CONFIG_SYS_I2C_MVTWSI=y +CONFIG_LED=y +CONFIG_LED_BLINK=y +CONFIG_LED_GPIO=y -+# CONFIG_NETDEVICES is not set ++CONFIG_DM_ETH_PHY=y ++CONFIG_SUN8I_EMAC=y +CONFIG_CONS_INDEX=2 -- -2.30.1 +2.30.2 diff --git a/buildroot/board/otter/ottercast-S3/u-boot/patches/0005-sunxi-add-support-for-TWI1-iomux-on-v3s-SoC-family.patch b/buildroot/board/otter/ottercast-S3/u-boot/patches/0005-sunxi-add-support-for-TWI1-iomux-on-v3s-SoC-family.patch deleted file mode 100644 index 523df61..0000000 --- a/buildroot/board/otter/ottercast-S3/u-boot/patches/0005-sunxi-add-support-for-TWI1-iomux-on-v3s-SoC-family.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 7645fbbf608a575999957e5fa4838a4141a5a835 Mon Sep 17 00:00:00 2001 -From: Tobias Schramm -Date: Fri, 9 Apr 2021 17:45:17 +0200 -Subject: [PATCH 5/6] sunxi: add support for TWI1 iomux on v3s SoC family - -v3s based SoCs have two TWI interfaces, TWI0 and TWI1. Previously only -configuration of the iomux for the first TWI interface was supported. This -commit adds support for configuration of TWI1 function on pins PE21 and -PE22. - -Signed-off-by: Tobias Schramm ---- - arch/arm/include/asm/arch-sunxi/gpio.h | 1 + - board/sunxi/board.c | 4 ++++ - 2 files changed, 5 insertions(+) - -diff --git a/arch/arm/include/asm/arch-sunxi/gpio.h b/arch/arm/include/asm/arch-sunxi/gpio.h -index 2969a530ae..40dabfab57 100644 ---- a/arch/arm/include/asm/arch-sunxi/gpio.h -+++ b/arch/arm/include/asm/arch-sunxi/gpio.h -@@ -180,6 +180,7 @@ enum sunxi_gpio_number { - - #define SUN5I_GPE_SDC2 3 - #define SUN8I_GPE_TWI2 3 -+#define SUN8I_V3S_GPE_TWI1 3 - #define SUN50I_GPE_TWI2 3 - - #define SUNXI_GPF_SDC0 2 -diff --git a/board/sunxi/board.c b/board/sunxi/board.c -index e42b61e906..542e5ad682 100644 ---- a/board/sunxi/board.c -+++ b/board/sunxi/board.c -@@ -133,6 +133,10 @@ void i2c_init_board(void) - sunxi_gpio_set_cfgpin(SUNXI_GPH(16), SUN6I_GPH_TWI1); - sunxi_gpio_set_cfgpin(SUNXI_GPH(17), SUN6I_GPH_TWI1); - clock_twi_onoff(1, 1); -+#elif defined(CONFIG_MACH_SUN8I_V3S) -+ sunxi_gpio_set_cfgpin(SUNXI_GPE(21), SUN8I_V3S_GPE_TWI1); -+ sunxi_gpio_set_cfgpin(SUNXI_GPE(22), SUN8I_V3S_GPE_TWI1); -+ clock_twi_onoff(1, 1); - #elif defined(CONFIG_MACH_SUN8I) - sunxi_gpio_set_cfgpin(SUNXI_GPH(4), SUN8I_GPH_TWI1); - sunxi_gpio_set_cfgpin(SUNXI_GPH(5), SUN8I_GPH_TWI1); --- -2.30.1 - diff --git a/buildroot/board/otter/ottercast-S3/u-boot/patches/0006-configs-ottercast_amp_defconfig-configure-i2c-bus-1.patch b/buildroot/board/otter/ottercast-S3/u-boot/patches/0006-configs-ottercast_amp_defconfig-configure-i2c-bus-1.patch deleted file mode 100644 index b9ae1fd..0000000 --- a/buildroot/board/otter/ottercast-S3/u-boot/patches/0006-configs-ottercast_amp_defconfig-configure-i2c-bus-1.patch +++ /dev/null @@ -1,30 +0,0 @@ -From c8c4ba720567f94b9bdfc5fdb5a327c69fd98bcb Mon Sep 17 00:00:00 2001 -From: Tobias Schramm -Date: Fri, 9 Apr 2021 17:56:33 +0200 -Subject: [PATCH 6/6] configs: ottercast_amp_defconfig: configure i2c bus 1 - -Previously access to i2c devices was not possible from u-boot. This change -allows to distinguish OtterCast Audio and OtterCast Amp via the devices -present on I2C bus 1. ---- - configs/ottercast_amp_defconfig | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/configs/ottercast_amp_defconfig b/configs/ottercast_amp_defconfig -index 707b83610d..b893c04eab 100644 ---- a/configs/ottercast_amp_defconfig -+++ b/configs/ottercast_amp_defconfig -@@ -5,7 +5,10 @@ CONFIG_MACH_SUN8I_V3S=y - CONFIG_SUNXI_DRAM_DDR3_1333=y - CONFIG_DRAM_CLK=504 - CONFIG_DRAM_ODT_EN=y -+CONFIG_I2C1_ENABLE=y - CONFIG_DEFAULT_DEVICE_TREE="sun8i-s3-ottercast-amp" -+CONFIG_DM_I2C=y -+CONFIG_I2C_SET_DEFAULT_BUS_NUM=y - CONFIG_LED=y - CONFIG_LED_BLINK=y - CONFIG_LED_GPIO=y --- -2.30.1 - diff --git a/buildroot/board/otter/ottercast-S3/u-boot/patches/0007-arm-sun8i-OtterCast-Amp-add-ethernet0-alias-to-emac.patch b/buildroot/board/otter/ottercast-S3/u-boot/patches/0007-arm-sun8i-OtterCast-Amp-add-ethernet0-alias-to-emac.patch deleted file mode 100644 index b3d6a2b..0000000 --- a/buildroot/board/otter/ottercast-S3/u-boot/patches/0007-arm-sun8i-OtterCast-Amp-add-ethernet0-alias-to-emac.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 0cf08954625e1ea9e9646d0c009925460e7fb3ec Mon Sep 17 00:00:00 2001 -From: Tobias Schramm -Date: Sat, 15 May 2021 21:44:05 +0200 -Subject: [PATCH 7/7] arm: sun8i: OtterCast Amp: add ethernet0 alias to emac - -The board setup code uses the alias to generate MAC addresses that are -then exported into the environment. -This enables generation of the fist MAC address, which is placed into the -env var `ethaddr`. ---- - arch/arm/dts/sun8i-s3-ottercast-amp.dts | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/arch/arm/dts/sun8i-s3-ottercast-amp.dts b/arch/arm/dts/sun8i-s3-ottercast-amp.dts -index ed86554f30..d8a20e9f14 100644 ---- a/arch/arm/dts/sun8i-s3-ottercast-amp.dts -+++ b/arch/arm/dts/sun8i-s3-ottercast-amp.dts -@@ -14,6 +14,7 @@ - - aliases { - serial0 = &uart1; -+ ethernet0 = &emac; - }; - - chosen { --- -2.31.1 - diff --git a/buildroot/configs/ottercast_s3_defconfig b/buildroot/configs/ottercast_s3_defconfig index b7d6c99..68b4875 100644 --- a/buildroot/configs/ottercast_s3_defconfig +++ b/buildroot/configs/ottercast_s3_defconfig @@ -96,7 +96,7 @@ BR2_TARGET_UBOOT=y BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y BR2_TARGET_UBOOT_CUSTOM_GIT=y BR2_TARGET_UBOOT_CUSTOM_REPO_URL="https://gitlab.denx.de/u-boot/u-boot.git" -BR2_TARGET_UBOOT_CUSTOM_REPO_VERSION="e14d5762de1db84cae6d84d59c1e40f3eb26c4c3" +BR2_TARGET_UBOOT_CUSTOM_REPO_VERSION="v2024.04" BR2_TARGET_UBOOT_PATCH="$(BR2_EXTERNAL_OTTERCASTAUDIO_PATH)/board/otter/ottercast-S3/u-boot/patches/" BR2_TARGET_UBOOT_BOARD_DEFCONFIG="ottercast_amp" BR2_TARGET_UBOOT_NEEDS_DTC=y