Skip to contentSkip to conversation

Add Amlogic A311D2 and Khadas Vim4 Board Support

PATCH Superseded Lucas Tanure 3 participants 8 messages Jun 22, 2023 – Jun 23, 2023

Subsystems (3)

v4 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

v4 cover Add Amlogic A311D2 and Khadas Vim4 Board Support

The Khadas VIM4 uses the Amlogic A311D2 SoC, based on the Amlogic Meson 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 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 (3):
dt-bindings: arm: amlogic: add Amlogic A311D2 bindings
dt-bindings: serial: amlogic,meson-uart: Add compatible string for T7
arm64: dts: meson-t7-a311d2-khadas-vim4: add initial device-tree

 .../devicetree/bindings/arm/amlogic.yaml      |   7 +
 .../bindings/serial/amlogic,meson-uart.yaml   |   6 +
 arch/arm64/boot/dts/amlogic/Makefile          |   1 +
 .../amlogic/meson-t7-a311d2-khadas-vim4.dts   |  52 ++++++
 arch/arm64/boot/dts/amlogic/meson-t7.dtsi     | 159 ++++++++++++++++++
 5 files changed, 225 insertions(+)
 create mode 100644 arch/arm64/boot/dts/amlogic/meson-t7-a311d2-khadas-vim4.dts
 create mode 100644 arch/arm64/boot/dts/amlogic/meson-t7.dtsi
Signature · 7 lines
2.41.0


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

PATCH v4 1/3 dt-bindings: arm: amlogic: add Amlogic A311D2 bindings

Add bindings for the Khadas Vim4 board, using A311D2 soc, a Meson 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..8dbd65170c50 100644
@@ -211,6 +211,13 @@ properties:
               - amlogic,aq222
           - const: amlogic,s4
 
+      - description: Boards with the Amlogic Meson t7 A311D2 SoC
+        items:
+          - enum:
+              - khadas,vim4
+          - const: amlogic,a311d2
+          - const: amlogic,t7
+
 additionalProperties: true
 
 ...
Signature · 7 lines
2.41.0


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

PATCH v4 2/3 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      | 6 ++++++
 1 file changed, 6 insertions(+)
Documentation/devicetree/bindings/serial/amlogic,meson-uart.yaml +6 -0
index 01ec45b3b406..4ca4673169aa 100644
@@ -46,6 +46,12 @@ properties:
           - amlogic,meson8b-uart
           - amlogic,meson-gx-uart
           - amlogic,meson-s4-uart
+      - description: Everything-Else power domain UART controller on G12A compatible SoCs
+        items:
+          - enum:
+              - amlogic,meson-t7-uart
+          - const: amlogic,meson-g12a-uart
+          - const: amlogic,meson-ao-uart
       - description: Everything-Else power domain UART controller on G12A SoCs
         items:
           - const: amlogic,meson-g12a-uart
Signature · 7 lines
2.41.0


_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
Acked-by on v4 2/3
#3 lore raw

Re: [PATCH v4 2/3] dt-bindings: serial: amlogic,meson-uart: Add compatible string for T7

Hey Lucas,

Quoted 5 lines · 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.

You can delete this, I don't need a Co-developed-by tag for review feedback.

Quoted 10 lines
---
 .../devicetree/bindings/serial/amlogic,meson-uart.yaml      | 6 ++++++
 1 file changed, 6 insertions(+)
Documentation/devicetree/bindings/serial/amlogic,meson-uart.yaml +0 -0
index 01ec45b3b406..4ca4673169aa 100644

Documentation/devicetree/bindings/serial/amlogic,meson-uart.yaml properties: · line 49

Quoted 4 lines
Documentation/devicetree/bindings/serial/amlogic,meson-uart.yaml +1 -0
@@ -46,6 +46,12 @@ properties:
           - amlogic,meson8b-uart
           - amlogic,meson-gx-uart
           - amlogic,meson-s4-uart
+      - description: Everything-Else power domain UART controller on G12A compatible SoCs

s/Everything-Else/Always-on/
Otherwise,

Perhaps it can be fixed on application, I don't know how the amlogic maintainers operate.

Cheers,
Conor.

Quoted 11 lines
Documentation/devicetree/bindings/serial/amlogic,meson-uart.yaml +5 -0
+        items:
+          - enum:
+              - amlogic,meson-t7-uart
+          - const: amlogic,meson-g12a-uart
+          - const: amlogic,meson-ao-uart
       - description: Everything-Else power domain UART controller on G12A SoCs
         items:
           - const: amlogic,meson-g12a-uart
Signature · 1 line
2.41.0

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

maintainer
#4 lore raw

Re: [PATCH v4 2/3] dt-bindings: serial: amlogic,meson-uart: Add compatible string for T7

Quoted 17 lines · Conor Dooley

Hey Lucas,

Quoted 5 lines · 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.

You can delete this, I don't need a Co-developed-by tag for review feedback.

Quoted 5 lines
---
  .../devicetree/bindings/serial/amlogic,meson-uart.yaml      | 6 ++++++
  1 file changed, 6 insertions(+)
Quoted 11 lines

Documentation/devicetree/bindings/serial/amlogic,meson-uart.yaml properties: · line 49

Quoted 9 lines
Documentation/devicetree/bindings/serial/amlogic,meson-uart.yaml +1 -0
index 01ec45b3b406..4ca4673169aa 100644
@@ -46,6 +46,12 @@ properties:
            - amlogic,meson8b-uart
            - amlogic,meson-gx-uart
            - amlogic,meson-s4-uart
+      - description: Everything-Else power domain UART controller on G12A compatible SoCs

s/Everything-Else/Always-on/

"Everything-Else" was the amlogic naming for the non-always-on power domain, but it seems it's no more something used on new SoCs like the T7 family.

Anyway, the description is wrong, and it's a mess because we used "amlogic,meson-ao-uart" for uarts on the Always-On domain, but here it's described as Everything-Else...

Lucas, is there AO_uarts on T7 ? if not drop this amlogic,meson-ao-uart for the T7 UARTs.

But if there's no more AO uart controller, you'll need to change drivers/tty/serial/meson_uart.c and add a OF_EARLYCON_DECLARE() for amlogic,meson-t7-uart.

But still, why don't you use the amlogic,meson-s4-uart as fallback instead ?

+ - description: UART controller on T7 compatible SoCs
+ items:
+ - const: amlogic,meson-t7-uart
+ - const: amlogic,meson-s4-uart

and update meson_uart.c if there's no AO uarts anymore....

Neil

Quoted 20 lines

Otherwise,

Perhaps it can be fixed on application, I don't know how the amlogic maintainers operate.

Cheers,
Conor.

Quoted 11 lines
Documentation/devicetree/bindings/serial/amlogic,meson-uart.yaml +5 -0
+        items:
+          - enum:
+              - amlogic,meson-t7-uart
+          - const: amlogic,meson-g12a-uart
+          - const: amlogic,meson-ao-uart
        - description: Everything-Else power domain UART controller on G12A SoCs
          items:
            - const: amlogic,meson-g12a-uart
Signature · 1 line
2.41.0

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

#5 lore raw

Re: [PATCH v4 2/3] dt-bindings: serial: amlogic,meson-uart: Add compatible string for T7

Quoted 35 lines · Neil Armstrong
Quoted 15 lines · Conor Dooley
Quoted 5 lines · 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.

You can delete this, I don't need a Co-developed-by tag for review feedback.

Quoted 5 lines
---
  .../devicetree/bindings/serial/amlogic,meson-uart.yaml      | 6 ++++++
  1 file changed, 6 insertions(+)
Quoted 11 lines

Documentation/devicetree/bindings/serial/amlogic,meson-uart.yaml properties: · line 49

Quoted 9 lines
Documentation/devicetree/bindings/serial/amlogic,meson-uart.yaml +1 -0
index 01ec45b3b406..4ca4673169aa 100644
@@ -46,6 +46,12 @@ properties:
            - amlogic,meson8b-uart
            - amlogic,meson-gx-uart
            - amlogic,meson-s4-uart
+      - description: Everything-Else power domain UART controller on G12A compatible SoCs

s/Everything-Else/Always-on/

"Everything-Else" was the amlogic naming for the non-always-on power domain, but it seems it's no more something used on new SoCs like the T7 family.

Anyway, the description is wrong, and it's a mess because we used "amlogic,meson-ao-uart" for uarts on the Always-On domain, but here it's described as Everything-Else...

Quoted 6 lines

Lucas, is there AO_uarts on T7 ? if not drop this amlogic,meson-ao-uart for the T7 UARTs.

But if there's no more AO uart controller, you'll need to change drivers/tty/serial/meson_uart.c and add a OF_EARLYCON_DECLARE() for amlogic,meson-t7-uart.

But still, why don't you use the amlogic,meson-s4-uart as fallback instead ?

That's probably my fault, I suggested the g12a in my reply to v3, because that is the one from which the match data is being copied, so it seemed like it'd make the most sense to me as the fallback.

btw Neil, is the "meson-gx-uart" a wildcard? Dunno the hardware, so wasn't sure.

Review

Quoted 4 lines
(quoted diff) +4 -0
+      - description: UART controller on T7 compatible SoCs
+        items:
+          - const: amlogic,meson-t7-uart
+          - const: amlogic,meson-s4-uart

As mentioned on v (N-1), I am fine with this either. You can keep the Ack Lucas with this change.

Quoted 6 lines

and update meson_uart.c if there's no AO uarts anymore....

Neil

Quoted 2 lines

Otherwise,

#6 lore raw

Re: [PATCH v4 2/3] dt-bindings: serial: amlogic,meson-uart: Add compatible string for T7

In reply to Neil Armstrong
Quoted 32 lines · Neil Armstrong
Quoted 17 lines · Conor Dooley

Hey Lucas,

Quoted 5 lines · 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.

You can delete this, I don't need a Co-developed-by tag for review feedback.

Quoted 5 lines
---
  .../devicetree/bindings/serial/amlogic,meson-uart.yaml      | 6 ++++++
  1 file changed, 6 insertions(+)
Quoted 11 lines

Documentation/devicetree/bindings/serial/amlogic,meson-uart.yaml properties: · line 49

Quoted 9 lines
Documentation/devicetree/bindings/serial/amlogic,meson-uart.yaml +1 -0
index 01ec45b3b406..4ca4673169aa 100644
@@ -46,6 +46,12 @@ properties:
            - amlogic,meson8b-uart
            - amlogic,meson-gx-uart
            - amlogic,meson-s4-uart
+      - description: Everything-Else power domain UART controller on G12A compatible SoCs

s/Everything-Else/Always-on/

Quoted 7 lines

"Everything-Else" was the amlogic naming for the non-always-on power domain, but it seems it's no more something used on new SoCs like the T7 family.

Anyway, the description is wrong, and it's a mess because we used "amlogic,meson-ao-uart" for uarts on the Always-On domain, but here it's described as Everything-Else...

Lucas, is there AO_uarts on T7 ? if not drop this amlogic,meson-ao-uart for the T7 UARTs.

No, there is not an AO_uart in T7, as far as I can see from the code and datasheet.

Quoted 5 lines

But if there's no more AO uart controller, you'll need to change drivers/tty/serial/meson_uart.c and add a OF_EARLYCON_DECLARE() for amlogic,meson-t7-uart.

But still, why don't you use the amlogic,meson-s4-uart as fallback instead ?

As S4 and T7 are the same as g12a, I thought it would be better to just have g12a uart.
But sure, I can use S4 as fallback.

Quoted 7 lines
(quoted diff) +4 -0
+      - description: UART controller on T7 compatible SoCs
+        items:
+          - const: amlogic,meson-t7-uart
+          - const: amlogic,meson-s4-uart

and update meson_uart.c if there's no AO uarts anymore....

Ok, v5 is coming up.

Quoted 24 lines

Neil

Quoted 20 lines

Otherwise,

Perhaps it can be fixed on application, I don't know how the amlogic maintainers operate.

Cheers,
Conor.

Quoted 11 lines
Documentation/devicetree/bindings/serial/amlogic,meson-uart.yaml +5 -1
+        items:
+          - enum:
+              - amlogic,meson-t7-uart
+          - const: amlogic,meson-g12a-uart
+          - const: amlogic,meson-ao-uart
        - description: Everything-Else power domain UART controller on G12A SoCs
          items:
            - const: amlogic,meson-g12a-uart
--

2.41.0

#7 lore raw

PATCH v4 3/3 arm64: dts: meson-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/meson-t7-a311d2-khadas-vim4.dts   |  52 ++++++
 arch/arm64/boot/dts/amlogic/meson-t7.dtsi     | 159 ++++++++++++++++++
 3 files changed, 212 insertions(+)
 create mode 100644 arch/arm64/boot/dts/amlogic/meson-t7-a311d2-khadas-vim4.dts
 create mode 100644 arch/arm64/boot/dts/amlogic/meson-t7.dtsi
arch/arm64/boot/dts/amlogic/Makefile +1 -0
index cd1c5b04890a..1c5846bd1ca0 100644
@@ -74,3 +74,4 @@ dtb-$(CONFIG_ARCH_MESON) += meson-sm1-odroid-hc4.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-sm1-sei610.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-sm1-x96-air-gbit.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-sm1-x96-air.dtb
+dtb-$(CONFIG_ARCH_MESON) += meson-t7-a311d2-khadas-vim4.dtb
arch/arm64/boot/dts/amlogic/meson-t7-a311d2-khadas-vim4.dts new file +52 -0

52 lines not on this page · raw message

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

159 lines not on this page · raw message

Signature · 7 lines
2.41.0


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