Skip to contentSkip to conversation

Amlogic Meson cleanup for AXG SoC support

PATCH Superseded Neil Armstrong 3 participants 27 messages Nov 9, 2018 – Nov 21, 2018

Subsystems (8)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Amlogic Meson cleanup for AXG SoC support

This patchset will refactor the Amlogic Meson SoC support in order to easily add support for the Amlogic AXg SoC family, and later the G12x SoCs.

In order :
- Cleanup the mach-meson configs
- Move board support to reference design common boards
- Move board Kconfig into mach-meson
- Add AXG pinctrl & clock support
- Add AXG device tree and mach-meson support
- Add support for S400 reference design
- Do a final factorization of the code
- Add USB boot support in U-boot

At the end of the patches, the board code is lighter and we maintain only the reference designs, where each board will differ in the defconfig.

It will be simpler to add custom board support for future boards with more changes against the reference designs.

The complete AXG support depends on the :
- mmc: meson-gx: Add AXG compatible
- net: designware: add meson meson axg compatible
patches submitted to the U-Boot mailing list.

Jerome Brunet (12):
ARM: meson: clean-up platform selection
configs: meson: remove unnecessary MESON_FDTFILE_SETTING
board: amlogic: remove p212 derivatives
board: amlogic: factorise gxbb boards
ARM: rework amlogic configuration
configs: meson: change default load addresses
pinctrl: meson: rework gx pmx function
pinctrl: meson: select generic pinctrl
pinctrl: meson: add axg support
clk: meson: silence debug print
ARM: meson: rework soc arch file to prepare for new SoC
ARM: meson: factorize common code out amlogic's boards

Neil Armstrong (7):
board: amlogic: move khadas-vim2 as q200 ref board
clk: meson: add static to meson_gates table
ARM: meson: Add support for AXG family
ARM: dts: Sync Amlogic Meson AXG DT from Linux 4.20-rc1
clk: Add clock driver for AXG
board: amlogic: add support for S400 board
ARM: meson: Add boot device discovery

 arch/arm/dts/Makefile                              |    3 +-
 arch/arm/dts/meson-axg-s400.dts                    |  554 +++++++
 arch/arm/dts/meson-axg.dtsi                        | 1589 ++++++++++++++++++++
 arch/arm/include/asm/arch-meson/axg.h              |   52 +
 arch/arm/include/asm/arch-meson/boot.h             |   20 +
 arch/arm/include/asm/arch-meson/clock-axg.h        |  104 ++
 arch/arm/include/asm/arch-meson/clock-gx.h         |  117 ++
 arch/arm/include/asm/arch-meson/clock.h            |  117 --
 arch/arm/include/asm/arch-meson/eth.h              |    6 +-
 arch/arm/include/asm/arch-meson/gx.h               |    1 +
 arch/arm/include/asm/arch-meson/mem.h              |    3 +-
 arch/arm/mach-meson/Kconfig                        |  132 +-
 arch/arm/mach-meson/Makefile                       |    4 +-
 arch/arm/mach-meson/board-axg.c                    |  118 ++
 arch/arm/mach-meson/board-common.c                 |  118 ++
 arch/arm/mach-meson/board-gx.c                     |  138 ++
 arch/arm/mach-meson/board.c                        |  130 --
 arch/arm/mach-meson/eth.c                          |   53 -
 arch/arm/mach-meson/sm.c                           |    1 -
 board/amlogic/khadas-vim/Kconfig                   |   12 -
 board/amlogic/khadas-vim/MAINTAINERS               |    6 -
 board/amlogic/khadas-vim/Makefile                  |    6 -
 board/amlogic/khadas-vim/README                    |  102 --
 board/amlogic/khadas-vim/khadas-vim.c              |   57 -
 board/amlogic/khadas-vim2/Kconfig                  |   12 -
 board/amlogic/khadas-vim2/MAINTAINERS              |    6 -
 board/amlogic/khadas-vim2/Makefile                 |    6 -
 board/amlogic/khadas-vim2/README                   |  103 --
 board/amlogic/khadas-vim2/khadas-vim2.c            |   62 -
 board/amlogic/libretech-cc/Kconfig                 |   12 -
 board/amlogic/libretech-cc/MAINTAINERS             |    6 -
 board/amlogic/libretech-cc/Makefile                |    6 -
 board/amlogic/libretech-cc/README                  |  102 --
 board/amlogic/libretech-cc/libretech-cc.c          |   57 -
 board/amlogic/nanopi-k2/Kconfig                    |   12 -
 board/amlogic/nanopi-k2/MAINTAINERS                |    6 -
 board/amlogic/nanopi-k2/Makefile                   |    7 -
 board/amlogic/nanopi-k2/README                     |   99 --
 board/amlogic/nanopi-k2/nanopi-k2.c                |   55 -
 board/amlogic/odroid-c2/Kconfig                    |   12 -
 board/amlogic/odroid-c2/MAINTAINERS                |    1 +
 board/amlogic/odroid-c2/README                     |   66 -
 board/amlogic/odroid-c2/README.nanopi-k2           |   99 ++
 board/amlogic/odroid-c2/README.odroid-c2           |   66 +
 board/amlogic/odroid-c2/odroid-c2.c                |   16 +-
 board/amlogic/p212/Kconfig                         |   12 -
 board/amlogic/p212/README                          |  103 --
 board/amlogic/p212/README.khadas-vim               |  102 ++
 board/amlogic/p212/README.libretech-cc             |  102 ++
 board/amlogic/p212/README.p212                     |  103 ++
 board/amlogic/p212/p212.c                          |   16 +-
 board/amlogic/q200/MAINTAINERS                     |    6 +
 board/amlogic/q200/Makefile                        |    6 +
 board/amlogic/q200/README.khadas-vim2              |  103 ++
 board/amlogic/q200/README.q200                     |  102 ++
 board/amlogic/q200/q200.c                          |   50 +
 board/amlogic/s400/MAINTAINERS                     |    6 +
 board/amlogic/s400/Makefile                        |    6 +
 board/amlogic/s400/README                          |  110 ++
 board/amlogic/s400/s400.c                          |   21 +
 configs/khadas-vim2_defconfig                      |    1 -
 configs/khadas-vim_defconfig                       |    1 -
 configs/libretech-cc_defconfig                     |    1 -
 configs/nanopi-k2_defconfig                        |    2 -
 configs/odroid-c2_defconfig                        |    1 -
 configs/p212_defconfig                             |    1 -
 configs/s400_defconfig                             |   38 +
 drivers/clk/Makefile                               |    2 +-
 drivers/clk/clk_meson.c                            |    6 +-
 drivers/clk/clk_meson_axg.c                        |  316 ++++
 drivers/pinctrl/meson/Kconfig                      |   18 +-
 drivers/pinctrl/meson/Makefile                     |    3 +
 drivers/pinctrl/meson/pinctrl-meson-axg-pmx.c      |  125 ++
 drivers/pinctrl/meson/pinctrl-meson-axg.c          |  979 ++++++++++++
 drivers/pinctrl/meson/pinctrl-meson-axg.h          |   66 +
 drivers/pinctrl/meson/pinctrl-meson-gx-pmx.c       |   97 ++
 drivers/pinctrl/meson/pinctrl-meson-gx.h           |   48 +
 drivers/pinctrl/meson/pinctrl-meson-gxbb.c         |    6 +-
 drivers/pinctrl/meson/pinctrl-meson-gxl.c          |    6 +-
 drivers/pinctrl/meson/pinctrl-meson.c              |  109 +-
 drivers/pinctrl/meson/pinctrl-meson.h              |   37 +-
 include/configs/khadas-vim.h                       |   16 -
 include/configs/khadas-vim2.h                      |   18 -
 include/configs/libretech-cc.h                     |   16 -
 include/configs/meson-gx-common.h                  |   52 -
 include/configs/meson64.h                          |   73 +
 include/configs/nanopi-k2.h                        |   16 -
 include/configs/odroid-c2.h                        |   16 -
 include/configs/p212.h                             |   18 -
 include/dt-bindings/clock/axg-aoclkc.h             |   26 +
 include/dt-bindings/clock/axg-audio-clkc.h         |   94 ++
 include/dt-bindings/clock/axg-clkc.h               |   76 +
 include/dt-bindings/gpio/meson-axg-gpio.h          |  116 ++
 .../reset/amlogic,meson-axg-audio-arb.h            |   17 +
 .../dt-bindings/reset/amlogic,meson-axg-reset.h    |  124 ++
 include/dt-bindings/reset/axg-aoclkc.h             |   20 +
 96 files changed, 6038 insertions(+), 1625 deletions(-)
 create mode 100644 arch/arm/dts/meson-axg-s400.dts
 create mode 100644 arch/arm/dts/meson-axg.dtsi
 create mode 100644 arch/arm/include/asm/arch-meson/axg.h
 create mode 100644 arch/arm/include/asm/arch-meson/boot.h
 create mode 100644 arch/arm/include/asm/arch-meson/clock-axg.h
 create mode 100644 arch/arm/include/asm/arch-meson/clock-gx.h
 delete mode 100644 arch/arm/include/asm/arch-meson/clock.h
 create mode 100644 arch/arm/mach-meson/board-axg.c
 create mode 100644 arch/arm/mach-meson/board-common.c
 create mode 100644 arch/arm/mach-meson/board-gx.c
 delete mode 100644 arch/arm/mach-meson/board.c
 delete mode 100644 arch/arm/mach-meson/eth.c
 delete mode 100644 board/amlogic/khadas-vim/Kconfig
 delete mode 100644 board/amlogic/khadas-vim/MAINTAINERS
 delete mode 100644 board/amlogic/khadas-vim/Makefile
 delete mode 100644 board/amlogic/khadas-vim/README
 delete mode 100644 board/amlogic/khadas-vim/khadas-vim.c
 delete mode 100644 board/amlogic/khadas-vim2/Kconfig
 delete mode 100644 board/amlogic/khadas-vim2/MAINTAINERS
 delete mode 100644 board/amlogic/khadas-vim2/Makefile
 delete mode 100644 board/amlogic/khadas-vim2/README
 delete mode 100644 board/amlogic/khadas-vim2/khadas-vim2.c
 delete mode 100644 board/amlogic/libretech-cc/Kconfig
 delete mode 100644 board/amlogic/libretech-cc/MAINTAINERS
 delete mode 100644 board/amlogic/libretech-cc/Makefile
 delete mode 100644 board/amlogic/libretech-cc/README
 delete mode 100644 board/amlogic/libretech-cc/libretech-cc.c
 delete mode 100644 board/amlogic/nanopi-k2/Kconfig
 delete mode 100644 board/amlogic/nanopi-k2/MAINTAINERS
 delete mode 100644 board/amlogic/nanopi-k2/Makefile
 delete mode 100644 board/amlogic/nanopi-k2/README
 delete mode 100644 board/amlogic/nanopi-k2/nanopi-k2.c
 delete mode 100644 board/amlogic/odroid-c2/Kconfig
 delete mode 100644 board/amlogic/odroid-c2/README
 create mode 100644 board/amlogic/odroid-c2/README.nanopi-k2
 create mode 100644 board/amlogic/odroid-c2/README.odroid-c2
 delete mode 100644 board/amlogic/p212/Kconfig
 delete mode 100644 board/amlogic/p212/README
 create mode 100644 board/amlogic/p212/README.khadas-vim
 create mode 100644 board/amlogic/p212/README.libretech-cc
 create mode 100644 board/amlogic/p212/README.p212
 create mode 100644 board/amlogic/q200/MAINTAINERS
 create mode 100644 board/amlogic/q200/Makefile
 create mode 100644 board/amlogic/q200/README.khadas-vim2
 create mode 100644 board/amlogic/q200/README.q200
 create mode 100644 board/amlogic/q200/q200.c
 create mode 100644 board/amlogic/s400/MAINTAINERS
 create mode 100644 board/amlogic/s400/Makefile
 create mode 100644 board/amlogic/s400/README
 create mode 100644 board/amlogic/s400/s400.c
 create mode 100644 configs/s400_defconfig
 create mode 100644 drivers/clk/clk_meson_axg.c
 create mode 100644 drivers/pinctrl/meson/pinctrl-meson-axg-pmx.c
 create mode 100644 drivers/pinctrl/meson/pinctrl-meson-axg.c
 create mode 100644 drivers/pinctrl/meson/pinctrl-meson-axg.h
 create mode 100644 drivers/pinctrl/meson/pinctrl-meson-gx-pmx.c
 create mode 100644 drivers/pinctrl/meson/pinctrl-meson-gx.h
 delete mode 100644 include/configs/khadas-vim.h
 delete mode 100644 include/configs/khadas-vim2.h
 delete mode 100644 include/configs/libretech-cc.h
 delete mode 100644 include/configs/meson-gx-common.h
 create mode 100644 include/configs/meson64.h
 delete mode 100644 include/configs/nanopi-k2.h
 delete mode 100644 include/configs/odroid-c2.h
 delete mode 100644 include/configs/p212.h
 create mode 100644 include/dt-bindings/clock/axg-aoclkc.h
 create mode 100644 include/dt-bindings/clock/axg-audio-clkc.h
 create mode 100644 include/dt-bindings/clock/axg-clkc.h
 create mode 100644 include/dt-bindings/gpio/meson-axg-gpio.h
 create mode 100644 include/dt-bindings/reset/amlogic,meson-axg-audio-arb.h
 create mode 100644 include/dt-bindings/reset/amlogic,meson-axg-reset.h
 create mode 100644 include/dt-bindings/reset/axg-aoclkc.h
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/19 ARM: meson: clean-up platform selection

From: Jerome Brunet <[email protected]>

Even if multiple board are selected through Kconfig, u-boot will only compile one. This makes sense since compiling these targets will export global symbols, such as board_init()

The change rework amlogic Kconfig so only one board may be selected at a time

---
 arch/arm/mach-meson/Kconfig | 51 ++++++++++++++++++---------------------------
 1 file changed, 20 insertions(+), 31 deletions(-)
arch/arm/mach-meson/Kconfig +20 -31
index cc94344..bc0f6a1 100644
@@ -1,41 +1,32 @@
 if ARCH_MESON
 
-config MESON_GXBB
-	bool "Support Meson GXBaby"
+config MESON64_COMMON
+	bool
 	select ARM64
 	select CLK
 	select DM
 	select DM_SERIAL
 	imply CMD_DM
-	help
-	  The Amlogic Meson GXBaby (S905) is an ARM SoC with a
-	  quad-core Cortex-A53 CPU and a Mali-450 GPU.
+
+config MESON_GXBB
+	bool
+	select MESON64_COMMON
 
 config MESON_GXL
-	bool "Support Meson GXL"
-	select ARM64
-	select CLK
-	select DM
-	select DM_SERIAL
-	imply CMD_DM
-	help
-	  The Amlogic Meson GXL (S905X and S905D) is an ARM SoC with a
-	  quad-core Cortex-A53 CPU and a Mali-450 GPU.
+	bool
+	select MESON64_COMMON
 
 config MESON_GXM
-	bool "Support Meson GXM"
-	select ARM64
-	select CLK
-	select DM
-	select DM_SERIAL
-	help
-	  The Amlogic Meson GXM (S912) is an ARM SoC with an
-	  octo-core Cortex-A53 CPU and a Mali-T860 GPU.
+	bool
+	select MESON64_COMMON
 
-if MESON_GXBB
+choice
+	prompt "Platform select"
+	default TARGET_ODROID_C2
 
 config TARGET_ODROID_C2
 	bool "ODROID-C2"
+	select MESON_GXBB
 	help
 	  ODROID-C2 is a single board computer based on Meson GXBaby
 	  with 2 GiB of RAM, Gigabit Ethernet, HDMI, 4 USB, micro-SD
@@ -43,16 +34,15 @@ config TARGET_ODROID_C2
 
 config TARGET_NANOPI_K2
 	bool "NANOPI_K2"
+	select MESON_GXBB
 	help
 	  NANOPI_K2 is a single board computer based on Meson GXBaby
 	  with 2 GiB of RAM, Gigabit Ethernet,AP6212 Wifi, HDMI, 4 USB,
 	  micro-SD slot, eMMC, IR receiver and a 40-pin GPIO header.
-endif
-
-if MESON_GXL
 
 config TARGET_P212
 	bool "P212"
+	select MESON_GXL
 	help
 	  P212 is a reference dessign board based on Meson GXL S905X SoC
 	  with 2 GiB of RAM, Ethernet, HDMI, 2 USB, micro-SD slot,
@@ -60,6 +50,7 @@ config TARGET_P212
 
 config TARGET_LIBRETECH_CC
 	bool "LIBRETECH-CC"
+	select MESON_GXL
 	help
 	  LibreTech CC is a single board computer based on Meson GXL
 	  with 2 GiB of RAM, Ethernet, HDMI, 4 USB, micro-SD slot,
@@ -67,23 +58,21 @@ config TARGET_LIBRETECH_CC
 
 config TARGET_KHADAS_VIM
 	bool "KHADAS-VIM"
+	select MESON_GXL
 	help
 	  Khadas VIM is a single board computer based on Meson GXL
 	  with 2 GiB of RAM, Ethernet, HDMI, 4 USB, micro-SD slot,
 	  eMMC, IR receiver and a 40-pin GPIO header.
 
-endif
-
-if MESON_GXM
-
 config TARGET_KHADAS_VIM2
 	bool "KHADAS-VIM2"
+	select MESON_GXM
 	help
 	  Khadas VIM2 is a single board computer based on Meson GXM
 	  with 2/3 GiB of RAM, Ethernet, HDMI, 4 USB, micro-SD slot,
 	  eMMC, IR receiver and a 40-pin GPIO header.
 
-endif
+endchoice
 
 config SYS_SOC
 	default "meson"
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/19 configs: meson: remove unnecessary MESON_FDTFILE_SETTING

In reply to Neil Armstrong

From: Jerome Brunet <[email protected]>

MESON_FDTFILE_SETTING is used to define the default name of the fdt file in u-boot environment. We can easily derive it from CONFIG_DEFAULT_DEVICE_TREE instead. This will help factorize the code a bit

---
 include/configs/khadas-vim.h      | 2 --
 include/configs/libretech-cc.h    | 2 --
 include/configs/meson-gx-common.h | 2 +-
 include/configs/nanopi-k2.h       | 4 ----
 include/configs/odroid-c2.h       | 4 ----
 include/configs/p212.h            | 4 ----
 6 files changed, 1 insertion(+), 17 deletions(-)
include/configs/khadas-vim.h +0 -2
index 6615f77..ff87c02 100644
@@ -9,8 +9,6 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
-#define MESON_FDTFILE_SETTING "fdtfile=amlogic/meson-gxl-s905x-khadas-vim.dtb\0"
-
 #include <configs/meson-gx-common.h>
 
 #endif /* __CONFIG_H */
include/configs/libretech-cc.h +0 -2
index a0856f9..95e0f34 100644
@@ -9,8 +9,6 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
-#define MESON_FDTFILE_SETTING "fdtfile=amlogic/meson-gxl-s905x-libretech-cc.dtb\0"
-
 #include <configs/meson-gx-common.h>
 
 #endif /* __CONFIG_H */
include/configs/meson-gx-common.h +1 -1
index c46522e..c436976 100644
@@ -44,7 +44,7 @@
 	"kernel_addr_r=0x01080000\0" \
 	"pxefile_addr_r=0x01080000\0" \
 	"ramdisk_addr_r=0x13000000\0" \
-	MESON_FDTFILE_SETTING \
+	"fdtfile=amlogic/" CONFIG_DEFAULT_DEVICE_TREE ".dtb\0" \
 	BOOTENV
 
 #define CONFIG_SYS_BOOTM_LEN    (64 << 20)      /* 64 MiB */
include/configs/nanopi-k2.h +0 -4
index ef53f20..3fd6e8f 100644
@@ -7,10 +7,6 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
-/* Serial setup */
-
-#define MESON_FDTFILE_SETTING "fdtfile=amlogic/meson-gxbb-nanopi-k2.dtb\0"
-
 #include <configs/meson-gx-common.h>
 
 #endif /* __CONFIG_H */
include/configs/odroid-c2.h +0 -4
index d117b18..87e3ddb 100644
@@ -7,10 +7,6 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
-/* Serial setup */
-
-#define MESON_FDTFILE_SETTING "fdtfile=amlogic/meson-gxbb-odroidc2.dtb\0"
-
 #include <configs/meson-gx-common.h>
 
 #endif /* __CONFIG_H */
include/configs/p212.h +0 -4
index 2aa9f5d..4414293 100644
@@ -9,10 +9,6 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
-/* Serial setup */
-
-#define MESON_FDTFILE_SETTING "fdtfile=amlogic/meson-gxl-s905x-p212.dtb\0"
-
 #include <configs/meson-gx-common.h>
 
 #endif /* __CONFIG_H */
Signature · 1 line
2.7.4
#3 lore raw

PATCH 3/19 board: amlogic: remove p212 derivatives

In reply to Neil Armstrong

From: Jerome Brunet <[email protected]>

The Khadas vim and the libretech aml-s905x-cc (aka Potato) derive from amlogic s905x reference design (P212).

All the code in these board is a copy/paste from the p212, which is tedious to maintain. This change use p212 u-boot board for all these boards, while keeping a dedicated defconfig to customize the names and device tree.

---
 arch/arm/mach-meson/Kconfig               |  22 +------
 board/amlogic/khadas-vim/Kconfig          |  12 ----
 board/amlogic/khadas-vim/MAINTAINERS      |   6 --
 board/amlogic/khadas-vim/Makefile         |   6 --
 board/amlogic/khadas-vim/README           | 102 -----------------------------
 board/amlogic/khadas-vim/khadas-vim.c     |  57 -----------------
 board/amlogic/libretech-cc/Kconfig        |  12 ----
 board/amlogic/libretech-cc/MAINTAINERS    |   6 --
 board/amlogic/libretech-cc/Makefile       |   6 --
 board/amlogic/libretech-cc/README         | 102 -----------------------------
 board/amlogic/libretech-cc/libretech-cc.c |  57 -----------------
 board/amlogic/p212/README                 | 103 ------------------------------
 board/amlogic/p212/README.khadas-vim      | 102 +++++++++++++++++++++++++++++
 board/amlogic/p212/README.libretech-cc    | 102 +++++++++++++++++++++++++++++
 board/amlogic/p212/README.p212            | 103 ++++++++++++++++++++++++++++++
 configs/khadas-vim_defconfig              |   2 +-
 configs/libretech-cc_defconfig            |   2 +-
 17 files changed, 311 insertions(+), 491 deletions(-)
 delete mode 100644 board/amlogic/khadas-vim/Kconfig
 delete mode 100644 board/amlogic/khadas-vim/MAINTAINERS
 delete mode 100644 board/amlogic/khadas-vim/Makefile
 delete mode 100644 board/amlogic/khadas-vim/README
 delete mode 100644 board/amlogic/khadas-vim/khadas-vim.c
 delete mode 100644 board/amlogic/libretech-cc/Kconfig
 delete mode 100644 board/amlogic/libretech-cc/MAINTAINERS
 delete mode 100644 board/amlogic/libretech-cc/Makefile
 delete mode 100644 board/amlogic/libretech-cc/README
 delete mode 100644 board/amlogic/libretech-cc/libretech-cc.c
 delete mode 100644 board/amlogic/p212/README
 create mode 100644 board/amlogic/p212/README.khadas-vim
 create mode 100644 board/amlogic/p212/README.libretech-cc
 create mode 100644 board/amlogic/p212/README.p212
arch/arm/mach-meson/Kconfig +2 -20
index bc0f6a1..e0b2812 100644
@@ -47,22 +47,8 @@ config TARGET_P212
 	  P212 is a reference dessign board based on Meson GXL S905X SoC
 	  with 2 GiB of RAM, Ethernet, HDMI, 2 USB, micro-SD slot,
 	  eMMC, IR receiver, CVBS+Audio jack and a SDIO WiFi module.
-
-config TARGET_LIBRETECH_CC
-	bool "LIBRETECH-CC"
-	select MESON_GXL
-	help
-	  LibreTech CC is a single board computer based on Meson GXL
-	  with 2 GiB of RAM, Ethernet, HDMI, 4 USB, micro-SD slot,
-	  eMMC, IR receiver and a 40-pin GPIO header.
-
-config TARGET_KHADAS_VIM
-	bool "KHADAS-VIM"
-	select MESON_GXL
-	help
-	  Khadas VIM is a single board computer based on Meson GXL
-	  with 2 GiB of RAM, Ethernet, HDMI, 4 USB, micro-SD slot,
-	  eMMC, IR receiver and a 40-pin GPIO header.
+	  You should also select this TARGET if you have Khadas Vim or
+	  a libretech aml-s905x-cc
 
 config TARGET_KHADAS_VIM2
 	bool "KHADAS-VIM2"
@@ -86,10 +72,6 @@ source "board/amlogic/nanopi-k2/Kconfig"
 
 source "board/amlogic/p212/Kconfig"
 
-source "board/amlogic/libretech-cc/Kconfig"
-
-source "board/amlogic/khadas-vim/Kconfig"
-
 source "board/amlogic/khadas-vim2/Kconfig"
 
 endif
board/amlogic/khadas-vim/Kconfig deleted +0 -12
deleted file mode 100644
index 0fa8db9..0000000
@@ -1,12 +0,0 @@
-if TARGET_KHADAS_VIM
-
-config SYS_BOARD
-	default "khadas-vim"
-
-config SYS_VENDOR
-	default "amlogic"
-
-config SYS_CONFIG_NAME
-	default "khadas-vim"
-
-endif
board/amlogic/khadas-vim/MAINTAINERS deleted +0 -6
deleted file mode 100644
index 024220a..0000000
@@ -1,6 +0,0 @@
-KHADAS-VIM
-M:	Neil Armstrong <[email protected]>
-S:	Maintained
-F:	board/amlogic/khadas-vim/
-F:	include/configs/khadas-vim.h
-F:	configs/khadas-vim_defconfig
board/amlogic/khadas-vim/Makefile deleted +0 -6
deleted file mode 100644
index 558c076..0000000
@@ -1,6 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0+
-#
-# (C) Copyright 2016 BayLibre, SAS
-# Author: Neil Armstrong <[email protected]>
-
-obj-y	:= khadas-vim.o
board/amlogic/khadas-vim/README deleted +0 -102

102 lines not on this page · raw message

board/amlogic/khadas-vim/khadas-vim.c deleted +0 -57

57 lines not on this page · raw message

board/amlogic/libretech-cc/Kconfig deleted +0 -12
deleted file mode 100644
index 7a6f916..0000000
@@ -1,12 +0,0 @@
-if TARGET_LIBRETECH_CC
-
-config SYS_BOARD
-	default "libretech-cc"
-
-config SYS_VENDOR
-	default "amlogic"
-
-config SYS_CONFIG_NAME
-	default "libretech-cc"
-
-endif
board/amlogic/libretech-cc/MAINTAINERS deleted +0 -6
deleted file mode 100644
index 398ce57..0000000
@@ -1,6 +0,0 @@
-LIBRETECH-CC
-M:	Neil Armstrong <[email protected]>
-S:	Maintained
-F:	board/amlogic/libretech-cc/
-F:	include/configs/libretech-cc.h
-F:	configs/libretech-cc_defconfig
board/amlogic/libretech-cc/Makefile deleted +0 -6
deleted file mode 100644
index 3b0adf8..0000000
@@ -1,6 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0+
-#
-# (C) Copyright 2016 BayLibre, SAS
-# Author: Neil Armstrong <[email protected]>
-
-obj-y	:= libretech-cc.o
board/amlogic/libretech-cc/README deleted +0 -102

102 lines not on this page · raw message

board/amlogic/libretech-cc/libretech-cc.c deleted +0 -57

57 lines not on this page · raw message

board/amlogic/p212/README deleted +0 -103

103 lines not on this page · raw message

board/amlogic/p212/README.khadas-vim new file +102 -0

102 lines not on this page · raw message

board/amlogic/p212/README.libretech-cc new file +102 -0

102 lines not on this page · raw message

board/amlogic/p212/README.p212 new file +103 -0

103 lines not on this page · raw message

configs/khadas-vim_defconfig +1 -1
index 0c89d9a..af30113 100644
@@ -2,7 +2,7 @@ CONFIG_ARM=y
 CONFIG_ARCH_MESON=y
 CONFIG_SYS_TEXT_BASE=0x01000000
 CONFIG_MESON_GXL=y
-CONFIG_TARGET_KHADAS_VIM=y
+CONFIG_TARGET_P212=y
 CONFIG_DEBUG_UART_BASE=0xc81004c0
 CONFIG_DEBUG_UART_CLOCK=24000000
 CONFIG_IDENT_STRING=" khadas-vim"
configs/libretech-cc_defconfig +1 -1
index 36d117c..7526516 100644
@@ -2,7 +2,7 @@ CONFIG_ARM=y
 CONFIG_ARCH_MESON=y
 CONFIG_SYS_TEXT_BASE=0x01000000
 CONFIG_MESON_GXL=y
-CONFIG_TARGET_LIBRETECH_CC=y
+CONFIG_TARGET_P212=y
 CONFIG_DEBUG_UART_BASE=0xc81004c0
 CONFIG_DEBUG_UART_CLOCK=24000000
 CONFIG_IDENT_STRING=" libretech-cc"
Signature · 1 line
2.7.4
#4 lore raw

PATCH 4/19 board: amlogic: move khadas-vim2 as q200 ref board

In reply to Neil Armstrong

The Khadas vim2 derive from amlogic s912 reference design (Q200).

This patch moves the khadas-vim2 board support to a generic Q200 board, while keeping a dedicated defconfig to customize the names and device tree.

---
 arch/arm/mach-meson/Kconfig             |   9 +--
 board/amlogic/khadas-vim2/Kconfig       |  12 ----
 board/amlogic/khadas-vim2/MAINTAINERS   |   6 --
 board/amlogic/khadas-vim2/Makefile      |   6 --
 board/amlogic/khadas-vim2/README        | 103 --------------------------------
 board/amlogic/khadas-vim2/khadas-vim2.c |  62 -------------------
 board/amlogic/q200/Kconfig              |  12 ++++
 board/amlogic/q200/MAINTAINERS          |   6 ++
 board/amlogic/q200/Makefile             |   6 ++
 board/amlogic/q200/README.khadas-vim2   | 103 ++++++++++++++++++++++++++++++++
 board/amlogic/q200/README.q200          | 102 +++++++++++++++++++++++++++++++
 board/amlogic/q200/q200.c               |  62 +++++++++++++++++++
 configs/khadas-vim2_defconfig           |   2 +-
 include/configs/khadas-vim2.h           |  18 ------
 include/configs/q200.h                  |  18 ++++++
 15 files changed, 315 insertions(+), 212 deletions(-)
 delete mode 100644 board/amlogic/khadas-vim2/Kconfig
 delete mode 100644 board/amlogic/khadas-vim2/MAINTAINERS
 delete mode 100644 board/amlogic/khadas-vim2/Makefile
 delete mode 100644 board/amlogic/khadas-vim2/README
 delete mode 100644 board/amlogic/khadas-vim2/khadas-vim2.c
 create mode 100644 board/amlogic/q200/Kconfig
 create mode 100644 board/amlogic/q200/MAINTAINERS
 create mode 100644 board/amlogic/q200/Makefile
 create mode 100644 board/amlogic/q200/README.khadas-vim2
 create mode 100644 board/amlogic/q200/README.q200
 create mode 100644 board/amlogic/q200/q200.c
 delete mode 100644 include/configs/khadas-vim2.h
 create mode 100644 include/configs/q200.h
arch/arm/mach-meson/Kconfig +5 -4
index e0b2812..98303db 100644
@@ -50,13 +50,14 @@ config TARGET_P212
 	  You should also select this TARGET if you have Khadas Vim or
 	  a libretech aml-s905x-cc
 
-config TARGET_KHADAS_VIM2
+config TARGET_Q200
 	bool "KHADAS-VIM2"
 	select MESON_GXM
 	help
-	  Khadas VIM2 is a single board computer based on Meson GXM
+	  Q200 is a reference dessign board based on Meson GXM
 	  with 2/3 GiB of RAM, Ethernet, HDMI, 4 USB, micro-SD slot,
-	  eMMC, IR receiver and a 40-pin GPIO header.
+	  eMMC, IR receiver.
+	  You should also select this TARGET if you have Khadas Vim2.
 
 endchoice
 
@@ -72,6 +73,6 @@ source "board/amlogic/nanopi-k2/Kconfig"
 
 source "board/amlogic/p212/Kconfig"
 
-source "board/amlogic/khadas-vim2/Kconfig"
+source "board/amlogic/q200/Kconfig"
 
 endif
board/amlogic/khadas-vim2/Kconfig deleted +0 -12
deleted file mode 100644
index d0af362..0000000
@@ -1,12 +0,0 @@
-if TARGET_KHADAS_VIM2
-
-config SYS_BOARD
-	default "khadas-vim2"
-
-config SYS_VENDOR
-	default "amlogic"
-
-config SYS_CONFIG_NAME
-	default "khadas-vim2"
-
-endif
board/amlogic/khadas-vim2/MAINTAINERS deleted +0 -6
deleted file mode 100644
index ca63e31..0000000
@@ -1,6 +0,0 @@
-KHADAS-VIM2
-M:	Neil Armstrong <[email protected]>
-S:	Maintained
-F:	board/amlogic/khadas-vim2/
-F:	include/configs/khadas-vim2.h
-F:	configs/khadas-vim2_defconfig
board/amlogic/khadas-vim2/Makefile deleted +0 -6
deleted file mode 100644
index 4e7c9a0..0000000
@@ -1,6 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0+
-#
-# (C) Copyright 2016 BayLibre, SAS
-# Author: Neil Armstrong <[email protected]>
-
-obj-y	:= khadas-vim2.o
board/amlogic/khadas-vim2/README deleted +0 -103

103 lines not on this page · raw message

board/amlogic/khadas-vim2/khadas-vim2.c deleted +0 -62

62 lines not on this page · raw message

board/amlogic/q200/Kconfig new file +12 -0
new file mode 100644
index 0000000..cfaf379
@@ -0,0 +1,12 @@
+if TARGET_Q200
+
+config SYS_BOARD
+	default "q200"
+
+config SYS_VENDOR
+	default "amlogic"
+
+config SYS_CONFIG_NAME
+	default "q200"
+
+endif
board/amlogic/q200/MAINTAINERS new file +6 -0
new file mode 100644
index 0000000..be86386
@@ -0,0 +1,6 @@
+Q200
+M:	Neil Armstrong <[email protected]>
+S:	Maintained
+F:	board/amlogic/q200/
+F:	include/configs/q200.h
+F:	configs/khadas-vim2_defconfig
board/amlogic/q200/Makefile new file +6 -0
new file mode 100644
index 0000000..fd78fd0
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# (C) Copyright 2016 BayLibre, SAS
+# Author: Neil Armstrong <[email protected]>
+
+obj-y	:= q200.o
board/amlogic/q200/README.khadas-vim2 new file +103 -0

103 lines not on this page · raw message

board/amlogic/q200/README.q200 new file +102 -0

102 lines not on this page · raw message

board/amlogic/q200/q200.c new file +62 -0

62 lines not on this page · raw message

configs/khadas-vim2_defconfig +1 -1
index f21e3a8..387d7da 100644
@@ -2,7 +2,7 @@ CONFIG_ARM=y
 CONFIG_ARCH_MESON=y
 CONFIG_SYS_TEXT_BASE=0x01000000
 CONFIG_MESON_GXM=y
-CONFIG_TARGET_KHADAS_VIM2=y
+CONFIG_TARGET_Q200=y
 CONFIG_DEBUG_UART_BASE=0xc81004c0
 CONFIG_DEBUG_UART_CLOCK=24000000
 CONFIG_IDENT_STRING=" khadas-vim2"
include/configs/khadas-vim2.h deleted +0 -18
deleted file mode 100644
index 7ef8f42..0000000
@@ -1,18 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * Configuration for Khadas VIM2
- *
- * Copyright (C) 2017 Baylibre, SAS
- * Author: Neil Armstrong <[email protected]>
- */
-
-#ifndef __CONFIG_H
-#define __CONFIG_H
-
-#define CONFIG_MISC_INIT_R
-
-#define MESON_FDTFILE_SETTING "fdtfile=amlogic/meson-gxm-khadas-vim2.dtb\0"
-
-#include <configs/meson-gx-common.h>
-
-#endif /* __CONFIG_H */
include/configs/q200.h new file +18 -0
new file mode 100644
index 0000000..7ef8f42
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Configuration for Khadas VIM2
+ *
+ * Copyright (C) 2017 Baylibre, SAS
+ * Author: Neil Armstrong <[email protected]>
+ */
+
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+#define CONFIG_MISC_INIT_R
+
+#define MESON_FDTFILE_SETTING "fdtfile=amlogic/meson-gxm-khadas-vim2.dtb\0"
+
+#include <configs/meson-gx-common.h>
+
+#endif /* __CONFIG_H */
Signature · 1 line
2.7.4
#5 lore raw

PATCH 5/19 board: amlogic: factorise gxbb boards

In reply to Neil Armstrong

From: Jerome Brunet <[email protected]>

The nanopi-k2 and the odroid-c2 are similar enough to be supported by the same u-boot board. This change use odroid-c2 u-boot board for the nanopi-k2 as well. Dedicated defconfig are kept to customize the names and device tree.

---
 arch/arm/mach-meson/Kconfig              | 11 +---
 board/amlogic/nanopi-k2/Kconfig          | 12 ----
 board/amlogic/nanopi-k2/MAINTAINERS      |  6 --
 board/amlogic/nanopi-k2/Makefile         |  7 ---
 board/amlogic/nanopi-k2/README           | 99 --------------------------------
 board/amlogic/nanopi-k2/nanopi-k2.c      | 55 ------------------
 board/amlogic/odroid-c2/MAINTAINERS      |  1 +
 board/amlogic/odroid-c2/README           | 66 ---------------------
 board/amlogic/odroid-c2/README.nanopi-k2 | 99 ++++++++++++++++++++++++++++++++
 board/amlogic/odroid-c2/README.odroid-c2 | 66 +++++++++++++++++++++
 configs/nanopi-k2_defconfig              |  2 +-
 11 files changed, 168 insertions(+), 256 deletions(-)
 delete mode 100644 board/amlogic/nanopi-k2/Kconfig
 delete mode 100644 board/amlogic/nanopi-k2/MAINTAINERS
 delete mode 100644 board/amlogic/nanopi-k2/Makefile
 delete mode 100644 board/amlogic/nanopi-k2/README
 delete mode 100644 board/amlogic/nanopi-k2/nanopi-k2.c
 delete mode 100644 board/amlogic/odroid-c2/README
 create mode 100644 board/amlogic/odroid-c2/README.nanopi-k2
 create mode 100644 board/amlogic/odroid-c2/README.odroid-c2
arch/arm/mach-meson/Kconfig +1 -10
index 98303db..d86b1be 100644
@@ -31,14 +31,7 @@ config TARGET_ODROID_C2
 	  ODROID-C2 is a single board computer based on Meson GXBaby
 	  with 2 GiB of RAM, Gigabit Ethernet, HDMI, 4 USB, micro-SD
 	  slot, eMMC, IR receiver and a 40-pin GPIO header.
-
-config TARGET_NANOPI_K2
-	bool "NANOPI_K2"
-	select MESON_GXBB
-	help
-	  NANOPI_K2 is a single board computer based on Meson GXBaby
-	  with 2 GiB of RAM, Gigabit Ethernet,AP6212 Wifi, HDMI, 4 USB,
-	  micro-SD slot, eMMC, IR receiver and a 40-pin GPIO header.
+	  You should also select this TARGET if you have an nanopi-k2
 
 config TARGET_P212
 	bool "P212"
@@ -69,8 +62,6 @@ config SYS_MALLOC_F_LEN
 
 source "board/amlogic/odroid-c2/Kconfig"
 
-source "board/amlogic/nanopi-k2/Kconfig"
-
 source "board/amlogic/p212/Kconfig"
 
 source "board/amlogic/q200/Kconfig"
board/amlogic/nanopi-k2/Kconfig deleted +0 -12
deleted file mode 100644
index 374bda2..0000000
@@ -1,12 +0,0 @@
-if TARGET_NANOPI_K2
-
-config SYS_BOARD
-	default "nanopi-k2"
-
-config SYS_VENDOR
-	default "amlogic"
-
-config SYS_CONFIG_NAME
-	default "nanopi-k2"
-
-endif
board/amlogic/nanopi-k2/MAINTAINERS deleted +0 -6
deleted file mode 100644
index 0452bd1..0000000
@@ -1,6 +0,0 @@
-NANOPI-K2
-M:	Neil Armstrong <[email protected]>
-S:	Maintained
-F:	board/amlogic/nanopi-k2/
-F:	include/configs/nanopi-k2.h
-F:	configs/nanopi-k2_defconfig
board/amlogic/nanopi-k2/Makefile deleted +0 -7
deleted file mode 100644
index 7d9b666..0000000
@@ -1,7 +0,0 @@
-#
-# (C) Copyright 2018 Thomas McKahan
-#
-# SPDX-License-Identifier:	GPL-2.0+
-#
-
-obj-y	:= nanopi-k2.o
board/amlogic/nanopi-k2/README deleted +0 -99

99 lines not on this page · raw message

board/amlogic/nanopi-k2/nanopi-k2.c deleted +0 -55

55 lines not on this page · raw message

board/amlogic/odroid-c2/MAINTAINERS +1 -0
index 699850f..fd74d53 100644
@@ -1,5 +1,6 @@
 ODROID-C2
 M:	Beniamino Galvani <[email protected]>
+M:	Neil Armstrong <[email protected]>
 S:	Maintained
 F:	board/amlogic/odroid-c2/
 F:	include/configs/odroid-c2.h
board/amlogic/odroid-c2/README deleted +0 -66

66 lines not on this page · raw message

board/amlogic/odroid-c2/README.nanopi-k2 new file +99 -0

99 lines not on this page · raw message

board/amlogic/odroid-c2/README.odroid-c2 new file +66 -0

66 lines not on this page · raw message

configs/nanopi-k2_defconfig +1 -1
index 5c8c747..01196d6 100644
@@ -2,7 +2,7 @@ CONFIG_ARM=y
 CONFIG_ARCH_MESON=y
 CONFIG_SYS_TEXT_BASE=0x01000000
 CONFIG_MESON_GXBB=y
-CONFIG_TARGET_NANOPI_K2=y
+CONFIG_TARGET_ODROID_C2=y
 CONFIG_DEBUG_UART_BASE=0xc81004c0
 CONFIG_DEBUG_UART_CLOCK=24000000
 CONFIG_IDENT_STRING=" nanopi-k2"
Signature · 1 line
2.7.4
#6 lore raw

PATCH 6/19 ARM: rework amlogic configuration

In reply to Neil Armstrong

From: Jerome Brunet <[email protected]>

Rework the board SYS_BOARD, SYS_VENDOR and SYS_CONFIG_NAME setup by moving the board Kconfig into the mach-meson Kconfig to make it easier to add new boards for a SoC architecture and add a custom config header or custom board handler for a platform.

This drops the board CONFIGs and the duplicate boards configs headers in favor of a single meson64.h config header.

---
 arch/arm/mach-meson/Kconfig       | 75 +++++++++++++++++++--------------------
 board/amlogic/odroid-c2/Kconfig   | 12 -------
 board/amlogic/p212/Kconfig        | 12 -------
 board/amlogic/q200/Kconfig        | 12 -------
 configs/khadas-vim2_defconfig     |  1 -
 configs/khadas-vim_defconfig      |  1 -
 configs/libretech-cc_defconfig    |  1 -
 configs/nanopi-k2_defconfig       |  2 --
 configs/odroid-c2_defconfig       |  1 -
 configs/p212_defconfig            |  1 -
 include/configs/khadas-vim.h      | 14 --------
 include/configs/libretech-cc.h    | 14 --------
 include/configs/meson-gx-common.h | 52 ---------------------------
 include/configs/meson64.h         | 55 ++++++++++++++++++++++++++++
 include/configs/nanopi-k2.h       | 12 -------
 include/configs/odroid-c2.h       | 12 -------
 include/configs/p212.h            | 14 --------
 include/configs/q200.h            | 18 ----------
 18 files changed, 92 insertions(+), 217 deletions(-)
 delete mode 100644 board/amlogic/odroid-c2/Kconfig
 delete mode 100644 board/amlogic/p212/Kconfig
 delete mode 100644 board/amlogic/q200/Kconfig
 delete mode 100644 include/configs/khadas-vim.h
 delete mode 100644 include/configs/libretech-cc.h
 delete mode 100644 include/configs/meson-gx-common.h
 create mode 100644 include/configs/meson64.h
 delete mode 100644 include/configs/nanopi-k2.h
 delete mode 100644 include/configs/odroid-c2.h
 delete mode 100644 include/configs/p212.h
 delete mode 100644 include/configs/q200.h
arch/arm/mach-meson/Kconfig +37 -38
index d86b1be..6f60167 100644
@@ -8,49 +8,27 @@ config MESON64_COMMON
 	select DM_SERIAL
 	imply CMD_DM
 
-config MESON_GXBB
-	bool
-	select MESON64_COMMON
-
-config MESON_GXL
-	bool
-	select MESON64_COMMON
-
-config MESON_GXM
-	bool
-	select MESON64_COMMON
-
 choice
 	prompt "Platform select"
-	default TARGET_ODROID_C2
+	default MESON_GXBB
 
-config TARGET_ODROID_C2
-	bool "ODROID-C2"
-	select MESON_GXBB
+config MESON_GXBB
+	bool "GXBB"
+	select MESON64_COMMON
 	help
-	  ODROID-C2 is a single board computer based on Meson GXBaby
-	  with 2 GiB of RAM, Gigabit Ethernet, HDMI, 4 USB, micro-SD
-	  slot, eMMC, IR receiver and a 40-pin GPIO header.
-	  You should also select this TARGET if you have an nanopi-k2
+	  Select this if your SoC is an S905
 
-config TARGET_P212
-	bool "P212"
-	select MESON_GXL
+config MESON_GXL
+	bool "GXL"
+	select MESON64_COMMON
 	help
-	  P212 is a reference dessign board based on Meson GXL S905X SoC
-	  with 2 GiB of RAM, Ethernet, HDMI, 2 USB, micro-SD slot,
-	  eMMC, IR receiver, CVBS+Audio jack and a SDIO WiFi module.
-	  You should also select this TARGET if you have Khadas Vim or
-	  a libretech aml-s905x-cc
+	  Select this if your SoC is an S905X/D or S805X
 
-config TARGET_Q200
-	bool "KHADAS-VIM2"
-	select MESON_GXM
+config MESON_GXM
+	bool "GXM"
+	select MESON64_COMMON
 	help
-	  Q200 is a reference dessign board based on Meson GXM
-	  with 2/3 GiB of RAM, Ethernet, HDMI, 4 USB, micro-SD slot,
-	  eMMC, IR receiver.
-	  You should also select this TARGET if you have Khadas Vim2.
+	  Select this if your SoC is an S912
 
 endchoice
 
@@ -60,10 +38,31 @@ config SYS_SOC
 config SYS_MALLOC_F_LEN
 	default 0x1000
 
-source "board/amlogic/odroid-c2/Kconfig"
+config SYS_VENDOR
+	string "Vendor name"
+	default "amlogic"
+	help
+	  This option contains information about board name.
+	  Based on this option board/<CONFIG_SYS_VENDOR>/<CONFIG_SYS_BOARD> will
+	  be used.
 
-source "board/amlogic/p212/Kconfig"
+config SYS_BOARD
+	string "Board name"
+	default "odroid-c2" if MESON_GXBB
+	default "p212" if MESON_GXL
+	default "q200" if MESON_GXM
+	default ""
+	help
+	  This option contains information about board name.
+	  Based on this option board/<CONFIG_SYS_VENDOR>/<CONFIG_SYS_BOARD> will
+	  be used.
 
-source "board/amlogic/q200/Kconfig"
+config SYS_CONFIG_NAME
+	string "Board configuration name"
+	default "meson64"
+	help
+	  This option contains information about board configuration name.
+	  Based on this option include/configs/<CONFIG_SYS_CONFIG_NAME>.h header
+	  will be used for board configuration.
 
 endif
board/amlogic/odroid-c2/Kconfig deleted +0 -12
deleted file mode 100644
index 2b16889..0000000
@@ -1,12 +0,0 @@
-if TARGET_ODROID_C2
-
-config SYS_BOARD
-	default "odroid-c2"
-
-config SYS_VENDOR
-	default "amlogic"
-
-config SYS_CONFIG_NAME
-	default "odroid-c2"
-
-endif
board/amlogic/p212/Kconfig deleted +0 -12
deleted file mode 100644
index 720c92b..0000000
@@ -1,12 +0,0 @@
-if TARGET_P212
-
-config SYS_BOARD
-	default "p212"
-
-config SYS_VENDOR
-	default "amlogic"
-
-config SYS_CONFIG_NAME
-	default "p212"
-
-endif
board/amlogic/q200/Kconfig deleted +0 -12
deleted file mode 100644
index cfaf379..0000000
@@ -1,12 +0,0 @@
-if TARGET_Q200
-
-config SYS_BOARD
-	default "q200"
-
-config SYS_VENDOR
-	default "amlogic"
-
-config SYS_CONFIG_NAME
-	default "q200"
-
-endif
configs/khadas-vim2_defconfig +0 -1
index 387d7da..40e7cac 100644
@@ -2,7 +2,6 @@ CONFIG_ARM=y
 CONFIG_ARCH_MESON=y
 CONFIG_SYS_TEXT_BASE=0x01000000
 CONFIG_MESON_GXM=y
-CONFIG_TARGET_Q200=y
 CONFIG_DEBUG_UART_BASE=0xc81004c0
 CONFIG_DEBUG_UART_CLOCK=24000000
 CONFIG_IDENT_STRING=" khadas-vim2"
configs/khadas-vim_defconfig +0 -1
index af30113..6e855dd 100644
@@ -2,7 +2,6 @@ CONFIG_ARM=y
 CONFIG_ARCH_MESON=y
 CONFIG_SYS_TEXT_BASE=0x01000000
 CONFIG_MESON_GXL=y
-CONFIG_TARGET_P212=y
 CONFIG_DEBUG_UART_BASE=0xc81004c0
 CONFIG_DEBUG_UART_CLOCK=24000000
 CONFIG_IDENT_STRING=" khadas-vim"
configs/libretech-cc_defconfig +0 -1
index 7526516..c2f985f 100644
@@ -2,7 +2,6 @@ CONFIG_ARM=y
 CONFIG_ARCH_MESON=y
 CONFIG_SYS_TEXT_BASE=0x01000000
 CONFIG_MESON_GXL=y
-CONFIG_TARGET_P212=y
 CONFIG_DEBUG_UART_BASE=0xc81004c0
 CONFIG_DEBUG_UART_CLOCK=24000000
 CONFIG_IDENT_STRING=" libretech-cc"
configs/nanopi-k2_defconfig +0 -2
index 01196d6..8bbf48f 100644
@@ -1,8 +1,6 @@
 CONFIG_ARM=y
 CONFIG_ARCH_MESON=y
 CONFIG_SYS_TEXT_BASE=0x01000000
-CONFIG_MESON_GXBB=y
-CONFIG_TARGET_ODROID_C2=y
 CONFIG_DEBUG_UART_BASE=0xc81004c0
 CONFIG_DEBUG_UART_CLOCK=24000000
 CONFIG_IDENT_STRING=" nanopi-k2"
configs/odroid-c2_defconfig +0 -1
index 19196b3..68554ba 100644
@@ -2,7 +2,6 @@ CONFIG_ARM=y
 CONFIG_ARCH_MESON=y
 CONFIG_SYS_TEXT_BASE=0x01000000
 CONFIG_MESON_GXBB=y
-CONFIG_TARGET_ODROID_C2=y
 CONFIG_DEBUG_UART_BASE=0xc81004c0
 CONFIG_DEBUG_UART_CLOCK=24000000
 CONFIG_IDENT_STRING=" odroid-c2"
configs/p212_defconfig +0 -1
index 9e3b1d6..a15064d 100644
@@ -2,7 +2,6 @@ CONFIG_ARM=y
 CONFIG_ARCH_MESON=y
 CONFIG_SYS_TEXT_BASE=0x01000000
 CONFIG_MESON_GXL=y
-CONFIG_TARGET_P212=y
 CONFIG_DEBUG_UART_BASE=0xc81004c0
 CONFIG_DEBUG_UART_CLOCK=24000000
 CONFIG_IDENT_STRING=" p212"
include/configs/khadas-vim.h deleted +0 -14
deleted file mode 100644
index ff87c02..0000000
@@ -1,14 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * Configuration for Khadas VIM
- *
- * Copyright (C) 2017 Baylibre, SAS
- * Author: Neil Armstrong <[email protected]>
- */
-
-#ifndef __CONFIG_H
-#define __CONFIG_H
-
-#include <configs/meson-gx-common.h>
-
-#endif /* __CONFIG_H */
include/configs/libretech-cc.h deleted +0 -14
deleted file mode 100644
index 95e0f34..0000000
@@ -1,14 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * Configuration for LibreTech CC
- *
- * Copyright (C) 2017 Baylibre, SAS
- * Author: Neil Armstrong <[email protected]>
- */
-
-#ifndef __CONFIG_H
-#define __CONFIG_H
-
-#include <configs/meson-gx-common.h>
-
-#endif /* __CONFIG_H */
include/configs/meson-gx-common.h deleted +0 -52

52 lines not on this page · raw message

include/configs/meson64.h new file +55 -0

55 lines not on this page · raw message

include/configs/nanopi-k2.h deleted +0 -12
deleted file mode 100644
index 3fd6e8f..0000000
@@ -1,12 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * Configuration for NANOPI-K2
- * (C) Copyright 2018 Thomas McKahan
- */
-
-#ifndef __CONFIG_H
-#define __CONFIG_H
-
-#include <configs/meson-gx-common.h>
-
-#endif /* __CONFIG_H */
include/configs/odroid-c2.h deleted +0 -12
deleted file mode 100644
index 87e3ddb..0000000
@@ -1,12 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * Configuration for ODROID-C2
- * (C) Copyright 2016 Beniamino Galvani <[email protected]>
- */
-
-#ifndef __CONFIG_H
-#define __CONFIG_H
-
-#include <configs/meson-gx-common.h>
-
-#endif /* __CONFIG_H */
include/configs/p212.h deleted +0 -14
deleted file mode 100644
index 4414293..0000000
@@ -1,14 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * Configuration for Amlogic P212
- *
- * Copyright (C) 2017 Baylibre, SAS
- * Author: Neil Armstrong <[email protected]>
- */
-
-#ifndef __CONFIG_H
-#define __CONFIG_H
-
-#include <configs/meson-gx-common.h>
-
-#endif /* __CONFIG_H */
include/configs/q200.h deleted +0 -18
deleted file mode 100644
index 7ef8f42..0000000
@@ -1,18 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * Configuration for Khadas VIM2
- *
- * Copyright (C) 2017 Baylibre, SAS
- * Author: Neil Armstrong <[email protected]>
- */
-
-#ifndef __CONFIG_H
-#define __CONFIG_H
-
-#define CONFIG_MISC_INIT_R
-
-#define MESON_FDTFILE_SETTING "fdtfile=amlogic/meson-gxm-khadas-vim2.dtb\0"
-
-#include <configs/meson-gx-common.h>
-
-#endif /* __CONFIG_H */
Signature · 1 line
2.7.4
#7 lore raw

PATCH 7/19 configs: meson: change default load addresses

In reply to Neil Armstrong

From: Jerome Brunet <[email protected]>

The original chosen addresses conflict with the BL2 initialisation. So far there was no issue with them but if we preload binaries in RAM (ROMUSB boot) before running the BL2 they get corrupted by the execution of BL2 init.

If we load them around 0x08000000, there is no such issue.

---
 include/configs/meson64.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
include/configs/meson64.h +3 -3
index 1929a3e..80c883e 100644
@@ -41,9 +41,9 @@
 
 #ifndef CONFIG_EXTRA_ENV_SETTINGS
 #define CONFIG_EXTRA_ENV_SETTINGS \
-	"fdt_addr_r=0x01000000\0" \
-	"scriptaddr=0x1f000000\0" \
-	"kernel_addr_r=0x01080000\0" \
+	"fdt_addr_r=0x08008000\0" \
+	"scriptaddr=0x08000000\0" \
+	"kernel_addr_r=0x08080000\0" \
 	"pxefile_addr_r=0x01080000\0" \
 	"ramdisk_addr_r=0x13000000\0" \
 	"fdtfile=amlogic/" CONFIG_DEFAULT_DEVICE_TREE ".dtb\0" \
Signature · 1 line
2.7.4
#8 lore raw

PATCH 8/19 pinctrl: meson: rework gx pmx function

In reply to Neil Armstrong

From: Jerome Brunet <[email protected]>

In preparation of supporting the new Amlogix AGX SoCs, we need to move the Amlogic GX pinmux functions out of the common code to be able to add a different set of SoC specific pinmux functions for AXG.

---
 drivers/pinctrl/meson/Kconfig                |   8 +-
 drivers/pinctrl/meson/Makefile               |   1 +
 drivers/pinctrl/meson/pinctrl-meson-gx-pmx.c |  97 ++++++++++++++++++++++++
 drivers/pinctrl/meson/pinctrl-meson-gx.h     |  48 ++++++++++++
 drivers/pinctrl/meson/pinctrl-meson-gxbb.c   |   6 +-
 drivers/pinctrl/meson/pinctrl-meson-gxl.c    |   6 +-
 drivers/pinctrl/meson/pinctrl-meson.c        | 109 ++++-----------------------
 drivers/pinctrl/meson/pinctrl-meson.h        |  37 +++++----
 8 files changed, 191 insertions(+), 121 deletions(-)
 create mode 100644 drivers/pinctrl/meson/pinctrl-meson-gx-pmx.c
 create mode 100644 drivers/pinctrl/meson/pinctrl-meson-gx.h
drivers/pinctrl/meson/Kconfig +6 -2
index 27ba890..15a8d9c 100644
@@ -4,12 +4,16 @@ config PINCTRL_MESON
 	depends on PINCTRL_GENERIC
 	bool
 
+config PINCTRL_MESON_GX_PMX
+	select PINCTRL_MESON
+	bool
+
 config PINCTRL_MESON_GXBB
 	bool "Amlogic Meson GXBB SoC pinctrl driver"
-	select PINCTRL_MESON
+	select PINCTRL_MESON_GX_PMX
 
 config PINCTRL_MESON_GXL
 	bool "Amlogic Meson GXL SoC pinctrl driver"
-	select PINCTRL_MESON
+	select PINCTRL_MESON_GX_PMX
 
 endif
drivers/pinctrl/meson/Makefile +1 -0
index 965092c..30b6875 100644
@@ -1,5 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0+
 
 obj-y					+= pinctrl-meson.o
+obj-$(CONFIG_PINCTRL_MESON_GX_PMX)	+= pinctrl-meson-gx-pmx.o
 obj-$(CONFIG_PINCTRL_MESON_GXBB)	+= pinctrl-meson-gxbb.o
 obj-$(CONFIG_PINCTRL_MESON_GXL)		+= pinctrl-meson-gxl.o
drivers/pinctrl/meson/pinctrl-meson-gx-pmx.c new file +97 -0

97 lines not on this page · raw message

drivers/pinctrl/meson/pinctrl-meson-gx.h new file +48 -0

48 lines not on this page · raw message

drivers/pinctrl/meson/pinctrl-meson-gxbb.c +4 -2
index a8e47e3..22e8b05 100644
@@ -11,7 +11,7 @@
 #include <dm/pinctrl.h>
 #include <dt-bindings/gpio/meson-gxbb-gpio.h>
 
-#include "pinctrl-meson.h"
+#include "pinctrl-meson-gx.h"
 
 #define EE_OFF	15
 
@@ -417,6 +417,7 @@ struct meson_pinctrl_data meson_gxbb_periphs_pinctrl_data = {
 	.num_groups	= ARRAY_SIZE(meson_gxbb_periphs_groups),
 	.num_funcs	= ARRAY_SIZE(meson_gxbb_periphs_functions),
 	.num_banks	= ARRAY_SIZE(meson_gxbb_periphs_banks),
+	.gpio_driver	= &meson_gx_gpio_driver,
 };
 
 struct meson_pinctrl_data meson_gxbb_aobus_pinctrl_data = {
@@ -429,6 +430,7 @@ struct meson_pinctrl_data meson_gxbb_aobus_pinctrl_data = {
 	.num_groups	= ARRAY_SIZE(meson_gxbb_aobus_groups),
 	.num_funcs	= ARRAY_SIZE(meson_gxbb_aobus_functions),
 	.num_banks	= ARRAY_SIZE(meson_gxbb_aobus_banks),
+	.gpio_driver	= &meson_gx_gpio_driver,
 };
 
 static const struct udevice_id meson_gxbb_pinctrl_match[] = {
@@ -449,5 +451,5 @@ U_BOOT_DRIVER(meson_gxbb_pinctrl) = {
 	.of_match = of_match_ptr(meson_gxbb_pinctrl_match),
 	.probe = meson_pinctrl_probe,
 	.priv_auto_alloc_size = sizeof(struct meson_pinctrl),
-	.ops = &meson_pinctrl_ops,
+	.ops = &meson_gx_pinctrl_ops,
 };
drivers/pinctrl/meson/pinctrl-meson-gxl.c +4 -2
index ba6e353..1819eee 100644
@@ -11,7 +11,7 @@
 #include <dm/pinctrl.h>
 #include <dt-bindings/gpio/meson-gxl-gpio.h>
 
-#include "pinctrl-meson.h"
+#include "pinctrl-meson-gx.h"
 
 #define EE_OFF	11
 
@@ -699,6 +699,7 @@ struct meson_pinctrl_data meson_gxl_periphs_pinctrl_data = {
 	.num_groups	= ARRAY_SIZE(meson_gxl_periphs_groups),
 	.num_funcs	= ARRAY_SIZE(meson_gxl_periphs_functions),
 	.num_banks	= ARRAY_SIZE(meson_gxl_periphs_banks),
+	.gpio_driver	= &meson_gx_gpio_driver,
 };
 
 struct meson_pinctrl_data meson_gxl_aobus_pinctrl_data = {
@@ -711,6 +712,7 @@ struct meson_pinctrl_data meson_gxl_aobus_pinctrl_data = {
 	.num_groups	= ARRAY_SIZE(meson_gxl_aobus_groups),
 	.num_funcs	= ARRAY_SIZE(meson_gxl_aobus_functions),
 	.num_banks	= ARRAY_SIZE(meson_gxl_aobus_banks),
+	.gpio_driver	= &meson_gx_gpio_driver,
 };
 
 static const struct udevice_id meson_gxl_pinctrl_match[] = {
@@ -731,5 +733,5 @@ U_BOOT_DRIVER(meson_gxl_pinctrl) = {
 	.of_match = of_match_ptr(meson_gxl_pinctrl_match),
 	.probe = meson_pinctrl_probe,
 	.priv_auto_alloc_size = sizeof(struct meson_pinctrl),
-	.ops = &meson_pinctrl_ops,
+	.ops = &meson_gx_pinctrl_ops,
 };
drivers/pinctrl/meson/pinctrl-meson.c +14 -95

187 lines not on this page · raw message

drivers/pinctrl/meson/pinctrl-meson.h +17 -20
index 6ec89ba..bdee721 100644
@@ -12,9 +12,7 @@ struct meson_pmx_group {
 	const char *name;
 	const unsigned int *pins;
 	unsigned int num_pins;
-	bool is_gpio;
-	unsigned int reg;
-	unsigned int bit;
+	const void *data;
 };
 
 struct meson_pmx_func {
@@ -33,6 +31,8 @@ struct meson_pinctrl_data {
 	unsigned int num_groups;
 	unsigned int num_funcs;
 	unsigned int num_banks;
+	const struct driver *gpio_driver;
+	void *pmx_data;
 };
 
 struct meson_pinctrl {
@@ -89,23 +89,6 @@ struct meson_bank {
 
 #define PIN(x, b)	(b + x)
 
-#define GROUP(grp, r, b)						\
-	{								\
-		.name = #grp,						\
-		.pins = grp ## _pins,					\
-		.num_pins = ARRAY_SIZE(grp ## _pins),			\
-		.reg = r,						\
-		.bit = b,						\
-	 }
-
-#define GPIO_GROUP(gpio, b)						\
-	{								\
-		.name = #gpio,						\
-		.pins = (const unsigned int[]){ PIN(gpio, b) },		\
-		.num_pins = 1,						\
-		.is_gpio = true,					\
-	 }
-
 #define FUNCTION(fn)							\
 	{								\
 		.name = #fn,						\
@@ -131,6 +114,20 @@ struct meson_bank {
 
 extern const struct pinctrl_ops meson_pinctrl_ops;
 
+int meson_pinctrl_get_groups_count(struct udevice *dev);
+const char *meson_pinctrl_get_group_name(struct udevice *dev,
+					 unsigned int selector);
+int meson_pinmux_get_functions_count(struct udevice *dev);
+const char *meson_pinmux_get_function_name(struct udevice *dev,
+					   unsigned int selector);
 int meson_pinctrl_probe(struct udevice *dev);
 
+int meson_gpio_get(struct udevice *dev, unsigned int offset);
+int meson_gpio_set(struct udevice *dev, unsigned int offset, int value);
+int meson_gpio_get_direction(struct udevice *dev, unsigned int offset);
+int meson_gpio_direction_input(struct udevice *dev, unsigned int offset);
+int meson_gpio_direction_output(struct udevice *dev, unsigned int offset,
+				int value);
+int meson_gpio_probe(struct udevice *dev);
+
 #endif /* __PINCTRL_MESON_H__ */
Signature · 1 line
2.7.4
#9 lore raw

PATCH 9/19 pinctrl: meson: select generic pinctrl

In reply to Neil Armstrong

From: Jerome Brunet <[email protected]>

Meson pinctrl needs generic pinctrl, rather than depending on it select it

---
 drivers/pinctrl/meson/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/meson/Kconfig +1 -1
index 15a8d9c..fc51b43 100644
@@ -1,7 +1,7 @@
 if ARCH_MESON
 
 config PINCTRL_MESON
-	depends on PINCTRL_GENERIC
+	select PINCTRL_GENERIC
 	bool
 
 config PINCTRL_MESON_GX_PMX
Signature · 1 line
2.7.4
#10 lore raw

PATCH 10/19 pinctrl: meson: add axg support

In reply to Neil Armstrong

From: Jerome Brunet <[email protected]>

This adds support for the Amlogic AXG SoC pinctrl and GPIO controller using a specific set of pinctrl functions which differs from the GX SoCs.

---
 drivers/pinctrl/meson/Kconfig                 |   8 +
 drivers/pinctrl/meson/Makefile                |   2 +
 drivers/pinctrl/meson/pinctrl-meson-axg-pmx.c | 125 ++++
 drivers/pinctrl/meson/pinctrl-meson-axg.c     | 979 ++++++++++++++++++++++++++
 drivers/pinctrl/meson/pinctrl-meson-axg.h     |  66 ++
 5 files changed, 1180 insertions(+)
 create mode 100644 drivers/pinctrl/meson/pinctrl-meson-axg-pmx.c
 create mode 100644 drivers/pinctrl/meson/pinctrl-meson-axg.c
 create mode 100644 drivers/pinctrl/meson/pinctrl-meson-axg.h
drivers/pinctrl/meson/Kconfig +8 -0
index fc51b43..ee820a5 100644
@@ -8,6 +8,10 @@ config PINCTRL_MESON_GX_PMX
 	select PINCTRL_MESON
 	bool
 
+config PINCTRL_MESON_AXG_PMX
+	select PINCTRL_MESON
+	bool
+
 config PINCTRL_MESON_GXBB
 	bool "Amlogic Meson GXBB SoC pinctrl driver"
 	select PINCTRL_MESON_GX_PMX
@@ -16,4 +20,8 @@ config PINCTRL_MESON_GXL
 	bool "Amlogic Meson GXL SoC pinctrl driver"
 	select PINCTRL_MESON_GX_PMX
 
+config PINCTRL_MESON_AXG
+	bool "Amlogic Meson AXG SoC pinctrl driver"
+	select PINCTRL_MESON_AXG_PMX
+
 endif
drivers/pinctrl/meson/Makefile +2 -0
index 30b6875..707287c 100644
@@ -2,5 +2,7 @@
 
 obj-y					+= pinctrl-meson.o
 obj-$(CONFIG_PINCTRL_MESON_GX_PMX)	+= pinctrl-meson-gx-pmx.o
+obj-$(CONFIG_PINCTRL_MESON_AXG_PMX)	+= pinctrl-meson-axg-pmx.o
 obj-$(CONFIG_PINCTRL_MESON_GXBB)	+= pinctrl-meson-gxbb.o
 obj-$(CONFIG_PINCTRL_MESON_GXL)		+= pinctrl-meson-gxl.o
+obj-$(CONFIG_PINCTRL_MESON_AXG)		+= pinctrl-meson-axg.o
drivers/pinctrl/meson/pinctrl-meson-axg-pmx.c new file +125 -0

125 lines not on this page · raw message

drivers/pinctrl/meson/pinctrl-meson-axg.c new file +979 -0

979 lines not on this page · raw message

drivers/pinctrl/meson/pinctrl-meson-axg.h new file +66 -0

66 lines not on this page · raw message

Signature · 1 line
2.7.4
#14 lore raw

PATCH 11/19 clk: meson: add static to meson_gates table

In reply to Neil Armstrong

The meson_gates table should be set static in the clk_meson driver.

---
 drivers/clk/clk_meson.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/clk_meson.c +1 -1
index 236d734..509872b 100644
@@ -79,7 +79,7 @@ static ulong meson_clk_set_rate_by_id(struct clk *clk, unsigned long id,
 static ulong meson_mux_get_parent(struct clk *clk, unsigned long id);
 static ulong meson_clk_get_rate_by_id(struct clk *clk, unsigned long id);
 
-struct meson_gate gates[] = {
+static struct meson_gate gates[] = {
 	/* Everything Else (EE) domain gates */
 	MESON_GATE(CLKID_DDR, HHI_GCLK_MPEG0, 0),
 	MESON_GATE(CLKID_DOS, HHI_GCLK_MPEG0, 1),
Signature · 1 line
2.7.4
#15 lore raw

PATCH 12/19 clk: meson: silence debug print

In reply to Neil Armstrong

From: Jerome Brunet <[email protected]>

This debug print was not designed to be active in non-debug mode.

---
 drivers/clk/clk_meson.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/clk_meson.c +1 -1
index 509872b..87e959e 100644
@@ -790,7 +790,7 @@ static ulong meson_clk_get_rate_by_id(struct clk *clk, unsigned long id)
 		return -ENOENT;
 	}
 
-	printf("clock %lu has rate %lu\n", id, rate);
+	debug("clock %lu has rate %lu\n", id, rate);
 	return rate;
 }
 
Signature · 1 line
2.7.4
#16 lore raw

PATCH 13/19 ARM: meson: rework soc arch file to prepare for new SoC

In reply to Neil Armstrong

From: Jerome Brunet <[email protected]>

We are about to add support for the Amlogic AXG SoC. While very close to the Gx SoC family, we will need to handle a few thing which are different in this SoC. Rework the meson arch directory to prepare for this.

---
 arch/arm/include/asm/arch-meson/clock-gx.h | 117 +++++++++++++++++++++++++
 arch/arm/include/asm/arch-meson/clock.h    | 117 -------------------------
 arch/arm/include/asm/arch-meson/eth.h      |   6 +-
 arch/arm/include/asm/arch-meson/mem.h      |   3 +-
 arch/arm/mach-meson/Kconfig                |  10 ++-
 arch/arm/mach-meson/Makefile               |   3 +-
 arch/arm/mach-meson/board-common.c         |  56 ++++++++++++
 arch/arm/mach-meson/board-gx.c             | 132 +++++++++++++++++++++++++++++
 arch/arm/mach-meson/board.c                | 130 ----------------------------
 arch/arm/mach-meson/eth.c                  |  53 ------------
 arch/arm/mach-meson/sm.c                   |   1 -
 board/amlogic/odroid-c2/odroid-c2.c        |   6 +-
 board/amlogic/p212/p212.c                  |   6 +-
 board/amlogic/q200/q200.c                  |   4 +-
 drivers/clk/clk_meson.c                    |   2 +-
 15 files changed, 328 insertions(+), 318 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-meson/clock-gx.h
 delete mode 100644 arch/arm/include/asm/arch-meson/clock.h
 create mode 100644 arch/arm/mach-meson/board-common.c
 create mode 100644 arch/arm/mach-meson/board-gx.c
 delete mode 100644 arch/arm/mach-meson/board.c
 delete mode 100644 arch/arm/mach-meson/eth.c
arch/arm/include/asm/arch-meson/clock-gx.h new file +117 -0
new file mode 100644
index 0000000..13a2e76
@@ -0,0 +1,117 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright 2016 - AmLogic, Inc.
+ * Copyright 2018 - Beniamino Galvani <[email protected]>
+ */
+#ifndef _ARCH_MESON_CLOCK_GX_H_
+#define _ARCH_MESON_CLOCK_GX_H_
+
+/*
+ * Clock controller register offsets
+ *
+ * Register offsets from the data sheet are listed in comment blocks below.
+ * Those offsets must be multiplied by 4 before adding them to the base address
+ * to get the right value
+ */
+#define SCR				0x2C /* 0x0b offset in data sheet */
+#define TIMEOUT_VALUE			0x3c /* 0x0f offset in data sheet */
+
+#define HHI_GP0_PLL_CNTL		0x40 /* 0x10 offset in data sheet */
+#define HHI_GP0_PLL_CNTL2		0x44 /* 0x11 offset in data sheet */
+#define HHI_GP0_PLL_CNTL3		0x48 /* 0x12 offset in data sheet */
+#define HHI_GP0_PLL_CNTL4		0x4c /* 0x13 offset in data sheet */
+#define	HHI_GP0_PLL_CNTL5		0x50 /* 0x14 offset in data sheet */
+#define	HHI_GP0_PLL_CNTL1		0x58 /* 0x16 offset in data sheet */
+
+#define	HHI_XTAL_DIVN_CNTL		0xbc /* 0x2f offset in data sheet */
+#define	HHI_TIMER90K			0xec /* 0x3b offset in data sheet */
+
+#define	HHI_MEM_PD_REG0			0x100 /* 0x40 offset in data sheet */
+#define	HHI_MEM_PD_REG1			0x104 /* 0x41 offset in data sheet */
+#define	HHI_VPU_MEM_PD_REG1		0x108 /* 0x42 offset in data sheet */
+#define	HHI_VIID_CLK_DIV		0x128 /* 0x4a offset in data sheet */
+#define	HHI_VIID_CLK_CNTL		0x12c /* 0x4b offset in data sheet */
+
+#define HHI_GCLK_MPEG0			0x140 /* 0x50 offset in data sheet */
+#define HHI_GCLK_MPEG1			0x144 /* 0x51 offset in data sheet */
+#define HHI_GCLK_MPEG2			0x148 /* 0x52 offset in data sheet */
+#define HHI_GCLK_OTHER			0x150 /* 0x54 offset in data sheet */
+#define HHI_GCLK_AO			0x154 /* 0x55 offset in data sheet */
+#define HHI_SYS_OSCIN_CNTL		0x158 /* 0x56 offset in data sheet */
+#define HHI_SYS_CPU_CLK_CNTL1		0x15c /* 0x57 offset in data sheet */
+#define HHI_SYS_CPU_RESET_CNTL		0x160 /* 0x58 offset in data sheet */
+#define HHI_VID_CLK_DIV			0x164 /* 0x59 offset in data sheet */
+
+#define HHI_MPEG_CLK_CNTL		0x174 /* 0x5d offset in data sheet */
+#define HHI_AUD_CLK_CNTL		0x178 /* 0x5e offset in data sheet */
+#define HHI_VID_CLK_CNTL		0x17c /* 0x5f offset in data sheet */
+#define HHI_AUD_CLK_CNTL2		0x190 /* 0x64 offset in data sheet */
+#define HHI_VID_CLK_CNTL2		0x194 /* 0x65 offset in data sheet */
+#define HHI_SYS_CPU_CLK_CNTL0		0x19c /* 0x67 offset in data sheet */
+#define HHI_VID_PLL_CLK_DIV		0x1a0 /* 0x68 offset in data sheet */
+#define HHI_AUD_CLK_CNTL3		0x1a4 /* 0x69 offset in data sheet */
+#define HHI_MALI_CLK_CNTL		0x1b0 /* 0x6c offset in data sheet */
+#define HHI_VPU_CLK_CNTL		0x1bC /* 0x6f offset in data sheet */
+
+#define HHI_HDMI_CLK_CNTL		0x1CC /* 0x73 offset in data sheet */
+#define HHI_VDEC_CLK_CNTL		0x1E0 /* 0x78 offset in data sheet */
+#define HHI_VDEC2_CLK_CNTL		0x1E4 /* 0x79 offset in data sheet */
+#define HHI_VDEC3_CLK_CNTL		0x1E8 /* 0x7a offset in data sheet */
+#define HHI_VDEC4_CLK_CNTL		0x1EC /* 0x7b offset in data sheet */
+#define HHI_HDCP22_CLK_CNTL		0x1F0 /* 0x7c offset in data sheet */
+#define HHI_VAPBCLK_CNTL		0x1F4 /* 0x7d offset in data sheet */
+
+#define HHI_VPU_CLKB_CNTL		0x20C /* 0x83 offset in data sheet */
+#define HHI_USB_CLK_CNTL		0x220 /* 0x88 offset in data sheet */
+#define HHI_32K_CLK_CNTL		0x224 /* 0x89 offset in data sheet */
+#define HHI_GEN_CLK_CNTL		0x228 /* 0x8a offset in data sheet */
+#define HHI_GEN_CLK_CNTL		0x228 /* 0x8a offset in data sheet */
+
+#define HHI_PCM_CLK_CNTL		0x258 /* 0x96 offset in data sheet */
+#define HHI_NAND_CLK_CNTL		0x25C /* 0x97 offset in data sheet */
+#define HHI_SD_EMMC_CLK_CNTL		0x264 /* 0x99 offset in data sheet */
+
+#define HHI_MPLL_CNTL			0x280 /* 0xa0 offset in data sheet */
+#define HHI_MPLL_CNTL2			0x284 /* 0xa1 offset in data sheet */
+#define HHI_MPLL_CNTL3			0x288 /* 0xa2 offset in data sheet */
+#define HHI_MPLL_CNTL4			0x28C /* 0xa3 offset in data sheet */
+#define HHI_MPLL_CNTL5			0x290 /* 0xa4 offset in data sheet */
+#define HHI_MPLL_CNTL6			0x294 /* 0xa5 offset in data sheet */
+#define HHI_MPLL_CNTL7			0x298 /* 0xa6 offset in data sheet */
+#define HHI_MPLL_CNTL8			0x29C /* 0xa7 offset in data sheet */
+#define HHI_MPLL_CNTL9			0x2A0 /* 0xa8 offset in data sheet */
+#define HHI_MPLL_CNTL10			0x2A4 /* 0xa9 offset in data sheet */
+
+#define HHI_MPLL3_CNTL0			0x2E0 /* 0xb8 offset in data sheet */
+#define HHI_MPLL3_CNTL1			0x2E4 /* 0xb9 offset in data sheet */
+#define HHI_VDAC_CNTL0			0x2F4 /* 0xbd offset in data sheet */
+#define HHI_VDAC_CNTL1			0x2F8 /* 0xbe offset in data sheet */
+
+#define HHI_SYS_PLL_CNTL		0x300 /* 0xc0 offset in data sheet */
+#define HHI_SYS_PLL_CNTL2		0x304 /* 0xc1 offset in data sheet */
+#define HHI_SYS_PLL_CNTL3		0x308 /* 0xc2 offset in data sheet */
+#define HHI_SYS_PLL_CNTL4		0x30c /* 0xc3 offset in data sheet */
+#define HHI_SYS_PLL_CNTL5		0x310 /* 0xc4 offset in data sheet */
+#define HHI_DPLL_TOP_I			0x318 /* 0xc6 offset in data sheet */
+#define HHI_DPLL_TOP2_I			0x31C /* 0xc7 offset in data sheet */
+#define HHI_HDMI_PLL_CNTL		0x320 /* 0xc8 offset in data sheet */
+#define HHI_HDMI_PLL_CNTL2		0x324 /* 0xc9 offset in data sheet */
+#define HHI_HDMI_PLL_CNTL3		0x328 /* 0xca offset in data sheet */
+#define HHI_HDMI_PLL_CNTL4		0x32C /* 0xcb offset in data sheet */
+#define HHI_HDMI_PLL_CNTL5		0x330 /* 0xcc offset in data sheet */
+#define HHI_HDMI_PLL_CNTL6		0x334 /* 0xcd offset in data sheet */
+#define HHI_HDMI_PLL_CNTL_I		0x338 /* 0xce offset in data sheet */
+#define HHI_HDMI_PLL_CNTL7		0x33C /* 0xcf offset in data sheet */
+
+#define HHI_HDMI_PHY_CNTL0		0x3A0 /* 0xe8 offset in data sheet */
+#define HHI_HDMI_PHY_CNTL1		0x3A4 /* 0xe9 offset in data sheet */
+#define HHI_HDMI_PHY_CNTL2		0x3A8 /* 0xea offset in data sheet */
+#define HHI_HDMI_PHY_CNTL3		0x3AC /* 0xeb offset in data sheet */
+
+#define HHI_VID_LOCK_CLK_CNTL		0x3C8 /* 0xf2 offset in data sheet */
+#define HHI_BT656_CLK_CNTL		0x3D4 /* 0xf5 offset in data sheet */
+#define HHI_SAR_CLK_CNTL		0x3D8 /* 0xf6 offset in data sheet */
+
+ulong meson_measure_clk_rate(unsigned int clk);
+
+#endif
arch/arm/include/asm/arch-meson/clock.h deleted +0 -117

117 lines not on this page · raw message

arch/arm/include/asm/arch-meson/eth.h +3 -3
index 1aa0872..08acc5c 100644
@@ -10,13 +10,13 @@
 #include <phy.h>
 
 enum {
-	/* Use GXL Internal RMII PHY */
-	MESON_GXL_USE_INTERNAL_RMII_PHY = 1,
+	/* Use Internal RMII PHY */
+	MESON_USE_INTERNAL_RMII_PHY = 1,
 };
 
 /* Configure the Ethernet MAC with the requested interface mode
  * with some optional flags.
  */
-void meson_gx_eth_init(phy_interface_t mode, unsigned int flags);
+void meson_eth_init(phy_interface_t mode, unsigned int flags);
 
 #endif /* __MESON_ETH_H__ */
arch/arm/include/asm/arch-meson/mem.h +2 -1
index 6281833..a65100a 100644
@@ -10,6 +10,7 @@
 /* Configure the reserved memory zones exported by the secure registers
  * into EFI and DTB reserved memory entries.
  */
-void meson_gx_init_reserved_memory(void *fdt);
+void meson_board_add_reserved_memory(void *fdt, u64 start, u64 size);
+void meson_init_reserved_memory(void *fdt);
 
 #endif /* __MESON_MEM_H__ */
arch/arm/mach-meson/Kconfig +7 -3
index 6f60167..6225417 100644
@@ -8,25 +8,29 @@ config MESON64_COMMON
 	select DM_SERIAL
 	imply CMD_DM
 
+config MESON_GX
+	bool
+	select MESON64_COMMON
+
 choice
 	prompt "Platform select"
 	default MESON_GXBB
 
 config MESON_GXBB
 	bool "GXBB"
-	select MESON64_COMMON
+	select MESON_GX
 	help
 	  Select this if your SoC is an S905
 
 config MESON_GXL
 	bool "GXL"
-	select MESON64_COMMON
+	select MESON_GX
 	help
 	  Select this if your SoC is an S905X/D or S805X
 
 config MESON_GXM
 	bool "GXM"
-	select MESON64_COMMON
+	select MESON_GX
 	help
 	  Select this if your SoC is an S912
 
arch/arm/mach-meson/Makefile +2 -1
index 8ad9b3e..78345b4 100644
@@ -2,4 +2,5 @@
 #
 # Copyright (c) 2016 Beniamino Galvani <[email protected]>
 
-obj-y += board.o sm.o eth.o
+obj-y += board-common.o sm.o
+obj-$(CONFIG_MESON_GX) += board-gx.o
arch/arm/mach-meson/board-common.c new file +56 -0

56 lines not on this page · raw message

arch/arm/mach-meson/board-gx.c new file +132 -0

132 lines not on this page · raw message

arch/arm/mach-meson/board.c deleted +0 -130

130 lines not on this page · raw message

arch/arm/mach-meson/eth.c deleted +0 -53

53 lines not on this page · raw message

arch/arm/mach-meson/sm.c +0 -1
index 0bba5e4..a07b468 100644
@@ -6,7 +6,6 @@
  */
 
 #include <common.h>
-#include <asm/arch/gx.h>
 #include <linux/kernel.h>
 
 #define FN_GET_SHARE_MEM_INPUT_BASE	0x82000020
board/amlogic/odroid-c2/odroid-c2.c +3 -3
index 2a2755c..d784d6b 100644
@@ -28,7 +28,7 @@ int misc_init_r(void)
 	char serial[EFUSE_SN_SIZE];
 	ssize_t len;
 
-	meson_gx_eth_init(PHY_INTERFACE_MODE_RGMII, 0);
+	meson_eth_init(PHY_INTERFACE_MODE_RGMII, 0);
 
 	if (!eth_env_get_enetaddr("ethaddr", mac_addr)) {
 		len = meson_sm_read_efuse(EFUSE_MAC_OFFSET,
@@ -40,7 +40,7 @@ int misc_init_r(void)
 	if (!env_get("serial#")) {
 		len = meson_sm_read_efuse(EFUSE_SN_OFFSET, serial,
 			EFUSE_SN_SIZE);
-		if (len == EFUSE_SN_SIZE) 
+		if (len == EFUSE_SN_SIZE)
 			env_set("serial#", serial);
 	}
 
@@ -49,7 +49,7 @@ int misc_init_r(void)
 
 int ft_board_setup(void *blob, bd_t *bd)
 {
-	meson_gx_init_reserved_memory(blob);
+	meson_init_reserved_memory(blob);
 
 	return 0;
 }
board/amlogic/p212/p212.c +3 -3
index 00e07d7..33992a2 100644
@@ -29,8 +29,8 @@ int misc_init_r(void)
 	char serial[EFUSE_SN_SIZE];
 	ssize_t len;
 
-	meson_gx_eth_init(PHY_INTERFACE_MODE_RMII,
-			  MESON_GXL_USE_INTERNAL_RMII_PHY);
+	meson_eth_init(PHY_INTERFACE_MODE_RMII,
+		       MESON_USE_INTERNAL_RMII_PHY);
 
 	if (!eth_env_get_enetaddr("ethaddr", mac_addr)) {
 		len = meson_sm_read_efuse(EFUSE_MAC_OFFSET,
@@ -51,7 +51,7 @@ int misc_init_r(void)
 
 int ft_board_setup(void *blob, bd_t *bd)
 {
-	meson_gx_init_reserved_memory(blob);
+	meson_init_reserved_memory(blob);
 
 	return 0;
 }
board/amlogic/q200/q200.c +2 -2
index ff56569..b59c11b 100644
@@ -29,7 +29,7 @@ int misc_init_r(void)
 	char serial[EFUSE_SN_SIZE];
 	ssize_t len;
 
-	meson_gx_eth_init(PHY_INTERFACE_MODE_RGMII, 0);
+	meson_eth_init(PHY_INTERFACE_MODE_RGMII, 0);
 
 	/* Reset PHY on GPIOZ_14 */
 	clrbits_le32(GX_GPIO_EN(3), BIT(14));
@@ -56,7 +56,7 @@ int misc_init_r(void)
 
 int ft_board_setup(void *blob, bd_t *bd)
 {
-	meson_gx_init_reserved_memory(blob);
+	meson_init_reserved_memory(blob);
 
 	return 0;
 }
drivers/clk/clk_meson.c +1 -1
index 87e959e..978f646 100644
@@ -6,7 +6,7 @@
  */
 
 #include <common.h>
-#include <asm/arch/clock.h>
+#include <asm/arch/clock-gx.h>
 #include <asm/io.h>
 #include <clk-uclass.h>
 #include <div64.h>
Signature · 1 line
2.7.4
#19 lore raw

PATCH 14/19 ARM: meson: Add support for AXG family

In reply to Neil Armstrong

This patch adds support for the Amlogic AXG SoC, which is very close from the Amlogic GXL SoCs with :
- Same 4xCortex-A53 CPUs but clocked at 1.2GHZ max
- DDR Interface limited to DDR4 16bit
- The whole physical register address space has been moved to 0xfxxxxxxx
- The pinctrl setup has changed
- The clock tree is different enough to use a different driver

---
 arch/arm/include/asm/arch-meson/axg.h |  51 ++++++++++++++++
 arch/arm/mach-meson/Kconfig           |   8 +++
 arch/arm/mach-meson/Makefile          |   1 +
 arch/arm/mach-meson/board-axg.c       | 112 ++++++++++++++++++++++++++++++++++
 include/configs/meson64.h             |   5 ++
 5 files changed, 177 insertions(+)
 create mode 100644 arch/arm/include/asm/arch-meson/axg.h
 create mode 100644 arch/arm/mach-meson/board-axg.c
arch/arm/include/asm/arch-meson/axg.h new file +51 -0
new file mode 100644
index 0000000..28a38b7
@@ -0,0 +1,51 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (C) 2018 BayLibre, SAS
+ * Author: Neil Armstrong <[email protected]>
+ */
+
+#ifndef __AXG_H__
+#define __AXG_H__
+
+#define AXG_AOBUS_BASE		0xff800000
+#define AXG_PERIPHS_BASE	0xff634400
+#define AXG_HIU_BASE		0xff63c000
+#define AXG_ETH_BASE		0xff3f0000
+
+/* Always-On Peripherals registers */
+#define AXG_AO_ADDR(off)	(AXG_AOBUS_BASE + ((off) << 2))
+
+#define AXG_AO_SEC_GP_CFG0	AXG_AO_ADDR(0x90)
+#define AXG_AO_SEC_GP_CFG3	AXG_AO_ADDR(0x93)
+#define AXG_AO_SEC_GP_CFG4	AXG_AO_ADDR(0x94)
+#define AXG_AO_SEC_GP_CFG5	AXG_AO_ADDR(0x95)
+
+#define AXG_AO_MEM_SIZE_MASK	0xFFFF0000
+#define AXG_AO_MEM_SIZE_SHIFT	16
+#define AXG_AO_BL31_RSVMEM_SIZE_MASK	0xFFFF0000
+#define AXG_AO_BL31_RSVMEM_SIZE_SHIFT	16
+#define AXG_AO_BL32_RSVMEM_SIZE_MASK	0xFFFF
+
+/* Peripherals registers */
+#define AXG_PERIPHS_ADDR(off)	(AXG_PERIPHS_BASE + ((off) << 2))
+
+#define AXG_ETH_REG_0		AXG_PERIPHS_ADDR(0x50)
+#define AXG_ETH_REG_1		AXG_PERIPHS_ADDR(0x51)
+
+#define AXG_ETH_REG_0_PHY_INTF_RGMII	BIT(0)
+#define AXG_ETH_REG_0_PHY_INTF_RMII	BIT(2)
+#define AXG_ETH_REG_0_TX_PHASE(x)	(((x) & 3) << 5)
+#define AXG_ETH_REG_0_TX_RATIO(x)	(((x) & 7) << 7)
+#define AXG_ETH_REG_0_PHY_CLK_EN	BIT(10)
+#define AXG_ETH_REG_0_INVERT_RMII_CLK	BIT(11)
+#define AXG_ETH_REG_0_CLK_EN		BIT(12)
+
+/* HIU registers */
+#define AXG_HIU_ADDR(off)	(AXG_HIU_BASE + ((off) << 2))
+
+#define AXG_MEM_PD_REG_0	AXG_HIU_ADDR(0x40)
+
+/* Ethernet memory power domain */
+#define AXG_MEM_PD_REG_0_ETH_MASK	(BIT(2) | BIT(3))
+
+#endif /* __AXG_H__ */
arch/arm/mach-meson/Kconfig +8 -0
index 6225417..7f217fa 100644
@@ -6,6 +6,8 @@ config MESON64_COMMON
 	select CLK
 	select DM
 	select DM_SERIAL
+	select SYSCON
+	select REGMAP
 	imply CMD_DM
 
 config MESON_GX
@@ -34,6 +36,12 @@ config MESON_GXM
 	help
 	  Select this if your SoC is an S912
 
+config MESON_AXG
+	bool "AXG"
+	select MESON64_COMMON
+	help
+		Select this if your SoC is an A113X/D
+
 endchoice
 
 config SYS_SOC
arch/arm/mach-meson/Makefile +1 -0
index 78345b4..b716e1a 100644
@@ -4,3 +4,4 @@
 
 obj-y += board-common.o sm.o
 obj-$(CONFIG_MESON_GX) += board-gx.o
+obj-$(CONFIG_MESON_AXG) += board-axg.o
arch/arm/mach-meson/board-axg.c new file +112 -0

112 lines not on this page · raw message

include/configs/meson64.h +5 -0
index 80c883e..f961f43 100644
@@ -8,8 +8,13 @@
 #define __MESON64_CONFIG_H
 
 /* Generic Interrupt Controller Definitions */
+#if defined(CONFIG_MESON_AXG)
+#define GICD_BASE			0xffc01000
+#define GICC_BASE			0xffc02000
+#else /* MESON GXL and GXBB */
 #define GICD_BASE			0xc4301000
 #define GICC_BASE			0xc4302000
+#endif
 
 #define CONFIG_CPU_ARMV8
 #define CONFIG_REMAKE_ELF
Signature · 1 line
2.7.4
#20 lore raw

PATCH 15/19 ARM: dts: Sync Amlogic Meson AXG DT from Linux 4.20-rc1

In reply to Neil Armstrong

Synchronize the Amlogic AXG Device Tree files and bindings include from the recent Linux 4.20-rc1, because it includes patches fixing support for U-boot.

---
 arch/arm/dts/Makefile                              |    3 +-
 arch/arm/dts/meson-axg-s400.dts                    |  554 +++++++
 arch/arm/dts/meson-axg.dtsi                        | 1589 ++++++++++++++++++++
 include/dt-bindings/clock/axg-aoclkc.h             |   26 +
 include/dt-bindings/clock/axg-audio-clkc.h         |   94 ++
 include/dt-bindings/clock/axg-clkc.h               |   76 +
 include/dt-bindings/gpio/meson-axg-gpio.h          |  116 ++
 .../reset/amlogic,meson-axg-audio-arb.h            |   17 +
 .../dt-bindings/reset/amlogic,meson-axg-reset.h    |  124 ++
 include/dt-bindings/reset/axg-aoclkc.h             |   20 +
 10 files changed, 2618 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/dts/meson-axg-s400.dts
 create mode 100644 arch/arm/dts/meson-axg.dtsi
 create mode 100644 include/dt-bindings/clock/axg-aoclkc.h
 create mode 100644 include/dt-bindings/clock/axg-audio-clkc.h
 create mode 100644 include/dt-bindings/clock/axg-clkc.h
 create mode 100644 include/dt-bindings/gpio/meson-axg-gpio.h
 create mode 100644 include/dt-bindings/reset/amlogic,meson-axg-audio-arb.h
 create mode 100644 include/dt-bindings/reset/amlogic,meson-axg-reset.h
 create mode 100644 include/dt-bindings/reset/axg-aoclkc.h
arch/arm/dts/Makefile +2 -1
index d36447d..6667434 100644
@@ -59,7 +59,8 @@ dtb-$(CONFIG_ARCH_MESON) += \
 	meson-gxl-s905x-p212.dtb \
 	meson-gxl-s905x-libretech-cc.dtb \
 	meson-gxl-s905x-khadas-vim.dtb \
-	meson-gxm-khadas-vim2.dtb
+	meson-gxm-khadas-vim2.dtb \
+	meson-axg-s400.dtb
 dtb-$(CONFIG_TEGRA) += tegra20-harmony.dtb \
 	tegra20-medcom-wide.dtb \
 	tegra20-paz00.dtb \
arch/arm/dts/meson-axg-s400.dts new file +554 -0

554 lines not on this page · raw message

arch/arm/dts/meson-axg.dtsi new file +1589 -0

1,589 lines not on this page · raw message

include/dt-bindings/clock/axg-aoclkc.h new file +26 -0
new file mode 100644
index 0000000..6195501
@@ -0,0 +1,26 @@
+/* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */
+/*
+ * Copyright (c) 2016 BayLibre, SAS
+ * Author: Neil Armstrong <[email protected]>
+ *
+ * Copyright (c) 2018 Amlogic, inc.
+ * Author: Qiufang Dai <[email protected]>
+ */
+
+#ifndef DT_BINDINGS_CLOCK_AMLOGIC_MESON_AXG_AOCLK
+#define DT_BINDINGS_CLOCK_AMLOGIC_MESON_AXG_AOCLK
+
+#define CLKID_AO_REMOTE		0
+#define CLKID_AO_I2C_MASTER	1
+#define CLKID_AO_I2C_SLAVE	2
+#define CLKID_AO_UART1		3
+#define CLKID_AO_UART2		4
+#define CLKID_AO_IR_BLASTER	5
+#define CLKID_AO_SAR_ADC	6
+#define CLKID_AO_CLK81		7
+#define CLKID_AO_SAR_ADC_SEL	8
+#define CLKID_AO_SAR_ADC_DIV	9
+#define CLKID_AO_SAR_ADC_CLK	10
+#define CLKID_AO_ALT_XTAL	11
+
+#endif
include/dt-bindings/clock/axg-audio-clkc.h new file +94 -0

94 lines not on this page · raw message

include/dt-bindings/clock/axg-clkc.h new file +76 -0

76 lines not on this page · raw message

include/dt-bindings/gpio/meson-axg-gpio.h new file +116 -0

116 lines not on this page · raw message

include/dt-bindings/reset/amlogic,meson-axg-audio-arb.h new file +17 -0
new file mode 100644
index 0000000..05c3636
@@ -0,0 +1,17 @@
+/* SPDX-License-Identifier: (GPL-2.0 OR MIT)
+ *
+ * Copyright (c) 2018 Baylibre SAS.
+ * Author: Jerome Brunet <[email protected]>
+ */
+
+#ifndef _DT_BINDINGS_AMLOGIC_MESON_AXG_AUDIO_ARB_H
+#define _DT_BINDINGS_AMLOGIC_MESON_AXG_AUDIO_ARB_H
+
+#define AXG_ARB_TODDR_A	0
+#define AXG_ARB_TODDR_B	1
+#define AXG_ARB_TODDR_C	2
+#define AXG_ARB_FRDDR_A	3
+#define AXG_ARB_FRDDR_B	4
+#define AXG_ARB_FRDDR_C	5
+
+#endif /* _DT_BINDINGS_AMLOGIC_MESON_AXG_AUDIO_ARB_H */
include/dt-bindings/reset/amlogic,meson-axg-reset.h new file +124 -0

124 lines not on this page · raw message

include/dt-bindings/reset/axg-aoclkc.h new file +20 -0
new file mode 100644
index 0000000..d342c0b
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */
+/*
+ * Copyright (c) 2016 BayLibre, SAS
+ * Author: Neil Armstrong <[email protected]>
+ *
+ * Copyright (c) 2018 Amlogic, inc.
+ * Author: Qiufang Dai <[email protected]>
+ */
+
+#ifndef DT_BINDINGS_RESET_AMLOGIC_MESON_AXG_AOCLK
+#define DT_BINDINGS_RESET_AMLOGIC_MESON_AXG_AOCLK
+
+#define RESET_AO_REMOTE		0
+#define RESET_AO_I2C_MASTER	1
+#define RESET_AO_I2C_SLAVE	2
+#define RESET_AO_UART1		3
+#define RESET_AO_UART2		4
+#define RESET_AO_IR_BLASTER	5
+
+#endif
Signature · 1 line
2.7.4
#21 lore raw

PATCH 16/19 clk: Add clock driver for AXG

In reply to Neil Armstrong

This patch adds a minimal clock driver for the Amlogic AXG SoC to handle the basic gates and PLLs.

---
 arch/arm/include/asm/arch-meson/clock-axg.h | 104 +++++++++
 drivers/clk/Makefile                        |   2 +-
 drivers/clk/clk_meson_axg.c                 | 316 ++++++++++++++++++++++++++++
 3 files changed, 421 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/include/asm/arch-meson/clock-axg.h
 create mode 100644 drivers/clk/clk_meson_axg.c
arch/arm/include/asm/arch-meson/clock-axg.h new file +104 -0
new file mode 100644
index 0000000..1ef88e4
@@ -0,0 +1,104 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright 2016 - AmLogic, Inc.
+ * Copyright 2018 - Beniamino Galvani <[email protected]>
+ * Copyright 2018 - BayLibre, SAS
+ * Author: Neil Armstrong <[email protected]>
+ */
+#ifndef _ARCH_MESON_CLOCK_AXG_H_
+#define _ARCH_MESON_CLOCK_AXG_H_
+
+/*
+ * Clock controller register offsets
+ *
+ * Register offsets from the data sheet are listed in comment blocks below.
+ * Those offsets must be multiplied by 4 before adding them to the base address
+ * to get the right value
+ */
+#define HHI_GP0_PLL_CNTL		0x40
+#define HHI_GP0_PLL_CNTL2		0x44
+#define HHI_GP0_PLL_CNTL3		0x48
+#define HHI_GP0_PLL_CNTL4		0x4c
+#define HHI_GP0_PLL_CNTL5		0x50
+#define HHI_GP0_PLL_STS			0x54
+#define HHI_GP0_PLL_CNTL1		0x58
+#define HHI_HIFI_PLL_CNTL		0x80
+#define HHI_HIFI_PLL_CNTL2		0x84
+#define HHI_HIFI_PLL_CNTL3		0x88
+#define HHI_HIFI_PLL_CNTL4		0x8C
+#define HHI_HIFI_PLL_CNTL5		0x90
+#define HHI_HIFI_PLL_STS		0x94
+#define HHI_HIFI_PLL_CNTL1		0x98
+
+#define HHI_XTAL_DIVN_CNTL		0xbc
+#define HHI_GCLK2_MPEG0			0xc0
+#define HHI_GCLK2_MPEG1			0xc4
+#define HHI_GCLK2_MPEG2			0xc8
+#define HHI_GCLK2_OTHER			0xd0
+#define HHI_GCLK2_AO			0xd4
+#define HHI_PCIE_PLL_CNTL		0xd8
+#define HHI_PCIE_PLL_CNTL1		0xdC
+#define HHI_PCIE_PLL_CNTL2		0xe0
+#define HHI_PCIE_PLL_CNTL3		0xe4
+#define HHI_PCIE_PLL_CNTL4		0xe8
+#define HHI_PCIE_PLL_CNTL5		0xec
+#define HHI_PCIE_PLL_CNTL6		0xf0
+#define HHI_PCIE_PLL_STS		0xf4
+
+#define HHI_MEM_PD_REG0			0x100
+#define HHI_VPU_MEM_PD_REG0		0x104
+#define HHI_VIID_CLK_DIV		0x128
+#define HHI_VIID_CLK_CNTL		0x12c
+
+#define HHI_GCLK_MPEG0			0x140
+#define HHI_GCLK_MPEG1			0x144
+#define HHI_GCLK_MPEG2			0x148
+#define HHI_GCLK_OTHER			0x150
+#define HHI_GCLK_AO			0x154
+#define HHI_SYS_CPU_CLK_CNTL1		0x15c
+#define HHI_SYS_CPU_RESET_CNTL		0x160
+#define HHI_VID_CLK_DIV			0x164
+#define HHI_SPICC_HCLK_CNTL		0x168
+
+#define HHI_MPEG_CLK_CNTL		0x174
+#define HHI_VID_CLK_CNTL		0x17c
+#define HHI_TS_CLK_CNTL			0x190
+#define HHI_VID_CLK_CNTL2		0x194
+#define HHI_SYS_CPU_CLK_CNTL0		0x19c
+#define HHI_VID_PLL_CLK_DIV		0x1a0
+#define HHI_VPU_CLK_CNTL		0x1bC
+
+#define HHI_VAPBCLK_CNTL		0x1F4
+
+#define HHI_GEN_CLK_CNTL		0x228
+
+#define HHI_VDIN_MEAS_CLK_CNTL		0x250
+#define HHI_NAND_CLK_CNTL		0x25C
+#define HHI_SD_EMMC_CLK_CNTL		0x264
+
+#define HHI_MPLL_CNTL			0x280
+#define HHI_MPLL_CNTL2			0x284
+#define HHI_MPLL_CNTL3			0x288
+#define HHI_MPLL_CNTL4			0x28C
+#define HHI_MPLL_CNTL5			0x290
+#define HHI_MPLL_CNTL6			0x294
+#define HHI_MPLL_CNTL7			0x298
+#define HHI_MPLL_CNTL8			0x29C
+#define HHI_MPLL_CNTL9			0x2A0
+#define HHI_MPLL_CNTL10			0x2A4
+
+#define HHI_MPLL3_CNTL0			0x2E0
+#define HHI_MPLL3_CNTL1			0x2E4
+#define HHI_PLL_TOP_MISC		0x2E8
+
+#define HHI_SYS_PLL_CNTL1		0x2FC
+#define HHI_SYS_PLL_CNTL		0x300
+#define HHI_SYS_PLL_CNTL2		0x304
+#define HHI_SYS_PLL_CNTL3		0x308
+#define HHI_SYS_PLL_CNTL4		0x30c
+#define HHI_SYS_PLL_CNTL5		0x310
+#define HHI_SYS_PLL_STS			0x314
+#define HHI_DPLL_TOP_I			0x318
+#define HHI_DPLL_TOP2_I			0x31C
+
+#endif
drivers/clk/Makefile +1 -1
index 821b586..a696245 100644
@@ -9,7 +9,7 @@ obj-$(CONFIG_$(SPL_TPL_)CLK) += clk-uclass.o clk_fixed_rate.o
 obj-y += imx/
 obj-y += tegra/
 obj-$(CONFIG_ARCH_ASPEED) += aspeed/
-obj-$(CONFIG_ARCH_MESON) += clk_meson.o
+obj-$(CONFIG_ARCH_MESON) += clk_meson.o clk_meson_axg.o
 obj-$(CONFIG_ARCH_ROCKCHIP) += rockchip/
 obj-$(CONFIG_ARCH_SOCFPGA) += altera/
 obj-$(CONFIG_CLK_AT91) += at91/
drivers/clk/clk_meson_axg.c new file +316 -0

316 lines not on this page · raw message

Signature · 1 line
2.7.4
#22 lore raw

PATCH 17/19 board: amlogic: add support for S400 board

In reply to Neil Armstrong

The S400 board is the Amlogic AXG SoC reference board including :
- Amlogic A113DX ARM Cortex-A53 quad-core SoC @ 1.2GHz
- 1GB DDR4 SDRAM
- 10/100 Ethernet
- 2 x USB 2.0 Host
- eMMC
- Infrared receiver
- SDIO WiFi Module
- MIPI DSI Connector
- Audio HAT Connector
- PCI-E M.2 Connectors

---
 arch/arm/mach-meson/Kconfig    |   1 +
 board/amlogic/s400/MAINTAINERS |   6 +++
 board/amlogic/s400/Makefile    |   6 +++
 board/amlogic/s400/README      | 110 +++++++++++++++++++++++++++++++++++++++++
 board/amlogic/s400/s400.c      |  33 +++++++++++++
 configs/s400_defconfig         |  38 ++++++++++++++
 6 files changed, 194 insertions(+)
 create mode 100644 board/amlogic/s400/MAINTAINERS
 create mode 100644 board/amlogic/s400/Makefile
 create mode 100644 board/amlogic/s400/README
 create mode 100644 board/amlogic/s400/s400.c
 create mode 100644 configs/s400_defconfig
arch/arm/mach-meson/Kconfig +1 -0
index 7f217fa..deddcc5 100644
@@ -63,6 +63,7 @@ config SYS_BOARD
 	default "odroid-c2" if MESON_GXBB
 	default "p212" if MESON_GXL
 	default "q200" if MESON_GXM
+	default "s400" if MESON_AXG
 	default ""
 	help
 	  This option contains information about board name.
board/amlogic/s400/MAINTAINERS new file +6 -0
new file mode 100644
index 0000000..9ca9836
@@ -0,0 +1,6 @@
+S400
+M:	Neil Armstrong <[email protected]>
+S:	Maintained
+F:	board/amlogic/s400/
+F:	include/configs/s400.h
+F:	configs/s400_defconfig
board/amlogic/s400/Makefile new file +6 -0
new file mode 100644
index 0000000..bf03862
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# (C) Copyright 2016 BayLibre, SAS
+# Author: Neil Armstrong <[email protected]>
+
+obj-y	:= s400.o
board/amlogic/s400/README new file +110 -0

110 lines not on this page · raw message

board/amlogic/s400/s400.c new file +33 -0
new file mode 100644
index 0000000..c2b50f6
@@ -0,0 +1,33 @@
+// 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/axg.h>
+#include <asm/arch/sm.h>
+#include <asm/arch/eth.h>
+#include <asm/arch/mem.h>
+
+int board_init(void)
+{
+	return 0;
+}
+
+int misc_init_r(void)
+{
+	meson_eth_init(PHY_INTERFACE_MODE_RGMII, 0);
+
+	return 0;
+}
+
+int ft_board_setup(void *blob, bd_t *bd)
+{
+	meson_init_reserved_memory(blob);
+
+	return 0;
+}
configs/s400_defconfig new file +38 -0
new file mode 100644
index 0000000..1bd4b71
@@ -0,0 +1,38 @@
+CONFIG_ARM=y
+CONFIG_ARCH_MESON=y
+CONFIG_SYS_TEXT_BASE=0x01000000
+CONFIG_MESON_AXG=y
+CONFIG_DEBUG_UART_BASE=0xff803000
+CONFIG_DEBUG_UART_CLOCK=24000000
+CONFIG_IDENT_STRING=" s400"
+CONFIG_DEBUG_UART=y
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_OF_BOARD_SETUP=y
+CONFIG_MISC_INIT_R=y
+# CONFIG_DISPLAY_CPUINFO is not set
+# CONFIG_DISPLAY_BOARDINFO is not set
+# CONFIG_CMD_BDI is not set
+# CONFIG_CMD_IMI is not set
+CONFIG_CMD_GPIO=y
+# CONFIG_CMD_LOADS is not set
+CONFIG_CMD_MMC=y
+# CONFIG_CMD_SETEXPR is not set
+CONFIG_CMD_REGULATOR=y
+CONFIG_OF_CONTROL=y
+CONFIG_DEFAULT_DEVICE_TREE="meson-axg-s400"
+CONFIG_NET_RANDOM_ETHADDR=y
+CONFIG_DM_GPIO=y
+CONFIG_DM_MMC=y
+CONFIG_MMC_MESON_GX=y
+CONFIG_DM_ETH=y
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_MESON_AXG=y
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_FIXED=y
+CONFIG_DM_RESET=y
+CONFIG_DEBUG_UART_MESON=y
+CONFIG_DEBUG_UART_ANNOUNCE=y
+CONFIG_DEBUG_UART_SKIP_INIT=y
+CONFIG_MESON_SERIAL=y
+CONFIG_OF_LIBFDT_OVERLAY=y
Signature · 1 line
2.7.4
#25 lore raw

PATCH 18/19 ARM: meson: factorize common code out amlogic's boards

In reply to Neil Armstrong

From: Jerome Brunet <[email protected]>

Now we have moved all the Amlogic board support to common generic board code, we can move the identical board_init() and ft_board_setup() functions to weak functions into the board-common mach-meson file.

---
 arch/arm/mach-meson/board-common.c  | 17 +++++++++++++++++
 board/amlogic/odroid-c2/odroid-c2.c | 12 ------------
 board/amlogic/p212/p212.c           | 12 ------------
 board/amlogic/q200/q200.c           | 12 ------------
 board/amlogic/s400/s400.c           | 12 ------------
 5 files changed, 17 insertions(+), 48 deletions(-)
arch/arm/mach-meson/board-common.c +17 -0
index 0446507..249e0d9 100644
@@ -14,6 +14,11 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+__weak int board_init(void)
+{
+	return 0;
+}
+
 int dram_init(void)
 {
 	const fdt64_t *val;
@@ -34,6 +39,18 @@ int dram_init(void)
 	return 0;
 }
 
+__weak int meson_ft_board_setup(void *blob, bd_t *bd)
+{
+	return 0;
+}
+
+int ft_board_setup(void *blob, bd_t *bd)
+{
+	meson_init_reserved_memory(blob);
+
+	return meson_ft_board_setup(blob, bd);
+}
+
 void meson_board_add_reserved_memory(void *fdt, u64 start, u64 size)
 {
 	int ret;
board/amlogic/odroid-c2/odroid-c2.c +0 -12
index d784d6b..62f0f4c 100644
@@ -17,11 +17,6 @@
 #define EFUSE_MAC_OFFSET	52
 #define EFUSE_MAC_SIZE		6
 
-int board_init(void)
-{
-	return 0;
-}
-
 int misc_init_r(void)
 {
 	u8 mac_addr[EFUSE_MAC_SIZE];
@@ -46,10 +41,3 @@ int misc_init_r(void)
 
 	return 0;
 }
-
-int ft_board_setup(void *blob, bd_t *bd)
-{
-	meson_init_reserved_memory(blob);
-
-	return 0;
-}
board/amlogic/p212/p212.c +0 -12
index 33992a2..546c4d9 100644
@@ -18,11 +18,6 @@
 #define EFUSE_MAC_OFFSET	52
 #define EFUSE_MAC_SIZE		6
 
-int board_init(void)
-{
-	return 0;
-}
-
 int misc_init_r(void)
 {
 	u8 mac_addr[EFUSE_MAC_SIZE];
@@ -48,10 +43,3 @@ int misc_init_r(void)
 
 	return 0;
 }
-
-int ft_board_setup(void *blob, bd_t *bd)
-{
-	meson_init_reserved_memory(blob);
-
-	return 0;
-}
board/amlogic/q200/q200.c +0 -12
index b59c11b..6db1b26 100644
@@ -18,11 +18,6 @@
 #define EFUSE_MAC_OFFSET	52
 #define EFUSE_MAC_SIZE		6
 
-int board_init(void)
-{
-	return 0;
-}
-
 int misc_init_r(void)
 {
 	u8 mac_addr[EFUSE_MAC_SIZE];
@@ -53,10 +48,3 @@ int misc_init_r(void)
 
 	return 0;
 }
-
-int ft_board_setup(void *blob, bd_t *bd)
-{
-	meson_init_reserved_memory(blob);
-
-	return 0;
-}
board/amlogic/s400/s400.c +0 -12
index c2b50f6..02a0e92 100644
@@ -13,21 +13,9 @@
 #include <asm/arch/eth.h>
 #include <asm/arch/mem.h>
 
-int board_init(void)
-{
-	return 0;
-}
-
 int misc_init_r(void)
 {
 	meson_eth_init(PHY_INTERFACE_MODE_RGMII, 0);
 
 	return 0;
 }
-
-int ft_board_setup(void *blob, bd_t *bd)
-{
-	meson_init_reserved_memory(blob);
-
-	return 0;
-}
Signature · 1 line
2.7.4
#26 lore raw

PATCH 19/19 ARM: meson: Add boot device discovery

In reply to Neil Armstrong

The Amlogic Meson SoCs ROM supports a boot over USB with a custom protocol.

When no other boot medium are available (or by forcing the USB mode), the ROM sets the primary USB port as device mode and waits for a Host to enumerate.

When enumerated, a custom protocol described at [1] permits writing to memory and execution some specific FIP init code to run the loaded Arm Trusted Firmware BL2 and BL3 staged before running the BL33 stage.

In this mode, we can load different binaries that can be used by U-boot like a script image file.

This adds support for a custom USB boot stage only available when the boot mode is USB and the script file at a pre-defined address is valid. This support was heavily copied from the Sunxi Allwinner FEL U-Boot support.

The tool pyamlboot described at [2], permits using this boot mode on boards exposing the first USB port, either as OTG or Host port.

[1] https://github.com/superna9999/pyamlboot/blob/master/PROTOCOL.md
[2] https://github.com/superna9999/pyamlboot/blob/master/README.md

---
 arch/arm/include/asm/arch-meson/axg.h  |  1 +
 arch/arm/include/asm/arch-meson/boot.h | 20 +++++++++++++++
 arch/arm/include/asm/arch-meson/gx.h   |  1 +
 arch/arm/mach-meson/Kconfig            |  1 +
 arch/arm/mach-meson/board-axg.c        |  6 +++++
 arch/arm/mach-meson/board-common.c     | 45 ++++++++++++++++++++++++++++++++++
 arch/arm/mach-meson/board-gx.c         |  6 +++++
 include/configs/meson64.h              | 13 ++++++++++
 8 files changed, 93 insertions(+)
 create mode 100644 arch/arm/include/asm/arch-meson/boot.h
arch/arm/include/asm/arch-meson/axg.h +1 -0
index 28a38b7..d293f2a 100644
@@ -20,6 +20,7 @@
 #define AXG_AO_SEC_GP_CFG4	AXG_AO_ADDR(0x94)
 #define AXG_AO_SEC_GP_CFG5	AXG_AO_ADDR(0x95)
 
+#define AXG_AO_BOOT_DEVICE	0xF
 #define AXG_AO_MEM_SIZE_MASK	0xFFFF0000
 #define AXG_AO_MEM_SIZE_SHIFT	16
 #define AXG_AO_BL31_RSVMEM_SIZE_MASK	0xFFFF0000
arch/arm/include/asm/arch-meson/boot.h new file +20 -0
new file mode 100644
index 0000000..a90fe55
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (C) 2016 BayLibre, SAS
+ * Author: Neil Armstrong <[email protected]>
+ */
+
+#ifndef __MESON_BOOT_H__
+#define __MESON_BOOT_H__
+
+/* Boot device */
+#define BOOT_DEVICE_RESERVED    0
+#define BOOT_DEVICE_EMMC        1
+#define BOOT_DEVICE_NAND        2
+#define BOOT_DEVICE_SPI         3
+#define BOOT_DEVICE_SD          4
+#define BOOT_DEVICE_USB         5
+
+int meson_get_boot_device(void);
+
+#endif /* __MESON_BOOT_H__ */
arch/arm/include/asm/arch-meson/gx.h +1 -0
index 4bc9475..b781ba9 100644
@@ -21,6 +21,7 @@
 #define GX_AO_SEC_GP_CFG4	GX_AO_ADDR(0x94)
 #define GX_AO_SEC_GP_CFG5	GX_AO_ADDR(0x95)
 
+#define GX_AO_BOOT_DEVICE	0xF
 #define GX_AO_MEM_SIZE_MASK	0xFFFF0000
 #define GX_AO_MEM_SIZE_SHIFT	16
 #define GX_AO_BL31_RSVMEM_SIZE_MASK	0xFFFF0000
arch/arm/mach-meson/Kconfig +1 -0
index deddcc5..11077bc 100644
@@ -8,6 +8,7 @@ config MESON64_COMMON
 	select DM_SERIAL
 	select SYSCON
 	select REGMAP
+	select BOARD_LATE_INIT
 	imply CMD_DM
 
 config MESON_GX
arch/arm/mach-meson/board-axg.c +6 -0
index 014b25d..173905e 100644
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <asm/arch/boot.h>
 #include <asm/arch/eth.h>
 #include <asm/arch/axg.h>
 #include <asm/arch/mem.h>
@@ -15,6 +16,11 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+int meson_get_boot_device(void)
+{
+	return readl(AXG_AO_SEC_GP_CFG0) & AXG_AO_BOOT_DEVICE;
+}
+
 /* Configure the reserved memory zones exported by the secure registers
  * into EFI and DTB reserved memory entries.
  */
arch/arm/mach-meson/board-common.c +45 -0

57 lines not on this page · raw message

arch/arm/mach-meson/board-gx.c +6 -0
index f1397f8..e41552d 100644
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <asm/arch/boot.h>
 #include <asm/arch/eth.h>
 #include <asm/arch/gx.h>
 #include <asm/arch/mem.h>
@@ -15,6 +16,11 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+int meson_get_boot_device(void)
+{
+	return readl(GX_AO_SEC_GP_CFG0) & GX_AO_BOOT_DEVICE;
+}
+
 /* Configure the reserved memory zones exported by the secure registers
  * into EFI and DTB reserved memory entries.
  */
include/configs/meson64.h +13 -0
index f961f43..40ac079 100644
@@ -28,6 +28,18 @@
 #define CONFIG_SYS_LOAD_ADDR		CONFIG_SYS_TEXT_BASE
 #define CONFIG_SYS_BOOTM_LEN		(64 << 20) /* 64 MiB */
 
+/* ROM USB boot support, auto-execute boot.scr@scriptaddr */
+#define BOOTENV_DEV_ROMUSB(devtypeu, devtypel, instance) \
+	"bootcmd_romusb=" \
+		"if test \"${boot_source}\" = \"usb\" && " \
+				"test -n \"${scriptaddr}\"; then " \
+			"echo '(ROM USB boot)'; " \
+			"source ${scriptaddr}; " \
+		"fi\0"
+
+#define BOOTENV_DEV_NAME_ROMUSB(devtypeu, devtypel, instance)	\
+		"romusb "
+
 #ifdef CONFIG_CMD_USB
 #define BOOT_TARGET_DEVICES_USB(func) func(USB, usb, 0)
 #else
@@ -36,6 +48,7 @@
 
 #ifndef BOOT_TARGET_DEVICES
 #define BOOT_TARGET_DEVICES(func) \
+	func(ROMUSB, romusb, na)  \
 	func(MMC, mmc, 0) \
 	func(MMC, mmc, 1) \
 	func(MMC, mmc, 2) \
Signature · 1 line
2.7.4
#11 lore raw

PATCH 10/19 pinctrl: meson: add axg support

In reply to Neil Armstrong
Quoted 9 lines · Neil Armstrong

From: Jerome Brunet <[email protected]>

This adds support for the Amlogic AXG SoC pinctrl and GPIO controller using a specific set of pinctrl functions which differs from the GX SoCs.

---

/cut

drivers/pinctrl/meson/pinctrl-meson-axg-pmx.c line 109

Quoted 6 lines
(quoted diff) +2 -0
+static int meson_axg_gpio_request(struct udevice *dev,
+				  unsigned int offset, const char

*label)

drivers/pinctrl/meson/pinctrl-meson-axg-pmx.c new file +3 -0
+{
+	return meson_axg_pmx_update_function(dev, offset, 0);
+}

Hey Neil,
this should be:

meson_axg_pmx_update_function(dev->parent, offset, 0);

since you want to pass the pinctrl udevice (not the gpio one) otherwise you get a Synchronous Abort when trying to access the pinctrl priv data (and you can crash the board with => gpio input aobus-banks10).

Cheers,

--
Carlo Caione

#12 lore raw

PATCH 10/19 pinctrl: meson: add axg support

In reply to Neil Armstrong
Quoted 8 lines · Neil Armstrong

From: Jerome Brunet <[email protected]>

This adds support for the Amlogic AXG SoC pinctrl and GPIO controller using a specific set of pinctrl functions which differs from the GX SoCs.

/cut

drivers/pinctrl/meson/pinctrl-meson-axg.c line 952

Quoted 7 lines
drivers/pinctrl/meson/pinctrl-meson-axg.c new file +7 -0
+struct meson_pinctrl_data meson_axg_aobus_pinctrl_data = {
+	.name		= "aobus-banks",
+	.pin_base	= 0,
+	.groups		= meson_axg_aobus_groups,
+	.funcs		= meson_axg_aobus_functions,
+	.banks		= meson_axg_aobus_banks,
+	.num_pins	= 11,

Should this be 14?

--
Carlo Caione

#23 lore raw

PATCH 17/19 board: amlogic: add support for S400 board

In reply to Neil Armstrong

Hi Neil,

Quoted 149 lines · Neil Armstrong

The S400 board is the Amlogic AXG SoC reference board including :
- Amlogic A113DX ARM Cortex-A53 quad-core SoC @ 1.2GHz
- 1GB DDR4 SDRAM
- 10/100 Ethernet
- 2 x USB 2.0 Host
- eMMC
- Infrared receiver
- SDIO WiFi Module
- MIPI DSI Connector
- Audio HAT Connector
- PCI-E M.2 Connectors

---
 arch/arm/mach-meson/Kconfig    |   1 +
 board/amlogic/s400/MAINTAINERS |   6 +++
 board/amlogic/s400/Makefile    |   6 +++
 board/amlogic/s400/README      | 110 +++++++++++++++++++++++++++++++++++++++++
 board/amlogic/s400/s400.c      |  33 +++++++++++++
 configs/s400_defconfig         |  38 ++++++++++++++
 6 files changed, 194 insertions(+)
 create mode 100644 board/amlogic/s400/MAINTAINERS
 create mode 100644 board/amlogic/s400/Makefile
 create mode 100644 board/amlogic/s400/README
 create mode 100644 board/amlogic/s400/s400.c
 create mode 100644 configs/s400_defconfig
arch/arm/mach-meson/Kconfig +1 -0
index 7f217fa..deddcc5 100644
@@ -63,6 +63,7 @@ config SYS_BOARD
 	default "odroid-c2" if MESON_GXBB
 	default "p212" if MESON_GXL
 	default "q200" if MESON_GXM
+	default "s400" if MESON_AXG
 	default ""
 	help
 	  This option contains information about board name.
board/amlogic/s400/MAINTAINERS new file +6 -0
new file mode 100644
index 0000000..9ca9836
@@ -0,0 +1,6 @@
+S400
+M:	Neil Armstrong <[email protected]>
+S:	Maintained
+F:	board/amlogic/s400/
+F:	include/configs/s400.h
+F:	configs/s400_defconfig
board/amlogic/s400/Makefile new file +6 -0
new file mode 100644
index 0000000..bf03862
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# (C) Copyright 2016 BayLibre, SAS
+# Author: Neil Armstrong <[email protected]>
+
+obj-y	:= s400.o
board/amlogic/s400/README new file +79 -0
new file mode 100644
index 0000000..29ccf2d
@@ -0,0 +1,110 @@
+U-Boot for Amlogic S400
+=======================
+
+S400 is a reference board manufactured by Amlogic with the following
+specifications:
+
+ - Amlogic A113DX ARM Cortex-A53 quad-core SoC @ 1.2GHz
+ - 1GB DDR4 SDRAM
+ - 10/100 Ethernet
+ - 2 x USB 2.0 Host
+ - eMMC
+ - Infrared receiver
+ - SDIO WiFi Module
+ - MIPI DSI Connector
+ - Audio HAT Connector
+ - PCI-E M.2 Connectors
+
+Schematics are available from Amlogic on demand.
+
+Currently the u-boot port supports the following devices:
+ - serial
+ - eMMC
+ - Ethernet
+ - I2C
+ - Regulators
+ - Reset controller
+ - Clock controller
+ - USB Host
+ - ADC
+
+u-boot compilation
+==================
+
+ > export ARCH=arm
+ > export CROSS_COMPILE=aarch64-none-elf-
+ > make s400_defconfig
+ > make
+
+Image creation
+==============
+
+Amlogic doesn't provide sources for the firmware and for tools needed
+to create the bootloader image, so it is necessary to obtain them from
+the git tree published by the board vendor:
+
+ > wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
+ > wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
+ > tar xvfJ gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
+ > tar xvfJ gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
+ > export PATH=$PWD/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux/bin:$PWD/gcc-linaro-arm-none-eabi-4.8-2013.11_linux/bin:$PATH
+ > git clone https://github.com/BayLibre/u-boot.git -b n-amlogic-openlinux-20170606 amlogic-u-boot
+ > cd amlogic-u-boot
+ > make axg_s400_v1_defconfig
+ > make
+ > export FIPDIR=$PWD/fip
+
+Go back to mainline U-boot source tree then :
+ > mkdir fip
+
+ > cp $FIPDIR/axg/bl2.bin fip/
+ > cp $FIPDIR/axg/acs.bin fip/
+ > cp $FIPDIR/axg/bl21.bin fip/
+ > cp $FIPDIR/axg/bl30.bin fip/
+ > cp $FIPDIR/axg/bl301.bin fip/
+ > cp $FIPDIR/axg/bl31.img fip/
+ > cp u-boot.bin fip/bl33.bin
+
+ > $FIPDIR/blx_fix.sh \
+	fip/bl30.bin \
+	fip/zero_tmp \
+	fip/bl30_zero.bin \
+	fip/bl301.bin \
+	fip/bl301_zero.bin \
+	fip/bl30_new.bin \
+	bl30
+
+ > $FIPDIR/acs_tool.pyc fip/bl2.bin fip/bl2_acs.bin fip/acs.bin 0
+
+ > $FIPDIR/blx_fix.sh \

board/amlogic/s400/README line 89

Quoted 10 lines
board/amlogic/s400/README new file +10 -0
+	fip/bl2_acs.bin \
+	fip/zero_tmp \
+	fip/bl2_zero.bin \
+	fip/bl21.bin \
+	fip/bl21_zero.bin \
+	fip/bl2_new.bin \
+	bl2
+
+ > $FIPDIR/axg/aml_encrypt_axg --bl3sig --input fip/bl30_new.bin \
+	 				--output fip/bl30_new.bin.enc \

I have a git warning because there is a white space between two tabs in that line.

board/amlogic/s400/README line 92

Quoted 3 lines
board/amlogic/s400/README new file +3 -0
+					--level v3 --type bl30
+ > $FIPDIR/axg/aml_encrypt_axg --bl3sig --input fip/bl31.img \
+	 				--output fip/bl31.img.enc \

Same here :)

board/amlogic/s400/README line 95

Quoted 3 lines
board/amlogic/s400/README new file +3 -0
+					--level v3 --type bl31
+ > $FIPDIR/axg/aml_encrypt_axg --bl3sig --input fip/bl33.bin --compress lz4 \
+	 				--output fip/bl33.bin.enc \

Same here :)

board/amlogic/s400/README line 98

Quoted 3 lines
board/amlogic/s400/README new file +3 -0
+					--level v3 --type bl33
+ > $FIPDIR/axg/aml_encrypt_axg --bl2sig --input fip/bl2_new.bin \
+	 				--output fip/bl2.n.bin.sig

And same here :) (the last!)

Quoted 96 lines
board/amlogic/s400/README new file +12 -0
+ > $FIPDIR/axg/aml_encrypt_axg --bootmk \
+		--output fip/u-boot.bin \
+		--bl2 fip/bl2.n.bin.sig \
+		--bl30 fip/bl30_new.bin.enc \
+		--bl31 fip/bl31.img.enc \
+		--bl33 fip/bl33.bin.enc --level v3
+
+and then write the image to SD with:
+
+ > DEV=/dev/your_sd_device
+ > dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=512 skip=1 seek=1
+ > dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=444
board/amlogic/s400/s400.c new file +33 -0
new file mode 100644
index 0000000..c2b50f6
@@ -0,0 +1,33 @@
+// 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/axg.h>
+#include <asm/arch/sm.h>
+#include <asm/arch/eth.h>
+#include <asm/arch/mem.h>
+
+int board_init(void)
+{
+	return 0;
+}
+
+int misc_init_r(void)
+{
+	meson_eth_init(PHY_INTERFACE_MODE_RGMII, 0);
+
+	return 0;
+}
+
+int ft_board_setup(void *blob, bd_t *bd)
+{
+	meson_init_reserved_memory(blob);
+
+	return 0;
+}
configs/s400_defconfig new file +38 -0
new file mode 100644
index 0000000..1bd4b71
@@ -0,0 +1,38 @@
+CONFIG_ARM=y
+CONFIG_ARCH_MESON=y
+CONFIG_SYS_TEXT_BASE=0x01000000
+CONFIG_MESON_AXG=y
+CONFIG_DEBUG_UART_BASE=0xff803000
+CONFIG_DEBUG_UART_CLOCK=24000000
+CONFIG_IDENT_STRING=" s400"
+CONFIG_DEBUG_UART=y
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_OF_BOARD_SETUP=y
+CONFIG_MISC_INIT_R=y
+# CONFIG_DISPLAY_CPUINFO is not set
+# CONFIG_DISPLAY_BOARDINFO is not set
+# CONFIG_CMD_BDI is not set
+# CONFIG_CMD_IMI is not set
+CONFIG_CMD_GPIO=y
+# CONFIG_CMD_LOADS is not set
+CONFIG_CMD_MMC=y
+# CONFIG_CMD_SETEXPR is not set
+CONFIG_CMD_REGULATOR=y
+CONFIG_OF_CONTROL=y
+CONFIG_DEFAULT_DEVICE_TREE="meson-axg-s400"
+CONFIG_NET_RANDOM_ETHADDR=y
+CONFIG_DM_GPIO=y
+CONFIG_DM_MMC=y
+CONFIG_MMC_MESON_GX=y
+CONFIG_DM_ETH=y
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_MESON_AXG=y
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_FIXED=y
+CONFIG_DM_RESET=y
+CONFIG_DEBUG_UART_MESON=y
+CONFIG_DEBUG_UART_ANNOUNCE=y
+CONFIG_DEBUG_UART_SKIP_INIT=y
+CONFIG_MESON_SERIAL=y
+CONFIG_OF_LIBFDT_OVERLAY=y
Signature · 15 lines
Loic Devulder <[email protected]> | ldevulder at irc
0x175A963893C85F55 | D220 DEF5 56A3 DE00 9DAA 78BA 175A 9638 93C8 5F55
Senior QA Engineer | Container & Storage Solutions Quality Assurance
team (qa-css)
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nuernberg, Germany
GF: F. Imend?rffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB,
21284 (AG Nuernberg)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-amlogic/attachments/20181120/c98bff16/attachment.sig>
#17 lore raw

PATCH 13/19 ARM: meson: rework soc arch file to prepare for new SoC

In reply to Neil Armstrong

Hi Neil,

Quoted 412 lines · Neil Armstrong

From: Jerome Brunet <[email protected]>

We are about to add support for the Amlogic AXG SoC. While very close to the Gx SoC family, we will need to handle a few thing which are different in this SoC. Rework the meson arch directory to prepare for this.

---
 arch/arm/include/asm/arch-meson/clock-gx.h | 117 +++++++++++++++++++++++++
 arch/arm/include/asm/arch-meson/clock.h    | 117 -------------------------
 arch/arm/include/asm/arch-meson/eth.h      |   6 +-
 arch/arm/include/asm/arch-meson/mem.h      |   3 +-
 arch/arm/mach-meson/Kconfig                |  10 ++-
 arch/arm/mach-meson/Makefile               |   3 +-
 arch/arm/mach-meson/board-common.c         |  56 ++++++++++++
 arch/arm/mach-meson/board-gx.c             | 132 +++++++++++++++++++++++++++++
 arch/arm/mach-meson/board.c                | 130 ----------------------------
 arch/arm/mach-meson/eth.c                  |  53 ------------
 arch/arm/mach-meson/sm.c                   |   1 -
 board/amlogic/odroid-c2/odroid-c2.c        |   6 +-
 board/amlogic/p212/p212.c                  |   6 +-
 board/amlogic/q200/q200.c                  |   4 +-
 drivers/clk/clk_meson.c                    |   2 +-
 15 files changed, 328 insertions(+), 318 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-meson/clock-gx.h
 delete mode 100644 arch/arm/include/asm/arch-meson/clock.h
 create mode 100644 arch/arm/mach-meson/board-common.c
 create mode 100644 arch/arm/mach-meson/board-gx.c
 delete mode 100644 arch/arm/mach-meson/board.c
 delete mode 100644 arch/arm/mach-meson/eth.c
arch/arm/include/asm/arch-meson/clock-gx.h new file +117 -0
new file mode 100644
index 0000000..13a2e76
@@ -0,0 +1,117 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright 2016 - AmLogic, Inc.
+ * Copyright 2018 - Beniamino Galvani <[email protected]>
+ */
+#ifndef _ARCH_MESON_CLOCK_GX_H_
+#define _ARCH_MESON_CLOCK_GX_H_
+
+/*
+ * Clock controller register offsets
+ *
+ * Register offsets from the data sheet are listed in comment blocks below.
+ * Those offsets must be multiplied by 4 before adding them to the base address
+ * to get the right value
+ */
+#define SCR				0x2C /* 0x0b offset in data sheet */
+#define TIMEOUT_VALUE			0x3c /* 0x0f offset in data sheet */
+
+#define HHI_GP0_PLL_CNTL		0x40 /* 0x10 offset in data sheet */
+#define HHI_GP0_PLL_CNTL2		0x44 /* 0x11 offset in data sheet */
+#define HHI_GP0_PLL_CNTL3		0x48 /* 0x12 offset in data sheet */
+#define HHI_GP0_PLL_CNTL4		0x4c /* 0x13 offset in data sheet */
+#define	HHI_GP0_PLL_CNTL5		0x50 /* 0x14 offset in data sheet */
+#define	HHI_GP0_PLL_CNTL1		0x58 /* 0x16 offset in data sheet */
+
+#define	HHI_XTAL_DIVN_CNTL		0xbc /* 0x2f offset in data sheet */
+#define	HHI_TIMER90K			0xec /* 0x3b offset in data sheet */
+
+#define	HHI_MEM_PD_REG0			0x100 /* 0x40 offset in data sheet */
+#define	HHI_MEM_PD_REG1			0x104 /* 0x41 offset in data sheet */
+#define	HHI_VPU_MEM_PD_REG1		0x108 /* 0x42 offset in data sheet */
+#define	HHI_VIID_CLK_DIV		0x128 /* 0x4a offset in data sheet */
+#define	HHI_VIID_CLK_CNTL		0x12c /* 0x4b offset in data sheet */
+
+#define HHI_GCLK_MPEG0			0x140 /* 0x50 offset in data sheet */
+#define HHI_GCLK_MPEG1			0x144 /* 0x51 offset in data sheet */
+#define HHI_GCLK_MPEG2			0x148 /* 0x52 offset in data sheet */
+#define HHI_GCLK_OTHER			0x150 /* 0x54 offset in data sheet */
+#define HHI_GCLK_AO			0x154 /* 0x55 offset in data sheet */
+#define HHI_SYS_OSCIN_CNTL		0x158 /* 0x56 offset in data sheet */
+#define HHI_SYS_CPU_CLK_CNTL1		0x15c /* 0x57 offset in data sheet */
+#define HHI_SYS_CPU_RESET_CNTL		0x160 /* 0x58 offset in data sheet */
+#define HHI_VID_CLK_DIV			0x164 /* 0x59 offset in data sheet */
+
+#define HHI_MPEG_CLK_CNTL		0x174 /* 0x5d offset in data sheet */
+#define HHI_AUD_CLK_CNTL		0x178 /* 0x5e offset in data sheet */
+#define HHI_VID_CLK_CNTL		0x17c /* 0x5f offset in data sheet */
+#define HHI_AUD_CLK_CNTL2		0x190 /* 0x64 offset in data sheet */
+#define HHI_VID_CLK_CNTL2		0x194 /* 0x65 offset in data sheet */
+#define HHI_SYS_CPU_CLK_CNTL0		0x19c /* 0x67 offset in data sheet */
+#define HHI_VID_PLL_CLK_DIV		0x1a0 /* 0x68 offset in data sheet */
+#define HHI_AUD_CLK_CNTL3		0x1a4 /* 0x69 offset in data sheet */
+#define HHI_MALI_CLK_CNTL		0x1b0 /* 0x6c offset in data sheet */
+#define HHI_VPU_CLK_CNTL		0x1bC /* 0x6f offset in data sheet */
+
+#define HHI_HDMI_CLK_CNTL		0x1CC /* 0x73 offset in data sheet */
+#define HHI_VDEC_CLK_CNTL		0x1E0 /* 0x78 offset in data sheet */
+#define HHI_VDEC2_CLK_CNTL		0x1E4 /* 0x79 offset in data sheet */
+#define HHI_VDEC3_CLK_CNTL		0x1E8 /* 0x7a offset in data sheet */
+#define HHI_VDEC4_CLK_CNTL		0x1EC /* 0x7b offset in data sheet */
+#define HHI_HDCP22_CLK_CNTL		0x1F0 /* 0x7c offset in data sheet */
+#define HHI_VAPBCLK_CNTL		0x1F4 /* 0x7d offset in data sheet */
+
+#define HHI_VPU_CLKB_CNTL		0x20C /* 0x83 offset in data sheet */
+#define HHI_USB_CLK_CNTL		0x220 /* 0x88 offset in data sheet */
+#define HHI_32K_CLK_CNTL		0x224 /* 0x89 offset in data sheet */
+#define HHI_GEN_CLK_CNTL		0x228 /* 0x8a offset in data sheet */
+#define HHI_GEN_CLK_CNTL		0x228 /* 0x8a offset in data sheet */
+
+#define HHI_PCM_CLK_CNTL		0x258 /* 0x96 offset in data sheet */
+#define HHI_NAND_CLK_CNTL		0x25C /* 0x97 offset in data sheet */
+#define HHI_SD_EMMC_CLK_CNTL		0x264 /* 0x99 offset in data sheet */
+
+#define HHI_MPLL_CNTL			0x280 /* 0xa0 offset in data sheet */
+#define HHI_MPLL_CNTL2			0x284 /* 0xa1 offset in data sheet */
+#define HHI_MPLL_CNTL3			0x288 /* 0xa2 offset in data sheet */
+#define HHI_MPLL_CNTL4			0x28C /* 0xa3 offset in data sheet */
+#define HHI_MPLL_CNTL5			0x290 /* 0xa4 offset in data sheet */
+#define HHI_MPLL_CNTL6			0x294 /* 0xa5 offset in data sheet */
+#define HHI_MPLL_CNTL7			0x298 /* 0xa6 offset in data sheet */
+#define HHI_MPLL_CNTL8			0x29C /* 0xa7 offset in data sheet */
+#define HHI_MPLL_CNTL9			0x2A0 /* 0xa8 offset in data sheet */
+#define HHI_MPLL_CNTL10			0x2A4 /* 0xa9 offset in data sheet */
+
+#define HHI_MPLL3_CNTL0			0x2E0 /* 0xb8 offset in data sheet */
+#define HHI_MPLL3_CNTL1			0x2E4 /* 0xb9 offset in data sheet */
+#define HHI_VDAC_CNTL0			0x2F4 /* 0xbd offset in data sheet */
+#define HHI_VDAC_CNTL1			0x2F8 /* 0xbe offset in data sheet */
+
+#define HHI_SYS_PLL_CNTL		0x300 /* 0xc0 offset in data sheet */
+#define HHI_SYS_PLL_CNTL2		0x304 /* 0xc1 offset in data sheet */
+#define HHI_SYS_PLL_CNTL3		0x308 /* 0xc2 offset in data sheet */
+#define HHI_SYS_PLL_CNTL4		0x30c /* 0xc3 offset in data sheet */
+#define HHI_SYS_PLL_CNTL5		0x310 /* 0xc4 offset in data sheet */
+#define HHI_DPLL_TOP_I			0x318 /* 0xc6 offset in data sheet */
+#define HHI_DPLL_TOP2_I			0x31C /* 0xc7 offset in data sheet */
+#define HHI_HDMI_PLL_CNTL		0x320 /* 0xc8 offset in data sheet */
+#define HHI_HDMI_PLL_CNTL2		0x324 /* 0xc9 offset in data sheet */
+#define HHI_HDMI_PLL_CNTL3		0x328 /* 0xca offset in data sheet */
+#define HHI_HDMI_PLL_CNTL4		0x32C /* 0xcb offset in data sheet */
+#define HHI_HDMI_PLL_CNTL5		0x330 /* 0xcc offset in data sheet */
+#define HHI_HDMI_PLL_CNTL6		0x334 /* 0xcd offset in data sheet */
+#define HHI_HDMI_PLL_CNTL_I		0x338 /* 0xce offset in data sheet */
+#define HHI_HDMI_PLL_CNTL7		0x33C /* 0xcf offset in data sheet */
+
+#define HHI_HDMI_PHY_CNTL0		0x3A0 /* 0xe8 offset in data sheet */
+#define HHI_HDMI_PHY_CNTL1		0x3A4 /* 0xe9 offset in data sheet */
+#define HHI_HDMI_PHY_CNTL2		0x3A8 /* 0xea offset in data sheet */
+#define HHI_HDMI_PHY_CNTL3		0x3AC /* 0xeb offset in data sheet */
+
+#define HHI_VID_LOCK_CLK_CNTL		0x3C8 /* 0xf2 offset in data sheet */
+#define HHI_BT656_CLK_CNTL		0x3D4 /* 0xf5 offset in data sheet */
+#define HHI_SAR_CLK_CNTL		0x3D8 /* 0xf6 offset in data sheet */
+
+ulong meson_measure_clk_rate(unsigned int clk);
+
+#endif
arch/arm/include/asm/arch-meson/clock.h deleted +0 -117
deleted file mode 100644
index c0ff00f..0000000
@@ -1,117 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * Copyright 2016 - AmLogic, Inc.
- * Copyright 2018 - Beniamino Galvani <[email protected]>
- */
-#ifndef _ARCH_MESON_CLOCK_H_
-#define _ARCH_MESON_CLOCK_H_
-
-/*
- * Clock controller register offsets
- *
- * Register offsets from the data sheet are listed in comment blocks below.
- * Those offsets must be multiplied by 4 before adding them to the base address
- * to get the right value
- */
-#define SCR				0x2C /* 0x0b offset in data sheet */
-#define TIMEOUT_VALUE			0x3c /* 0x0f offset in data sheet */
-
-#define HHI_GP0_PLL_CNTL		0x40 /* 0x10 offset in data sheet */
-#define HHI_GP0_PLL_CNTL2		0x44 /* 0x11 offset in data sheet */
-#define HHI_GP0_PLL_CNTL3		0x48 /* 0x12 offset in data sheet */
-#define HHI_GP0_PLL_CNTL4		0x4c /* 0x13 offset in data sheet */
-#define	HHI_GP0_PLL_CNTL5		0x50 /* 0x14 offset in data sheet */
-#define	HHI_GP0_PLL_CNTL1		0x58 /* 0x16 offset in data sheet */
-
-#define	HHI_XTAL_DIVN_CNTL		0xbc /* 0x2f offset in data sheet */
-#define	HHI_TIMER90K			0xec /* 0x3b offset in data sheet */
-
-#define	HHI_MEM_PD_REG0			0x100 /* 0x40 offset in data sheet */
-#define	HHI_MEM_PD_REG1			0x104 /* 0x41 offset in data sheet */
-#define	HHI_VPU_MEM_PD_REG1		0x108 /* 0x42 offset in data sheet */
-#define	HHI_VIID_CLK_DIV		0x128 /* 0x4a offset in data sheet */
-#define	HHI_VIID_CLK_CNTL		0x12c /* 0x4b offset in data sheet */
-
-#define HHI_GCLK_MPEG0			0x140 /* 0x50 offset in data sheet */
-#define HHI_GCLK_MPEG1			0x144 /* 0x51 offset in data sheet */
-#define HHI_GCLK_MPEG2			0x148 /* 0x52 offset in data sheet */
-#define HHI_GCLK_OTHER			0x150 /* 0x54 offset in data sheet */
-#define HHI_GCLK_AO			0x154 /* 0x55 offset in data sheet */
-#define HHI_SYS_OSCIN_CNTL		0x158 /* 0x56 offset in data sheet */
-#define HHI_SYS_CPU_CLK_CNTL1		0x15c /* 0x57 offset in data sheet */
-#define HHI_SYS_CPU_RESET_CNTL		0x160 /* 0x58 offset in data sheet */
-#define HHI_VID_CLK_DIV			0x164 /* 0x59 offset in data sheet */
-
-#define HHI_MPEG_CLK_CNTL		0x174 /* 0x5d offset in data sheet */
-#define HHI_AUD_CLK_CNTL		0x178 /* 0x5e offset in data sheet */
-#define HHI_VID_CLK_CNTL		0x17c /* 0x5f offset in data sheet */
-#define HHI_AUD_CLK_CNTL2		0x190 /* 0x64 offset in data sheet */
-#define HHI_VID_CLK_CNTL2		0x194 /* 0x65 offset in data sheet */
-#define HHI_SYS_CPU_CLK_CNTL0		0x19c /* 0x67 offset in data sheet */
-#define HHI_VID_PLL_CLK_DIV		0x1a0 /* 0x68 offset in data sheet */
-#define HHI_AUD_CLK_CNTL3		0x1a4 /* 0x69 offset in data sheet */
-#define HHI_MALI_CLK_CNTL		0x1b0 /* 0x6c offset in data sheet */
-#define HHI_VPU_CLK_CNTL		0x1bC /* 0x6f offset in data sheet */
-
-#define HHI_HDMI_CLK_CNTL		0x1CC /* 0x73 offset in data sheet */
-#define HHI_VDEC_CLK_CNTL		0x1E0 /* 0x78 offset in data sheet */
-#define HHI_VDEC2_CLK_CNTL		0x1E4 /* 0x79 offset in data sheet */
-#define HHI_VDEC3_CLK_CNTL		0x1E8 /* 0x7a offset in data sheet */
-#define HHI_VDEC4_CLK_CNTL		0x1EC /* 0x7b offset in data sheet */
-#define HHI_HDCP22_CLK_CNTL		0x1F0 /* 0x7c offset in data sheet */
-#define HHI_VAPBCLK_CNTL		0x1F4 /* 0x7d offset in data sheet */
-
-#define HHI_VPU_CLKB_CNTL		0x20C /* 0x83 offset in data sheet */
-#define HHI_USB_CLK_CNTL		0x220 /* 0x88 offset in data sheet */
-#define HHI_32K_CLK_CNTL		0x224 /* 0x89 offset in data sheet */
-#define HHI_GEN_CLK_CNTL		0x228 /* 0x8a offset in data sheet */
-#define HHI_GEN_CLK_CNTL		0x228 /* 0x8a offset in data sheet */
-
-#define HHI_PCM_CLK_CNTL		0x258 /* 0x96 offset in data sheet */
-#define HHI_NAND_CLK_CNTL		0x25C /* 0x97 offset in data sheet */
-#define HHI_SD_EMMC_CLK_CNTL		0x264 /* 0x99 offset in data sheet */
-
-#define HHI_MPLL_CNTL			0x280 /* 0xa0 offset in data sheet */
-#define HHI_MPLL_CNTL2			0x284 /* 0xa1 offset in data sheet */
-#define HHI_MPLL_CNTL3			0x288 /* 0xa2 offset in data sheet */
-#define HHI_MPLL_CNTL4			0x28C /* 0xa3 offset in data sheet */
-#define HHI_MPLL_CNTL5			0x290 /* 0xa4 offset in data sheet */
-#define HHI_MPLL_CNTL6			0x294 /* 0xa5 offset in data sheet */
-#define HHI_MPLL_CNTL7			0x298 /* 0xa6 offset in data sheet */
-#define HHI_MPLL_CNTL8			0x29C /* 0xa7 offset in data sheet */
-#define HHI_MPLL_CNTL9			0x2A0 /* 0xa8 offset in data sheet */
-#define HHI_MPLL_CNTL10			0x2A4 /* 0xa9 offset in data sheet */
-
-#define HHI_MPLL3_CNTL0			0x2E0 /* 0xb8 offset in data sheet */
-#define HHI_MPLL3_CNTL1			0x2E4 /* 0xb9 offset in data sheet */
-#define HHI_VDAC_CNTL0			0x2F4 /* 0xbd offset in data sheet */
-#define HHI_VDAC_CNTL1			0x2F8 /* 0xbe offset in data sheet */
-
-#define HHI_SYS_PLL_CNTL		0x300 /* 0xc0 offset in data sheet */
-#define HHI_SYS_PLL_CNTL2		0x304 /* 0xc1 offset in data sheet */
-#define HHI_SYS_PLL_CNTL3		0x308 /* 0xc2 offset in data sheet */
-#define HHI_SYS_PLL_CNTL4		0x30c /* 0xc3 offset in data sheet */
-#define HHI_SYS_PLL_CNTL5		0x310 /* 0xc4 offset in data sheet */
-#define HHI_DPLL_TOP_I			0x318 /* 0xc6 offset in data sheet */
-#define HHI_DPLL_TOP2_I			0x31C /* 0xc7 offset in data sheet */
-#define HHI_HDMI_PLL_CNTL		0x320 /* 0xc8 offset in data sheet */
-#define HHI_HDMI_PLL_CNTL2		0x324 /* 0xc9 offset in data sheet */
-#define HHI_HDMI_PLL_CNTL3		0x328 /* 0xca offset in data sheet */
-#define HHI_HDMI_PLL_CNTL4		0x32C /* 0xcb offset in data sheet */
-#define HHI_HDMI_PLL_CNTL5		0x330 /* 0xcc offset in data sheet */
-#define HHI_HDMI_PLL_CNTL6		0x334 /* 0xcd offset in data sheet */
-#define HHI_HDMI_PLL_CNTL_I		0x338 /* 0xce offset in data sheet */
-#define HHI_HDMI_PLL_CNTL7		0x33C /* 0xcf offset in data sheet */
-
-#define HHI_HDMI_PHY_CNTL0		0x3A0 /* 0xe8 offset in data sheet */
-#define HHI_HDMI_PHY_CNTL1		0x3A4 /* 0xe9 offset in data sheet */
-#define HHI_HDMI_PHY_CNTL2		0x3A8 /* 0xea offset in data sheet */
-#define HHI_HDMI_PHY_CNTL3		0x3AC /* 0xeb offset in data sheet */
-
-#define HHI_VID_LOCK_CLK_CNTL		0x3C8 /* 0xf2 offset in data sheet */
-#define HHI_BT656_CLK_CNTL		0x3D4 /* 0xf5 offset in data sheet */
-#define HHI_SAR_CLK_CNTL		0x3D8 /* 0xf6 offset in data sheet */
-
-ulong meson_measure_clk_rate(unsigned int clk);
-
-#endif
arch/arm/include/asm/arch-meson/eth.h +3 -3
index 1aa0872..08acc5c 100644
@@ -10,13 +10,13 @@
 #include <phy.h>
 
 enum {
-	/* Use GXL Internal RMII PHY */
-	MESON_GXL_USE_INTERNAL_RMII_PHY = 1,
+	/* Use Internal RMII PHY */
+	MESON_USE_INTERNAL_RMII_PHY = 1,
 };
 
 /* Configure the Ethernet MAC with the requested interface mode
  * with some optional flags.
  */
-void meson_gx_eth_init(phy_interface_t mode, unsigned int flags);
+void meson_eth_init(phy_interface_t mode, unsigned int flags);
 
 #endif /* __MESON_ETH_H__ */
arch/arm/include/asm/arch-meson/mem.h +2 -1
index 6281833..a65100a 100644
@@ -10,6 +10,7 @@
 /* Configure the reserved memory zones exported by the secure registers
  * into EFI and DTB reserved memory entries.
  */
-void meson_gx_init_reserved_memory(void *fdt);
+void meson_board_add_reserved_memory(void *fdt, u64 start, u64 size);
+void meson_init_reserved_memory(void *fdt);
 
 #endif /* __MESON_MEM_H__ */
arch/arm/mach-meson/Kconfig +7 -3
index 6f60167..6225417 100644
@@ -8,25 +8,29 @@ config MESON64_COMMON
 	select DM_SERIAL
 	imply CMD_DM
 
+config MESON_GX
+	bool
+	select MESON64_COMMON
+
 choice
 	prompt "Platform select"
 	default MESON_GXBB
 
 config MESON_GXBB
 	bool "GXBB"
-	select MESON64_COMMON
+	select MESON_GX
 	help
 	  Select this if your SoC is an S905
 
 config MESON_GXL
 	bool "GXL"
-	select MESON64_COMMON
+	select MESON_GX
 	help
 	  Select this if your SoC is an S905X/D or S805X
 
 config MESON_GXM
 	bool "GXM"
-	select MESON64_COMMON
+	select MESON_GX
 	help
 	  Select this if your SoC is an S912
 
arch/arm/mach-meson/Makefile +2 -1
index 8ad9b3e..78345b4 100644
@@ -2,4 +2,5 @@
 #
 # Copyright (c) 2016 Beniamino Galvani <[email protected]>
 
-obj-y += board.o sm.o eth.o
+obj-y += board-common.o sm.o
+obj-$(CONFIG_MESON_GX) += board-gx.o
arch/arm/mach-meson/board-common.c new file +46 -0
new file mode 100644
index 0000000..0446507
@@ -0,0 +1,56 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * (C) Copyright 2016 Beniamino Galvani <[email protected]>
+ */
+
+#include <common.h>
+#include <linux/libfdt.h>
+#include <linux/err.h>
+#include <asm/arch/mem.h>
+#include <asm/arch/sm.h>
+#include <asm/armv8/mmu.h>
+#include <asm/unaligned.h>
+#include <efi_loader.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int dram_init(void)
+{
+	const fdt64_t *val;
+	int offset;
+	int len;
+
+	offset = fdt_path_offset(gd->fdt_blob, "/memory");
+	if (offset < 0)
+		return -EINVAL;
+
+	val = fdt_getprop(gd->fdt_blob, offset, "reg", &len);
+	if (len < sizeof(*val) * 2)
+		return -EINVAL;
+
+	/* Use unaligned access since cache is still disabled */
+	gd->ram_size = get_unaligned_be64(&val[1]);
+
+	return 0;
+}
+
+void meson_board_add_reserved_memory(void *fdt, u64 start, u64 size)
+{
+	int ret;
+
+	ret = fdt_add_mem_rsv(fdt, start, size);
+	if (ret)
+		printf("Could not reserve zone @ 0x%llx\n", start);
+
+	if (IS_ENABLED(CONFIG_EFI_LOADER)) {
+		efi_add_memory_map(start,

arch/arm/mach-meson/board-common.c line 56

Quoted 10 lines
arch/arm/mach-meson/board-common.c new file +10 -0
+				   ALIGN(size, EFI_PAGE_SIZE) >> EFI_PAGE_SHIFT,
+				   EFI_RESERVED_MEMORY_TYPE, false);
+	}
+}
+
+void reset_cpu(ulong addr)
+{
+	psci_system_reset();
+}
+

Also a small warning because of this blank line at EOF.

Quoted 436 lines
arch/arm/mach-meson/board-gx.c new file +132 -0
new file mode 100644
index 0000000..f1397f8
@@ -0,0 +1,132 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * (C) Copyright 2016 Beniamino Galvani <[email protected]>
+ * (C) Copyright 2018 Neil Armstrong <[email protected]>
+ */
+
+#include <common.h>
+#include <asm/arch/eth.h>
+#include <asm/arch/gx.h>
+#include <asm/arch/mem.h>
+#include <asm/io.h>
+#include <asm/armv8/mmu.h>
+#include <linux/sizes.h>
+#include <phy.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/* Configure the reserved memory zones exported by the secure registers
+ * into EFI and DTB reserved memory entries.
+ */
+void meson_init_reserved_memory(void *fdt)
+{
+	u64 bl31_size, bl31_start;
+	u64 bl32_size, bl32_start;
+	u32 reg;
+
+	/*
+	 * Get ARM Trusted Firmware reserved memory zones in :
+	 * - AO_SEC_GP_CFG3: bl32 & bl31 size in KiB, can be 0
+	 * - AO_SEC_GP_CFG5: bl31 physical start address, can be NULL
+	 * - AO_SEC_GP_CFG4: bl32 physical start address, can be NULL
+	 */
+	reg = readl(GX_AO_SEC_GP_CFG3);
+
+	bl31_size = ((reg & GX_AO_BL31_RSVMEM_SIZE_MASK)
+			>> GX_AO_BL31_RSVMEM_SIZE_SHIFT) * SZ_1K;
+	bl32_size = (reg & GX_AO_BL32_RSVMEM_SIZE_MASK) * SZ_1K;
+
+	bl31_start = readl(GX_AO_SEC_GP_CFG5);
+	bl32_start = readl(GX_AO_SEC_GP_CFG4);
+
+	/*
+	 * Early Meson GX Firmware revisions did not provide the reserved
+	 * memory zones in the registers, keep fixed memory zone handling.
+	 */
+	if (IS_ENABLED(CONFIG_MESON_GX) &&
+	    !reg && !bl31_start && !bl32_start) {
+		bl31_start = 0x10000000;
+		bl31_size = 0x200000;
+	}
+
+	/* Add first 16MiB reserved zone */
+	meson_board_add_reserved_memory(fdt, 0, GX_FIRMWARE_MEM_SIZE);
+
+	/* Add BL31 reserved zone */
+	if (bl31_start && bl31_size)
+		meson_board_add_reserved_memory(fdt, bl31_start, bl31_size);
+
+	/* Add BL32 reserved zone */
+	if (bl32_start && bl32_size)
+		meson_board_add_reserved_memory(fdt, bl32_start, bl32_size);
+}
+
+phys_size_t get_effective_memsize(void)
+{
+	/* Size is reported in MiB, convert it in bytes */
+	return ((readl(GX_AO_SEC_GP_CFG0) & GX_AO_MEM_SIZE_MASK)
+			>> GX_AO_MEM_SIZE_SHIFT) * SZ_1M;
+}
+
+static struct mm_region gx_mem_map[] = {
+	{
+		.virt = 0x0UL,
+		.phys = 0x0UL,
+		.size = 0xc0000000UL,
+		.attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
+			 PTE_BLOCK_INNER_SHARE
+	}, {
+		.virt = 0xc0000000UL,
+		.phys = 0xc0000000UL,
+		.size = 0x30000000UL,
+		.attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
+			 PTE_BLOCK_NON_SHARE |
+			 PTE_BLOCK_PXN | PTE_BLOCK_UXN
+	}, {
+		/* List terminator */
+		0,
+	}
+};
+
+struct mm_region *mem_map = gx_mem_map;
+
+/* Configure the Ethernet MAC with the requested interface mode
+ * with some optional flags.
+ */
+void meson_eth_init(phy_interface_t mode, unsigned int flags)
+{
+	switch (mode) {
+	case PHY_INTERFACE_MODE_RGMII:
+	case PHY_INTERFACE_MODE_RGMII_ID:
+	case PHY_INTERFACE_MODE_RGMII_RXID:
+	case PHY_INTERFACE_MODE_RGMII_TXID:
+		/* Set RGMII mode */
+		setbits_le32(GX_ETH_REG_0, GX_ETH_REG_0_PHY_INTF |
+			     GX_ETH_REG_0_TX_PHASE(1) |
+			     GX_ETH_REG_0_TX_RATIO(4) |
+			     GX_ETH_REG_0_PHY_CLK_EN |
+			     GX_ETH_REG_0_CLK_EN);
+		break;
+
+	case PHY_INTERFACE_MODE_RMII:
+		/* Set RMII mode */
+		out_le32(GX_ETH_REG_0, GX_ETH_REG_0_INVERT_RMII_CLK |
+					 GX_ETH_REG_0_CLK_EN);
+
+		/* Use GXL RMII Internal PHY */
+		if (IS_ENABLED(CONFIG_MESON_GXL) &&
+		    (flags & MESON_USE_INTERNAL_RMII_PHY)) {
+			writel(0x10110181, GX_ETH_REG_2);
+			writel(0xe40908ff, GX_ETH_REG_3);
+		}
+
+		break;
+
+	default:
+		printf("Invalid Ethernet interface mode\n");
+		return;
+	}
+
+	/* Enable power gate */
+	clrbits_le32(GX_MEM_PD_REG_0, GX_MEM_PD_REG_0_ETH_MASK);
+}
arch/arm/mach-meson/board.c deleted +0 -130
deleted file mode 100644
index d6c6253..0000000
@@ -1,130 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * (C) Copyright 2016 Beniamino Galvani <[email protected]>
- */
-
-#include <common.h>
-#include <linux/libfdt.h>
-#include <linux/err.h>
-#include <asm/arch/gx.h>
-#include <asm/arch/sm.h>
-#include <asm/armv8/mmu.h>
-#include <asm/unaligned.h>
-#include <linux/sizes.h>
-#include <efi_loader.h>
-#include <asm/io.h>
-
-DECLARE_GLOBAL_DATA_PTR;
-
-int dram_init(void)
-{
-	const fdt64_t *val;
-	int offset;
-	int len;
-
-	offset = fdt_path_offset(gd->fdt_blob, "/memory");
-	if (offset < 0)
-		return -EINVAL;
-
-	val = fdt_getprop(gd->fdt_blob, offset, "reg", &len);
-	if (len < sizeof(*val) * 2)
-		return -EINVAL;
-
-	/* Use unaligned access since cache is still disabled */
-	gd->ram_size = get_unaligned_be64(&val[1]);
-
-	return 0;
-}
-
-phys_size_t get_effective_memsize(void)
-{
-	/* Size is reported in MiB, convert it in bytes */
-	return ((readl(GX_AO_SEC_GP_CFG0) & GX_AO_MEM_SIZE_MASK)
-			>> GX_AO_MEM_SIZE_SHIFT) * SZ_1M;
-}
-
-static void meson_board_add_reserved_memory(void *fdt, u64 start, u64 size)
-{
-	int ret;
-
-	ret = fdt_add_mem_rsv(fdt, start, size);
-	if (ret)
-		printf("Could not reserve zone @ 0x%llx\n", start);
-
-	if (IS_ENABLED(CONFIG_EFI_LOADER)) {
-		efi_add_memory_map(start,
-				   ALIGN(size, EFI_PAGE_SIZE) >> EFI_PAGE_SHIFT,
-				   EFI_RESERVED_MEMORY_TYPE, false);
-	}
-}
-
-void meson_gx_init_reserved_memory(void *fdt)
-{
-	u64 bl31_size, bl31_start;
-	u64 bl32_size, bl32_start;
-	u32 reg;
-
-	/*
-	 * Get ARM Trusted Firmware reserved memory zones in :
-	 * - AO_SEC_GP_CFG3: bl32 & bl31 size in KiB, can be 0
-	 * - AO_SEC_GP_CFG5: bl31 physical start address, can be NULL
-	 * - AO_SEC_GP_CFG4: bl32 physical start address, can be NULL
-	 */
-
-	reg = readl(GX_AO_SEC_GP_CFG3);
-
-	bl31_size = ((reg & GX_AO_BL31_RSVMEM_SIZE_MASK)
-			>> GX_AO_BL31_RSVMEM_SIZE_SHIFT) * SZ_1K;
-	bl32_size = (reg & GX_AO_BL32_RSVMEM_SIZE_MASK) * SZ_1K;
-
-	bl31_start = readl(GX_AO_SEC_GP_CFG5);
-	bl32_start = readl(GX_AO_SEC_GP_CFG4);
-
-	/*
-	 * Early Meson GX Firmware revisions did not provide the reserved
-	 * memory zones in the registers, keep fixed memory zone handling.
-	 */
-	if (IS_ENABLED(CONFIG_MESON_GX) &&
-	    !reg && !bl31_start && !bl32_start) {
-		bl31_start = 0x10000000;
-		bl31_size = 0x200000;
-	}
-
-	/* Add first 16MiB reserved zone */
-	meson_board_add_reserved_memory(fdt, 0, GX_FIRMWARE_MEM_SIZE);
-
-	/* Add BL31 reserved zone */
-	if (bl31_start && bl31_size)
-		meson_board_add_reserved_memory(fdt, bl31_start, bl31_size);
-
-	/* Add BL32 reserved zone */
-	if (bl32_start && bl32_size)
-		meson_board_add_reserved_memory(fdt, bl32_start, bl32_size);
-}
-
-void reset_cpu(ulong addr)
-{
-	psci_system_reset();
-}
-
-static struct mm_region gx_mem_map[] = {
-	{
-		.virt = 0x0UL,
-		.phys = 0x0UL,
-		.size = 0xc0000000UL,
-		.attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
-			 PTE_BLOCK_INNER_SHARE
-	}, {
-		.virt = 0xc0000000UL,
-		.phys = 0xc0000000UL,
-		.size = 0x30000000UL,
-		.attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
-			 PTE_BLOCK_NON_SHARE |
-			 PTE_BLOCK_PXN | PTE_BLOCK_UXN
-	}, {
-		/* List terminator */
-		0,
-	}
-};
-
-struct mm_region *mem_map = gx_mem_map;
arch/arm/mach-meson/eth.c deleted +0 -53
deleted file mode 100644
index 8b28bc8..0000000
@@ -1,53 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Copyright (C) 2016 BayLibre, SAS
- * Author: Neil Armstrong <[email protected]>
- */
-
-#include <common.h>
-#include <dm.h>
-#include <asm/io.h>
-#include <asm/arch/gx.h>
-#include <asm/arch/eth.h>
-#include <phy.h>
-
-/* Configure the Ethernet MAC with the requested interface mode
- * with some optional flags.
- */
-void meson_gx_eth_init(phy_interface_t mode, unsigned int flags)
-{
-	switch (mode) {
-	case PHY_INTERFACE_MODE_RGMII:
-	case PHY_INTERFACE_MODE_RGMII_ID:
-	case PHY_INTERFACE_MODE_RGMII_RXID:
-	case PHY_INTERFACE_MODE_RGMII_TXID:
-		/* Set RGMII mode */
-		setbits_le32(GX_ETH_REG_0, GX_ETH_REG_0_PHY_INTF |
-			     GX_ETH_REG_0_TX_PHASE(1) |
-			     GX_ETH_REG_0_TX_RATIO(4) |
-			     GX_ETH_REG_0_PHY_CLK_EN |
-			     GX_ETH_REG_0_CLK_EN);
-		break;
-
-	case PHY_INTERFACE_MODE_RMII:
-		/* Set RMII mode */
-		out_le32(GX_ETH_REG_0, GX_ETH_REG_0_INVERT_RMII_CLK |
-					 GX_ETH_REG_0_CLK_EN);
-
-		/* Use GXL RMII Internal PHY */
-		if (IS_ENABLED(CONFIG_MESON_GXL) &&
-		    (flags & MESON_GXL_USE_INTERNAL_RMII_PHY)) {
-			writel(0x10110181, GX_ETH_REG_2);
-			writel(0xe40908ff, GX_ETH_REG_3);
-		}
-
-		break;
-
-	default:
-		printf("Invalid Ethernet interface mode\n");
-		return;
-	}
-
-	/* Enable power gate */
-	clrbits_le32(GX_MEM_PD_REG_0, GX_MEM_PD_REG_0_ETH_MASK);
-}
arch/arm/mach-meson/sm.c +0 -1
index 0bba5e4..a07b468 100644
@@ -6,7 +6,6 @@
  */
 
 #include <common.h>
-#include <asm/arch/gx.h>
 #include <linux/kernel.h>
 
 #define FN_GET_SHARE_MEM_INPUT_BASE	0x82000020
board/amlogic/odroid-c2/odroid-c2.c +3 -3
index 2a2755c..d784d6b 100644
@@ -28,7 +28,7 @@ int misc_init_r(void)
 	char serial[EFUSE_SN_SIZE];
 	ssize_t len;
 
-	meson_gx_eth_init(PHY_INTERFACE_MODE_RGMII, 0);
+	meson_eth_init(PHY_INTERFACE_MODE_RGMII, 0);
 
 	if (!eth_env_get_enetaddr("ethaddr", mac_addr)) {
 		len = meson_sm_read_efuse(EFUSE_MAC_OFFSET,
@@ -40,7 +40,7 @@ int misc_init_r(void)
 	if (!env_get("serial#")) {
 		len = meson_sm_read_efuse(EFUSE_SN_OFFSET, serial,
 			EFUSE_SN_SIZE);
-		if (len == EFUSE_SN_SIZE) 
+		if (len == EFUSE_SN_SIZE)
 			env_set("serial#", serial);
 	}
 
@@ -49,7 +49,7 @@ int misc_init_r(void)
 
 int ft_board_setup(void *blob, bd_t *bd)
 {
-	meson_gx_init_reserved_memory(blob);
+	meson_init_reserved_memory(blob);
 
 	return 0;
 }
board/amlogic/p212/p212.c +3 -3
index 00e07d7..33992a2 100644
@@ -29,8 +29,8 @@ int misc_init_r(void)
 	char serial[EFUSE_SN_SIZE];
 	ssize_t len;
 
-	meson_gx_eth_init(PHY_INTERFACE_MODE_RMII,
-			  MESON_GXL_USE_INTERNAL_RMII_PHY);
+	meson_eth_init(PHY_INTERFACE_MODE_RMII,
+		       MESON_USE_INTERNAL_RMII_PHY);
 
 	if (!eth_env_get_enetaddr("ethaddr", mac_addr)) {
 		len = meson_sm_read_efuse(EFUSE_MAC_OFFSET,
@@ -51,7 +51,7 @@ int misc_init_r(void)
 
 int ft_board_setup(void *blob, bd_t *bd)
 {
-	meson_gx_init_reserved_memory(blob);
+	meson_init_reserved_memory(blob);
 
 	return 0;
 }
board/amlogic/q200/q200.c +2 -2
index ff56569..b59c11b 100644
@@ -29,7 +29,7 @@ int misc_init_r(void)
 	char serial[EFUSE_SN_SIZE];
 	ssize_t len;
 
-	meson_gx_eth_init(PHY_INTERFACE_MODE_RGMII, 0);
+	meson_eth_init(PHY_INTERFACE_MODE_RGMII, 0);
 
 	/* Reset PHY on GPIOZ_14 */
 	clrbits_le32(GX_GPIO_EN(3), BIT(14));
@@ -56,7 +56,7 @@ int misc_init_r(void)
 
 int ft_board_setup(void *blob, bd_t *bd)
 {
-	meson_gx_init_reserved_memory(blob);
+	meson_init_reserved_memory(blob);
 
 	return 0;
 }
drivers/clk/clk_meson.c +1 -1
index 87e959e..978f646 100644
@@ -6,7 +6,7 @@
  */
 
 #include <common.h>
-#include <asm/arch/clock.h>
+#include <asm/arch/clock-gx.h>
 #include <asm/io.h>
 #include <clk-uclass.h>
 #include <div64.h>
Signature · 15 lines
Loic Devulder <[email protected]> | ldevulder at irc
0x175A963893C85F55 | D220 DEF5 56A3 DE00 9DAA 78BA 175A 9638 93C8 5F55
Senior QA Engineer | Container & Storage Solutions Quality Assurance
team (qa-css)
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nuernberg, Germany
GF: F. Imend?rffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB,
21284 (AG Nuernberg)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-amlogic/attachments/20181120/fc81a5af/attachment.sig>
#24 lore raw

PATCH 17/19 board: amlogic: add support for S400 board

In reply to Loic Devulder

Hi Loic,

Quoted 18 lines · Loic Devulder

Hi Neil,

Quoted 15 lines · Neil Armstrong

The S400 board is the Amlogic AXG SoC reference board including :
- Amlogic A113DX ARM Cortex-A53 quad-core SoC @ 1.2GHz
- 1GB DDR4 SDRAM
- 10/100 Ethernet
- 2 x USB 2.0 Host
- eMMC
- Infrared receiver
- SDIO WiFi Module
- MIPI DSI Connector
- Audio HAT Connector
- PCI-E M.2 Connectors

---

[...]

Quoted 24 lines

board/amlogic/s400/README line 89

Quoted 3 lines
board/amlogic/s400/README new file +3 -0
+
+ > $FIPDIR/axg/aml_encrypt_axg --bl3sig --input fip/bl30_new.bin \
+	 				--output fip/bl30_new.bin.enc \

I have a git warning because there is a white space between two tabs in that line.

board/amlogic/s400/README line 92

Quoted 3 lines
board/amlogic/s400/README new file +3 -0
+					--level v3 --type bl30
+ > $FIPDIR/axg/aml_encrypt_axg --bl3sig --input fip/bl31.img \
+	 				--output fip/bl31.img.enc \

Same here :)

board/amlogic/s400/README line 95

Quoted 3 lines
board/amlogic/s400/README new file +3 -0
+					--level v3 --type bl31
+ > $FIPDIR/axg/aml_encrypt_axg --bl3sig --input fip/bl33.bin --compress lz4 \
+	 				--output fip/bl33.bin.enc \

Same here :)

board/amlogic/s400/README line 98

Quoted 3 lines
board/amlogic/s400/README new file +3 -0
+					--level v3 --type bl33
+ > $FIPDIR/axg/aml_encrypt_axg --bl2sig --input fip/bl2_new.bin \
+	 				--output fip/bl2.n.bin.sig

And same here :) (the last!)

Quoted 7 lines

board/amlogic/s400/README line 105

Quoted 7 lines

+ > $FIPDIR/axg/aml_encrypt_axg --bootmk \

board/amlogic/s400/README new file +6 -0
+		--output fip/u-boot.bin \
+		--bl2 fip/bl2.n.bin.sig \
+		--bl30 fip/bl30_new.bin.enc \
+		--bl31 fip/bl31.img.enc \
+		--bl33 fip/bl33.bin.enc --level v3
+

[...]

Will fix all these, thanks !

Neil

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-amlogic/attachments/20181121/8f8a260a/attachment.sig>

#18 lore raw

PATCH 13/19 ARM: meson: rework soc arch file to prepare for new SoC

In reply to Loic Devulder

Hi Loic,

Quoted 12 lines · Loic Devulder

Hi Neil,

Quoted 9 lines · Neil Armstrong

From: Jerome Brunet <[email protected]>

We are about to add support for the Amlogic AXG SoC. While very close to the Gx SoC family, we will need to handle a few thing which are different in this SoC. Rework the meson arch directory to prepare for this.

---

[...]

Quoted 56 lines
Quoted 56 lines
arch/arm/mach-meson/board-common.c new file +50 -0
new file mode 100644
index 0000000..0446507
@@ -0,0 +1,56 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * (C) Copyright 2016 Beniamino Galvani <[email protected]>
+ */
+
+#include <common.h>
+#include <linux/libfdt.h>
+#include <linux/err.h>
+#include <asm/arch/mem.h>
+#include <asm/arch/sm.h>
+#include <asm/armv8/mmu.h>
+#include <asm/unaligned.h>
+#include <efi_loader.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int dram_init(void)
+{
+	const fdt64_t *val;
+	int offset;
+	int len;
+
+	offset = fdt_path_offset(gd->fdt_blob, "/memory");
+	if (offset < 0)
+		return -EINVAL;
+
+	val = fdt_getprop(gd->fdt_blob, offset, "reg", &len);
+	if (len < sizeof(*val) * 2)
+		return -EINVAL;
+
+	/* Use unaligned access since cache is still disabled */
+	gd->ram_size = get_unaligned_be64(&val[1]);
+
+	return 0;
+}
+
+void meson_board_add_reserved_memory(void *fdt, u64 start, u64 size)
+{
+	int ret;
+
+	ret = fdt_add_mem_rsv(fdt, start, size);
+	if (ret)
+		printf("Could not reserve zone @ 0x%llx\n", start);
+
+	if (IS_ENABLED(CONFIG_EFI_LOADER)) {
+		efi_add_memory_map(start,
+				   ALIGN(size, EFI_PAGE_SIZE) >> EFI_PAGE_SHIFT,
+				   EFI_RESERVED_MEMORY_TYPE, false);
+	}
+}
Quoted 8 lines

arch/arm/mach-meson/board-common.c line 56

Quoted 6 lines
arch/arm/mach-meson/board-common.c new file +6 -0
+
+void reset_cpu(ulong addr)
+{
+	psci_system_reset();
+}
+

Also a small warning because of this blank line at EOF.

Will fix in v2, thanks !

Quoted 4 lines

arch/arm/mach-meson/board-gx.c

Quoted 4 lines
arch/arm/mach-meson/board-gx.c new file +0 -0
new file mode 100644
index 0000000..f1397f8

[...]
Neil

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-amlogic/attachments/20181121/5646c5e6/attachment.sig>

#13 lore raw

PATCH 10/19 pinctrl: meson: add axg support

In reply to Carlo Caione

Hi Carlo,

Quoted 21 lines · Carlo Caione
Quoted 8 lines · Neil Armstrong

From: Jerome Brunet <[email protected]>

This adds support for the Amlogic AXG SoC pinctrl and GPIO controller using a specific set of pinctrl functions which differs from the GX SoCs.

/cut

drivers/pinctrl/meson/pinctrl-meson-axg.c line 952

Quoted 7 lines
drivers/pinctrl/meson/pinctrl-meson-axg.c new file +7 -0
+struct meson_pinctrl_data meson_axg_aobus_pinctrl_data = {
+	.name		= "aobus-banks",
+	.pin_base	= 0,
+	.groups		= meson_axg_aobus_groups,
+	.funcs		= meson_axg_aobus_functions,
+	.banks		= meson_axg_aobus_banks,
+	.num_pins	= 11,

Should this be 14?

Quoted 3 lines

--
Carlo Caione

Will fix both errors,

Thanks,
Neil