[PATCH 0/4] board: sl28: new variants and SATA support

Add support for the last two remaining board variants and add SATA support.
This is intended for the next branch.
Michael Walle (4): board: sl28: move ethernet aliases to variant specific dtsi board: sl28: add network variant 1 support board: sl28: add network variant 2 support board: sl28: add SATA support
arch/arm/dts/Makefile | 2 + .../dts/fsl-ls1028a-kontron-sl28-u-boot.dtsi | 64 +++++++++++++++++-- .../fsl-ls1028a-kontron-sl28-var1-u-boot.dtsi | 8 +++ .../arm/dts/fsl-ls1028a-kontron-sl28-var1.dts | 57 +++++++++++++++++ .../fsl-ls1028a-kontron-sl28-var2-u-boot.dtsi | 2 + .../arm/dts/fsl-ls1028a-kontron-sl28-var2.dts | 25 ++++++++ .../fsl-ls1028a-kontron-sl28-var3-u-boot.dtsi | 6 ++ .../fsl-ls1028a-kontron-sl28-var4-u-boot.dtsi | 7 ++ arch/arm/dts/fsl-ls1028a-kontron-sl28.dts | 4 ++ board/kontron/sl28/Makefile | 2 +- board/kontron/sl28/common.c | 10 --- board/kontron/sl28/sl28.c | 6 ++ board/kontron/sl28/spl.c | 38 +++++++++++ configs/kontron_sl28_defconfig | 1 + include/configs/kontron_sl28.h | 1 + 15 files changed, 215 insertions(+), 18 deletions(-) create mode 100644 arch/arm/dts/fsl-ls1028a-kontron-sl28-var1-u-boot.dtsi create mode 100644 arch/arm/dts/fsl-ls1028a-kontron-sl28-var1.dts create mode 100644 arch/arm/dts/fsl-ls1028a-kontron-sl28-var2-u-boot.dtsi create mode 100644 arch/arm/dts/fsl-ls1028a-kontron-sl28-var2.dts delete mode 100644 board/kontron/sl28/common.c

The variants differ in their network configuration. Move the first two network aliases to the proper variant device tree includes. This is in prepartion for variant 1 and 2 support which has a different network port mapping. The network aliases for the two internal ports will stay in the common dtsi because they are present on all board variants.
This might leave a hole if there is no ethernet1 alias. This is intended.
Signed-off-by: Michael Walle michael@walle.cc --- arch/arm/dts/fsl-ls1028a-kontron-sl28-u-boot.dtsi | 2 -- arch/arm/dts/fsl-ls1028a-kontron-sl28-var3-u-boot.dtsi | 6 ++++++ arch/arm/dts/fsl-ls1028a-kontron-sl28-var4-u-boot.dtsi | 7 +++++++ 3 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/arch/arm/dts/fsl-ls1028a-kontron-sl28-u-boot.dtsi b/arch/arm/dts/fsl-ls1028a-kontron-sl28-u-boot.dtsi index 9b4e0298a7..84e974e84d 100644 --- a/arch/arm/dts/fsl-ls1028a-kontron-sl28-u-boot.dtsi +++ b/arch/arm/dts/fsl-ls1028a-kontron-sl28-u-boot.dtsi @@ -10,8 +10,6 @@ i2c1 = &i2c3; i2c2 = &i2c4; rtc0 = &rtc; - ethernet0 = &enetc0; - ethernet1 = &enetc1; ethernet2 = &enetc2; ethernet3 = &enetc6; }; diff --git a/arch/arm/dts/fsl-ls1028a-kontron-sl28-var3-u-boot.dtsi b/arch/arm/dts/fsl-ls1028a-kontron-sl28-var3-u-boot.dtsi index 79b771e074..879a76415b 100644 --- a/arch/arm/dts/fsl-ls1028a-kontron-sl28-var3-u-boot.dtsi +++ b/arch/arm/dts/fsl-ls1028a-kontron-sl28-var3-u-boot.dtsi @@ -1,2 +1,8 @@ // SPDX-License-Identifier: GPL-2.0+ #include "fsl-ls1028a-kontron-sl28-u-boot.dtsi" + +/ { + aliases { + ethernet0 = &enetc0; + }; +}; diff --git a/arch/arm/dts/fsl-ls1028a-kontron-sl28-var4-u-boot.dtsi b/arch/arm/dts/fsl-ls1028a-kontron-sl28-var4-u-boot.dtsi index 79b771e074..fce4694682 100644 --- a/arch/arm/dts/fsl-ls1028a-kontron-sl28-var4-u-boot.dtsi +++ b/arch/arm/dts/fsl-ls1028a-kontron-sl28-var4-u-boot.dtsi @@ -1,2 +1,9 @@ // SPDX-License-Identifier: GPL-2.0+ #include "fsl-ls1028a-kontron-sl28-u-boot.dtsi" + +/ { + aliases { + ethernet0 = &enetc0; + ethernet1 = &enetc1; + }; +};

This variant has one network port connected via RGMII and doesn't have any TSN capabilities out-of-the-box. Instead it has all four SerDes lanes available for customer use.
Signed-off-by: Michael Walle michael@walle.cc --- arch/arm/dts/Makefile | 1 + .../dts/fsl-ls1028a-kontron-sl28-u-boot.dtsi | 33 ++++++++++- .../fsl-ls1028a-kontron-sl28-var1-u-boot.dtsi | 8 +++ .../arm/dts/fsl-ls1028a-kontron-sl28-var1.dts | 57 +++++++++++++++++++ board/kontron/sl28/spl.c | 2 + 5 files changed, 98 insertions(+), 3 deletions(-) create mode 100644 arch/arm/dts/fsl-ls1028a-kontron-sl28-var1-u-boot.dtsi create mode 100644 arch/arm/dts/fsl-ls1028a-kontron-sl28-var1.dts
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index fd47e408f8..fa57967bb6 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -432,6 +432,7 @@ dtb-$(CONFIG_FSL_LSCH2) += fsl-ls1043a-qds-duart.dtb \ fsl-ls1012a-frdm.dtb \ fsl-ls1012a-frwy.dtb dtb-$(CONFIG_TARGET_SL28) += fsl-ls1028a-kontron-sl28.dtb \ + fsl-ls1028a-kontron-sl28-var1.dtb \ fsl-ls1028a-kontron-sl28-var3.dtb \ fsl-ls1028a-kontron-sl28-var4.dtb \
diff --git a/arch/arm/dts/fsl-ls1028a-kontron-sl28-u-boot.dtsi b/arch/arm/dts/fsl-ls1028a-kontron-sl28-u-boot.dtsi index 84e974e84d..585753c14d 100644 --- a/arch/arm/dts/fsl-ls1028a-kontron-sl28-u-boot.dtsi +++ b/arch/arm/dts/fsl-ls1028a-kontron-sl28-u-boot.dtsi @@ -50,6 +50,17 @@ };
fdt-2 { + description = "fsl-ls1028a-kontron-sl28-var1"; + type = "flat_dt"; + arch = "arm"; + compression = "none"; + + blob { + filename = "arch/arm/dts/fsl-ls1028a-kontron-sl28-var1.dtb"; + }; + }; + + fdt-3 { description = "fsl-ls1028a-kontron-sl28-var3"; type = "flat_dt"; arch = "arm"; @@ -60,7 +71,7 @@ }; };
- fdt-3 { + fdt-4 { description = "fsl-ls1028a-kontron-sl28-var4"; type = "flat_dt"; arch = "arm"; @@ -82,16 +93,23 @@ };
conf-2 { - description = "fsl-ls1028a-kontron-sl28-var3"; + description = "fsl-ls1028a-kontron-sl28-var1"; firmware = "uboot"; fdt = "fdt-2"; };
conf-3 { - description = "fsl-ls1028a-kontron-sl28-var4"; + description = "fsl-ls1028a-kontron-sl28-var3"; firmware = "uboot"; fdt = "fdt-3"; }; + + conf-4 { + description = "fsl-ls1028a-kontron-sl28-var4"; + firmware = "uboot"; + loadables = "uboot"; + fdt = "fdt-4"; + }; }; }; }; @@ -131,6 +149,11 @@ firmware = "bl31"; loadables = "uboot"; }; + + conf-4 { + firmware = "bl31"; + loadables = "uboot"; + }; }; }; }; @@ -167,6 +190,10 @@ conf-3 { loadables = "uboot", "bl32"; }; + + conf-4 { + loadables = "uboot", "bl32"; + }; }; }; }; diff --git a/arch/arm/dts/fsl-ls1028a-kontron-sl28-var1-u-boot.dtsi b/arch/arm/dts/fsl-ls1028a-kontron-sl28-var1-u-boot.dtsi new file mode 100644 index 0000000000..98e8939369 --- /dev/null +++ b/arch/arm/dts/fsl-ls1028a-kontron-sl28-var1-u-boot.dtsi @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0+ +#include "fsl-ls1028a-kontron-sl28-u-boot.dtsi" + +/ { + aliases { + ethernet0 = &enetc1; + }; +}; diff --git a/arch/arm/dts/fsl-ls1028a-kontron-sl28-var1.dts b/arch/arm/dts/fsl-ls1028a-kontron-sl28-var1.dts new file mode 100644 index 0000000000..fe708bdbfa --- /dev/null +++ b/arch/arm/dts/fsl-ls1028a-kontron-sl28-var1.dts @@ -0,0 +1,57 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Device Tree file for the Kontron SMARC-sAL28 board. + * + * This is for the network variant 1 which has one ethernet port. It is + * different than the base variant, which also has one port, but here the + * port is connected via RGMII. This port is not TSN aware. + * None of the four SerDes lanes are used by the module, instead they are + * all led out to the carrier for customer use. + * + * Copyright (C) 2020 Michael Walle michael@walle.cc + * + */ + +/dts-v1/; +#include "fsl-ls1028a-kontron-sl28.dts" +#include <dt-bindings/net/qca-ar803x.h> + +/ { + model = "Kontron SMARC-sAL28 (4 Lanes)"; + compatible = "kontron,sl28-var1", "kontron,sl28", "fsl,ls1028a"; +}; + +&enetc0 { + status = "disabled"; + /delete-property/ phy-handle; +}; + +&enetc1 { + phy-handle = <&phy0>; + phy-mode = "rgmii-id"; + status = "okay"; +}; + +/delete-node/ &phy0; +&mdio0 { + phy0: ethernet-phy@4 { + reg = <0x4>; + eee-broken-1000t; + eee-broken-100tx; + + qca,clk-out-frequency = <125000000>; + qca,clk-out-strength = <AR803X_STRENGTH_FULL>; + + vddio-supply = <&vddh>; + + vddio: vddio-regulator { + regulator-name = "VDDIO"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + }; + + vddh: vddh-regulator { + regulator-name = "VDDH"; + }; + }; +}; diff --git a/board/kontron/sl28/spl.c b/board/kontron/sl28/spl.c index fa5829eee0..92f8342c45 100644 --- a/board/kontron/sl28/spl.c +++ b/board/kontron/sl28/spl.c @@ -17,6 +17,8 @@ int board_fit_config_name_match(const char *name) int variant = sl28_variant();
switch (variant) { + case 1: + return strcmp(name, "fsl-ls1028a-kontron-sl28-var1"); case 3: return strcmp(name, "fsl-ls1028a-kontron-sl28-var3"); case 4:

Although this variant has two external network ports, they are not (yet) supported by the bootloader because they are connected via an internal network switch. Otherwise its the same as the other variants.
Signed-off-by: Michael Walle michael@walle.cc --- arch/arm/dts/Makefile | 1 + .../dts/fsl-ls1028a-kontron-sl28-u-boot.dtsi | 33 +++++++++++++++++-- .../fsl-ls1028a-kontron-sl28-var2-u-boot.dtsi | 2 ++ .../arm/dts/fsl-ls1028a-kontron-sl28-var2.dts | 25 ++++++++++++++ board/kontron/sl28/spl.c | 2 ++ 5 files changed, 60 insertions(+), 3 deletions(-) create mode 100644 arch/arm/dts/fsl-ls1028a-kontron-sl28-var2-u-boot.dtsi create mode 100644 arch/arm/dts/fsl-ls1028a-kontron-sl28-var2.dts
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index fa57967bb6..180300e28d 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -433,6 +433,7 @@ dtb-$(CONFIG_FSL_LSCH2) += fsl-ls1043a-qds-duart.dtb \ fsl-ls1012a-frwy.dtb dtb-$(CONFIG_TARGET_SL28) += fsl-ls1028a-kontron-sl28.dtb \ fsl-ls1028a-kontron-sl28-var1.dtb \ + fsl-ls1028a-kontron-sl28-var2.dtb \ fsl-ls1028a-kontron-sl28-var3.dtb \ fsl-ls1028a-kontron-sl28-var4.dtb \
diff --git a/arch/arm/dts/fsl-ls1028a-kontron-sl28-u-boot.dtsi b/arch/arm/dts/fsl-ls1028a-kontron-sl28-u-boot.dtsi index 585753c14d..240178ab4e 100644 --- a/arch/arm/dts/fsl-ls1028a-kontron-sl28-u-boot.dtsi +++ b/arch/arm/dts/fsl-ls1028a-kontron-sl28-u-boot.dtsi @@ -61,6 +61,17 @@ };
fdt-3 { + description = "fsl-ls1028a-kontron-sl28-var2"; + type = "flat_dt"; + arch = "arm"; + compression = "none"; + + blob { + filename = "arch/arm/dts/fsl-ls1028a-kontron-sl28-var2.dtb"; + }; + }; + + fdt-4 { description = "fsl-ls1028a-kontron-sl28-var3"; type = "flat_dt"; arch = "arm"; @@ -71,7 +82,7 @@ }; };
- fdt-4 { + fdt-5 { description = "fsl-ls1028a-kontron-sl28-var4"; type = "flat_dt"; arch = "arm"; @@ -99,17 +110,24 @@ };
conf-3 { - description = "fsl-ls1028a-kontron-sl28-var3"; + description = "fsl-ls1028a-kontron-sl28-var2"; firmware = "uboot"; fdt = "fdt-3"; };
conf-4 { - description = "fsl-ls1028a-kontron-sl28-var4"; + description = "fsl-ls1028a-kontron-sl28-var3"; firmware = "uboot"; loadables = "uboot"; fdt = "fdt-4"; }; + + conf-5 { + description = "fsl-ls1028a-kontron-sl28-var4"; + firmware = "uboot"; + loadables = "uboot"; + fdt = "fdt-5"; + }; }; }; }; @@ -154,6 +172,11 @@ firmware = "bl31"; loadables = "uboot"; }; + + conf-5 { + firmware = "bl31"; + loadables = "uboot"; + }; }; }; }; @@ -194,6 +217,10 @@ conf-4 { loadables = "uboot", "bl32"; }; + + conf-5 { + loadables = "uboot", "bl32"; + }; }; }; }; diff --git a/arch/arm/dts/fsl-ls1028a-kontron-sl28-var2-u-boot.dtsi b/arch/arm/dts/fsl-ls1028a-kontron-sl28-var2-u-boot.dtsi new file mode 100644 index 0000000000..79b771e074 --- /dev/null +++ b/arch/arm/dts/fsl-ls1028a-kontron-sl28-var2-u-boot.dtsi @@ -0,0 +1,2 @@ +// SPDX-License-Identifier: GPL-2.0+ +#include "fsl-ls1028a-kontron-sl28-u-boot.dtsi" diff --git a/arch/arm/dts/fsl-ls1028a-kontron-sl28-var2.dts b/arch/arm/dts/fsl-ls1028a-kontron-sl28-var2.dts new file mode 100644 index 0000000000..1ea1265bcf --- /dev/null +++ b/arch/arm/dts/fsl-ls1028a-kontron-sl28-var2.dts @@ -0,0 +1,25 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Device Tree file for the Kontron SMARC-sAL28 board. + * + * This is for the network variant 2 which has no ethernet support in the + * bootloader. + * + * Copyright (C) 2020 Michael Walle michael@walle.cc + * + */ + +/dts-v1/; +#include "fsl-ls1028a-kontron-sl28.dts" + +/ { + model = "Kontron SMARC-sAL28 (TSN-on-module)"; + compatible = "kontron,sl28-var2", "kontron,sl28", "fsl,ls1028a"; +}; + +&enetc0 { + status = "disabled"; + /delete-property/ phy-handle; +}; + +/delete-node/ &phy0; diff --git a/board/kontron/sl28/spl.c b/board/kontron/sl28/spl.c index 92f8342c45..0ef67e2886 100644 --- a/board/kontron/sl28/spl.c +++ b/board/kontron/sl28/spl.c @@ -19,6 +19,8 @@ int board_fit_config_name_match(const char *name) switch (variant) { case 1: return strcmp(name, "fsl-ls1028a-kontron-sl28-var1"); + case 2: + return strcmp(name, "fsl-ls1028a-kontron-sl28-var2"); case 3: return strcmp(name, "fsl-ls1028a-kontron-sl28-var3"); case 4:

Enable SATA support. Although not supported by the usual SATA pins on the SMARC baseboard connector, SATA mode is supported on a PCIe lane. This way one can use a mSATA card in a Mini PCI slot.
We need to invert the received data because in this mode the polarity of the SerDes lane is swapped. Provide a fixup in board_early_init_f() for the SPL. board_early_init_f() is then not common between SPL and u-boot proper anymore, thus common.c is removed, as it just contained said function.
Signed-off-by: Michael Walle michael@walle.cc --- arch/arm/dts/fsl-ls1028a-kontron-sl28.dts | 4 +++ board/kontron/sl28/Makefile | 2 +- board/kontron/sl28/common.c | 10 ------- board/kontron/sl28/sl28.c | 6 ++++ board/kontron/sl28/spl.c | 34 +++++++++++++++++++++++ configs/kontron_sl28_defconfig | 1 + include/configs/kontron_sl28.h | 1 + 7 files changed, 47 insertions(+), 11 deletions(-) delete mode 100644 board/kontron/sl28/common.c
diff --git a/arch/arm/dts/fsl-ls1028a-kontron-sl28.dts b/arch/arm/dts/fsl-ls1028a-kontron-sl28.dts index 9561a58562..ea77a83d2f 100644 --- a/arch/arm/dts/fsl-ls1028a-kontron-sl28.dts +++ b/arch/arm/dts/fsl-ls1028a-kontron-sl28.dts @@ -172,6 +172,10 @@ }; };
+&sata { + status = "okay"; +}; + &serial0 { status = "okay"; }; diff --git a/board/kontron/sl28/Makefile b/board/kontron/sl28/Makefile index 5d220f0744..147ef9872b 100644 --- a/board/kontron/sl28/Makefile +++ b/board/kontron/sl28/Makefile @@ -4,7 +4,7 @@ ifndef CONFIG_SPL_BUILD obj-y += sl28.o cmds.o endif
-obj-y += common.o ddr.o +obj-y += ddr.o
ifdef CONFIG_SPL_BUILD obj-y += spl.o diff --git a/board/kontron/sl28/common.c b/board/kontron/sl28/common.c deleted file mode 100644 index 14704f7051..0000000000 --- a/board/kontron/sl28/common.c +++ /dev/null @@ -1,10 +0,0 @@ -// 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; -} diff --git a/board/kontron/sl28/sl28.c b/board/kontron/sl28/sl28.c index 34f17b486b..28e8c4c954 100644 --- a/board/kontron/sl28/sl28.c +++ b/board/kontron/sl28/sl28.c @@ -19,6 +19,12 @@
DECLARE_GLOBAL_DATA_PTR;
+int board_early_init_f(void) +{ + fsl_lsch3_early_init_f(); + return 0; +} + int board_init(void) { if (CONFIG_IS_ENABLED(FSL_CAAM)) diff --git a/board/kontron/sl28/spl.c b/board/kontron/sl28/spl.c index 0ef67e2886..0e6ad5f37e 100644 --- a/board/kontron/sl28/spl.c +++ b/board/kontron/sl28/spl.c @@ -3,10 +3,36 @@ #include <common.h> #include <asm/io.h> #include <asm/spl.h> +#include <asm/arch-fsl-layerscape/fsl_serdes.h> +#include <asm/arch-fsl-layerscape/soc.h>
#define DCFG_RCWSR25 0x160 #define GPINFO_HW_VARIANT_MASK 0xff
+#define SERDES_LNDGCR0 0x1ea08c0 +#define LNDGCR0_PROTS_MASK GENMASK(11, 7) +#define LNDGCR0_PROTS_SATA (0x2 << 7) +#define SERDES_LNDGCR1 0x1ea08c4 +#define LNDGCR1_RDAT_INV BIT(31) + +/* + * On this board the SMARC PCIe lane D might be switched to SATA mode. This + * makes sense if this lane is connected to a Mini PCI slot and a mSATA card + * is plugged in. In this case, the RX pair is swapped and we need to invert + * the received data. + */ +static void fixup_sata_rx_polarity(void) +{ + u32 prot = in_le32(SERDES_LNDGCR0) & LNDGCR0_PROTS_MASK; + u32 tmp; + + if (prot == LNDGCR0_PROTS_SATA) { + tmp = in_le32(SERDES_LNDGCR1); + tmp |= LNDGCR1_RDAT_INV; + out_le32(SERDES_LNDGCR1, tmp); + } +} + int sl28_variant(void) { return in_le32(DCFG_BASE + DCFG_RCWSR25) & GPINFO_HW_VARIANT_MASK; @@ -34,3 +60,11 @@ void board_boot_order(u32 *spl_boot_list) { spl_boot_list[0] = BOOT_DEVICE_SPI; } + +int board_early_init_f(void) +{ + fixup_sata_rx_polarity(); + fsl_lsch3_early_init_f(); + + return 0; +} diff --git a/configs/kontron_sl28_defconfig b/configs/kontron_sl28_defconfig index c1a096799c..7953957cfa 100644 --- a/configs/kontron_sl28_defconfig +++ b/configs/kontron_sl28_defconfig @@ -62,6 +62,7 @@ CONFIG_DM=y CONFIG_SPL_DM=y CONFIG_SPL_DM_SEQ_ALIAS=y CONFIG_SCSI_AHCI=y +CONFIG_SATA_CEVA=y CONFIG_FSL_CAAM=y CONFIG_SYS_FSL_DDR3=y CONFIG_DM_I2C=y diff --git a/include/configs/kontron_sl28.h b/include/configs/kontron_sl28.h index 442fb58b97..5d818a708d 100644 --- a/include/configs/kontron_sl28.h +++ b/include/configs/kontron_sl28.h @@ -93,6 +93,7 @@ func(MMC, mmc, 1) \ func(NVME, nvme, 0) \ func(USB, usb, 0) \ + func(SCSI, scsi, 0) \ func(DHCP, dhcp, 0) \ func(PXE, pxe, 0) #include <config_distro_bootcmd.h>
participants (1)
-
Michael Walle