Skip to contentSkip to conversation

Add Intel Arria 10 SoC support

PATCH Superseded Ley Foon Tan 6 participants 34 messages Apr 19, 2017 – Apr 25, 2017

Subsystems (5)

v6 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

v6 cover Add Intel Arria 10 SoC support

This is the 6th version of patchset to adds support for Intel Arria 10 SoC. This is initial patchset enables the basic support for Arria 10 and other features will come after this.

There is only one minor change in patch #5.

This series is rebased on top of http://git.denx.de/?p=u-boot/u-boot-socfpga.git.

v5 -> v6 changes:
-----------------
- macros sorted by address

Patchset history
----------------
[v1]: https://www.mail-archive.com/u-boot at lists.denx.de/msg240052.html [v2]: https://www.mail-archive.com/u-boot at lists.denx.de/msg241249.html [v3]: https://www.mail-archive.com/u-boot at lists.denx.de/msg243107.html [v4]: https://www.mail-archive.com/u-boot at lists.denx.de/msg243815.html [v5]: https://www.mail-archive.com/u-boot at lists.denx.de/msg244930.html

Ley Foon Tan (16):
arm: socfpga: Restructure clock manager driver
arm: socfpga: Restructure reset manager driver
arm: socfpga: Restructure system manager
arm: socfpga: Restructure misc driver
arm: socfpga: Add A10 macros
arm: socfpga: Add reset driver support for Arria 10
arm: socfpga: Add clock driver for Arria 10
arm: socfpga: Add system manager for Arria 10
arm: socfpga: Add sdram header file for Arria 10
arm: socfpga: Add pinmux for Arria 10
arm: socfpga: Add misc support for Arria 10
arm: dts: Add dts and dtsi for Arria 10
arm: socfpga: Add SPL support for Arria 10
arm: socfpga: Add config and defconfig for Arria 10
arm: socfpga: Add board files for the Arria10
arm: socfpga: Enable build for Arria 10

 arch/arm/dts/Makefile                              |    1 +
 arch/arm/dts/socfpga_arria10.dtsi                  |  869 ++++++++++++++++
 arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts       |   38 +
 .../dts/socfpga_arria10_socdk_sdmmc_handoff.dtsi   |  481 +++++++++
 arch/arm/mach-socfpga/Kconfig                      |   10 +
 arch/arm/mach-socfpga/Makefile                     |   41 +-
 arch/arm/mach-socfpga/clock_manager.c              |  525 +---------
 arch/arm/mach-socfpga/clock_manager_arria10.c      | 1096 ++++++++++++++++++++
 .../{clock_manager.c => clock_manager_gen5.c}      |  137 +--
 arch/arm/mach-socfpga/include/mach/base_addr_a10.h |    8 +-
 arch/arm/mach-socfpga/include/mach/clock_manager.h |  317 +-----
 .../include/mach/clock_manager_arria10.h           |  224 ++++
 .../mach/{clock_manager.h => clock_manager_gen5.h} |  151 +--
 arch/arm/mach-socfpga/include/mach/misc.h          |   31 +
 arch/arm/mach-socfpga/include/mach/pinmux.h        |   17 +
 arch/arm/mach-socfpga/include/mach/reset_manager.h |   50 +-
 .../include/mach/reset_manager_arria10.h           |  146 +++
 .../mach-socfpga/include/mach/reset_manager_gen5.h |   49 +
 arch/arm/mach-socfpga/include/mach/sdram_arria10.h |  380 +++++++
 .../arm/mach-socfpga/include/mach/system_manager.h |  202 ++--
 .../include/mach/system_manager_arria10.h          |   81 ++
 .../{system_manager.h => system_manager_gen5.h}    |   39 +-
 arch/arm/mach-socfpga/misc.c                       |  363 +------
 arch/arm/mach-socfpga/misc_arria10.c               |  259 +++++
 arch/arm/mach-socfpga/{misc.c => misc_gen5.c}      |  157 +--
 arch/arm/mach-socfpga/pinmux_arria10.c             |   96 ++
 arch/arm/mach-socfpga/reset_manager.c              |   93 +-
 arch/arm/mach-socfpga/reset_manager_arria10.c      |  383 +++++++
 .../{reset_manager.c => reset_manager_gen5.c}      |   51 +-
 arch/arm/mach-socfpga/spl.c                        |   75 +-
 .../{system_manager.c => system_manager_gen5.c}    |    6 +-
 board/altera/arria10-socdk/Kconfig                 |   18 +
 board/altera/arria10-socdk/Makefile                |    7 +
 board/altera/arria10-socdk/socfpga.c               |    7 +
 configs/socfpga_arria10_defconfig                  |   29 +
 include/configs/socfpga_arria10_socdk.h            |   66 ++
 include/configs/socfpga_common.h                   |   21 +-
 include/dt-bindings/reset/altr,rst-mgr-a10.h       |  110 ++
 38 files changed, 4837 insertions(+), 1797 deletions(-)
 create mode 100644 arch/arm/dts/socfpga_arria10.dtsi
 create mode 100644 arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts
 create mode 100644 arch/arm/dts/socfpga_arria10_socdk_sdmmc_handoff.dtsi
 create mode 100644 arch/arm/mach-socfpga/clock_manager_arria10.c
 copy arch/arm/mach-socfpga/{clock_manager.c => clock_manager_gen5.c} (85%)
 create mode 100644 arch/arm/mach-socfpga/include/mach/clock_manager_arria10.h
 copy arch/arm/mach-socfpga/include/mach/{clock_manager.h => clock_manager_gen5.h} (79%)
 create mode 100644 arch/arm/mach-socfpga/include/mach/misc.h
 create mode 100644 arch/arm/mach-socfpga/include/mach/pinmux.h
 create mode 100644 arch/arm/mach-socfpga/include/mach/reset_manager_arria10.h
 create mode 100644 arch/arm/mach-socfpga/include/mach/reset_manager_gen5.h
 create mode 100644 arch/arm/mach-socfpga/include/mach/sdram_arria10.h
 create mode 100644 arch/arm/mach-socfpga/include/mach/system_manager_arria10.h
 copy arch/arm/mach-socfpga/include/mach/{system_manager.h => system_manager_gen5.h} (73%)
 create mode 100644 arch/arm/mach-socfpga/misc_arria10.c
 copy arch/arm/mach-socfpga/{misc.c => misc_gen5.c} (71%)
 create mode 100644 arch/arm/mach-socfpga/pinmux_arria10.c
 create mode 100644 arch/arm/mach-socfpga/reset_manager_arria10.c
 copy arch/arm/mach-socfpga/{reset_manager.c => reset_manager_gen5.c} (75%)
 rename arch/arm/mach-socfpga/{system_manager.c => system_manager_gen5.c} (94%)
 create mode 100644 board/altera/arria10-socdk/Kconfig
 create mode 100644 board/altera/arria10-socdk/Makefile
 create mode 100644 board/altera/arria10-socdk/socfpga.c
 create mode 100644 configs/socfpga_arria10_defconfig
 create mode 100644 include/configs/socfpga_arria10_socdk.h
 create mode 100644 include/dt-bindings/reset/altr,rst-mgr-a10.h
Signature · 1 line
1.8.2.3
#1 lore raw

PATCH v6 1/16 arm: socfpga: Restructure clock manager driver

Restructure clock manager driver in the preparation to support A10. Move the Gen5 specific code to _gen5 files.

- Change all uint32_t to u32 and change to use macro BIT(n) for bit shift.
- Check return value from wait_for_bit(). So change return type to int for cm_write_with_phase() and cm_basic_init().

---
 arch/arm/mach-socfpga/Makefile                     |   3 +-
 arch/arm/mach-socfpga/clock_manager.c              | 515 +--------------------
 .../{clock_manager.c => clock_manager_gen5.c}      | 137 ++----
 arch/arm/mach-socfpga/include/mach/clock_manager.h | 316 +------------
 .../mach/{clock_manager.h => clock_manager_gen5.h} | 151 +++---
 arch/arm/mach-socfpga/spl.c                        |   3 +-
 6 files changed, 149 insertions(+), 976 deletions(-)
 copy arch/arm/mach-socfpga/{clock_manager.c => clock_manager_gen5.c} (85%)
 copy arch/arm/mach-socfpga/include/mach/{clock_manager.h => clock_manager_gen5.h} (79%)
arch/arm/mach-socfpga/Makefile +2 -1
index 809cd47..b76de4c 100644
@@ -13,7 +13,8 @@ obj-y	+= misc.o timer.o reset_manager.o system_manager.o clock_manager.o \
 obj-$(CONFIG_SPL_BUILD) += spl.o freeze_controller.o
 
 # QTS-generated config file wrappers
-obj-$(CONFIG_TARGET_SOCFPGA_GEN5)	+= scan_manager.o wrap_pll_config.o
+obj-$(CONFIG_TARGET_SOCFPGA_GEN5)	+= scan_manager.o wrap_pll_config.o \
+					   clock_manager_gen5.o
 obj-$(CONFIG_SPL_BUILD) += wrap_iocsr_config.o wrap_pinmux_config.o	\
 			   wrap_sdram_config.o
 CFLAGS_wrap_iocsr_config.o	+= -I$(srctree)/board/$(BOARDDIR)
arch/arm/mach-socfpga/clock_manager.c +8 -507

538 lines not on this page · raw message

arch/arm/mach-socfpga/clock_manager_gen5.c renamed from arch/arm/mach-socfpga/clock_manager.c +50 -87

268 lines not on this page · raw message

arch/arm/mach-socfpga/include/mach/clock_manager.h +9 -307

326 lines not on this page · raw message

arch/arm/mach-socfpga/include/mach/clock_manager_gen5.h renamed from arch/arm/mach-socfpga/include/mach/clock_manager.h +78 -73

221 lines not on this page · raw message

arch/arm/mach-socfpga/spl.c +2 -1
index fec4c7a..0064fc8 100644
@@ -127,7 +127,8 @@ void board_init_f(ulong dummy)
 
 	debug("Reconfigure Clock Manager\n");
 	/* reconfigure the PLLs */
-	cm_basic_init(cm_default_cfg);
+	if (cm_basic_init(cm_default_cfg))
+		hang();
 
 	/* Enable bootrom to configure IOs. */
 	sysmgr_config_warmrstcfgio(1);
Signature · 1 line
1.8.2.3
#2 lore raw

PATCH v6 2/16 arm: socfpga: Restructure reset manager driver

In reply to Ley Foon Tan

Restructure reset manager driver in the preparation to support A10.
Move the Gen5 specific code to gen5 files. Change socfpga_per_reset() return type to int.

---
 arch/arm/mach-socfpga/Makefile                     |  2 +-
 arch/arm/mach-socfpga/include/mach/reset_manager.h | 48 ++---------
 .../mach-socfpga/include/mach/reset_manager_gen5.h | 49 ++++++++++++
 arch/arm/mach-socfpga/reset_manager.c              | 93 +---------------------
 .../{reset_manager.c => reset_manager_gen5.c}      | 51 ++++++------
 5 files changed, 83 insertions(+), 160 deletions(-)
 create mode 100644 arch/arm/mach-socfpga/include/mach/reset_manager_gen5.h
 copy arch/arm/mach-socfpga/{reset_manager.c => reset_manager_gen5.c} (75%)
arch/arm/mach-socfpga/Makefile +1 -1
index b76de4c..97819ac 100644
@@ -14,7 +14,7 @@ obj-$(CONFIG_SPL_BUILD) += spl.o freeze_controller.o
 
 # QTS-generated config file wrappers
 obj-$(CONFIG_TARGET_SOCFPGA_GEN5)	+= scan_manager.o wrap_pll_config.o \
-					   clock_manager_gen5.o
+					   clock_manager_gen5.o reset_manager_gen5.o
 obj-$(CONFIG_SPL_BUILD) += wrap_iocsr_config.o wrap_pinmux_config.o	\
 			   wrap_sdram_config.o
 CFLAGS_wrap_iocsr_config.o	+= -I$(srctree)/board/$(BOARDDIR)
arch/arm/mach-socfpga/include/mach/reset_manager.h +8 -40

70 lines not on this page · raw message

arch/arm/mach-socfpga/include/mach/reset_manager_gen5.h new file +49 -0

49 lines not on this page · raw message

arch/arm/mach-socfpga/reset_manager.c +2 -91

114 lines not on this page · raw message

arch/arm/mach-socfpga/reset_manager_gen5.c renamed from arch/arm/mach-socfpga/reset_manager.c +23 -28

101 lines not on this page · raw message

Signature · 1 line
1.8.2.3
#3 lore raw

PATCH v6 3/16 arm: socfpga: Restructure system manager

In reply to Ley Foon Tan

Restructure system manager in the preparation to support A10. No functional change.

Change uint32_t to u32.

---
 arch/arm/mach-socfpga/Makefile                     |   5 +-
 .../arm/mach-socfpga/include/mach/system_manager.h | 128 ++-------------------
 .../{system_manager.h => system_manager_gen5.h}    |  39 +------
 .../{system_manager.c => system_manager_gen5.c}    |   6 +-
 4 files changed, 22 insertions(+), 156 deletions(-)
 copy arch/arm/mach-socfpga/include/mach/{system_manager.h => system_manager_gen5.h} (73%)
 rename arch/arm/mach-socfpga/{system_manager.c => system_manager_gen5.c} (94%)
arch/arm/mach-socfpga/Makefile +3 -2
index 97819ac..4980e51 100644
@@ -7,14 +7,15 @@
 # SPDX-License-Identifier:	GPL-2.0+
 #
 
-obj-y	+= misc.o timer.o reset_manager.o system_manager.o clock_manager.o \
+obj-y	+= misc.o timer.o reset_manager.o clock_manager.o \
 	   fpga_manager.o board.o
 
 obj-$(CONFIG_SPL_BUILD) += spl.o freeze_controller.o
 
 # QTS-generated config file wrappers
 obj-$(CONFIG_TARGET_SOCFPGA_GEN5)	+= scan_manager.o wrap_pll_config.o \
-					   clock_manager_gen5.o reset_manager_gen5.o
+					   clock_manager_gen5.o reset_manager_gen5.o \
+					   system_manager_gen5.o
 obj-$(CONFIG_SPL_BUILD) += wrap_iocsr_config.o wrap_pinmux_config.o	\
 			   wrap_sdram_config.o
 CFLAGS_wrap_iocsr_config.o	+= -I$(srctree)/board/$(BOARDDIR)
arch/arm/mach-socfpga/include/mach/system_manager.h +10 -118

146 lines not on this page · raw message

arch/arm/mach-socfpga/include/mach/system_manager_gen5.h renamed from arch/arm/mach-socfpga/include/mach/system_manager.h +6 -33
similarity index 73%
copy from arch/arm/mach-socfpga/include/mach/system_manager.h
copy to arch/arm/mach-socfpga/include/mach/system_manager_gen5.h
index c45edea..285c1a2 100644
@@ -1,11 +1,11 @@
 /*
- * Copyright (C) 2013 Altera Corporation <www.altera.com>
+ * Copyright (C) 2013-2017 Altera Corporation <www.altera.com>
  *
  * SPDX-License-Identifier:	GPL-2.0+
  */
 
-#ifndef	_SYSTEM_MANAGER_H_
-#define	_SYSTEM_MANAGER_H_
+#ifndef _SYSTEM_MANAGER_GEN5_H_
+#define _SYSTEM_MANAGER_GEN5_H_
 
 #ifndef __ASSEMBLY__
 
@@ -13,7 +13,6 @@ void sysmgr_pinmux_init(void);
 void sysmgr_config_warmrstcfgio(int enable);
 
 void sysmgr_get_pinmux_table(const u8 **table, unsigned int *table_len);
-#endif
 
 struct socfpga_system_manager {
 	/* System Manager Module */
@@ -115,35 +114,9 @@ struct socfpga_system_manager {
 	u32	_pad_0x734;
 	u32	spim0usefpga;			/* 0x738 */
 };
-
-#define SYSMGR_ROMCODEGRP_CTRL_WARMRSTCFGPINMUX	(1 << 0)
-#define SYSMGR_ROMCODEGRP_CTRL_WARMRSTCFGIO	(1 << 1)
-#define SYSMGR_ECC_OCRAM_EN	(1 << 0)
-#define SYSMGR_ECC_OCRAM_SERR	(1 << 3)
-#define SYSMGR_ECC_OCRAM_DERR	(1 << 4)
-#define SYSMGR_FPGAINTF_USEFPGA	0x1
-#define SYSMGR_FPGAINTF_SPIM0	(1 << 0)
-#define SYSMGR_FPGAINTF_SPIM1	(1 << 1)
-#define SYSMGR_FPGAINTF_EMAC0	(1 << 2)
-#define SYSMGR_FPGAINTF_EMAC1	(1 << 3)
-#define SYSMGR_FPGAINTF_NAND	(1 << 4)
-#define SYSMGR_FPGAINTF_SDMMC	(1 << 5)
-
-#if defined(CONFIG_TARGET_SOCFPGA_GEN5)
-#define SYSMGR_SDMMC_SMPLSEL_SHIFT	3
-#else
-#define SYSMGR_SDMMC_SMPLSEL_SHIFT	4
 #endif
 
-#define SYSMGR_SDMMC_DRVSEL_SHIFT	0
-
-/* EMAC Group Bit definitions */
-#define SYSMGR_EMACGRP_CTRL_PHYSEL_ENUM_GMII_MII	0x0
-#define SYSMGR_EMACGRP_CTRL_PHYSEL_ENUM_RGMII		0x1
-#define SYSMGR_EMACGRP_CTRL_PHYSEL_ENUM_RMII		0x2
-
-#define SYSMGR_EMACGRP_CTRL_PHYSEL0_LSB			0
-#define SYSMGR_EMACGRP_CTRL_PHYSEL1_LSB			2
-#define SYSMGR_EMACGRP_CTRL_PHYSEL_MASK			0x3
+#define SYSMGR_SDMMC_SMPLSEL_SHIFT	3
+#define SYSMGR_BOOTINFO_BSEL_SHIFT	0
 
-#endif /* _SYSTEM_MANAGER_H_ */
+#endif /* _SYSTEM_MANAGER_GEN5_H_ */
arch/arm/mach-socfpga/system_manager_gen5.c renamed from arch/arm/mach-socfpga/system_manager.c +3 -3
similarity index 94%
rename from arch/arm/mach-socfpga/system_manager.c
rename to arch/arm/mach-socfpga/system_manager_gen5.c
index 75a65f3..3588a57 100644
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 Altera Corporation <www.altera.com>
+ * Copyright (C) 2013-2017 Altera Corporation <www.altera.com>
  *
  * SPDX-License-Identifier:	GPL-2.0+
  */
@@ -21,7 +21,7 @@ static struct socfpga_system_manager *sysmgr_regs =
  */
 static void populate_sysmgr_fpgaintf_module(void)
 {
-	uint32_t handoff_val = 0;
+	u32 handoff_val = 0;
 
 	/* ISWGRP_HANDOFF_FPGAINTF */
 	writel(0, &sysmgr_regs->iswgrp_handoff[2]);
@@ -56,7 +56,7 @@ static void populate_sysmgr_fpgaintf_module(void)
  */
 void sysmgr_pinmux_init(void)
 {
-	uint32_t regs = (uint32_t)&sysmgr_regs->emacio[0];
+	u32 regs = (u32)&sysmgr_regs->emacio[0];
 	const u8 *sys_mgr_init_table;
 	unsigned int len;
 	int i;
Signature · 1 line
1.8.2.3
#4 lore raw

PATCH v6 4/16 arm: socfpga: Restructure misc driver

In reply to Ley Foon Tan

Restructure misc driver in the preparation to support A10. Move the Gen5 specific code to gen5 file.

Change all uint32_t_to u32 and check return value from socfpga_bridges_reset.

---
 arch/arm/mach-socfpga/Makefile                |   2 +-
 arch/arm/mach-socfpga/include/mach/misc.h     |  25 ++
 arch/arm/mach-socfpga/misc.c                  | 363 ++------------------------
 arch/arm/mach-socfpga/{misc.c => misc_gen5.c} | 157 ++---------
 4 files changed, 65 insertions(+), 482 deletions(-)
 create mode 100644 arch/arm/mach-socfpga/include/mach/misc.h
 copy arch/arm/mach-socfpga/{misc.c => misc_gen5.c} (71%)
arch/arm/mach-socfpga/Makefile +1 -1
index 4980e51..e83da2e 100644
@@ -15,7 +15,7 @@ obj-$(CONFIG_SPL_BUILD) += spl.o freeze_controller.o
 # QTS-generated config file wrappers
 obj-$(CONFIG_TARGET_SOCFPGA_GEN5)	+= scan_manager.o wrap_pll_config.o \
 					   clock_manager_gen5.o reset_manager_gen5.o \
-					   system_manager_gen5.o
+					   misc_gen5.o system_manager_gen5.o
 obj-$(CONFIG_SPL_BUILD) += wrap_iocsr_config.o wrap_pinmux_config.o	\
 			   wrap_sdram_config.o
 CFLAGS_wrap_iocsr_config.o	+= -I$(srctree)/board/$(BOARDDIR)
arch/arm/mach-socfpga/include/mach/misc.h new file +25 -0
new file mode 100644
index 0000000..f344749
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2016-2017 Intel Corporation
+ *
+ * SPDX-License-Identifier:    GPL-2.0
+ */
+
+#ifndef _MISC_H_
+#define _MISC_H_
+
+void dwmac_deassert_reset(const unsigned int of_reset_id, const u32 phymode);
+
+struct bsel {
+	const char	*mode;
+	const char	*name;
+};
+
+extern struct bsel bsel_str[];
+
+#ifdef CONFIG_FPGA
+void socfpga_fpga_add(void);
+#else
+static inline void socfpga_fpga_add(void) {}
+#endif
+
+#endif /* _MISC_H_ */
arch/arm/mach-socfpga/misc.c +15 -348

403 lines not on this page · raw message

arch/arm/mach-socfpga/misc_gen5.c renamed from arch/arm/mach-socfpga/misc.c +24 -133

246 lines not on this page · raw message

Signature · 1 line
1.8.2.3
#5 lore raw

PATCH v6 5/16 arm: socfpga: Add A10 macros

In reply to Ley Foon Tan

Add i2c, timer and other A10 macros.

---
 arch/arm/mach-socfpga/include/mach/base_addr_a10.h | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
arch/arm/mach-socfpga/include/mach/base_addr_a10.h +7 -1
index a7056d4..7818aa5 100644
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014 Altera Corporation <www.altera.com>
+ * Copyright (C) 2014-2017 Altera Corporation <www.altera.com>
  *
  * SPDX-License-Identifier:	GPL-2.0+
  */
@@ -29,17 +29,23 @@
 #define SOCFPGA_MPUL2_ADDRESS			0xfffff000
 #define SOCFPGA_I2C0_ADDRESS			0xffc02200
 #define SOCFPGA_I2C1_ADDRESS			0xffc02300
+#define SOCFPGA_I2C2_ADDRESS			0xffc02400
+#define SOCFPGA_I2C3_ADDRESS			0xffc02500
+#define SOCFPGA_I2C4_ADDRESS			0xffc02600
 
 #define SOCFPGA_ECC_OCRAM_ADDRESS		0xff8c3000
 #define SOCFPGA_UART0_ADDRESS			0xffc02000
 #define SOCFPGA_OSC1TIMER0_ADDRESS		0xffd00000
+#define SOCFPGA_OSC1TIMER1_ADDRESS		0xffd00100
 #define SOCFPGA_CLKMGR_ADDRESS			0xffd04000
 #define SOCFPGA_RSTMGR_ADDRESS			0xffd05000
 
 #define SOCFPGA_SDR_ADDRESS			0xffcfb000
+#define SOCFPGA_NOC_L4_PRIV_FLT_OFST		0xffd11000
 #define SOCFPGA_SDR_SCHEDULER_ADDRESS		0xffd12400
 #define SOCFPGA_SDR_FIREWALL_OCRAM_ADDRESS	0xffd13200
 #define SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS	0xffd13300
 #define SOCFPGA_SDR_FIREWALL_L3_ADDRESS		0xffd13400
+#define SOCFPGA_NOC_FW_H2F_SCR_OFST		0xffd13500
 
 #endif /* _SOCFPGA_A10_BASE_HARDWARE_H_ */
Signature · 1 line
1.8.2.3
#6 lore raw

PATCH v6 6/16 arm: socfpga: Add reset driver support for Arria 10

In reply to Ley Foon Tan

Add reset driver support for Arria 10.

---
 arch/arm/mach-socfpga/Makefile                     |   2 +
 arch/arm/mach-socfpga/include/mach/reset_manager.h |   2 +
 .../include/mach/reset_manager_arria10.h           | 146 ++++++++
 arch/arm/mach-socfpga/reset_manager_arria10.c      | 383 +++++++++++++++++++++
 include/dt-bindings/reset/altr,rst-mgr-a10.h       | 110 ++++++
 5 files changed, 643 insertions(+)
 create mode 100644 arch/arm/mach-socfpga/include/mach/reset_manager_arria10.h
 create mode 100644 arch/arm/mach-socfpga/reset_manager_arria10.c
 create mode 100644 include/dt-bindings/reset/altr,rst-mgr-a10.h
arch/arm/mach-socfpga/Makefile +2 -0
index e83da2e..d81f003 100644
@@ -10,6 +10,8 @@
 obj-y	+= misc.o timer.o reset_manager.o clock_manager.o \
 	   fpga_manager.o board.o
 
+obj-$(CONFIG_TARGET_SOCFPGA_ARRIA10) += reset_manager_arria10.o
+
 obj-$(CONFIG_SPL_BUILD) += spl.o freeze_controller.o
 
 # QTS-generated config file wrappers
arch/arm/mach-socfpga/include/mach/reset_manager.h +2 -0
index c99efa7..a0d611b 100644
@@ -45,6 +45,8 @@ void socfpga_per_reset_all(void);
 
 #if defined(CONFIG_TARGET_SOCFPGA_GEN5)
 #include <asm/arch/reset_manager_gen5.h>
+#elif defined(CONFIG_TARGET_SOCFPGA_ARRIA10)
+#include <asm/arch/reset_manager_arria10.h>
 #endif
 
 #endif /* _RESET_MANAGER_H_ */
arch/arm/mach-socfpga/include/mach/reset_manager_arria10.h new file +146 -0

146 lines not on this page · raw message

arch/arm/mach-socfpga/reset_manager_arria10.c new file +383 -0

383 lines not on this page · raw message

include/dt-bindings/reset/altr,rst-mgr-a10.h new file +110 -0

110 lines not on this page · raw message

Signature · 1 line
1.8.2.3
#7 lore raw

PATCH v6 7/16 arm: socfpga: Add clock driver for Arria 10

In reply to Ley Foon Tan

Add clock driver support for Arria 10.

---
 arch/arm/mach-socfpga/Makefile                     |    3 +-
 arch/arm/mach-socfpga/clock_manager.c              |   10 +
 arch/arm/mach-socfpga/clock_manager_arria10.c      | 1096 ++++++++++++++++++++
 arch/arm/mach-socfpga/include/mach/clock_manager.h |    3 +
 .../include/mach/clock_manager_arria10.h           |  224 ++++
 5 files changed, 1335 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/mach-socfpga/clock_manager_arria10.c
 create mode 100644 arch/arm/mach-socfpga/include/mach/clock_manager_arria10.h
arch/arm/mach-socfpga/Makefile +2 -1
index d81f003..c494930 100644
@@ -10,7 +10,8 @@
 obj-y	+= misc.o timer.o reset_manager.o clock_manager.o \
 	   fpga_manager.o board.o
 
-obj-$(CONFIG_TARGET_SOCFPGA_ARRIA10) += reset_manager_arria10.o
+obj-$(CONFIG_TARGET_SOCFPGA_ARRIA10) += clock_manager_arria10.o \
+					reset_manager_arria10.o
 
 obj-$(CONFIG_SPL_BUILD) += spl.o freeze_controller.o
 
arch/arm/mach-socfpga/clock_manager.c +10 -0
index 8051995..cb6ae03 100644
@@ -19,7 +19,12 @@ void cm_wait_for_lock(u32 mask)
 	u32 inter_val;
 	u32 retry = 0;
 	do {
+#if defined(CONFIG_TARGET_SOCFPGA_GEN5)
 		inter_val = readl(&clock_manager_base->inter) & mask;
+#elif defined(CONFIG_TARGET_SOCFPGA_ARRIA10)
+		inter_val = readl(&clock_manager_base->stat) & mask;
+#endif
+		/* Wait for stable lock */
 		if (inter_val == mask)
 			retry++;
 		else
@@ -44,7 +49,12 @@ int set_cpu_clk_info(void)
 
 	gd->bd->bi_arm_freq = cm_get_mpu_clk_hz() / 1000000;
 	gd->bd->bi_dsp_freq = 0;
+
+#if defined(CONFIG_TARGET_SOCFPGA_GEN5)
 	gd->bd->bi_ddr_freq = cm_get_sdram_clk_hz() / 1000000;
+#elif defined(CONFIG_TARGET_SOCFPGA_ARRIA10)
+	gd->bd->bi_ddr_freq = 0;
+#endif
 
 	return 0;
 }
arch/arm/mach-socfpga/clock_manager_arria10.c new file +1096 -0

1,096 lines not on this page · raw message

arch/arm/mach-socfpga/include/mach/clock_manager.h +3 -0
index b076497..4c6b1f8 100644
@@ -15,5 +15,8 @@ void cm_print_clock_quick_summary(void);
 
 #if defined(CONFIG_TARGET_SOCFPGA_GEN5)
 #include <asm/arch/clock_manager_gen5.h>
+#elif defined(CONFIG_TARGET_SOCFPGA_ARRIA10)
+#include <asm/arch/clock_manager_arria10.h>
 #endif
+
 #endif /* _CLOCK_MANAGER_H_ */
arch/arm/mach-socfpga/include/mach/clock_manager_arria10.h new file +224 -0

224 lines not on this page · raw message

Signature · 1 line
1.8.2.3
#8 lore raw

PATCH v6 8/16 arm: socfpga: Add system manager for Arria 10

In reply to Ley Foon Tan

Add system manager register struct and macros for Arria 10.

---
 .../arm/mach-socfpga/include/mach/system_manager.h | 74 +++++++++++++++++---
 .../include/mach/system_manager_arria10.h          | 81 ++++++++++++++++++++++
 2 files changed, 144 insertions(+), 11 deletions(-)
 create mode 100644 arch/arm/mach-socfpga/include/mach/system_manager_arria10.h
arch/arm/mach-socfpga/include/mach/system_manager.h +63 -11
index 30f0bbe..e6d4280 100644
@@ -7,18 +7,18 @@
 #ifndef _SYSTEM_MANAGER_H_
 #define _SYSTEM_MANAGER_H_
 
-#define SYSMGR_ROMCODEGRP_CTRL_WARMRSTCFGPINMUX	(1 << 0)
-#define SYSMGR_ROMCODEGRP_CTRL_WARMRSTCFGIO	(1 << 1)
-#define SYSMGR_ECC_OCRAM_EN	(1 << 0)
-#define SYSMGR_ECC_OCRAM_SERR	(1 << 3)
-#define SYSMGR_ECC_OCRAM_DERR	(1 << 4)
+#define SYSMGR_ROMCODEGRP_CTRL_WARMRSTCFGPINMUX	BIT(0)
+#define SYSMGR_ROMCODEGRP_CTRL_WARMRSTCFGIO	BIT(1)
+#define SYSMGR_ECC_OCRAM_EN	BIT(0)
+#define SYSMGR_ECC_OCRAM_SERR	BIT(3)
+#define SYSMGR_ECC_OCRAM_DERR	BIT(4)
 #define SYSMGR_FPGAINTF_USEFPGA	0x1
-#define SYSMGR_FPGAINTF_SPIM0	(1 << 0)
-#define SYSMGR_FPGAINTF_SPIM1	(1 << 1)
-#define SYSMGR_FPGAINTF_EMAC0	(1 << 2)
-#define SYSMGR_FPGAINTF_EMAC1	(1 << 3)
-#define SYSMGR_FPGAINTF_NAND	(1 << 4)
-#define SYSMGR_FPGAINTF_SDMMC	(1 << 5)
+#define SYSMGR_FPGAINTF_SPIM0	BIT(0)
+#define SYSMGR_FPGAINTF_SPIM1	BIT(1)
+#define SYSMGR_FPGAINTF_EMAC0	BIT(2)
+#define SYSMGR_FPGAINTF_EMAC1	BIT(3)
+#define SYSMGR_FPGAINTF_NAND	BIT(4)
+#define SYSMGR_FPGAINTF_SDMMC	BIT(5)
 
 #define SYSMGR_SDMMC_DRVSEL_SHIFT	0
 
@@ -31,8 +31,60 @@
 #define SYSMGR_EMACGRP_CTRL_PHYSEL1_LSB			2
 #define SYSMGR_EMACGRP_CTRL_PHYSEL_MASK			0x3
 
+/* For dedicated IO configuration */
+/* Voltage select enums */
+#define VOLTAGE_SEL_3V		0x0
+#define VOLTAGE_SEL_1P8V	0x1
+#define VOLTAGE_SEL_2P5V	0x2
+
+/* Input buffer enable */
+#define INPUT_BUF_DISABLE	0
+#define INPUT_BUF_1P8V		1
+#define INPUT_BUF_2P5V3V	2
+
+/* Weak pull up enable */
+#define WK_PU_DISABLE		0
+#define WK_PU_ENABLE		1
+
+/* Pull up slew rate control */
+#define PU_SLW_RT_SLOW		0
+#define PU_SLW_RT_FAST		1
+#define PU_SLW_RT_DEFAULT	PU_SLW_RT_SLOW
+
+/* Pull down slew rate control */
+#define PD_SLW_RT_SLOW		0
+#define PD_SLW_RT_FAST		1
+#define PD_SLW_RT_DEFAULT	PD_SLW_RT_SLOW
+
+/* Drive strength control */
+#define PU_DRV_STRG_DEFAULT	0x10
+#define PD_DRV_STRG_DEFAULT	0x10
+
+/* bit position */
+#define PD_DRV_STRG_LSB		0
+#define PD_SLW_RT_LSB		5
+#define PU_DRV_STRG_LSB		8
+#define PU_SLW_RT_LSB		13
+#define WK_PU_LSB		16
+#define INPUT_BUF_LSB		17
+#define BIAS_TRIM_LSB		19
+#define VOLTAGE_SEL_LSB		0
+
+#define ALT_SYSMGR_NOC_H2F_SET_MSK	BIT(0)
+#define ALT_SYSMGR_NOC_LWH2F_SET_MSK	BIT(4)
+#define ALT_SYSMGR_NOC_F2H_SET_MSK	BIT(8)
+#define ALT_SYSMGR_NOC_F2SDR0_SET_MSK	BIT(16)
+#define ALT_SYSMGR_NOC_F2SDR1_SET_MSK	BIT(20)
+#define ALT_SYSMGR_NOC_F2SDR2_SET_MSK	BIT(24)
+#define ALT_SYSMGR_NOC_TMO_EN_SET_MSK	BIT(0)
+
+#define ALT_SYSMGR_ECC_INTSTAT_SERR_OCRAM_SET_MSK	BIT(1)
+#define ALT_SYSMGR_ECC_INTSTAT_DERR_OCRAM_SET_MSK	BIT(1)
+
 #if defined(CONFIG_TARGET_SOCFPGA_GEN5)
 #include <asm/arch/system_manager_gen5.h>
+#elif defined(CONFIG_TARGET_SOCFPGA_ARRIA10)
+#include <asm/arch/system_manager_arria10.h>
 #endif
 
 #define SYSMGR_GET_BOOTINFO_BSEL(bsel)		\
arch/arm/mach-socfpga/include/mach/system_manager_arria10.h new file +81 -0

81 lines not on this page · raw message

Signature · 1 line
1.8.2.3
#9 lore raw

PATCH v6 9/16 arm: socfpga: Add sdram header file for Arria 10

In reply to Ley Foon Tan

Add sdram header file for Arria 10.

---
 arch/arm/mach-socfpga/include/mach/sdram_arria10.h | 380 +++++++++++++++++++++
 1 file changed, 380 insertions(+)
 create mode 100644 arch/arm/mach-socfpga/include/mach/sdram_arria10.h
arch/arm/mach-socfpga/include/mach/sdram_arria10.h new file +380 -0
new file mode 100644
index 0000000..1d7b7c1
@@ -0,0 +1,380 @@
+/*
+ * Copyright (C) 2015-2017 Intel Corporation <www.intel.com>
+ *
+ * SPDX-License-Identifier:	GPL-2.0
+ */
+
+#ifndef _SOCFPGA_SDRAM_ARRIA10_H_
+#define _SOCFPGA_SDRAM_ARRIA10_H_
+
+#ifndef __ASSEMBLY__
+
+struct socfpga_ecc_hmc {
+	u32 ip_rev_id;
+	u32 _pad_0x4_0x7;
+	u32 ddrioctrl;
+	u32 ddrcalstat;
+	u32 mpr_0beat1;
+	u32 mpr_1beat1;
+	u32 mpr_2beat1;
+	u32 mpr_3beat1;
+	u32 mpr_4beat1;
+	u32 mpr_5beat1;
+	u32 mpr_6beat1;
+	u32 mpr_7beat1;
+	u32 mpr_8beat1;
+	u32 mpr_0beat2;
+	u32 mpr_1beat2;
+	u32 mpr_2beat2;
+	u32 mpr_3beat2;
+	u32 mpr_4beat2;
+	u32 mpr_5beat2;
+	u32 mpr_6beat2;
+	u32 mpr_7beat2;
+	u32 mpr_8beat2;
+	u32 _pad_0x58_0x5f[2];
+	u32 auto_precharge;
+	u32 _pad_0x64_0xff[39];
+	u32 eccctrl;
+	u32 eccctrl2;
+	u32 _pad_0x108_0x10f[2];
+	u32 errinten;
+	u32 errintens;
+	u32 errintenr;
+	u32 intmode;
+	u32 intstat;
+	u32 diaginttest;
+	u32 modstat;
+	u32 derraddra;
+	u32 serraddra;
+	u32 _pad_0x134_0x137;
+	u32 autowb_corraddr;
+	u32 serrcntreg;
+	u32 autowb_drop_cntreg;
+	u32 _pad_0x144_0x147;
+	u32 ecc_reg2wreccdatabus;
+	u32 ecc_rdeccdata2regbus;
+	u32 ecc_reg2rdeccdatabus;
+	u32 _pad_0x154_0x15f[3];
+	u32 ecc_diagon;
+	u32 ecc_decstat;
+	u32 _pad_0x168_0x16f[2];
+	u32 ecc_errgenaddr_0;
+	u32 ecc_errgenaddr_1;
+	u32 ecc_errgenaddr_2;
+	u32 ecc_errgenaddr_3;
+};
+
+struct socfpga_noc_ddr_scheduler {
+	u32 ddr_t_main_scheduler_id_coreid;
+	u32 ddr_t_main_scheduler_id_revisionid;
+	u32 ddr_t_main_scheduler_ddrconf;
+	u32 ddr_t_main_scheduler_ddrtiming;
+	u32 ddr_t_main_scheduler_ddrmode;
+	u32 ddr_t_main_scheduler_readlatency;
+	u32 _pad_0x20_0x34[8];
+	u32 ddr_t_main_scheduler_activate;
+	u32 ddr_t_main_scheduler_devtodev;
+};
+
+/*
+ * OCRAM firewall
+ */
+struct socfpga_noc_fw_ocram {
+	u32 enable;
+	u32 enable_set;
+	u32 enable_clear;
+	u32 region0;
+	u32 region1;
+	u32 region2;
+	u32 region3;
+	u32 region4;
+	u32 region5;
+};
+
+/* for master such as MPU and FPGA */
+struct socfpga_noc_fw_ddr_mpu_fpga2sdram {
+	u32 enable;
+	u32 enable_set;
+	u32 enable_clear;
+	u32 _pad_0xc_0xf;
+	u32 mpuregion0addr;
+	u32 mpuregion1addr;
+	u32 mpuregion2addr;
+	u32 mpuregion3addr;
+	u32 fpga2sdram0region0addr;
+	u32 fpga2sdram0region1addr;
+	u32 fpga2sdram0region2addr;
+	u32 fpga2sdram0region3addr;
+	u32 fpga2sdram1region0addr;
+	u32 fpga2sdram1region1addr;
+	u32 fpga2sdram1region2addr;
+	u32 fpga2sdram1region3addr;
+	u32 fpga2sdram2region0addr;
+	u32 fpga2sdram2region1addr;
+	u32 fpga2sdram2region2addr;
+	u32 fpga2sdram2region3addr;
+};
+
+/* for L3 master */
+struct socfpga_noc_fw_ddr_l3 {
+	u32 enable;
+	u32 enable_set;
+	u32 enable_clear;
+	u32 hpsregion0addr;
+	u32 hpsregion1addr;
+	u32 hpsregion2addr;
+	u32 hpsregion3addr;
+	u32 hpsregion4addr;
+	u32 hpsregion5addr;
+	u32 hpsregion6addr;
+	u32 hpsregion7addr;
+};
+
+struct socfpga_io48_mmr {
+	u32 dbgcfg0;
+	u32 dbgcfg1;
+	u32 dbgcfg2;
+	u32 dbgcfg3;
+	u32 dbgcfg4;
+	u32 dbgcfg5;
+	u32 dbgcfg6;
+	u32 reserve0;
+	u32 reserve1;
+	u32 reserve2;
+	u32 ctrlcfg0;
+	u32 ctrlcfg1;
+	u32 ctrlcfg2;
+	u32 ctrlcfg3;
+	u32 ctrlcfg4;
+	u32 ctrlcfg5;
+	u32 ctrlcfg6;
+	u32 ctrlcfg7;
+	u32 ctrlcfg8;
+	u32 ctrlcfg9;
+	u32 dramtiming0;
+	u32 dramodt0;
+	u32 dramodt1;
+	u32 sbcfg0;
+	u32 sbcfg1;
+	u32 sbcfg2;
+	u32 sbcfg3;
+	u32 sbcfg4;
+	u32 sbcfg5;
+	u32 sbcfg6;
+	u32 sbcfg7;
+	u32 caltiming0;
+	u32 caltiming1;
+	u32 caltiming2;
+	u32 caltiming3;
+	u32 caltiming4;
+	u32 caltiming5;
+	u32 caltiming6;
+	u32 caltiming7;
+	u32 caltiming8;
+	u32 caltiming9;
+	u32 caltiming10;
+	u32 dramaddrw;
+	u32 sideband0;
+	u32 sideband1;
+	u32 sideband2;
+	u32 sideband3;
+	u32 sideband4;
+	u32 sideband5;
+	u32 sideband6;
+	u32 sideband7;
+	u32 sideband8;
+	u32 sideband9;
+	u32 sideband10;
+	u32 sideband11;
+	u32 sideband12;
+	u32 sideband13;
+	u32 sideband14;
+	u32 sideband15;
+	u32 dramsts;
+	u32 dbgdone;
+	u32 dbgsignals;
+	u32 dbgreset;
+	u32 dbgmatch;
+	u32 counter0mask;
+	u32 counter1mask;
+	u32 counter0match;
+	u32 counter1match;
+	u32 niosreserve0;
+	u32 niosreserve1;
+	u32 niosreserve2;
+};
+#endif /*__ASSEMBLY__*/
+
+#define IO48_MMR_CTRLCFG0_DB2_BURST_LENGTH_MASK		0x1F000000
+#define IO48_MMR_CTRLCFG0_DB2_BURST_LENGTH_SHIFT	24
+#define IO48_MMR_CTRLCFG0_DB1_BURST_LENGTH_MASK		0x00F80000
+#define IO48_MMR_CTRLCFG0_DB1_BURST_LENGTH_SHIFT	19
+#define IO48_MMR_CTRLCFG0_DB0_BURST_LENGTH_MASK		0x0007C000
+#define IO48_MMR_CTRLCFG0_DB0_BURST_LENGTH_SHIFT	14
+#define IO48_MMR_CTRLCFG0_CTRL_BURST_LENGTH_MASK	0x00003E00
+#define IO48_MMR_CTRLCFG0_CTRL_BURST_LENGTH_SHIFT	9
+#define IO48_MMR_CTRLCFG0_AC_POS_MASK			0x00000180
+#define IO48_MMR_CTRLCFG0_AC_POS_SHIFT			7
+#define IO48_MMR_CTRLCFG0_DIMM_TYPE_MASK		0x00000070
+#define IO48_MMR_CTRLCFG0_DIM_TYPE_SHIFT		4
+#define IO48_MMR_CTRLCFG0_MEM_TYPE_MASK			0x0000000F
+#define IO48_MMR_CTRLCFG0_MEM_TYPE_SHIFT		0
+
+#define IO48_MMR_CTRLCFG1_DBC3_ENABLE_DM		BIT(30)
+#define IO48_MMR_CTRLCFG1_DBC2_ENABLE_DM		BIT(29)
+#define IO48_MMR_CTRLCFG1_DBC1_ENABLE_DM		BIT(28)
+#define IO48_MMR_CTRLCFG1_DBC0_ENABLE_DM		BIT(27)
+#define IO48_MMR_CTRLCFG1_CTRL_ENABLE_DM		BIT(26)
+#define IO48_MMR_CTRLCFG1_DQSTRK_EN			BIT(25)
+#define IO48_MMR_CTRLCFG1_STARVE_LIMIT_MASK		0x01F80000
+#define IO48_MMR_CTRLCFG1_STARVE_LIMIT_SHIFT		19
+#define IO48_MMR_CTRLCFG1_REORDER_READ			BIT(18)
+#define IO48_MMR_CTRLCFG1_DBC3_REORDER_RDATA		BIT(17)
+#define IO48_MMR_CTRLCFG1_DBC2_REORDER_RDATA		BIT(16)
+#define IO48_MMR_CTRLCFG1_DBC1_REORDER_RDATA		BIT(15)
+#define IO48_MMR_CTRLCFG1_DBC0_REORDER_RDATA		BIT(14)
+#define IO48_MMR_CTRLCFG1_CTRL_REORDER_RDATA		BIT(13)
+#define IO48_MMR_CTRLCFG1_REORDER_DATA			BIT(12)
+#define IO48_MMR_CTRLCFG1_DBC3_ENABLE_ECC		BIT(11)
+#define IO48_MMR_CTRLCFG1_DBC2_ENABLE_ECC		BIT(10)
+#define IO48_MMR_CTRLCFG1_DBC1_ENABLE_ECC		BIT(9)
+#define IO48_MMR_CTRLCFG1_DBC0_ENABLE_ECC		BIT(8)
+#define IO48_MMR_CTRLCFG1_CTRL_ENABLE_ECC		BIT(7)
+#define IO48_MMR_CTRLCFG1_ADDR_ORDER_MASK		0x00000060
+#define IO48_MMR_CTRLCFG1_ADDR_ORDER_SHIFT		5
+#define IO48_MMR_CTRLCFG1_DBC3_BURST_LENGTH_MASK	0x0000001F
+#define IO48_MMR_CTRLCFG1_DBC3_BURST_LENGTH_SHIFT	0
+
+#define IO48_MMR_CALTIMING0_CFG_ACT_TO_ACT_DIFF_BG_MASK		0x3F000000
+#define IO48_MMR_CALTIMING0_CFG_ACT_TO_ACT_DIFF_BG_SHIFT	24
+#define IO48_MMR_CALTIMING0_CFG_ACT_TO_ACT_DIFF_BANK_MASK	0x00FC0000
+#define IO48_MMR_CALTIMING0_CFG_ACT_TO_ACT_DIFF_BANK_SHIFT	18
+#define IO48_MMR_CALTIMING0_CFG_ACT_TO_ACT_MASK			0x0003F000
+#define IO48_MMR_CALTIMING0_CFG_ACT_TO_ACT_SHIFT		12
+#define IO48_MMR_CALTIMING0_CFG_ACT_TO_PCH_MASK			0x00000FC0
+#define IO48_MMR_CALTIMING0_CFG_ACT_TO_PCH_SHIFT		6
+#define IO48_MMR_CALTIMING0_CFG_ACT_TO_RDWR_MASK		0x0000003F
+#define IO48_MMR_CALTIMING0_CFG_ACT_TO_RDWR_SHIFT		0
+
+#define IO48_MMR_CALTIMING1_CFG_RD_TO_WR_DIFF_CHIP_MASK		0x3F000000
+#define IO48_MMR_CALTIMING1_CFG_RD_TO_WR_DIFF_CHIP_SHIFT	24
+#define IO48_MMR_CALTIMING1_CFG_RD_TO_WR_MASK			0x00FC0000
+#define IO48_MMR_CALTIMING1_CFG_RD_TO_WR_SHIFT			18
+#define IO48_MMR_CALTIMING1_CFG_RD_TO_RD_DB_MASK		0x0003F000
+#define IO48_MMR_CALTIMING1_CFG_RD_TO_RD_DB_SHIFT		12
+#define IO48_MMR_CALTIMING1_CFG_RD_TO_RD_DC_MASK		0x00000FC0
+#define IO48_MMR_CALTIMING1_CFG_RD_TO_RD_DC_SHIFT		6
+#define IO48_MMR_CALTIMING1_CFG_RD_TO_RD_MASK			0x0000003F
+#define IO48_MMR_CALTIMING1_CFG_RD_TO_RD_SHIFT			0
+
+#define IO48_MMR_CALTIMING2_CFG_WR_TO_WR_DIFF_CHIP_MASK		0x3F000000
+#define IO48_MMR_CALTIMING2_CFG_WR_TO_WR_DIFF_CHIP_SHIFT	24
+#define IO48_MMR_CALTIMING2_CFG_WR_TO_WR_MASK			0x00FC0000
+#define IO48_MMR_CALTIMING2_CFG_WR_TO_WR_SHIFT			18
+#define IO48_MMR_CALTIMING2_CFG_RD_TO_AP_VALID_MASK		0x0003F000
+#define IO48_MMR_CALTIMING2_CFG_RD_TO_AP_VALID_SHIFT		12
+#define IO48_MMR_CALTIMING2_CFG_RD_TO_PCH_MASK			0x00000FC0
+#define IO48_MMR_CALTIMING2_CFG_RD_TO_PCH_SHIFT			6
+#define IO48_MMR_CALTIMING2_CFG_RD_TO_WR_DIFF_BG_MASK		0x0000003F
+#define IO48_MMR_CALTIMING2_CFG_RD_TO_WR_DIFF_BG_SHIFT		0
+
+#define IO48_MMR_CALTIMING3_CFG_WR_TO_PCH_MASK			0x3F000000
+#define IO48_MMR_CALTIMING3_CFG_WR_TO_PCH_SHIFT			24
+#define IO48_MMR_CALTIMING3_CFG_WR_TO_RD_DIFF_BG_MASK		0x00FC0000
+#define IO48_MMR_CALTIMING3_CFG_WR_TO_RD_DIFF_BG_SHIFT		18
+#define IO48_MMR_CALTIMING3_CFG_WR_TO_RD_DIFF_CHIP_MASK		0x0003F000
+#define IO48_MMR_CALTIMING3_CFG_WR_TO_RD_DIFF_CHIP_SHIFT	12
+#define IO48_MMR_CALTIMING3_CFG_WR_TO_RD_MASK			0x00000FC0
+#define IO48_MMR_CALTIMING3_CFG_WR_TO_RD_SHIFT			6
+#define IO48_MMR_CALTIMING3_CFG_WR_TO_WR_DIFF_BG_MASK		0x0000003F
+#define IO48_MMR_CALTIMING3_CFG_WR_TO_WR_DIFF_BG_SHIFT		0
+
+#define IO48_MMR_CALTIMING4_CFG_PDN_TO_VALID_MASK		0xFC000000
+#define IO48_MMR_CALTIMING4_CFG_PDN_TO_VALID_SHIFT		26
+#define IO48_MMR_CALTIMING4_CFG_ARF_TO_VALID_MASK		0x03FC0000
+#define IO48_MMR_CALTIMING4_CFG_ARF_TO_VALID_SHIFT		18
+#define IO48_MMR_CALTIMING4_CFG_PCH_ALL_TO_VALID_MASK		0x0003F000
+#define IO48_MMR_CALTIMING4_CFG_PCH_ALL_TO_VALID_SHIFT		12
+#define IO48_MMR_CALTIMING4_CFG_PCH_TO_VALID_MASK		0x00000FC0
+#define IO48_MMR_CALTIMING4_CFG_PCH_TO_VALID_SHIFT		6
+#define IO48_MMR_CALTIMING4_CFG_WR_AP_TO_VALID_MASK		0x0000003F
+#define IO48_MMR_CALTIMING4_CFG_WR_AP_TO_VALID_SHIFT		0
+
+#define IO48_MMR_CALTIMING9_CFG_WR_4_ACT_TO_ACT_MASK		0x000000FF
+#define IO48_MMR_CALTIMING9_CFG_WR_4_ACT_TO_ACT_SHIFT		0
+
+#define IO48_MMR_DRAMADDRW_CFG_CS_ADDR_WIDTH_MASK		0x00070000
+#define IO48_MMR_DRAMADDRW_CFG_CS_ADDR_WIDTH_SHIFT		16
+#define IO48_MMR_DRAMADDRW_CFG_BANK_GROUP_ADDR_WIDTH_MASK	0x0000C000
+#define IO48_MMR_DRAMADDRW_CFG_BANK_GROUP_ADDR_WIDTH_SHIFT	14
+#define IO48_MMR_DRAMADDRW_CFG_BANK_ADDR_WIDTH_MASK		0x00003C00
+#define IO48_MMR_DRAMADDRW_CFG_BANK_ADDR_WIDTH_SHIFT		10
+#define IO48_MMR_DRAMADDRW_CFG_ROW_ADDR_WIDTH_MASK		0x000003E0
+#define IO48_MMR_DRAMADDRW_CFG_ROW_ADDR_WIDTH_SHIFT		5
+#define IO48_MMR_DRAMADDRW_CFG_COL_ADDR_WIDTH_MASK		0x0000001F
+#define IO48_MMR_DRAMADDRW_CFG_COL_ADDR_WIDTH_SHIFT		0
+
+#define ALT_ECC_HMC_OCP_DDRIOCTRL_IO_SIZE_MSK		0x00000003
+
+#define ALT_ECC_HMC_OCP_INTSTAT_SERRPENA_SET_MSK	BIT(0)
+#define ALT_ECC_HMC_OCP_INTSTAT_DERRPENA_SET_MSK	BIT(1)
+#define ALT_ECC_HMC_OCP_ERRINTEN_SERRINTEN_SET_MSK	BIT(0)
+#define ALT_ECC_HMC_OCP_ERRINTEN_DERRINTEN_SET_MSK	BIT(1)
+#define ALT_ECC_HMC_OCP_INTMOD_INTONCMP_SET_MSK		BIT(16)
+#define ALT_ECC_HMC_OCP_ECCCTL_AWB_CNT_RST_SET_MSK	BIT(16)
+#define ALT_ECC_HMC_OCP_ECCCTL_CNT_RST_SET_MSK		BIT(8)
+#define ALT_ECC_HMC_OCP_ECCCTL_ECC_EN_SET_MSK		BIT(0)
+#define ALT_ECC_HMC_OCP_ECCCTL2_RMW_EN_SET_MSK		BIT(8)
+#define ALT_ECC_HMC_OCP_ECCCTL2_AWB_EN_SET_MSK		BIT(0)
+
+#define ALT_ECC_HMC_OCP_SERRCNTREG_VALUE		8
+
+#define ALT_NOC_MPU_DDR_T_SCHED_DDRTIMING_ACTTOACT_LSB	0
+#define ALT_NOC_MPU_DDR_T_SCHED_DDRTIMING_RDTOMISS_LSB	6
+#define ALT_NOC_MPU_DDR_T_SCHED_DDRTIMING_WRTOMISS_LSB	12
+#define ALT_NOC_MPU_DDR_T_SCHED_DDRTIMING_BURSTLEN_LSB	18
+#define ALT_NOC_MPU_DDR_T_SCHED_DDRTIMING_RDTOWR_LSB	21
+#define ALT_NOC_MPU_DDR_T_SCHED_DDRTIMING_WRTORD_LSB	26
+#define ALT_NOC_MPU_DDR_T_SCHED_DDRTIMING_BWRATIO_LSB	31
+
+#define ALT_NOC_MPU_DDR_T_SCHED_DDRMOD_AUTOPRECHARGE_LSB	0
+#define ALT_NOC_MPU_DDR_T_SCHED_DDRMOD_BWRATIOEXTENDED_LSB	1
+
+#define ALT_NOC_MPU_DDR_T_SCHED_ACTIVATE_RRD_LSB	0
+#define ALT_NOC_MPU_DDR_T_SCHED_ACTIVATE_FAW_LSB	4
+#define ALT_NOC_MPU_DDR_T_SCHED_ACTIVATE_FAWBANK_LSB	10
+
+#define ALT_NOC_MPU_DDR_T_SCHED_DEVTODEV_BUSRDTORD_LSB	0
+#define ALT_NOC_MPU_DDR_T_SCHED_DEVTODEV_BUSRDTOWR_LSB	2
+#define ALT_NOC_MPU_DDR_T_SCHED_DEVTODEV_BUSWRTORD_LSB	4
+
+#define ALT_NOC_FW_DDR_END_ADDR_LSB	16
+#define ALT_NOC_FW_DDR_ADDR_MASK	0xFFFF
+#define ALT_NOC_FW_DDR_SCR_EN_HPSREG0EN_SET_MSK		BIT(0)
+#define ALT_NOC_FW_DDR_SCR_EN_HPSREG1EN_SET_MSK		BIT(1)
+#define ALT_NOC_FW_DDR_SCR_EN_HPSREG2EN_SET_MSK		BIT(2)
+#define ALT_NOC_FW_DDR_SCR_EN_HPSREG3EN_SET_MSK		BIT(3)
+#define ALT_NOC_FW_DDR_SCR_EN_HPSREG4EN_SET_MSK		BIT(4)
+#define ALT_NOC_FW_DDR_SCR_EN_HPSREG5EN_SET_MSK		BIT(5)
+#define ALT_NOC_FW_DDR_SCR_EN_HPSREG6EN_SET_MSK		BIT(6)
+#define ALT_NOC_FW_DDR_SCR_EN_HPSREG7EN_SET_MSK		BIT(7)
+#define ALT_NOC_FW_DDR_SCR_EN_MPUREG0EN_SET_MSK		BIT(0)
+#define ALT_NOC_FW_DDR_SCR_EN_MPUREG1EN_SET_MSK		BIT(1)
+#define ALT_NOC_FW_DDR_SCR_EN_MPUREG2EN_SET_MSK		BIT(2)
+#define ALT_NOC_FW_DDR_SCR_EN_MPUREG3EN_SET_MSK		BIT(3)
+#define ALT_NOC_FW_DDR_SCR_EN_F2SDR0REG0EN_SET_MSK	BIT(4)
+#define ALT_NOC_FW_DDR_SCR_EN_F2SDR0REG1EN_SET_MSK	BIT(5)
+#define ALT_NOC_FW_DDR_SCR_EN_F2SDR0REG2EN_SET_MSK	BIT(6)
+#define ALT_NOC_FW_DDR_SCR_EN_F2SDR0REG3EN_SET_MSK	BIT(7)
+#define ALT_NOC_FW_DDR_SCR_EN_F2SDR1REG0EN_SET_MSK	BIT(8)
+#define ALT_NOC_FW_DDR_SCR_EN_F2SDR1REG1EN_SET_MSK	BIT(9)
+#define ALT_NOC_FW_DDR_SCR_EN_F2SDR1REG2EN_SET_MSK	BIT(10)
+#define ALT_NOC_FW_DDR_SCR_EN_F2SDR1REG3EN_SET_MSK	BIT(11)
+#define ALT_NOC_FW_DDR_SCR_EN_F2SDR2REG0EN_SET_MSK	BIT(12)
+#define ALT_NOC_FW_DDR_SCR_EN_F2SDR2REG1EN_SET_MSK	BIT(13)
+#define ALT_NOC_FW_DDR_SCR_EN_F2SDR2REG2EN_SET_MSK	BIT(14)
+#define ALT_NOC_FW_DDR_SCR_EN_F2SDR2REG3EN_SET_MSK	BIT(15)
+
+#define ALT_IO48_DRAMTIME_MEM_READ_LATENCY_MASK		0x0000003F
+#endif /* _SOCFPGA_SDRAM_ARRIA10_H_ */
Signature · 1 line
1.8.2.3
#10 lore raw

PATCH v6 10/16 arm: socfpga: Add pinmux for Arria 10

In reply to Ley Foon Tan

Add pinmux support for Arria 10.

---
 arch/arm/mach-socfpga/Makefile              |  1 +
 arch/arm/mach-socfpga/include/mach/pinmux.h | 17 +++++
 arch/arm/mach-socfpga/pinmux_arria10.c      | 96 +++++++++++++++++++++++++++++
 3 files changed, 114 insertions(+)
 create mode 100644 arch/arm/mach-socfpga/include/mach/pinmux.h
 create mode 100644 arch/arm/mach-socfpga/pinmux_arria10.c
arch/arm/mach-socfpga/Makefile +1 -0
index c494930..503b79f 100644
@@ -11,6 +11,7 @@ obj-y	+= misc.o timer.o reset_manager.o clock_manager.o \
 	   fpga_manager.o board.o
 
 obj-$(CONFIG_TARGET_SOCFPGA_ARRIA10) += clock_manager_arria10.o \
+					pinmux_arria10.o	\
 					reset_manager_arria10.o
 
 obj-$(CONFIG_SPL_BUILD) += spl.o freeze_controller.o
arch/arm/mach-socfpga/include/mach/pinmux.h new file +17 -0
new file mode 100644
index 0000000..563a3db
@@ -0,0 +1,17 @@
+/*
+ * Copyright (C) 2016-2017 Intel Corporation <www.intel.com>
+ *
+ * SPDX-License-Identifier:	GPL-2.0
+ */
+
+#ifndef _PINMUX_H_
+#define _PINMUX_H_
+
+#define PINMUX_UART		0xD
+
+#ifndef __ASSEMBLY__
+int config_dedicated_pins(const void *blob);
+int config_pins(const void *blob, const char *pin_grp);
+#endif
+
+#endif /* _PINMUX_H_ */
arch/arm/mach-socfpga/pinmux_arria10.c new file +96 -0

96 lines not on this page · raw message

Signature · 1 line
1.8.2.3
#11 lore raw

PATCH v6 11/16 arm: socfpga: Add misc support for Arria 10

In reply to Ley Foon Tan

Add misc support for Arria 10.

---
 arch/arm/mach-socfpga/Makefile            |   1 +
 arch/arm/mach-socfpga/include/mach/misc.h |   6 +
 arch/arm/mach-socfpga/misc_arria10.c      | 259 ++++++++++++++++++++++++++++++
 3 files changed, 266 insertions(+)
 create mode 100644 arch/arm/mach-socfpga/misc_arria10.c
arch/arm/mach-socfpga/Makefile +1 -0
index 503b79f..4ce8eac 100644
@@ -12,6 +12,7 @@ obj-y	+= misc.o timer.o reset_manager.o clock_manager.o \
 
 obj-$(CONFIG_TARGET_SOCFPGA_ARRIA10) += clock_manager_arria10.o \
 					pinmux_arria10.o	\
+					misc_arria10.o		\
 					reset_manager_arria10.o
 
 obj-$(CONFIG_SPL_BUILD) += spl.o freeze_controller.o
arch/arm/mach-socfpga/include/mach/misc.h +6 -0
index f344749..0b65783 100644
@@ -22,4 +22,10 @@ void socfpga_fpga_add(void);
 static inline void socfpga_fpga_add(void) {}
 #endif
 
+#if defined(CONFIG_TARGET_SOCFPGA_ARRIA10)
+unsigned int dedicated_uart_com_port(const void *blob);
+unsigned int shared_uart_com_port(const void *blob);
+unsigned int uart_com_port(const void *blob);
+#endif
+
 #endif /* _MISC_H_ */
arch/arm/mach-socfpga/misc_arria10.c new file +259 -0

259 lines not on this page · raw message

Signature · 1 line
1.8.2.3
#12 lore raw

PATCH v6 12/16 arm: dts: Add dts and dtsi for Arria 10

In reply to Ley Foon Tan

Device tree files for Arria 10

---
 arch/arm/dts/Makefile                              |   1 +
 arch/arm/dts/socfpga_arria10.dtsi                  | 869 +++++++++++++++++++++
 arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts       |  38 +
 .../dts/socfpga_arria10_socdk_sdmmc_handoff.dtsi   | 481 ++++++++++++
 4 files changed, 1389 insertions(+)
 create mode 100644 arch/arm/dts/socfpga_arria10.dtsi
 create mode 100644 arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts
 create mode 100644 arch/arm/dts/socfpga_arria10_socdk_sdmmc_handoff.dtsi
arch/arm/dts/Makefile +1 -0
index 68d2791..cc31ae9 100644
@@ -147,6 +147,7 @@ dtb-$(CONFIG_AM43XX) += am437x-gp-evm.dtb am437x-sk-evm.dtb	\
 dtb-$(CONFIG_THUNDERX) += thunderx-88xx.dtb
 
 dtb-$(CONFIG_ARCH_SOCFPGA) +=				\
+	socfpga_arria10_socdk_sdmmc.dtb			\
 	socfpga_arria5_socdk.dtb			\
 	socfpga_cyclone5_is1.dtb			\
 	socfpga_cyclone5_mcvevk.dtb			\
arch/arm/dts/socfpga_arria10.dtsi new file +869 -0

869 lines not on this page · raw message

arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts new file +38 -0
new file mode 100644
index 0000000..b573d0e
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2015-2017 Altera Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope 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.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/dts-v1/;
+#include "socfpga_arria10_socdk_sdmmc_handoff.dtsi"
+
+/ {
+	chosen {
+		bootargs = "console=ttyS0,115200";
+	};
+};
+
+&uart1 {
+	u-boot,dm-pre-reloc;
+	status = "okay";
+};
+
+&mmc {
+	u-boot,dm-pre-reloc;
+	status = "okay";
+	num-slots = <1>;
+	cap-sd-highspeed;
+	broken-cd;
+	bus-width = <4>;
+};
arch/arm/dts/socfpga_arria10_socdk_sdmmc_handoff.dtsi new file +481 -0

481 lines not on this page · raw message

Signature · 1 line
1.8.2.3
#13 lore raw

PATCH v6 13/16 arm: socfpga: Add SPL support for Arria 10

In reply to Ley Foon Tan

Add SPL support for Arria 10.

---
 arch/arm/mach-socfpga/spl.c | 72 +++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 67 insertions(+), 5 deletions(-)
arch/arm/mach-socfpga/spl.c +67 -5
index 0064fc8..f4a3cdd 100644
@@ -19,23 +19,32 @@
 #include <asm/arch/sdram.h>
 #include <asm/arch/scu.h>
 #include <asm/arch/nic301.h>
+#include <asm/sections.h>
+#include <fdtdec.h>
+#include <watchdog.h>
+#if defined(CONFIG_TARGET_SOCFPGA_ARRIA10)
+#include <asm/arch/pinmux.h>
+#endif
 
 DECLARE_GLOBAL_DATA_PTR;
 
+#if defined(CONFIG_TARGET_SOCFPGA_GEN5)
 static struct pl310_regs *const pl310 =
 	(struct pl310_regs *)CONFIG_SYS_PL310_BASE;
 static struct scu_registers *scu_regs =
 	(struct scu_registers *)SOCFPGA_MPUSCU_ADDRESS;
 static struct nic301_registers *nic301_regs =
 	(struct nic301_registers *)SOCFPGA_L3REGS_ADDRESS;
-static struct socfpga_system_manager *sysmgr_regs =
+#endif
+
+static const struct socfpga_system_manager *sysmgr_regs =
 	(struct socfpga_system_manager *)SOCFPGA_SYSMGR_ADDRESS;
 
 u32 spl_boot_device(void)
 {
 	const u32 bsel = readl(&sysmgr_regs->bootinfo);
 
-	switch (bsel & 0x7) {
+	switch (SYSMGR_GET_BOOTINFO_BSEL(bsel)) {
 	case 0x1:	/* FPGA (HPS2FPGA Bridge) */
 		return BOOT_DEVICE_RAM;
 	case 0x2:	/* NAND Flash (1.8V) */
@@ -68,6 +77,7 @@ u32 spl_boot_mode(const u32 boot_device)
 }
 #endif
 
+#if defined(CONFIG_TARGET_SOCFPGA_GEN5)
 static void socfpga_nic301_slave_ns(void)
 {
 	writel(0x1, &nic301_regs->lwhps2fpgaregs);
@@ -85,6 +95,7 @@ void board_init_f(ulong dummy)
 #endif
 	unsigned long sdram_size;
 	unsigned long reg;
+	int ret;
 
 	/*
 	 * First C code to run. Clear fake OCRAM ECC first as SBE
@@ -117,7 +128,11 @@ void board_init_f(ulong dummy)
 	/* Put everything into reset but L4WD0. */
 	socfpga_per_reset_all();
 	/* Put FPGA bridges into reset too. */
-	socfpga_bridges_reset(1);
+	ret = socfpga_bridges_reset(1);
+	if (ret) {
+		printf("socfpga_bridges_reset() failed: %d\n", ret);
+		hang();
+	}
 
 	socfpga_per_reset(SOCFPGA_RESET(SDR), 0);
 	socfpga_per_reset(SOCFPGA_RESET(UART0), 0);
@@ -148,7 +163,11 @@ void board_init_f(ulong dummy)
 
 	/* De-assert reset for peripherals and bridges based on handoff */
 	reset_deassert_peripherals_handoff();
-	socfpga_bridges_reset(0);
+	ret = socfpga_bridges_reset(0);
+	if (ret) {
+		printf("socfpga_bridges_reset() failed: %d\n", ret);
+		hang();
+	}
 
 	debug("Unfreezing/Thaw all I/O banks\n");
 	/* unfreeze / thaw all IO banks */
@@ -178,8 +197,51 @@ void board_init_f(ulong dummy)
 		hang();
 	}
 
-	socfpga_bridges_reset(1);
+	ret = socfpga_bridges_reset(1);
+	if (ret) {
+		printf("socfpga_bridges_reset() failed: %d\n", ret);
+		hang();
+	}
 
 	/* Configure simple malloc base pointer into RAM. */
 	gd->malloc_base = CONFIG_SYS_TEXT_BASE + (1024 * 1024);
 }
+#elif defined(CONFIG_TARGET_SOCFPGA_ARRIA10)
+void spl_board_init(void)
+{
+	/* configuring the clock based on handoff */
+	cm_basic_init(gd->fdt_blob);
+	WATCHDOG_RESET();
+
+	config_dedicated_pins(gd->fdt_blob);
+	WATCHDOG_RESET();
+
+	/* Release UART from reset */
+	socfpga_reset_uart(0);
+
+	/* enable console uart printing */
+	preloader_console_init();
+}
+
+void board_init_f(ulong dummy)
+{
+	/*
+	 * Configure Clock Manager to use intosc clock instead external osc to
+	 * ensure success watchdog operation. We do it as early as possible.
+	 */
+	cm_use_intosc();
+
+	socfpga_watchdog_disable();
+
+	arch_early_init_r();
+
+#ifdef CONFIG_HW_WATCHDOG
+	/* release osc1 watchdog timer 0 from reset */
+	socfpga_reset_deassert_osc1wd0();
+
+	/* reconfigure and enable the watchdog */
+	hw_watchdog_init();
+	WATCHDOG_RESET();
+#endif /* CONFIG_HW_WATCHDOG */
+}
+#endif
Signature · 1 line
1.8.2.3
maintainer
#14 lore raw

PATCH v6 13/16 arm: socfpga: Add SPL support for Arria 10

Quoted 77 lines · Ley Foon Tan

Add SPL support for Arria 10.

---
 arch/arm/mach-socfpga/spl.c | 72 +++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 67 insertions(+), 5 deletions(-)
arch/arm/mach-socfpga/spl.c +18 -3
index 0064fc8..f4a3cdd 100644
@@ -19,23 +19,32 @@
 #include <asm/arch/sdram.h>
 #include <asm/arch/scu.h>
 #include <asm/arch/nic301.h>
+#include <asm/sections.h>
+#include <fdtdec.h>
+#include <watchdog.h>
+#if defined(CONFIG_TARGET_SOCFPGA_ARRIA10)
+#include <asm/arch/pinmux.h>
+#endif
 
 DECLARE_GLOBAL_DATA_PTR;
 
+#if defined(CONFIG_TARGET_SOCFPGA_GEN5)
 static struct pl310_regs *const pl310 =
 	(struct pl310_regs *)CONFIG_SYS_PL310_BASE;
 static struct scu_registers *scu_regs =
 	(struct scu_registers *)SOCFPGA_MPUSCU_ADDRESS;
 static struct nic301_registers *nic301_regs =
 	(struct nic301_registers *)SOCFPGA_L3REGS_ADDRESS;
-static struct socfpga_system_manager *sysmgr_regs =
+#endif
+
+static const struct socfpga_system_manager *sysmgr_regs =
 	(struct socfpga_system_manager *)SOCFPGA_SYSMGR_ADDRESS;
 
 u32 spl_boot_device(void)
 {
 	const u32 bsel = readl(&sysmgr_regs->bootinfo);
 
-	switch (bsel & 0x7) {
+	switch (SYSMGR_GET_BOOTINFO_BSEL(bsel)) {
 	case 0x1:	/* FPGA (HPS2FPGA Bridge) */
 		return BOOT_DEVICE_RAM;
 	case 0x2:	/* NAND Flash (1.8V) */
@@ -68,6 +77,7 @@ u32 spl_boot_mode(const u32 boot_device)
 }
 #endif
 
+#if defined(CONFIG_TARGET_SOCFPGA_GEN5)
 static void socfpga_nic301_slave_ns(void)
 {
 	writel(0x1, &nic301_regs->lwhps2fpgaregs);
@@ -85,6 +95,7 @@ void board_init_f(ulong dummy)
 #endif
 	unsigned long sdram_size;
 	unsigned long reg;
+	int ret;
 
 	/*
 	 * First C code to run. Clear fake OCRAM ECC first as SBE
@@ -117,7 +128,11 @@ void board_init_f(ulong dummy)
 	/* Put everything into reset but L4WD0. */
 	socfpga_per_reset_all();
 	/* Put FPGA bridges into reset too. */
-	socfpga_bridges_reset(1);
+	ret = socfpga_bridges_reset(1);
+	if (ret) {
+		printf("socfpga_bridges_reset() failed: %d\n", ret);
+		hang();
+	}
 
 	socfpga_per_reset(SOCFPGA_RESET(SDR), 0);
 	socfpga_per_reset(SOCFPGA_RESET(UART0), 0);

arch/arm/mach-socfpga/spl.c void board_init_f(ulong dummy) · line 169

Quoted 8 lines
arch/arm/mach-socfpga/spl.c +4 -1
@@ -148,7 +163,11 @@ void board_init_f(ulong dummy)
 
 	/* De-assert reset for peripherals and bridges based on handoff */
 	reset_deassert_peripherals_handoff();
-	socfpga_bridges_reset(0);
+	ret = socfpga_bridges_reset(0);
+	if (ret) {
+		printf("socfpga_bridges_reset() failed: %d\n", ret);
+		hang();

If you keep this patch the way it is, this will cause the Atlas board to hang here.

Dinh

maintainer
#15 lore raw

PATCH v6 13/16 arm: socfpga: Add SPL support for Arria 10

CC Dalon Westergreen
Quoted 81 lines · Dinh Nguyen
Quoted 78 lines · Ley Foon Tan

Add SPL support for Arria 10.

---
 arch/arm/mach-socfpga/spl.c | 72 +++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 67 insertions(+), 5 deletions(-)
arch/arm/mach-socfpga/spl.c +18 -3
index 0064fc8..f4a3cdd 100644
@@ -19,23 +19,32 @@
 #include <asm/arch/sdram.h>
 #include <asm/arch/scu.h>
 #include <asm/arch/nic301.h>
+#include <asm/sections.h>
+#include <fdtdec.h>
+#include <watchdog.h>
+#if defined(CONFIG_TARGET_SOCFPGA_ARRIA10)
+#include <asm/arch/pinmux.h>
+#endif
 
 DECLARE_GLOBAL_DATA_PTR;
 
+#if defined(CONFIG_TARGET_SOCFPGA_GEN5)
 static struct pl310_regs *const pl310 =
 	(struct pl310_regs *)CONFIG_SYS_PL310_BASE;
 static struct scu_registers *scu_regs =
 	(struct scu_registers *)SOCFPGA_MPUSCU_ADDRESS;
 static struct nic301_registers *nic301_regs =
 	(struct nic301_registers *)SOCFPGA_L3REGS_ADDRESS;
-static struct socfpga_system_manager *sysmgr_regs =
+#endif
+
+static const struct socfpga_system_manager *sysmgr_regs =
 	(struct socfpga_system_manager *)SOCFPGA_SYSMGR_ADDRESS;
 
 u32 spl_boot_device(void)
 {
 	const u32 bsel = readl(&sysmgr_regs->bootinfo);
 
-	switch (bsel & 0x7) {
+	switch (SYSMGR_GET_BOOTINFO_BSEL(bsel)) {
 	case 0x1:	/* FPGA (HPS2FPGA Bridge) */
 		return BOOT_DEVICE_RAM;
 	case 0x2:	/* NAND Flash (1.8V) */
@@ -68,6 +77,7 @@ u32 spl_boot_mode(const u32 boot_device)
 }
 #endif
 
+#if defined(CONFIG_TARGET_SOCFPGA_GEN5)
 static void socfpga_nic301_slave_ns(void)
 {
 	writel(0x1, &nic301_regs->lwhps2fpgaregs);
@@ -85,6 +95,7 @@ void board_init_f(ulong dummy)
 #endif
 	unsigned long sdram_size;
 	unsigned long reg;
+	int ret;
 
 	/*
 	 * First C code to run. Clear fake OCRAM ECC first as SBE
@@ -117,7 +128,11 @@ void board_init_f(ulong dummy)
 	/* Put everything into reset but L4WD0. */
 	socfpga_per_reset_all();
 	/* Put FPGA bridges into reset too. */
-	socfpga_bridges_reset(1);
+	ret = socfpga_bridges_reset(1);
+	if (ret) {
+		printf("socfpga_bridges_reset() failed: %d\n", ret);
+		hang();
+	}
 
 	socfpga_per_reset(SOCFPGA_RESET(SDR), 0);
 	socfpga_per_reset(SOCFPGA_RESET(UART0), 0);
@@ -148,7 +163,11 @@ void board_init_f(ulong dummy)
 
Quoted 11 lines

arch/arm/mach-socfpga/spl.c void board_init_f(ulong dummy) · line 169

Quoted 7 lines
arch/arm/mach-socfpga/spl.c +4 -1
 	/* De-assert reset for peripherals and bridges based on handoff */
 	reset_deassert_peripherals_handoff();
-	socfpga_bridges_reset(0);
+	ret = socfpga_bridges_reset(0);
+	if (ret) {
+		printf("socfpga_bridges_reset() failed: %d\n", ret);
+		hang();

If you keep this patch the way it is, this will cause the Atlas board to hang here.

Hi Dalon,

Can you check this patch? On the Atlas board, I'm seeing the call to socfpga_bridges_reset(0) fail because fpgamgr_test_fpga_ready() is failing, because is_fpgamgr_initdone_high() is returning 0.

Dinh

#16 lore raw

PATCH v6 13/16 arm: socfpga: Add SPL support for Arria 10

Really including Dalon

Quoted 107 lines · Dinh Nguyen
CC Dalon Westergreen
Quoted 81 lines · Dinh Nguyen
Quoted 78 lines · Ley Foon Tan

Add SPL support for Arria 10.

---
 arch/arm/mach-socfpga/spl.c | 72 +++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 67 insertions(+), 5 deletions(-)
arch/arm/mach-socfpga/spl.c +18 -3
index 0064fc8..f4a3cdd 100644
@@ -19,23 +19,32 @@
 #include <asm/arch/sdram.h>
 #include <asm/arch/scu.h>
 #include <asm/arch/nic301.h>
+#include <asm/sections.h>
+#include <fdtdec.h>
+#include <watchdog.h>
+#if defined(CONFIG_TARGET_SOCFPGA_ARRIA10)
+#include <asm/arch/pinmux.h>
+#endif
 
 DECLARE_GLOBAL_DATA_PTR;
 
+#if defined(CONFIG_TARGET_SOCFPGA_GEN5)
 static struct pl310_regs *const pl310 =
     (struct pl310_regs *)CONFIG_SYS_PL310_BASE;
 static struct scu_registers *scu_regs =
     (struct scu_registers *)SOCFPGA_MPUSCU_ADDRESS;
 static struct nic301_registers *nic301_regs =
     (struct nic301_registers *)SOCFPGA_L3REGS_ADDRESS;
-static struct socfpga_system_manager *sysmgr_regs =
+#endif
+
+static const struct socfpga_system_manager *sysmgr_regs =
     (struct socfpga_system_manager *)SOCFPGA_SYSMGR_ADDRESS;
 
 u32 spl_boot_device(void)
 {
     const u32 bsel = readl(&sysmgr_regs->bootinfo);
 
-    switch (bsel & 0x7) {
+    switch (SYSMGR_GET_BOOTINFO_BSEL(bsel)) {
     case 0x1:       /* FPGA (HPS2FPGA Bridge) */
             return BOOT_DEVICE_RAM;
     case 0x2:       /* NAND Flash (1.8V) */
@@ -68,6 +77,7 @@ u32 spl_boot_mode(const u32 boot_device)
 }
 #endif
 
+#if defined(CONFIG_TARGET_SOCFPGA_GEN5)
 static void socfpga_nic301_slave_ns(void)
 {
     writel(0x1, &nic301_regs->lwhps2fpgaregs);
@@ -85,6 +95,7 @@ void board_init_f(ulong dummy)
 #endif
     unsigned long sdram_size;
     unsigned long reg;
+    int ret;
 
     /*
      * First C code to run. Clear fake OCRAM ECC first as SBE
@@ -117,7 +128,11 @@ void board_init_f(ulong dummy)
     /* Put everything into reset but L4WD0. */
     socfpga_per_reset_all();
     /* Put FPGA bridges into reset too. */
-    socfpga_bridges_reset(1);
+    ret = socfpga_bridges_reset(1);
+    if (ret) {
+            printf("socfpga_bridges_reset() failed: %d\n", ret);
+            hang();
+    }
 
     socfpga_per_reset(SOCFPGA_RESET(SDR), 0);
     socfpga_per_reset(SOCFPGA_RESET(UART0), 0);
@@ -148,7 +163,11 @@ void board_init_f(ulong dummy)
 
Quoted 11 lines

arch/arm/mach-socfpga/spl.c void board_init_f(ulong dummy) · line 169

Quoted 7 lines
arch/arm/mach-socfpga/spl.c +4 -1
     /* De-assert reset for peripherals and bridges based on handoff */
     reset_deassert_peripherals_handoff();
-    socfpga_bridges_reset(0);
+    ret = socfpga_bridges_reset(0);
+    if (ret) {
+            printf("socfpga_bridges_reset() failed: %d\n", ret);
+            hang();

If you keep this patch the way it is, this will cause the Atlas board to hang here.

Hi Dalon,

Can you check this patch? On the Atlas board, I'm seeing the call to socfpga_bridges_reset(0) fail because fpgamgr_test_fpga_ready() is failing, because is_fpgamgr_initdone_high() is returning 0.

Dinh
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

#17 lore raw

PATCH v6 13/16 arm: socfpga: Add SPL support for Arria 10

Quoted 15 lines · Dinh Nguyen

Really including Dalon

Quoted 13 lines · Dinh Nguyen
CC Dalon Westergreen
Quoted 9 lines · Dinh Nguyen
Quoted 6 lines · Ley Foon Tan

Add SPL support for Arria 10.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

---

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

 arch/arm/mach-socfpga/spl.c | 72

+++++++++++++++++++++++++++++++++++++++++----

Quoted 84 lines
Quoted 84 lines
Quoted 83 lines
Quoted 71 lines
 1 file changed, 67 insertions(+), 5 deletions(-)
arch/arm/mach-socfpga/spl.c +7 -0
index 0064fc8..f4a3cdd 100644
@@ -19,23 +19,32 @@
  #include <asm/arch/sdram.h>
  #include <asm/arch/scu.h>
  #include <asm/arch/nic301.h>
+#include <asm/sections.h>
+#include <fdtdec.h>
+#include <watchdog.h>
+#if defined(CONFIG_TARGET_SOCFPGA_ARRIA10)
+#include <asm/arch/pinmux.h>
+#endif
 
  DECLARE_GLOBAL_DATA_PTR;
 
+#if defined(CONFIG_TARGET_SOCFPGA_GEN5)

 static struct pl310_regs *const pl310 = (struct pl310_regs *)CONFIG_SYS_PL310_BASE; static struct scu_registers *scu_regs = (struct scu_registers *)SOCFPGA_MPUSCU_ADDRESS; static struct nic301_registers *nic301_regs = (struct nic301_registers *)SOCFPGA_L3REGS_ADDRESS;

arch/arm/mach-socfpga/spl.c +3 -1
-static struct socfpga_system_manager *sysmgr_regs =
+#endif
+
+static const struct socfpga_system_manager *sysmgr_regs =

     (struct socfpga_system_manager *)SOCFPGA_SYSMGR_ADDRESS;

 u32 spl_boot_device(void)
 {
     const u32 bsel = readl(&sysmgr_regs->bootinfo);

-    switch (bsel & 0x7) {
+    switch (SYSMGR_GET_BOOTINFO_BSEL(bsel)) {
     case 0x1:       /* FPGA (HPS2FPGA Bridge) */
             return BOOT_DEVICE_RAM;
     case 0x2:       /* NAND Flash (1.8V) */

arch/arm/mach-socfpga/spl.c +7 -1
@@ -68,6 +77,7 @@ u32 spl_boot_mode(const u32 boot_device)
  }
  #endif
 
+#if defined(CONFIG_TARGET_SOCFPGA_GEN5)
  static void socfpga_nic301_slave_ns(void)
  {
      writel(0x1, &nic301_regs->lwhps2fpgaregs);
@@ -85,6 +95,7 @@ void board_init_f(ulong dummy)
  #endif
      unsigned long sdram_size;
      unsigned long reg;
+    int ret;
 
      /*
       * First C code to run. Clear fake OCRAM ECC first as SBE
@@ -117,7 +128,11 @@ void board_init_f(ulong dummy)
      /* Put everything into reset but L4WD0. */
      socfpga_per_reset_all();
      /* Put FPGA bridges into reset too. */
-    socfpga_bridges_reset(1);
+    ret = socfpga_bridges_reset(1);
+    if (ret) {
+            printf("socfpga_bridges_reset() failed: %d\n", ret);
+            hang();
+    }
 
      socfpga_per_reset(SOCFPGA_RESET(SDR), 0);
      socfpga_per_reset(SOCFPGA_RESET(UART0), 0);

arch/arm/mach-socfpga/spl.c void board_init_f(ulong dummy) · line 169

Quoted 8 lines
arch/arm/mach-socfpga/spl.c +4 -1
@@ -148,7 +163,11 @@ void board_init_f(ulong dummy)
 
      /* De-assert reset for peripherals and bridges based on handoff */
      reset_deassert_peripherals_handoff();
-    socfpga_bridges_reset(0);
+    ret = socfpga_bridges_reset(0);
+    if (ret) {
+            printf("socfpga_bridges_reset() failed: %d\n", ret);
+            hang();

If you keep this patch the way it is, this will cause the Atlas board to hang here.

Quoted 7 lines
Quoted 7 lines

Hi Dalon,

Can you check this patch? On the Atlas board, I'm seeing the call to socfpga_bridges_reset(0) fail because fpgamgr_test_fpga_ready() is failing, because is_fpgamgr_initdone_high() is returning 0.

Dinh

i saw it the first go round.  i will test this out this afternoon.

--dalon

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

_______________________________________________

U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

#18 lore raw

PATCH v6 13/16 arm: socfpga: Add SPL support for Arria 10

Quoted 124 lines · Dalon Westergreen
Quoted 27 lines · Dinh Nguyen

Really including Dalon

Quoted 24 lines · Dinh Nguyen
CC Dalon Westergreen
Quoted 19 lines · Dinh Nguyen
Quoted 15 lines · Ley Foon Tan

Add SPL support for Arria 10.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

---

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

 arch/arm/mach-socfpga/spl.c | 72

+++++++++++++++++++++++++++++++++++++++++----

Quoted 95 lines
Quoted 95 lines
Quoted 76 lines
Quoted 76 lines



 1 file changed, 67 insertions(+), 5 deletions(-)
arch/arm/mach-socfpga/spl.c +7 -0
index 0064fc8..f4a3cdd 100644
@@ -19,23 +19,32 @@
  #include <asm/arch/sdram.h>
  #include <asm/arch/scu.h>
  #include <asm/arch/nic301.h>
+#include <asm/sections.h>
+#include <fdtdec.h>
+#include <watchdog.h>
+#if defined(CONFIG_TARGET_SOCFPGA_ARRIA10)
+#include <asm/arch/pinmux.h>
+#endif
 
  DECLARE_GLOBAL_DATA_PTR;
 
+#if defined(CONFIG_TARGET_SOCFPGA_GEN5)

 static struct pl310_regs *const pl310 = (struct pl310_regs *)CONFIG_SYS_PL310_BASE; static struct scu_registers *scu_regs = (struct scu_registers *)SOCFPGA_MPUSCU_ADDRESS; static struct nic301_registers *nic301_regs = (struct nic301_registers *)SOCFPGA_L3REGS_ADDRESS;

arch/arm/mach-socfpga/spl.c +3 -1
-static struct socfpga_system_manager *sysmgr_regs =
+#endif
+
+static const struct socfpga_system_manager *sysmgr_regs =

     (struct socfpga_system_manager *)SOCFPGA_SYSMGR_ADDRESS;

 u32 spl_boot_device(void)
 {
     const u32 bsel = readl(&sysmgr_regs->bootinfo);

-    switch (bsel & 0x7) {
+    switch (SYSMGR_GET_BOOTINFO_BSEL(bsel)) {
     case 0x1:       /* FPGA (HPS2FPGA Bridge) */
             return BOOT_DEVICE_RAM;
     case 0x2:       /* NAND Flash (1.8V) */

arch/arm/mach-socfpga/spl.c +7 -1
@@ -68,6 +77,7 @@ u32 spl_boot_mode(const u32 boot_device)
  }
  #endif
 
+#if defined(CONFIG_TARGET_SOCFPGA_GEN5)
  static void socfpga_nic301_slave_ns(void)
  {
      writel(0x1, &nic301_regs->lwhps2fpgaregs);
@@ -85,6 +95,7 @@ void board_init_f(ulong dummy)
  #endif
      unsigned long sdram_size;
      unsigned long reg;
+    int ret;
 
      /*
       * First C code to run. Clear fake OCRAM ECC first as SBE
@@ -117,7 +128,11 @@ void board_init_f(ulong dummy)
      /* Put everything into reset but L4WD0. */
      socfpga_per_reset_all();
      /* Put FPGA bridges into reset too. */
-    socfpga_bridges_reset(1);
+    ret = socfpga_bridges_reset(1);
+    if (ret) {
+            printf("socfpga_bridges_reset() failed: %d\n", ret);
+            hang();
+    }
 
      socfpga_per_reset(SOCFPGA_RESET(SDR), 0);
      socfpga_per_reset(SOCFPGA_RESET(UART0), 0);
@@ -148,7 +163,11 @@ void board_init_f(ulong dummy)
 
Quoted 12 lines

arch/arm/mach-socfpga/spl.c void board_init_f(ulong dummy) · line 169

Quoted 8 lines
arch/arm/mach-socfpga/spl.c +4 -1
      /* De-assert reset for peripherals and bridges based on handoff
 */
      reset_deassert_peripherals_handoff();
-    socfpga_bridges_reset(0);
+    ret = socfpga_bridges_reset(0);
+    if (ret) {
+            printf("socfpga_bridges_reset() failed: %d\n", ret);
+            hang();

If you keep this patch the way it is, this will cause the Atlas board to hang here.

Hi Dalon,

Can you check this patch? On the Atlas board, I'm seeing the call to socfpga_bridges_reset(0) fail because fpgamgr_test_fpga_ready() is failing, because is_fpgamgr_initdone_high() is returning 0.

Quoted 5 lines
Quoted 1 line
Quoted 1 line

Dinh

i saw it the first go round.  i will test this out this afternoon.

--dalon

i see the exact same thing.  for the c5/a5 devices there is no reason for init done to be high since fpga configuration isnt required to boot.

--dalon

Quoted 23 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

_______________________________________________

U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

#19 lore raw

PATCH v6 13/16 arm: socfpga: Add SPL support for Arria 10

Quoted 125 lines · Dalon Westergreen
Quoted 124 lines · Dalon Westergreen
Quoted 27 lines · Dinh Nguyen

Really including Dalon

Quoted 24 lines · Dinh Nguyen
CC Dalon Westergreen
Quoted 19 lines · Dinh Nguyen
Quoted 15 lines · Ley Foon Tan

Add SPL support for Arria 10.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

---

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines



 arch/arm/mach-socfpga/spl.c | 72

+++++++++++++++++++++++++++++++++++++++++----

Quoted 95 lines
Quoted 95 lines
Quoted 76 lines
Quoted 76 lines



 1 file changed, 67 insertions(+), 5 deletions(-)
arch/arm/mach-socfpga/spl.c +18 -3
index 0064fc8..f4a3cdd 100644
@@ -19,23 +19,32 @@
 #include <asm/arch/sdram.h>
 #include <asm/arch/scu.h>
 #include <asm/arch/nic301.h>
+#include <asm/sections.h>
+#include <fdtdec.h>
+#include <watchdog.h>
+#if defined(CONFIG_TARGET_SOCFPGA_ARRIA10)
+#include <asm/arch/pinmux.h>
+#endif
 
 DECLARE_GLOBAL_DATA_PTR;
 
+#if defined(CONFIG_TARGET_SOCFPGA_GEN5)
 static struct pl310_regs *const pl310 =
     (struct pl310_regs *)CONFIG_SYS_PL310_BASE;
 static struct scu_registers *scu_regs =
     (struct scu_registers *)SOCFPGA_MPUSCU_ADDRESS;
 static struct nic301_registers *nic301_regs =
     (struct nic301_registers *)SOCFPGA_L3REGS_ADDRESS;
-static struct socfpga_system_manager *sysmgr_regs =
+#endif
+
+static const struct socfpga_system_manager *sysmgr_regs =
     (struct socfpga_system_manager *)SOCFPGA_SYSMGR_ADDRESS;
 
 u32 spl_boot_device(void)
 {
     const u32 bsel = readl(&sysmgr_regs->bootinfo);
 
-    switch (bsel & 0x7) {
+    switch (SYSMGR_GET_BOOTINFO_BSEL(bsel)) {
     case 0x1:       /* FPGA (HPS2FPGA Bridge) */
             return BOOT_DEVICE_RAM;
     case 0x2:       /* NAND Flash (1.8V) */
@@ -68,6 +77,7 @@ u32 spl_boot_mode(const u32 boot_device)
 }
 #endif
 
+#if defined(CONFIG_TARGET_SOCFPGA_GEN5)
 static void socfpga_nic301_slave_ns(void)
 {
     writel(0x1, &nic301_regs->lwhps2fpgaregs);
@@ -85,6 +95,7 @@ void board_init_f(ulong dummy)
 #endif
     unsigned long sdram_size;
     unsigned long reg;
+    int ret;
 
     /*
      * First C code to run. Clear fake OCRAM ECC first as SBE
@@ -117,7 +128,11 @@ void board_init_f(ulong dummy)
     /* Put everything into reset but L4WD0. */
     socfpga_per_reset_all();
     /* Put FPGA bridges into reset too. */
-    socfpga_bridges_reset(1);
+    ret = socfpga_bridges_reset(1);
+    if (ret) {
+            printf("socfpga_bridges_reset() failed: %d\n", ret);
+            hang();
+    }
 
     socfpga_per_reset(SOCFPGA_RESET(SDR), 0);
     socfpga_per_reset(SOCFPGA_RESET(UART0), 0);
@@ -148,7 +163,11 @@ void board_init_f(ulong dummy)
 
Quoted 12 lines

arch/arm/mach-socfpga/spl.c void board_init_f(ulong dummy) · line 169

Quoted 8 lines
arch/arm/mach-socfpga/spl.c +4 -1
     /* De-assert reset for peripherals and bridges based on handoff
 */
     reset_deassert_peripherals_handoff();
-    socfpga_bridges_reset(0);
+    ret = socfpga_bridges_reset(0);
+    if (ret) {
+            printf("socfpga_bridges_reset() failed: %d\n", ret);
+            hang();

If you keep this patch the way it is, this will cause the Atlas board to hang here.

Hi Dalon,

Can you check this patch? On the Atlas board, I'm seeing the call to socfpga_bridges_reset(0) fail because fpgamgr_test_fpga_ready() is failing, because is_fpgamgr_initdone_high() is returning 0.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line
Quoted 1 line

Dinh

i saw it the first go round. i will test this out this afternoon.

--dalon

i see the exact same thing. for the c5/a5 devices there is no reason for init done to be high since fpga configuration isnt required to boot.

Okay, good! It doesn't happen on the C5 devkit though.

Ley Foon, did you test this on the Arria5?

Dinh

#20 lore raw

PATCH v6 13/16 arm: socfpga: Add SPL support for Arria 10

Quoted 159 lines · Dinh Nguyen
Quoted 149 lines · Dalon Westergreen
Quoted 147 lines · Dalon Westergreen
Quoted 40 lines · Dinh Nguyen

Really including Dalon

Quoted 36 lines

On Wed, Apr 19, 2017 at 3:26 PM, Dinh Nguyen <[email protected]> wrote:
CC: Dalon Westergreen

Quoted 29 lines · Dinh Nguyen
Quoted 24 lines · Ley Foon Tan

Add SPL support for Arria 10.

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

---

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

 arch/arm/mach-socfpga/spl.c | 72

+++++++++++++++++++++++++++++++++++++++++----

Quoted 103 lines
Quoted 103 lines
Quoted 81 lines
Quoted 81 lines







 1 file changed, 67 insertions(+), 5 deletions(-)
arch/arm/mach- renamed from arch/arm/mach-socfpga/spl.c +0 -0

socfpga/spl.c
index 0064fc8..f4a3cdd 100644

arch/arm/mach-socfpga/spl.c +7 -0
@@ -19,23 +19,32 @@
  #include <asm/arch/sdram.h>
  #include <asm/arch/scu.h>
  #include <asm/arch/nic301.h>
+#include <asm/sections.h>
+#include <fdtdec.h>
+#include <watchdog.h>
+#if defined(CONFIG_TARGET_SOCFPGA_ARRIA10)
+#include <asm/arch/pinmux.h>
+#endif
 
  DECLARE_GLOBAL_DATA_PTR;
 
+#if defined(CONFIG_TARGET_SOCFPGA_GEN5)

 static struct pl310_regs *const pl310 = (struct pl310_regs *)CONFIG_SYS_PL310_BASE; static struct scu_registers *scu_regs = (struct scu_registers *)SOCFPGA_MPUSCU_ADDRESS; static struct nic301_registers *nic301_regs = (struct nic301_registers *)SOCFPGA_L3REGS_ADDRESS;

arch/arm/mach-socfpga/spl.c +3 -1
-static struct socfpga_system_manager *sysmgr_regs =
+#endif
+
+static const struct socfpga_system_manager *sysmgr_regs =

     (struct socfpga_system_manager *)SOCFPGA_SYSMGR_ADDRESS;

 u32 spl_boot_device(void)
 {
     const u32 bsel = readl(&sysmgr_regs->bootinfo);

-    switch (bsel & 0x7) {
+    switch (SYSMGR_GET_BOOTINFO_BSEL(bsel)) {
     case 0x1:       /* FPGA (HPS2FPGA Bridge) */
             return BOOT_DEVICE_RAM;
     case 0x2:       /* NAND Flash (1.8V) */

arch/arm/mach-socfpga/spl.c +7 -1
@@ -68,6 +77,7 @@ u32 spl_boot_mode(const u32 boot_device)
  }
  #endif
 
+#if defined(CONFIG_TARGET_SOCFPGA_GEN5)
  static void socfpga_nic301_slave_ns(void)
  {
      writel(0x1, &nic301_regs->lwhps2fpgaregs);
@@ -85,6 +95,7 @@ void board_init_f(ulong dummy)
  #endif
      unsigned long sdram_size;
      unsigned long reg;
+    int ret;
 
      /*
       * First C code to run. Clear fake OCRAM ECC first as SBE
@@ -117,7 +128,11 @@ void board_init_f(ulong dummy)
      /* Put everything into reset but L4WD0. */
      socfpga_per_reset_all();
      /* Put FPGA bridges into reset too. */
-    socfpga_bridges_reset(1);
+    ret = socfpga_bridges_reset(1);
+    if (ret) {
+            printf("socfpga_bridges_reset() failed: %d\n", ret);
+            hang();
+    }
 
      socfpga_per_reset(SOCFPGA_RESET(SDR), 0);
      socfpga_per_reset(SOCFPGA_RESET(UART0), 0);
@@ -148,7 +163,11 @@ void board_init_f(ulong dummy)
 
Quoted 14 lines
Quoted 9 lines
arch/arm/mach-socfpga/spl.c +0 -0
      /* De-assert reset for peripherals and bridges based on

handoff
*/
     reset_deassert_peripherals_handoff();
-    socfpga_bridges_reset(0);
+    ret = socfpga_bridges_reset(0);
+    if (ret) {
+            printf("socfpga_bridges_reset() failed: %d\n", ret); +            hang();

If you keep this patch the way it is, this will cause the Atlas board to
hang here.

Hi Dalon,

Can you check this patch? On the Atlas board, I'm seeing the call to socfpga_bridges_reset(0) fail because fpgamgr_test_fpga_ready() is failing, because is_fpgamgr_initdone_high() is returning 0.

Dinh

Quoted 7 lines
Quoted 3 lines

i saw it the first go round.  i will test this out this afternoon.

--dalon

i see the exact same thing.  for the c5/a5 devices there is no reason for init
done to be high since fpga configuration isnt required to boot.

Quoted 5 lines

Okay, good! It doesn't happen on the C5 devkit though.

Ley Foon, did you test this on the Arria5?

Dinh

Odd, init done should not be high without the FPGA configured.  i will try it on the c5 board as well to try and figure out why init done is high.

--dalon

#21 lore raw

PATCH v6 13/16 arm: socfpga: Add SPL support for Arria 10

Quoted 185 lines · Dalon Westergreen
Quoted 184 lines · Dinh Nguyen
Quoted 169 lines · Dalon Westergreen
Quoted 166 lines · Dalon Westergreen
Quoted 52 lines · Dinh Nguyen

Really including Dalon

Quoted 47 lines

On Wed, Apr 19, 2017 at 3:26 PM, Dinh Nguyen <[email protected]> wrote:
CC: Dalon Westergreen

Quoted 39 lines · Dinh Nguyen
Quoted 33 lines · Ley Foon Tan

Add SPL support for Arria 10.

Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

---

Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines

 arch/arm/mach-socfpga/spl.c | 72

+++++++++++++++++++++++++++++++++++++++++----

Quoted 109 lines
Quoted 109 lines
Quoted 86 lines
Quoted 86 lines











 1 file changed, 67 insertions(+), 5 deletions(-)
arch/arm/mach- renamed from arch/arm/mach-socfpga/spl.c +0 -0

socfpga/spl.c
index 0064fc8..f4a3cdd 100644

arch/arm/mach-socfpga/spl.c +7 -0
@@ -19,23 +19,32 @@
  #include <asm/arch/sdram.h>
  #include <asm/arch/scu.h>
  #include <asm/arch/nic301.h>
+#include <asm/sections.h>
+#include <fdtdec.h>
+#include <watchdog.h>
+#if defined(CONFIG_TARGET_SOCFPGA_ARRIA10)
+#include <asm/arch/pinmux.h>
+#endif
 
  DECLARE_GLOBAL_DATA_PTR;
 
+#if defined(CONFIG_TARGET_SOCFPGA_GEN5)

 static struct pl310_regs *const pl310 = (struct pl310_regs *)CONFIG_SYS_PL310_BASE; static struct scu_registers *scu_regs = (struct scu_registers *)SOCFPGA_MPUSCU_ADDRESS; static struct nic301_registers *nic301_regs = (struct nic301_registers *)SOCFPGA_L3REGS_ADDRESS;

arch/arm/mach-socfpga/spl.c +3 -1
-static struct socfpga_system_manager *sysmgr_regs =
+#endif
+
+static const struct socfpga_system_manager *sysmgr_regs =

     (struct socfpga_system_manager *)SOCFPGA_SYSMGR_ADDRESS;

 u32 spl_boot_device(void)
 {
     const u32 bsel = readl(&sysmgr_regs->bootinfo);

-    switch (bsel & 0x7) {
+    switch (SYSMGR_GET_BOOTINFO_BSEL(bsel)) {
     case 0x1:       /* FPGA (HPS2FPGA Bridge) */
             return BOOT_DEVICE_RAM;
     case 0x2:       /* NAND Flash (1.8V) */

arch/arm/mach-socfpga/spl.c +7 -1
@@ -68,6 +77,7 @@ u32 spl_boot_mode(const u32 boot_device)
  }
  #endif
 
+#if defined(CONFIG_TARGET_SOCFPGA_GEN5)
  static void socfpga_nic301_slave_ns(void)
  {
      writel(0x1, &nic301_regs->lwhps2fpgaregs);
@@ -85,6 +95,7 @@ void board_init_f(ulong dummy)
  #endif
      unsigned long sdram_size;
      unsigned long reg;
+    int ret;
 
      /*
       * First C code to run. Clear fake OCRAM ECC first as SBE
@@ -117,7 +128,11 @@ void board_init_f(ulong dummy)
      /* Put everything into reset but L4WD0. */
      socfpga_per_reset_all();
      /* Put FPGA bridges into reset too. */
-    socfpga_bridges_reset(1);
+    ret = socfpga_bridges_reset(1);
+    if (ret) {
+            printf("socfpga_bridges_reset() failed: %d\n",
 ret);
+            hang();
+    }
 
      socfpga_per_reset(SOCFPGA_RESET(SDR), 0);

     socfpga_per_reset(SOCFPGA_RESET(UART0), 0);

arch/arm/mach-socfpga/spl.c +0 -0
@@ -148,7 +163,11 @@ void board_init_f(ulong dummy)
 
Quoted 15 lines
Quoted 10 lines
arch/arm/mach-socfpga/spl.c +0 -0
      /* De-assert reset for peripherals and bridges based on

handoff
*/
     reset_deassert_peripherals_handoff();
-    socfpga_bridges_reset(0);
+    ret = socfpga_bridges_reset(0);
+    if (ret) {
+            printf("socfpga_bridges_reset() failed: %d\n", ret);
+            hang();

If you keep this patch the way it is, this will cause the Atlas board to
hang here.

Hi Dalon,

Can you check this patch? On the Atlas board, I'm seeing the call to socfpga_bridges_reset(0) fail because fpgamgr_test_fpga_ready() is failing, because is_fpgamgr_initdone_high() is returning 0.

Dinh

Quoted 7 lines
Quoted 3 lines

i saw it the first go round.  i will test this out this afternoon.

--dalon

i see the exact same thing.  for the c5/a5 devices there is no reason for init
done to be high since fpga configuration isnt required to boot.

Okay, good! It doesn't happen on the C5 devkit though.

Ley Foon, did you test this on the Arria5?

Quoted 7 lines
Quoted 1 line

Dinh

Odd, init done should not be high without the FPGA configured.  i will try it on
the c5 board as well to try and figure out why init done is high.

--dalon

I ran this on the c5 socdk and noticed the same behavior as Dinh, then realized the board was setup to configure the fpga independently of the processor.  When i change the MSELs on the board to ensure the FPGA is unconfigured the code fails in the same location where init done is not high.  It is definitely an expected use case in c5/a5 that uboot can run without the fpga configured at all.

--dalon

Quoted 4 lines

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

#22 lore raw

PATCH v6 13/16 arm: socfpga: Add SPL support for Arria 10

Quoted 192 lines · Dalon Westergreen
Quoted 191 lines · Dalon Westergreen
Quoted 180 lines · Dinh Nguyen
Quoted 169 lines · Dalon Westergreen
Quoted 166 lines · Dalon Westergreen
Quoted 52 lines · Dinh Nguyen

Really including Dalon

Quoted 47 lines

On Wed, Apr 19, 2017 at 3:26 PM, Dinh Nguyen <[email protected]> wrote:
CC: Dalon Westergreen

Quoted 39 lines · Dinh Nguyen
Quoted 33 lines · Ley Foon Tan

Add SPL support for Arria 10.

Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Signed-off-by: Tien Fong Chee <[email protected]>
Signed-off-by: Ley Foon Tan <[email protected]>

---

Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines

arch/arm/mach-socfpga/spl.c | 72

+++++++++++++++++++++++++++++++++++++++++----

Quoted 109 lines
Quoted 109 lines
Quoted 86 lines
Quoted 86 lines











 1 file changed, 67 insertions(+), 5 deletions(-)
arch/arm/mach- renamed from arch/arm/mach-socfpga/spl.c +0 -0

socfpga/spl.c
index 0064fc8..f4a3cdd 100644

arch/arm/mach-socfpga/spl.c +18 -3
@@ -19,23 +19,32 @@
 #include <asm/arch/sdram.h>
 #include <asm/arch/scu.h>
 #include <asm/arch/nic301.h>
+#include <asm/sections.h>
+#include <fdtdec.h>
+#include <watchdog.h>
+#if defined(CONFIG_TARGET_SOCFPGA_ARRIA10)
+#include <asm/arch/pinmux.h>
+#endif
 
 DECLARE_GLOBAL_DATA_PTR;
 
+#if defined(CONFIG_TARGET_SOCFPGA_GEN5)
 static struct pl310_regs *const pl310 =
     (struct pl310_regs *)CONFIG_SYS_PL310_BASE;
 static struct scu_registers *scu_regs =
     (struct scu_registers *)SOCFPGA_MPUSCU_ADDRESS;
 static struct nic301_registers *nic301_regs =
     (struct nic301_registers *)SOCFPGA_L3REGS_ADDRESS;
-static struct socfpga_system_manager *sysmgr_regs =
+#endif
+
+static const struct socfpga_system_manager *sysmgr_regs =
     (struct socfpga_system_manager *)SOCFPGA_SYSMGR_ADDRESS;
 
 u32 spl_boot_device(void)
 {
     const u32 bsel = readl(&sysmgr_regs->bootinfo);
 
-    switch (bsel & 0x7) {
+    switch (SYSMGR_GET_BOOTINFO_BSEL(bsel)) {
     case 0x1:       /* FPGA (HPS2FPGA Bridge) */
             return BOOT_DEVICE_RAM;
     case 0x2:       /* NAND Flash (1.8V) */
@@ -68,6 +77,7 @@ u32 spl_boot_mode(const u32 boot_device)
 }
 #endif
 
+#if defined(CONFIG_TARGET_SOCFPGA_GEN5)
 static void socfpga_nic301_slave_ns(void)
 {
     writel(0x1, &nic301_regs->lwhps2fpgaregs);
@@ -85,6 +95,7 @@ void board_init_f(ulong dummy)
 #endif
     unsigned long sdram_size;
     unsigned long reg;
+    int ret;
 
     /*
      * First C code to run. Clear fake OCRAM ECC first as SBE
@@ -117,7 +128,11 @@ void board_init_f(ulong dummy)
     /* Put everything into reset but L4WD0. */
     socfpga_per_reset_all();
     /* Put FPGA bridges into reset too. */
-    socfpga_bridges_reset(1);
+    ret = socfpga_bridges_reset(1);
+    if (ret) {
+            printf("socfpga_bridges_reset() failed: %d\n",
 ret);
+            hang();
+    }
 
     socfpga_per_reset(SOCFPGA_RESET(SDR), 0);
     socfpga_per_reset(SOCFPGA_RESET(UART0), 0);
arch/arm/mach-socfpga/spl.c +0 -0
@@ -148,7 +163,11 @@ void board_init_f(ulong dummy)
 
Quoted 15 lines
Quoted 10 lines
arch/arm/mach-socfpga/spl.c +0 -0
     /* De-assert reset for peripherals and bridges based on

handoff
*/

     reset_deassert_peripherals_handoff();
arch/arm/mach-socfpga/spl.c +3 -1
-    socfpga_bridges_reset(0);
+    ret = socfpga_bridges_reset(0);
+    if (ret) {
+            printf("socfpga_bridges_reset() failed: %d\n",

ret);
+ hang();

If you keep this patch the way it is, this will cause the Atlas board to
hang here.

Hi Dalon,

Can you check this patch? On the Atlas board, I'm seeing the call to socfpga_bridges_reset(0) fail because fpgamgr_test_fpga_ready() is failing, because is_fpgamgr_initdone_high() is returning 0.

Dinh

Quoted 7 lines
Quoted 3 lines

i saw it the first go round. i will test this out this afternoon.

--dalon

i see the exact same thing. for the c5/a5 devices there is no reason for init
done to be high since fpga configuration isnt required to boot.

Quoted 5 lines

Okay, good! It doesn't happen on the C5 devkit though.

Ley Foon, did you test this on the Arria5?

Dinh

Odd, init done should not be high without the FPGA configured. i will try it on
the c5 board as well to try and figure out why init done is high.

Quoted 8 lines
Quoted 1 line

--dalon

I ran this on the c5 socdk and noticed the same behavior as Dinh, then realized the board was setup to configure the fpga independently of the processor. When i change the MSELs on the board to ensure the FPGA is unconfigured the code fails in the same location where init done is not high. It is definitely an expected use case in c5/a5 that uboot can run without the fpga configured at all.

My proposal is revert back to its original code, revert socfpga_bridges_reset() return type to void and don't check error from fpgamgr_test_fpga_ready(). So, we can support Gen5 boot without program FPGA.
Thanks.

Regards
Ley Foon

#23 lore raw

PATCH v6 13/16 arm: socfpga: Add SPL support for Arria 10

Quoted 202 lines · Ley Foon Tan
Quoted 192 lines · Dalon Westergreen
Quoted 191 lines · Dalon Westergreen
Quoted 180 lines · Dinh Nguyen
Quoted 169 lines · Dalon Westergreen
Quoted 166 lines · Dalon Westergreen
Quoted 52 lines · Dinh Nguyen

Really including Dalon

Quoted 47 lines

On Wed, Apr 19, 2017 at 3:26 PM, Dinh Nguyen <[email protected]> wrote:
CC: Dalon Westergreen

Quoted 39 lines · Dinh Nguyen
Quoted 33 lines · Ley Foon Tan

Add SPL support for Arria 10.

Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Signed-off-by: Tien Fong Chee <[email protected]>
Signed-off-by: Ley Foon Tan <[email protected]>

---

Quoted 13 lines
Quoted 13 lines
Quoted 13 lines

arch/arm/mach-socfpga/spl.c | 72

+++++++++++++++++++++++++++++++++++++++++----

Quoted 109 lines
Quoted 109 lines
Quoted 86 lines
Quoted 86 lines











 1 file changed, 67 insertions(+), 5 deletions(-)
arch/arm/mach- renamed from arch/arm/mach-socfpga/spl.c +0 -0

socfpga/spl.c
index 0064fc8..f4a3cdd 100644

arch/arm/mach-socfpga/spl.c +18 -3
@@ -19,23 +19,32 @@
 #include <asm/arch/sdram.h>
 #include <asm/arch/scu.h>
 #include <asm/arch/nic301.h>
+#include <asm/sections.h>
+#include <fdtdec.h>
+#include <watchdog.h>
+#if defined(CONFIG_TARGET_SOCFPGA_ARRIA10)
+#include <asm/arch/pinmux.h>
+#endif
 
 DECLARE_GLOBAL_DATA_PTR;
 
+#if defined(CONFIG_TARGET_SOCFPGA_GEN5)
 static struct pl310_regs *const pl310 =
     (struct pl310_regs *)CONFIG_SYS_PL310_BASE;
 static struct scu_registers *scu_regs =
     (struct scu_registers *)SOCFPGA_MPUSCU_ADDRESS;
 static struct nic301_registers *nic301_regs =
     (struct nic301_registers *)SOCFPGA_L3REGS_ADDRESS;
-static struct socfpga_system_manager *sysmgr_regs =
+#endif
+
+static const struct socfpga_system_manager *sysmgr_regs =
     (struct socfpga_system_manager *)SOCFPGA_SYSMGR_ADDRESS;
 
 u32 spl_boot_device(void)
 {
     const u32 bsel = readl(&sysmgr_regs->bootinfo);
 
-    switch (bsel & 0x7) {
+    switch (SYSMGR_GET_BOOTINFO_BSEL(bsel)) {
     case 0x1:       /* FPGA (HPS2FPGA Bridge) */
             return BOOT_DEVICE_RAM;
     case 0x2:       /* NAND Flash (1.8V) */
@@ -68,6 +77,7 @@ u32 spl_boot_mode(const u32 boot_device)
 }
 #endif
 
+#if defined(CONFIG_TARGET_SOCFPGA_GEN5)
 static void socfpga_nic301_slave_ns(void)
 {
     writel(0x1, &nic301_regs->lwhps2fpgaregs);
@@ -85,6 +95,7 @@ void board_init_f(ulong dummy)
 #endif
     unsigned long sdram_size;
     unsigned long reg;
+    int ret;
 
     /*
      * First C code to run. Clear fake OCRAM ECC first as SBE
@@ -117,7 +128,11 @@ void board_init_f(ulong dummy)
     /* Put everything into reset but L4WD0. */
     socfpga_per_reset_all();
     /* Put FPGA bridges into reset too. */
-    socfpga_bridges_reset(1);
+    ret = socfpga_bridges_reset(1);
+    if (ret) {
+            printf("socfpga_bridges_reset() failed: %d\n",
 ret);
+            hang();
+    }
 
     socfpga_per_reset(SOCFPGA_RESET(SDR), 0);
     socfpga_per_reset(SOCFPGA_RESET(UART0), 0);
arch/arm/mach-socfpga/spl.c +0 -0
@@ -148,7 +163,11 @@ void board_init_f(ulong dummy)
 
Quoted 15 lines
Quoted 10 lines
arch/arm/mach-socfpga/spl.c +0 -0
     /* De-assert reset for peripherals and bridges based on

handoff
*/

     reset_deassert_peripherals_handoff();
arch/arm/mach-socfpga/spl.c +3 -1
-    socfpga_bridges_reset(0);
+    ret = socfpga_bridges_reset(0);
+    if (ret) {
+            printf("socfpga_bridges_reset() failed: %d\n",

ret);
+ hang();

If you keep this patch the way it is, this will cause the Atlas board to
hang here.

Hi Dalon,

Can you check this patch? On the Atlas board, I'm seeing the call to socfpga_bridges_reset(0) fail because fpgamgr_test_fpga_ready() is failing, because is_fpgamgr_initdone_high() is returning 0.

Dinh

Quoted 7 lines
Quoted 3 lines

i saw it the first go round. i will test this out this afternoon.

--dalon

i see the exact same thing. for the c5/a5 devices there is no reason for init
done to be high since fpga configuration isnt required to boot.

Quoted 5 lines

Okay, good! It doesn't happen on the C5 devkit though.

Ley Foon, did you test this on the Arria5?

Dinh

Odd, init done should not be high without the FPGA configured. i will try it on
the c5 board as well to try and figure out why init done is high.

Quoted 8 lines
Quoted 1 line

--dalon

I ran this on the c5 socdk and noticed the same behavior as Dinh, then realized the board was setup to configure the fpga independently of the processor. When i change the MSELs on the board to ensure the FPGA is unconfigured the code fails in the same location where init done is not high. It is definitely an expected use case in c5/a5 that uboot can run without the fpga configured at all.

Quoted 4 lines

My proposal is revert back to its original code, revert socfpga_bridges_reset() return type to void and don't check error from fpgamgr_test_fpga_ready(). So, we can support Gen5 boot without program FPGA.

Isn't the difference between CV/AV and A10 such that the former can boot without programmed FPGA while the later can NOT boot without programmed FPGA ? So this code is A10 specific ?

Signature · 2 lines
Best regards,
Marek Vasut
#24 lore raw

PATCH v6 13/16 arm: socfpga: Add SPL support for Arria 10

Quoted 243 lines · Marek Vasut
Quoted 242 lines · Ley Foon Tan
Quoted 239 lines · Dalon Westergreen
Quoted 217 lines · Dalon Westergreen
Quoted 215 lines · Dinh Nguyen
Quoted 198 lines · Dalon Westergreen
Quoted 194 lines · Dalon Westergreen
Quoted 4 lines · Dinh Nguyen
Quoted 63 lines

Really including Dalon

Quoted 61 lines

On Wed, Apr 19, 2017 at 3:26 PM, Dinh Nguyen <dinguyen@kernel. org>
wrote:
CC: Dalon Westergreen

Quoted 51 lines · Dinh Nguyen
Quoted 44 lines · Ley Foon Tan

Add SPL support for Arria 10.

Quoted 16 lines
Quoted 16 lines
Quoted 4 lines
Quoted 4 lines

Signed-off-by: Tien Fong Chee <tien.fong.chee@inte
l.com>
Signed-off-by: Ley Foon Tan <[email protected]
m>

---

Quoted 17 lines
Quoted 17 lines

 arch/arm/mach-socfpga/spl.c | 72

+++++++++++++++++++++++++++++++++++++++++----

Quoted 121 lines
Quoted 121 lines
Quoted 102 lines
Quoted 102 lines















 1 file changed, 67 insertions(+), 5 deletions(-)
arch/arm/mach- renamed from arch/arm/mach-socfpga/spl.c +0 -0

socfpga/spl.c
index 0064fc8..f4a3cdd 100644

arch/arm/mach-socfpga/spl.c +7 -0
@@ -19,23 +19,32 @@
  #include <asm/arch/sdram.h>
  #include <asm/arch/scu.h>
  #include <asm/arch/nic301.h>
+#include <asm/sections.h>
+#include <fdtdec.h>
+#include <watchdog.h>
+#if defined(CONFIG_TARGET_SOCFPGA_ARRIA10)
+#include <asm/arch/pinmux.h>
+#endif
 
  DECLARE_GLOBAL_DATA_PTR;
 
+#if defined(CONFIG_TARGET_SOCFPGA_GEN5)

 static struct pl310_regs *const pl310 = (struct pl310_regs *)CONFIG_SYS_PL310_BASE; static struct scu_registers *scu_regs = (struct scu_registers *)SOCFPGA_MPUSCU_ADDRESS; static struct nic301_registers *nic301_regs = (struct nic301_registers *)SOCFPGA_L3REGS_ADDRESS;

arch/arm/mach-socfpga/spl.c +3 -1
-static struct socfpga_system_manager *sysmgr_regs =
+#endif
+
+static const struct socfpga_system_manager *sysmgr_regs =

     (struct socfpga_system_manager
*)SOCFPGA_SYSMGR_ADDRESS;

 u32 spl_boot_device(void)
 {
     const u32 bsel = readl(&sysmgr_regs->bootinfo);

-    switch (bsel & 0x7) {
+    switch (SYSMGR_GET_BOOTINFO_BSEL(bsel)) {
     case 0x1:       /* FPGA (HPS2FPGA Bridge) */
             return BOOT_DEVICE_RAM;
     case 0x2:       /* NAND Flash (1.8V) */

arch/arm/mach-socfpga/spl.c +2 -0
@@ -68,6 +77,7 @@ u32 spl_boot_mode(const u32 boot_device)
  }
  #endif
 
+#if defined(CONFIG_TARGET_SOCFPGA_GEN5)
  static void socfpga_nic301_slave_ns(void)
  {
      writel(0x1, &nic301_regs->lwhps2fpgaregs);
@@ -85,6 +95,7 @@ void board_init_f(ulong dummy)
  #endif
      unsigned long sdram_size;
      unsigned long reg;
+    int ret;
 
      /*
       * First C code to run. Clear fake OCRAM ECC first as

SBE

arch/arm/mach-socfpga/spl.c +5 -1
@@ -117,7 +128,11 @@ void board_init_f(ulong dummy)
      /* Put everything into reset but L4WD0. */
      socfpga_per_reset_all();
      /* Put FPGA bridges into reset too. */
-    socfpga_bridges_reset(1);
+    ret = socfpga_bridges_reset(1);
+    if (ret) {
+            printf("socfpga_bridges_reset() failed:
 %d\n",
 ret);
+            hang();
+    }
 

     socfpga_per_reset(SOCFPGA_RESET(SDR), 0);
     socfpga_per_reset(SOCFPGA_RESET(UART0), 0);

arch/arm/mach-socfpga/spl.c +0 -0
@@ -148,7 +163,11 @@ void board_init_f(ulong dummy)
 
      /* De-assert reset for peripherals and bridges based

on
handoff
*/
     reset_deassert_peripherals_handoff();
-    socfpga_bridges_reset(0);
+    ret = socfpga_bridges_reset(0);
+    if (ret) {
+            printf("socfpga_bridges_reset() failed:

Quoted 9 lines
Quoted 3 lines

%d\n",
ret);
+            hang();

If you keep this patch the way it is, this will cause the Atlas
board to
hang here.

Hi Dalon,

Can you check this patch? On the Atlas board, I'm seeing the call to
socfpga_bridges_reset(0) fail because fpgamgr_test_fpga_ready() is
failing, because is_fpgamgr_initdone_high() is returning 0.

Dinh

Quoted 8 lines
Quoted 3 lines

i saw it the first go round.  i will test this out this afternoon.

--dalon

i see the exact same thing.  for the c5/a5 devices there is no reason for
init
done to be high since fpga configuration isnt required to boot.

Okay, good! It doesn't happen on the C5 devkit though.

Ley Foon, did you test this on the Arria5?

Quoted 8 lines
Quoted 1 line

Dinh

Odd, init done should not be high without the FPGA configured.  i will try it
on
the c5 board as well to try and figure out why init done is high.

--dalon

I ran this on the c5 socdk and noticed the same behavior as Dinh, then realized
the board was setup to configure the fpga independently of the processor.  When
i change the MSELs on the board to ensure the FPGA is unconfigured the code
fails in the same location where init done is not high.  It is definitely an
expected use case in c5/a5 that uboot can run without the fpga configured at
all.

Quoted 8 lines
Quoted 4 lines

My proposal is revert back to its original code, revert socfpga_bridges_reset() return type to void and don't check error from fpgamgr_test_fpga_ready(). So, we can support Gen5 boot without program FPGA.

Isn't the difference between CV/AV and A10 such that the former can boot without programmed FPGA while the later can NOT boot without programmed FPGA ? So this code is A10 specific ?

Yes, at a minimum in A10 the IO ring needs to be configured prior to boot. Since these functions (socfpga_bridges_reset) are different for c5/a5 and a10, i would suggest changing the code to enable the bridges IF the fpga is configured.  perhaps just:

...
        } else {
                writel(0, &sysmgr_regs->iswgrp_handoff[0]); writel(l3mask, &sysmgr_regs->iswgrp_handoff[1]);
                /* Check signal from FPGA. */
                if (!fpgamgr_test_fpga_ready()) {
                       /* brdmodrst */
      writel(0, &reset_manager_base->brg_mod_reset); }

...

I think this actually mirrors the behavior of the 2013.01.01 fork where if the fpga is configured, spl enables the bridges.

--dalon

#25 lore raw

PATCH v6 13/16 arm: socfpga: Add SPL support for Arria 10

Quoted 249 lines · Dalon Westergreen
Quoted 248 lines · Marek Vasut
Quoted 246 lines · Ley Foon Tan
Quoted 228 lines · Dalon Westergreen
Quoted 217 lines · Dalon Westergreen
Quoted 215 lines · Dinh Nguyen
Quoted 198 lines · Dalon Westergreen
Quoted 194 lines · Dalon Westergreen
Quoted 4 lines · Dinh Nguyen
Quoted 63 lines

Really including Dalon

Quoted 61 lines

On Wed, Apr 19, 2017 at 3:26 PM, Dinh Nguyen <dinguyen@kernel. org>
wrote:
CC: Dalon Westergreen

Quoted 51 lines · Dinh Nguyen
Quoted 44 lines · Ley Foon Tan

Add SPL support for Arria 10.

Quoted 20 lines

Signed-off-by: Tien Fong Chee <tien.fong.chee@inte
l.com>
Signed-off-by: Ley Foon Tan <[email protected]
m>

---

Quoted 17 lines

arch/arm/mach-socfpga/spl.c | 72

+++++++++++++++++++++++++++++++++++++++++----

Quoted 121 lines
Quoted 121 lines
Quoted 102 lines
Quoted 102 lines















 1 file changed, 67 insertions(+), 5 deletions(-)
arch/arm/mach- renamed from arch/arm/mach-socfpga/spl.c +0 -0

socfpga/spl.c
index 0064fc8..f4a3cdd 100644

arch/arm/mach-socfpga/spl.c +11 -2
@@ -19,23 +19,32 @@
 #include <asm/arch/sdram.h>
 #include <asm/arch/scu.h>
 #include <asm/arch/nic301.h>
+#include <asm/sections.h>
+#include <fdtdec.h>
+#include <watchdog.h>
+#if defined(CONFIG_TARGET_SOCFPGA_ARRIA10)
+#include <asm/arch/pinmux.h>
+#endif
 
 DECLARE_GLOBAL_DATA_PTR;
 
+#if defined(CONFIG_TARGET_SOCFPGA_GEN5)
 static struct pl310_regs *const pl310 =
     (struct pl310_regs *)CONFIG_SYS_PL310_BASE;
 static struct scu_registers *scu_regs =
     (struct scu_registers *)SOCFPGA_MPUSCU_ADDRESS;
 static struct nic301_registers *nic301_regs =
     (struct nic301_registers *)SOCFPGA_L3REGS_ADDRESS;
-static struct socfpga_system_manager *sysmgr_regs =
+#endif
+
+static const struct socfpga_system_manager *sysmgr_regs =
     (struct socfpga_system_manager
 *)SOCFPGA_SYSMGR_ADDRESS;
 
 u32 spl_boot_device(void)
 {
     const u32 bsel = readl(&sysmgr_regs->bootinfo);
 
-    switch (bsel & 0x7) {
+    switch (SYSMGR_GET_BOOTINFO_BSEL(bsel)) {
     case 0x1:       /* FPGA (HPS2FPGA Bridge) */
             return BOOT_DEVICE_RAM;
     case 0x2:       /* NAND Flash (1.8V) */
arch/arm/mach-socfpga/spl.c +2 -0
@@ -68,6 +77,7 @@ u32 spl_boot_mode(const u32 boot_device)
 }
 #endif
 
+#if defined(CONFIG_TARGET_SOCFPGA_GEN5)
 static void socfpga_nic301_slave_ns(void)
 {
     writel(0x1, &nic301_regs->lwhps2fpgaregs);
@@ -85,6 +95,7 @@ void board_init_f(ulong dummy)
 #endif
     unsigned long sdram_size;
     unsigned long reg;
+    int ret;
 
     /*
      * First C code to run. Clear fake OCRAM ECC first as

SBE

arch/arm/mach-socfpga/spl.c +5 -1
@@ -117,7 +128,11 @@ void board_init_f(ulong dummy)
     /* Put everything into reset but L4WD0. */
     socfpga_per_reset_all();
     /* Put FPGA bridges into reset too. */
-    socfpga_bridges_reset(1);
+    ret = socfpga_bridges_reset(1);
+    if (ret) {
+            printf("socfpga_bridges_reset() failed:
 %d\n",
 ret);
+            hang();
+    }
 
     socfpga_per_reset(SOCFPGA_RESET(SDR), 0);
     socfpga_per_reset(SOCFPGA_RESET(UART0), 0);
arch/arm/mach-socfpga/spl.c +0 -0
@@ -148,7 +163,11 @@ void board_init_f(ulong dummy)
 
     /* De-assert reset for peripherals and bridges based

on
handoff
*/

     reset_deassert_peripherals_handoff();
arch/arm/mach-socfpga/spl.c +3 -1
-    socfpga_bridges_reset(0);
+    ret = socfpga_bridges_reset(0);
+    if (ret) {
+            printf("socfpga_bridges_reset() failed:
Quoted 9 lines
Quoted 3 lines

%d\n",
ret);
+ hang();

If you keep this patch the way it is, this will cause the Atlas
board to
hang here.

Hi Dalon,

Can you check this patch? On the Atlas board, I'm seeing the call to
socfpga_bridges_reset(0) fail because fpgamgr_test_fpga_ready() is
failing, because is_fpgamgr_initdone_high() is returning 0.

Dinh

Quoted 8 lines
Quoted 3 lines

i saw it the first go round. i will test this out this afternoon.

--dalon

i see the exact same thing. for the c5/a5 devices there is no reason for
init
done to be high since fpga configuration isnt required to boot.

Okay, good! It doesn't happen on the C5 devkit though.

Ley Foon, did you test this on the Arria5?

Quoted 8 lines
Quoted 1 line

Dinh

Odd, init done should not be high without the FPGA configured. i will try it
on
the c5 board as well to try and figure out why init done is high.

--dalon

Quoted 11 lines

I ran this on the c5 socdk and noticed the same behavior as Dinh, then realized
the board was setup to configure the fpga independently of the processor. When
i change the MSELs on the board to ensure the FPGA is unconfigured the code
fails in the same location where init done is not high. It is definitely an
expected use case in c5/a5 that uboot can run without the fpga configured at
all.

My proposal is revert back to its original code, revert socfpga_bridges_reset() return type to void and don't check error from fpgamgr_test_fpga_ready(). So, we can support Gen5 boot without program FPGA.

Quoted 5 lines
Quoted 3 lines

Isn't the difference between CV/AV and A10 such that the former can boot without programmed FPGA while the later can NOT boot without programmed FPGA ? So this code is A10 specific ?

Yes, at a minimum in A10 the IO ring needs to be configured prior to boot.

We do the IOCSR configuration on C5/A5 too, so what's the difference ?

Quoted 3 lines

Since these functions (socfpga_bridges_reset) are different for c5/a5 and a10,
i would suggest changing the code to enable the bridges IF the fpga is configured. perhaps just:

If it works ... fine.

Quoted 11 lines

...

        } else {                                                                
                writel(0, &sysmgr_regs->iswgrp_handoff[0]);                     
                writel(l3mask, &sysmgr_regs->iswgrp_handoff[1]);                
                                                                                
                /* Check signal from FPGA. */                                   
                if (!fpgamgr_test_fpga_ready()) {                               
                       /* brdmodrst */                                          
      			writel(0, &reset_manager_base->brg_mod_reset);             
                }                                                               
Quoted 4 lines

...

I think this actually mirrors the behavior of the 2013.01.01 fork where if the fpga is configured, spl enables the bridges.

Super :)

Quoted 2 lines

--dalon

Signature · 2 lines
Best regards,
Marek Vasut
#26 lore raw

PATCH v6 13/16 arm: socfpga: Add SPL support for Arria 10

Quoted 290 lines · Marek Vasut
Quoted 289 lines · Dalon Westergreen
Quoted 287 lines · Marek Vasut
Quoted 284 lines · Ley Foon Tan
Quoted 263 lines · Dalon Westergreen
Quoted 252 lines · Dalon Westergreen
Quoted 243 lines · Dinh Nguyen
Quoted 231 lines · Dalon Westergreen
Quoted 226 lines · Dalon Westergreen
Quoted 5 lines · Dinh Nguyen
Quoted 77 lines

Really including Dalon

Quoted 75 lines

On Wed, Apr 19, 2017 at 3:26 PM, Dinh Nguyen <dinguyen@ker nel.
org>
wrote:
CC: Dalon Westergreen

Quoted 63 lines · Dinh Nguyen
Quoted 55 lines · Ley Foon Tan

Add SPL support for Arria 10.

Signed-off-by: Tien Fong Chee <tien.fong.chee@
inte
l.com>
Signed-off-by: Ley Foon Tan <ley.foon.tan@inte
l.co
m>
---

 arch/arm/mach-socfpga/spl.c | 72

+++++++++++++++++++++++++++++++++++++++++----

Quoted 133 lines
Quoted 133 lines
Quoted 113 lines
Quoted 113 lines

 1 file changed, 67 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-socfpga/spl.c
b/arch/arm/mach-
socfpga/spl.c
index 0064fc8..f4a3cdd 100644
--- a/arch/arm/mach-socfpga/spl.c
+++ b/arch/arm/mach-socfpga/spl.c
@@ -19,23 +19,32 @@
 #include <asm/arch/sdram.h>
 #include <asm/arch/scu.h>
 #include <asm/arch/nic301.h>
+#include <asm/sections.h>
+#include <fdtdec.h>
+#include <watchdog.h>
+#if defined(CONFIG_TARGET_SOCFPGA_ARRIA10)
+#include <asm/arch/pinmux.h>
+#endif

 DECLARE_GLOBAL_DATA_PTR;

+#if defined(CONFIG_TARGET_SOCFPGA_GEN5)
 static struct pl310_regs *const pl310 =
     (struct pl310_regs *)CONFIG_SYS_PL310_BASE;
 static struct scu_registers *scu_regs =
     (struct scu_registers *)SOCFPGA_MPUSCU_ADDRESS;
 static struct nic301_registers *nic301_regs =
     (struct nic301_registers
*)SOCFPGA_L3REGS_ADDRESS;
-static struct socfpga_system_manager *sysmgr_regs =
+#endif
+
+static const struct socfpga_system_manager
*sysmgr_regs =
     (struct socfpga_system_manager
*)SOCFPGA_SYSMGR_ADDRESS;

 u32 spl_boot_device(void)
 {
     const u32 bsel = readl(&sysmgr_regs->bootinfo);

-    switch (bsel & 0x7) {
+    switch (SYSMGR_GET_BOOTINFO_BSEL(bsel)) {
     case 0x1:       /* FPGA (HPS2FPGA Bridge) */
             return BOOT_DEVICE_RAM;
     case 0x2:       /* NAND Flash (1.8V) */
@@ -68,6 +77,7 @@ u32 spl_boot_mode(const u32
boot_device)
 }
 #endif

+#if defined(CONFIG_TARGET_SOCFPGA_GEN5)
 static void socfpga_nic301_slave_ns(void)
 {
     writel(0x1, &nic301_regs->lwhps2fpgaregs);
@@ -85,6 +95,7 @@ void board_init_f(ulong dummy)
 #endif
     unsigned long sdram_size;
     unsigned long reg;
+    int ret;

     /*
      * First C code to run. Clear fake OCRAM ECC
first as
SBE
@@ -117,7 +128,11 @@ void board_init_f(ulong dummy)
     /* Put everything into reset but L4WD0. */
     socfpga_per_reset_all();
     /* Put FPGA bridges into reset too. */
-    socfpga_bridges_reset(1);
+    ret = socfpga_bridges_reset(1);
+    if (ret) {
+            printf("socfpga_bridges_reset() failed:
%d\n",
ret);
+            hang();
+    }

     socfpga_per_reset(SOCFPGA_RESET(SDR), 0);
     socfpga_per_reset(SOCFPGA_RESET(UART0), 0);
@@ -148,7 +163,11 @@ void board_init_f(ulong dummy)

     /* De-assert reset for peripherals and bridges
based
on
handoff
*/
     reset_deassert_peripherals_handoff();
-    socfpga_bridges_reset(0);
+    ret = socfpga_bridges_reset(0);
+    if (ret) {
+            printf("socfpga_bridges_reset() failed:
%d\n",

Quoted 9 lines
Quoted 2 lines

ret);
+            hang();

If you keep this patch the way it is, this will cause the
Atlas
board to
hang here.

Hi Dalon,

Can you check this patch? On the Atlas board, I'm seeing the
call to
socfpga_bridges_reset(0) fail because fpgamgr_test_fpga_ready() is
failing, because is_fpgamgr_initdone_high() is returning 0.

Quoted 1 line
Quoted 1 line

Dinh

i saw it the first go round.  i will test this out this afternoon.

Quoted 6 lines
Quoted 1 line

--dalon

i see the exact same thing.  for the c5/a5 devices there is no reason for
init
done to be high since fpga configuration isnt required to boot.

Quoted 5 lines

Okay, good! It doesn't happen on the C5 devkit though.

Ley Foon, did you test this on the Arria5?

Dinh

Quoted 7 lines

Odd, init done should not be high without the FPGA configured.  i will
try it
on
the c5 board as well to try and figure out why init done is high.

--dalon

Quoted 13 lines

I ran this on the c5 socdk and noticed the same behavior as Dinh, then realized
the board was setup to configure the fpga independently of the processor.  When
i change the MSELs on the board to ensure the FPGA is unconfigured the code
fails in the same location where init done is not high.  It is definitely
an
expected use case in c5/a5 that uboot can run without the fpga configured
at
all.

My proposal is revert back to its original code, revert socfpga_bridges_reset() return type to void and don't check error from fpgamgr_test_fpga_ready(). So, we can support Gen5 boot without program FPGA.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

Isn't the difference between CV/AV and A10 such that the former can boot without programmed FPGA while the later can NOT boot without programmed FPGA ? So this code is A10 specific ?

Yes, at a minimum in A10 the IO ring needs to be configured prior to boot.

We do the IOCSR configuration on C5/A5 too, so what's the difference ?

in c5/a5 the iocsr config is done directly, the iocsr data is compiled into spl, for a10 this is all done by the fpga bitstream, there is no direct iocsr config.

Quoted 43 lines
Quoted 5 lines

 Since these functions (socfpga_bridges_reset) are different for c5/a5 and a10,
i would suggest changing the code to enable the bridges IF the fpga is configured.  perhaps just:

If it works ... fine.

Quoted 24 lines

...
        } else
{
                writel(0, &sysmgr_regs-

Quoted 1 line

iswgrp_handoff[0]);

                writel(l3mask, &sysmgr_regs-

Quoted 1 line

iswgrp_handoff[1]);



                /* Check signal from FPGA.
*/
                if (!fpgamgr_test_fpga_ready()) {
                       /* brdmodrst
*/
       writel(0, &reset_manager_base-

Quoted 1 line

brg_mod_reset);

                }



...

Quoted 3 lines

I think this actually mirrors the behavior of the 2013.01.01 fork where if the
fpga is configured, spl enables the bridges.

Super :)

Quoted 3 lines

--dalon

#27 lore raw

PATCH v6 13/16 arm: socfpga: Add SPL support for Arria 10

On 04/21/2017 06:37 PM, Dalon Westergreen wrote:

[...]

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Quoted 4 lines

My proposal is revert back to its original code, revert socfpga_bridges_reset() return type to void and don't check error from fpgamgr_test_fpga_ready(). So, we can support Gen5 boot without program FPGA.

Isn't the difference between CV/AV and A10 such that the former can boot without programmed FPGA while the later can NOT boot without programmed FPGA ? So this code is A10 specific ?

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Yes, at a minimum in A10 the IO ring needs to be configured prior to boot.

We do the IOCSR configuration on C5/A5 too, so what's the difference ?

in c5/a5 the iocsr config is done directly, the iocsr data is compiled into spl, for a10 this is all done by the fpga bitstream, there is no direct iocsr config.

So that's why the FPGA must always be programmed with something to get the A10 working ? I see ... thanks for clarifying.

Quoted 43 lines
Quoted 43 lines
Quoted 5 lines

Since these functions (socfpga_bridges_reset) are different for c5/a5 and
a10,
i would suggest changing the code to enable the bridges IF the fpga is configured. perhaps just:

If it works ... fine.

Quoted 22 lines

...

        } else
{                                                                
                writel(0, &sysmgr_regs-
Quoted 1 line

iswgrp_handoff[0]);

writel(l3mask, &sysmgr_regs-

Quoted 1 line

iswgrp_handoff[1]);

                /* Check signal from FPGA.
*/                                   
                if (!fpgamgr_test_fpga_ready())
{                               
                       /* brdmodrst

*/
writel(0, &reset_manager_base-

Quoted 1 line

brg_mod_reset);

                }                                                           
Quoted 5 lines

...

I think this actually mirrors the behavior of the 2013.01.01 fork where if the
fpga is configured, spl enables the bridges.

Super :)

Quoted 3 lines

--dalon

Signature · 2 lines
Best regards,
Marek Vasut
#28 lore raw

PATCH v6 13/16 arm: socfpga: Add SPL support for Arria 10

In reply to Dalon Westergreen
Quoted 269 lines · Dalon Westergreen
Quoted 243 lines · Marek Vasut
Quoted 242 lines · Ley Foon Tan
Quoted 239 lines · Dalon Westergreen
Quoted 217 lines · Dalon Westergreen
Quoted 215 lines · Dinh Nguyen
Quoted 198 lines · Dalon Westergreen
Quoted 194 lines · Dalon Westergreen
Quoted 4 lines · Dinh Nguyen
Quoted 63 lines

Really including Dalon

Quoted 61 lines

On Wed, Apr 19, 2017 at 3:26 PM, Dinh Nguyen <dinguyen@kernel. org>
wrote:
CC: Dalon Westergreen

Quoted 51 lines · Dinh Nguyen
Quoted 44 lines · Ley Foon Tan

Add SPL support for Arria 10.

Quoted 20 lines

Signed-off-by: Tien Fong Chee <tien.fong.chee@inte
l.com>
Signed-off-by: Ley Foon Tan <[email protected]
m>

---

Quoted 17 lines

arch/arm/mach-socfpga/spl.c | 72

+++++++++++++++++++++++++++++++++++++++++----

Quoted 121 lines
Quoted 121 lines
Quoted 102 lines
Quoted 102 lines















 1 file changed, 67 insertions(+), 5 deletions(-)
arch/arm/mach- renamed from arch/arm/mach-socfpga/spl.c +0 -0

socfpga/spl.c
index 0064fc8..f4a3cdd 100644

arch/arm/mach-socfpga/spl.c +11 -2
@@ -19,23 +19,32 @@
 #include <asm/arch/sdram.h>
 #include <asm/arch/scu.h>
 #include <asm/arch/nic301.h>
+#include <asm/sections.h>
+#include <fdtdec.h>
+#include <watchdog.h>
+#if defined(CONFIG_TARGET_SOCFPGA_ARRIA10)
+#include <asm/arch/pinmux.h>
+#endif
 
 DECLARE_GLOBAL_DATA_PTR;
 
+#if defined(CONFIG_TARGET_SOCFPGA_GEN5)
 static struct pl310_regs *const pl310 =
     (struct pl310_regs *)CONFIG_SYS_PL310_BASE;
 static struct scu_registers *scu_regs =
     (struct scu_registers *)SOCFPGA_MPUSCU_ADDRESS;
 static struct nic301_registers *nic301_regs =
     (struct nic301_registers *)SOCFPGA_L3REGS_ADDRESS;
-static struct socfpga_system_manager *sysmgr_regs =
+#endif
+
+static const struct socfpga_system_manager *sysmgr_regs =
     (struct socfpga_system_manager
 *)SOCFPGA_SYSMGR_ADDRESS;
 
 u32 spl_boot_device(void)
 {
     const u32 bsel = readl(&sysmgr_regs->bootinfo);
 
-    switch (bsel & 0x7) {
+    switch (SYSMGR_GET_BOOTINFO_BSEL(bsel)) {
     case 0x1:       /* FPGA (HPS2FPGA Bridge) */
             return BOOT_DEVICE_RAM;
     case 0x2:       /* NAND Flash (1.8V) */
arch/arm/mach-socfpga/spl.c +2 -0
@@ -68,6 +77,7 @@ u32 spl_boot_mode(const u32 boot_device)
 }
 #endif
 
+#if defined(CONFIG_TARGET_SOCFPGA_GEN5)
 static void socfpga_nic301_slave_ns(void)
 {
     writel(0x1, &nic301_regs->lwhps2fpgaregs);
@@ -85,6 +95,7 @@ void board_init_f(ulong dummy)
 #endif
     unsigned long sdram_size;
     unsigned long reg;
+    int ret;
 
     /*
      * First C code to run. Clear fake OCRAM ECC first as

SBE

arch/arm/mach-socfpga/spl.c +5 -1
@@ -117,7 +128,11 @@ void board_init_f(ulong dummy)
     /* Put everything into reset but L4WD0. */
     socfpga_per_reset_all();
     /* Put FPGA bridges into reset too. */
-    socfpga_bridges_reset(1);
+    ret = socfpga_bridges_reset(1);
+    if (ret) {
+            printf("socfpga_bridges_reset() failed:
 %d\n",
 ret);
+            hang();
+    }
 
     socfpga_per_reset(SOCFPGA_RESET(SDR), 0);
     socfpga_per_reset(SOCFPGA_RESET(UART0), 0);
arch/arm/mach-socfpga/spl.c +0 -0
@@ -148,7 +163,11 @@ void board_init_f(ulong dummy)
 
     /* De-assert reset for peripherals and bridges based

on
handoff
*/

     reset_deassert_peripherals_handoff();
arch/arm/mach-socfpga/spl.c +3 -1
-    socfpga_bridges_reset(0);
+    ret = socfpga_bridges_reset(0);
+    if (ret) {
+            printf("socfpga_bridges_reset() failed:
Quoted 9 lines
Quoted 3 lines

%d\n",
ret);
+ hang();

If you keep this patch the way it is, this will cause the Atlas
board to
hang here.

Hi Dalon,

Can you check this patch? On the Atlas board, I'm seeing the call to
socfpga_bridges_reset(0) fail because fpgamgr_test_fpga_ready() is
failing, because is_fpgamgr_initdone_high() is returning 0.

Dinh

Quoted 8 lines
Quoted 3 lines

i saw it the first go round. i will test this out this afternoon.

--dalon

i see the exact same thing. for the c5/a5 devices there is no reason for
init
done to be high since fpga configuration isnt required to boot.

Okay, good! It doesn't happen on the C5 devkit though.

Ley Foon, did you test this on the Arria5?

Quoted 8 lines
Quoted 1 line

Dinh

Odd, init done should not be high without the FPGA configured. i will try it
on
the c5 board as well to try and figure out why init done is high.

--dalon

I ran this on the c5 socdk and noticed the same behavior as Dinh, then realized
the board was setup to configure the fpga independently of the processor. When
i change the MSELs on the board to ensure the FPGA is unconfigured the code
fails in the same location where init done is not high. It is definitely an
expected use case in c5/a5 that uboot can run without the fpga configured at
all.

Quoted 8 lines
Quoted 4 lines

My proposal is revert back to its original code, revert socfpga_bridges_reset() return type to void and don't check error from fpgamgr_test_fpga_ready(). So, we can support Gen5 boot without program FPGA.

Isn't the difference between CV/AV and A10 such that the former can boot without programmed FPGA while the later can NOT boot without programmed FPGA ? So this code is A10 specific ?

Yes, at a minimum in A10 the IO ring needs to be configured prior to boot.
Since these functions (socfpga_bridges_reset) are different for c5/a5 and a10,
i would suggest changing the code to enable the bridges IF the fpga is configured. perhaps just:

...

        } else {
                writel(0, &sysmgr_regs->iswgrp_handoff[0]);
                writel(l3mask, &sysmgr_regs->iswgrp_handoff[1]);

                /* Check signal from FPGA. */
                if (!fpgamgr_test_fpga_ready()) {
                       /* brdmodrst */
                        writel(0, &reset_manager_base->brg_mod_reset);
                }
Quoted 1 line

...

Code above will reset bridge if FPGA configuration is failed. So, it should be something like this (original code):

...

   } else {
               writel(0, &sysmgr_regs->iswgrp_handoff[0]);
                writel(l3mask, &sysmgr_regs->iswgrp_handoff[1]);

                /* Check signal from FPGA. */
                if (!fpgamgr_test_fpga_ready()) {
                        /* FPGA not ready, do nothing. */
                        printf("%s: FPGA not ready, aborting.\n", __func__);
                        return;
                }

                /* brdmodrst */
                writel(0, &reset_manager_base->brg_mod_reset);

                /* Remap the bridges into memory map */
                writel(l3mask, SOCFPGA_L3REGS_ADDRESS);
}

....

Quoted 4 lines

I think this actually mirrors the behavior of the 2013.01.01 fork where if the fpga is configured, spl enables the bridges.

Thanks

Regards
Ley Foon

#29 lore raw

PATCH v6 14/16 arm: socfpga: Add config and defconfig for Arria 10

In reply to Ley Foon Tan

Add config and defconfig for the Arria10 and update socfpga_common.h.

---
 configs/socfpga_arria10_defconfig       | 29 +++++++++++++++
 include/configs/socfpga_arria10_socdk.h | 66 +++++++++++++++++++++++++++++++++
 include/configs/socfpga_common.h        | 21 ++++++++---
 3 files changed, 111 insertions(+), 5 deletions(-)
 create mode 100644 configs/socfpga_arria10_defconfig
 create mode 100644 include/configs/socfpga_arria10_socdk.h
configs/socfpga_arria10_defconfig new file +29 -0
new file mode 100644
index 0000000..46bda47
@@ -0,0 +1,29 @@
+CONFIG_ARM=y
+CONFIG_ARCH_SOCFPGA=y
+CONFIG_SYS_MALLOC_F_LEN=0x2000
+CONFIG_TARGET_SOCFPGA_ARRIA10_SOCDK=y
+CONFIG_IDENT_STRING="socfpga_arria10"
+CONFIG_DEFAULT_DEVICE_TREE="socfpga_arria10_socdk_sdmmc"
+CONFIG_DEFAULT_FDT_FILE="socfpga_arria10_socdk_sdmmc.dtb"
+CONFIG_SPL=y
+CONFIG_CMD_BOOTZ=y
+# CONFIG_CMD_IMLS is not set
+CONFIG_CMD_ASKENV=y
+CONFIG_CMD_GREPENV=y
+# CONFIG_CMD_FLASH is not set
+CONFIG_CMD_MMC=y
+CONFIG_CMD_GPIO=y
+CONFIG_CMD_DHCP=y
+CONFIG_CMD_PING=y
+CONFIG_CMD_CACHE=y
+CONFIG_CMD_EXT4=y
+CONFIG_CMD_EXT4_WRITE=y
+CONFIG_DOS_PARTITION=y
+# CONFIG_SPL_DOS_PARTITION is not set
+CONFIG_SPL_DM=y
+CONFIG_SPL_DM_SEQ_ALIAS=y
+CONFIG_DM_GPIO=y
+CONFIG_DWAPB_GPIO=y
+CONFIG_DM_MMC=y
+CONFIG_SYS_NS16550=y
+CONFIG_USE_TINY_PRINTF=y
include/configs/socfpga_arria10_socdk.h new file +66 -0

66 lines not on this page · raw message

include/configs/socfpga_common.h +16 -5
index 107c6d5..da7e4ad 100644
@@ -32,9 +32,13 @@
 #define CONFIG_SYS_MALLOC_LEN		(64 * 1024 * 1024)
 #define CONFIG_SYS_MEMTEST_START	PHYS_SDRAM_1
 #define CONFIG_SYS_MEMTEST_END		PHYS_SDRAM_1_SIZE
-
+#if defined(CONFIG_TARGET_SOCFPGA_GEN5)
 #define CONFIG_SYS_INIT_RAM_ADDR	0xFFFF0000
 #define CONFIG_SYS_INIT_RAM_SIZE	0x10000
+#elif defined(CONFIG_TARGET_SOCFPGA_ARRIA10)
+#define CONFIG_SYS_INIT_RAM_ADDR	0xFFE00000
+#define CONFIG_SYS_INIT_RAM_SIZE	0x40000 /* 256KB */
+#endif
 #define CONFIG_SYS_INIT_SP_OFFSET		\
 	(CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
 #define CONFIG_SYS_INIT_SP_ADDR			\
@@ -101,13 +105,14 @@
 /*
  * FPGA Driver
  */
+#ifdef CONFIG_TARGET_SOCFPGA_GEN5
 #ifdef CONFIG_CMD_FPGA
 #define CONFIG_FPGA
 #define CONFIG_FPGA_ALTERA
 #define CONFIG_FPGA_SOCFPGA
 #define CONFIG_FPGA_COUNT		1
 #endif
-
+#endif
 /*
  * L4 OSC1 Timer 0
  */
@@ -207,11 +212,14 @@ unsigned int cm_get_qspi_controller_clk_hz(void);
  */
 #define CONFIG_SYS_NS16550_SERIAL
 #define CONFIG_SYS_NS16550_REG_SIZE	-4
-#define CONFIG_SYS_NS16550_COM1		SOCFPGA_UART0_ADDRESS
 #ifdef CONFIG_SOCFPGA_VIRTUAL_TARGET
 #define CONFIG_SYS_NS16550_CLK		1000000
-#else
+#elif defined(CONFIG_TARGET_SOCFPGA_GEN5)
+#define CONFIG_SYS_NS16550_COM1		SOCFPGA_UART0_ADDRESS
 #define CONFIG_SYS_NS16550_CLK		100000000
+#elif defined(CONFIG_TARGET_SOCFPGA_ARRIA10)
+#define CONFIG_SYS_NS16550_COM1        SOCFPGA_UART1_ADDRESS
+#define CONFIG_SYS_NS16550_CLK		50000000
 #endif
 #define CONFIG_CONS_INDEX		1
 
@@ -298,7 +306,10 @@ unsigned int cm_get_qspi_controller_clk_hz(void);
  */
 #define CONFIG_SPL_FRAMEWORK
 #define CONFIG_SPL_TEXT_BASE		CONFIG_SYS_INIT_RAM_ADDR
-#define CONFIG_SPL_MAX_SIZE		(64 * 1024)
+#define CONFIG_SPL_MAX_SIZE		CONFIG_SYS_INIT_RAM_SIZE
+#if defined(CONFIG_TARGET_SOCFPGA_ARRIA10)
+#define CONFIG_SPL_BOARD_INIT
+#endif
 
 /* SPL SDMMC boot support */
 #ifdef CONFIG_SPL_MMC_SUPPORT
Signature · 1 line
1.8.2.3
#30 lore raw

PATCH v6 15/16 arm: socfpga: Add board files for the Arria10

In reply to Ley Foon Tan

Add support for the Arria10 SoCDK.

---
 board/altera/arria10-socdk/Kconfig   | 18 ++++++++++++++++++
 board/altera/arria10-socdk/Makefile  |  7 +++++++
 board/altera/arria10-socdk/socfpga.c |  7 +++++++
 3 files changed, 32 insertions(+)
 create mode 100644 board/altera/arria10-socdk/Kconfig
 create mode 100644 board/altera/arria10-socdk/Makefile
 create mode 100644 board/altera/arria10-socdk/socfpga.c
board/altera/arria10-socdk/Kconfig new file +18 -0
new file mode 100644
index 0000000..b80cc6d
@@ -0,0 +1,18 @@
+if TARGET_SOCFPGA_ARRIA10
+
+config SYS_CPU
+	default "armv7"
+
+config SYS_BOARD
+	default "socfpga_arria10"
+
+config SYS_VENDOR
+	default "altera"
+
+config SYS_SOC
+	default "socfpga_arria10"
+
+config SYS_CONFIG_NAME
+	default "socfpga_arria10"
+
+endif
board/altera/arria10-socdk/Makefile new file +7 -0
new file mode 100644
index 0000000..1d885ce
@@ -0,0 +1,7 @@
+#
+# Copyright (C) 2015 Altera Corporation <www.altera.com>
+#
+# SPDX-License-Identifier:	GPL-2.0
+#
+
+obj-y	:= socfpga.o
board/altera/arria10-socdk/socfpga.c new file +7 -0
new file mode 100644
index 0000000..8516633
@@ -0,0 +1,7 @@
+/*
+ * Copyright (C) 2015 Altera Corporation <www.altera.com>
+ *
+ * SPDX-License-Identifier:	GPL-2.0
+ */
+
+#include <common.h>
Signature · 1 line
1.8.2.3
#31 lore raw

PATCH v6 16/16 arm: socfpga: Enable build for Arria 10

In reply to Ley Foon Tan

Update Kconfig and Makefile to enable Arria 10. Clean up Makefile and sorting *.o alphanumerically.

---
 arch/arm/mach-socfpga/Kconfig  | 10 +++++++++
 arch/arm/mach-socfpga/Makefile | 46 ++++++++++++++++++++++++++++++------------
 2 files changed, 43 insertions(+), 13 deletions(-)
arch/arm/mach-socfpga/Kconfig +10 -0
index 9bfee04..b36ffb1 100644
@@ -37,6 +37,9 @@ config TARGET_SOCFPGA_ARRIA5
 	bool
 	select TARGET_SOCFPGA_GEN5
 
+config TARGET_SOCFPGA_ARRIA10
+	bool
+
 config TARGET_SOCFPGA_CYCLONE5
 	bool
 	select TARGET_SOCFPGA_GEN5
@@ -49,6 +52,10 @@ choice
 	prompt "Altera SOCFPGA board select"
 	optional
 
+config TARGET_SOCFPGA_ARRIA10_SOCDK
+	bool "Altera SOCFPGA SoCDK (Arria 10)"
+	select TARGET_SOCFPGA_ARRIA10
+
 config TARGET_SOCFPGA_ARRIA5_SOCDK
 	bool "Altera SOCFPGA SoCDK (Arria V)"
 	select TARGET_SOCFPGA_ARRIA5
@@ -94,6 +101,7 @@ endchoice
 
 config SYS_BOARD
 	default "arria5-socdk" if TARGET_SOCFPGA_ARRIA5_SOCDK
+	default "arria10-socdk" if TARGET_SOCFPGA_ARRIA10_SOCDK
 	default "cyclone5-socdk" if TARGET_SOCFPGA_CYCLONE5_SOCDK
 	default "de0-nano-soc" if TARGET_SOCFPGA_TERASIC_DE0_NANO
 	default "de1-soc" if TARGET_SOCFPGA_TERASIC_DE1_SOC
@@ -106,6 +114,7 @@ config SYS_BOARD
 
 config SYS_VENDOR
 	default "altera" if TARGET_SOCFPGA_ARRIA5_SOCDK
+	default "altera" if TARGET_SOCFPGA_ARRIA10_SOCDK
 	default "altera" if TARGET_SOCFPGA_CYCLONE5_SOCDK
 	default "aries" if TARGET_SOCFPGA_ARIES_MCVEVK
 	default "ebv" if TARGET_SOCFPGA_EBV_SOCRATES
@@ -119,6 +128,7 @@ config SYS_SOC
 
 config SYS_CONFIG_NAME
 	default "socfpga_arria5_socdk" if TARGET_SOCFPGA_ARRIA5_SOCDK
+	default "socfpga_arria10_socdk" if TARGET_SOCFPGA_ARRIA10_SOCDK
 	default "socfpga_cyclone5_socdk" if TARGET_SOCFPGA_CYCLONE5_SOCDK
 	default "socfpga_de0_nano_soc" if TARGET_SOCFPGA_TERASIC_DE0_NANO
 	default "socfpga_de1_soc" if TARGET_SOCFPGA_TERASIC_DE1_SOC
arch/arm/mach-socfpga/Makefile +33 -13

61 lines not on this page · raw message

Signature · 1 line
1.8.2.3
#32 lore raw

v6 cover Add Intel Arria 10 SoC support

In reply to Ley Foon Tan
Quoted 4 lines · Ley Foon Tan

This is the 6th version of patchset to adds support for Intel Arria 10 SoC. This is initial patchset enables the basic support for Arria 10 and other features will come after this.

Quoted 8 lines

There is only one minor change in patch #5.

This series is rebased on top of http://git.denx.de/?p=u-boot/u-boot-socfpga.git.

v5 -> v6 changes:
-----------------
- macros sorted by address

OK, waiting for final review by Dinh ...

Signature · 2 lines
Best regards,
Marek Vasut
#33 lore raw

v6 cover Add Intel Arria 10 SoC support

Quoted 7 lines · Marek Vasut
Quoted 6 lines · Ley Foon Tan

This is the 6th version of patchset to adds support for Intel Arria 10 SoC. This is initial patchset enables the basic support for Arria 10 and other features will come after this.

There is only one minor change in patch #5.

Quoted 9 lines
Quoted 6 lines

This series is rebased on top of http://git.denx.de/?p=u-boot/u-boot-socfpga.git.

v5 -> v6 changes:
-----------------
- macros sorted by address

OK, waiting for final review by Dinh ...

Looks pretty good. Let me apply and test it on a few of my boards today.

Dinh