Skip to contentSkip to conversation

Add Amlogic A311D2 and Khadas Vim4 Board Support

PATCH Applied Lucas Tanure 4 participants 12 messages Jun 29, 2023 – Aug 14, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v7 cover Add Amlogic A311D2 and Khadas Vim4 Board Support

The Khadas VIM4 uses the Amlogic A311D2 SoC, based on the Amlogic T7 family. This chip is not the same as A311D used in Vim3 board.

Work based on Khadas 5.4 branch:
https://github.com/khadas/linux/tree/khadas-vims-5.4.y

The current status is Vim4 board booting to emergency shell via uart.

Board Features:
- 8GB LPDDR4X 2016MHz
- 32GB eMMC 5.1 storage
- 32MB SPI flash
- 10/100/1000 Base-T Ethernet
- AP6275S Wireless (802.11 a/b/g/n/ac/ax, BT5.1)
- HDMI 2.1 video
- HDMI Input
- 1x USB 2.0 + 1x USB 3.0 ports
- 1x USB-C (power) with USB 2.0 OTG
- 3x LED's (1x red, 1x blue, 1x white)
- 3x buttons (power, function, reset)
- M2 socket with PCIe, USB, ADC & I2C
- 40pin GPIO Header
- 1x micro SD card slot

Changes Since v6:
- Move Uart clock to amlogic-t7-a311d2-khadas-vim4 dts
- Fix GIC_CPU_MASK_SIMPLE
- Lowercase uart label

Changes Since v5:
- Remove meson as T7 its not a meson chip
- Change Uart Document descript to S4 compatibles

Changes Since v4:
- Use S4 instead of G12a for uart fallback
- Add OF_EARLYCON_DECLARE for T7 uart

Changes Since v3:
- Fix issues with "amlogic,meson-t7-uart" documentation

Changes Since v2:
- Add "amlogic,meson-t7-uart" documentation

Changes Since v1:
- Drop the T7 clock driver as it is not needed for serial boot. It will later use the S4 clock
driver as S4 and T7 seems to be similar chips.
- Use "arm,gic-400" for interrupt controller to fix dtb_check
- Remove CPU node properties not needed for serial boot
- Move UART node to apb4 node
- Drop T7 UART compatible line and use S4 uart
- Use psci V1 instead of 0.2, it works, but I can't verify is correct as the datasheet I have
doesn't contain that information.
- Remove compatible from meson-t7.dtsi, move it to vim4 board dts
- Add memory node with 8GB. Not sure about this one, works without, but doesn't detect 8GB
- Use defines for GIC_CPU_MASK_SIMPLE, IRQ_TYPE_LEVEL_LOW, IRQ_TYPE_LEVEL_HIGH instead of hardcoded values

Lucas Tanure (4):
dt-bindings: arm: amlogic: add Amlogic A311D2 bindings
dt-bindings: serial: amlogic,meson-uart: Add compatible string for T7
tty: serial: meson: Add a earlycon for the T7 SoC
arm64: dts: amlogic-t7-a311d2-khadas-vim4: add initial device-tree

 .../devicetree/bindings/arm/amlogic.yaml      |   7 +
 .../bindings/serial/amlogic,meson-uart.yaml   |   4 +
 arch/arm64/boot/dts/amlogic/Makefile          |   1 +
 .../amlogic/amlogic-t7-a311d2-khadas-vim4.dts |  54 ++++++
 arch/arm64/boot/dts/amlogic/amlogic-t7.dtsi   | 155 ++++++++++++++++++
 drivers/tty/serial/meson_uart.c               |   2 +
 6 files changed, 223 insertions(+)
 create mode 100644 arch/arm64/boot/dts/amlogic/amlogic-t7-a311d2-khadas-vim4.dts
 create mode 100644 arch/arm64/boot/dts/amlogic/amlogic-t7.dtsi

--
2.41.0

_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic

#1 lore raw

PATCH v7 1/4 dt-bindings: arm: amlogic: add Amlogic A311D2 bindings

Add bindings for the Khadas Vim4 board, using A311D2 Soc from Amlogic T7 family chip.

---
 Documentation/devicetree/bindings/arm/amlogic.yaml | 7 +++++++
 1 file changed, 7 insertions(+)
Documentation/devicetree/bindings/arm/amlogic.yaml +7 -0
index 274ee0890312..f5c51dfe4281 100644
@@ -211,6 +211,13 @@ properties:
               - amlogic,aq222
           - const: amlogic,s4
 
+      - description: Boards with the Amlogic T7 A311D2 SoC
+        items:
+          - enum:
+              - khadas,vim4
+          - const: amlogic,a311d2
+          - const: amlogic,t7
+
 additionalProperties: true
 
 ...

--
2.41.0

_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic

#2 lore raw

PATCH v7 2/4 dt-bindings: serial: amlogic,meson-uart: Add compatible string for T7

In reply to Lucas Tanure

Amlogic T7 SoCs uses the same UART controller as S4 SoCs and G12A. There is no need for an extra compatible line in the driver, but add T7 compatible line for documentation.

---
 .../devicetree/bindings/serial/amlogic,meson-uart.yaml        | 4 ++++
 1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/serial/amlogic,meson-uart.yaml +4 -0
index 01ec45b3b406..591d1f8de191 100644
@@ -50,6 +50,10 @@ properties:
         items:
           - const: amlogic,meson-g12a-uart
           - const: amlogic,meson-gx-uart
+      - description: UART controller on S4 compatible SoCs
+        items:
+          - const: amlogic,t7-uart
+          - const: amlogic,meson-s4-uart
 
   reg:
     maxItems: 1

--
2.41.0

_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic

#3 lore raw

PATCH v7 3/4 tty: serial: meson: Add a earlycon for the T7 SoC

In reply to Lucas Tanure

The new Amlogic T7 SoC does not have a always-on uart, so add OF_EARLYCON_DECLARE for it.

---
 drivers/tty/serial/meson_uart.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/tty/serial/meson_uart.c +2 -0
index 2501db5a7aaf..c24e105a98c5 100644
@@ -649,6 +649,8 @@ meson_serial_early_console_setup(struct earlycon_device *device, const char *opt
 
 OF_EARLYCON_DECLARE(meson, "amlogic,meson-ao-uart",
 		    meson_serial_early_console_setup);
+OF_EARLYCON_DECLARE(meson, "amlogic,t7-uart",
+		    meson_serial_early_console_setup);
 
 #define MESON_SERIAL_CONSOLE	(&meson_serial_console)
 #else

--
2.41.0

_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic

#4 lore raw

Re: [PATCH v7 3/4] tty: serial: meson: Add a earlycon for the T7 SoC

Quoted 9 lines · Lucas Tanure

The new Amlogic T7 SoC does not have a always-on uart, so add OF_EARLYCON_DECLARE for it.

---
 drivers/tty/serial/meson_uart.c | 2 ++
 1 file changed, 2 insertions(+)

These 2 serial patches will probably never be applied if you don't send this to Greg and linux-serial. IOW, use get_maintainers.pl for your patches.

Rob

#5 lore raw

Re: [PATCH v7 3/4] tty: serial: meson: Add a earlycon for the T7 SoC

Quoted 12 lines · Rob Herring
Quoted 9 lines · Lucas Tanure

The new Amlogic T7 SoC does not have a always-on uart, so add OF_EARLYCON_DECLARE for it.

---
 drivers/tty/serial/meson_uart.c | 2 ++
 1 file changed, 2 insertions(+)
Quoted 5 lines

These 2 serial patches will probably never be applied if you don't send this to Greg and linux-serial. IOW, use get_maintainers.pl for your patches.

Rob

Thanks, I didn't see that issue.
I just re-sent ad v9.

_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic

#6 lore raw

PATCH v7 4/4 arm64: dts: amlogic-t7-a311d2-khadas-vim4: add initial device-tree

In reply to Lucas Tanure

The Khadas VIM4 uses the Amlogic A311D2 SoC, based on the Amlogic T7 SoC family, on a board with the same form factor as the VIM3 models.

- 8GB LPDDR4X 2016MHz
- 32GB eMMC 5.1 storage
- 32MB SPI flash
- 10/100/1000 Base-T Ethernet
- AP6275S Wireless (802.11 a/b/g/n/ac/ax, BT5.1)
- HDMI 2.1 video
- HDMI Input
- 1x USB 2.0 + 1x USB 3.0 ports
- 1x USB-C (power) with USB 2.0 OTG
- 3x LED's (1x red, 1x blue, 1x white)
- 3x buttons (power, function, reset)
- M2 socket with PCIe, USB, ADC & I2C
- 40pin GPIO Header
- 1x micro SD card slot

---
 arch/arm64/boot/dts/amlogic/Makefile          |   1 +
 .../amlogic/amlogic-t7-a311d2-khadas-vim4.dts |  54 ++++++
 arch/arm64/boot/dts/amlogic/amlogic-t7.dtsi   | 155 ++++++++++++++++++
 3 files changed, 210 insertions(+)
 create mode 100644 arch/arm64/boot/dts/amlogic/amlogic-t7-a311d2-khadas-vim4.dts
 create mode 100644 arch/arm64/boot/dts/amlogic/amlogic-t7.dtsi
arch/arm64/boot/dts/amlogic/Makefile +1 -0
index cd1c5b04890a..166fec1e4229 100644
@@ -1,4 +1,5 @@
 # SPDX-License-Identifier: GPL-2.0
+dtb-$(CONFIG_ARCH_MESON) += amlogic-t7-a311d2-khadas-vim4.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-a1-ad401.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-axg-jethome-jethub-j100.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-axg-jethome-jethub-j110-rev-2.dtb
arch/arm64/boot/dts/amlogic/amlogic-t7-a311d2-khadas-vim4.dts new file +54 -0

54 lines not on this page · raw message

arch/arm64/boot/dts/amlogic/amlogic-t7.dtsi new file +155 -0

155 lines not on this page · raw message

--
2.41.0

_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic

#7 lore raw

Re: [PATCH v7 4/4] arm64: dts: amlogic-t7-a311d2-khadas-vim4: add initial device-tree

Quoted 81 lines · Lucas Tanure

[ EXTERNAL EMAIL ]

The Khadas VIM4 uses the Amlogic A311D2 SoC, based on the Amlogic T7 SoC family, on a board with the same form factor as the VIM3 models.

- 8GB LPDDR4X 2016MHz
- 32GB eMMC 5.1 storage
- 32MB SPI flash
- 10/100/1000 Base-T Ethernet
- AP6275S Wireless (802.11 a/b/g/n/ac/ax, BT5.1)
- HDMI 2.1 video
- HDMI Input
- 1x USB 2.0 + 1x USB 3.0 ports
- 1x USB-C (power) with USB 2.0 OTG
- 3x LED's (1x red, 1x blue, 1x white)
- 3x buttons (power, function, reset)
- M2 socket with PCIe, USB, ADC & I2C
- 40pin GPIO Header
- 1x micro SD card slot

---
  arch/arm64/boot/dts/amlogic/Makefile          |   1 +
  .../amlogic/amlogic-t7-a311d2-khadas-vim4.dts |  54 ++++++
  arch/arm64/boot/dts/amlogic/amlogic-t7.dtsi   | 155 ++++++++++++++++++
  3 files changed, 210 insertions(+)

create mode 100644 arch/arm64/boot/dts/amlogic/amlogic-t7-a311d2-khadas-vim4.dts create mode 100644 arch/arm64/boot/dts/amlogic/amlogic-t7.dtsi

arch/arm64/boot/dts/amlogic/Makefile +1 -0
index cd1c5b04890a..166fec1e4229 100644
@@ -1,4 +1,5 @@
  # SPDX-License-Identifier: GPL-2.0
+dtb-$(CONFIG_ARCH_MESON) += amlogic-t7-a311d2-khadas-vim4.dtb
  dtb-$(CONFIG_ARCH_MESON) += meson-a1-ad401.dtb
  dtb-$(CONFIG_ARCH_MESON) += meson-axg-jethome-jethub-j100.dtb
  dtb-$(CONFIG_ARCH_MESON) += meson-axg-jethome-jethub-j110-rev-2.dtb
arch/arm64/boot/dts/amlogic/amlogic-t7-a311d2-khadas-vim4.dts new file +36 -0
new file mode 100644
index 000000000000..fffdab96b12e
@@ -0,0 +1,54 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2022 Wesion, Inc. All rights reserved.
+ */
+
+/dts-v1/;
+
+#include "amlogic-t7.dtsi"
+
+/ {
+       model = "Khadas vim4";
+       compatible = "khadas,vim4", "amlogic,a311d2", "amlogic,t7";
+
+       aliases {
+               serial0 = &uart_a;
+       };
+
+       memory@0 {
+               device_type = "memory";
+               reg = <0x0 0x0 0x2 0x0>; /* 8 GB */
+       };
+
+       reserved-memory {
+               #address-cells = <2>;
+               #size-cells = <2>;
+               ranges;
+
+               /* 3 MiB reserved for ARM Trusted Firmware (BL31) */
+               secmon_reserved: secmon@5000000 {
+                       reg = <0x0 0x05000000 0x0 0x300000>;
+                       no-map;
+               };
+
+               /* 32 MiB reserved for ARM Trusted Firmware (BL32) */
+               secmon_reserved_bl32: secmon@5300000 {
+                       reg = <0x0 0x05300000 0x0 0x2000000>;

arch/arm64/boot/dts/amlogic/amlogic-t7-a311d2-khadas-vim4.dts line 46

Quoted 10 lines
arch/arm64/boot/dts/amlogic/amlogic-t7-a311d2-khadas-vim4.dts new file +10 -0
+                       no-map;
+               };
+       };
+
+       xtal: xtal-clk {
+               compatible = "fixed-clock";
+               clock-frequency = <24000000>;
+               clock-output-names = "xtal";
+               #clock-cells = <0>;
+       };

Place xal in DTSI files is beterr, the same as other Amlogic SoCs family. If frequency is different, reset value in here.

Quoted 170 lines
arch/arm64/boot/dts/amlogic/amlogic-t7-a311d2-khadas-vim4.dts new file +8 -0
+
+};
+
+&uart_a {
+       status = "okay";
+       clocks = <&xtal>, <&xtal>, <&xtal>;
+       clock-names = "xtal", "pclk", "baud";
+};
arch/arm64/boot/dts/amlogic/amlogic-t7.dtsi new file +155 -1
new file mode 100644
index 000000000000..1423d4a79156
@@ -0,0 +1,155 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2019 Amlogic, Inc. All rights reserved.
+ */
+
+#include <dt-bindings/interrupt-controller/arm-gic.h>
+
+/ {
+       interrupt-parent = <&gic>;
+       #address-cells = <2>;
+       #size-cells = <2>;
+
+       cpus {
+               #address-cells = <0x2>;
+               #size-cells = <0x0>;
+
+               cpu-map {
+                       cluster0 {
+                               core0 {
+                                       cpu = <&cpu100>;
+                               };
+                               core1 {
+                                       cpu = <&cpu101>;
+                               };
+                               core2 {
+                                       cpu = <&cpu102>;
+                               };
+                               core3 {
+                                       cpu = <&cpu103>;
+                               };
+                       };
+
+                       cluster1 {
+                               core0 {
+                                       cpu = <&cpu0>;
+                               };
+                               core1 {
+                                       cpu = <&cpu1>;
+                               };
+                               core2 {
+                                       cpu = <&cpu2>;
+                               };
+                               core3 {
+                                       cpu = <&cpu3>;
+                               };
+                       };
+               };
+
+               cpu100: cpu@100 {
+                       device_type = "cpu";
+                       compatible = "arm,cortex-a53";
+                       reg = <0x0 0x100>;
+                       enable-method = "psci";
+               };
+
+               cpu101: cpu@101{
+                       device_type = "cpu";
+                       compatible = "arm,cortex-a53";
+                       reg = <0x0 0x101>;
+                       enable-method = "psci";
+               };
+
+               cpu102: cpu@102 {
+                       device_type = "cpu";
+                       compatible = "arm,cortex-a53";
+                       reg = <0x0 0x102>;
+                       enable-method = "psci";
+               };
+
+               cpu103: cpu@103 {
+                       device_type = "cpu";
+                       compatible = "arm,cortex-a53";
+                       reg = <0x0 0x103>;
+                       enable-method = "psci";
+               };
+
+               cpu0: cpu@0 {
+                       device_type = "cpu";
+                       compatible = "arm,cortex-a73";
+                       reg = <0x0 0x0>;
+                       enable-method = "psci";
+               };
+
+               cpu1: cpu@1 {
+                       device_type = "cpu";
+                       compatible = "arm,cortex-a73";
+                       reg = <0x0 0x1>;
+                       enable-method = "psci";
+               };
+
+               cpu2: cpu@2 {
+                       device_type = "cpu";
+                       compatible = "arm,cortex-a73";
+                       reg = <0x0 0x2>;
+                       enable-method = "psci";
+               };
+
+               cpu3: cpu@3 {
+                       device_type = "cpu";
+                       compatible = "arm,cortex-a73";
+                       reg = <0x0 0x3>;
+                       enable-method = "psci";
+               };
+       };
+
+       timer {
+               compatible = "arm,armv8-timer";
+               interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(8) | IRQ_TYPE_LEVEL_LOW)>,
+                            <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(8) | IRQ_TYPE_LEVEL_LOW)>,
+                            <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(8) | IRQ_TYPE_LEVEL_LOW)>,
+                            <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(8) | IRQ_TYPE_LEVEL_LOW)>;
+       };
+
+       psci {
+               compatible = "arm,psci-1.0";
+               method = "smc";
+       };
+
+       sm: secure-monitor {
+               compatible = "amlogic,meson-gxbb-sm";
+       };
+
+       soc {
+               compatible = "simple-bus";
+               #address-cells = <2>;
+               #size-cells = <2>;
+               ranges;
+
+               gic: interrupt-controller@fff01000 {
+                       compatible = "arm,gic-400";
+                       #interrupt-cells = <3>;
+                       #address-cells = <0>;
+                       interrupt-controller;
+                       reg = <0x0 0xfff01000 0 0x1000>,
+                             <0x0 0xfff02000 0 0x0100>;
+                       interrupts = <GIC_PPI 9 (GIC_CPU_MASK_SIMPLE(8) | IRQ_TYPE_LEVEL_HIGH)>;
+               };
+
+               apb4: bus@fe000000 {
+                       compatible = "simple-bus";
+                       reg = <0x0 0xfe000000 0x0 0x480000>;
+                       #address-cells = <2>;
+                       #size-cells = <2>;
+                       ranges = <0x0 0x0 0x0 0xfe000000 0x0 0x480000>;
+
+                       uart_a: serial@78000 {
+                               compatible = "amlogic,t7-uart", "amlogic,meson-s4-uart";
+                               reg = <0x0 0x78000 0x0 0x18>;
+                               interrupts = <GIC_SPI 168 IRQ_TYPE_EDGE_RISING>;
+                               status = "disabled";
+                       };
+               };
+
+       };
+};
--
Quoted 2 lines

2.41.0

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

maintainer
#8 lore raw

Re: [PATCH v7 4/4] arm64: dts: amlogic-t7-a311d2-khadas-vim4: add initial device-tree

Hi,

Quoted 87 lines · Xianwei Zhao
Quoted 84 lines · Lucas Tanure

[ EXTERNAL EMAIL ]

The Khadas VIM4 uses the Amlogic A311D2 SoC, based on the Amlogic T7 SoC family, on a board with the same form factor as the VIM3 models.

- 8GB LPDDR4X 2016MHz
- 32GB eMMC 5.1 storage
- 32MB SPI flash
- 10/100/1000 Base-T Ethernet
- AP6275S Wireless (802.11 a/b/g/n/ac/ax, BT5.1)
- HDMI 2.1 video
- HDMI Input
- 1x USB 2.0 + 1x USB 3.0 ports
- 1x USB-C (power) with USB 2.0 OTG
- 3x LED's (1x red, 1x blue, 1x white)
- 3x buttons (power, function, reset)
- M2 socket with PCIe, USB, ADC & I2C
- 40pin GPIO Header
- 1x micro SD card slot

---
  arch/arm64/boot/dts/amlogic/Makefile          |   1 + .../amlogic/amlogic-t7-a311d2-khadas-vim4.dts |  54 ++++++ arch/arm64/boot/dts/amlogic/amlogic-t7.dtsi   | 155 ++++++++++++++++++

  3 files changed, 210 insertions(+)

  create mode 100644 arch/arm64/boot/dts/amlogic/amlogic-t7-a311d2-khadas-vim4.dts create mode 100644 arch/arm64/boot/dts/amlogic/amlogic-t7.dtsi

arch/arm64/boot/dts/amlogic/Makefile +1 -0
index cd1c5b04890a..166fec1e4229 100644
@@ -1,4 +1,5 @@
   # SPDX-License-Identifier: GPL-2.0
+dtb-$(CONFIG_ARCH_MESON) += amlogic-t7-a311d2-khadas-vim4.dtb

  dtb-$(CONFIG_ARCH_MESON) += meson-a1-ad401.dtb dtb-$(CONFIG_ARCH_MESON) += meson-axg-jethome-jethub-j100.dtb dtb-$(CONFIG_ARCH_MESON) += meson-axg-jethome-jethub-j110-rev-2.dtb

arch/arm64/boot/dts/amlogic/amlogic-t7-a311d2-khadas-vim4.dts new file +39 -0
new file mode 100644
index 000000000000..fffdab96b12e
@@ -0,0 +1,54 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2022 Wesion, Inc. All rights reserved.
+ */
+
+/dts-v1/;
+
+#include "amlogic-t7.dtsi"
+
+/ {
+       model = "Khadas vim4";
+       compatible = "khadas,vim4", "amlogic,a311d2", "amlogic,t7";
+
+       aliases {
+               serial0 = &uart_a;
+       };
+
+       memory@0 {
+               device_type = "memory";
+               reg = <0x0 0x0 0x2 0x0>; /* 8 GB */
+       };
+
+       reserved-memory {
+               #address-cells = <2>;
+               #size-cells = <2>;
+               ranges;
+
+               /* 3 MiB reserved for ARM Trusted Firmware (BL31) */
+               secmon_reserved: secmon@5000000 {
+                       reg = <0x0 0x05000000 0x0 0x300000>;
+                       no-map;
+               };
+
+               /* 32 MiB reserved for ARM Trusted Firmware (BL32) */
+               secmon_reserved_bl32: secmon@5300000 {
+                       reg = <0x0 0x05300000 0x0 0x2000000>;
+                       no-map;
+               };
+       };
Quoted 8 lines

arch/arm64/boot/dts/amlogic/amlogic-t7-a311d2-khadas-vim4.dts line 46

Quoted 7 lines
arch/arm64/boot/dts/amlogic/amlogic-t7-a311d2-khadas-vim4.dts new file +7 -0
+
+       xtal: xtal-clk {
+               compatible = "fixed-clock";
+               clock-frequency = <24000000>;
+               clock-output-names = "xtal";
+               #clock-cells = <0>;
+       };

Place xal in DTSI files is beterr,  the same as other Amlogic SoCs family. If frequency is different, reset value in here.

It's expected to have xtal in the board dts, since it's part of the board not the SoC.

Neil

Quoted 173 lines
Quoted 173 lines
arch/arm64/boot/dts/amlogic/amlogic-t7-a311d2-khadas-vim4.dts new file +8 -0
+
+};
+
+&uart_a {
+       status = "okay";
+       clocks = <&xtal>, <&xtal>, <&xtal>;
+       clock-names = "xtal", "pclk", "baud";
+};
arch/arm64/boot/dts/amlogic/amlogic-t7.dtsi new file +155 -0
new file mode 100644
index 000000000000..1423d4a79156
@@ -0,0 +1,155 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2019 Amlogic, Inc. All rights reserved.
+ */
+
+#include <dt-bindings/interrupt-controller/arm-gic.h>
+
+/ {
+       interrupt-parent = <&gic>;
+       #address-cells = <2>;
+       #size-cells = <2>;
+
+       cpus {
+               #address-cells = <0x2>;
+               #size-cells = <0x0>;
+
+               cpu-map {
+                       cluster0 {
+                               core0 {
+                                       cpu = <&cpu100>;
+                               };
+                               core1 {
+                                       cpu = <&cpu101>;
+                               };
+                               core2 {
+                                       cpu = <&cpu102>;
+                               };
+                               core3 {
+                                       cpu = <&cpu103>;
+                               };
+                       };
+
+                       cluster1 {
+                               core0 {
+                                       cpu = <&cpu0>;
+                               };
+                               core1 {
+                                       cpu = <&cpu1>;
+                               };
+                               core2 {
+                                       cpu = <&cpu2>;
+                               };
+                               core3 {
+                                       cpu = <&cpu3>;
+                               };
+                       };
+               };
+
+               cpu100: cpu@100 {
+                       device_type = "cpu";
+                       compatible = "arm,cortex-a53";
+                       reg = <0x0 0x100>;
+                       enable-method = "psci";
+               };
+
+               cpu101: cpu@101{
+                       device_type = "cpu";
+                       compatible = "arm,cortex-a53";
+                       reg = <0x0 0x101>;
+                       enable-method = "psci";
+               };
+
+               cpu102: cpu@102 {
+                       device_type = "cpu";
+                       compatible = "arm,cortex-a53";
+                       reg = <0x0 0x102>;
+                       enable-method = "psci";
+               };
+
+               cpu103: cpu@103 {
+                       device_type = "cpu";
+                       compatible = "arm,cortex-a53";
+                       reg = <0x0 0x103>;
+                       enable-method = "psci";
+               };
+
+               cpu0: cpu@0 {
+                       device_type = "cpu";
+                       compatible = "arm,cortex-a73";
+                       reg = <0x0 0x0>;
+                       enable-method = "psci";
+               };
+
+               cpu1: cpu@1 {
+                       device_type = "cpu";
+                       compatible = "arm,cortex-a73";
+                       reg = <0x0 0x1>;
+                       enable-method = "psci";
+               };
+
+               cpu2: cpu@2 {
+                       device_type = "cpu";
+                       compatible = "arm,cortex-a73";
+                       reg = <0x0 0x2>;
+                       enable-method = "psci";
+               };
+
+               cpu3: cpu@3 {
+                       device_type = "cpu";
+                       compatible = "arm,cortex-a73";
+                       reg = <0x0 0x3>;
+                       enable-method = "psci";
+               };
+       };
+
+       timer {
+               compatible = "arm,armv8-timer";
+               interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(8) | IRQ_TYPE_LEVEL_LOW)>,
+                            <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(8) | IRQ_TYPE_LEVEL_LOW)>,
+                            <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(8) | IRQ_TYPE_LEVEL_LOW)>,
+                            <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(8) | IRQ_TYPE_LEVEL_LOW)>;
+       };
+
+       psci {
+               compatible = "arm,psci-1.0";
+               method = "smc";
+       };
+
+       sm: secure-monitor {
+               compatible = "amlogic,meson-gxbb-sm";
+       };
+
+       soc {
+               compatible = "simple-bus";
+               #address-cells = <2>;
+               #size-cells = <2>;
+               ranges;
+
+               gic: interrupt-controller@fff01000 {
+                       compatible = "arm,gic-400";
+                       #interrupt-cells = <3>;
+                       #address-cells = <0>;
+                       interrupt-controller;
+                       reg = <0x0 0xfff01000 0 0x1000>,
+                             <0x0 0xfff02000 0 0x0100>;
+                       interrupts = <GIC_PPI 9 (GIC_CPU_MASK_SIMPLE(8) | IRQ_TYPE_LEVEL_HIGH)>;
+               };
+
+               apb4: bus@fe000000 {
+                       compatible = "simple-bus";
+                       reg = <0x0 0xfe000000 0x0 0x480000>;
+                       #address-cells = <2>;
+                       #size-cells = <2>;
+                       ranges = <0x0 0x0 0x0 0xfe000000 0x0 0x480000>;
+
+                       uart_a: serial@78000 {
+                               compatible = "amlogic,t7-uart", "amlogic,meson-s4-uart";
+                               reg = <0x0 0x78000 0x0 0x18>;
+                               interrupts = <GIC_SPI 168 IRQ_TYPE_EDGE_RISING>;
+                               status = "disabled";
+                       };
+               };
+
+       };
+};
Signature · 1 line
2.41.0
maintainer Reviewed-by on v7 4/4
#9 lore raw

Re: [PATCH v7 4/4] arm64: dts: amlogic-t7-a311d2-khadas-vim4: add initial device-tree

In reply to Lucas Tanure
Quoted 259 lines · Lucas Tanure

The Khadas VIM4 uses the Amlogic A311D2 SoC, based on the Amlogic T7 SoC family, on a board with the same form factor as the VIM3 models.

- 8GB LPDDR4X 2016MHz
- 32GB eMMC 5.1 storage
- 32MB SPI flash
- 10/100/1000 Base-T Ethernet
- AP6275S Wireless (802.11 a/b/g/n/ac/ax, BT5.1)
- HDMI 2.1 video
- HDMI Input
- 1x USB 2.0 + 1x USB 3.0 ports
- 1x USB-C (power) with USB 2.0 OTG
- 3x LED's (1x red, 1x blue, 1x white)
- 3x buttons (power, function, reset)
- M2 socket with PCIe, USB, ADC & I2C
- 40pin GPIO Header
- 1x micro SD card slot

---
  arch/arm64/boot/dts/amlogic/Makefile          |   1 +
  .../amlogic/amlogic-t7-a311d2-khadas-vim4.dts |  54 ++++++
  arch/arm64/boot/dts/amlogic/amlogic-t7.dtsi   | 155 ++++++++++++++++++
  3 files changed, 210 insertions(+)

create mode 100644 arch/arm64/boot/dts/amlogic/amlogic-t7-a311d2-khadas-vim4.dts create mode 100644 arch/arm64/boot/dts/amlogic/amlogic-t7.dtsi

arch/arm64/boot/dts/amlogic/Makefile +1 -0
index cd1c5b04890a..166fec1e4229 100644
@@ -1,4 +1,5 @@
  # SPDX-License-Identifier: GPL-2.0
+dtb-$(CONFIG_ARCH_MESON) += amlogic-t7-a311d2-khadas-vim4.dtb
  dtb-$(CONFIG_ARCH_MESON) += meson-a1-ad401.dtb
  dtb-$(CONFIG_ARCH_MESON) += meson-axg-jethome-jethub-j100.dtb
  dtb-$(CONFIG_ARCH_MESON) += meson-axg-jethome-jethub-j110-rev-2.dtb
arch/arm64/boot/dts/amlogic/amlogic-t7-a311d2-khadas-vim4.dts new file +54 -0
new file mode 100644
index 000000000000..fffdab96b12e
@@ -0,0 +1,54 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2022 Wesion, Inc. All rights reserved.
+ */
+
+/dts-v1/;
+
+#include "amlogic-t7.dtsi"
+
+/ {
+	model = "Khadas vim4";
+	compatible = "khadas,vim4", "amlogic,a311d2", "amlogic,t7";
+
+	aliases {
+		serial0 = &uart_a;
+	};
+
+	memory@0 {
+		device_type = "memory";
+		reg = <0x0 0x0 0x2 0x0>; /* 8 GB */
+	};
+
+	reserved-memory {
+		#address-cells = <2>;
+		#size-cells = <2>;
+		ranges;
+
+		/* 3 MiB reserved for ARM Trusted Firmware (BL31) */
+		secmon_reserved: secmon@5000000 {
+			reg = <0x0 0x05000000 0x0 0x300000>;
+			no-map;
+		};
+
+		/* 32 MiB reserved for ARM Trusted Firmware (BL32) */
+		secmon_reserved_bl32: secmon@5300000 {
+			reg = <0x0 0x05300000 0x0 0x2000000>;
+			no-map;
+		};
+	};
+
+	xtal: xtal-clk {
+		compatible = "fixed-clock";
+		clock-frequency = <24000000>;
+		clock-output-names = "xtal";
+		#clock-cells = <0>;
+	};
+
+};
+
+&uart_a {
+	status = "okay";
+	clocks = <&xtal>, <&xtal>, <&xtal>;
+	clock-names = "xtal", "pclk", "baud";
+};
arch/arm64/boot/dts/amlogic/amlogic-t7.dtsi new file +155 -1
new file mode 100644
index 000000000000..1423d4a79156
@@ -0,0 +1,155 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2019 Amlogic, Inc. All rights reserved.
+ */
+
+#include <dt-bindings/interrupt-controller/arm-gic.h>
+
+/ {
+	interrupt-parent = <&gic>;
+	#address-cells = <2>;
+	#size-cells = <2>;
+
+	cpus {
+		#address-cells = <0x2>;
+		#size-cells = <0x0>;
+
+		cpu-map {
+			cluster0 {
+				core0 {
+					cpu = <&cpu100>;
+				};
+				core1 {
+					cpu = <&cpu101>;
+				};
+				core2 {
+					cpu = <&cpu102>;
+				};
+				core3 {
+					cpu = <&cpu103>;
+				};
+			};
+
+			cluster1 {
+				core0 {
+					cpu = <&cpu0>;
+				};
+				core1 {
+					cpu = <&cpu1>;
+				};
+				core2 {
+					cpu = <&cpu2>;
+				};
+				core3 {
+					cpu = <&cpu3>;
+				};
+			};
+		};
+
+		cpu100: cpu@100 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a53";
+			reg = <0x0 0x100>;
+			enable-method = "psci";
+		};
+
+		cpu101: cpu@101{
+			device_type = "cpu";
+			compatible = "arm,cortex-a53";
+			reg = <0x0 0x101>;
+			enable-method = "psci";
+		};
+
+		cpu102: cpu@102 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a53";
+			reg = <0x0 0x102>;
+			enable-method = "psci";
+		};
+
+		cpu103: cpu@103 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a53";
+			reg = <0x0 0x103>;
+			enable-method = "psci";
+		};
+
+		cpu0: cpu@0 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a73";
+			reg = <0x0 0x0>;
+			enable-method = "psci";
+		};
+
+		cpu1: cpu@1 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a73";
+			reg = <0x0 0x1>;
+			enable-method = "psci";
+		};
+
+		cpu2: cpu@2 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a73";
+			reg = <0x0 0x2>;
+			enable-method = "psci";
+		};
+
+		cpu3: cpu@3 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a73";
+			reg = <0x0 0x3>;
+			enable-method = "psci";
+		};
+	};
+
+	timer {
+		compatible = "arm,armv8-timer";
+		interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(8) | IRQ_TYPE_LEVEL_LOW)>,
+			     <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(8) | IRQ_TYPE_LEVEL_LOW)>,
+			     <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(8) | IRQ_TYPE_LEVEL_LOW)>,
+			     <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(8) | IRQ_TYPE_LEVEL_LOW)>;
+	};
+
+	psci {
+		compatible = "arm,psci-1.0";
+		method = "smc";
+	};
+
+	sm: secure-monitor {
+		compatible = "amlogic,meson-gxbb-sm";
+	};
+
+	soc {
+		compatible = "simple-bus";
+		#address-cells = <2>;
+		#size-cells = <2>;
+		ranges;
+
+		gic: interrupt-controller@fff01000 {
+			compatible = "arm,gic-400";
+			#interrupt-cells = <3>;
+			#address-cells = <0>;
+			interrupt-controller;
+			reg = <0x0 0xfff01000 0 0x1000>,
+			      <0x0 0xfff02000 0 0x0100>;
+			interrupts = <GIC_PPI 9 (GIC_CPU_MASK_SIMPLE(8) | IRQ_TYPE_LEVEL_HIGH)>;
+		};
+
+		apb4: bus@fe000000 {
+			compatible = "simple-bus";
+			reg = <0x0 0xfe000000 0x0 0x480000>;
+			#address-cells = <2>;
+			#size-cells = <2>;
+			ranges = <0x0 0x0 0x0 0xfe000000 0x0 0x480000>;
+
+			uart_a: serial@78000 {
+				compatible = "amlogic,t7-uart", "amlogic,meson-s4-uart";
+				reg = <0x0 0x78000 0x0 0x18>;
+				interrupts = <GIC_SPI 168 IRQ_TYPE_EDGE_RISING>;
+				status = "disabled";
+			};
+		};
+
+	};
+};
--
Quoted 2 lines

2.41.0

maintainer Applied
#10 lore raw

Re: (subset) [PATCH v7 0/4] Add Amlogic A311D2 and Khadas Vim4 Board Support

In reply to Lucas Tanure

Hi,

Quoted 9 lines · Lucas Tanure

The Khadas VIM4 uses the Amlogic A311D2 SoC, based on the Amlogic T7 family. This chip is not the same as A311D used in Vim3 board.

Work based on Khadas 5.4 branch:
https://github.com/khadas/linux/tree/khadas-vims-5.4.y

The current status is Vim4 board booting to emergency shell via uart.

[...]

Thanks, Applied to https://git.kernel.org/pub/scm/linux/kernel/git/amlogic/linux.git (v6.6/arm64-dt)

[1/4] dt-bindings: arm: amlogic: add Amlogic A311D2 bindings

      https://git.kernel.org/amlogic/c/19f1263230b6c665d950d63290de6648ed81e0a9
[4/4] arm64: dts: amlogic-t7-a311d2-khadas-vim4: add initial device-tree
      https://git.kernel.org/amlogic/c/419b6066cf1ff2a5f29edf565d5ece55fceb4230

These changes has been applied on the intermediate git tree [1].

The v6.6/arm64-dt branch will then be sent via a formal Pull Request to the Linux SoC maintainers for inclusion in their intermediate git branches in order to be sent to Linus during the next merge window, or sooner if it's a set of fixes.

In the cases of fixes, those will be merged in the current release candidate kernel and as soon they appear on the Linux master branch they will be backported to the previous Stable and Long-Stable kernels [2].

The intermediate git branches are merged daily in the linux-next tree [3], people are encouraged testing these pre-release kernels and report issues on the relevant mailing-lists.

If problems are discovered on those changes, please submit a signed-off-by revert patch followed by a corrective changeset.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/amlogic/linux.git
[2] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
[3] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git

Signature · 1 line
Neil
maintainer
#11 lore raw
In reply to Lucas Tanure

Hi Lucas,

Quoted 8 lines · Lucas Tanure

The Khadas VIM4 uses the Amlogic A311D2 SoC, based on the Amlogic T7 family. This chip is not the same as A311D used in Vim3 board.

Work based on Khadas 5.4 branch:
https://github.com/khadas/linux/tree/khadas-vims-5.4.y

The current status is Vim4 board booting to emergency shell via uart.

Quoted 15 lines

Board Features:
- 8GB LPDDR4X 2016MHz
- 32GB eMMC 5.1 storage
- 32MB SPI flash
- 10/100/1000 Base-T Ethernet
- AP6275S Wireless (802.11 a/b/g/n/ac/ax, BT5.1)
- HDMI 2.1 video
- HDMI Input
- 1x USB 2.0 + 1x USB 3.0 ports
- 1x USB-C (power) with USB 2.0 OTG
- 3x LED's (1x red, 1x blue, 1x white)
- 3x buttons (power, function, reset)
- M2 socket with PCIe, USB, ADC & I2C
- 40pin GPIO Header
- 1x micro SD card slot

I've applied patches 1 & 4, now you can send the serie with only uart changes, it will simplify Greg's life.

Thanks,
Neil

Quoted 56 lines

Changes Since v6:
- Move Uart clock to amlogic-t7-a311d2-khadas-vim4 dts
- Fix GIC_CPU_MASK_SIMPLE
- Lowercase uart label

Changes Since v5:
- Remove meson as T7 its not a meson chip
- Change Uart Document descript to S4 compatibles

Changes Since v4:
- Use S4 instead of G12a for uart fallback
- Add OF_EARLYCON_DECLARE for T7 uart

Changes Since v3:
- Fix issues with "amlogic,meson-t7-uart" documentation

Changes Since v2:
- Add "amlogic,meson-t7-uart" documentation

Changes Since v1:
- Drop the T7 clock driver as it is not needed for serial boot. It will later use the S4 clock
driver as S4 and T7 seems to be similar chips.
- Use "arm,gic-400" for interrupt controller to fix dtb_check
- Remove CPU node properties not needed for serial boot
- Move UART node to apb4 node
- Drop T7 UART compatible line and use S4 uart
- Use psci V1 instead of 0.2, it works, but I can't verify is correct as the datasheet I have
doesn't contain that information.
- Remove compatible from meson-t7.dtsi, move it to vim4 board dts
- Add memory node with 8GB. Not sure about this one, works without, but doesn't detect 8GB
- Use defines for GIC_CPU_MASK_SIMPLE, IRQ_TYPE_LEVEL_LOW, IRQ_TYPE_LEVEL_HIGH instead of hardcoded values

Lucas Tanure (4):
dt-bindings: arm: amlogic: add Amlogic A311D2 bindings
dt-bindings: serial: amlogic,meson-uart: Add compatible string for T7
tty: serial: meson: Add a earlycon for the T7 SoC
arm64: dts: amlogic-t7-a311d2-khadas-vim4: add initial device-tree

  .../devicetree/bindings/arm/amlogic.yaml      |   7 +
  .../bindings/serial/amlogic,meson-uart.yaml   |   4 +
  arch/arm64/boot/dts/amlogic/Makefile          |   1 +
  .../amlogic/amlogic-t7-a311d2-khadas-vim4.dts |  54 ++++++
  arch/arm64/boot/dts/amlogic/amlogic-t7.dtsi   | 155 ++++++++++++++++++
  drivers/tty/serial/meson_uart.c               |   2 +
  6 files changed, 223 insertions(+)

create mode 100644 arch/arm64/boot/dts/amlogic/amlogic-t7-a311d2-khadas-vim4.dts create mode 100644 arch/arm64/boot/dts/amlogic/amlogic-t7.dtsi

--
2.41.0