Skip to contentSkip to conversation

amlogic: Add support for Odroid-N2

PATCH New Neil Armstrong 2 participants 7 messages Jul 29, 2019 – Jul 31, 2019

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

cover amlogic: Add support for Odroid-N2

ODROID-N2 is a single board computer manufactured by Hardkernel Co. Ltd with the following specifications:

- Amlogic S922X ARM Cortex-A53 dual-core + Cortex-A73 quad-core SoC
- 4GB DDR4 SDRAM
- Gigabit Ethernet
- HDMI 2.1 4K/60Hz display
- 40-pin GPIO header
- 4 x USB 3.0 Host, 1 x USB OTG
- eMMC, microSD
- Infrared receiver

This patchset :
- adds the Odroid-N2 from Linux 5.3-rc1
- fixes 4GiB memory support
- adds board support

The board directory is W400, the name of the Amlogic Reference Design of Amlogic G12B with Gigabit boards, which will be used for similar boards.

Changes since v1:
- Fix typo in README.odroid-n2

Neil Armstrong (3):
ARM: dts: add support for Odroid-N2
ARM: meson-g12a: Handle 4GiB DRAM size
board: amlogic: add support for Odroid-N2

 arch/arm/dts/Makefile                         |   3 +-
 arch/arm/dts/meson-g12b-odroid-n2.dts         | 386 ++++++++++++++++++
 arch/arm/dts/meson-g12b.dtsi                  |  82 ++++
 arch/arm/mach-meson/board-g12a.c              |  13 +-
 board/amlogic/w400/MAINTAINERS                |   6 +
 board/amlogic/w400/Makefile                   |   6 +
 board/amlogic/w400/README.odroid-n2           | 130 ++++++
 board/amlogic/w400/README.w400                | 130 ++++++
 board/amlogic/w400/w400.c                     |  18 +
 configs/odroid-n2_defconfig                   |  56 +++
 .../dt-bindings/sound/meson-g12a-tohdmitx.h   |  13 +
 11 files changed, 836 insertions(+), 7 deletions(-)
 create mode 100644 arch/arm/dts/meson-g12b-odroid-n2.dts
 create mode 100644 arch/arm/dts/meson-g12b.dtsi
 create mode 100644 board/amlogic/w400/MAINTAINERS
 create mode 100644 board/amlogic/w400/Makefile
 create mode 100644 board/amlogic/w400/README.odroid-n2
 create mode 100644 board/amlogic/w400/README.w400
 create mode 100644 board/amlogic/w400/w400.c
 create mode 100644 configs/odroid-n2_defconfig
 create mode 100644 include/dt-bindings/sound/meson-g12a-tohdmitx.h
Signature · 1 line
2.22.0
#1 lore raw

PATCH 1/3 ARM: dts: add support for Odroid-N2

Import HardKernel Odroid-N2 DT from Linux 5.3-rc1, commit 5f9e832c1370 ("Linus 5.3-rc1") based on an Amlogic G12B S922X SoC.

---
 arch/arm/dts/Makefile                         |   3 +-
 arch/arm/dts/meson-g12b-odroid-n2.dts         | 386 ++++++++++++++++++
 arch/arm/dts/meson-g12b.dtsi                  |  82 ++++
 .../dt-bindings/sound/meson-g12a-tohdmitx.h   |  13 +
 4 files changed, 483 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/dts/meson-g12b-odroid-n2.dts
 create mode 100644 arch/arm/dts/meson-g12b.dtsi
 create mode 100644 include/dt-bindings/sound/meson-g12a-tohdmitx.h
arch/arm/dts/Makefile +2 -1
index f5535078c7..2baa368215 100644
@@ -135,7 +135,8 @@ dtb-$(CONFIG_ARCH_MESON) += \
 	meson-gxl-s905x-khadas-vim.dtb \
 	meson-gxm-khadas-vim2.dtb \
 	meson-axg-s400.dtb \
-	meson-g12a-u200.dtb
+	meson-g12a-u200.dtb \
+	meson-g12b-odroid-n2.dtb
 dtb-$(CONFIG_TEGRA) += tegra20-harmony.dtb \
 	tegra20-medcom-wide.dtb \
 	tegra20-paz00.dtb \
arch/arm/dts/meson-g12b-odroid-n2.dts new file +386 -0

386 lines not on this page · raw message

arch/arm/dts/meson-g12b.dtsi new file +82 -0

82 lines not on this page · raw message

include/dt-bindings/sound/meson-g12a-tohdmitx.h new file +13 -0
new file mode 100644
index 0000000000..c5e1f48d30
@@ -0,0 +1,13 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef __DT_MESON_G12A_TOHDMITX_H
+#define __DT_MESON_G12A_TOHDMITX_H
+
+#define TOHDMITX_I2S_IN_A	0
+#define TOHDMITX_I2S_IN_B	1
+#define TOHDMITX_I2S_IN_C	2
+#define TOHDMITX_I2S_OUT	3
+#define TOHDMITX_SPDIF_IN_A	4
+#define TOHDMITX_SPDIF_IN_B	5
+#define TOHDMITX_SPDIF_OUT	6
+
+#endif /* __DT_MESON_G12A_TOHDMITX_H */
Signature · 1 line
2.22.0
#2 lore raw

PATCH 2/3 ARM: meson-g12a: Handle 4GiB DRAM size

In reply to Neil Armstrong

When configured with 4GiB DRAM size, only 3.8GiB is available, the I/O beeing mapped in the last 256MiB of the first 4GiB physical memory/

First fixup the mm_region to handle the first 3.8GiB as memory and the last 256MiB as I/O.

Then limit the real memory reported by the firmware to the available physical space, 3.8GiB aligned with the mm_region memory zone size.

---
 arch/arm/mach-meson/board-g12a.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
arch/arm/mach-meson/board-g12a.c +7 -6
index 1652970fbd..546b9f6039 100644
@@ -62,21 +62,21 @@ void meson_init_reserved_memory(void *fdt)
 phys_size_t get_effective_memsize(void)
 {
 	/* Size is reported in MiB, convert it in bytes */
-	return ((readl(G12A_AO_SEC_GP_CFG0) & G12A_AO_MEM_SIZE_MASK)
-			>> G12A_AO_MEM_SIZE_SHIFT) * SZ_1M;
+	return min(((readl(G12A_AO_SEC_GP_CFG0) & G12A_AO_MEM_SIZE_MASK)
+			>> G12A_AO_MEM_SIZE_SHIFT) * SZ_1M, 0xf5000000);
 }
 
 static struct mm_region g12a_mem_map[] = {
 	{
 		.virt = 0x0UL,
 		.phys = 0x0UL,
-		.size = 0x80000000UL,
+		.size = 0xf5000000UL,
 		.attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
 			 PTE_BLOCK_INNER_SHARE
 	}, {
-		.virt = 0xf0000000UL,
-		.phys = 0xf0000000UL,
-		.size = 0x10000000UL,
+		.virt = 0xf5000000UL,
+		.phys = 0xf5000000UL,
+		.size = 0x0b000000UL,
 		.attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
 			 PTE_BLOCK_NON_SHARE |
 			 PTE_BLOCK_PXN | PTE_BLOCK_UXN
@@ -129,6 +129,7 @@ void meson_eth_init(phy_interface_t mode, unsigned int flags)
 			     G12A_ETH_REG_0_TX_RATIO(4) |
 			     G12A_ETH_REG_0_PHY_CLK_EN |
 			     G12A_ETH_REG_0_CLK_EN);
+		g12a_enable_external_mdio();
 		break;
 
 	case PHY_INTERFACE_MODE_RMII:
Signature · 1 line
2.22.0
#3 lore raw

PATCH 3/3 board: amlogic: add support for Odroid-N2

In reply to Neil Armstrong

ODROID-N2 is a single board computer manufactured by Hardkernel Co. Ltd with the following specifications:

- Amlogic S922X ARM Cortex-A53 dual-core + Cortex-A73 quad-core SoC
- 4GB DDR4 SDRAM
- Gigabit Ethernet
- HDMI 2.1 4K/60Hz display
- 40-pin GPIO header
- 4 x USB 3.0 Host, 1 x USB OTG
- eMMC, microSD
- Infrared receiver

The board directory is W400, the name of the Amlogic Reference Design of Amlogic G12B with Gigabit boards, which will be used for similar boards.

---
 board/amlogic/w400/MAINTAINERS      |   6 ++
 board/amlogic/w400/Makefile         |   6 ++
 board/amlogic/w400/README.odroid-n2 | 130 ++++++++++++++++++++++++++++
 board/amlogic/w400/README.w400      | 130 ++++++++++++++++++++++++++++
 board/amlogic/w400/w400.c           |  18 ++++
 configs/odroid-n2_defconfig         |  56 ++++++++++++
 6 files changed, 346 insertions(+)
 create mode 100644 board/amlogic/w400/MAINTAINERS
 create mode 100644 board/amlogic/w400/Makefile
 create mode 100644 board/amlogic/w400/README.odroid-n2
 create mode 100644 board/amlogic/w400/README.w400
 create mode 100644 board/amlogic/w400/w400.c
 create mode 100644 configs/odroid-n2_defconfig
board/amlogic/w400/MAINTAINERS new file +6 -0
new file mode 100644
index 0000000000..6e68fa73f7
@@ -0,0 +1,6 @@
+W400
+M:	Neil Armstrong <[email protected]>
+S:	Maintained
+L:	u-boot-amlogic at groups.io
+F:	board/amlogic/w400/
+F:	configs/odroid-n2_defconfig
board/amlogic/w400/Makefile new file +6 -0
new file mode 100644
index 0000000000..fac4a73afa
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# (C) Copyright 2019 BayLibre, SAS
+# Author: Neil Armstrong <[email protected]>
+
+obj-y	:= w400.o
board/amlogic/w400/README.odroid-n2 new file +130 -0

130 lines not on this page · raw message

board/amlogic/w400/README.w400 new file +130 -0

130 lines not on this page · raw message

board/amlogic/w400/w400.c new file +18 -0
new file mode 100644
index 0000000000..4737865367
@@ -0,0 +1,18 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2016 BayLibre, SAS
+ * Author: Neil Armstrong <[email protected]>
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <environment.h>
+#include <asm/io.h>
+#include <asm/arch/eth.h>
+
+int misc_init_r(void)
+{
+	meson_eth_init(PHY_INTERFACE_MODE_RGMII, 0);
+
+	return 0;
+}
configs/odroid-n2_defconfig new file +56 -0

56 lines not on this page · raw message

Signature · 1 line
2.22.0
#4 lore raw

cover amlogic: Add support for Odroid-N2

In reply to Neil Armstrong
Quoted 42 lines · Neil Armstrong

ODROID-N2 is a single board computer manufactured by Hardkernel Co. Ltd with the following specifications:

- Amlogic S922X ARM Cortex-A53 dual-core + Cortex-A73 quad-core SoC
- 4GB DDR4 SDRAM
- Gigabit Ethernet
- HDMI 2.1 4K/60Hz display
- 40-pin GPIO header
- 4 x USB 3.0 Host, 1 x USB OTG
- eMMC, microSD
- Infrared receiver

This patchset :
- adds the Odroid-N2 from Linux 5.3-rc1
- fixes 4GiB memory support
- adds board support

The board directory is W400, the name of the Amlogic Reference Design of Amlogic G12B with Gigabit boards, which will be used for similar boards.

Changes since v1:
- Fix typo in README.odroid-n2

Neil Armstrong (3):
ARM: dts: add support for Odroid-N2
ARM: meson-g12a: Handle 4GiB DRAM size
board: amlogic: add support for Odroid-N2

 arch/arm/dts/Makefile                         |   3 +-
 arch/arm/dts/meson-g12b-odroid-n2.dts         | 386 ++++++++++++++++++
 arch/arm/dts/meson-g12b.dtsi                  |  82 ++++
 arch/arm/mach-meson/board-g12a.c              |  13 +-
 board/amlogic/w400/MAINTAINERS                |   6 +
 board/amlogic/w400/Makefile                   |   6 +
 board/amlogic/w400/README.odroid-n2           | 130 ++++++
 board/amlogic/w400/README.w400                | 130 ++++++
 board/amlogic/w400/w400.c                     |  18 +
 configs/odroid-n2_defconfig                   |  56 +++
 .../dt-bindings/sound/meson-g12a-tohdmitx.h   |  13 +
 11 files changed, 836 insertions(+), 7 deletions(-)
 create mode 100644 arch/arm/dts/meson-g12b-odroid-n2.dts
Quoted 9 lines
 create mode 100644 arch/arm/dts/meson-g12b.dtsi
 create mode 100644 board/amlogic/w400/MAINTAINERS
 create mode 100644 board/amlogic/w400/Makefile
 create mode 100644 board/amlogic/w400/README.odroid-n2
 create mode 100644 board/amlogic/w400/README.w400
 create mode 100644 board/amlogic/w400/w400.c
 create mode 100644 configs/odroid-n2_defconfig
 create mode 100644 include/dt-bindings/sound/meson-g12a-tohdmitx.h

Applied on u-boot-amlogic

Neil

#5 lore raw

cover amlogic: Add support for Odroid-N2

Quoted 56 lines

From: Neil Armstrong <[email protected]>
Date: Wed, 31 Jul 2019 09:18:10 +0200

Quoted 42 lines · Neil Armstrong

ODROID-N2 is a single board computer manufactured by Hardkernel Co. Ltd with the following specifications:

- Amlogic S922X ARM Cortex-A53 dual-core + Cortex-A73 quad-core SoC
- 4GB DDR4 SDRAM
- Gigabit Ethernet
- HDMI 2.1 4K/60Hz display
- 40-pin GPIO header
- 4 x USB 3.0 Host, 1 x USB OTG
- eMMC, microSD
- Infrared receiver

This patchset :
- adds the Odroid-N2 from Linux 5.3-rc1
- fixes 4GiB memory support
- adds board support

The board directory is W400, the name of the Amlogic Reference Design of Amlogic G12B with Gigabit boards, which will be used for similar boards.

Changes since v1:
- Fix typo in README.odroid-n2

Neil Armstrong (3):
ARM: dts: add support for Odroid-N2
ARM: meson-g12a: Handle 4GiB DRAM size
board: amlogic: add support for Odroid-N2

 arch/arm/dts/Makefile                         |   3 +-
 arch/arm/dts/meson-g12b-odroid-n2.dts         | 386 ++++++++++++++++++
 arch/arm/dts/meson-g12b.dtsi                  |  82 ++++
 arch/arm/mach-meson/board-g12a.c              |  13 +-
 board/amlogic/w400/MAINTAINERS                |   6 +
 board/amlogic/w400/Makefile                   |   6 +
 board/amlogic/w400/README.odroid-n2           | 130 ++++++
 board/amlogic/w400/README.w400                | 130 ++++++
 board/amlogic/w400/w400.c                     |  18 +
 configs/odroid-n2_defconfig                   |  56 +++
 .../dt-bindings/sound/meson-g12a-tohdmitx.h   |  13 +
 11 files changed, 836 insertions(+), 7 deletions(-)
 create mode 100644 arch/arm/dts/meson-g12b-odroid-n2.dts
Quoted 9 lines
 create mode 100644 arch/arm/dts/meson-g12b.dtsi
 create mode 100644 board/amlogic/w400/MAINTAINERS
 create mode 100644 board/amlogic/w400/Makefile
 create mode 100644 board/amlogic/w400/README.odroid-n2
 create mode 100644 board/amlogic/w400/README.w400
 create mode 100644 board/amlogic/w400/w400.c
 create mode 100644 configs/odroid-n2_defconfig
 create mode 100644 include/dt-bindings/sound/meson-g12a-tohdmitx.h
Quoted 1 line

Applied on u-boot-amlogic

FWIW, this made it possible for me to finally build a U-Boot with UEFI support that can run the OpenBSD bootloader and kernel. Now I just need to finish writing the device drivers for the Amlogic-specific hardware blocks ;).

So, feel free to add:

if for some reason you need to respin the series

#6 lore raw

cover amlogic: Add support for Odroid-N2

Hi,

Quoted 63 lines · Mark Kettenis
Quoted 56 lines

From: Neil Armstrong <[email protected]>
Date: Wed, 31 Jul 2019 09:18:10 +0200

Quoted 42 lines · Neil Armstrong

ODROID-N2 is a single board computer manufactured by Hardkernel Co. Ltd with the following specifications:

- Amlogic S922X ARM Cortex-A53 dual-core + Cortex-A73 quad-core SoC
- 4GB DDR4 SDRAM
- Gigabit Ethernet
- HDMI 2.1 4K/60Hz display
- 40-pin GPIO header
- 4 x USB 3.0 Host, 1 x USB OTG
- eMMC, microSD
- Infrared receiver

This patchset :
- adds the Odroid-N2 from Linux 5.3-rc1
- fixes 4GiB memory support
- adds board support

The board directory is W400, the name of the Amlogic Reference Design of Amlogic G12B with Gigabit boards, which will be used for similar boards.

Changes since v1:
- Fix typo in README.odroid-n2

Neil Armstrong (3):
ARM: dts: add support for Odroid-N2
ARM: meson-g12a: Handle 4GiB DRAM size
board: amlogic: add support for Odroid-N2

 arch/arm/dts/Makefile                         |   3 +-
 arch/arm/dts/meson-g12b-odroid-n2.dts         | 386 ++++++++++++++++++
 arch/arm/dts/meson-g12b.dtsi                  |  82 ++++
 arch/arm/mach-meson/board-g12a.c              |  13 +-
 board/amlogic/w400/MAINTAINERS                |   6 +
 board/amlogic/w400/Makefile                   |   6 +
 board/amlogic/w400/README.odroid-n2           | 130 ++++++
 board/amlogic/w400/README.w400                | 130 ++++++
 board/amlogic/w400/w400.c                     |  18 +
 configs/odroid-n2_defconfig                   |  56 +++
 .../dt-bindings/sound/meson-g12a-tohdmitx.h   |  13 +
 11 files changed, 836 insertions(+), 7 deletions(-)
 create mode 100644 arch/arm/dts/meson-g12b-odroid-n2.dts
Quoted 9 lines
 create mode 100644 arch/arm/dts/meson-g12b.dtsi
 create mode 100644 board/amlogic/w400/MAINTAINERS
 create mode 100644 board/amlogic/w400/Makefile
 create mode 100644 board/amlogic/w400/README.odroid-n2
 create mode 100644 board/amlogic/w400/README.w400
 create mode 100644 board/amlogic/w400/w400.c
 create mode 100644 configs/odroid-n2_defconfig
 create mode 100644 include/dt-bindings/sound/meson-g12a-tohdmitx.h
Quoted 1 line

Applied on u-boot-amlogic

FWIW, this made it possible for me to finally build a U-Boot with UEFI support that can run the OpenBSD bootloader and kernel. Now I just need to finish writing the device drivers for the Amlogic-specific hardware blocks ;).

Quoted 6 lines

So, feel free to add:

if for some reason you need to respin the series

Nice, I haven't sent the PR, so I'll add it !

Thanks for testing !

Neil