Skip to contentSkip to conversation

Basic Kontron SMARC-sAL28 board support

PATCH Superseded Michael Walle 2 participants 5 messages Aug 30, 2020 – Sep 7, 2020 Arm (32-bit)

v6 of 9 Superseded Latest is v9 →

lore
Share & tools
lore
#0 lore raw

v6 cover Basic Kontron SMARC-sAL28 board support

Add basic board support for the Kontron SMARC-sAL28 board. Please note, that this board doesn't support TF-a (yet). Therefore, the u-boot SPL is the first code which is run and it has to set up the RAM.

changes since v5:
- moved CONFIG_ENV_OVERWRITE to defconfig. Thanks Kuldeep!

changes since v4:
- dropped "armv8: ls1028a: move FSL_LAYERSCAPE to kconfig" as it is already upstream
- new patch "board: sl28: add board specific nvm command"
- use binman
- sync device trees with linux
- use "<devicetree>-u-boot.dtsi" style
- rebase to lastest master

changes since v3:
- rebase to latest master
- use CONFIG_PCI_INIT_R
- set fdtfile in default environment

changes since v2:
- add variant 4 support. Since the atheros PHY dt bindings were merged into master, we can now use them
- add environment section in include/configs/kontron_sl28.h
- add cover letter

changes since v1:
- fix watchdog device tree reference

Michael Walle (2):
board: kontron: add sl28 support
board: sl28: add board specific nvm command

 arch/arm/Kconfig                              |  11 +
 arch/arm/dts/Makefile                         |   3 +
 .../dts/fsl-ls1028a-kontron-sl28-u-boot.dtsi  | 135 +++++++++++++
 .../fsl-ls1028a-kontron-sl28-var3-u-boot.dtsi |   2 +
 .../arm/dts/fsl-ls1028a-kontron-sl28-var3.dts |  15 ++
 .../fsl-ls1028a-kontron-sl28-var4-u-boot.dtsi |   2 +
 .../arm/dts/fsl-ls1028a-kontron-sl28-var4.dts |  48 +++++
 arch/arm/dts/fsl-ls1028a-kontron-sl28.dts     | 189 ++++++++++++++++++
 board/kontron/sl28/Kconfig                    |  18 ++
 board/kontron/sl28/MAINTAINERS                |   6 +
 board/kontron/sl28/Makefile                   |   8 +
 board/kontron/sl28/README                     | 142 +++++++++++++
 board/kontron/sl28/cmds.c                     | 178 +++++++++++++++++
 board/kontron/sl28/common.c                   |  10 +
 board/kontron/sl28/ddr.c                      |  98 +++++++++
 board/kontron/sl28/sl28.c                     |  70 +++++++
 board/kontron/sl28/spl.c                      |  32 +++
 configs/kontron_sl28_defconfig                | 107 ++++++++++
 include/configs/kontron_sl28.h                | 122 +++++++++++
 19 files changed, 1196 insertions(+)
 create mode 100644 arch/arm/dts/fsl-ls1028a-kontron-sl28-u-boot.dtsi
 create mode 100644 arch/arm/dts/fsl-ls1028a-kontron-sl28-var3-u-boot.dtsi
 create mode 100644 arch/arm/dts/fsl-ls1028a-kontron-sl28-var3.dts
 create mode 100644 arch/arm/dts/fsl-ls1028a-kontron-sl28-var4-u-boot.dtsi
 create mode 100644 arch/arm/dts/fsl-ls1028a-kontron-sl28-var4.dts
 create mode 100644 arch/arm/dts/fsl-ls1028a-kontron-sl28.dts
 create mode 100644 board/kontron/sl28/Kconfig
 create mode 100644 board/kontron/sl28/MAINTAINERS
 create mode 100644 board/kontron/sl28/Makefile
 create mode 100644 board/kontron/sl28/README
 create mode 100644 board/kontron/sl28/cmds.c
 create mode 100644 board/kontron/sl28/common.c
 create mode 100644 board/kontron/sl28/ddr.c
 create mode 100644 board/kontron/sl28/sl28.c
 create mode 100644 board/kontron/sl28/spl.c
 create mode 100644 configs/kontron_sl28_defconfig
 create mode 100644 include/configs/kontron_sl28.h
Signature · 1 line
2.20.1
#1 lore raw

PATCH v6 1/2 board: kontron: add sl28 support

Add basic support for the Kontron SMARC-sAL28 board. This includes just the bare minimum to be able to bring up the board and boot linux.

For now, the Single and Dual PHY variant is supported. Other variants will fall back to the basic variant.

In particular, there is no watchdog support for now. This means that you have to disable the default watchdog, otherwise you'll end up in the recovery bootloader. See the board README for details.

---
 arch/arm/Kconfig                              |  11 +
 arch/arm/dts/Makefile                         |   3 +
 .../dts/fsl-ls1028a-kontron-sl28-u-boot.dtsi  | 135 +++++++++++++
 .../fsl-ls1028a-kontron-sl28-var3-u-boot.dtsi |   2 +
 .../arm/dts/fsl-ls1028a-kontron-sl28-var3.dts |  15 ++
 .../fsl-ls1028a-kontron-sl28-var4-u-boot.dtsi |   2 +
 .../arm/dts/fsl-ls1028a-kontron-sl28-var4.dts |  48 +++++
 arch/arm/dts/fsl-ls1028a-kontron-sl28.dts     | 189 ++++++++++++++++++
 board/kontron/sl28/Kconfig                    |  18 ++
 board/kontron/sl28/MAINTAINERS                |   6 +
 board/kontron/sl28/Makefile                   |   8 +
 board/kontron/sl28/README                     |  63 ++++++
 board/kontron/sl28/common.c                   |  10 +
 board/kontron/sl28/ddr.c                      |  98 +++++++++
 board/kontron/sl28/sl28.c                     |  70 +++++++
 board/kontron/sl28/spl.c                      |  32 +++
 configs/kontron_sl28_defconfig                | 107 ++++++++++
 include/configs/kontron_sl28.h                | 122 +++++++++++
 18 files changed, 939 insertions(+)
 create mode 100644 arch/arm/dts/fsl-ls1028a-kontron-sl28-u-boot.dtsi
 create mode 100644 arch/arm/dts/fsl-ls1028a-kontron-sl28-var3-u-boot.dtsi
 create mode 100644 arch/arm/dts/fsl-ls1028a-kontron-sl28-var3.dts
 create mode 100644 arch/arm/dts/fsl-ls1028a-kontron-sl28-var4-u-boot.dtsi
 create mode 100644 arch/arm/dts/fsl-ls1028a-kontron-sl28-var4.dts
 create mode 100644 arch/arm/dts/fsl-ls1028a-kontron-sl28.dts
 create mode 100644 board/kontron/sl28/Kconfig
 create mode 100644 board/kontron/sl28/MAINTAINERS
 create mode 100644 board/kontron/sl28/Makefile
 create mode 100644 board/kontron/sl28/README
 create mode 100644 board/kontron/sl28/common.c
 create mode 100644 board/kontron/sl28/ddr.c
 create mode 100644 board/kontron/sl28/sl28.c
 create mode 100644 board/kontron/sl28/spl.c
 create mode 100644 configs/kontron_sl28_defconfig
 create mode 100644 include/configs/kontron_sl28.h
arch/arm/Kconfig +11 -0
index 80702c23d3..f57d48800d 100644
@@ -1615,6 +1615,16 @@ config TARGET_LS1046AFRWY
 	  development platform that supports the QorIQ LS1046A
 	  Layerscape Architecture processor.
 
+config TARGET_SL28
+	bool "Support sl28"
+	select ARCH_LS1028A
+	select ARM64
+	select ARMV8_MULTIENTRY
+	select SUPPORT_SPL
+	select BINMAN
+	help
+	  Support for Kontron SMARC-sAL28 board.
+
 config TARGET_COLIBRI_PXA270
 	bool "Support colibri_pxa270"
 	select CPU_PXA
@@ -1986,6 +1996,7 @@ source "board/hisilicon/hikey/Kconfig"
 source "board/hisilicon/hikey960/Kconfig"
 source "board/hisilicon/poplar/Kconfig"
 source "board/isee/igep003x/Kconfig"
+source "board/kontron/sl28/Kconfig"
 source "board/myir/mys_6ulx/Kconfig"
 source "board/spear/spear300/Kconfig"
 source "board/spear/spear310/Kconfig"
arch/arm/dts/Makefile +3 -0
index f8f529435b..b45eb6a772 100644
@@ -422,6 +422,9 @@ dtb-$(CONFIG_FSL_LSCH2) += fsl-ls1043a-qds-duart.dtb \
 	fsl-ls1012a-2g5rdb.dtb \
 	fsl-ls1012a-frdm.dtb \
 	fsl-ls1012a-frwy.dtb
+dtb-$(CONFIG_TARGET_SL28) += fsl-ls1028a-kontron-sl28.dtb \
+	fsl-ls1028a-kontron-sl28-var3.dtb \
+	fsl-ls1028a-kontron-sl28-var4.dtb \
 
 dtb-$(CONFIG_TARGET_DRAGONBOARD410C) += dragonboard410c.dtb
 dtb-$(CONFIG_TARGET_DRAGONBOARD820C) += dragonboard820c.dtb
arch/arm/dts/fsl-ls1028a-kontron-sl28-u-boot.dtsi new file +135 -0

135 lines not on this page · raw message

arch/arm/dts/fsl-ls1028a-kontron-sl28-var3-u-boot.dtsi new file +2 -0
new file mode 100644
index 0000000000..79b771e074
@@ -0,0 +1,2 @@
+// SPDX-License-Identifier: GPL-2.0+
+#include "fsl-ls1028a-kontron-sl28-u-boot.dtsi"
arch/arm/dts/fsl-ls1028a-kontron-sl28-var3.dts new file +15 -0
new file mode 100644
index 0000000000..0c8b2af41a
@@ -0,0 +1,15 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Device Tree file for the Kontron SMARC-sAL28 board.
+ *
+ * Copyright (C) 2019 Michael Walle <[email protected]>
+ *
+ */
+
+/dts-v1/;
+#include "fsl-ls1028a-kontron-sl28.dts"
+
+/ {
+	model = "Kontron SMARC-sAL28 (Single PHY)";
+	compatible = "kontron,sl28-var3", "kontron,sl28", "fsl,ls1028a";
+};
arch/arm/dts/fsl-ls1028a-kontron-sl28-var4-u-boot.dtsi new file +2 -0
new file mode 100644
index 0000000000..79b771e074
@@ -0,0 +1,2 @@
+// SPDX-License-Identifier: GPL-2.0+
+#include "fsl-ls1028a-kontron-sl28-u-boot.dtsi"
arch/arm/dts/fsl-ls1028a-kontron-sl28-var4.dts new file +48 -0

48 lines not on this page · raw message

arch/arm/dts/fsl-ls1028a-kontron-sl28.dts new file +189 -0

189 lines not on this page · raw message

board/kontron/sl28/Kconfig new file +18 -0
new file mode 100644
index 0000000000..cdec39be01
@@ -0,0 +1,18 @@
+if TARGET_SL28
+
+config SYS_BOARD
+	default "sl28"
+
+config SYS_VENDOR
+	default "kontron"
+
+config SYS_SOC
+	default "fsl-layerscape"
+
+config SYS_CONFIG_NAME
+	default "kontron_sl28"
+
+config SYS_TEXT_BASE
+	default 0x96000000
+
+endif
board/kontron/sl28/MAINTAINERS new file +6 -0
new file mode 100644
index 0000000000..047a057646
@@ -0,0 +1,6 @@
+Kontron SMARC-sAL28 board
+M:	Michael Walle <[email protected]>
+S:	Maintained
+F:	board/kontron/sl28/
+F:	include/configs/kontron_sl28.h
+F:	configs/kontron_sl28_defconfig
board/kontron/sl28/Makefile new file +8 -0
new file mode 100644
index 0000000000..0f1866c874
@@ -0,0 +1,8 @@
+# SPDX-License-Identifier:	GPL-2.0+
+
+ifndef CONFIG_SPL_BUILD
+obj-y += sl28.o
+endif
+
+obj-y += common.o ddr.o
+obj-$(CONFIG_SPL_BUILD) += spl.o
board/kontron/sl28/README new file +63 -0

63 lines not on this page · raw message

board/kontron/sl28/common.c new file +10 -0
new file mode 100644
index 0000000000..14704f7051
@@ -0,0 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+#include <common.h>
+#include <asm/arch-fsl-layerscape/soc.h>
+
+int board_early_init_f(void)
+{
+	fsl_lsch3_early_init_f();
+	return 0;
+}
board/kontron/sl28/ddr.c new file +98 -0

98 lines not on this page · raw message

board/kontron/sl28/sl28.c new file +70 -0

70 lines not on this page · raw message

board/kontron/sl28/spl.c new file +32 -0
new file mode 100644
index 0000000000..fa5829eee0
@@ -0,0 +1,32 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+#include <common.h>
+#include <asm/io.h>
+#include <asm/spl.h>
+
+#define DCFG_RCWSR25 0x160
+#define GPINFO_HW_VARIANT_MASK 0xff
+
+int sl28_variant(void)
+{
+	return in_le32(DCFG_BASE + DCFG_RCWSR25) & GPINFO_HW_VARIANT_MASK;
+}
+
+int board_fit_config_name_match(const char *name)
+{
+	int variant = sl28_variant();
+
+	switch (variant) {
+	case 3:
+		return strcmp(name, "fsl-ls1028a-kontron-sl28-var3");
+	case 4:
+		return strcmp(name, "fsl-ls1028a-kontron-sl28-var4");
+	default:
+		return strcmp(name, "fsl-ls1028a-kontron-sl28");
+	}
+}
+
+void board_boot_order(u32 *spl_boot_list)
+{
+	spl_boot_list[0] = BOOT_DEVICE_SPI;
+}
configs/kontron_sl28_defconfig new file +107 -0

107 lines not on this page · raw message

include/configs/kontron_sl28.h new file +122 -0

122 lines not on this page · raw message

Signature · 1 line
2.20.1
#2 lore raw

PATCH v6 1/2 board: kontron: add sl28 support

Quoted 11 lines · Michael Walle

Add basic support for the Kontron SMARC-sAL28 board. This includes just the bare minimum to be able to bring up the board and boot linux.

For now, the Single and Dual PHY variant is supported. Other variants will fall back to the basic variant.

In particular, there is no watchdog support for now. This means that you have to disable the default watchdog, otherwise you'll end up in the recovery bootloader. See the board README for details.

[snip]

board/kontron/sl28/MAINTAINERS line 6

Quoted 12 lines
board/kontron/sl28/MAINTAINERS new file +6 -0
new file mode 100644
index 0000000000..047a057646
@@ -0,0 +1,6 @@
+Kontron SMARC-sAL28 board
+M:	Michael Walle <[email protected]>
+S:	Maintained
+F:	board/kontron/sl28/
+F:	include/configs/kontron_sl28.h
+F:	configs/kontron_sl28_defconfig

You should list the DTS files here too.

[snip]

board/kontron/sl28/README

Quoted 5 lines
board/kontron/sl28/README new file +0 -0
new file mode 100644
index 0000000000..3ddd9aeeb8

This should be rST and in doc/board/ somewhere please.

[snip]

Quoted 6 lines
include/configs/kontron_sl28.h new file +0 -0
new file mode 100644
index 0000000000..a5e3219560

include/configs/kontron_sl28.h line 8

Quoted 8 lines
include/configs/kontron_sl28.h new file +8 -0
@@ -0,0 +1,122 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+
+#ifndef __SL28_H
+#define __SL28_H
+
+#include <asm/arch/stream_id_lsch3.h>
+#include <asm/arch/config.h>
+#include <asm/arch/soc.h>

Do we need these in here?

[snip]

include/configs/kontron_sl28.h line 86

Quoted 5 lines
include/configs/kontron_sl28.h new file +5 -0
+#ifdef CONFIG_SPL_BUILD
+#define CONFIG_SYS_MONITOR_BASE		CONFIG_SPL_TEXT_BASE
+#else
+#define CONFIG_SYS_MONITOR_BASE		CONFIG_SYS_TEXT_BASE
+#endif

I don't like this, but I see it's copied from other layerscapes. Is it really needed?

include/configs/kontron_sl28.h line 98

Quoted 12 lines
include/configs/kontron_sl28.h new file +12 -0
+
+#define CONFIG_SYS_LOAD_ADDR		(CONFIG_SYS_DDR_SDRAM_BASE + 0x10000000)
+
+/* environment */
+#define CONFIG_LOADADDR 0x81000000
+#define ENV_MEM_LAYOUT_SETTINGS \
+	"scriptaddr=0x90000000\0" \
+	"pxefile_addr_r=0x90100000\0" \
+	"kernel_addr_r=" __stringify(CONFIG_LOADADDR) "\0" \
+	"fdt_addr_r=0x83000000\0" \
+	"ramdisk_addr_r=0x83100000\0" \
+	"fdtfile=freescale/fsl-ls1028a-kontron-sl28.dtb\0"

These are too small of a range of kernel/device tree/ramdisk addresses, and there will be overlap/overwrites at some point. I've been pointing people at the big block comment in include/configs/ti_armv7_common.h as it's still correct for minimum sizes for aarch64 as well.

include/configs/kontron_sl28.h line 111

Quoted 12 lines
include/configs/kontron_sl28.h new file +12 -0
+#ifndef CONFIG_SPL_BUILD
+#define BOOT_TARGET_DEVICES(func) \
+	func(MMC, mmc, 1) \
+	func(MMC, mmc, 0) \
+	func(NVME, nvme, 0) \
+	func(USB, usb, 0) \
+	func(DHCP, dhcp, 0) \
+	func(PXE, pxe, 0)
+#include <config_distro_bootcmd.h>
+#else
+#define BOOTENV
+#endif

Is env in SPL enabled? This is another case that I don't really like to see done.

include/configs/kontron_sl28.h line 115

Quoted 3 lines
include/configs/kontron_sl28.h new file +3 -0
+#define CONFIG_EXTRA_ENV_SETTINGS \
+	"fdt_high=0xffffffffffffffff\0" \
+	"initrd_high=0xffffffffffffffff\0" \

You cannot disable fdt relocation by default and you likely shouldn't for initrd. If we would be placing the device tree outside of visible to the kernel memory use bootm_size to limit relocation but it's so easy to construct real life cases where the device tree is not 8 byte aligned and Linux blows up in non-obvious ways. Thanks.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200831/186f53ec/attachment.sig>
#3 lore raw

PATCH v6 1/2 board: kontron: add sl28 support

Hi Tom,

thanks for the review!

Am 2020-08-31 18:08, schrieb Tom Rini:

Quoted 15 lines · Michael Walle
Quoted 14 lines

Add basic support for the Kontron SMARC-sAL28 board. This includes just
the bare minimum to be able to bring up the board and boot linux.

For now, the Single and Dual PHY variant is supported. Other variants will fall back to the basic variant.

In particular, there is no watchdog support for now. This means that you
have to disable the default watchdog, otherwise you'll end up in the recovery bootloader. See the board README for details.

..

Quoted 9 lines
Quoted 9 lines
include/configs/kontron_sl28.h new file +2 -0
new file mode 100644
index 0000000000..a5e3219560
@@ -0,0 +1,122 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+
Quoted 8 lines

include/configs/kontron_sl28.h line 8

Quoted 6 lines
include/configs/kontron_sl28.h new file +6 -0
+#ifndef __SL28_H
+#define __SL28_H
+
+#include <asm/arch/stream_id_lsch3.h>
+#include <asm/arch/config.h>
+#include <asm/arch/soc.h>

Do we need these in here?

They are included in the ls1028a_common.h, but I cannot include this common
file because its is really just a "common across freescale development boards" file. Therefore, I had to duplicate it here. Removing these includes
results in build errors, eg. DCFG_BASE is undefined etc. I really don't want
to go down that rabbit hole and fixing all the layerscape/freescale stuff.

Quoted 8 lines

include/configs/kontron_sl28.h line 86

Quoted 5 lines
include/configs/kontron_sl28.h new file +5 -0
+#ifdef CONFIG_SPL_BUILD
+#define CONFIG_SYS_MONITOR_BASE		CONFIG_SPL_TEXT_BASE
+#else
+#define CONFIG_SYS_MONITOR_BASE		CONFIG_SYS_TEXT_BASE
+#endif

I don't like this, but I see it's copied from other layerscapes. Is it really needed?

I don't think so. I'll remove it.

Quoted 10 lines
Quoted 10 lines
include/configs/kontron_sl28.h new file +2 -0
+
+#define CONFIG_SYS_LOAD_ADDR		(CONFIG_SYS_DDR_SDRAM_BASE + 

0x10000000)

include/configs/kontron_sl28.h new file +7 -0
+
+/* environment */
+#define CONFIG_LOADADDR 0x81000000
+#define ENV_MEM_LAYOUT_SETTINGS \
+	"scriptaddr=0x90000000\0" \
+	"pxefile_addr_r=0x90100000\0" \
+	"kernel_addr_r=" __stringify(CONFIG_LOADADDR) "\0" \
Quoted 8 lines

include/configs/kontron_sl28.h line 98

Quoted 3 lines
include/configs/kontron_sl28.h new file +3 -0
+	"fdt_addr_r=0x83000000\0" \
+	"ramdisk_addr_r=0x83100000\0" \
+	"fdtfile=freescale/fsl-ls1028a-kontron-sl28.dtb\0"

These are too small of a range of kernel/device tree/ramdisk addresses, and there will be overlap/overwrites at some point. I've been pointing people at the big block comment in include/configs/ti_armv7_common.h as it's still correct for minimum sizes for aarch64 as well.

thanks for pointing that out.

Quoted 8 lines
Quoted 8 lines
include/configs/kontron_sl28.h new file +8 -0
+#ifndef CONFIG_SPL_BUILD
+#define BOOT_TARGET_DEVICES(func) \
+	func(MMC, mmc, 1) \
+	func(MMC, mmc, 0) \
+	func(NVME, nvme, 0) \
+	func(USB, usb, 0) \
+	func(DHCP, dhcp, 0) \
+	func(PXE, pxe, 0)
Quoted 8 lines

include/configs/kontron_sl28.h line 111

Quoted 4 lines
include/configs/kontron_sl28.h new file +4 -0
+#include <config_distro_bootcmd.h>
+#else
+#define BOOTENV
+#endif

Is env in SPL enabled? This is another case that I don't really like to
see done.

No it's not and it seems to build without the else case. IIRC it wasn't building a year ago when I did the original port.

I'll post a new version with your suggested changes, soon.

-michael

#4 lore raw

PATCH v6 2/2 board: sl28: add board specific nvm command

In reply to Michael Walle

The board supports 16 configuration bits which can be manipulated with this command. See the board's README for a detailed explanation on each bit.

---
 board/kontron/sl28/Makefile |   2 +-
 board/kontron/sl28/README   |  79 ++++++++++++++++
 board/kontron/sl28/cmds.c   | 178 ++++++++++++++++++++++++++++++++++++
 3 files changed, 258 insertions(+), 1 deletion(-)
 create mode 100644 board/kontron/sl28/cmds.c
board/kontron/sl28/Makefile +1 -1
index 0f1866c874..74d8012f0f 100644
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier:	GPL-2.0+
 
 ifndef CONFIG_SPL_BUILD
-obj-y += sl28.o
+obj-y += sl28.o cmds.o
 endif
 
 obj-y += common.o ddr.o
board/kontron/sl28/README +79 -0

85 lines not on this page · raw message

board/kontron/sl28/cmds.c new file +178 -0

178 lines not on this page · raw message

Signature · 1 line
2.20.1