Re: [PATCH v3 0/3] Conclusive WHLE-LS1 support (was: Conclusive WHLE-LS1046A support)
Pinging to have this series reviewed. Regards, Artur
[PATCH] net: phy: realtek: Add support for LED configuration
From: Jakub Klama Introduce an ability to configure LED and Fiber LEDs found in RTL8211F PHYs. This is achieved through two optional Device Tree properties: * rtl,lcr for LED control * rtl,flcr for Fiber LED control Signed-off-by: Jakub Klama Signed-off-by: Artur Rojek --- drivers/net/phy/realtek.c | 18 -- 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c index 396cac76d6..d078f41bee 100644 --- a/drivers/net/phy/realtek.c +++ b/drivers/net/phy/realtek.c @@ -59,6 +59,7 @@ #define MIIM_RTL8211F_TX_DELAY 0x100 #define MIIM_RTL8211F_RX_DELAY 0x8 #define MIIM_RTL8211F_LCR 0x10 +#define MIIM_RTL8211F_FLCR 0x12 #define RTL8201F_RMSR 0x10 @@ -220,6 +221,8 @@ default_delay: static int rtl8211f_config(struct phy_device *phydev) { + ofnode node = phy_get_ofnode(phydev); + u32 lcr, flcr; u16 reg; if (phydev->flags & PHY_RTL8211F_FORCE_EEE_RXC_ON) { @@ -254,14 +257,17 @@ static int rtl8211f_config(struct phy_device *phydev) reg &= ~MIIM_RTL8211F_RX_DELAY; phy_write(phydev, MDIO_DEVAD_NONE, 0x15, reg); - /* restore to default page 0 */ - phy_write(phydev, MDIO_DEVAD_NONE, - MIIM_RTL8211F_PAGE_SELECT, 0x0); - - /* Set green LED for Link, yellow LED for Active */ phy_write(phydev, MDIO_DEVAD_NONE, MIIM_RTL8211F_PAGE_SELECT, 0xd04); - phy_write(phydev, MDIO_DEVAD_NONE, 0x10, 0x617f); + + if (ofnode_valid(node) && !ofnode_read_u32(node, "rtl,lcr", &lcr)) + phy_write(phydev, MDIO_DEVAD_NONE, MIIM_RTL8211F_LCR, lcr); + else /* Set green LED for Link, yellow LED for Active */ + phy_write(phydev, MDIO_DEVAD_NONE, MIIM_RTL8211F_LCR, 0x617f); + + if (ofnode_valid(node) && !ofnode_read_u32(node, "rtl,flcr", &flcr)) + phy_write(phydev, MDIO_DEVAD_NONE, MIIM_RTL8211F_FLCR, flcr); + phy_write(phydev, MDIO_DEVAD_NONE, MIIM_RTL8211F_PAGE_SELECT, 0x0); -- 2.34.1
[PATCH v3 3/3] board: Add support for Conclusive WHLE-LS1088A
Introduce support for Conclusive WHLE-LS1088A Single Board Computer. Co-developed-by: Jakub Klama Signed-off-by: Jakub Klama Signed-off-by: Artur Rojek --- v3: new patch arch/arm/Kconfig | 19 ++ arch/arm/dts/Makefile | 1 + arch/arm/dts/fsl-ls1088a-whle-u-boot.dtsi | 8 + arch/arm/dts/fsl-ls1088a-whle.dts | 235 ++ board/conclusive/whle-ls1088a/Kconfig | 29 ++ board/conclusive/whle-ls1088a/MAINTAINERS | 11 + board/conclusive/whle-ls1088a/Makefile| 7 + board/conclusive/whle-ls1088a/ddr.c | 134 board/conclusive/whle-ls1088a/ddr.h | 47 +++ board/conclusive/whle-ls1088a/eth.c | 13 + board/conclusive/whle-ls1088a/whle-ls1088a.c | 301 ++ .../conclusive/whle-ls1088a/whle-ls1088a.env | 13 + configs/whle_ls1088a_emmc_defconfig | 84 + configs/whle_ls1088a_qspi_defconfig | 84 + include/configs/whle_ls1088a.h| 92 ++ 15 files changed, 1078 insertions(+) create mode 100644 arch/arm/dts/fsl-ls1088a-whle-u-boot.dtsi create mode 100644 arch/arm/dts/fsl-ls1088a-whle.dts create mode 100644 board/conclusive/whle-ls1088a/Kconfig create mode 100644 board/conclusive/whle-ls1088a/MAINTAINERS create mode 100644 board/conclusive/whle-ls1088a/Makefile create mode 100644 board/conclusive/whle-ls1088a/ddr.c create mode 100644 board/conclusive/whle-ls1088a/ddr.h create mode 100644 board/conclusive/whle-ls1088a/eth.c create mode 100644 board/conclusive/whle-ls1088a/whle-ls1088a.c create mode 100644 board/conclusive/whle-ls1088a/whle-ls1088a.env create mode 100644 configs/whle_ls1088a_emmc_defconfig create mode 100644 configs/whle_ls1088a_qspi_defconfig create mode 100644 include/configs/whle_ls1088a.h diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 609571e6e421..cd53fcaac883 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -1869,6 +1869,24 @@ config TARGET_WHLE_LS1046A Layerscape Architecture processor: https://conclusive.tech/products/whle-ls1-sbc/ +config TARGET_WHLE_LS1088A + bool "Support Conclusive WHLE-LS1088A" + select ARCH_LS1088A + select ARM64 + select ARMV8_MULTIENTRY + select ARCH_SUPPORT_TFABOOT + select BOARD_EARLY_INIT_F + select BOARD_LATE_INIT + select GPIO_EXTRA_HEADER + select DM_SPI_FLASH if DM_SPI + imply SCSI + help + Support for Conclusive WHLE-LS1088A platform. + The WHLE-LS1088A is a high-performance Single Board Computer with + extensive connectivity features that supports the QorIQ LS1088A + Layerscape Architecture processor: + https://conclusive.tech/products/whle-ls1-sbc/ + config TARGET_TEN64 bool "Support ten64" select ARCH_LS1088A @@ -2318,6 +2336,7 @@ source "board/broadcom/bcmns/Kconfig" source "board/broadcom/bcmns3/Kconfig" source "board/cavium/thunderx/Kconfig" source "board/conclusive/whle-ls1046a/Kconfig" +source "board/conclusive/whle-ls1088a/Kconfig" source "board/eets/pdu001/Kconfig" source "board/emulation/qemu-arm/Kconfig" source "board/freescale/ls2080aqds/Kconfig" diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index 8dcbf29df363..b0782b4f29bc 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -591,6 +591,7 @@ dtb-$(CONFIG_FSL_LSCH3) += fsl-ls2080a-qds.dtb \ fsl-ls1088a-qds.dtb \ fsl-ls1088a-qds-21-x.dtb \ fsl-ls1088a-qds-29-x.dtb \ + fsl-ls1088a-whle.dtb \ fsl-ls1028a-rdb.dtb \ fsl-ls1028a-qds-duart.dtb \ fsl-ls1028a-qds-lpuart.dtb \ diff --git a/arch/arm/dts/fsl-ls1088a-whle-u-boot.dtsi b/arch/arm/dts/fsl-ls1088a-whle-u-boot.dtsi new file mode 100644 index ..bbe93a1d6e4f --- /dev/null +++ b/arch/arm/dts/fsl-ls1088a-whle-u-boot.dtsi @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0+ OR X11 +/* + * Copyright 2020-2023 Conclusive Engineering Sp. z o. o. + */ + +#include + +#include "fsl-ls1088a-u-boot.dtsi" diff --git a/arch/arm/dts/fsl-ls1088a-whle.dts b/arch/arm/dts/fsl-ls1088a-whle.dts new file mode 100644 index ..76ef1c748059 --- /dev/null +++ b/arch/arm/dts/fsl-ls1088a-whle.dts @@ -0,0 +1,235 @@ +// SPDX-License-Identifier: GPL-2.0+ OR X11 +/* + * Copyright 2020-2023 Conclusive Engineering Sp. z o. o. + */ + +/dts-v1/; + +#include "fsl-ls1088a.dtsi" + +/ { + model = "Conclusive WHLE-LS1088A"; + compatible = "conclusive,whle-ls1088a", "fsl,ls1088a"; + + chosen { + stdout-path = &duart0; + }; + + aliases { + spi0 = &qspi; + }; +}; + +&dpmac1 { + status = "okay"; + phy-connection-type = "10gbase-r"; +}; + +&dpmac
[PATCH v3 2/3] board: Add support for Conclusive WHLE-LS1046A
Introduce support for Conclusive WHLE-LS1046A Single Board Computer. Co-developed-by: Jakub Klama Signed-off-by: Jakub Klama Signed-off-by: Artur Rojek --- v3: no change v2: - drop non-DM_ETH case - clean-up defines in configs/whle_ls1046a.h: remove unneeded ones, move others to appropriate files in board directory - move environment variables to whle-ls1046a.env - move away from distro_bootcmd and use BOOTSTD - fix i2c-mux node parent and ext_i2c address in Device Tree - style changes to eth.c - fix CONFIG_MTDPARTS_DEFAULT value in defconfigs arch/arm/Kconfig | 19 ++ arch/arm/dts/Makefile | 1 + arch/arm/dts/fsl-ls1046a-whle.dts | 208 + board/conclusive/whle-ls1046a/Kconfig | 15 ++ board/conclusive/whle-ls1046a/MAINTAINERS | 9 + board/conclusive/whle-ls1046a/Makefile| 7 + board/conclusive/whle-ls1046a/ddr.c | 21 ++ board/conclusive/whle-ls1046a/eth.c | 65 ++ board/conclusive/whle-ls1046a/whle-ls1046a.c | 215 ++ .../conclusive/whle-ls1046a/whle-ls1046a.env | 13 ++ configs/whle_ls1046a_emmc_defconfig | 83 +++ configs/whle_ls1046a_qspi_defconfig | 84 +++ include/configs/whle_ls1046a.h| 47 13 files changed, 787 insertions(+) create mode 100644 arch/arm/dts/fsl-ls1046a-whle.dts create mode 100644 board/conclusive/whle-ls1046a/Kconfig create mode 100644 board/conclusive/whle-ls1046a/MAINTAINERS create mode 100644 board/conclusive/whle-ls1046a/Makefile create mode 100644 board/conclusive/whle-ls1046a/ddr.c create mode 100644 board/conclusive/whle-ls1046a/eth.c create mode 100644 board/conclusive/whle-ls1046a/whle-ls1046a.c create mode 100644 board/conclusive/whle-ls1046a/whle-ls1046a.env create mode 100644 configs/whle_ls1046a_emmc_defconfig create mode 100644 configs/whle_ls1046a_qspi_defconfig create mode 100644 include/configs/whle_ls1046a.h diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index d812685c9842..609571e6e421 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -1851,6 +1851,24 @@ config TARGET_SL28 help Support for Kontron SMARC-sAL28 board. +config TARGET_WHLE_LS1046A + bool "Support Conclusive WHLE-LS1046A" + select ARCH_LS1046A + select ARM64 + select ARMV8_MULTIENTRY + select ARCH_SUPPORT_TFABOOT + select BOARD_EARLY_INIT_F + select BOARD_LATE_INIT + select GPIO_EXTRA_HEADER + select DM_SPI_FLASH if DM_SPI + imply SCSI + help + Support for Conclusive WHLE-LS1046A platform. + The WHLE-LS1046A is a high-performance Single Board Computer with + extensive connectivity features that supports the QorIQ LS1046A + Layerscape Architecture processor: + https://conclusive.tech/products/whle-ls1-sbc/ + config TARGET_TEN64 bool "Support ten64" select ARCH_LS1088A @@ -2299,6 +2317,7 @@ source "board/cortina/presidio-asic/Kconfig" source "board/broadcom/bcmns/Kconfig" source "board/broadcom/bcmns3/Kconfig" source "board/cavium/thunderx/Kconfig" +source "board/conclusive/whle-ls1046a/Kconfig" source "board/eets/pdu001/Kconfig" source "board/emulation/qemu-arm/Kconfig" source "board/freescale/ls2080aqds/Kconfig" diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index 1be08c5fdc2e..8dcbf29df363 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -615,6 +615,7 @@ dtb-$(CONFIG_FSL_LSCH2) += fsl-ls1043a-qds-duart.dtb \ fsl-ls1046a-qds-lpuart.dtb \ fsl-ls1046a-rdb.dtb \ fsl-ls1046a-frwy.dtb \ + fsl-ls1046a-whle.dtb \ fsl-ls1012a-qds.dtb \ fsl-ls1012a-rdb.dtb \ fsl-ls1012a-2g5rdb.dtb \ diff --git a/arch/arm/dts/fsl-ls1046a-whle.dts b/arch/arm/dts/fsl-ls1046a-whle.dts new file mode 100644 index ..1aed3e8c4701 --- /dev/null +++ b/arch/arm/dts/fsl-ls1046a-whle.dts @@ -0,0 +1,208 @@ +// SPDX-License-Identifier: GPL-2.0+ OR X11 +/* + * Copyright 2020-2023 Conclusive Engineering Sp. z o. o. + */ + +#include + +/dts-v1/; +#include "fsl-ls1046a.dtsi" + +/ { + model = "Conclusive WHLE-LS1046A"; + compatible = "conclusive,whle-ls1046a", "fsl,ls1046a"; + + chosen { + stdout-path = &duart0; + }; + + aliases { + spi0 = &qspi; + }; +}; + +&soc { + pcie@340 { + status = "okay"; + }; +}; + +&qspi { + status = "okay"; + + gd25lq128: flash@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + spi-max-frequency = <5000>
[PATCH v3 1/3] armv8: layerscape: Enable ext4 environment storage
From: Jakub Klama Some boards keep their environment on MMC storage within an ext4 partition. Signed-off-by: Jakub Klama Signed-off-by: Artur Rojek Reviewed-by: Tom Rini --- v2-v3: no change arch/arm/cpu/armv8/fsl-layerscape/cpu.c | 5 + 1 file changed, 5 insertions(+) diff --git a/arch/arm/cpu/armv8/fsl-layerscape/cpu.c b/arch/arm/cpu/armv8/fsl-layerscape/cpu.c index 12d31184ad91..3775cb493732 100644 --- a/arch/arm/cpu/armv8/fsl-layerscape/cpu.c +++ b/arch/arm/cpu/armv8/fsl-layerscape/cpu.c @@ -857,6 +857,11 @@ enum env_location arch_env_get_location(enum env_operation op, int prio) break; } +#ifdef CONFIG_ENV_IS_IN_EXT4 + if (env_loc == ENVL_MMC) + return ENVL_EXT4; +#endif + return env_loc; } #endif /* CONFIG_TFABOOT */ -- 2.43.0
[PATCH v3 0/3] Conclusive WHLE-LS1 support (was: Conclusive WHLE-LS1046A support)
Hi all, this is v3 of the WHLE-LS1 support. The major change in this version is addition of WHLE-LS1088A board support, next to the WHLE-LS1046A found in previous iterations of this series. Patch [1/3] and [2/3] remain unchanged. Patch [3/3] introduces WHLE-LS1088A board support. Artur Rojek (2): board: Add support for Conclusive WHLE-LS1046A board: Add support for Conclusive WHLE-LS1088A Jakub Klama (1): armv8: layerscape: Enable ext4 environment storage arch/arm/Kconfig | 38 +++ arch/arm/cpu/armv8/fsl-layerscape/cpu.c | 5 + arch/arm/dts/Makefile | 2 + arch/arm/dts/fsl-ls1046a-whle.dts | 208 arch/arm/dts/fsl-ls1088a-whle-u-boot.dtsi | 8 + arch/arm/dts/fsl-ls1088a-whle.dts | 235 ++ board/conclusive/whle-ls1046a/Kconfig | 15 + board/conclusive/whle-ls1046a/MAINTAINERS | 9 + board/conclusive/whle-ls1046a/Makefile| 7 + board/conclusive/whle-ls1046a/ddr.c | 21 ++ board/conclusive/whle-ls1046a/eth.c | 65 board/conclusive/whle-ls1046a/whle-ls1046a.c | 215 + .../conclusive/whle-ls1046a/whle-ls1046a.env | 13 + board/conclusive/whle-ls1088a/Kconfig | 29 ++ board/conclusive/whle-ls1088a/MAINTAINERS | 11 + board/conclusive/whle-ls1088a/Makefile| 7 + board/conclusive/whle-ls1088a/ddr.c | 134 board/conclusive/whle-ls1088a/ddr.h | 47 +++ board/conclusive/whle-ls1088a/eth.c | 13 + board/conclusive/whle-ls1088a/whle-ls1088a.c | 301 ++ .../conclusive/whle-ls1088a/whle-ls1088a.env | 13 + configs/whle_ls1046a_emmc_defconfig | 83 + configs/whle_ls1046a_qspi_defconfig | 84 + configs/whle_ls1088a_emmc_defconfig | 84 + configs/whle_ls1088a_qspi_defconfig | 84 + include/configs/whle_ls1046a.h| 47 +++ include/configs/whle_ls1088a.h| 92 ++ 27 files changed, 1870 insertions(+) create mode 100644 arch/arm/dts/fsl-ls1046a-whle.dts create mode 100644 arch/arm/dts/fsl-ls1088a-whle-u-boot.dtsi create mode 100644 arch/arm/dts/fsl-ls1088a-whle.dts create mode 100644 board/conclusive/whle-ls1046a/Kconfig create mode 100644 board/conclusive/whle-ls1046a/MAINTAINERS create mode 100644 board/conclusive/whle-ls1046a/Makefile create mode 100644 board/conclusive/whle-ls1046a/ddr.c create mode 100644 board/conclusive/whle-ls1046a/eth.c create mode 100644 board/conclusive/whle-ls1046a/whle-ls1046a.c create mode 100644 board/conclusive/whle-ls1046a/whle-ls1046a.env create mode 100644 board/conclusive/whle-ls1088a/Kconfig create mode 100644 board/conclusive/whle-ls1088a/MAINTAINERS create mode 100644 board/conclusive/whle-ls1088a/Makefile create mode 100644 board/conclusive/whle-ls1088a/ddr.c create mode 100644 board/conclusive/whle-ls1088a/ddr.h create mode 100644 board/conclusive/whle-ls1088a/eth.c create mode 100644 board/conclusive/whle-ls1088a/whle-ls1088a.c create mode 100644 board/conclusive/whle-ls1088a/whle-ls1088a.env create mode 100644 configs/whle_ls1046a_emmc_defconfig create mode 100644 configs/whle_ls1046a_qspi_defconfig create mode 100644 configs/whle_ls1088a_emmc_defconfig create mode 100644 configs/whle_ls1088a_qspi_defconfig create mode 100644 include/configs/whle_ls1046a.h create mode 100644 include/configs/whle_ls1088a.h -- 2.43.0
[PATCH v2 2/2] board: Add support for Conclusive WHLE-LS1046A
Introduce support for Conclusive WHLE-LS1046A Single Board Computer. Co-developed-by: Jakub Klama Signed-off-by: Jakub Klama Signed-off-by: Artur Rojek --- v2: - drop non-DM_ETH case - clean-up defines in configs/whle_ls1046a.h: remove unneeded ones, move others to appropriate files in board directory - move environment variables to whle-ls1046a.env - move away from distro_bootcmd and use BOOTSTD - fix i2c-mux node parent and ext_i2c address in Device Tree - style changes to eth.c - fix CONFIG_MTDPARTS_DEFAULT value in defconfigs arch/arm/Kconfig | 19 ++ arch/arm/dts/Makefile | 1 + arch/arm/dts/fsl-ls1046a-whle.dts | 208 + board/conclusive/whle-ls1046a/Kconfig | 15 ++ board/conclusive/whle-ls1046a/MAINTAINERS | 9 + board/conclusive/whle-ls1046a/Makefile| 7 + board/conclusive/whle-ls1046a/ddr.c | 21 ++ board/conclusive/whle-ls1046a/eth.c | 65 ++ board/conclusive/whle-ls1046a/whle-ls1046a.c | 215 ++ .../conclusive/whle-ls1046a/whle-ls1046a.env | 13 ++ configs/whle_ls1046a_emmc_defconfig | 83 +++ configs/whle_ls1046a_qspi_defconfig | 84 +++ include/configs/whle_ls1046a.h| 47 13 files changed, 787 insertions(+) create mode 100644 arch/arm/dts/fsl-ls1046a-whle.dts create mode 100644 board/conclusive/whle-ls1046a/Kconfig create mode 100644 board/conclusive/whle-ls1046a/MAINTAINERS create mode 100644 board/conclusive/whle-ls1046a/Makefile create mode 100644 board/conclusive/whle-ls1046a/ddr.c create mode 100644 board/conclusive/whle-ls1046a/eth.c create mode 100644 board/conclusive/whle-ls1046a/whle-ls1046a.c create mode 100644 board/conclusive/whle-ls1046a/whle-ls1046a.env create mode 100644 configs/whle_ls1046a_emmc_defconfig create mode 100644 configs/whle_ls1046a_qspi_defconfig create mode 100644 include/configs/whle_ls1046a.h diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index d812685c9842..609571e6e421 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -1851,6 +1851,24 @@ config TARGET_SL28 help Support for Kontron SMARC-sAL28 board. +config TARGET_WHLE_LS1046A + bool "Support Conclusive WHLE-LS1046A" + select ARCH_LS1046A + select ARM64 + select ARMV8_MULTIENTRY + select ARCH_SUPPORT_TFABOOT + select BOARD_EARLY_INIT_F + select BOARD_LATE_INIT + select GPIO_EXTRA_HEADER + select DM_SPI_FLASH if DM_SPI + imply SCSI + help + Support for Conclusive WHLE-LS1046A platform. + The WHLE-LS1046A is a high-performance Single Board Computer with + extensive connectivity features that supports the QorIQ LS1046A + Layerscape Architecture processor: + https://conclusive.tech/products/whle-ls1-sbc/ + config TARGET_TEN64 bool "Support ten64" select ARCH_LS1088A @@ -2299,6 +2317,7 @@ source "board/cortina/presidio-asic/Kconfig" source "board/broadcom/bcmns/Kconfig" source "board/broadcom/bcmns3/Kconfig" source "board/cavium/thunderx/Kconfig" +source "board/conclusive/whle-ls1046a/Kconfig" source "board/eets/pdu001/Kconfig" source "board/emulation/qemu-arm/Kconfig" source "board/freescale/ls2080aqds/Kconfig" diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index 1be08c5fdc2e..8dcbf29df363 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -615,6 +615,7 @@ dtb-$(CONFIG_FSL_LSCH2) += fsl-ls1043a-qds-duart.dtb \ fsl-ls1046a-qds-lpuart.dtb \ fsl-ls1046a-rdb.dtb \ fsl-ls1046a-frwy.dtb \ + fsl-ls1046a-whle.dtb \ fsl-ls1012a-qds.dtb \ fsl-ls1012a-rdb.dtb \ fsl-ls1012a-2g5rdb.dtb \ diff --git a/arch/arm/dts/fsl-ls1046a-whle.dts b/arch/arm/dts/fsl-ls1046a-whle.dts new file mode 100644 index ..1aed3e8c4701 --- /dev/null +++ b/arch/arm/dts/fsl-ls1046a-whle.dts @@ -0,0 +1,208 @@ +// SPDX-License-Identifier: GPL-2.0+ OR X11 +/* + * Copyright 2020-2023 Conclusive Engineering Sp. z o. o. + */ + +#include + +/dts-v1/; +#include "fsl-ls1046a.dtsi" + +/ { + model = "Conclusive WHLE-LS1046A"; + compatible = "conclusive,whle-ls1046a", "fsl,ls1046a"; + + chosen { + stdout-path = &duart0; + }; + + aliases { + spi0 = &qspi; + }; +}; + +&soc { + pcie@340 { + status = "okay"; + }; +}; + +&qspi { + status = "okay"; + + gd25lq128: flash@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + spi-max-frequency = <5000>
[PATCH v2 1/2] armv8: layerscape: Enable ext4 environment storage
From: Jakub Klama Some boards keep their environment on MMC storage within an ext4 partition. Signed-off-by: Jakub Klama Signed-off-by: Artur Rojek Reviewed-by: Tom Rini --- v2: no change arch/arm/cpu/armv8/fsl-layerscape/cpu.c | 5 + 1 file changed, 5 insertions(+) diff --git a/arch/arm/cpu/armv8/fsl-layerscape/cpu.c b/arch/arm/cpu/armv8/fsl-layerscape/cpu.c index 12d31184ad91..3775cb493732 100644 --- a/arch/arm/cpu/armv8/fsl-layerscape/cpu.c +++ b/arch/arm/cpu/armv8/fsl-layerscape/cpu.c @@ -857,6 +857,11 @@ enum env_location arch_env_get_location(enum env_operation op, int prio) break; } +#ifdef CONFIG_ENV_IS_IN_EXT4 + if (env_loc == ENVL_MMC) + return ENVL_EXT4; +#endif + return env_loc; } #endif /* CONFIG_TFABOOT */ -- 2.42.1
[PATCH v2 0/2] Conclusive WHLE-LS1046A support
Hi all, this is v2 of the Conclusive WHLE-LS1046A support series. Patch [1/2] remains unchanged. Patch [2/2] features a major clean-up to configs/whle_ls1046a.h, dropping unneeded/redundant defines, and moving some others to more appropriate locations in board code. The environment settings have been moved to plain text whle-ls1046a.env file, and distro_bootcmd macros dropped in favor of BOOTSTD. A non-DM_ETH case has also been removed. In Device Tree bindings, i2c-mux node has been relocated to the correct parent and ext_i2c received an address correction. Minor style clean-ups have been performed to eth.c and an incorrect value of CONFIG_MTDPARTS_DEFAULT removed from defconfigs. Artur Rojek (1): board: Add support for Conclusive WHLE-LS1046A Jakub Klama (1): armv8: layerscape: Enable ext4 environment storage arch/arm/Kconfig | 19 ++ arch/arm/cpu/armv8/fsl-layerscape/cpu.c | 5 + arch/arm/dts/Makefile | 1 + arch/arm/dts/fsl-ls1046a-whle.dts | 208 + board/conclusive/whle-ls1046a/Kconfig | 15 ++ board/conclusive/whle-ls1046a/MAINTAINERS | 9 + board/conclusive/whle-ls1046a/Makefile| 7 + board/conclusive/whle-ls1046a/ddr.c | 21 ++ board/conclusive/whle-ls1046a/eth.c | 65 ++ board/conclusive/whle-ls1046a/whle-ls1046a.c | 215 ++ .../conclusive/whle-ls1046a/whle-ls1046a.env | 13 ++ configs/whle_ls1046a_emmc_defconfig | 83 +++ configs/whle_ls1046a_qspi_defconfig | 84 +++ include/configs/whle_ls1046a.h| 47 14 files changed, 792 insertions(+) create mode 100644 arch/arm/dts/fsl-ls1046a-whle.dts create mode 100644 board/conclusive/whle-ls1046a/Kconfig create mode 100644 board/conclusive/whle-ls1046a/MAINTAINERS create mode 100644 board/conclusive/whle-ls1046a/Makefile create mode 100644 board/conclusive/whle-ls1046a/ddr.c create mode 100644 board/conclusive/whle-ls1046a/eth.c create mode 100644 board/conclusive/whle-ls1046a/whle-ls1046a.c create mode 100644 board/conclusive/whle-ls1046a/whle-ls1046a.env create mode 100644 configs/whle_ls1046a_emmc_defconfig create mode 100644 configs/whle_ls1046a_qspi_defconfig create mode 100644 include/configs/whle_ls1046a.h -- 2.42.1
[PATCH 2/2] board: Add support for Conclusive WHLE-LS1046A
Introduce support for Conclusive WHLE-LS1046A Single Board Computer. Co-developed-by: Jakub Klama Signed-off-by: Jakub Klama Signed-off-by: Artur Rojek --- arch/arm/Kconfig | 19 ++ arch/arm/dts/Makefile| 1 + arch/arm/dts/fsl-ls1046a-whle.dts| 208 ++ board/conclusive/whle-ls1046a/Kconfig| 15 ++ board/conclusive/whle-ls1046a/MAINTAINERS| 9 + board/conclusive/whle-ls1046a/Makefile | 7 + board/conclusive/whle-ls1046a/ddr.c | 21 ++ board/conclusive/whle-ls1046a/eth.c | 64 ++ board/conclusive/whle-ls1046a/whle-ls1046a.c | 218 +++ configs/whle_ls1046a_emmc_defconfig | 82 +++ configs/whle_ls1046a_qspi_defconfig | 83 +++ include/configs/whle_ls1046a.h | 90 12 files changed, 817 insertions(+) create mode 100644 arch/arm/dts/fsl-ls1046a-whle.dts create mode 100644 board/conclusive/whle-ls1046a/Kconfig create mode 100644 board/conclusive/whle-ls1046a/MAINTAINERS create mode 100644 board/conclusive/whle-ls1046a/Makefile create mode 100644 board/conclusive/whle-ls1046a/ddr.c create mode 100644 board/conclusive/whle-ls1046a/eth.c create mode 100644 board/conclusive/whle-ls1046a/whle-ls1046a.c create mode 100644 configs/whle_ls1046a_emmc_defconfig create mode 100644 configs/whle_ls1046a_qspi_defconfig create mode 100644 include/configs/whle_ls1046a.h diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index d812685c9842..609571e6e421 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -1851,6 +1851,24 @@ config TARGET_SL28 help Support for Kontron SMARC-sAL28 board. +config TARGET_WHLE_LS1046A + bool "Support Conclusive WHLE-LS1046A" + select ARCH_LS1046A + select ARM64 + select ARMV8_MULTIENTRY + select ARCH_SUPPORT_TFABOOT + select BOARD_EARLY_INIT_F + select BOARD_LATE_INIT + select GPIO_EXTRA_HEADER + select DM_SPI_FLASH if DM_SPI + imply SCSI + help + Support for Conclusive WHLE-LS1046A platform. + The WHLE-LS1046A is a high-performance Single Board Computer with + extensive connectivity features that supports the QorIQ LS1046A + Layerscape Architecture processor: + https://conclusive.tech/products/whle-ls1-sbc/ + config TARGET_TEN64 bool "Support ten64" select ARCH_LS1088A @@ -2299,6 +2317,7 @@ source "board/cortina/presidio-asic/Kconfig" source "board/broadcom/bcmns/Kconfig" source "board/broadcom/bcmns3/Kconfig" source "board/cavium/thunderx/Kconfig" +source "board/conclusive/whle-ls1046a/Kconfig" source "board/eets/pdu001/Kconfig" source "board/emulation/qemu-arm/Kconfig" source "board/freescale/ls2080aqds/Kconfig" diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index 1be08c5fdc2e..8dcbf29df363 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -615,6 +615,7 @@ dtb-$(CONFIG_FSL_LSCH2) += fsl-ls1043a-qds-duart.dtb \ fsl-ls1046a-qds-lpuart.dtb \ fsl-ls1046a-rdb.dtb \ fsl-ls1046a-frwy.dtb \ + fsl-ls1046a-whle.dtb \ fsl-ls1012a-qds.dtb \ fsl-ls1012a-rdb.dtb \ fsl-ls1012a-2g5rdb.dtb \ diff --git a/arch/arm/dts/fsl-ls1046a-whle.dts b/arch/arm/dts/fsl-ls1046a-whle.dts new file mode 100644 index ..44188f16d739 --- /dev/null +++ b/arch/arm/dts/fsl-ls1046a-whle.dts @@ -0,0 +1,208 @@ +// SPDX-License-Identifier: GPL-2.0+ OR X11 +/* + * Copyright 2020-2023 Conclusive Engineering Sp. z o. o. + */ + +#include + +/dts-v1/; +#include "fsl-ls1046a.dtsi" + +/ { + model = "Conclusive WHLE-LS1046A"; + compatible = "conclusive,whle-ls1046a", "fsl,ls1046a"; + + chosen { + stdout-path = &duart0; + }; + + aliases { + spi0 = &qspi; + }; +}; + +&soc { + pcie@340 { + status = "okay"; + }; +}; + +&qspi { + status = "okay"; + + gd25lq128: flash@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + spi-max-frequency = <5000>; + reg = <0>; + + partitions { + #address-cells = <1>; + #size-cells = <1>; + compatible = "fixed-partitions"; + + partition@0 { + label = "bl2"; + reg = <0 0x10>; + }; + + partition@10 { + label = "fip1"; + reg = <0x1
[PATCH 0/2] Conclusive WHLE-LS1046A support
Hi all, this series adds support for Conclusive WHLE-LS1046A, a QorIQ LS1046A SoC based Single Board Computer by Conclusive Engineering. Patch [1/2] adds support for storing U-Boot environment on an ext4 partition of MMC. This is required for whle_ls1046a_emmc_defconfig. Patch [2/2] introduces support for Conclusive WHLE-LS1046A, including board init and Device Tree files. This board offers two boot methods, over QSPI and eMMC, with their respective defconfigs being provided. Artur Rojek (1): board: Add support for Conclusive WHLE-LS1046A Jakub Klama (1): armv8: layerscape: Enable ext4 environment storage arch/arm/Kconfig | 19 ++ arch/arm/cpu/armv8/fsl-layerscape/cpu.c | 5 + arch/arm/dts/Makefile| 1 + arch/arm/dts/fsl-ls1046a-whle.dts| 208 ++ board/conclusive/whle-ls1046a/Kconfig| 15 ++ board/conclusive/whle-ls1046a/MAINTAINERS| 9 + board/conclusive/whle-ls1046a/Makefile | 7 + board/conclusive/whle-ls1046a/ddr.c | 21 ++ board/conclusive/whle-ls1046a/eth.c | 64 ++ board/conclusive/whle-ls1046a/whle-ls1046a.c | 218 +++ configs/whle_ls1046a_emmc_defconfig | 82 +++ configs/whle_ls1046a_qspi_defconfig | 83 +++ include/configs/whle_ls1046a.h | 90 13 files changed, 822 insertions(+) create mode 100644 arch/arm/dts/fsl-ls1046a-whle.dts create mode 100644 board/conclusive/whle-ls1046a/Kconfig create mode 100644 board/conclusive/whle-ls1046a/MAINTAINERS create mode 100644 board/conclusive/whle-ls1046a/Makefile create mode 100644 board/conclusive/whle-ls1046a/ddr.c create mode 100644 board/conclusive/whle-ls1046a/eth.c create mode 100644 board/conclusive/whle-ls1046a/whle-ls1046a.c create mode 100644 configs/whle_ls1046a_emmc_defconfig create mode 100644 configs/whle_ls1046a_qspi_defconfig create mode 100644 include/configs/whle_ls1046a.h -- 2.42.1
[PATCH 1/2] armv8: layerscape: Enable ext4 environment storage
From: Jakub Klama Some boards keep their environment on MMC storage within an ext4 partition. Signed-off-by: Jakub Klama Signed-off-by: Artur Rojek --- arch/arm/cpu/armv8/fsl-layerscape/cpu.c | 5 + 1 file changed, 5 insertions(+) diff --git a/arch/arm/cpu/armv8/fsl-layerscape/cpu.c b/arch/arm/cpu/armv8/fsl-layerscape/cpu.c index 12d31184ad91..3775cb493732 100644 --- a/arch/arm/cpu/armv8/fsl-layerscape/cpu.c +++ b/arch/arm/cpu/armv8/fsl-layerscape/cpu.c @@ -857,6 +857,11 @@ enum env_location arch_env_get_location(enum env_operation op, int prio) break; } +#ifdef CONFIG_ENV_IS_IN_EXT4 + if (env_loc == ENVL_MMC) + return ENVL_EXT4; +#endif + return env_loc; } #endif /* CONFIG_TFABOOT */ -- 2.42.1
[PATCH v5 4/4] board: Add support for Conclusive KSTR-SAMA5D27
Introduce support for Conclusive KSTR-SAMA5D27 Single Board Computer. Co-developed-by: Jakub Klama Signed-off-by: Jakub Klama Co-developed-by: Marcin Jabrzyk Signed-off-by: Marcin Jabrzyk Signed-off-by: Artur Rojek --- v5: - move U-Boot specific props to at91-kstr-sama5d27-u-boot.dtsi file - include the above file in MAINTAINERS - assign an alias to i2c6 v4: - utilize EVT_SETTINGS_R in order to read MAC and serial number from EEPROM v3: - use CONFIG_ID_EEPROM to read serial number - as side-effect of using CONFIG_ID_EEPROM, KSTR-SAMA5D27 now also correctly uses EEPROM embedded MAC addresses (overlooked in v1-v2) - use CONFIG_DISPLAY_BOARDINFO_LATE for printing the board model and serial number, and provide the required checkboard() call - drop CONFIG_BOARD_LATE_INIT, as not needed anymore - defconfig cleanup v2: - remove redundant license text from at91-kstr-sama5d27.dts - when defining properties in .dts, reference nodes by labels - drop nodes for usb0 and pmic, as these aren't used by drivers - switch i2c to flexcom driver and make the necessary dts changes - sort includes in at91-kstr-sama5d27.dts alphabetically arch/arm/dts/Makefile | 3 + arch/arm/dts/at91-kstr-sama5d27-u-boot.dtsi | 42 +++ arch/arm/dts/at91-kstr-sama5d27.dts | 127 ++ arch/arm/mach-at91/Kconfig| 12 + board/conclusive/kstr-sama5d27/Kconfig| 15 ++ board/conclusive/kstr-sama5d27/MAINTAINERS| 9 + board/conclusive/kstr-sama5d27/Makefile | 5 + .../conclusive/kstr-sama5d27/kstr-sama5d27.c | 239 ++ configs/kstr_sama5d27_defconfig | 73 ++ include/configs/kstr-sama5d27.h | 15 ++ 10 files changed, 540 insertions(+) create mode 100644 arch/arm/dts/at91-kstr-sama5d27-u-boot.dtsi create mode 100644 arch/arm/dts/at91-kstr-sama5d27.dts create mode 100644 board/conclusive/kstr-sama5d27/Kconfig create mode 100644 board/conclusive/kstr-sama5d27/MAINTAINERS create mode 100644 board/conclusive/kstr-sama5d27/Makefile create mode 100644 board/conclusive/kstr-sama5d27/kstr-sama5d27.c create mode 100644 configs/kstr_sama5d27_defconfig create mode 100644 include/configs/kstr-sama5d27.h diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index 4569483d5fdf..f6f0d84ff77b 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -1232,6 +1232,9 @@ dtb-$(CONFIG_TARGET_SAMA5D27_SOM1_EK) += \ dtb-$(CONFIG_TARGET_SAMA5D27_WLSOM1_EK) += \ at91-sama5d27_wlsom1_ek.dtb +dtb-$(CONFIG_TARGET_KSTR_SAMA5D27) += \ + at91-kstr-sama5d27.dtb + dtb-$(CONFIG_TARGET_SAMA5D2_ICP) += \ at91-sama5d2_icp.dtb diff --git a/arch/arm/dts/at91-kstr-sama5d27-u-boot.dtsi b/arch/arm/dts/at91-kstr-sama5d27-u-boot.dtsi new file mode 100644 index ..cec35ab621f7 --- /dev/null +++ b/arch/arm/dts/at91-kstr-sama5d27-u-boot.dtsi @@ -0,0 +1,42 @@ +// SPDX-License-Identifier: GPL-2.0+ OR X11 +/* + * at91-kstr-sama5d27-u-boot.dtsi - Device Tree Include file w/ U-Boot specific + * properties for Conclusive KSTR-SAMA5D27 board + * + * Copyright (C) 2023 Conclusive Engineering Sp. z o. o. + * + */ + +/ { + chosen { + bootph-all; + }; +}; + +&sdmmc0 { + bootph-all; +}; + +&uart1 { + bootph-all; +}; + +&pinctrl_uart1_default { + bootph-all; +}; + +&pinctrl_macb0_phy_irq { + bootph-all; +}; + +&pinctrl_macb0_rmii { + bootph-all; +}; + +&pinctrl_sdmmc0_cmd_dat_default { + bootph-all; +}; + +&pinctrl_sdmmc0_ck_cd_default { + bootph-all; +}; diff --git a/arch/arm/dts/at91-kstr-sama5d27.dts b/arch/arm/dts/at91-kstr-sama5d27.dts new file mode 100644 index ..c226a214a551 --- /dev/null +++ b/arch/arm/dts/at91-kstr-sama5d27.dts @@ -0,0 +1,127 @@ +// SPDX-License-Identifier: GPL-2.0+ OR X11 +/* + * at91-kstr-sama5d27.dts - Device Tree file for Conclusive KSTR-SAMA5D27 board + * + * Copyright (C) 2019-2023 Conclusive Engineering Sp. z o. o. + * + */ +/dts-v1/; + +#include "sama5d2.dtsi" +#include "sama5d2-pinfunc.h" +#include +#include +#include + +/ { + model = "Conclusive KSTR-SAMA5D27"; + compatible = "conclusive,kstr-sama5d27", "atmel,sama5d2", "atmel,sama5"; + + chosen { + stdout-path = &uart1; + }; + + aliases { + i2c2 = &i2c6; + }; +}; + +&main_xtal { + clock-frequency = <1200>; +}; + +&sdmmc0 { + bus-width = <4>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_sdmmc0_cmd_dat_default &pinctrl_sdmmc0_ck_cd_default>; + status = "okay"; +}; + +&uart1 { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_uart1_default>; + status = "okay"; +}
[PATCH v5 3/4] arm: dts: at91: sama5: Add flexcom4 node
Set up flexcom4 for Microchip SAMA5D27 SoC and prepare it for usage in I2C mode. Signed-off-by: Artur Rojek --- v3-v5: no change v2: new patch arch/arm/dts/sama5d2.dtsi | 20 1 file changed, 20 insertions(+) diff --git a/arch/arm/dts/sama5d2.dtsi b/arch/arm/dts/sama5d2.dtsi index dd6468ed96aa..819564fdd5bb 100644 --- a/arch/arm/dts/sama5d2.dtsi +++ b/arch/arm/dts/sama5d2.dtsi @@ -781,6 +781,26 @@ status = "disabled"; }; + flx4: flexcom@fc018000 { + compatible = "atmel,sama5d2-flexcom"; + reg = <0xfc018000 0x200>; + clocks = <&flx4_clk>; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0xfc018000 0x800>; + status = "disabled"; + + i2c6: i2c@600 { + compatible = "atmel,sama5d2-i2c"; + reg = <0x600 0x200>; + #address-cells = <1>; + #size-cells = <0>; + clocks = <&flx4_clk>; + clock-names = "i2c6_clk"; + status = "disabled"; + }; + }; + aic: interrupt-controller@fc02 { #interrupt-cells = <3>; compatible = "atmel,sama5d2-aic"; -- 2.42.0
[PATCH v5 2/4] event: add new EVT_SETTINGS_R event
Introduce EVT_SETTINGS_R, triggered post-relocation and before console init. This event gives an option to perform any platform-dependent setup, which needs to take place before show_board_info(). Usage examples include readout of EEPROM stored settings. Signed-off-by: Artur Rojek Reviewed-by: Simon Glass --- v5: no change v4: new patch common/board_r.c | 1 + common/event.c | 1 + include/event.h | 9 + 3 files changed, 11 insertions(+) diff --git a/common/board_r.c b/common/board_r.c index 52786901be55..a7967849dc0c 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -693,6 +693,7 @@ static init_fnc_t init_sequence_r[] = { #if defined(CONFIG_ID_EEPROM) mac_read_from_eeprom, #endif + INITCALL_EVENT(EVT_SETTINGS_R), INIT_FUNC_WATCHDOG_RESET #if defined(CONFIG_PCI_INIT_R) && !defined(CONFIG_SYS_EARLY_PCI_INIT) /* diff --git a/common/event.c b/common/event.c index 3080d9ed754d..dc61b9672f32 100644 --- a/common/event.c +++ b/common/event.c @@ -37,6 +37,7 @@ const char *const type_name[] = { /* init hooks */ "misc_init_f", "fsp_init_r", + "settings_r", "last_stage_init", /* Fpga load hook */ diff --git a/include/event.h b/include/event.h index c5646b713ad8..a8f046da3c32 100644 --- a/include/event.h +++ b/include/event.h @@ -104,6 +104,15 @@ enum event_t { */ EVT_FSP_INIT_F, + /** +* @EVT_SETTINGS_R: +* This event is triggered post-relocation and before console init. +* This gives an option to perform any platform-dependent setup, which +* needs to take place before show_board_info() (e.g. readout of EEPROM +* stored settings). +*/ + EVT_SETTINGS_R, + /** * @EVT_LAST_STAGE_INIT: * This event is triggered just before jumping to the main loop. -- 2.42.0
[PATCH v5 1/4] common: add prototype & rename populate_serial_number()
Rename populate_serial_number() to a more descriptive serial_read_from_eeprom() and provide the missing function prototype. This is useful for boards that wish to read their serial number from EEPROM at init. Signed-off-by: Artur Rojek Reviewed-by: Simon Glass --- v5: no change v4: - revert to the approach found in v2 - keep the new serial_read_from_eeprom() name v3: - restore original function name and make it static - provide a generic function for reading EEPROM serial number and wrap it around the existing tlv logic - move the env var check out of populate_serial_number() and into the new serial_read_from_eeprom() in order to stay consistent with the documentation v2: - rename the function - move function documentation from .c file to the prototype location cmd/tlv_eeprom.c | 14 +- include/init.h | 14 ++ 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/cmd/tlv_eeprom.c b/cmd/tlv_eeprom.c index 79796394c5c8..57cfd355df1b 100644 --- a/cmd/tlv_eeprom.c +++ b/cmd/tlv_eeprom.c @@ -1088,19 +1088,7 @@ int mac_read_from_eeprom(void) return 0; } -/** - * populate_serial_number - read the serial number from EEPROM - * - * This function reads the serial number from the EEPROM and sets the - * appropriate environment variable. - * - * The environment variable is only set if it has not been set - * already. This ensures that any user-saved variables are never - * overwritten. - * - * This function must be called after relocation. - */ -int populate_serial_number(int devnum) +int serial_read_from_eeprom(int devnum) { char serialstr[257]; int eeprom_index; diff --git a/include/init.h b/include/init.h index 4e7fe26c2004..d57a24fd00dd 100644 --- a/include/init.h +++ b/include/init.h @@ -271,6 +271,20 @@ void board_init_r(struct global_data *id, ulong dest_addr) int cpu_init_r(void); int mac_read_from_eeprom(void); + +/** + * serial_read_from_eeprom - read the serial number from EEPROM + * + * This function reads the serial number from the EEPROM and sets the + * appropriate environment variable. + * + * The environment variable is only set if it has not been set + * already. This ensures that any user-saved variables are never + * overwritten. + * + * This function must be called after relocation. + */ +int serial_read_from_eeprom(int devnum); int set_cpu_clk_info(void); int update_flash_size(int flash_size); int arch_early_init_r(void); -- 2.42.0
[PATCH v5 0/4] Conclusive KSTR-SAMA5D27 support
Hi all, this is v5 of the Conclusive KSTR-SAMA5D27 support series. Patches [1/4], [2/4] and [3/4] remain unchanged. In patch [4/4], a new dtsi file has been added in order to keep U-Boot specific properties separate from the main dts. As such, MAINTAINERS has been modified to feature the new file. An alias to the i2c node holding the EEPROM has also been explicitly added, so that it always enumerates at bus 2. Artur Rojek (4): common: add prototype & rename populate_serial_number() event: add new EVT_SETTINGS_R event arm: dts: at91: sama5: Add flexcom4 node board: Add support for Conclusive KSTR-SAMA5D27 arch/arm/dts/Makefile | 3 + arch/arm/dts/at91-kstr-sama5d27-u-boot.dtsi | 42 +++ arch/arm/dts/at91-kstr-sama5d27.dts | 127 ++ arch/arm/dts/sama5d2.dtsi | 20 ++ arch/arm/mach-at91/Kconfig| 12 + board/conclusive/kstr-sama5d27/Kconfig| 15 ++ board/conclusive/kstr-sama5d27/MAINTAINERS| 9 + board/conclusive/kstr-sama5d27/Makefile | 5 + .../conclusive/kstr-sama5d27/kstr-sama5d27.c | 239 ++ cmd/tlv_eeprom.c | 14 +- common/board_r.c | 1 + common/event.c| 1 + configs/kstr_sama5d27_defconfig | 73 ++ include/configs/kstr-sama5d27.h | 15 ++ include/event.h | 9 + include/init.h| 14 + 16 files changed, 586 insertions(+), 13 deletions(-) create mode 100644 arch/arm/dts/at91-kstr-sama5d27-u-boot.dtsi create mode 100644 arch/arm/dts/at91-kstr-sama5d27.dts create mode 100644 board/conclusive/kstr-sama5d27/Kconfig create mode 100644 board/conclusive/kstr-sama5d27/MAINTAINERS create mode 100644 board/conclusive/kstr-sama5d27/Makefile create mode 100644 board/conclusive/kstr-sama5d27/kstr-sama5d27.c create mode 100644 configs/kstr_sama5d27_defconfig create mode 100644 include/configs/kstr-sama5d27.h -- 2.42.0
[PATCH v4 4/4] board: Add support for Conclusive KSTR-SAMA5D27
Introduce support for Conclusive KSTR-SAMA5D27 Single Board Computer. Co-developed-by: Jakub Klama Signed-off-by: Jakub Klama Co-developed-by: Marcin Jabrzyk Signed-off-by: Marcin Jabrzyk Signed-off-by: Artur Rojek --- v4: - utilize EVT_SETTINGS_R in order to read MAC and serial number from EEPROM v3: - use CONFIG_ID_EEPROM to read serial number - as side-effect of using CONFIG_ID_EEPROM, KSTR-SAMA5D27 now also correctly uses EEPROM embedded MAC addresses (overlooked in v1-v2) - use CONFIG_DISPLAY_BOARDINFO_LATE for printing the board model and serial number, and provide the required checkboard() call - drop CONFIG_BOARD_LATE_INIT, as not needed anymore - defconfig cleanup v2: - remove redundant license text from at91-kstr-sama5d27.dts - when defining properties in .dts, reference nodes by labels - drop nodes for usb0 and pmic, as these aren't used by drivers - switch i2c to flexcom driver and make the necessary dts changes - sort includes in at91-kstr-sama5d27.dts alphabetically arch/arm/dts/Makefile | 3 + arch/arm/dts/at91-kstr-sama5d27.dts | 131 ++ arch/arm/mach-at91/Kconfig| 12 + board/conclusive/kstr-sama5d27/Kconfig| 15 ++ board/conclusive/kstr-sama5d27/MAINTAINERS| 8 + board/conclusive/kstr-sama5d27/Makefile | 5 + .../conclusive/kstr-sama5d27/kstr-sama5d27.c | 239 ++ configs/kstr_sama5d27_defconfig | 73 ++ include/configs/kstr-sama5d27.h | 15 ++ 9 files changed, 501 insertions(+) create mode 100644 arch/arm/dts/at91-kstr-sama5d27.dts create mode 100644 board/conclusive/kstr-sama5d27/Kconfig create mode 100644 board/conclusive/kstr-sama5d27/MAINTAINERS create mode 100644 board/conclusive/kstr-sama5d27/Makefile create mode 100644 board/conclusive/kstr-sama5d27/kstr-sama5d27.c create mode 100644 configs/kstr_sama5d27_defconfig create mode 100644 include/configs/kstr-sama5d27.h diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index bde2176ec7f6..c0f3525ed4d3 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -1198,6 +1198,9 @@ dtb-$(CONFIG_TARGET_SAMA5D27_SOM1_EK) += \ dtb-$(CONFIG_TARGET_SAMA5D27_WLSOM1_EK) += \ at91-sama5d27_wlsom1_ek.dtb +dtb-$(CONFIG_TARGET_KSTR_SAMA5D27) += \ + at91-kstr-sama5d27.dtb + dtb-$(CONFIG_TARGET_SAMA5D2_ICP) += \ at91-sama5d2_icp.dtb diff --git a/arch/arm/dts/at91-kstr-sama5d27.dts b/arch/arm/dts/at91-kstr-sama5d27.dts new file mode 100644 index ..fe9ec7e5bbc3 --- /dev/null +++ b/arch/arm/dts/at91-kstr-sama5d27.dts @@ -0,0 +1,131 @@ +// SPDX-License-Identifier: GPL-2.0+ OR X11 +/* + * at91-kstr-sama5d27.dts - Device Tree file for Conclusive KSTR-SAMA5D27 board + * + * Copyright (C) 2019-2023 Conclusive Engineering Sp. z o. o. + * + */ +/dts-v1/; + +#include "sama5d2.dtsi" +#include "sama5d2-pinfunc.h" +#include +#include +#include + +/ { + model = "Conclusive KSTR-SAMA5D27"; + compatible = "conclusive,kstr-sama5d27", "atmel,sama5d2", "atmel,sama5"; + + chosen { + bootph-all; + stdout-path = &uart1; + }; +}; + +&main_xtal { + clock-frequency = <1200>; +}; + +&sdmmc0 { + bus-width = <4>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_sdmmc0_cmd_dat_default &pinctrl_sdmmc0_ck_cd_default>; + status = "okay"; + bootph-all; +}; + +&uart1 { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_uart1_default>; + status = "okay"; + bootph-all; +}; + +&macb0 { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_macb0_rmii &pinctrl_macb0_phy_irq>; + phy-mode = "rmii"; + status = "okay"; + + ethernet-phy@0 { + reg = <0x0>; + reset-gpios = <&pioA 44 GPIO_ACTIVE_LOW>; + }; +}; + +&flx4 { + atmel,flexcom-mode = ; + status = "okay"; +}; + +&i2c6 { + clock-frequency = <10>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_flx4_i2c>; + status = "okay"; + + eeprom: eeprom@50 { + compatible = "microchip,24c32", "atmel,24c32"; + reg = <0x50>; + read-only; + pagesize = <32>; + status = "okay"; + }; +}; + +&pioA { + pinctrl { + pinctrl_uart1_default: uart1_default { + pinmux = , +; + bias-disable;
[PATCH v4 3/4] arm: dts: at91: sama5: Add flexcom4 node
Set up flexcom4 for Microchip SAMA5D27 SoC and prepare it for usage in I2C mode. Signed-off-by: Artur Rojek --- v3-v4: no change v2: new patch arch/arm/dts/sama5d2.dtsi | 20 1 file changed, 20 insertions(+) diff --git a/arch/arm/dts/sama5d2.dtsi b/arch/arm/dts/sama5d2.dtsi index dd6468ed96aa..819564fdd5bb 100644 --- a/arch/arm/dts/sama5d2.dtsi +++ b/arch/arm/dts/sama5d2.dtsi @@ -781,6 +781,26 @@ status = "disabled"; }; + flx4: flexcom@fc018000 { + compatible = "atmel,sama5d2-flexcom"; + reg = <0xfc018000 0x200>; + clocks = <&flx4_clk>; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0xfc018000 0x800>; + status = "disabled"; + + i2c6: i2c@600 { + compatible = "atmel,sama5d2-i2c"; + reg = <0x600 0x200>; + #address-cells = <1>; + #size-cells = <0>; + clocks = <&flx4_clk>; + clock-names = "i2c6_clk"; + status = "disabled"; + }; + }; + aic: interrupt-controller@fc02 { #interrupt-cells = <3>; compatible = "atmel,sama5d2-aic"; -- 2.42.0
[PATCH v4 2/4] event: add new EVT_SETTINGS_R event
Introduce EVT_SETTINGS_R, triggered post-relocation and before console init. This event gives an option to perform any platform-dependent setup, which needs to take place before show_board_info(). Usage examples include readout of EEPROM stored settings. Signed-off-by: Artur Rojek --- v4: new patch common/board_r.c | 1 + common/event.c | 1 + include/event.h | 9 + 3 files changed, 11 insertions(+) diff --git a/common/board_r.c b/common/board_r.c index 52786901be55..a7967849dc0c 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -693,6 +693,7 @@ static init_fnc_t init_sequence_r[] = { #if defined(CONFIG_ID_EEPROM) mac_read_from_eeprom, #endif + INITCALL_EVENT(EVT_SETTINGS_R), INIT_FUNC_WATCHDOG_RESET #if defined(CONFIG_PCI_INIT_R) && !defined(CONFIG_SYS_EARLY_PCI_INIT) /* diff --git a/common/event.c b/common/event.c index 3080d9ed754d..dc61b9672f32 100644 --- a/common/event.c +++ b/common/event.c @@ -37,6 +37,7 @@ const char *const type_name[] = { /* init hooks */ "misc_init_f", "fsp_init_r", + "settings_r", "last_stage_init", /* Fpga load hook */ diff --git a/include/event.h b/include/event.h index be4cefd6ae8a..a60a64718e01 100644 --- a/include/event.h +++ b/include/event.h @@ -104,6 +104,15 @@ enum event_t { */ EVT_FSP_INIT_F, + /** +* @EVT_SETTINGS_R: +* This event is triggered post-relocation and before console init. +* This gives an option to perform any platform-dependent setup, which +* needs to take place before show_board_info() (e.g. readout of EEPROM +* stored settings). +*/ + EVT_SETTINGS_R, + /** * @EVT_LAST_STAGE_INIT: * This event is triggered just before jumping to the main loop. -- 2.42.0
[PATCH v4 1/4] common: add prototype & rename populate_serial_number()
Rename populate_serial_number() to a more descriptive serial_read_from_eeprom() and provide the missing function prototype. This is useful for boards that wish to read their serial number from EEPROM at init. Signed-off-by: Artur Rojek --- v4: - revert to the approach found in v2 - keep the new serial_read_from_eeprom() name v3: - restore original function name and make it static - provide a generic function for reading EEPROM serial number and wrap it around the existing tlv logic - move the env var check out of populate_serial_number() and into the new serial_read_from_eeprom() in order to stay consistent with the documentation v2: - rename the function - move function documentation from .c file to the prototype location cmd/tlv_eeprom.c | 14 +- include/init.h | 14 ++ 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/cmd/tlv_eeprom.c b/cmd/tlv_eeprom.c index 79796394c5c8..57cfd355df1b 100644 --- a/cmd/tlv_eeprom.c +++ b/cmd/tlv_eeprom.c @@ -1088,19 +1088,7 @@ int mac_read_from_eeprom(void) return 0; } -/** - * populate_serial_number - read the serial number from EEPROM - * - * This function reads the serial number from the EEPROM and sets the - * appropriate environment variable. - * - * The environment variable is only set if it has not been set - * already. This ensures that any user-saved variables are never - * overwritten. - * - * This function must be called after relocation. - */ -int populate_serial_number(int devnum) +int serial_read_from_eeprom(int devnum) { char serialstr[257]; int eeprom_index; diff --git a/include/init.h b/include/init.h index 4e7fe26c2004..d57a24fd00dd 100644 --- a/include/init.h +++ b/include/init.h @@ -271,6 +271,20 @@ void board_init_r(struct global_data *id, ulong dest_addr) int cpu_init_r(void); int mac_read_from_eeprom(void); + +/** + * serial_read_from_eeprom - read the serial number from EEPROM + * + * This function reads the serial number from the EEPROM and sets the + * appropriate environment variable. + * + * The environment variable is only set if it has not been set + * already. This ensures that any user-saved variables are never + * overwritten. + * + * This function must be called after relocation. + */ +int serial_read_from_eeprom(int devnum); int set_cpu_clk_info(void); int update_flash_size(int flash_size); int arch_early_init_r(void); -- 2.42.0
[PATCH v4 0/4] Conclusive KSTR-SAMA5D27 support
Hi all, this is v4 of the Conclusive KSTR-SAMA5D27 support series. Patch [1/4] now reverts to the approach found in v2. Simon, while the behavior is now identical to the one from v2, I retained the serial_read_from_eeprom() function name from v3 (it makes it more consistent with the existing mac_read_from_eeprom()). Because of that, I refrained from copying your v2 Reviewed-by tag. Patch [2/4] is new. It introduces a new event, intended to be called post-relocation and before console init. As a result, [v3 2/4] patch gets dropped in favor of this much simpler solution (see [4/4] below for use case). Patch [3/4] remains unchanged. Patch [4/4] makes use of the newly introduced EVT_SETTINGS_R, utilizing it for EEPROM readout of MAC and board serial number settings. Artur Rojek (4): common: add prototype & rename populate_serial_number() event: add new EVT_SETTINGS_R event arm: dts: at91: sama5: Add flexcom4 node board: Add support for Conclusive KSTR-SAMA5D27 arch/arm/dts/Makefile | 3 + arch/arm/dts/at91-kstr-sama5d27.dts | 131 ++ arch/arm/dts/sama5d2.dtsi | 20 ++ arch/arm/mach-at91/Kconfig| 12 + board/conclusive/kstr-sama5d27/Kconfig| 15 ++ board/conclusive/kstr-sama5d27/MAINTAINERS| 8 + board/conclusive/kstr-sama5d27/Makefile | 5 + .../conclusive/kstr-sama5d27/kstr-sama5d27.c | 239 ++ cmd/tlv_eeprom.c | 14 +- common/board_r.c | 1 + common/event.c| 1 + configs/kstr_sama5d27_defconfig | 73 ++ include/configs/kstr-sama5d27.h | 15 ++ include/event.h | 9 + include/init.h| 14 + 15 files changed, 547 insertions(+), 13 deletions(-) create mode 100644 arch/arm/dts/at91-kstr-sama5d27.dts create mode 100644 board/conclusive/kstr-sama5d27/Kconfig create mode 100644 board/conclusive/kstr-sama5d27/MAINTAINERS create mode 100644 board/conclusive/kstr-sama5d27/Makefile create mode 100644 board/conclusive/kstr-sama5d27/kstr-sama5d27.c create mode 100644 configs/kstr_sama5d27_defconfig create mode 100644 include/configs/kstr-sama5d27.h -- 2.42.0
Re: [PATCH v3 1/4] common: Add generic function for reading serial number
>Hi Artur, > >On Mon, 2 Oct 2023 at 06:42, Artur Rojek wrote: >> >> Provide a generic way for boards to read their serial number from EEPROM >> at init. >> >> If CONFIG_ID_EEPROM is set, the new serial_read_from_eeprom() function >> will now be called during the post-relocation part of the board init. >> >> Provided is the tlv eeprom implementation of the above function, making >> use of the existing, yet never utilized, populate_serial_number(). >> Boards which use custom logic for interaction with their EEPROMs need to >> supply their own implementation. >> >> Signed-off-by: Artur Rojek >> --- >> >> v3: - restore original function name and make it static >> - provide a generic function for reading EEPROM serial number and >> wrap it around the existing tlv logic >> - move the env var check out of populate_serial_number() and into >> the new serial_read_from_eeprom() in order to stay consistent with >> the documentation >> >> v2: - rename the function >> - move function documentation from .c file to the prototype location >> >> cmd/tlv_eeprom.c | 25 + >> common/board_r.c | 8 >> include/init.h | 14 ++ >> 3 files changed, 31 insertions(+), 16 deletions(-) > >Can you please use events for this? Something like EVT_SETTINGS_R ? > >See the one recently added for how to do this: > >INITCALL_EVENT(EVT_LAST_STAGE_INIT), I like this approach, but just to be clear with your intention - you want me to move both serial_read_from_eeprom AND mac_read_from_eeprom into a separate function, defined for each affected board? To do this for mac_read_from_eeprom becomes slightly cumbersome, because there are this many of them, depending on the current scheme: $ grep -r "ID_EEPROM" ./configs/ | wc -l 55 If each of them needs to contain something like this: >static int settings_r(void) >{ >#if defined(CONFIG_ID_EEPROM) > mac_read_from_eeprom(); >#endif > return 0; >} >EVENT_SPY_SIMPLE(EVT_SETTINGS_R, settings_r); then this strays very far from the original intention of this series, which is to add support for a single board :) Unless you only care about serial_read_from_eeprom, then I don't need to modify any of the existing boards. Cheers, Artur > >Regards, >Simon
[PATCH v3 3/4] arm: dts: at91: sama5: Add flexcom4 node
Set up flexcom4 for Microchip SAMA5D27 SoC and prepare it for usage in I2C mode. Signed-off-by: Artur Rojek --- v3: no change v2: new patch arch/arm/dts/sama5d2.dtsi | 20 1 file changed, 20 insertions(+) diff --git a/arch/arm/dts/sama5d2.dtsi b/arch/arm/dts/sama5d2.dtsi index dd6468ed96aa..819564fdd5bb 100644 --- a/arch/arm/dts/sama5d2.dtsi +++ b/arch/arm/dts/sama5d2.dtsi @@ -781,6 +781,26 @@ status = "disabled"; }; + flx4: flexcom@fc018000 { + compatible = "atmel,sama5d2-flexcom"; + reg = <0xfc018000 0x200>; + clocks = <&flx4_clk>; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0xfc018000 0x800>; + status = "disabled"; + + i2c6: i2c@600 { + compatible = "atmel,sama5d2-i2c"; + reg = <0x600 0x200>; + #address-cells = <1>; + #size-cells = <0>; + clocks = <&flx4_clk>; + clock-names = "i2c6_clk"; + status = "disabled"; + }; + }; + aic: interrupt-controller@fc02 { #interrupt-cells = <3>; compatible = "atmel,sama5d2-aic"; -- 2.42.0
[PATCH v3 4/4] board: Add support for Conclusive KSTR-SAMA5D27
Introduce support for Conclusive KSTR-SAMA5D27 Single Board Computer. Co-developed-by: Jakub Klama Signed-off-by: Jakub Klama Co-developed-by: Marcin Jabrzyk Signed-off-by: Marcin Jabrzyk Signed-off-by: Artur Rojek --- v3: - use CONFIG_ID_EEPROM to read serial number - as side-effect of using CONFIG_ID_EEPROM, KSTR-SAMA5D27 now also correctly uses EEPROM embedded MAC addresses (overlooked in v1-v2) - use CONFIG_DISPLAY_BOARDINFO_LATE for printing the board model and serial number, and provide the required checkboard() call - drop CONFIG_BOARD_LATE_INIT, as not needed anymore - defconfig cleanup v2: - remove redundant license text from at91-kstr-sama5d27.dts - when defining properties in .dts, reference nodes by labels - drop nodes for usb0 and pmic, as these aren't used by drivers - switch i2c to flexcom driver and make the necessary dts changes - sort includes in at91-kstr-sama5d27.dts alphabetically arch/arm/dts/Makefile | 3 + arch/arm/dts/at91-kstr-sama5d27.dts | 131 ++ arch/arm/mach-at91/Kconfig| 12 + board/conclusive/kstr-sama5d27/Kconfig| 15 ++ board/conclusive/kstr-sama5d27/MAINTAINERS| 8 + board/conclusive/kstr-sama5d27/Makefile | 5 + .../conclusive/kstr-sama5d27/kstr-sama5d27.c | 230 ++ configs/kstr_sama5d27_defconfig | 74 ++ include/configs/kstr-sama5d27.h | 15 ++ 9 files changed, 493 insertions(+) create mode 100644 arch/arm/dts/at91-kstr-sama5d27.dts create mode 100644 board/conclusive/kstr-sama5d27/Kconfig create mode 100644 board/conclusive/kstr-sama5d27/MAINTAINERS create mode 100644 board/conclusive/kstr-sama5d27/Makefile create mode 100644 board/conclusive/kstr-sama5d27/kstr-sama5d27.c create mode 100644 configs/kstr_sama5d27_defconfig create mode 100644 include/configs/kstr-sama5d27.h diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index 85fd5b1157b1..8e4d33c01912 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -1198,6 +1198,9 @@ dtb-$(CONFIG_TARGET_SAMA5D27_SOM1_EK) += \ dtb-$(CONFIG_TARGET_SAMA5D27_WLSOM1_EK) += \ at91-sama5d27_wlsom1_ek.dtb +dtb-$(CONFIG_TARGET_KSTR_SAMA5D27) += \ + at91-kstr-sama5d27.dtb + dtb-$(CONFIG_TARGET_SAMA5D2_ICP) += \ at91-sama5d2_icp.dtb diff --git a/arch/arm/dts/at91-kstr-sama5d27.dts b/arch/arm/dts/at91-kstr-sama5d27.dts new file mode 100644 index ..fe9ec7e5bbc3 --- /dev/null +++ b/arch/arm/dts/at91-kstr-sama5d27.dts @@ -0,0 +1,131 @@ +// SPDX-License-Identifier: GPL-2.0+ OR X11 +/* + * at91-kstr-sama5d27.dts - Device Tree file for Conclusive KSTR-SAMA5D27 board + * + * Copyright (C) 2019-2023 Conclusive Engineering Sp. z o. o. + * + */ +/dts-v1/; + +#include "sama5d2.dtsi" +#include "sama5d2-pinfunc.h" +#include +#include +#include + +/ { + model = "Conclusive KSTR-SAMA5D27"; + compatible = "conclusive,kstr-sama5d27", "atmel,sama5d2", "atmel,sama5"; + + chosen { + bootph-all; + stdout-path = &uart1; + }; +}; + +&main_xtal { + clock-frequency = <1200>; +}; + +&sdmmc0 { + bus-width = <4>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_sdmmc0_cmd_dat_default &pinctrl_sdmmc0_ck_cd_default>; + status = "okay"; + bootph-all; +}; + +&uart1 { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_uart1_default>; + status = "okay"; + bootph-all; +}; + +&macb0 { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_macb0_rmii &pinctrl_macb0_phy_irq>; + phy-mode = "rmii"; + status = "okay"; + + ethernet-phy@0 { + reg = <0x0>; + reset-gpios = <&pioA 44 GPIO_ACTIVE_LOW>; + }; +}; + +&flx4 { + atmel,flexcom-mode = ; + status = "okay"; +}; + +&i2c6 { + clock-frequency = <10>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_flx4_i2c>; + status = "okay"; + + eeprom: eeprom@50 { + compatible = "microchip,24c32", "atmel,24c32"; + reg = <0x50>; + read-only; + pagesize = <32>; + status = "okay"; + }; +}; + +&pioA { + pinctrl { + pinctrl_uart1_default: uart1_default { + pinmux = , +; + bias-disable;
[PATCH v3 2/4] cmd: tlv_eeprom: Add support for do_mac() command
The existing mac_read_from_eeprom() is supposed to be used in conjunction with CONFIG_ID_EEPROM=y. However, when this config option is enabled, it also expects the do_mac() command to be implemented. Provide tlv_eeprom's implementation of the do_mac() command. At this point only the "read" option is supported. Signed-off-by: Artur Rojek --- v3: new patch cmd/tlv_eeprom.c | 51 1 file changed, 51 insertions(+) diff --git a/cmd/tlv_eeprom.c b/cmd/tlv_eeprom.c index 9aa9b070473e..3e9972e506b6 100644 --- a/cmd/tlv_eeprom.c +++ b/cmd/tlv_eeprom.c @@ -1088,6 +1088,57 @@ int mac_read_from_eeprom(void) return 0; } +#if defined(CONFIG_ID_EEPROM) +int do_mac(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) +{ + struct tlvinfo_tlv *eeprom_tlv; + int i, eeprom_index, maccount, devnum = 0; + u8 macbase[6], *octet_p; + + /* Only the "read" command supported for now. */ + if (argc > 1 && strcmp(argv[1], "read")) { + printf("\"%s\" command not supported\n", argv[1]); + return 0; + } + + if (read_eeprom(devnum, eeprom)) + return 0; + + maccount = 1; + if (tlvinfo_find_tlv(eeprom, TLV_CODE_MAC_SIZE, &eeprom_index)) { + eeprom_tlv = to_entry(&eeprom[eeprom_index]); + maccount = (eeprom_tlv->value[0] << 8) | eeprom_tlv->value[1]; + } + + memcpy(macbase, "\0\0\0\0\0\0", 6); + if (tlvinfo_find_tlv(eeprom, TLV_CODE_MAC_BASE, &eeprom_index)) { + eeprom_tlv = to_entry(&eeprom[eeprom_index]); + memcpy(macbase, eeprom_tlv->value, 6); + } + + if (!is_valid_ethaddr(macbase)) + return 0; + + for (i = 0; i < maccount; i++) { + printf("EEPROM MAC Address #%d: %02X:%02X:%02X:%02X:%02X:%02X\n", + i, macbase[0], macbase[1], macbase[2], macbase[3], + macbase[4], macbase[5]); + + /* Increment next MAC address. */ + for (octet_p = &macbase[5]; ++*octet_p == 0; octet_p--) { + if (octet_p == &macbase[3]) { + macbase[2] = 0; + macbase[1] = 0; + macbase[0] = 0; + break; + } + } + } + + return 0; +} +#endif + static int populate_serial_number(int devnum) { char serialstr[257]; -- 2.42.0
[PATCH v3 1/4] common: Add generic function for reading serial number
Provide a generic way for boards to read their serial number from EEPROM at init. If CONFIG_ID_EEPROM is set, the new serial_read_from_eeprom() function will now be called during the post-relocation part of the board init. Provided is the tlv eeprom implementation of the above function, making use of the existing, yet never utilized, populate_serial_number(). Boards which use custom logic for interaction with their EEPROMs need to supply their own implementation. Signed-off-by: Artur Rojek --- v3: - restore original function name and make it static - provide a generic function for reading EEPROM serial number and wrap it around the existing tlv logic - move the env var check out of populate_serial_number() and into the new serial_read_from_eeprom() in order to stay consistent with the documentation v2: - rename the function - move function documentation from .c file to the prototype location cmd/tlv_eeprom.c | 25 + common/board_r.c | 8 include/init.h | 14 ++ 3 files changed, 31 insertions(+), 16 deletions(-) diff --git a/cmd/tlv_eeprom.c b/cmd/tlv_eeprom.c index 79796394c5c8..9aa9b070473e 100644 --- a/cmd/tlv_eeprom.c +++ b/cmd/tlv_eeprom.c @@ -1088,27 +1088,12 @@ int mac_read_from_eeprom(void) return 0; } -/** - * populate_serial_number - read the serial number from EEPROM - * - * This function reads the serial number from the EEPROM and sets the - * appropriate environment variable. - * - * The environment variable is only set if it has not been set - * already. This ensures that any user-saved variables are never - * overwritten. - * - * This function must be called after relocation. - */ -int populate_serial_number(int devnum) +static int populate_serial_number(int devnum) { char serialstr[257]; int eeprom_index; struct tlvinfo_tlv *eeprom_tlv; - if (env_get("serial#")) - return 0; - if (read_eeprom(devnum, eeprom)) { printf("Read failed.\n"); return -1; @@ -1123,3 +1108,11 @@ int populate_serial_number(int devnum) return 0; } + +int serial_read_from_eeprom(void) +{ + if (env_get("serial#")) + return 0; + + return populate_serial_number(0); +} diff --git a/common/board_r.c b/common/board_r.c index 4aaa89403117..0f2cbf7bd741 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -121,6 +121,13 @@ __weak int fixup_cpu(void) return 0; } +#if defined(CONFIG_ID_EEPROM) +__weak int serial_read_from_eeprom(void) +{ + return 0; +} +#endif + static int initr_reloc_global_data(void) { #ifdef __ARM__ @@ -714,6 +721,7 @@ static init_fnc_t init_sequence_r[] = { cpu_secondary_init_r, #if defined(CONFIG_ID_EEPROM) mac_read_from_eeprom, + serial_read_from_eeprom, #endif INIT_FUNC_WATCHDOG_RESET #if defined(CONFIG_PCI_INIT_R) && !defined(CONFIG_SYS_EARLY_PCI_INIT) diff --git a/include/init.h b/include/init.h index 3bf30476a2e0..df218c95de42 100644 --- a/include/init.h +++ b/include/init.h @@ -283,6 +283,20 @@ void board_init_r(struct global_data *id, ulong dest_addr) int cpu_init_r(void); int last_stage_init(void); int mac_read_from_eeprom(void); + +/** + * serial_read_from_eeprom - read the serial number from EEPROM + * + * This function reads the serial number from the EEPROM and sets the + * appropriate environment variable. + * + * The environment variable is only set if it has not been set + * already. This ensures that any user-saved variables are never + * overwritten. + * + * This function must be called after relocation. + */ +int serial_read_from_eeprom(void); int set_cpu_clk_info(void); int update_flash_size(int flash_size); int arch_early_init_r(void); -- 2.42.0
[PATCH v3 0/4] Conclusive KSTR-SAMA5D27 support
Hi all, this is v3 of the Conclusive KSTR-SAMA5D27 support series. Patch [1/4] now takes a different approach at reading the EEPROM serial. An existing CONFIG_ID_EEPROM option provides a mechanism for reading EEPROM embedded MAC addresses at init. As this option is meant for reading various identifying features, not just MACs, I've decided to expand it by the ability of reading serial number, adding a generic serial_read_from_eeprom(). For tlv eeprom, this wraps around existing populate_serial_number(), which now becomes local to tlv_eeprom.c. Other boards which enable CONFIG_ID_EEPROM, but don't store EEPROM data as tlv, will need to provide their own implementations of serial_read_from_eeprom(). A dummy weak function has been provided to prevent compilation issues on such boards. Simon, you've already accepted the solution from v2, however changes required for [4/4] have forced me to go with this new approach. Patch [2/4] is new. CONFIG_ID_EEPROM requires that the do_mac() command exists, however implementation of this function has been missing from tlv_eeprom. This patch adds a bare minimum support for it - only handling the "mac read" flag. KSTR-SAMA5D27 is supposed to use EEPROM embedded MAC addresses, however this feature has been overlooked in previous versions of this series. Patch [3/4] remains unchanged. Patch [4/4] now uses CONFIG_DISPLAY_BOARDINFO_LATE in order to display the board model and S/N. As a side effect of that, serial access has been moved to CONFIG_ID_EEPROM (see patch [1/4]) and BOARD_LATE_INIT mechanism dropped as unnecessary. The kstr_sama5d27_defconfig has also been re-generated with savedefconfig, which got rid of some redundant flags. Artur Rojek (4): common: Add generic function for reading serial number cmd: tlv_eeprom: Add support for do_mac() command arm: dts: at91: sama5: Add flexcom4 node board: Add support for Conclusive KSTR-SAMA5D27 arch/arm/dts/Makefile | 3 + arch/arm/dts/at91-kstr-sama5d27.dts | 131 ++ arch/arm/dts/sama5d2.dtsi | 20 ++ arch/arm/mach-at91/Kconfig| 12 + board/conclusive/kstr-sama5d27/Kconfig| 15 ++ board/conclusive/kstr-sama5d27/MAINTAINERS| 8 + board/conclusive/kstr-sama5d27/Makefile | 5 + .../conclusive/kstr-sama5d27/kstr-sama5d27.c | 230 ++ cmd/tlv_eeprom.c | 76 -- common/board_r.c | 8 + configs/kstr_sama5d27_defconfig | 74 ++ include/configs/kstr-sama5d27.h | 15 ++ include/init.h| 14 ++ 13 files changed, 595 insertions(+), 16 deletions(-) create mode 100644 arch/arm/dts/at91-kstr-sama5d27.dts create mode 100644 board/conclusive/kstr-sama5d27/Kconfig create mode 100644 board/conclusive/kstr-sama5d27/MAINTAINERS create mode 100644 board/conclusive/kstr-sama5d27/Makefile create mode 100644 board/conclusive/kstr-sama5d27/kstr-sama5d27.c create mode 100644 configs/kstr_sama5d27_defconfig create mode 100644 include/configs/kstr-sama5d27.h -- 2.42.0
[PATCH v2 3/3] board: Add support for Conclusive KSTR-SAMA5D27
Introduce support for Conclusive KSTR-SAMA5D27 Single Board Computer. Co-developed-by: Jakub Klama Signed-off-by: Jakub Klama Co-developed-by: Marcin Jabrzyk Signed-off-by: Marcin Jabrzyk Signed-off-by: Artur Rojek --- v2: - remove redundant license text from at91-kstr-sama5d27.dts - when defining properties in .dts, reference nodes by labels - drop nodes for usb0 and pmic, as these aren't used by drivers - switch i2c to flexcom driver and make the necessary dts changes - sort includes in at91-kstr-sama5d27.dts alphabetically arch/arm/dts/Makefile | 3 + arch/arm/dts/at91-kstr-sama5d27.dts | 131 ++ arch/arm/mach-at91/Kconfig| 13 + board/conclusive/kstr-sama5d27/Kconfig| 15 ++ board/conclusive/kstr-sama5d27/MAINTAINERS| 8 + board/conclusive/kstr-sama5d27/Makefile | 5 + .../conclusive/kstr-sama5d27/kstr-sama5d27.c | 234 ++ configs/kstr_sama5d27_defconfig | 80 ++ include/configs/kstr-sama5d27.h | 15 ++ 9 files changed, 504 insertions(+) create mode 100644 arch/arm/dts/at91-kstr-sama5d27.dts create mode 100644 board/conclusive/kstr-sama5d27/Kconfig create mode 100644 board/conclusive/kstr-sama5d27/MAINTAINERS create mode 100644 board/conclusive/kstr-sama5d27/Makefile create mode 100644 board/conclusive/kstr-sama5d27/kstr-sama5d27.c create mode 100644 configs/kstr_sama5d27_defconfig create mode 100644 include/configs/kstr-sama5d27.h diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index 85fd5b1157b1..8e4d33c01912 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -1198,6 +1198,9 @@ dtb-$(CONFIG_TARGET_SAMA5D27_SOM1_EK) += \ dtb-$(CONFIG_TARGET_SAMA5D27_WLSOM1_EK) += \ at91-sama5d27_wlsom1_ek.dtb +dtb-$(CONFIG_TARGET_KSTR_SAMA5D27) += \ + at91-kstr-sama5d27.dtb + dtb-$(CONFIG_TARGET_SAMA5D2_ICP) += \ at91-sama5d2_icp.dtb diff --git a/arch/arm/dts/at91-kstr-sama5d27.dts b/arch/arm/dts/at91-kstr-sama5d27.dts new file mode 100644 index ..fe9ec7e5bbc3 --- /dev/null +++ b/arch/arm/dts/at91-kstr-sama5d27.dts @@ -0,0 +1,131 @@ +// SPDX-License-Identifier: GPL-2.0+ OR X11 +/* + * at91-kstr-sama5d27.dts - Device Tree file for Conclusive KSTR-SAMA5D27 board + * + * Copyright (C) 2019-2023 Conclusive Engineering Sp. z o. o. + * + */ +/dts-v1/; + +#include "sama5d2.dtsi" +#include "sama5d2-pinfunc.h" +#include +#include +#include + +/ { + model = "Conclusive KSTR-SAMA5D27"; + compatible = "conclusive,kstr-sama5d27", "atmel,sama5d2", "atmel,sama5"; + + chosen { + bootph-all; + stdout-path = &uart1; + }; +}; + +&main_xtal { + clock-frequency = <1200>; +}; + +&sdmmc0 { + bus-width = <4>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_sdmmc0_cmd_dat_default &pinctrl_sdmmc0_ck_cd_default>; + status = "okay"; + bootph-all; +}; + +&uart1 { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_uart1_default>; + status = "okay"; + bootph-all; +}; + +&macb0 { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_macb0_rmii &pinctrl_macb0_phy_irq>; + phy-mode = "rmii"; + status = "okay"; + + ethernet-phy@0 { + reg = <0x0>; + reset-gpios = <&pioA 44 GPIO_ACTIVE_LOW>; + }; +}; + +&flx4 { + atmel,flexcom-mode = ; + status = "okay"; +}; + +&i2c6 { + clock-frequency = <10>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_flx4_i2c>; + status = "okay"; + + eeprom: eeprom@50 { + compatible = "microchip,24c32", "atmel,24c32"; + reg = <0x50>; + read-only; + pagesize = <32>; + status = "okay"; + }; +}; + +&pioA { + pinctrl { + pinctrl_uart1_default: uart1_default { + pinmux = , +; + bias-disable; + bootph-all; + }; + + pinctrl_macb0_phy_irq: macb0_phy_irq { + pinmux = ; + bias-disable; + bootph-all; + }; + + pinctrl_macb0_rmii: macb0_rmii { + pinmux = , +, +, +, +, +, +
[PATCH v2 2/3] arm: dts: at91: sama5: Add flexcom4 node
Set up flexcom4 for Microchip SAMA5D27 SoC and prepare it for usage in I2C mode. Signed-off-by: Artur Rojek --- v2: new patch arch/arm/dts/sama5d2.dtsi | 20 1 file changed, 20 insertions(+) diff --git a/arch/arm/dts/sama5d2.dtsi b/arch/arm/dts/sama5d2.dtsi index dd6468ed96aa..819564fdd5bb 100644 --- a/arch/arm/dts/sama5d2.dtsi +++ b/arch/arm/dts/sama5d2.dtsi @@ -781,6 +781,26 @@ status = "disabled"; }; + flx4: flexcom@fc018000 { + compatible = "atmel,sama5d2-flexcom"; + reg = <0xfc018000 0x200>; + clocks = <&flx4_clk>; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0xfc018000 0x800>; + status = "disabled"; + + i2c6: i2c@600 { + compatible = "atmel,sama5d2-i2c"; + reg = <0x600 0x200>; + #address-cells = <1>; + #size-cells = <0>; + clocks = <&flx4_clk>; + clock-names = "i2c6_clk"; + status = "disabled"; + }; + }; + aic: interrupt-controller@fc02 { #interrupt-cells = <3>; compatible = "atmel,sama5d2-aic"; -- 2.42.0
[PATCH v2 1/3] common: add prototype & rename populate_serial_number()
Rename populate_serial_number() to a more descriptive eeprom_read_serial() and provide the missing function prototype. This is useful for boards that wish to read their serial number from EEPROM at init. Signed-off-by: Artur Rojek --- v2: - rename the function - move function documentation from .c file to the prototype location cmd/tlv_eeprom.c | 14 +- include/init.h | 14 ++ 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/cmd/tlv_eeprom.c b/cmd/tlv_eeprom.c index 79796394c5c8..47c127ca4950 100644 --- a/cmd/tlv_eeprom.c +++ b/cmd/tlv_eeprom.c @@ -1088,19 +1088,7 @@ int mac_read_from_eeprom(void) return 0; } -/** - * populate_serial_number - read the serial number from EEPROM - * - * This function reads the serial number from the EEPROM and sets the - * appropriate environment variable. - * - * The environment variable is only set if it has not been set - * already. This ensures that any user-saved variables are never - * overwritten. - * - * This function must be called after relocation. - */ -int populate_serial_number(int devnum) +int eeprom_read_serial(int devnum) { char serialstr[257]; int eeprom_index; diff --git a/include/init.h b/include/init.h index 3bf30476a2e0..f18f3b9961d8 100644 --- a/include/init.h +++ b/include/init.h @@ -283,6 +283,20 @@ void board_init_r(struct global_data *id, ulong dest_addr) int cpu_init_r(void); int last_stage_init(void); int mac_read_from_eeprom(void); + +/** + * eeprom_read_serial - read the serial number from EEPROM + * + * This function reads the serial number from the EEPROM and sets the + * appropriate environment variable. + * + * The environment variable is only set if it has not been set + * already. This ensures that any user-saved variables are never + * overwritten. + * + * This function must be called after relocation. + */ +int eeprom_read_serial(int devnum); int set_cpu_clk_info(void); int update_flash_size(int flash_size); int arch_early_init_r(void); -- 2.42.0
[PATCH v2 0/3] Conclusive KSTR-SAMA5D27 support
Hi all, this is v2 of the Conclusive KSTR-SAMA5D27 support series. Patch [1/3] now also renames the EEPROM serial number function and moves its documentation from .c file to the .h. We should be fine doing that, as - to my knowledge - no other part of U-Boot seems to be using this symbol, as evidenced by the missing prototype. Patch [2/3] is new. It is the direct result of moving i2c as a child of flexcom (see below). Patch [3/3] now also addresses multiple dts issues. In particular, all node access is now being done through label references, unused nodes have been removed, and the i2c now goes explicitly through flexcom. Artur Rojek (3): common: add prototype & rename populate_serial_number() arm: dts: at91: sama5: Add flexcom4 node board: Add support for Conclusive KSTR-SAMA5D27 arch/arm/dts/Makefile | 3 + arch/arm/dts/at91-kstr-sama5d27.dts | 131 ++ arch/arm/dts/sama5d2.dtsi | 20 ++ arch/arm/mach-at91/Kconfig| 13 + board/conclusive/kstr-sama5d27/Kconfig| 15 ++ board/conclusive/kstr-sama5d27/MAINTAINERS| 8 + board/conclusive/kstr-sama5d27/Makefile | 5 + .../conclusive/kstr-sama5d27/kstr-sama5d27.c | 234 ++ cmd/tlv_eeprom.c | 14 +- configs/kstr_sama5d27_defconfig | 80 ++ include/configs/kstr-sama5d27.h | 15 ++ include/init.h| 14 ++ 12 files changed, 539 insertions(+), 13 deletions(-) create mode 100644 arch/arm/dts/at91-kstr-sama5d27.dts create mode 100644 board/conclusive/kstr-sama5d27/Kconfig create mode 100644 board/conclusive/kstr-sama5d27/MAINTAINERS create mode 100644 board/conclusive/kstr-sama5d27/Makefile create mode 100644 board/conclusive/kstr-sama5d27/kstr-sama5d27.c create mode 100644 configs/kstr_sama5d27_defconfig create mode 100644 include/configs/kstr-sama5d27.h -- 2.42.0
Re: [PATCH 2/2] board: Add support for Conclusive KSTR-SAMA5D27
Hey Eugen, thanks for the review. >Hello, > >Thank you for your patch, > >On 9/21/23 18:37, Artur Rojek wrote: >> Introduce support for Conclusive KSTR-SAMA5D27 Single Board Computer. >> >> Co-developed-by: Jakub Klama >> Signed-off-by: Jakub Klama >> Co-developed-by: Marcin Jabrzyk >> Signed-off-by: Marcin Jabrzyk >> Signed-off-by: Artur Rojek >> --- >> arch/arm/dts/Makefile | 3 + >> arch/arm/dts/at91-kstr-sama5d27.dts | 310 ++ >> arch/arm/mach-at91/Kconfig| 13 + >> board/conclusive/kstr-sama5d27/Kconfig| 15 + >> board/conclusive/kstr-sama5d27/MAINTAINERS| 8 + >> board/conclusive/kstr-sama5d27/Makefile | 5 + >> .../conclusive/kstr-sama5d27/kstr-sama5d27.c | 235 + >> configs/kstr_sama5d27_defconfig | 79 + >> include/configs/kstr-sama5d27.h | 15 + >> 9 files changed, 683 insertions(+) >> create mode 100644 arch/arm/dts/at91-kstr-sama5d27.dts >> create mode 100644 board/conclusive/kstr-sama5d27/Kconfig >> create mode 100644 board/conclusive/kstr-sama5d27/MAINTAINERS >> create mode 100644 board/conclusive/kstr-sama5d27/Makefile >> create mode 100644 board/conclusive/kstr-sama5d27/kstr-sama5d27.c >> create mode 100644 configs/kstr_sama5d27_defconfig >> create mode 100644 include/configs/kstr-sama5d27.h >> >> diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile >> index 85fd5b1157b1..8e4d33c01912 100644 >> --- a/arch/arm/dts/Makefile >> +++ b/arch/arm/dts/Makefile >> @@ -1198,6 +1198,9 @@ dtb-$(CONFIG_TARGET_SAMA5D27_SOM1_EK) += \ >> dtb-$(CONFIG_TARGET_SAMA5D27_WLSOM1_EK) += \ >> at91-sama5d27_wlsom1_ek.dtb >> >> +dtb-$(CONFIG_TARGET_KSTR_SAMA5D27) += \ >> +at91-kstr-sama5d27.dtb >> + >> dtb-$(CONFIG_TARGET_SAMA5D2_ICP) += \ >> at91-sama5d2_icp.dtb >> >> diff --git a/arch/arm/dts/at91-kstr-sama5d27.dts >> b/arch/arm/dts/at91-kstr-sama5d27.dts >> new file mode 100644 >> index ..6de918a3c964 >> --- /dev/null >> +++ b/arch/arm/dts/at91-kstr-sama5d27.dts >> @@ -0,0 +1,310 @@ >> +// SPDX-License-Identifier: GPL-2.0+ OR X11 >> +/* >> + * at91-kstr-sama5d27.dts - Device Tree file for Conclusive KSTR-SAMA5D27 >> board >> + * >> + * Copyright (C) 2019-2023 Conclusive Engineering Sp. z o. o. > >SPDX tag is enough, no need to replicate the license text below > >> + * >> + * This file is dual-licensed: you can use it either under the terms >> + * of the GPL or the X11 license, at your option. Note that this dual >> + * licensing only applies to this file, and not this project as a >> + * whole. >> + * >> + * a) This file is free software; you can redistribute it and/or >> + * modify it under the terms of the GNU General Public License as >> + * published by the Free Software Foundation; either version 2 of the >> + * License, or (at your option) any later version. >> + * >> + * This file is distributed in the hope that it will be useful, >> + * but WITHOUT ANY WARRANTY; without even the implied warranty of >> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >> + * GNU General Public License for more details. >> + * >> + * Or, alternatively, >> + * >> + * b) Permission is hereby granted, free of charge, to any person >> + * obtaining a copy of this software and associated documentation >> + * files (the "Software"), to deal in the Software without >> + * restriction, including without limitation the rights to use, >> + * copy, modify, merge, publish, distribute, sublicense, and/or >> + * sell copies of the Software, and to permit persons to whom the >> + * Software is furnished to do so, subject to the following >> + * conditions: >> + * >> + * The above copyright notice and this permission notice shall be >> + * included in all copies or substantial portions of the Software. >> + * >> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, >> + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES >> + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND >> + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT >> + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, >> + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING >
Re: [PATCH 1/2] common: add prototype for populate_serial_number()
Hi Simon, thanks for the review. >Hi Artur, > >On Thu, 21 Sept 2023 at 09:44, Artur Rojek wrote: >> >> Provide function prototype for populate_serial_number(). >> This is useful for boards that wish to read their serial number from >> EEPROM at init. >> >> Signed-off-by: Artur Rojek >> --- >> include/init.h | 1 + >> 1 file changed, 1 insertion(+) >> >> diff --git a/include/init.h b/include/init.h >> index 3bf30476a2e0..e0b7fbc943ad 100644 >> --- a/include/init.h >> +++ b/include/init.h >> @@ -283,6 +283,7 @@ void board_init_r(struct global_data *id, ulong >> dest_addr) >> int cpu_init_r(void); >> int last_stage_init(void); >> int mac_read_from_eeprom(void); >> +int populate_serial_number(int devnum); > >Please can you add a comment for this function? You can move it from the C >file. > >I also suggest renaming it to something like eeprom_get_serial() or >something like that. I'll go with eeprom_read_serial(), as the one you suggested is apparently already taken by board/gateworks/venice/eeprom.c. > >> int set_cpu_clk_info(void); >> int update_flash_size(int flash_size); >> int arch_early_init_r(void); >> -- >> 2.42.0 >> > >BTW tlv_eeprom.c should really be converted to driver model. It should, but maybe at some other opportunity :) Cheers, Artur > >Regards, >Simon
[PATCH 2/2] board: Add support for Conclusive KSTR-SAMA5D27
Introduce support for Conclusive KSTR-SAMA5D27 Single Board Computer. Co-developed-by: Jakub Klama Signed-off-by: Jakub Klama Co-developed-by: Marcin Jabrzyk Signed-off-by: Marcin Jabrzyk Signed-off-by: Artur Rojek --- arch/arm/dts/Makefile | 3 + arch/arm/dts/at91-kstr-sama5d27.dts | 310 ++ arch/arm/mach-at91/Kconfig| 13 + board/conclusive/kstr-sama5d27/Kconfig| 15 + board/conclusive/kstr-sama5d27/MAINTAINERS| 8 + board/conclusive/kstr-sama5d27/Makefile | 5 + .../conclusive/kstr-sama5d27/kstr-sama5d27.c | 235 + configs/kstr_sama5d27_defconfig | 79 + include/configs/kstr-sama5d27.h | 15 + 9 files changed, 683 insertions(+) create mode 100644 arch/arm/dts/at91-kstr-sama5d27.dts create mode 100644 board/conclusive/kstr-sama5d27/Kconfig create mode 100644 board/conclusive/kstr-sama5d27/MAINTAINERS create mode 100644 board/conclusive/kstr-sama5d27/Makefile create mode 100644 board/conclusive/kstr-sama5d27/kstr-sama5d27.c create mode 100644 configs/kstr_sama5d27_defconfig create mode 100644 include/configs/kstr-sama5d27.h diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index 85fd5b1157b1..8e4d33c01912 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -1198,6 +1198,9 @@ dtb-$(CONFIG_TARGET_SAMA5D27_SOM1_EK) += \ dtb-$(CONFIG_TARGET_SAMA5D27_WLSOM1_EK) += \ at91-sama5d27_wlsom1_ek.dtb +dtb-$(CONFIG_TARGET_KSTR_SAMA5D27) += \ + at91-kstr-sama5d27.dtb + dtb-$(CONFIG_TARGET_SAMA5D2_ICP) += \ at91-sama5d2_icp.dtb diff --git a/arch/arm/dts/at91-kstr-sama5d27.dts b/arch/arm/dts/at91-kstr-sama5d27.dts new file mode 100644 index ..6de918a3c964 --- /dev/null +++ b/arch/arm/dts/at91-kstr-sama5d27.dts @@ -0,0 +1,310 @@ +// SPDX-License-Identifier: GPL-2.0+ OR X11 +/* + * at91-kstr-sama5d27.dts - Device Tree file for Conclusive KSTR-SAMA5D27 board + * + * Copyright (C) 2019-2023 Conclusive Engineering Sp. z o. o. + * + * This file is dual-licensed: you can use it either under the terms + * of the GPL or the X11 license, at your option. Note that this dual + * licensing only applies to this file, and not this project as a + * whole. + * + * a) This file is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This file is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * Or, alternatively, + * + * b) Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ +/dts-v1/; + +#include "sama5d2.dtsi" +#include "sama5d2-pinfunc.h" +#include +#include + +/ { + model = "Conclusive KSTR-SAMA5D27"; + compatible = "conclusive,kstr-sama5d27", "atmel,sama5d2", "atmel,sama5"; + + chosen { + bootph-all; + stdout-path = &uart1; + }; + + clocks { + main_xtal: main_xtal { + clock-frequency = <1200>; + }; + }; + + ahb { + usb0: gadget@0030 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "atmel,sama5d3-udc"; + reg = <0x0030 0x10 + 0xfc02c000 0x400>; + interrupts = <42 IRQ_TYPE_L
[PATCH 1/2] common: add prototype for populate_serial_number()
Provide function prototype for populate_serial_number(). This is useful for boards that wish to read their serial number from EEPROM at init. Signed-off-by: Artur Rojek --- include/init.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/init.h b/include/init.h index 3bf30476a2e0..e0b7fbc943ad 100644 --- a/include/init.h +++ b/include/init.h @@ -283,6 +283,7 @@ void board_init_r(struct global_data *id, ulong dest_addr) int cpu_init_r(void); int last_stage_init(void); int mac_read_from_eeprom(void); +int populate_serial_number(int devnum); int set_cpu_clk_info(void); int update_flash_size(int flash_size); int arch_early_init_r(void); -- 2.42.0
[PATCH 0/2] Conclusive KSTR-SAMA5D27 support
Hi all, this series adds support for Conclusive KSTR-SAMA5D27, a Microchip SAMA5D27 SoC based Single Board Computer by Conclusive Engineering. Patch [1/2] adds a missing prototype for populate_serial_number(), which is used by KSTR-SAMA5D27 in order to read its serial number embedded in EEPROM TLV. Patch [2/2] introduces KSTR-SAMA5D27 support, including board init, Device Tree and defconfig files. An appropriate MAINTAINERS entry is also provided. A new board/conclusive subdirectory is added in anticipation of future support of our other products. Note that the "if (IS_ENABLED(CONFIG...))" checkpatch warnings for this patch are considered by me as false positives. Artur Rojek (2): common: add prototype for populate_serial_number() board: Add support for Conclusive KSTR-SAMA5D27 arch/arm/dts/Makefile | 3 + arch/arm/dts/at91-kstr-sama5d27.dts | 310 ++ arch/arm/mach-at91/Kconfig| 13 + board/conclusive/kstr-sama5d27/Kconfig| 15 + board/conclusive/kstr-sama5d27/MAINTAINERS| 8 + board/conclusive/kstr-sama5d27/Makefile | 5 + .../conclusive/kstr-sama5d27/kstr-sama5d27.c | 235 + configs/kstr_sama5d27_defconfig | 79 + include/configs/kstr-sama5d27.h | 15 + include/init.h| 1 + 10 files changed, 684 insertions(+) create mode 100644 arch/arm/dts/at91-kstr-sama5d27.dts create mode 100644 board/conclusive/kstr-sama5d27/Kconfig create mode 100644 board/conclusive/kstr-sama5d27/MAINTAINERS create mode 100644 board/conclusive/kstr-sama5d27/Makefile create mode 100644 board/conclusive/kstr-sama5d27/kstr-sama5d27.c create mode 100644 configs/kstr_sama5d27_defconfig create mode 100644 include/configs/kstr-sama5d27.h -- 2.42.0
[PATCH] USB: gadget: atmel: fix transfer of queued requests
In the existing implementation, multiple requests queued up on an endpoint are subject to getting evicted without transmission. For both control and bulk endpoints, their respective logic found in usba_control_irq()/usba_ep_irq() guarantees that TX FIFO is empty before data is sent out, and that request_complete() gets called once the transaction has been finished. At this point however, if any additional requests are found on the endpoint queue, they will be processed by submit_next_request(), which makes no checks against the above conditions, trashing data on a busy FIFO and neglecting completion handlers. Fix the above issues by removing the calls to submit_next_request(), and thus forcing the pending requests to be processed on the next pass of the respective endpoint logic. While at it, remove a DBG message, as that branch becomes part of regular flow. This restores mass storage mode operation on Microchip ATSAMA5D27 SoC. Signed-off-by: Artur Rojek --- drivers/usb/gadget/atmel_usba_udc.c | 11 ++- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c index 7d51821497b4..e6b458d940d8 100644 --- a/drivers/usb/gadget/atmel_usba_udc.c +++ b/drivers/usb/gadget/atmel_usba_udc.c @@ -57,13 +57,9 @@ static void submit_request(struct usba_ep *ep, struct usba_request *req) req->submitted = 1; next_fifo_transaction(ep, req); - if (req->last_transaction) { - usba_ep_writel(ep, CTL_DIS, USBA_TX_PK_RDY); - usba_ep_writel(ep, CTL_ENB, USBA_TX_COMPLETE); - } else { + if (ep_is_control(ep)) usba_ep_writel(ep, CTL_DIS, USBA_TX_COMPLETE); - usba_ep_writel(ep, CTL_ENB, USBA_TX_PK_RDY); - } + usba_ep_writel(ep, CTL_ENB, USBA_TX_PK_RDY); } static void submit_next_request(struct usba_ep *ep) @@ -889,7 +885,6 @@ restart: if (req) { list_del_init(&req->queue); request_complete(ep, req, 0); - submit_next_request(ep); } usba_ep_writel(ep, CTL_DIS, USBA_TX_COMPLETE); ep->state = WAIT_FOR_SETUP; @@ -1036,7 +1031,6 @@ static void usba_ep_irq(struct usba_udc *udc, struct usba_ep *ep) DBG(DBG_BUS, "%s: TX PK ready\n", ep->ep.name); if (list_empty(&ep->queue)) { - DBG(DBG_INT, "ep_irq: queue empty\n"); usba_ep_writel(ep, CTL_DIS, USBA_TX_PK_RDY); return; } @@ -1050,7 +1044,6 @@ static void usba_ep_irq(struct usba_udc *udc, struct usba_ep *ep) if (req->last_transaction) { list_del_init(&req->queue); - submit_next_request(ep); request_complete(ep, req, 0); } -- 2.42.0