ARM: socfpga: Add initial support for ic-automation Moritz III
Subsystems (3)
PATCH RESEND v5 9/11 ARM: socfpga: Add initial support for ic-automation Moritz III
Add initial support for ic-automation Moritz III, which is an Cyclone V SOM with ethernet, usb, uart. Booting via sd-card or flash is supported.
Changes for v5:
- fixed random ethaddr at failure
- fixed comments
Changes for v4:
- re-sort list alphabetically
- c style comments
Changes for v3:
- Resend via git send-email
Changes for v2:
- Coding Style cleanup
--- arch/arm/dts/Makefile | 1 + ...ocfpga_cyclone5_ica_moritz_iii-u-boot.dtsi | 45 ++ .../dts/socfpga_cyclone5_ica_moritz_iii.dts | 123 ++++ arch/arm/mach-socfpga/Kconfig | 8 + board/ic-automation/moritz_iii/MAINTAINERS | 8 + board/ic-automation/moritz_iii/Makefile | 8 + .../moritz_iii/moritz_iii_board.c | 127 ++++ .../moritz_iii/qts/iocsr_config.h | 658 ++++++++++++++++++ .../moritz_iii/qts/pinmux_config.h | 218 ++++++ .../ic-automation/moritz_iii/qts/pll_config.h | 83 +++ .../moritz_iii/qts/sdram_config.h | 344 +++++++++ board/ic-automation/moritz_iii/socfpga.c | 5 + configs/socfpga_moritz_iii_defconfig | 75 ++ include/configs/socfpga_ica_moritz_iii.h | 46 ++ 14 files changed, 1749 insertions(+) create mode 100644 arch/arm/dts/socfpga_cyclone5_ica_moritz_iii-u-boot.dtsi create mode 100644 arch/arm/dts/socfpga_cyclone5_ica_moritz_iii.dts create mode 100644 board/ic-automation/moritz_iii/MAINTAINERS create mode 100644 board/ic-automation/moritz_iii/Makefile create mode 100644 board/ic-automation/moritz_iii/moritz_iii_board.c create mode 100644 board/ic-automation/moritz_iii/qts/iocsr_config.h create mode 100644 board/ic-automation/moritz_iii/qts/pinmux_config.h create mode 100644 board/ic-automation/moritz_iii/qts/pll_config.h create mode 100644 board/ic-automation/moritz_iii/qts/sdram_config.h create mode 100644 board/ic-automation/moritz_iii/socfpga.c create mode 100644 configs/socfpga_moritz_iii_defconfig create mode 100644 include/configs/socfpga_ica_moritz_iii.h
arch/arm/dts/Makefile +1 -0
@@ -352,6 +352,7 @@ dtb-$(CONFIG_ARCH_SOCFPGA) += \ socfpga_cyclone5_de0_nano_soc.dtb \ socfpga_cyclone5_de1_soc.dtb \ socfpga_cyclone5_de10_nano.dtb \ + socfpga_cyclone5_ica_moritz_iii.dtb \ socfpga_cyclone5_sockit.dtb \ socfpga_cyclone5_socrates.dtb \ socfpga_cyclone5_sr1500.dtb \
arch/arm/dts/socfpga_cyclone5_ica_moritz_iii-u-boot.dtsi new file +45 -0
45 lines not on this page · raw message
arch/arm/dts/socfpga_cyclone5_ica_moritz_iii.dts new file +123 -0
123 lines not on this page · raw message
arch/arm/mach-socfpga/Kconfig +8 -0
@@ -118,6 +118,11 @@ config TARGET_SOCFPGA_EBV_SOCRATES bool "EBV SoCrates (Cyclone V)" select TARGET_SOCFPGA_CYCLONE5 + config TARGET_SOCFPGA_ICA_MORITZ_III + bool "ic-automation Moritz III (Cyclone V)" + select BOARD_LATE_INIT + select TARGET_SOCFPGA_CYCLONE5 + config TARGET_SOCFPGA_IS1 bool "IS1 (Cyclone V)" select TARGET_SOCFPGA_CYCLONE5
@@ -164,6 +169,7 @@ config SYS_BOARD default "de10-nano" if TARGET_SOCFPGA_TERASIC_DE10_NANO default "is1" if TARGET_SOCFPGA_IS1 default "mcvevk" if TARGET_SOCFPGA_ARIES_MCVEVK + default "moritz_iii" if TARGET_SOCFPGA_ICA_MORITZ_III default "secu1" if TARGET_SOCFPGA_ARRIA5_SECU1 default "sockit" if TARGET_SOCFPGA_TERASIC_SOCKIT default "socrates" if TARGET_SOCFPGA_EBV_SOCRATES
@@ -180,6 +186,7 @@ config SYS_VENDOR default "aries" if TARGET_SOCFPGA_ARIES_MCVEVK default "devboards" if TARGET_SOCFPGA_DEVBOARDS_DBM_SOC1 default "ebv" if TARGET_SOCFPGA_EBV_SOCRATES + default "ic-automation" if TARGET_SOCFPGA_ICA_MORITZ_III default "keymile" if TARGET_SOCFPGA_ARRIA5_SECU1 default "softing" if TARGET_SOCFPGA_SOFTING_VINING_FPGA default "terasic" if TARGET_SOCFPGA_TERASIC_DE0_NANO
@@ -200,6 +207,7 @@ config SYS_CONFIG_NAME default "socfpga_de0_nano_soc" if TARGET_SOCFPGA_TERASIC_DE0_NANO default "socfpga_de1_soc" if TARGET_SOCFPGA_TERASIC_DE1_SOC default "socfpga_de10_nano" if TARGET_SOCFPGA_TERASIC_DE10_NANO + default "socfpga_ica_moritz_iii" if TARGET_SOCFPGA_ICA_MORITZ_III default "socfpga_is1" if TARGET_SOCFPGA_IS1 default "socfpga_mcvevk" if TARGET_SOCFPGA_ARIES_MCVEVK default "socfpga_sockit" if TARGET_SOCFPGA_TERASIC_SOCKIT
board/ic-automation/moritz_iii/MAINTAINERS new file +8 -0
@@ -0,0 +1,8 @@ +MORITZ III BOARD +M: Nico Becker ic-automation GmbH <[email protected]> +S: Maintained +F: board/ic-automation/moritz_iii/ +F: include/configs/socfpga_ica_moritz_iii.h +F: configs/socfpga_moritz_iii_defconfig +F: arch/arm/dts/socfpga_cyclone5_ica_moritz_iii.dts +F: arch/arm/dts/socfpga_cyclone5_ica_moritz_iii-u-boot.dtsi
board/ic-automation/moritz_iii/Makefile new file +8 -0
@@ -0,0 +1,8 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# (C) Copyright 2001-2006 +# Wolfgang Denk, DENX Software Engineering, wd at denx.de. +# (C) Copyright 2010, Thomas Chou <[email protected]> + +obj-y := socfpga.o +obj-y := moritz_iii_board.o
board/ic-automation/moritz_iii/moritz_iii_board.c new file +127 -0
127 lines not on this page · raw message
board/ic-automation/moritz_iii/qts/iocsr_config.h new file +658 -0
658 lines not on this page · raw message
board/ic-automation/moritz_iii/qts/pinmux_config.h new file +218 -0
218 lines not on this page · raw message
board/ic-automation/moritz_iii/qts/pll_config.h new file +83 -0
83 lines not on this page · raw message
board/ic-automation/moritz_iii/qts/sdram_config.h new file +344 -0
344 lines not on this page · raw message
board/ic-automation/moritz_iii/socfpga.c new file +5 -0
@@ -0,0 +1,5 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Copyright (C) 2012 Altera Corporation <www.altera.com> +*/ +#include <common.h>
configs/socfpga_moritz_iii_defconfig new file +75 -0
75 lines not on this page · raw message
include/configs/socfpga_ica_moritz_iii.h new file +46 -0
46 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH RESEND v5 9/11 ARM: socfpga: Add initial support for ic-automation Moritz III
Quoted 5 lines · Nico Becker
Add initial support for ic-automation Moritz III, which is an Cyclone V SOM with ethernet, usb, uart. Booting via sd-card or flash is supported.
Changes for v5:
The changelog shouldn't be part of the commmit message, so it goes below the "---" line. Git then ignores it.
Quoted 7 lines
- fixed random ethaddr at failure
- fixed commentsChanges for v4:
- re-sort list alphabetically
- c style comments
Quoted 8 lines
Changes for v3:
- Resend via git send-emailChanges for v2:
- Coding Style cleanupSigned-off-by Nico Becker <[email protected]>---
Here ...
[...]
arch/arm/dts/socfpga_cyclone5_ica_moritz_iii-u-boot.dtsi line 6
Quoted 8 lines
+++
b/arch/arm/dts/socfpga_cyclone5_ica_moritz_iii-u-boot.dtsiarch/arm/dts/socfpga_cyclone5_ica_moritz_iii-u-boot.dtsi new file +6
-0@@ -0,0 +1,45 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * U-Boot additions + * + * Copyright (C) 2012 Altera Corporation <www.altera.com> + * Copyright (c) 2018 Simon Goldschmidt
I think the copyright assignment needs updating.
arch/arm/dts/socfpga_cyclone5_ica_moritz_iii-u-boot.dtsi line 13
Quoted 7 lines
arch/arm/dts/socfpga_cyclone5_ica_moritz_iii-u-boot.dtsi new file +7
-0+ */ + +#include "socfpga-common-u-boot.dtsi" + +/{ + aliases { + spi0 = "/soc/spi at ff705000";
spi0 = &qspi; should work too ?
[...]
Quoted 21 lines
arch/arm/dts/socfpga_cyclone5_ica_moritz_iii.dts new file +15
-0@@ -0,0 +1,123 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2012 Altera Corporation <www.altera.com> + * Copyright (C) 2020 Nico Becker ic-automation GmbH <[email protected]> + */ + +#include "socfpga_cyclone5.dtsi" + +/ { + model = "ic-automation Moritz III"; + compatible = "ic-automation,moritz_iii", "altr,socfpga-cyclone5", "altr,socfpga"; + + chosen { + bootargs = "earlyprintk"; + stdout-path = "serial0:115200n8";
arch/arm/dts/socfpga_cyclone5_ica_moritz_iii.dts line 25
Quoted 10 lines
arch/arm/dts/socfpga_cyclone5_ica_moritz_iii.dts new file +10
-0+ }; + + memory at 0 { + name = "memory"; + device_type = "memory"; + reg = <0x0 0x40000000>; /* 1GB */ + }; + + aliases { + /* this allow the ethaddr uboot environmnet variable contents
environment (typo)
Quoted 4 lines
arch/arm/dts/socfpga_cyclone5_ica_moritz_iii.dts new file +4
-0+ * to be added to the gmac1 device tree blob. + */ + ethernet0 = &gmac1; + };
[...]
[...]
Quoted 1 line
+++
b/board/ic-automation/moritz_iii/moritz_iii_board.c
[...]
arch/arm/dts/socfpga_cyclone5_ica_moritz_iii.dts
Quoted 13 lines
arch/arm/dts/socfpga_cyclone5_ica_moritz_iii.dts new file +13
-0+int board_late_init(void) +{ + u8 mac[MAC_LENGTH]; + char serial[SERIALNUMBER_LENGTH + 1]; + u8 eeprom_data[OVERALL_LENGTH]; + u32 calc_crc32; + u32 *read_crc32; + u8 w_data; + int error; + u8 registers[] = {0x02, 0x03, 0x06, 0x07}; + + for (int i = 0; i < OVERALL_LENGTH; i++) + eeprom_data[i] = 0x00;
Is that a memset() ?
[...]
arch/arm/dts/socfpga_cyclone5_ica_moritz_iii.dts
Quoted 2 lines
arch/arm/dts/socfpga_cyclone5_ica_moritz_iii.dts new file +2
-0+ /* delete environment var first. Otherwise we are unable to set it's value... */ + env_set("ethaddr", "");
ethaddr is not a string, so this will fail. Use NULL instead of "" . But you might just want to check whether ethaddr is set and skip overwriting it, that way the user can set their own ethaddr and make it persistent.
arch/arm/dts/socfpga_cyclone5_ica_moritz_iii.dts
Quoted 2 lines
arch/arm/dts/socfpga_cyclone5_ica_moritz_iii.dts new file +2
-0+ struct udevice *bus; + struct udevice *dev;
Move this to the beginning of the function, just like all the other vars.
[...]
arch/arm/dts/socfpga_cyclone5_ica_moritz_iii.dts
Quoted 3 lines
arch/arm/dts/socfpga_cyclone5_ica_moritz_iii.dts new file +3
-0+ /* check crc32 */ + calc_crc32 = crc32(0, eeprom_data, OVERALL_LENGTH - CRC32_LENGTH); + read_crc32 = (u32 *)&eeprom_data[SERIALNUMBER_LENGTH + MAC_LENGTH];
Use get_unaligned on the eeprom data, otherwise this will fail on ARM hardware with CPSR A-bit clear.
Quoted 4 lines
arch/arm/dts/socfpga_cyclone5_ica_moritz_iii.dts new file +4
-0+ if (*read_crc32 != calc_crc32) { + /* print read data is crc32 not valid */ + printf("read data:"); + for (int i = 0; i < OVERALL_LENGTH; i++)
arch/arm/dts/socfpga_cyclone5_ica_moritz_iii.dts
Quoted 10 lines
arch/arm/dts/socfpga_cyclone5_ica_moritz_iii.dts new file +10
-0+ printf("%02X", eeprom_data[i]); + printf("\n"); + /* print crc32 */ + printf("read crc32 %08X calc crc32 %08X\n", *read_crc32, calc_crc32); + + strncpy(serial, "00000000", 8); + memset((void *)mac, 0x00, 8); + } else { + /* copy serial */ + memcpy((void *)serial, (void *)eeprom_data, SERIALNUMBER_LENGTH);
The typecasts are not needed for memset()/memcpy() .
Quoted 6 lines
arch/arm/dts/socfpga_cyclone5_ica_moritz_iii.dts new file +6
-0+ /* copy MAC address */ + memcpy((void *)mac, (void *)&eeprom_data[SERIALNUMBER_LENGTH], MAC_LENGTH); + } + + serial[SERIALNUMBER_LENGTH] = 0x00; + printf("Serialnumber = %s\n", serial);
[...]
Quoted 24 lines
+++
b/include/configs/socfpga_ica_moritz_iii.harch/arm/dts/socfpga_cyclone5_ica_moritz_iii.dts new file +22
-0@@ -0,0 +1,46 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright (C) 2014 Marek Vasut <[email protected]> + * Copyright (C) 2020 Nico Becker ic-automation GmbH <[email protected]> + */ + +#ifndef __CONFIG_SOCFPGA_MORITZ_III_H__ +#define __CONFIG_SOCFPGA_MORITZ_III_H__ + +#include <asm/arch/base_addr_ac5.h> + +/* Memory configurations */ +#define PHYS_SDRAM_1_SIZE 0x40000000 /* 1GiB on SoCDK */ + +/* Booting Linux */ +#define CONFIG_LOADADDR 0x01000000 +#define CONFIG_SYS_LOAD_ADDR CONFIG_LOADADDR + +/* Boot emv */ +#define CONFIG_EXTRA_ENV_SETTINGS \ + "fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" \ + "fpgafile=/lib/firmware/socfpga_sram_bridge.rbf\0" \
arch/arm/dts/socfpga_cyclone5_ica_moritz_iii.dts line 32
Quoted 10 lines
arch/arm/dts/socfpga_cyclone5_ica_moritz_iii.dts new file +10
-0+ "kernel_addr_r=" __stringify(CONFIG_SYS_LOAD_ADDR)"\0" \ + "bootm_size=0xa000000\0" \ + "fdt_addr_r=0x02000000\0" \ + "ramdisk_addr_r=0x02300000\0" \ + "socfpga_legacy_reset_compat=1\0" \ + "fpgaloadandenable=" \ + "fpga load 0 ${loadaddr} ${filesize};" \ + "echo firmware $fpgafile written to fpga;" \ + "bridge enable; echo bridges enabled;\0" \ + "fpgaload=ext4load mmc 0:2 ${loadaddr} ${fpgafile}; run checkfpgafw;\0" \
use plain load (with CONFIG_FS_GENERIC) and use && as the load command might fail. You don't want to run the script if it fails. Also use && in the rest of the scripts where applicable.
Quoted 15 lines
arch/arm/dts/socfpga_cyclone5_ica_moritz_iii.dts new file +14
-0+ "checkfpgafw=" \ + "if test ${filesize} -le 0; then " \ + "echo cant load fpga firmare $fpgafile;" \ + "else " \ + "run fpgaloadandenable;" \ + "fi;\0" \ + "bootargs=console=ttyS0,115200 rootfstype=ext4 root=/dev/mmcblk0p2 rw rootwait\0" \ + "bootcmd=run fpgaload; run mmcload;\0" \ + "mmcload=ext4load mmc 0:2 ${kernel_addr_r} boot/zImage;ext4load mmc 0:2 ${fdt_addr_r} boot/${fdtfile};bootz ${kernel_addr_r} - ${fdt_addr_r}\0" + +/* The rest of the configuration is shared */ +#include <configs/socfpga_common.h> + +#endif /* __CONFIG_SOCFPGA_MORITZ_III_H__ */
Tan
PATCH RESEND v5 9/11 ARM: socfpga: Add initial support for ic-automation Moritz III
Quoted 33 lines
-----Original Message-----
From: Marek Vasut <[email protected]>
Sent: Friday, September 11, 2020 3:19 PM
To: Nico Becker <[email protected]>; u-boot at lists.denx.de; Tan, Ley Foon <[email protected]>; simon.k.r.goldschmidt at gmail.com
Subject: Re: [RESEND PATCH v5 9/11] ARM: socfpga: Add initial support for ic-automation Moritz IIIQuoted 5 lines · Nico Becker
Add initial support for ic-automation Moritz III, which is an Cyclone V SOM with ethernet, usb, uart. Booting via sd-card or flash is supported.
Changes for v5:
The changelog shouldn't be part of the commmit message, so it goes below the "---" line. Git then ignores it.
Quoted 13 lines
- fixed random ethaddr at failure
- fixed commentsChanges for v4:
- re-sort list alphabetically
- c style commentsChanges for v3:
- Resend via git send-emailChanges for v2:
- Coding Style cleanup
Quoted 7 lines
Quoted 2 lines
Signed-off-by Nico Becker <[email protected]>---
Here ...
[...]
Hi Nico
Can you rework as commented by Marek and send new revision of patch?
Regards
Ley Foon
Tan
PATCH RESEND v5 9/11 ARM: socfpga: Add initial support for ic-automation Moritz III
In reply to Nico BeckerQuoted 50 lines
-----Original Message-----
From: Nico Becker <[email protected]>
Sent: Friday, September 11, 2020 3:03 PM
To: u-boot at lists.denx.de; marex at denx.de; Tan, Ley Foon <[email protected]>; simon.k.r.goldschmidt at gmail.com
Cc: Nico Becker <[email protected]>
Subject: [RESEND PATCH v5 9/11] ARM: socfpga: Add initial support for ic- automation Moritz IIIAdd initial support for ic-automation Moritz III, which is an Cyclone V SOM with ethernet, usb, uart. Booting via sd-card or flash is supported.
Changes for v5:
- fixed random ethaddr at failure
- fixed commentsChanges for v4:
- re-sort list alphabetically
- c style commentsChanges for v3:
- Resend via git send-emailChanges for v2:
- Coding Style cleanupSigned-off-by Nico Becker <[email protected]>--- arch/arm/dts/Makefile | 1 + ...ocfpga_cyclone5_ica_moritz_iii-u-boot.dtsi | 45 ++ .../dts/socfpga_cyclone5_ica_moritz_iii.dts | 123 ++++ arch/arm/mach-socfpga/Kconfig | 8 + board/ic-automation/moritz_iii/MAINTAINERS | 8 + board/ic-automation/moritz_iii/Makefile | 8 + .../moritz_iii/moritz_iii_board.c | 127 ++++ .../moritz_iii/qts/iocsr_config.h | 658 ++++++++++++++++++ .../moritz_iii/qts/pinmux_config.h | 218 ++++++ .../ic-automation/moritz_iii/qts/pll_config.h | 83 +++ .../moritz_iii/qts/sdram_config.h | 344 +++++++++ board/ic-automation/moritz_iii/socfpga.c | 5 + configs/socfpga_moritz_iii_defconfig | 75 ++ include/configs/socfpga_ica_moritz_iii.h | 46 ++ 14 files changed, 1749 insertions(+) create mode 100644 arch/arm/dts/socfpga_cyclone5_ica_moritz_iii-u- boot.dtsi create mode 100644 arch/arm/dts/socfpga_cyclone5_ica_moritz_iii.dts create mode 100644 board/ic-automation/moritz_iii/MAINTAINERS create mode 100644 board/ic-automation/moritz_iii/Makefile
Quoted 9 lines
create mode 100644 board/ic-automation/moritz_iii/moritz_iii_board.c create mode 100644 board/ic-automation/moritz_iii/qts/iocsr_config.h create mode 100644 board/ic-automation/moritz_iii/qts/pinmux_config.h create mode 100644 board/ic-automation/moritz_iii/qts/pll_config.h create mode 100644 board/ic-automation/moritz_iii/qts/sdram_config.h create mode 100644 board/ic-automation/moritz_iii/socfpga.c create mode 100644 configs/socfpga_moritz_iii_defconfig create mode 100644 include/configs/socfpga_ica_moritz_iii.h
What is different from patch https://patchwork.ozlabs.org/project/uboot/patch/20200909120223.10174-1-n.becker at ic-automation.de/ ? This is patch 9/11?
Regards
Ley Foon