add support for Enclustra Mercury AA1 SoMs
v2 cover add support for Enclustra Mercury AA1 SoMs
Introduce the support for three variants of Enclustra's Intel Mercury AA1 (with Intel Arria10) SoMs and additional configs. This is supposed to be the first step to upstream several of Enclustras SoC FPGA Modules. There are still things to be modified. So, this is supposed to start the discussion and also to clarify some of my open issues.
On the DT approach: I can agree that in parallel I may go for upstreaming the kernel DT. There is a fundamental difference, still: In order to represent the combination of module + baseboard + bootmode for the kernel DT we have to use a mechanism like DTO. For u-boot this can be simpler. Currently the few adjustments needed will be represented by the DT files as are. I propose to keep them, and in case remove them later, which I doubt, since the full DT for the kernel will cover more details. In case refactoring is needed I can update the DT also in u-boot.
---
v1 -> v2:
- removal si5338 driver
- removal si5338 driver usage
- rename .c file for the boot cmd, build conditionally
- add separate .c file for late boot init to read MAC address from eeprom
- keep DT approach for u-boot under discussion
- fix issues in doc
- update MAINTAINERS to cover doc
---
Lothar Rubusch (7):
doc: board: enclustra: add Enclustra Intel AA1 SoM
ARM: dts: socfpga: add Enclustra Intel AA1
ARM: socfpga: add Enclustra AA1 SoM support
ARM: socfpga: add Enclustra AA1 extra env settings
ARM: socfpga: add Enclustra AA1 demo env files
ARM: socfpga: add Enclustra AA1 boot scripts
ARM: socfpga: AA1: support MAC from secure eeprom
arch/arm/dts/ME-AA1-270-2I2-D11E-NFX3.dtsi | 14 + arch/arm/dts/ME-AA1-270-3E4-D11E-NFX3.dtsi | 14 + arch/arm/dts/ME-AA1-480-2I3-D12E-NFX3.dtsi | 15 + arch/arm/dts/Makefile | 2 + arch/arm/dts/enclustra-aa1.dts | 32 ++ .../dts/socfpga_arria10_mercury_aa1_handoff.h | 307 ++++++++++++++++++ .../dts/socfpga_enclustra_mercury_aa1.dtsi | 179 ++++++++++ ...cfpga_enclustra_mercury_aa1_qspi_boot.dtsi | 18 + ...fpga_enclustra_mercury_aa1_sdmmc_boot.dtsi | 18 + .../dts/socfpga_enclustra_mercury_pe1.dtsi | 7 + .../dts/socfpga_enclustra_mercury_pe3.dtsi | 8 + .../dts/socfpga_enclustra_mercury_st1.dtsi | 8 + arch/arm/mach-socfpga/Kconfig | 9 + board/enclustra/bootscripts/qspi-aa1.cmd | 12 + board/enclustra/bootscripts/sd-aa1.cmd | 10 + board/enclustra/common/Kconfig | 24 ++ board/enclustra/common/Makefile | 7 + board/enclustra/common/enclustra_mac.h | 48 +++ board/enclustra/common/mac_atsha204.c | 97 ++++++ board/enclustra/common/mac_common.c | 54 +++ board/enclustra/common/mac_ds28.c | 88 +++++ board/enclustra/mercury_aa1/Kconfig | 15 + board/enclustra/mercury_aa1/MAINTAINERS | 11 + board/enclustra/mercury_aa1/Makefile | 10 + .../mercury_aa1/aa1_board_late_init.c | 17 + .../mercury_aa1/aa1_set_storage_cmd.c | 177 ++++++++++ board/enclustra/mercury_aa1/bitstream.its | 32 ++ board/enclustra/mercury_aa1/mercury_aa1.env | 65 ++++ .../socfpga_enclustra_mercury_aa1_defconfig | 79 +++++ doc/board/enclustra/index.rst | 9 + doc/board/enclustra/mercury-aa1.rst | 207 ++++++++++++ doc/board/index.rst | 1 + drivers/misc/Kconfig | 2 +- include/configs/socfpga_mercury_aa1.h | 68 ++++ 34 files changed, 1663 insertions(+), 1 deletion(-) create mode 100644 arch/arm/dts/ME-AA1-270-2I2-D11E-NFX3.dtsi create mode 100644 arch/arm/dts/ME-AA1-270-3E4-D11E-NFX3.dtsi create mode 100644 arch/arm/dts/ME-AA1-480-2I3-D12E-NFX3.dtsi create mode 100644 arch/arm/dts/enclustra-aa1.dts create mode 100644 arch/arm/dts/socfpga_arria10_mercury_aa1_handoff.h create mode 100644 arch/arm/dts/socfpga_enclustra_mercury_aa1.dtsi create mode 100644 arch/arm/dts/socfpga_enclustra_mercury_aa1_qspi_boot.dtsi create mode 100644 arch/arm/dts/socfpga_enclustra_mercury_aa1_sdmmc_boot.dtsi create mode 100644 arch/arm/dts/socfpga_enclustra_mercury_pe1.dtsi create mode 100644 arch/arm/dts/socfpga_enclustra_mercury_pe3.dtsi create mode 100644 arch/arm/dts/socfpga_enclustra_mercury_st1.dtsi create mode 100644 board/enclustra/bootscripts/qspi-aa1.cmd create mode 100644 board/enclustra/bootscripts/sd-aa1.cmd create mode 100644 board/enclustra/common/Kconfig create mode 100644 board/enclustra/common/Makefile create mode 100644 board/enclustra/common/enclustra_mac.h create mode 100644 board/enclustra/common/mac_atsha204.c create mode 100644 board/enclustra/common/mac_common.c create mode 100644 board/enclustra/common/mac_ds28.c create mode 100644 board/enclustra/mercury_aa1/Kconfig create mode 100644 board/enclustra/mercury_aa1/MAINTAINERS create mode 100644 board/enclustra/mercury_aa1/Makefile create mode 100644 board/enclustra/mercury_aa1/aa1_board_late_init.c create mode 100644 board/enclustra/mercury_aa1/aa1_set_storage_cmd.c create mode 100644 board/enclustra/mercury_aa1/bitstream.its create mode 100644 board/enclustra/mercury_aa1/mercury_aa1.env create mode 100644 configs/socfpga_enclustra_mercury_aa1_defconfig create mode 100644 doc/board/enclustra/index.rst create mode 100644 doc/board/enclustra/mercury-aa1.rst create mode 100644 include/configs/socfpga_mercury_aa1.h
Signature · 1 line
2.25.1
PATCH v2 1/7 doc: board: enclustra: add Enclustra Intel AA1 SoM
Start documentation section for Enclustra. Cover Enclustra Intel SoMs and related carrier board setups.
- Mercury AA1 (Arria10)
--- doc/board/enclustra/index.rst | 9 ++ doc/board/enclustra/mercury-aa1.rst | 207 ++++++++++++++++++++++++++++ doc/board/index.rst | 1 + 3 files changed, 217 insertions(+) create mode 100644 doc/board/enclustra/index.rst create mode 100644 doc/board/enclustra/mercury-aa1.rst
doc/board/enclustra/index.rst new file +9 -0
@@ -0,0 +1,9 @@ +.. SPDX-License-Identifier: GPL-2.0+ + +Enclustra +========= + +.. toctree:: + :maxdepth: 2 + + mercury-aa1
doc/board/enclustra/mercury-aa1.rst new file +207 -0
207 lines not on this page · raw message
doc/board/index.rst +1 -0
@@ -24,6 +24,7 @@ Board-specific doc congatec/index coreboot/index emulation/index + enclustra/index gateworks/index google/index highbank/index
Signature · 1 line
2.25.1
PATCH v2 2/7 ARM: dts: socfpga: add Enclustra Intel AA1
In reply to Lothar RubuschIntroduce device-tree files for Enclustra Intel AA1 SoMs and related support.
- Mercury AA1
The setup depends on a selected boot mode. Various fragments for SD/MMC and QSPI flash boot are provided.
In combination, the following Enclustra carrier boards are supported:
- ST1
- PE1
- PE3
--- arch/arm/dts/ME-AA1-270-2I2-D11E-NFX3.dtsi | 14 + arch/arm/dts/ME-AA1-270-3E4-D11E-NFX3.dtsi | 14 + arch/arm/dts/ME-AA1-480-2I3-D12E-NFX3.dtsi | 15 + arch/arm/dts/Makefile | 2 + arch/arm/dts/enclustra-aa1.dts | 32 ++ .../dts/socfpga_arria10_mercury_aa1_handoff.h | 307 ++++++++++++++++++ .../dts/socfpga_enclustra_mercury_aa1.dtsi | 179 ++++++++++ ...cfpga_enclustra_mercury_aa1_qspi_boot.dtsi | 18 + ...fpga_enclustra_mercury_aa1_sdmmc_boot.dtsi | 18 + .../dts/socfpga_enclustra_mercury_pe1.dtsi | 7 + .../dts/socfpga_enclustra_mercury_pe3.dtsi | 8 + .../dts/socfpga_enclustra_mercury_st1.dtsi | 8 + 12 files changed, 622 insertions(+) create mode 100644 arch/arm/dts/ME-AA1-270-2I2-D11E-NFX3.dtsi create mode 100644 arch/arm/dts/ME-AA1-270-3E4-D11E-NFX3.dtsi create mode 100644 arch/arm/dts/ME-AA1-480-2I3-D12E-NFX3.dtsi create mode 100644 arch/arm/dts/enclustra-aa1.dts create mode 100644 arch/arm/dts/socfpga_arria10_mercury_aa1_handoff.h create mode 100644 arch/arm/dts/socfpga_enclustra_mercury_aa1.dtsi create mode 100644 arch/arm/dts/socfpga_enclustra_mercury_aa1_qspi_boot.dtsi create mode 100644 arch/arm/dts/socfpga_enclustra_mercury_aa1_sdmmc_boot.dtsi create mode 100644 arch/arm/dts/socfpga_enclustra_mercury_pe1.dtsi create mode 100644 arch/arm/dts/socfpga_enclustra_mercury_pe3.dtsi create mode 100644 arch/arm/dts/socfpga_enclustra_mercury_st1.dtsi
arch/arm/dts/ME-AA1-270-2I2-D11E-NFX3.dtsi new file +14 -0
@@ -0,0 +1,14 @@ +// SPDX-License-Identifier: GPL-2.0+ OR MIT +/* + * Copyright (C) 2024 Enclustra GmbH - https://www.enclustra.com + */ + +/ { + model = "Enclustra Mercury+ AA1"; + + memory@0 { + name = "memory"; + device_type = "memory"; + reg = <0x0 0x80000000>; /* 2GB */ + }; +};
arch/arm/dts/ME-AA1-270-3E4-D11E-NFX3.dtsi new file +14 -0
@@ -0,0 +1,14 @@ +// SPDX-License-Identifier: GPL-2.0+ OR MIT +/* + * Copyright (C) 2024 Enclustra GmbH - https://www.enclustra.com + */ + +/ { + model = "Enclustra Mercury+ AA1"; + + memory@0 { + name = "memory"; + device_type = "memory"; + reg = <0x0 0x80000000>; /* 2GB */ + }; +};
arch/arm/dts/ME-AA1-480-2I3-D12E-NFX3.dtsi new file +15 -0
@@ -0,0 +1,15 @@ +// SPDX-License-Identifier: GPL-2.0+ OR MIT +/* + * Copyright (C) 2024 Enclustra GmbH - https://www.enclustra.com + */ + +/ { + model = "Enclustra Mercury+ AA1"; + + /* The module is equipped with 4Gbyte RAM but U-Boot limits the size to 2 Gbyte */ + memory@0 { + name = "memory"; + device_type = "memory"; + reg = <0x0 0x80000000>; /* 2GB */ + }; +};
arch/arm/dts/Makefile +2 -0
@@ -414,6 +414,8 @@ dtb-$(CONFIG_ARCH_SOCFPGA) += \ socfpga_n5x_socdk.dtb \ socfpga_stratix10_socdk.dtb +dtb-$(CONFIG_TARGET_SOCFPGA_ENCLUSTRA_MERCURY_AA1) += enclustra-aa1.dtb + dtb-$(CONFIG_TARGET_DRA7XX_EVM) += dra72-evm.dtb dra7-evm.dtb \ dra72-evm-revc.dtb dra71-evm.dtb dra76-evm.dtb dtb-$(CONFIG_TARGET_AM57XX_EVM) += am57xx-beagle-x15.dtb \
arch/arm/dts/enclustra-aa1.dts new file +32 -0
@@ -0,0 +1,32 @@ +// SPDX-License-Identifier: GPL-2.0+ OR MIT +/* + * Copyright (C) 2024 Enclustra GmbH - https://www.enclustra.com + */ + +/dts-v1/; + +/* arria10 family - NB: keep the order of the includes */ +#include "socfpga_arria10.dtsi" +#include "socfpga_arria10-u-boot.dtsi" + +/* The generated handoff.h goes here */ +#include "socfpga_arria10_mercury_aa1_handoff.h" + +/* Generic arria10 glue */ +#include "socfpga_arria10-handoff.dtsi" +#include "socfpga_arria10_handoff_u-boot.dtsi" +#include "socfpga_enclustra_mercury_aa1.dtsi" + +/* Select the boot mode: sd/mmc or qspi */ +//#include "socfpga_enclustra_mercury_aa1_qspi_boot.dtsi" +#include "socfpga_enclustra_mercury_aa1_sdmmc_boot.dtsi" + +/* Select the carrier board */ +//#include "socfpga_enclustra_mercury_st1.dtsi" +#include "socfpga_enclustra_mercury_pe1.dtsi" +//#include "socfpga_enclustra_mercury_pe3.dtsi" + +/* Select the type of AA1 module */ +//#include "ME-AA1-270-2I2-D11E-NFX3.dtsi" +//#include "ME-AA1-270-3E4-D11E-NFX3.dtsi" +#include "ME-AA1-480-2I3-D12E-NFX3.dtsi"
arch/arm/dts/socfpga_arria10_mercury_aa1_handoff.h new file +307 -0
307 lines not on this page · raw message
arch/arm/dts/socfpga_enclustra_mercury_aa1.dtsi new file +179 -0
179 lines not on this page · raw message
arch/arm/dts/socfpga_enclustra_mercury_aa1_qspi_boot.dtsi new file +18 -0
@@ -0,0 +1,18 @@ +// SPDX-License-Identifier: GPL-2.0+ OR MIT +/* + * Copyright (C) 2024 Enclustra GmbH - https://www.enclustra.com + */ + +/ { + fs_loader0: fs-loader { + bootph-all; + compatible = "u-boot,fs-loader"; + sfconfig = <0 0 50000000 3>; + }; +}; + +&fpga_mgr { + bootph-all; + firmware-loader = <&fs_loader0>; + altr,bitstream = "300000"; +};
arch/arm/dts/socfpga_enclustra_mercury_aa1_sdmmc_boot.dtsi new file +18 -0
@@ -0,0 +1,18 @@ +// SPDX-License-Identifier: GPL-2.0+ OR MIT +/* + * Copyright (C) 2024 Enclustra GmbH - https://www.enclustra.com + */ + +/ { + fs_loader0: fs-loader { + bootph-all; + compatible = "u-boot,fs-loader"; + phandlepart = <&mmc 1>; + }; +}; + +&fpga_mgr { + bootph-all; + firmware-loader = <&fs_loader0>; + altr,bitstream = "bitstream.itb"; +};
arch/arm/dts/socfpga_enclustra_mercury_pe1.dtsi new file +7 -0
@@ -0,0 +1,7 @@ +// SPDX-License-Identifier: GPL-2.0+ OR MIT +/* + * Copyright (C) 2024 Enclustra GmbH - https://www.enclustra.com + */ + +/ { +};
arch/arm/dts/socfpga_enclustra_mercury_pe3.dtsi new file +8 -0
@@ -0,0 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0+ OR MIT +/* + * Copyright (C) 2024 Enclustra GmbH - https://www.enclustra.com + */ + +&i2c_encl_fpga { + status = "okay"; +};
arch/arm/dts/socfpga_enclustra_mercury_st1.dtsi new file +8 -0
@@ -0,0 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0+ OR MIT +/* + * Copyright (C) 2024 Enclustra GmbH - https://www.enclustra.com + */ + +&i2c_encl_fpga { + status = "okay"; +};
Signature · 1 line
2.25.1
PATCH v2 3/7 ARM: socfpga: add Enclustra AA1 SoM support
In reply to Lothar RubuschIntroduce initial support for the Enclustra SoMs:
- Mercury AA1
Cover general board files for SD/MMC and QSPI boot modes. Integrate the boards to kconfig. All build variants will depend on Quartus handoff files, thus they depend on the particular Quartus design. The approach is covered in the according documentation part.
Additionally add configuration for SD/MMC boot and QSPI bootmodes. Register additional targets in kconfig.
--- arch/arm/mach-socfpga/Kconfig | 9 + board/enclustra/common/Kconfig | 1 + board/enclustra/common/Makefile | 4 + board/enclustra/mercury_aa1/Kconfig | 15 ++ board/enclustra/mercury_aa1/MAINTAINERS | 11 ++ board/enclustra/mercury_aa1/Makefile | 8 + .../mercury_aa1/aa1_set_storage_cmd.c | 177 ++++++++++++++++++ board/enclustra/mercury_aa1/bitstream.its | 32 ++++ .../socfpga_enclustra_mercury_aa1_defconfig | 78 ++++++++ include/configs/socfpga_mercury_aa1.h | 33 ++++ 10 files changed, 368 insertions(+) create mode 100644 board/enclustra/common/Kconfig create mode 100644 board/enclustra/common/Makefile create mode 100644 board/enclustra/mercury_aa1/Kconfig create mode 100644 board/enclustra/mercury_aa1/MAINTAINERS create mode 100644 board/enclustra/mercury_aa1/Makefile create mode 100644 board/enclustra/mercury_aa1/aa1_set_storage_cmd.c create mode 100644 board/enclustra/mercury_aa1/bitstream.its create mode 100644 configs/socfpga_enclustra_mercury_aa1_defconfig create mode 100644 include/configs/socfpga_mercury_aa1.h
arch/arm/mach-socfpga/Kconfig +9 -0
@@ -221,6 +221,10 @@ config TARGET_SOCFPGA_TERASIC_SOCKIT bool "Terasic SoCkit (Cyclone V)" select TARGET_SOCFPGA_CYCLONE5 +config TARGET_SOCFPGA_ENCLUSTRA_MERCURY_AA1 + bool "Enclustra Mercury+ AA1" + select TARGET_SOCFPGA_ARRIA10 + endchoice config SYS_BOARD
@@ -244,6 +248,7 @@ config SYS_BOARD default "sr1500" if TARGET_SOCFPGA_SR1500 default "stratix10-socdk" if TARGET_SOCFPGA_STRATIX10_SOCDK default "vining_fpga" if TARGET_SOCFPGA_SOFTING_VINING_FPGA + default "mercury_aa1" if TARGET_SOCFPGA_ENCLUSTRA_MERCURY_AA1 config SYS_VENDOR default "intel" if TARGET_SOCFPGA_AGILEX5_SOCDK
@@ -264,6 +269,7 @@ config SYS_VENDOR default "terasic" if TARGET_SOCFPGA_TERASIC_DE10_NANO default "terasic" if TARGET_SOCFPGA_TERASIC_DE10_STANDARD default "terasic" if TARGET_SOCFPGA_TERASIC_SOCKIT + default "enclustra" if TARGET_SOCFPGA_ENCLUSTRA_MERCURY_AA1 config SYS_SOC default "socfpga"
@@ -289,5 +295,8 @@ config SYS_CONFIG_NAME default "socfpga_sr1500" if TARGET_SOCFPGA_SR1500 default "socfpga_stratix10_socdk" if TARGET_SOCFPGA_STRATIX10_SOCDK default "socfpga_vining_fpga" if TARGET_SOCFPGA_SOFTING_VINING_FPGA + default "socfpga_mercury_aa1" if TARGET_SOCFPGA_ENCLUSTRA_MERCURY_AA1 + +source "board/enclustra/common/Kconfig" endif
board/enclustra/common/Kconfig new file +1 -0
@@ -0,0 +1 @@ +source "board/enclustra/mercury_aa1/Kconfig"
board/enclustra/common/Makefile new file +4 -0
@@ -0,0 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0+ +# Copyright (c) 2024 Enclustra GmbH + +# Common for several Enclustra modules
board/enclustra/mercury_aa1/Kconfig new file +15 -0
@@ -0,0 +1,15 @@ +if TARGET_SOCFPGA_ENCLUSTRA_MERCURY_AA1 + +config SYS_CPU + default "armv7" + +config SYS_BOARD + default "mercury_aa1" + +config SYS_VENDOR + default "enclustra" + +config SYS_CONFIG_NAME + default "socfpga_mercury_aa1" + +endif
board/enclustra/mercury_aa1/MAINTAINERS new file +11 -0
@@ -0,0 +1,11 @@ +Enclustra Mercury+ AA1 +M: Lothar Rubusch <[email protected]> +S: Maintained +F: board/enclustra/mercury_aa1/ +F: board/enclustra/common/ +F: include/configs/socfpga_mercury_aa1.h +F: configs/socfpga_enclustra_mercury_aa1_defconfig +F: arch/arm/dts/socfpga_enclustra_mercury_aa1.dtsi +F: arch/arm/dts/socfpga_enclustra_mercury_aa1_emmc_boot.dtsi +F: arch/arm/dts/socfpga_enclustra_mercury_aa1_qspi_boot.dtsi +F: doc/board/enclustra/mercury-aa1.rst
board/enclustra/mercury_aa1/Makefile new file +8 -0
@@ -0,0 +1,8 @@ +# SPDX-License-Identifier: GPL-2.0+ +# Copyright (c) 2024 Enclustra GmbH + +ifeq ($(CONFIG_SPL_BUILD),) + +obj-y += aa1_set_storage_cmd.o + +endif
board/enclustra/mercury_aa1/aa1_set_storage_cmd.c new file +177 -0
177 lines not on this page · raw message
board/enclustra/mercury_aa1/bitstream.its new file +32 -0
@@ -0,0 +1,32 @@ +/dts-v1/; + +/ { + description = "FIT image with FPGA bistream"; + #address-cells = <1>; + + images { + fpga-periph-1 { + description = "FPGA peripheral bitstream"; + data = /incbin/("bitstream.periph.rbf"); + type = "fpga"; + arch = "arm"; + compression = "none"; + }; + + fpga-core-1 { + description = "FPGA core bitstream"; + data = /incbin/("bitstream.core.rbf"); + type = "fpga"; + arch = "arm"; + compression = "none"; + }; + }; + + configurations { + default = "config-1"; + config-1 { + description = "Boot with FPGA early IO release config"; + fpga = "fpga-periph-1", "fpga-core-1"; + }; + }; +};
configs/socfpga_enclustra_mercury_aa1_defconfig new file +78 -0
78 lines not on this page · raw message
include/configs/socfpga_mercury_aa1.h new file +33 -0
@@ -0,0 +1,33 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Copyright (C) 2024 Enclustra GmbH +* <[email protected]> +*/ + +#ifndef __CONFIG_SOCFGPA_MERCURY_AA1_H__ +#define __CONFIG_SOCFGPA_MERCURY_AA1_H__ + +#include <asm/arch/base_addr_a10.h> + +/* +* U-Boot general configurations +*/ + +/* Memory configurations */ +#define PHYS_SDRAM_1_SIZE 0x80000000 + +/* +* Serial / UART configurations +*/ +#define CFG_SYS_BAUDRATE_TABLE {4800, 9600, 19200, 38400, 57600, 115200} + +/* +* L4 OSC1 Timer 0 +*/ +/* reload value when timer count to zero */ +#define TIMER_LOAD_VAL 0xFFFFFFFF + +/* The rest of the configuration is shared */ +#include <configs/socfpga_common.h> + +#endif /* __CONFIG_SOCFGPA_MERCURY_AA1_H__ */
Signature · 1 line
2.25.1
Re: [PATCH v2 3/7] ARM: socfpga: add Enclustra AA1 SoM support
On 9/17/24 8:21 AM, Lothar Rubusch wrote:
[...]
arch/arm/mach-socfpga/Kconfig config TARGET_SOCFPGA_TERASIC_SOCKIT · line 227
Quoted 12 lines
arch/arm/mach-socfpga/Kconfig +4
-0@@ -221,6 +221,10 @@ config TARGET_SOCFPGA_TERASIC_SOCKIT bool "Terasic SoCkit (Cyclone V)" select TARGET_SOCFPGA_CYCLONE5 +config TARGET_SOCFPGA_ENCLUSTRA_MERCURY_AA1 + bool "Enclustra Mercury+ AA1" + select TARGET_SOCFPGA_ARRIA10 +
Keep the list sorted.
arch/arm/mach-socfpga/Kconfig config SYS_BOARD · line 251
Quoted 8 lines
arch/arm/mach-socfpga/Kconfig +1
-0endchoice config SYS_BOARD@@ -244,6 +248,7 @@ config SYS_BOARD default "sr1500" if TARGET_SOCFPGA_SR1500 default "stratix10-socdk" if TARGET_SOCFPGA_STRATIX10_SOCDK default "vining_fpga" if TARGET_SOCFPGA_SOFTING_VINING_FPGA + default "mercury_aa1" if TARGET_SOCFPGA_ENCLUSTRA_MERCURY_AA1
Keep the list sorted.
arch/arm/mach-socfpga/Kconfig config SYS_VENDOR · line 272
Quoted 7 lines
arch/arm/mach-socfpga/Kconfig +1
-0config SYS_VENDOR default "intel" if TARGET_SOCFPGA_AGILEX5_SOCDK@@ -264,6 +269,7 @@ config SYS_VENDOR default "terasic" if TARGET_SOCFPGA_TERASIC_DE10_NANO default "terasic" if TARGET_SOCFPGA_TERASIC_DE10_STANDARD default "terasic" if TARGET_SOCFPGA_TERASIC_SOCKIT + default "enclustra" if TARGET_SOCFPGA_ENCLUSTRA_MERCURY_AA1
Keep the list sorted.
arch/arm/mach-socfpga/Kconfig config SYS_CONFIG_NAME · line 298
Quoted 7 lines
arch/arm/mach-socfpga/Kconfig +1
-0config SYS_SOC default "socfpga"@@ -289,5 +295,8 @@ config SYS_CONFIG_NAME default "socfpga_sr1500" if TARGET_SOCFPGA_SR1500 default "socfpga_stratix10_socdk" if TARGET_SOCFPGA_STRATIX10_SOCDK default "socfpga_vining_fpga" if TARGET_SOCFPGA_SOFTING_VINING_FPGA + default "socfpga_mercury_aa1" if TARGET_SOCFPGA_ENCLUSTRA_MERCURY_AA1
Keep the list sorted.
arch/arm/mach-socfpga/Kconfig config SYS_CONFIG_NAME · line 300
Quoted 1 line
arch/arm/mach-socfpga/Kconfig +1
-0+source "board/enclustra/common/Kconfig"
include the socfpga Kconfig directly, if more SoMs gets upstreamed, they might be Xilinx too so including common/Kconfig won't make sense here.
Quoted 1 line
arch/arm/mach-socfpga/Kconfig +0
-0endif
[...]
Quoted 6 lines
board/enclustra/mercury_aa1/MAINTAINERS new file +0
-0
board/enclustra/mercury_aa1/MAINTAINERS line 10
Quoted 10 lines
board/enclustra/mercury_aa1/MAINTAINERS new file +10
-0@@ -0,0 +1,11 @@ +Enclustra Mercury+ AA1 +M: Lothar Rubusch <[email protected]> +S: Maintained +F: board/enclustra/mercury_aa1/ +F: board/enclustra/common/ +F: include/configs/socfpga_mercury_aa1.h +F: configs/socfpga_enclustra_mercury_aa1_defconfig +F: arch/arm/dts/socfpga_enclustra_mercury_aa1.dtsi +F: arch/arm/dts/socfpga_enclustra_mercury_aa1_emmc_boot.dtsi +F: arch/arm/dts/socfpga_enclustra_mercury_aa1_qspi_boot.dtsi
Try these regex patterns (see top level MAINTAINERS file for details) , they should cover pretty much everything listed here automatically:
N: enclustra
N: mercury_aa1
Quoted 39 lines
board/enclustra/mercury_aa1/MAINTAINERS new file +1
-0+F: doc/board/enclustra/mercury-aa1.rstboard/enclustra/mercury_aa1/Makefile new file +8
-0@@ -0,0 +1,8 @@ +# SPDX-License-Identifier: GPL-2.0+ +# Copyright (c) 2024 Enclustra GmbH + +ifeq ($(CONFIG_SPL_BUILD),) + +obj-y += aa1_set_storage_cmd.o + +endifboard/enclustra/mercury_aa1/aa1_set_storage_cmd.c new file +18
-0@@ -0,0 +1,177 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Copyright (C) 2024 Enclustra GmbH +* <[email protected]> +*/ + +#include <command.h> +#include <env.h> +#include <init.h> +#include <dm/uclass.h> +#include <asm-generic/gpio.h> +#include <asm/io.h> + +/* Pin muxing */ +#define ALTERA_NONE 0 +#define ALTERA_MMC 1 +#define ALTERA_QSPI 2 +#define ALTERA_EMMC 3
board/enclustra/mercury_aa1/aa1_set_storage_cmd.c line 28
Quoted 10 lines
board/enclustra/mercury_aa1/aa1_set_storage_cmd.c new file +10
-0+#define MMC_CLK_DIV 0x9 +#define QSPI_CLK_DIV 0x384 +#define ALTERA_PINMUX_OFFS 0xffd07200 +#define ALTERA_CLKMGR_MAINPLL_CNTR6CLK_BASE 0xFFD04078 + +static int altera_current_storage =ALTERA_NONE ; + +static void set_mux_mmc (void ) +{ +u32 pinmux_arr[] = {0x0c ,0x8 ,// IO4 connected to SDMMC
This can be static const u32 , DTTO all the other arrays.
Quoted 5 lines
board/enclustra/mercury_aa1/aa1_set_storage_cmd.c new file +5
-0+0x10 ,0x8 ,// IO5 +0x14 ,0x8 ,// IO6 +0x18 ,0x8 ,// IO7 +0x1c ,0x8 ,// IO8 + 0x20, 0x8, // IO9
board/enclustra/mercury_aa1/aa1_set_storage_cmd.c line 43
Quoted 10 lines
board/enclustra/mercury_aa1/aa1_set_storage_cmd.c new file +10
-0+0x24 ,0xf ,// IO10 connected to GPIO +0x28 ,0xf ,// IO11 +0x2c ,0xf ,// IO12 +0x30 ,0xf ,// IO13 +0x34 ,0xf ,// IO14 + 0x38, 0xf}; // IO15 +u32 len, i, offset, value; + + len =sizeof (pinmux_arr) /sizeof (u32); +for (i =0 ; i < len; i +=2 ) {
Surely this function and all of its follow up almost identical copies can be deduplicated.
Quoted 21 lines
board/enclustra/mercury_aa1/aa1_set_storage_cmd.c new file +21
-0+ offset = pinmux_arr[i]; + value = pinmux_arr[i +1 ]; +writel (value,ALTERA_PINMUX_OFFS + offset); + } +} + +static void set_mux_emmc (void ) +{ +u32 pinmux_arr[] = {0x0c ,0x8 ,// IO4 +0x10 ,0x8 ,// IO5 +0x14 ,0x8 ,// IO6 +0x18 ,0x8 ,// IO7 +0x1c ,0x8 ,// IO8 +0x20 ,0x8 ,// IO9 +0x24 ,0xf ,// IO10 +0x28 ,0xf ,// IO11 +0x2c ,0x8 ,// IO12 +0x30 ,0x8 ,// IO13 +0x34 ,0x8 ,// IO14 +0x38 ,0x8 };// IO15 +u32 len, i, offset, value;
board/enclustra/mercury_aa1/aa1_set_storage_cmd.c line 74
Quoted 10 lines
board/enclustra/mercury_aa1/aa1_set_storage_cmd.c new file +10
-0+ + len =sizeof (pinmux_arr) /sizeof (u32); +for (i =0 ; i < len; i +=2 ) { + offset = pinmux_arr[i]; + value = pinmux_arr[i +1 ]; +writel (value,ALTERA_PINMUX_OFFS + offset); + } +} + +static void set_mux_qspi (void )
Some more specific name of this symbol would be useful, e.g. enclustra_mercury_aa1_set_mux_qspi , since that symbol then shows up in e.g. objdump -D and unique name makes it easy to identify what it is.
Quoted 28 lines
board/enclustra/mercury_aa1/aa1_set_storage_cmd.c new file +28
-0+{ +u32 pinmux_arr[] = {0x0c ,0x4 ,// IO4 connected to QSPI +0x10 ,0x4 ,// IO5 +0x14 ,0x4 ,// IO6 +0x18 ,0x4 ,// IO7 +0x1c ,0x4 ,// IO8 +0x20 ,0x4 ,// IO9 +0x24 ,0xf ,// IO10 +0x28 ,0xf ,// IO11 +0x2c ,0xf ,// IO12 +0x30 ,0xf ,// IO13 +0x34 ,0xf ,// IO14 +0x38 ,0xf };// IO15 +u32 len, i, offset, value; + + len =sizeof (pinmux_arr) /sizeof (u32); +for (i =0 ; i < len; i +=2 ) { + offset = pinmux_arr[i]; + value = pinmux_arr[i +1 ]; +writel (value,ALTERA_PINMUX_OFFS + offset); + } +} + +static void altera_set_storage (int store) +{ +unsigned int gpio_flash_sel; +unsigned int gpio_flash_oe; +
board/enclustra/mercury_aa1/aa1_set_storage_cmd.c line 112
Quoted 10 lines
board/enclustra/mercury_aa1/aa1_set_storage_cmd.c new file +10
-0+if (store == altera_current_storage) +return ; + +if (gpio_lookup_name ("portb5" ,NULL ,NULL , &gpio_flash_oe)) { +printf ("ERROR: GPIO not found\n" ); +return ; + } + +if (gpio_request (gpio_flash_oe,"flash_oe" )) { +printf ("ERROR: GPIO request failed\n" );
Does this look up have to be done for every single invocation of the command ?
This is missing gpio_free() for fail case.
Return value should be propagated in case of failure.
Quoted 71 lines
board/enclustra/mercury_aa1/aa1_set_storage_cmd.c new file +65
-0+return ; + } + +if (gpio_lookup_name ("portc6" ,NULL ,NULL , &gpio_flash_sel)) { +printf ("ERROR: GPIO not found\n" ); +return ; + } + +if (gpio_request (gpio_flash_sel,"flash_sel" )) { +printf ("ERROR: GPIO request failed\n" ); +return ; + } + +switch (store) { +case ALTERA_MMC : +set_mux_mmc (); +gpio_direction_output (gpio_flash_sel,0 ); +gpio_direction_output (gpio_flash_oe,0 ); + altera_current_storage =ALTERA_MMC ; +writel (MMC_CLK_DIV ,ALTERA_CLKMGR_MAINPLL_CNTR6CLK_BASE ); +break ; +case ALTERA_EMMC : +set_mux_emmc (); +gpio_direction_output (gpio_flash_sel,1 ); +gpio_direction_output (gpio_flash_oe,1 ); + altera_current_storage =ALTERA_EMMC ; +writel (MMC_CLK_DIV ,ALTERA_CLKMGR_MAINPLL_CNTR6CLK_BASE ); +break ; +case ALTERA_QSPI : +set_mux_qspi (); +gpio_direction_output (gpio_flash_sel,1 ); +gpio_direction_output (gpio_flash_oe,0 ); + altera_current_storage =ALTERA_QSPI ; +writel (QSPI_CLK_DIV ,ALTERA_CLKMGR_MAINPLL_CNTR6CLK_BASE ); +break ; +default : + altera_current_storage =ALTERA_NONE ; +break ; + } + +gpio_free (gpio_flash_sel); +gpio_free (gpio_flash_oe); +} + +static int altera_set_storage_cmd (struct cmd_tbl *cmdtp,int flag, +int argc,char *const argv[]) +{ +if (argc !=2 ) +return CMD_RET_USAGE ; + +if (!strcmp (argv[1 ],"MMC" )) +altera_set_storage (ALTERA_MMC ); +else if (!strcmp (argv[1 ],"QSPI" )) +altera_set_storage (ALTERA_QSPI ); +else if (!strcmp (argv[1 ],"EMMC" )) +altera_set_storage (ALTERA_EMMC ); +else +return CMD_RET_USAGE ; + +return CMD_RET_SUCCESS ; +} + +U_BOOT_CMD (altera_set_storage,2 ,0 , altera_set_storage_cmd, +"Set non volatile memory access" , +"<MMC|QSPI|EMMC> - Set access for the selected memory device" );board/enclustra/mercury_aa1/bitstream.its new file +0
-0
board/enclustra/mercury_aa1/bitstream.its line 5
Quoted 5 lines
board/enclustra/mercury_aa1/bitstream.its new file +5
-0@@ -0,0 +1,32 @@ +/dts-v1/; + +/ { + description = "FIT image with FPGA bistream"; + #address-cells = <1>;
This address-cells shouldn't be needed here ?
Quoted 27 lines
board/enclustra/mercury_aa1/bitstream.its new file +27
-0+ + images { + fpga-periph-1 { + description = "FPGA peripheral bitstream"; + data = /incbin/("bitstream.periph.rbf"); + type = "fpga"; + arch = "arm"; + compression = "none"; + }; + + fpga-core-1 { + description = "FPGA core bitstream"; + data = /incbin/("bitstream.core.rbf"); + type = "fpga"; + arch = "arm"; + compression = "none"; + }; + }; + + configurations { + default = "config-1"; + config-1 { + description = "Boot with FPGA early IO release config"; + fpga = "fpga-periph-1", "fpga-core-1"; + }; + }; +};
[...]
Quoted 18 lines
include/configs/socfpga_mercury_aa1.h new file +12
-0@@ -0,0 +1,33 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Copyright (C) 2024 Enclustra GmbH +* <[email protected]> +*/ + +#ifndef __CONFIG_SOCFGPA_MERCURY_AA1_H__ +#define __CONFIG_SOCFGPA_MERCURY_AA1_H__ + +#include <asm/arch/base_addr_a10.h> + +/*
include/configs/socfpga_mercury_aa1.h line 22
Quoted 10 lines
include/configs/socfpga_mercury_aa1.h new file +10
-0+* U-Boot general configurations +*/ + +/* Memory configurations */ +#define PHYS_SDRAM_1_SIZE 0x80000000 + +/* +* Serial / UART configurations +*/ +#define CFG_SYS_BAUDRATE_TABLE {4800, 9600, 19200, 38400, 57600, 115200}
Is this needed or is the default baud rate table enough ?
include/configs/socfpga_mercury_aa1.h line 28
Quoted 5 lines
include/configs/socfpga_mercury_aa1.h new file +5
-0+/* +* L4 OSC1 Timer 0 +*/ +/* reload value when timer count to zero */ +#define TIMER_LOAD_VAL 0xFFFFFFFF
Is this needed ?
PATCH v2 4/7 ARM: socfpga: add Enclustra AA1 extra env settings
In reply to Lothar RubuschAdd command files for boot scripts and initial boot environment.
--- include/configs/socfpga_mercury_aa1.h | 35 +++++++++++++++++++++++++++ 1 file changed, 35 insertions(+)
include/configs/socfpga_mercury_aa1.h +35 -0
@@ -21,6 +21,41 @@*/ #define CFG_SYS_BAUDRATE_TABLE {4800, 9600, 19200, 38400, 57600, 115200} +/* U-Boot environment */ +#define CFG_EXTRA_ENV_SETTINGS \ + "bitstream_size=0xD00000\0" \ + "bootargs=earlycon console=ttyS0,115200 rw rootwait root=/dev/mmcblk0p3\0" \ + "bootargs_qspi=earlycon console=ttyS0,115200 rw root=/dev/ram0\0" \ + "bootm_size=0x0a000000\0" \ + "env_size=0x80000\0" \ + "fdt_addr_r=0x10000000\0" \ + "fdtfile=system.dtb\0" \ + "fdtload=load ${devtype} ${devnum}:${distro_bootpart} ${fdt_addr_r} ${bootdir}/${fdtfile}; load ${devtype} ${devnum}:${distro_bootpart} ${fdto_addr_r} ${bootdir}/${fdtofile}; fdt addr $fdt_addr_r; fdt resize 8192; fdt apply $fdto_addr_r\0" \ + "fdtload_qspi=sf probe; sf read ${fdt_addr_r} ${qspi_offset_addr_devicetree} ${fdt_size}; sf read ${fdto_addr_r} ${qspi_offset_addr_dtoverlay} ${fdto_size}; fdt addr ${fdt_addr_r}; fdt resize 8192; fdt apply ${fdto_addr_r}\0" \ + "fdto_addr_r=0x100c0000\0" \ + "fdtofile=socfpga_enclustra_mercury_XXX_overlay.dtbo\0" \ + "fdto_size=0x40000\0" \ + "fdt_size=0x40000\0" \ + "kernel_addr_r=0x11000000\0" \ + "kernel_size=0x1000000\0" \ + "qspiboot=source ${scriptaddr}\0" \ + "qspiload=setenv bootargs ${bootargs_qspi}; sf probe; sf read ${scriptaddr} ${qspi_offset_addr_boot_script} ${scriptsize}\0" \ + "qspi_offset_addr_bitstream=0x300000\0" \ + "qspi_offset_addr_boot_script=0x200000\0" \ + "qspi_offset_addr_devicetree=0x280000\0" \ + "qspi_offset_addr_dtoverlay=0x2c0000\0" \ + "qspi_offset_addr_kernel=0x1000000\0" \ + "qspi_offset_addr_rootfs=0x2000000\0" \ + "qspi_offset_addr_spl=0x0\0" \ + "qspi_offset_addr_uboot=0x100000\0" \ + "qspi_offset_addr_uboot_env=0x180000\0" \ + "rootfs_addr_r=0x12000000\0" \ + "rootfs_size=0x2000000\0" \ + "scriptaddr=0x10800000\0" \ + "scriptsize=0x80000\0" \ + "spl_size=0x100000\0" \ + "uboot_size=0x80000\0" +/* * L4 OSC1 Timer 0 */
Signature · 1 line
2.25.1
Re: [PATCH v2 4/7] ARM: socfpga: add Enclustra AA1 extra env settings
Quoted 17 lines · Lothar Rubusch
Add command files for boot scripts and initial boot environment.
Signed-off-by Andreas Buerkler <[email protected]>Signed-off-by Lothar Rubusch <[email protected]>--- include/configs/socfpga_mercury_aa1.h | 35 +++++++++++++++++++++++++++ 1 file changed, 35 insertions(+)include/configs/socfpga_mercury_aa1.h +1
-0@@ -21,6 +21,41 @@*/ #define CFG_SYS_BAUDRATE_TABLE {4800, 9600, 19200, 38400, 57600, 115200} +/* U-Boot environment */
include/configs/socfpga_mercury_aa1.h line 34
Quoted 10 lines
include/configs/socfpga_mercury_aa1.h +10
-0+#define CFG_EXTRA_ENV_SETTINGS \ + "bitstream_size=0xD00000\0" \ + "bootargs=earlycon console=ttyS0,115200 rw rootwait root=/dev/mmcblk0p3\0" \ + "bootargs_qspi=earlycon console=ttyS0,115200 rw root=/dev/ram0\0" \ + "bootm_size=0x0a000000\0" \ + "env_size=0x80000\0" \ + "fdt_addr_r=0x10000000\0" \ + "fdtfile=system.dtb\0" \ + "fdtload=load ${devtype} ${devnum}:${distro_bootpart} ${fdt_addr_r} ${bootdir}/${fdtfile}; load ${devtype} ${devnum}:${distro_bootpart} ${fdto_addr_r} ${bootdir}/${fdtofile}; fdt addr $fdt_addr_r; fdt resize 8192; fdt apply $fdto_addr_r\0" \ + "fdtload_qspi=sf probe; sf read ${fdt_addr_r} ${qspi_offset_addr_devicetree} ${fdt_size}; sf read ${fdto_addr_r} ${qspi_offset_addr_dtoverlay} ${fdto_size}; fdt addr ${fdt_addr_r}; fdt resize 8192; fdt apply ${fdto_addr_r}\0" \
Use && instead of ; to bail from the script right after failing command instead of running through the whole script after failing command.
Quoted 13 lines
include/configs/socfpga_mercury_aa1.h +13
-0+"fdto_addr_r=0x100c0000\0" \ +"fdtofile=socfpga_enclustra_mercury_XXX_overlay.dtbo\0" \ +"fdto_size=0x40000\0" \ +"fdt_size=0x40000\0" \ +"kernel_addr_r=0x11000000\0" \ +"kernel_size=0x1000000\0" \ +"qspiboot=source ${scriptaddr}\0" \ +"qspiload=setenv bootargs ${bootargs_qspi}; sf probe; sf read ${scriptaddr} ${qspi_offset_addr_boot_script} ${scriptsize}\0" \ +"qspi_offset_addr_bitstream=0x300000\0" \ +"qspi_offset_addr_boot_script=0x200000\0" \ +"qspi_offset_addr_devicetree=0x280000\0" \ +"qspi_offset_addr_dtoverlay=0x2c0000\0" \ +"qspi_offset_addr_kernel=0x1000000\0" \
include/configs/socfpga_mercury_aa1.h line 57
Quoted 10 lines
include/configs/socfpga_mercury_aa1.h +10
-0+"qspi_offset_addr_rootfs=0x2000000\0" \ +"qspi_offset_addr_spl=0x0\0" \ +"qspi_offset_addr_uboot=0x100000\0" \ +"qspi_offset_addr_uboot_env=0x180000\0" \ +"rootfs_addr_r=0x12000000\0" \ +"rootfs_size=0x2000000\0" \ +"scriptaddr=0x10800000\0" \ +"scriptsize=0x80000\0" \ +"spl_size=0x100000\0" \ +"uboot_size=0x80000\0"
Squash this into 3/7 already .
PATCH v2 5/7 ARM: socfpga: add Enclustra AA1 demo env files
In reply to Lothar RubuschProvide additional uboot.env text environment files meant as a generic demo. The default environment uses a uboot.env. The default environment works somehow. This environment provides better support but only shows one possible approach used in the Enclustra reference design setups.
--- board/enclustra/mercury_aa1/mercury_aa1.env | 65 +++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 board/enclustra/mercury_aa1/mercury_aa1.env
board/enclustra/mercury_aa1/mercury_aa1.env new file +65 -0
@@ -0,0 +1,65 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2024 Enclustra GmbH + * <[email protected]> + * + * This is an example configuration file for uboot.env generation. + * + * Given ENV_FAT_FILE defaults to "uboot.env" and ENV_SIZE defaults to 0x80000 + * (see configuration options). Then adjust the configuration to your needs and + * build the a binary .env file as follows + * $ ./tools/mkenvimage -s 0x80000 -o uboot.env ./board/enclustra/mercury_aa1/mercury_aa1.env + * + * NB: Without providing this binary uboot.env the board is supposed to come up + * with the generic environment based on the architecture. This can be helpful + * when upgrading and/or recuding environments. + */ +bitstream_size=0xD00000 +bootargs=earlycon console=ttyS0,115200 rw rootwait root=/dev/mmcblk0p3 +bootargs_qspi=earlycon console=ttyS0,115200 rw root=/dev/ram0 +bootm_size=0x0a000000 +devnum=0 +devtype=mmc +distro_bootpart=1 +env_size=0x80000 +fdt_addr_r=0x10000000 +fdtfile=system.dtb +fdtload= + load ${devtype} ${devnum}:${distro_bootpart} ${fdt_addr_r} ${bootdir}/${fdtfile}; + load ${devtype} ${devnum}:${distro_bootpart} ${fdto_addr_r} ${bootdir}/${fdtofile}; + fdt addr $fdt_addr_r; + fdt resize 8192; + fdt apply $fdto_addr_r +fdtload_qspi= + sf probe; + sf read ${fdt_addr_r} ${qspi_offset_addr_devicetree} ${fdt_size}; + sf read ${fdto_addr_r} ${qspi_offset_addr_dtoverlay} ${fdto_size}; + fdt addr ${fdt_addr_r}; + fdt resize 8192; + fdt apply ${fdto_addr_r} +fdto_addr_r=0x100c0000 +fdtofile=socfpga_enclustra_mercury_sdmmc_overlay.dtbo +fdto_size=0x40000 +fdt_size=0x40000 +kernel_addr_r=0x11000000 +kernel_size=0x1000000 +qspiboot=source ${scriptaddr} +qspiload= + setenv bootargs ${bootargs_qspi}; + sf probe; + sf read ${scriptaddr} ${qspi_offset_addr_boot_script} ${scriptsize} +qspi_offset_addr_bitstream=0x300000 +qspi_offset_addr_boot_script=0x200000 +qspi_offset_addr_devicetree=0x280000 +qspi_offset_addr_dtoverlay=0x2c0000 +qspi_offset_addr_kernel=0x1000000 +qspi_offset_addr_rootfs=0x2000000 +qspi_offset_addr_spl=0x0 +qspi_offset_addr_uboot=0x100000 +qspi_offset_addr_uboot_env=0x180000 +rootfs_addr_r=0x12000000 +rootfs_size=0x2000000 +scriptaddr=0x10800000 +scriptsize=0x80000 +spl_size=0x100000 +uboot_size=0x80000
Signature · 1 line
2.25.1
Re: [PATCH v2 5/7] ARM: socfpga: add Enclustra AA1 demo env files
Quoted 3 lines · Lothar Rubusch
Provide additional uboot.env text environment files meant as a generic demo. The default environment uses a uboot.env. The default environment works somehow.
What does this "somehow" mean ?
Quoted 18 lines
This environment provides better support but only shows one possible approach used in the Enclustra reference design setups.
Signed-off-by Lothar Rubusch <[email protected]>--- board/enclustra/mercury_aa1/mercury_aa1.env | 65 +++++++++++++++++++++ 1 file changed, 65 insertions(+)create mode 100644 board/enclustra/mercury_aa1/mercury_aa1.env
board/enclustra/mercury_aa1/mercury_aa1.env new file +3
-0@@ -0,0 +1,65 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2024 Enclustra GmbH
board/enclustra/mercury_aa1/mercury_aa1.env line 13
Quoted 10 lines
board/enclustra/mercury_aa1/mercury_aa1.env new file +10
-0+ * <[email protected]> + * + * This is an example configuration file for uboot.env generation. + * + * Given ENV_FAT_FILE defaults to "uboot.env" and ENV_SIZE defaults to 0x80000 + * (see configuration options). Then adjust the configuration to your needs and + * build the a binary .env file as follows + * $ ./tools/mkenvimage -s 0x80000 -o uboot.env ./board/enclustra/mercury_aa1/mercury_aa1.env + * + * NB: Without providing this binary uboot.env the board is supposed to come up
What does NB: mean ?
board/enclustra/mercury_aa1/mercury_aa1.env line 16
Quoted 3 lines
board/enclustra/mercury_aa1/mercury_aa1.env new file +3
-0+ * with the generic environment based on the architecture. This can be helpful + * when upgrading and/or recuding environments. + */
Can you please pick one method of specifying board environment ? Either this or include/configs/board.h, but do not use both, that is confusing.
board/enclustra/mercury_aa1/mercury_aa1.env line 29
Quoted 13 lines
board/enclustra/mercury_aa1/mercury_aa1.env new file +13
-0+bitstream_size=0xD00000 +bootargs=earlycon console=ttyS0,115200 rw rootwait root=/dev/mmcblk0p3 +bootargs_qspi=earlycon console=ttyS0,115200 rw root=/dev/ram0 +bootm_size=0x0a000000 +devnum=0 +devtype=mmc +distro_bootpart=1 +env_size=0x80000 +fdt_addr_r=0x10000000 +fdtfile=system.dtb +fdtload= + load ${devtype} ${devnum}:${distro_bootpart} ${fdt_addr_r} ${bootdir}/${fdtfile}; + load ${devtype} ${devnum}:${distro_bootpart} ${fdto_addr_r} ${bootdir}/${fdtofile};
&& instead of ;
PATCH v2 6/7 ARM: socfpga: add Enclustra AA1 boot scripts
In reply to Lothar RubuschAdd support to boot Enclustra SoMs from MMC, SD or QSPI flash.
--- board/enclustra/bootscripts/qspi-aa1.cmd | 12 ++++++++++++ board/enclustra/bootscripts/sd-aa1.cmd | 10 ++++++++++ 2 files changed, 22 insertions(+) create mode 100644 board/enclustra/bootscripts/qspi-aa1.cmd create mode 100644 board/enclustra/bootscripts/sd-aa1.cmd
board/enclustra/bootscripts/qspi-aa1.cmd new file +12 -0
@@ -0,0 +1,12 @@ +# This is an example input file for boot.scr generation. +# Generate boot.scr +# ./tools/mkimage -A arm -O linux -T script -C none -a 0 -e 0 -d board/enclustra/bootscripts/qspi-aa1.cmd boot.scr +# +# NB: The needed variables need to be set in the environment. +bridge enable +sf probe +sf read $kernel_addr_r $qspi_offset_addr_kernel $kernel_size +sf read $fdt_addr_r $qspi_offset_addr_devicetree $fdt_size +sf read $rootfs_addr_r $qspi_offset_addr_rootfs $rootfs_size +run fdtload_qspi +bootm $kernel_addr_r $rootfs_addr_r $fdt_addr_r
board/enclustra/bootscripts/sd-aa1.cmd new file +10 -0
@@ -0,0 +1,10 @@ +# This is an example input file for boot.scr generation. +# Generate boot.scr +# ./tools/mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n "U-boot mmc start script" -d board/enclustra/bootscripts/sd-aa1.cmd boot.scr +# +# NB: The needed variables need to be set in the environment. +bridge enable +fatload mmc $devnum:$distro_bootpart $kernel_addr_r Image +fatload mmc $devnum:$distro_bootpart $fdt_addr_r $fdtfile +run fdtload +bootm $kernel_addr_r - $fdt_addr_r
Signature · 1 line
2.25.1
Re: [PATCH v2 6/7] ARM: socfpga: add Enclustra AA1 boot scripts
Quoted 1 line · Lothar Rubusch
Add support to boot Enclustra SoMs from MMC, SD or QSPI flash.
Where are these scripts used ?
PATCH v2 7/7 ARM: socfpga: AA1: support MAC from secure eeprom
In reply to Lothar RubuschSeveral Enclustra devices store MAC address in a secure eeprom device. In most cases this is the atsha204a (alternatively DS28). The atsha204a device is preconfigured accordingly. Reading then is based on u-boot's atsha204a driver. Add such support for Enclustra's AA1 SoMs.
--- board/enclustra/common/Kconfig | 23 +++++ board/enclustra/common/Makefile | 3 + board/enclustra/common/enclustra_mac.h | 48 +++++++++ board/enclustra/common/mac_atsha204.c | 97 +++++++++++++++++++ board/enclustra/common/mac_common.c | 54 +++++++++++ board/enclustra/common/mac_ds28.c | 88 +++++++++++++++++ board/enclustra/mercury_aa1/Makefile | 2 + .../mercury_aa1/aa1_board_late_init.c | 17 ++++ .../socfpga_enclustra_mercury_aa1_defconfig | 1 + drivers/misc/Kconfig | 2 +- 10 files changed, 334 insertions(+), 1 deletion(-) create mode 100644 board/enclustra/common/enclustra_mac.h create mode 100644 board/enclustra/common/mac_atsha204.c create mode 100644 board/enclustra/common/mac_common.c create mode 100644 board/enclustra/common/mac_ds28.c create mode 100644 board/enclustra/mercury_aa1/aa1_board_late_init.c
board/enclustra/common/Kconfig +23 -0
@@ -1 +1,24 @@ +config ENCLUSTRA_EEPROM_MAC + bool "Enclustra MAC address" + select ATSHA204A + default y if TARGET_SOCFPGA_ENCLUSTRA_MERCURY_AA1 + help + Reads the MAC address out of the EEPROM and configures the MAC + addresses in the environment. + +choice + prompt "Enclustra EEPROM device" + depends on ENCLUSTRA_EEPROM_MAC + default ENCLUSTRA_EEPROM_MAC_ATSHA204 if TARGET_SOCFPGA_ENCLUSTRA_MERCURY_AA1 + help + Specify the device where the MAC is stored. + +config ENCLUSTRA_EEPROM_MAC_ATSHA204 + bool "MAC stored in 'ATSHA204'" + +config ENCLUSTRA_EEPROM_MAC_DS28 + bool "MAC stored in 'DS28'" + +endchoice + source "board/enclustra/mercury_aa1/Kconfig"
board/enclustra/common/Makefile +3 -0
@@ -2,3 +2,6 @@ # Copyright (c) 2024 Enclustra GmbH # Common for several Enclustra modules +obj-$(CONFIG_ENCLUSTRA_EEPROM_MAC) += mac_common.o +obj-$(CONFIG_ENCLUSTRA_EEPROM_MAC_ATSHA204) += mac_atsha204.o +obj-$(CONFIG_ENCLUSTRA_EEPROM_MAC_DS28) += mac_ds28.o
board/enclustra/common/enclustra_mac.h new file +48 -0
48 lines not on this page · raw message
board/enclustra/common/mac_atsha204.c new file +97 -0
97 lines not on this page · raw message
board/enclustra/common/mac_common.c new file +54 -0
54 lines not on this page · raw message
board/enclustra/common/mac_ds28.c new file +88 -0
88 lines not on this page · raw message
board/enclustra/mercury_aa1/Makefile +2 -0
@@ -6,3 +6,5 @@ ifeq ($(CONFIG_SPL_BUILD),) obj-y += aa1_set_storage_cmd.o endif + +obj-y += aa1_board_late_init.o
board/enclustra/mercury_aa1/aa1_board_late_init.c new file +17 -0
@@ -0,0 +1,17 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Copyright (C) 2024 Enclustra GmbH +* <[email protected]> +*/ + +#include <env.h> +#include <init.h> +#include <dm/uclass.h> +#include <dm.h> + +#include "../common/enclustra_mac.h" + +int board_late_init (void ) +{ +return enclustra_setup_mac_address (); +}
configs/socfpga_enclustra_mercury_aa1_defconfig +1 -0
@@ -26,6 +26,7 @@ CONFIG_SYS_CONSOLE_IS_IN_ENV=y CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE=y CONFIG_SYS_CONSOLE_ENV_OVERWRITE=y CONFIG_DISPLAY_BOARDINFO_LATE=y +CONFIG_BOARD_LATE_INIT=y CONFIG_CLOCKS=y CONFIG_SPL_PAD_TO=0x40000 CONFIG_SPL_NO_BSS_LIMIT=y
drivers/misc/Kconfig +1 -1
@@ -73,7 +73,7 @@ config ATSHA204A help Enable support for I2C connected Atmel's ATSHA204A CryptoAuthentication module found for example on the Turris Omnia - board. + board and Enclustra SoC FPGA boards. config GATEWORKS_SC bool "Gateworks System Controller Support"
Signature · 1 line
2.25.1
Re: [PATCH v2 7/7] ARM: socfpga: AA1: support MAC from secure eeprom
On 9/17/24 8:21 AM, Lothar Rubusch wrote:
[...]
Quoted 5 lines
board/enclustra/common/mac_atsha204.c new file +5
-0+int enclustra_get_mac_from_eeprom (unsigned char *enetaddr,const char *alias) +{ +struct udevice *dev; +u32 hwaddr_h; +u8 data[4 ];
board/enclustra/common/mac_atsha204.c line 26
Quoted 10 lines
board/enclustra/common/mac_atsha204.c new file +10
-0+int i, j, eeprom_addr, mac_len, ret; + + ret =uclass_get_device_by_name (UCLASS_MISC , alias, &dev); +if (ret) { +printf ("%s: Failed, cannot find EEPROM! ret = %d\n" , __func__, ret); +return ret; + } + +/* Make sure atsha204a is in a defined state (part of protocol) */ +if (atsha204a_sleep (dev)) {
Please propagate return values.
board/enclustra/common/mac_atsha204.c line 36
Quoted 10 lines
board/enclustra/common/mac_atsha204.c new file +10
-0+printf ("%s(): Failed to bring EEPROM in defined state\n" , __func__); +return -ENODEV ; + } + +if (atsha204a_wakeup (dev)) { +printf ("%s(): Failed to wakeup EEPROM\n" , __func__); +return -ENODEV ; + } + +/* Read twice portions of 4 bytes (atsha204 protocol). One from address 4
Use Linux comment style, not netdev:
/*
* Read some
* stuff
* and so on
*/
board/enclustra/common/mac_atsha204.c line 41
Quoted 5 lines
board/enclustra/common/mac_atsha204.c new file +5
-0+* the other from address 5 of the OTP zone. Then convert the data to +* the 6 elements of the MAC address. +*/ + eeprom_addr =4 ; + mac_len =6 ;
These can be const variables assigned at the beginning of this function.
Quoted 20 lines
board/enclustra/common/mac_atsha204.c new file +20
-0+for (i =0 ; i <2 ; i++) { + eeprom_addr += i; +if (atsha204a_read (dev,ATSHA204A_ZONE_OTP , false, eeprom_addr, data)) { +printf ("%s(): Failed to parse ATSHA204A_ZONE_OTP of EEPROM\n" , + __func__); +return -EFAULT ; + } + +for (j =0 ; j <4 && j + i *4 < mac_len; j++) + enetaddr[j + i *4 ] = data[j]; + } + +/* Check if the value is a valid mac registered for +* Enclustra GmbH +*/ + hwaddr_h = enetaddr[0 ] | enetaddr[1 ] <<8 | enetaddr[2 ] <<16 ; +if ((hwaddr_h &0xFFFFFF ) !=ENCLUSTRA_MAC ) { +printf ("%s(): Failed, parsed MAC is no Enclustra MAC\n" , __func__); +return -ENOENT ; + }
board/enclustra/common/mac_atsha204.c line 71
Quoted 10 lines
board/enclustra/common/mac_atsha204.c new file +10
-0+ +if (!is_valid_ethaddr (enetaddr)) { +printf ("%s(): Failed, address read from EEPROM is invalid!\n" , + __func__); +return -EINVAL ; + } + +printf ("ethaddr set to %02X:%02X:%02X:%02X:%02X:%02X\n" , + enetaddr[0 ], enetaddr[1 ], enetaddr[2 ], + enetaddr[3 ], enetaddr[4 ], enetaddr[5 ]);
This should be:
debug("ethaddr set to %pM\n", ethaddr);
see lib/vsprintf.c for the formatting strings.
Quoted 4 lines
board/enclustra/common/mac_atsha204.c new file +4
-0+return 0 ; +} + +__weak int enclustra_setup_mac_address (void )
board/enclustra/common/mac_atsha204.c line 86
Quoted 10 lines
board/enclustra/common/mac_atsha204.c new file +10
-0+{ +unsigned char enetaddr[6 ]; + +if (enclustra_mac_is_in_env ("ethaddr" )) +return 0 ; + +if (enclustra_get_mac_is_enabled ("ethernet0" )) +return 0 ; + +if (enclustra_get_mac_from_eeprom (enetaddr,"atsha204a@64" ))
Please propagate return values, fix globally.
Quoted 11 lines
board/enclustra/common/mac_atsha204.c new file +11
-0+return -ENXIO ; + +if (eth_env_set_enetaddr ("ethaddr" , enetaddr)) +return -ENXIO ; + +if (!enclustra_get_mac1_from_mac (enetaddr)) +return eth_env_set_enetaddr ("eth1addr" , enetaddr); + +printf ("%s(): Failed, unable to set mac address!\n" , __func__); +return -ENXIO ; +}
[...]
Quoted 10 lines
board/enclustra/common/mac_common.c new file +10
-0+int enclustra_get_mac1_from_mac (unsigned char *enetaddr) +{ +u32 hwaddr_h; + +/* Increment MAC addr */ + hwaddr_h = (enetaddr[3 ] <<16 ) | (enetaddr[4 ] <<8 ) | enetaddr[5 ]; + hwaddr_h = (hwaddr_h +1 ) &0xFFFFFF ; + enetaddr[3 ] = (hwaddr_h >>16 ) &0xFF ; + enetaddr[4 ] = (hwaddr_h >>8 ) &0xFF ; + enetaddr[5 ] = hwaddr_h &0xFF ;
board/enclustra/common/mac_common.c line 51
Quoted 10 lines
board/enclustra/common/mac_common.c new file +10
-0+ +if (!is_valid_ethaddr (enetaddr)) { +printf ("%s(): Failed, address computed from enetaddr is invalid!\n" , + __func__); +return -EINVAL ; + } + +printf ("eth1addr set to %02X:%02X:%02X:%02X:%02X:%02X\n" , + enetaddr[0 ], enetaddr[1 ], enetaddr[2 ], + enetaddr[3 ], enetaddr[4 ], enetaddr[5 ]);
debug("... %pM\n", enetaddr);
Quoted 43 lines
(quoted diff) +2
-0+ return 0; +}board/enclustra/common/mac_ds28.c new file +35
-0@@ -0,0 +1,88 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Copyright (c) 2024 Enclustra GmbH +*/ + +#include <linux/compat.h> +#include <dm.h> +#include <i2c.h> +#include <net.h> + +#include "enclustra_mac.h" + +#define DS28_I2C_ADDR 0x5C +#define DS28_SYS_I2C_EEPROM_BUS 0 + +int enclustra_get_mac_from_eeprom (unsigned char *enetaddr,const char *alias) +{ +struct udevice *dev; +u32 hwaddr_h; +struct dm_i2c_chip *chip; +uint chip_addr =DS28_I2C_ADDR ; +int alen =1 ; +int ret; + +if (i2c_get_chip_for_busnum (DS28_SYS_I2C_EEPROM_BUS , chip_addr, + alen, &dev)) +return -ENODEV ; + + chip =dev_get_parent_plat (dev); +if (chip->offset_len != alen) { +debug ("I2C chip %x: alen %d does not match offset_len %d\n" , + chip_addr, alen, chip->offset_len); +return -EADDRNOTAVAIL ; + } +
board/enclustra/common/mac_ds28.c line 45
Quoted 10 lines
board/enclustra/common/mac_ds28.c new file +10
-0+ ret =dm_i2c_read (dev,0x10 , enetaddr,6 ); +if (ret) { +printf ("%s(): Failed reading EEPROM! ret = %d\n" , __func__, ret); +return ret; + } + +/* Check if the value is a valid mac registered for +* Enclustra GmbH +*/ + hwaddr_h = enetaddr[0 ] | enetaddr[1 ] <<8 | enetaddr[2 ] <<16 ;
Better use () around the shifts, i.e. ... | (enetaddr[i] << 8) | ...
Quoted 9 lines
board/enclustra/common/mac_ds28.c new file +9
-0+if ((hwaddr_h &0xFFFFFF ) !=ENCLUSTRA_MAC ) { +printf ("%s(): Failed, parsed MAC is no Enclustra MAC\n" , __func__); +return -ENOENT ; + } + +if (!is_valid_ethaddr (enetaddr)) { +printf ("%s(): Failed, address read from EEPROM is invalid!\n" , + __func__); +return -EINVAL ;
board/enclustra/common/mac_ds28.c line 64
Quoted 10 lines
board/enclustra/common/mac_ds28.c new file +10
-0+ } + +printf ("ethaddr set to %02X:%02X:%02X:%02X:%02X:%02X\n" , + enetaddr[0 ], enetaddr[1 ], enetaddr[2 ], + enetaddr[3 ], enetaddr[4 ], enetaddr[5 ]); + +return 0 ; +} + +__weak int enclustra_setup_mac_address (void )
Is the __weak really necessary ?
board/enclustra/common/mac_ds28.c line 76
Quoted 12 lines
board/enclustra/common/mac_ds28.c new file +12
-0+{ +unsigned char enetaddr[6 ]; + +if (enclustra_mac_is_in_env ("ethaddr" )) +return 0 ; + +if (enclustra_get_mac_is_enabled ("ethernet0" )) +return 0 ; + +// NB: DS28 is still not available in official DT, so referencing +// here by i2c busnumber and address directly +// preparation for DT access here, though
Use C comment style /* */
board/enclustra/common/mac_ds28.c line 86
Quoted 10 lines
board/enclustra/common/mac_ds28.c new file +10
-0+if (enclustra_get_mac_from_eeprom (enetaddr,"" )) +return -ENXIO ; + +if (eth_env_set_enetaddr ("ethaddr" , enetaddr)) +return -ENXIO ; + +if (!enclustra_get_mac1_from_mac (enetaddr)) +return eth_env_set_enetaddr ("eth1addr" , enetaddr); + +printf ("%s(): Failed, unable to set mac address!\n" , __func__);
MAC address, MAC in capitals.
[...]
drivers/misc/Kconfig config ATSHA204A · line 76
Quoted 8 lines
drivers/misc/Kconfig +1
-1@@ -73,7 +73,7 @@ config ATSHA204A help Enable support for I2C connected Atmel's ATSHA204A CryptoAuthentication module found for example on the Turris Omnia - board. + board and Enclustra SoC FPGA boards.
This change should be elsewhere in this series ?
Quoted 6 lines · Lothar Rubusch
Introduce the support for three variants of Enclustra's Intel Mercury AA1 (with Intel Arria10) SoMs and additional configs. This is supposed to be the first step to upstream several of Enclustras SoC FPGA Modules. There are still things to be modified. So, this is supposed to start the discussion and also to clarify some of my open issues.
Quoted 8 lines
On the DT approach: I can agree that in parallel I may go for upstreaming the kernel DT. There is a fundamental difference, still: In order to represent the combination of module + baseboard + bootmode for the kernel DT we have to use a mechanism like DTO. For u-boot this can be simpler. Currently the few adjustments needed will be represented by the DT files as are. I propose to keep them, and in case remove them later, which I doubt, since the full DT for the kernel will cover more details. In case refactoring is needed I can update the DT also in u-boot.
I assume after the LPC discussion, there will be a V3 ?
Quoted 16 lines · Marek Vasut
Quoted 6 lines · Lothar Rubusch
Introduce the support for three variants of Enclustra's Intel Mercury AA1 (with Intel Arria10) SoMs and additional configs. This is supposed to be the first step to upstream several of Enclustras SoC FPGA Modules. There are still things to be modified. So, this is supposed to start the discussion and also to clarify some of my open issues.
Quoted 8 lines
On the DT approach: I can agree that in parallel I may go for upstreaming the kernel DT. There is a fundamental difference, still: In order to represent the combination of module + baseboard + bootmode for the kernel DT we have to use a mechanism like DTO. For u-boot this can be simpler. Currently the few adjustments needed will be represented by the DT files as are. I propose to keep them, and in case remove them later, which I doubt, since the full DT for the kernel will cover more details. In case refactoring is needed I can update the DT also in u-boot.
Quoted 1 line
I assume after the LPC discussion, there will be a V3 ?
Yes.
V3 affects mainly the DT question. As of the LPC discussions I had, currently I'm about to rework the DT material. The material will need to pass dtbs_check/dtschema. Functionality then needs to be verified on my hardware zoo, and eventually I upstream it directly to the Linux kernel ML. If successful, then, in u-boot I will build up on upstream DTs as proposed here initially.
V2: Please, feel free to already review V2 patch set. As I assume still some issues. Alternatively, we do this on the V3 patch set. No stress! Every feedback here is highly appreciate!!
I pretend putting the involved u-boot people here in CC on the kernel ML. Pls, let me know if I need to do the u-boot ML in CC as well.
Quoted 17 lines · Lothar Rubusch
Quoted 16 lines · Marek Vasut
Quoted 14 lines · Lothar Rubusch
Introduce the support for three variants of Enclustra's Intel Mercury AA1 (with Intel Arria10) SoMs and additional configs. This is supposed to be the first step to upstream several of Enclustras SoC FPGA Modules. There are still things to be modified. So, this is supposed to start the discussion and also to clarify some of my open issues.
On the DT approach: I can agree that in parallel I may go for upstreaming the kernel DT. There is a fundamental difference, still: In order to represent the combination of module + baseboard + bootmode for the kernel DT we have to use a mechanism like DTO. For u-boot this can be simpler. Currently the few adjustments needed will be represented by the DT files as are. I propose to keep them, and in case remove them later, which I doubt, since the full DT for the kernel will cover more details. In case refactoring is needed I can update the DT also in u-boot.
Quoted 7 lines
Quoted 1 line
I assume after the LPC discussion, there will be a V3 ?
Yes.
V3 affects mainly the DT question. As of the LPC discussions I had, currently I'm about to rework the DT material. The material will need to pass dtbs_check/dtschema.
Indeed, that's a good thing.
Quoted 4 lines
Functionality then needs to be verified
on my hardware zoo, and eventually I upstream it directly to the Linux kernel ML. If successful, then, in u-boot I will build up on upstream DTs as proposed here initially.
Thank you.
Quoted 6 lines
V2: Please, feel free to already review V2 patch set. As I assume still some issues. Alternatively, we do this on the V3 patch set. No stress! Every feedback here is highly appreciate!!
I pretend putting the involved u-boot people here in CC on the kernel ML. Pls, let me know if I need to do the u-boot ML in CC as well.
CC is a good idea.