From patchwork Fri Jun 12 08:01:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nico Becker X-Patchwork-Id: 242158 List-Id: U-Boot discussion From: u-boot at ic-automation.de (Nico Becker) Date: Fri, 12 Jun 2020 10:01:24 +0200 Subject: [PATCH] arm: socfpga: add board support for ic-automation moritz III Message-ID: <3ffc8893-2df9-8f3e-8cf6-a4ffeb07f580@ic-automation.de> add board support for the moritz iii board from ic-automation initial version, first try :-) thanks a lot greetings From f1e5851c1e5359db6179303bd6c2305eaf9f6893 Mon Sep 17 00:00:00 2001 From: ica build Date: Fri, 12 Jun 2020 09:56:10 +0200 Subject: [PATCH] add board support for ic-automation Moritz III initial ?version --- ?arch/arm/dts/Makefile???????????????????????? |?? 1 + ?...ocfpga_cyclone5_ica_moritz_iii-u-boot.dtsi |? 45 ++ ?.../dts/socfpga_cyclone5_ica_moritz_iii.dts?? | 122 ++++ ?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???????????? | 128 ++++ ?.../moritz_iii/qts/iocsr_config.h???????????? | 659 ++++++++++++++++++ ?.../moritz_iii/qts/pinmux_config.h??????????? | 218 ++++++ ?.../ic-automation/moritz_iii/qts/pll_config.h |? 84 +++ ?.../moritz_iii/qts/sdram_config.h???????????? | 344 +++++++++ ?board/ic-automation/moritz_iii/socfpga.c????? |?? 5 + ?configs/socfpga_moritz_iii_defconfig????????? |? 74 ++ ?include/configs/socfpga_ica_moritz_iii.h????? |? 36 + ?14 files changed, 1740 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 0:2 ${fdt_addr_r} boot/${fdtfile};bootz ${kernel_addr_r} - ${fdt_addr_r}\0" + +/* The rest of the configuration is shared */ +#include + +#endif??? /* __CONFIG_SOCFPGA_MORITZ_III_H__ */ diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index 9900b44274..2e815ca5f0 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -356,6 +356,7 @@ dtb-$(CONFIG_ARCH_SOCFPGA) +=??? ??? ??? ??? \ ???? socfpga_cyclone5_socrates.dtb??? ??? ??? \ ???? socfpga_cyclone5_sr1500.dtb??? ??? ??? \ ???? socfpga_cyclone5_vining_fpga.dtb??? ??? \ +??? socfpga_cyclone5_ica_moritz_iii.dtb??? ??? \ ???? socfpga_stratix10_socdk.dtb ?dtb-$(CONFIG_TARGET_DRA7XX_EVM) += dra72-evm.dtb dra7-evm.dtb??? \ diff --git a/arch/arm/dts/socfpga_cyclone5_ica_moritz_iii-u-boot.dtsi b/arch/arm/dts/socfpga_cyclone5_ica_moritz_iii-u-boot.dtsi new file mode 100644 index 0000000000..3ba01d1fd9 --- /dev/null +++ b/arch/arm/dts/socfpga_cyclone5_ica_moritz_iii-u-boot.dtsi @@ -0,0 +1,45 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * U-Boot additions + * + * Copyright (C) 2012 Altera Corporation + * Copyright (c) 2018 Simon Goldschmidt + */ + +#include "socfpga-common-u-boot.dtsi" + +/{ +??? aliases { +??? ??? spi0 = "/soc/spi at ff705000"; +??? ??? udc0 = &usb1; +??? }; +}; + +&watchdog0 { +??? status = "disabled"; +}; + +&mmc { +??? u-boot,dm-pre-reloc; +}; + +&qspi { +??? u-boot,dm-pre-reloc; +}; + +&uart0 { +??? clock-frequency = <100000000>; +??? u-boot,dm-pre-reloc; +}; + +&porta { +??? bank-name = "porta"; +}; + +&portb { +??? bank-name = "portb"; +}; + +&portc { +??? bank-name = "portc"; +}; diff --git a/arch/arm/dts/socfpga_cyclone5_ica_moritz_iii.dts b/arch/arm/dts/socfpga_cyclone5_ica_moritz_iii.dts new file mode 100644 index 0000000000..7836ecc8b6 --- /dev/null +++ b/arch/arm/dts/socfpga_cyclone5_ica_moritz_iii.dts @@ -0,0 +1,122 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2012 Altera Corporation + */ + +#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"; +??? }; + +??? memory at 0 { +??? ??? name = "memory"; +??? ??? device_type = "memory"; +??? ??? reg = <0x0 0x40000000>; /* 1GB */ +??? }; + +??? aliases { +??? ??? /* this allow the ethaddr uboot environmnet variable contents +??? ??? ?* to be added to the gmac1 device tree blob. +??? ??? ?*/ +??? ??? ethernet0 = &gmac1; +??? }; + +? fpga_bridge3: fpga_bridge at ffc25080 { +??? ??? compatible = "altr,socfpga-fpga2sdram-bridge"; +??? ??? reg = <0xffc25080 0x4>; +??? }; + +??? regulator_3_3v: 3-3-v-regulator { +??? ??? compatible = "regulator-fixed"; +??? ??? regulator-name = "3.3V"; +??? ??? regulator-min-microvolt = <3300000>; +??? ??? regulator-max-microvolt = <3300000>; +??? }; +}; + +&gmac1 { +??? status = "okay"; +??? phy-mode = "rgmii"; + +??? rxd0-skew-ps = <0>; +??? rxd1-skew-ps = <0>; +??? rxd2-skew-ps = <0>; +??? rxd3-skew-ps = <0>; +??? txen-skew-ps = <0>; +??? txc-skew-ps = <1320>; +??? rxdv-skew-ps = <0>; +??? rxc-skew-ps = <900>; +}; + +&gpio0 { +??? status = "okay"; +}; + +&gpio1 { +??? status = "okay"; +}; + +&gpio2 { +??? status = "okay"; +}; + +&i2c0 { +??? status = "okay"; +??? speed-mode = <0>; + +??? i2c-switch at 70 { +????? compatible = "nxp,pca9548"; +????? #address-cells = <1>; +????? #size-cells = <0>; +????? reg = <0x70>; +????? i2c at 1{ +??????? #address-cells = <1>; +??????? #size-cells = <0>; +??????? reg = <1>; +??????? mcp_rtc: rtc at 6F{ +????????? compatible = "microchip,mcp7941x"; +????????? reg = <0x6F>; +????????? }; +????? }; +??? }; +}; + +&i2c1 { +??? status = "okay"; +??? speed-mode = <0>; + +??? gpioexp at 20 { +??? ??? compatible = "ti,tca6416"; +??? ??? reg = <0x20>; +??? }; + +??? e2prom at 50 { +??? ??? compatible = "at,24c01"; +??? ??? reg = <0x50>; +??? }; + +??? tempsens at 48 { +??? ??? compatible = "ti,tmp108"; +??? ??? reg = <0x48>; +??? }; +}; + +&mmc0 { +??? vmmc-supply = <®ulator_3_3v>; +??? vqmmc-supply = <®ulator_3_3v>; +??? status = "okay"; +}; + +&spi0 { +??? status = "okay"; +}; + +&usb1 { +??? status = "okay"; +}; diff --git a/arch/arm/mach-socfpga/Kconfig b/arch/arm/mach-socfpga/Kconfig index a3699e82a1..c6039ac07d 100644 --- a/arch/arm/mach-socfpga/Kconfig +++ b/arch/arm/mach-socfpga/Kconfig @@ -151,6 +151,11 @@ config TARGET_SOCFPGA_TERASIC_SOCKIT ???? bool "Terasic SoCkit (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 + ?endchoice ?config SYS_BOARD @@ -170,6 +175,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 "moritz_iii" if TARGET_SOCFPGA_ICA_MORITZ_III ?config SYS_VENDOR ???? default "intel" if TARGET_SOCFPGA_AGILEX_SOCDK @@ -186,6 +192,7 @@ config SYS_VENDOR ???? default "terasic" if TARGET_SOCFPGA_TERASIC_DE1_SOC ???? default "terasic" if TARGET_SOCFPGA_TERASIC_DE10_NANO ???? default "terasic" if TARGET_SOCFPGA_TERASIC_SOCKIT +??? default "ic-automation" if TARGET_SOCFPGA_ICA_MORITZ_III ?config SYS_SOC ???? default "socfpga" @@ -207,6 +214,7 @@ 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_ica_moritz_iii" if TARGET_SOCFPGA_ICA_MORITZ_III ?source "board/keymile/Kconfig" diff --git a/board/ic-automation/moritz_iii/MAINTAINERS b/board/ic-automation/moritz_iii/MAINTAINERS new file mode 100644 index 0000000000..29e705524e --- /dev/null +++ b/board/ic-automation/moritz_iii/MAINTAINERS @@ -0,0 +1,8 @@ +MORITZ III BOARD +M:??? Nico Becker +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 diff --git a/board/ic-automation/moritz_iii/Makefile b/board/ic-automation/moritz_iii/Makefile new file mode 100644 index 0000000000..3577c94928 --- /dev/null +++ b/board/ic-automation/moritz_iii/Makefile @@ -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 + +obj-y??? := socfpga.o +obj-y??? := moritz_iii_board.o \ No newline at end of file diff --git a/board/ic-automation/moritz_iii/moritz_iii_board.c b/board/ic-automation/moritz_iii/moritz_iii_board.c new file mode 100644 index 0000000000..de56bf3a73 --- /dev/null +++ b/board/ic-automation/moritz_iii/moritz_iii_board.c @@ -0,0 +1,128 @@ +#include +#include +#include +#include +#include +#include + +#define I2C_BUS_NUM??? ??? ??? ??? ??? ??? 1 +#define EEPROM_ADDR??? ??? ??? ??? ??? ??? 0x50 +#define GPIO_ADDR??? ??? ??? ??? ??? ??? ??? 0x20 + +#define SERIALNUMBER_LENGTH??? ??? 8 +#define MAC_LENGTH??? ??? ??? ??? ??? ??? 6 +#define CRC32_LENGTH??? ??? ??? ??? ??? 4 +#define OVERALL_LENGTH (SERIALNUMBER_LENGTH+MAC_LENGTH+CRC32_LENGTH) + +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 + */ +#include diff --git a/configs/socfpga_moritz_iii_defconfig b/configs/socfpga_moritz_iii_defconfig new file mode 100644 index 0000000000..8909cf5c89 --- /dev/null +++ b/configs/socfpga_moritz_iii_defconfig @@ -0,0 +1,74 @@ +CONFIG_ARM=y +CONFIG_ARCH_SOCFPGA=y +CONFIG_ENV_SIZE=0x2000 +CONFIG_ENV_OFFSET=0x4400 +CONFIG_TARGET_SOCFPGA_ICA_MORITZ_III=y +CONFIG_SPL_TEXT_BASE=0xFFFF0000 +CONFIG_DISTRO_DEFAULTS=y +CONFIG_FIT=y +# CONFIG_USE_BOOTCOMMAND is not set +CONFIG_SYS_CONSOLE_IS_IN_ENV=y +CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE=y +CONFIG_SYS_CONSOLE_ENV_OVERWRITE=y +CONFIG_DEFAULT_FDT_FILE="socfpga_ica_moritz_iii.dtb" +CONFIG_VERSION_VARIABLE=y +# CONFIG_DISPLAY_BOARDINFO is not set +# CONFIG_DISPLAY_BOARDINFO_LATE is not set +CONFIG_SPL_SPI_LOAD=y +CONFIG_SYS_SPI_U_BOOT_OFFS=0x40000 +CONFIG_CMD_ASKENV=y +CONFIG_CMD_GREPENV=y +CONFIG_CMD_DFU=y +# CONFIG_CMD_FLASH is not set +CONFIG_CMD_GPIO=y +CONFIG_CMD_I2C=y +CONFIG_CMD_MMC=y +CONFIG_CMD_SPI=y +CONFIG_CMD_USB=y +CONFIG_CMD_USB_MASS_STORAGE=y +CONFIG_CMD_CACHE=y +CONFIG_CMD_EXT4_WRITE=y +# CONFIG_MTDIDS_DEFAULT is not set +# CONFIG_MTDPARTS_DEFAULT is not set +CONFIG_CMD_UBI=y +# CONFIG_ISO_PARTITION is not set +# CONFIG_EFI_PARTITION is not set +CONFIG_DEFAULT_DEVICE_TREE="socfpga_cyclone5_ica_moritz_iii" +CONFIG_ENV_IS_IN_MMC=y +CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_SPL_DM_SEQ_ALIAS=y +CONFIG_DFU_MMC=y +CONFIG_DM_GPIO=y +CONFIG_DWAPB_GPIO=y +CONFIG_DM_I2C=y +CONFIG_SYS_I2C_DW=y +CONFIG_DM_MMC=y +CONFIG_MMC_DW=y +CONFIG_MTD=y +CONFIG_SPI_FLASH_MACRONIX=y +CONFIG_SPI_FLASH_SPANSION=y +CONFIG_SPI_FLASH_STMICRO=y +# CONFIG_SPI_FLASH_USE_4K_SECTORS is not set +CONFIG_SPI_FLASH_MTD=y +CONFIG_PHY_MICREL=y +CONFIG_PHY_MICREL_KSZ90X1=y +CONFIG_DM_ETH=y +CONFIG_ETH_DESIGNWARE=y +CONFIG_MII=y +CONFIG_DM_RESET=y +CONFIG_SPI=y +CONFIG_CADENCE_QSPI=y +CONFIG_DESIGNWARE_SPI=y +CONFIG_USB=y +CONFIG_DM_USB=y +CONFIG_USB_DWC2=y +CONFIG_USB_GADGET=y +CONFIG_USB_GADGET_MANUFACTURER="altera" +CONFIG_USB_GADGET_VENDOR_NUM=0x0525 +CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 +CONFIG_USB_GADGET_DWC2_OTG=y +CONFIG_USB_GADGET_DOWNLOAD=y +# CONFIG_SPL_WDT is not set +CONFIG_SYS_PROMPT="M-III > " +CONFIG_SYS_BOARD="Moritz III" +CONFIG_SYS_VENDOR="ic-automation GmbH" diff --git a/include/configs/socfpga_ica_moritz_iii.h b/include/configs/socfpga_ica_moritz_iii.h new file mode 100644 index 0000000000..646ac0eb3a --- /dev/null +++ b/include/configs/socfpga_ica_moritz_iii.h @@ -0,0 +1,36 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright (C) 2014 Marek Vasut + */ +#ifndef __CONFIG_SOCFPGA_MORITZ_III_H__ +#define __CONFIG_SOCFPGA_MORITZ_III_H__ + +#include + +/* 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" \ +??? "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" \ +??? "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