Skip to contentSkip to conversation

Add Intel Stratix 10 SoC support

PATCH Superseded Ley Foon Tan 4 participants 26 messages May 18, 2018 – Jun 11, 2020

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover Add Intel Stratix 10 SoC support

This is 2nd version of patchset to adds support for Intel Stratix 10 SoC. This patchset is work on top of patchset in [1].

Changes:
- update base addresses header
- use reset framework for periperhals (16550 UART, MMC, EMAC)
- change to use serial DM driver
- move bridge command to misc common driver and reuse for other platforms
- rework board_init_f() in SPL
- update S10 dts and dtsi
- Mailbox:
- change to use register offset to access register instead of register structure
- rename function with __xxx prefix
- DDR:
- rework DDR driver
- change to use register offset to access register instead of register structure
- remove union bitwise structure
- use wait_for_bit to poll

Patchset history:
[v1]: https://patchwork.ozlabs.org/cover/900499/

[1]: https://patchwork.ozlabs.org/cover/910018/

Ley Foon Tan (16):
arm: socfpga: stratix10: Add watchdog and firewall base addresses
arm: socfpga: stratix10: Add clock manager driver for Stratix10 SoC
arm: socfpga: stratix10: Add reset manager driver for Stratix10 SoC
arm: socfpga: stratix10: Add pinmux support for Stratix10 SoC
arm: socfpga: misc: Add CONFIG_SYS_L2_PL310 switch
arm: socfpga: misc: Move bridge command to misc common
arm: socfpga: stratix10: Add misc support for Stratix10 SoC
arm: socfpga: stratix10: Add mailbox support for Stratix10 SoC
arm: socfpga: stratix10: Add MMU support for Stratix10 SoC
arm: socfpga: Restructure the SPL file
arm: socfpga: stratix10: Add SPL driver for Stratix10 SoC
arm: socfpga: stratix10: Add timer support for Stratix10 SoC
ddr: altera: stratix10: Add DDR support for Stratix10 SoC
board: altera: stratix10: Add socdk board support for Stratix10 SoC
arm: dts: socfpga: stratix10: update dtsi and dts
arm: socfpga: stratix10: Enable Stratix10 SoC build

 arch/arm/Kconfig                                   |    9 +-
 arch/arm/dts/socfpga_stratix10.dtsi                |   22 +-
 arch/arm/dts/socfpga_stratix10_socdk.dts           |    3 +
 arch/arm/mach-socfpga/Kconfig                      |   16 +
 arch/arm/mach-socfpga/Makefile                     |   23 +-
 arch/arm/mach-socfpga/clock_manager.c              |    4 +-
 arch/arm/mach-socfpga/clock_manager_s10.c          |  380 +++++++++++++++++++
 arch/arm/mach-socfpga/include/mach/base_addr_s10.h |   11 +
 arch/arm/mach-socfpga/include/mach/clock_manager.h |    2 +
 .../mach-socfpga/include/mach/clock_manager_s10.h  |  210 +++++++++++
 arch/arm/mach-socfpga/include/mach/firewall_s10.h  |  120 ++++++
 arch/arm/mach-socfpga/include/mach/handoff_s10.h   |   34 ++
 arch/arm/mach-socfpga/include/mach/mailbox_s10.h   |  144 ++++++++
 arch/arm/mach-socfpga/include/mach/misc.h          |    2 +
 arch/arm/mach-socfpga/include/mach/reset_manager.h |    2 +
 .../mach-socfpga/include/mach/reset_manager_s10.h  |  116 ++++++
 arch/arm/mach-socfpga/include/mach/sdram_s10.h     |  183 +++++++++
 .../arm/mach-socfpga/include/mach/system_manager.h |    5 +-
 .../mach-socfpga/include/mach/system_manager_s10.h |  176 +++++++++
 arch/arm/mach-socfpga/mailbox_s10.c                |  380 +++++++++++++++++++
 arch/arm/mach-socfpga/misc.c                       |   34 ++
 arch/arm/mach-socfpga/misc_gen5.c                  |   26 +--
 arch/arm/mach-socfpga/misc_s10.c                   |  133 +++++++
 arch/arm/mach-socfpga/mmu-arm64_s10.c              |   71 ++++
 arch/arm/mach-socfpga/reset_manager.c              |   13 +
 arch/arm/mach-socfpga/reset_manager_s10.c          |  140 +++++++
 arch/arm/mach-socfpga/spl_a10.c                    |  105 ++++++
 arch/arm/mach-socfpga/{spl.c => spl_gen5.c}        |   57 +---
 arch/arm/mach-socfpga/spl_s10.c                    |  199 ++++++++++
 arch/arm/mach-socfpga/system_manager_s10.c         |   91 +++++
 arch/arm/mach-socfpga/timer_s10.c                  |   26 ++
 arch/arm/mach-socfpga/wrap_pinmux_config_s10.c     |   56 +++
 arch/arm/mach-socfpga/wrap_pll_config_s10.c        |   59 +++
 board/altera/stratix10-socdk/MAINTAINERS           |    7 +
 board/altera/stratix10-socdk/Makefile              |    7 +
 board/altera/stratix10-socdk/socfpga.c             |    7 +
 configs/socfpga_stratix10_defconfig                |   58 +++
 drivers/ddr/altera/Makefile                        |    1 +
 drivers/ddr/altera/sdram_s10.c                     |  388 ++++++++++++++++++++
 include/configs/socfpga_stratix10_socdk.h          |  222 +++++++++++
 40 files changed, 3459 insertions(+), 83 deletions(-)
 create mode 100644 arch/arm/mach-socfpga/clock_manager_s10.c
 create mode 100644 arch/arm/mach-socfpga/include/mach/clock_manager_s10.h
 create mode 100644 arch/arm/mach-socfpga/include/mach/firewall_s10.h
 create mode 100644 arch/arm/mach-socfpga/include/mach/handoff_s10.h
 create mode 100644 arch/arm/mach-socfpga/include/mach/mailbox_s10.h
 create mode 100644 arch/arm/mach-socfpga/include/mach/reset_manager_s10.h
 create mode 100644 arch/arm/mach-socfpga/include/mach/sdram_s10.h
 create mode 100644 arch/arm/mach-socfpga/include/mach/system_manager_s10.h
 create mode 100644 arch/arm/mach-socfpga/mailbox_s10.c
 create mode 100644 arch/arm/mach-socfpga/misc_s10.c
 create mode 100644 arch/arm/mach-socfpga/mmu-arm64_s10.c
 create mode 100644 arch/arm/mach-socfpga/reset_manager_s10.c
 create mode 100644 arch/arm/mach-socfpga/spl_a10.c
 rename arch/arm/mach-socfpga/{spl.c => spl_gen5.c} (82%)
 create mode 100644 arch/arm/mach-socfpga/spl_s10.c
 create mode 100644 arch/arm/mach-socfpga/system_manager_s10.c
 create mode 100644 arch/arm/mach-socfpga/timer_s10.c
 create mode 100644 arch/arm/mach-socfpga/wrap_pinmux_config_s10.c
 create mode 100644 arch/arm/mach-socfpga/wrap_pll_config_s10.c
 create mode 100644 board/altera/stratix10-socdk/MAINTAINERS
 create mode 100644 board/altera/stratix10-socdk/Makefile
 create mode 100644 board/altera/stratix10-socdk/socfpga.c
 create mode 100644 configs/socfpga_stratix10_defconfig
 create mode 100644 drivers/ddr/altera/sdram_s10.c
 create mode 100644 include/configs/socfpga_stratix10_socdk.h
#1 lore raw

PATCH v2 1/16 arm: socfpga: stratix10: Add watchdog and firewall base addresses

Add the base address for watchdog and firewall.

---
 arch/arm/mach-socfpga/include/mach/base_addr_s10.h |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
arch/arm/mach-socfpga/include/mach/base_addr_s10.h +11 -0
index 2c6e412..1f549d7 100644
@@ -6,9 +6,11 @@
 #ifndef _SOCFPGA_S10_BASE_HARDWARE_H_
 #define _SOCFPGA_S10_BASE_HARDWARE_H_
 
+#define SOCFPGA_CCU_ADDRESS			0xf7000000
 #define SOCFPGA_SDR_SCHEDULER_ADDRESS		0xf8000400
 #define SOCFPGA_HMC_MMR_IO48_ADDRESS		0xf8010000
 #define SOCFPGA_SDR_ADDRESS			0xf8011000
+#define SOCFPGA_FW_MPU_DDR_SCR_ADDRESS		0xf8020100
 #define SOCFPGA_SMMU_ADDRESS			0xfa000000
 #define SOCFPGA_MAILBOX_ADDRESS			0xffa30000
 #define SOCFPGA_UART0_ADDRESS			0xffc02000
@@ -17,12 +19,21 @@
 #define SOCFPGA_SPTIMER1_ADDRESS		0xffc03100
 #define SOCFPGA_SYSTIMER0_ADDRESS		0xffd00000
 #define SOCFPGA_SYSTIMER1_ADDRESS		0xffd00100
+#define SOCFPGA_L4WD0_ADDRESS			0xffd00200
+#define SOCFPGA_L4WD1_ADDRESS			0xffd00300
+#define SOCFPGA_L4WD2_ADDRESS			0xffd00400
+#define SOCFPGA_L4WD3_ADDRESS			0xffd00500
 #define SOCFPGA_GTIMER_SEC_ADDRESS		0xffd01000
 #define SOCFPGA_GTIMER_NSEC_ADDRESS		0xffd02000
 #define SOCFPGA_CLKMGR_ADDRESS			0xffd10000
 #define SOCFPGA_RSTMGR_ADDRESS			0xffd11000
 #define SOCFPGA_SYSMGR_ADDRESS			0xffd12000
 #define SOCFPGA_PINMUX_DEDICATED_IO_ADDRESS	0xffd13000
+#define SOCFPGA_FIREWALL_L4_PER			0xffd21000
+#define SOCFPGA_FIREWALL_L4_SYS			0xffd21100
+#define SOCFPGA_FIREWALL_SOC2FPGA		0xffd21200
+#define SOCFPGA_FIREWALL_LWSOC2FPGA		0xffd21300
+#define SOCFPGA_FIREWALL_TCU			0xffd21400
 #define SOCFPGA_DMANONSECURE_ADDRESS		0xffda0000
 #define SOCFPGA_DMASECURE_ADDRESS		0xffda1000
 #define SOCFPGA_OCRAM_ADDRESS			0xffe00000
Signature · 1 line
1.7.1
#2 lore raw

PATCH v2 2/16 arm: socfpga: stratix10: Add clock manager driver for Stratix10 SoC

In reply to Ley Foon Tan

Add Clock Manager driver support for Stratix SoC

---
 arch/arm/mach-socfpga/Makefile                     |    4 +
 arch/arm/mach-socfpga/clock_manager.c              |    4 +-
 arch/arm/mach-socfpga/clock_manager_s10.c          |  380 ++++++++++++++++++++
 arch/arm/mach-socfpga/include/mach/clock_manager.h |    2 +
 .../mach-socfpga/include/mach/clock_manager_s10.h  |  210 +++++++++++
 arch/arm/mach-socfpga/include/mach/handoff_s10.h   |   34 ++
 arch/arm/mach-socfpga/wrap_pll_config_s10.c        |   59 +++
 7 files changed, 691 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/mach-socfpga/clock_manager_s10.c
 create mode 100644 arch/arm/mach-socfpga/include/mach/clock_manager_s10.h
 create mode 100644 arch/arm/mach-socfpga/include/mach/handoff_s10.h
 create mode 100644 arch/arm/mach-socfpga/wrap_pll_config_s10.c
arch/arm/mach-socfpga/Makefile +4 -0
index 89b4fdf..6ee8ce6 100644
@@ -28,6 +28,10 @@ obj-y	+= pinmux_arria10.o
 obj-y	+= reset_manager_arria10.o
 endif
 
+ifdef CONFIG_TARGET_SOCFPGA_STRATIX10
+obj-y	+= clock_manager_s10.o
+obj-y	+= wrap_pll_config_s10.o
+endif
 ifdef CONFIG_SPL_BUILD
 obj-y	+= spl.o
 ifdef CONFIG_TARGET_SOCFPGA_GEN5
arch/arm/mach-socfpga/clock_manager.c +2 -2
index bc2c0f8..59ede59 100644
@@ -20,7 +20,7 @@ void cm_wait_for_lock(u32 mask)
 	do {
 #if defined(CONFIG_TARGET_SOCFPGA_GEN5)
 		inter_val = readl(&clock_manager_base->inter) & mask;
-#elif defined(CONFIG_TARGET_SOCFPGA_ARRIA10)
+#else
 		inter_val = readl(&clock_manager_base->stat) & mask;
 #endif
 		/* Wait for stable lock */
@@ -51,7 +51,7 @@ int set_cpu_clk_info(void)
 
 #if defined(CONFIG_TARGET_SOCFPGA_GEN5)
 	gd->bd->bi_ddr_freq = cm_get_sdram_clk_hz() / 1000000;
-#elif defined(CONFIG_TARGET_SOCFPGA_ARRIA10)
+#else
 	gd->bd->bi_ddr_freq = 0;
 #endif
 
arch/arm/mach-socfpga/clock_manager_s10.c new file +380 -0

380 lines not on this page · raw message

arch/arm/mach-socfpga/include/mach/clock_manager.h +2 -0
index 3ace040..dd80e3a 100644
@@ -16,6 +16,8 @@ void cm_print_clock_quick_summary(void);
 #include <asm/arch/clock_manager_gen5.h>
 #elif defined(CONFIG_TARGET_SOCFPGA_ARRIA10)
 #include <asm/arch/clock_manager_arria10.h>
+#elif defined(CONFIG_TARGET_SOCFPGA_STRATIX10)
+#include <asm/arch/clock_manager_s10.h>
 #endif
 
 #endif /* _CLOCK_MANAGER_H_ */
arch/arm/mach-socfpga/include/mach/clock_manager_s10.h new file +210 -0

210 lines not on this page · raw message

arch/arm/mach-socfpga/include/mach/handoff_s10.h new file +34 -0
new file mode 100644
index 0000000..ba0f1fd
@@ -0,0 +1,34 @@
+/* SPDX-License-Identifier: GPL-2.0
+ *
+ * Copyright (C) 2016-2018 Intel Corporation <www.intel.com>
+ *
+ */
+
+#ifndef _HANDOFF_S10_H_
+#define _HANDOFF_S10_H_
+
+/*
+ * Offset for HW handoff from Quartus tools
+ */
+#define S10_HANDOFF_BASE		0xFFE3F000
+#define S10_HANDOFF_MUX		(S10_HANDOFF_BASE + 0x10)
+#define S10_HANDOFF_IOCTL		(S10_HANDOFF_BASE + 0x1A0)
+#define S10_HANDOFF_FPGA		(S10_HANDOFF_BASE + 0x330)
+#define S10_HANODFF_DELAY		(S10_HANDOFF_BASE + 0x3F0)
+#define S10_HANDOFF_CLOCK		(S10_HANDOFF_BASE + 0x580)
+#define S10_HANDOFF_MISC		(S10_HANDOFF_BASE + 0x610)
+#define S10_HANDOFF_MAGIC_MUX	0x504D5558
+#define S10_HANDOFF_MAGIC_IOCTL	0x494F4354
+#define S10_HANDOFF_MAGIC_FPGA	0x46504741
+#define S10_HANDOFF_MAGIC_DELAY	0x444C4159
+#define S10_HANDOFF_MAGIC_CLOCK	0x434C4B53
+#define S10_HANDOFF_MAGIC_MISC	0x4D495343
+#define S10_HANDOFF_OFFSET_LENGTH	0x4
+#define S10_HANDOFF_OFFSET_DATA	0x10
+
+#define S10_HANDOFF_CLOCK_OSC	(S10_HANDOFF_BASE + 0x608)
+#define S10_HANDOFF_CLOCK_FPGA	(S10_HANDOFF_BASE + 0x60C)
+
+#define S10_HANDOFF_SIZE	4096
+
+#endif /* _HANDOFF_S10_H_ */
arch/arm/mach-socfpga/wrap_pll_config_s10.c new file +59 -0

59 lines not on this page · raw message

Signature · 1 line
1.7.1
#3 lore raw

PATCH v2 3/16 arm: socfpga: stratix10: Add reset manager driver for Stratix10 SoC

In reply to Ley Foon Tan

Add Reset Manager driver support for Stratix SoC

---
 arch/arm/mach-socfpga/Makefile                     |    1 +
 arch/arm/mach-socfpga/include/mach/reset_manager.h |    2 +
 .../mach-socfpga/include/mach/reset_manager_s10.h  |  116 ++++++++++++++++
 arch/arm/mach-socfpga/reset_manager.c              |   13 ++
 arch/arm/mach-socfpga/reset_manager_s10.c          |  140 ++++++++++++++++++++
 5 files changed, 272 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-socfpga/include/mach/reset_manager_s10.h
 create mode 100644 arch/arm/mach-socfpga/reset_manager_s10.c
arch/arm/mach-socfpga/Makefile +1 -0
index 6ee8ce6..69bdb84 100644
@@ -30,6 +30,7 @@ endif
 
 ifdef CONFIG_TARGET_SOCFPGA_STRATIX10
 obj-y	+= clock_manager_s10.o
+obj-y	+= reset_manager_s10.o
 obj-y	+= wrap_pll_config_s10.o
 endif
 ifdef CONFIG_SPL_BUILD
arch/arm/mach-socfpga/include/mach/reset_manager.h +2 -0
index 7cfed7d..075da07 100644
@@ -44,6 +44,8 @@ void socfpga_per_reset_all(void);
 #include <asm/arch/reset_manager_gen5.h>
 #elif defined(CONFIG_TARGET_SOCFPGA_ARRIA10)
 #include <asm/arch/reset_manager_arria10.h>
+#elif defined(CONFIG_TARGET_SOCFPGA_STRATIX10)
+#include <asm/arch/reset_manager_s10.h>
 #endif
 
 #endif /* _RESET_MANAGER_H_ */
arch/arm/mach-socfpga/include/mach/reset_manager_s10.h new file +116 -0

116 lines not on this page · raw message

arch/arm/mach-socfpga/reset_manager.c +13 -0
index 1389c82..e0a01ed 100644
@@ -8,8 +8,16 @@
 #include <asm/io.h>
 #include <asm/arch/reset_manager.h>
 
+#if defined(CONFIG_TARGET_SOCFPGA_STRATIX10)
+#include <asm/arch/mailbox_s10.h>
+#endif
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#if !defined(CONFIG_TARGET_SOCFPGA_STRATIX10)
 static const struct socfpga_reset_manager *reset_manager_base =
 		(void *)SOCFPGA_RSTMGR_ADDRESS;
+#endif
 
 /*
  * Write the reset manager register to cause reset
@@ -17,8 +25,13 @@ static const struct socfpga_reset_manager *reset_manager_base =
 void reset_cpu(ulong addr)
 {
 	/* request a warm reset */
+#if defined(CONFIG_TARGET_SOCFPGA_STRATIX10)
+	puts("Mailbox: Issuing mailbox cmd REBOOT_HPS\n");
+	mbox_reset_cold();
+#else
 	writel(1 << RSTMGR_CTRL_SWWARMRSTREQ_LSB,
 	       &reset_manager_base->ctrl);
+#endif
 	/*
 	 * infinite loop here as watchdog will trigger and reset
 	 * the processor
arch/arm/mach-socfpga/reset_manager_s10.c new file +140 -0

140 lines not on this page · raw message

Signature · 1 line
1.7.1
#4 lore raw

PATCH v2 4/16 arm: socfpga: stratix10: Add pinmux support for Stratix10 SoC

In reply to Ley Foon Tan

Add pinmux driver support for Stratix SoC

---
 arch/arm/mach-socfpga/Makefile                     |    2 +
 .../arm/mach-socfpga/include/mach/system_manager.h |    5 +-
 .../mach-socfpga/include/mach/system_manager_s10.h |  176 ++++++++++++++++++++
 arch/arm/mach-socfpga/system_manager_s10.c         |   91 ++++++++++
 arch/arm/mach-socfpga/wrap_pinmux_config_s10.c     |   56 ++++++
 5 files changed, 329 insertions(+), 1 deletions(-)
 create mode 100644 arch/arm/mach-socfpga/include/mach/system_manager_s10.h
 create mode 100644 arch/arm/mach-socfpga/system_manager_s10.c
 create mode 100644 arch/arm/mach-socfpga/wrap_pinmux_config_s10.c
arch/arm/mach-socfpga/Makefile +2 -0
index 69bdb84..61f5778 100644
@@ -31,6 +31,8 @@ endif
 ifdef CONFIG_TARGET_SOCFPGA_STRATIX10
 obj-y	+= clock_manager_s10.o
 obj-y	+= reset_manager_s10.o
+obj-y	+= system_manager_s10.o
+obj-y	+= wrap_pinmux_config_s10.o
 obj-y	+= wrap_pll_config_s10.o
 endif
 ifdef CONFIG_SPL_BUILD
arch/arm/mach-socfpga/include/mach/system_manager.h +4 -1
index fbe2a8b..7e76df7 100644
@@ -6,6 +6,9 @@
 #ifndef _SYSTEM_MANAGER_H_
 #define _SYSTEM_MANAGER_H_
 
+#if defined(CONFIG_TARGET_SOCFPGA_STRATIX10)
+#include <asm/arch/system_manager_s10.h>
+#else
 #define SYSMGR_ROMCODEGRP_CTRL_WARMRSTCFGPINMUX	BIT(0)
 #define SYSMGR_ROMCODEGRP_CTRL_WARMRSTCFGIO	BIT(1)
 #define SYSMGR_ECC_OCRAM_EN	BIT(0)
@@ -88,5 +91,5 @@
 
 #define SYSMGR_GET_BOOTINFO_BSEL(bsel)		\
 		(((bsel) >> SYSMGR_BOOTINFO_BSEL_SHIFT) & 7)
-
+#endif
 #endif /* _SYSTEM_MANAGER_H_ */
arch/arm/mach-socfpga/include/mach/system_manager_s10.h new file +176 -0

176 lines not on this page · raw message

arch/arm/mach-socfpga/system_manager_s10.c new file +91 -0

91 lines not on this page · raw message

arch/arm/mach-socfpga/wrap_pinmux_config_s10.c new file +56 -0

56 lines not on this page · raw message

Signature · 1 line
1.7.1
#5 lore raw

PATCH v2 4/16 arm: socfpga: stratix10: Add pinmux support for Stratix10 SoC

Quoted 353 lines · Ley Foon Tan

Add pinmux driver support for Stratix SoC

---
 arch/arm/mach-socfpga/Makefile                     |    2 +
 .../arm/mach-socfpga/include/mach/system_manager.h |    5 +-
 .../mach-socfpga/include/mach/system_manager_s10.h |  176 ++++++++++++++++++++
 arch/arm/mach-socfpga/system_manager_s10.c         |   91 ++++++++++
 arch/arm/mach-socfpga/wrap_pinmux_config_s10.c     |   56 ++++++
 5 files changed, 329 insertions(+), 1 deletions(-)
 create mode 100644 arch/arm/mach-socfpga/include/mach/system_manager_s10.h
 create mode 100644 arch/arm/mach-socfpga/system_manager_s10.c
 create mode 100644 arch/arm/mach-socfpga/wrap_pinmux_config_s10.c
arch/arm/mach-socfpga/Makefile +2 -0
index 69bdb84..61f5778 100644
@@ -31,6 +31,8 @@ endif
 ifdef CONFIG_TARGET_SOCFPGA_STRATIX10
 obj-y	+= clock_manager_s10.o
 obj-y	+= reset_manager_s10.o
+obj-y	+= system_manager_s10.o
+obj-y	+= wrap_pinmux_config_s10.o
 obj-y	+= wrap_pll_config_s10.o
 endif
 ifdef CONFIG_SPL_BUILD
arch/arm/mach-socfpga/include/mach/system_manager.h +4 -1
index fbe2a8b..7e76df7 100644
@@ -6,6 +6,9 @@
 #ifndef _SYSTEM_MANAGER_H_
 #define _SYSTEM_MANAGER_H_
 
+#if defined(CONFIG_TARGET_SOCFPGA_STRATIX10)
+#include <asm/arch/system_manager_s10.h>
+#else
 #define SYSMGR_ROMCODEGRP_CTRL_WARMRSTCFGPINMUX	BIT(0)
 #define SYSMGR_ROMCODEGRP_CTRL_WARMRSTCFGIO	BIT(1)
 #define SYSMGR_ECC_OCRAM_EN	BIT(0)
@@ -88,5 +91,5 @@
 
 #define SYSMGR_GET_BOOTINFO_BSEL(bsel)		\
 		(((bsel) >> SYSMGR_BOOTINFO_BSEL_SHIFT) & 7)
-
+#endif
 #endif /* _SYSTEM_MANAGER_H_ */
arch/arm/mach-socfpga/include/mach/system_manager_s10.h new file +176 -0
new file mode 100644
index 0000000..813dff2
@@ -0,0 +1,176 @@
+/* SPDX-License-Identifier: GPL-2.0
+ *
+ * Copyright (C) 2016-2018 Intel Corporation <www.intel.com>
+ *
+ */
+
+#ifndef	_SYSTEM_MANAGER_S10_
+#define	_SYSTEM_MANAGER_S10_
+
+void sysmgr_pinmux_init(void);
+void populate_sysmgr_fpgaintf_module(void);
+void populate_sysmgr_pinmux(void);
+void sysmgr_pinmux_table_sel(const u32 **table, unsigned int *table_len);
+void sysmgr_pinmux_table_ctrl(const u32 **table, unsigned int *table_len);
+void sysmgr_pinmux_table_fpga(const u32 **table, unsigned int *table_len);
+void sysmgr_pinmux_table_delay(const u32 **table, unsigned int *table_len);
+
+struct socfpga_system_manager {
+	/* System Manager Module */
+	u32	siliconid1;			/* 0x00 */
+	u32	siliconid2;
+	u32	wddbg;
+	u32	_pad_0xc;
+	u32	mpu_status;			/* 0x10 */
+	u32	mpu_ace;
+	u32	_pad_0x18_0x1c[2];
+	u32	dma;				/* 0x20 */
+	u32	dma_periph;
+	/* SDMMC Controller Group */
+	u32	sdmmcgrp_ctrl;
+	u32	sdmmcgrp_l3master;
+	/* NAND Flash Controller Register Group */
+	u32	nandgrp_bootstrap;		/* 0x30 */
+	u32	nandgrp_l3master;
+	/* USB Controller Group */
+	u32	usb0_l3master;
+	u32	usb1_l3master;
+	/* EMAC Group */
+	u32	emac_gbl;			/* 0x40 */
+	u32	emac0;
+	u32	emac1;
+	u32	emac2;
+	u32	emac0_ace;			/* 0x50 */
+	u32	emac1_ace;
+	u32	emac2_ace;
+	u32	nand_axuser;
+	u32	_pad_0x60_0x64[2];		/* 0x60 */
+	/* FPGA interface Group */
+	u32	fpgaintf_en_1;
+	u32	fpgaintf_en_2;
+	u32	fpgaintf_en_3;			/* 0x70 */
+	u32	dma_l3master;
+	u32	etr_l3master;
+	u32	_pad_0x7c;
+	u32	sec_ctrl_slt;			/* 0x80 */
+	u32	osc_trim;
+	u32	_pad_0x88_0x8c[2];
+	/* ECC Group */
+	u32	ecc_intmask_value;		/* 0x90 */
+	u32	ecc_intmask_set;
+	u32	ecc_intmask_clr;
+	u32	ecc_intstatus_serr;
+	u32	ecc_intstatus_derr;		/* 0xa0 */
+	u32	_pad_0xa4_0xac[3];
+	u32	noc_addr_remap;			/* 0xb0 */
+	u32	hmc_clk;
+	u32	io_pa_ctrl;
+	u32	_pad_0xbc;
+	/* NOC Group */
+	u32	noc_timeout;			/* 0xc0 */
+	u32	noc_idlereq_set;
+	u32	noc_idlereq_clr;
+	u32	noc_idlereq_value;
+	u32	noc_idleack;			/* 0xd0 */
+	u32	noc_idlestatus;
+	u32	fpga2soc_ctrl;
+	u32	fpga_config;
+	u32	iocsrclk_gate;			/* 0xe0 */
+	u32	gpo;
+	u32	gpi;
+	u32	_pad_0xec;
+	u32	mpu;				/* 0xf0 */
+	u32	sdm_hps_spare;
+	u32	hps_sdm_spare;
+	u32	_pad_0xfc_0x1fc[65];
+	/* Boot scratch register group */
+	u32	boot_scratch_cold0;		/* 0x200 */
+	u32	boot_scratch_cold1;
+	u32	boot_scratch_cold2;
+	u32	boot_scratch_cold3;
+	u32	boot_scratch_cold4;		/* 0x210 */
+	u32	boot_scratch_cold5;
+	u32	boot_scratch_cold6;
+	u32	boot_scratch_cold7;
+	u32	boot_scratch_cold8;		/* 0x220 */
+	u32	boot_scratch_cold9;
+	u32	_pad_0x228_0xffc[886];
+	/* Pin select and pin control group */
+	u32	pinsel0[40];			/* 0x1000 */
+	u32	_pad_0x10a0_0x10fc[24];
+	u32	pinsel40[8];
+	u32	_pad_0x1120_0x112c[4];
+	u32	ioctrl0[28];
+	u32	_pad_0x11a0_0x11fc[24];
+	u32	ioctrl28[20];
+	u32	_pad_0x1250_0x12fc[44];
+	/* Use FPGA mux */
+	u32	rgmii0usefpga;			/* 0x1300 */
+	u32	rgmii1usefpga;
+	u32	rgmii2usefpga;
+	u32	i2c0usefpga;
+	u32	i2c1usefpga;
+	u32	i2c_emac0_usefpga;
+	u32	i2c_emac1_usefpga;
+	u32	i2c_emac2_usefpga;
+	u32	nandusefpga;
+	u32	_pad_0x1324;
+	u32	spim0usefpga;
+	u32	spim1usefpga;
+	u32	spis0usefpga;
+	u32	spis1usefpga;
+	u32	uart0usefpga;
+	u32	uart1usefpga;
+	u32	mdio0usefpga;
+	u32	mdio1usefpga;
+	u32	mdio2usefpga;
+	u32	_pad_0x134c;
+	u32	jtagusefpga;
+	u32	sdmmcusefpga;
+	u32	hps_osc_clk;
+	u32	_pad_0x135c_0x13fc[41];
+	u32	iodelay0[40];
+	u32	_pad_0x14a0_0x14fc[24];
+	u32	iodelay40[8];
+
+};
+
+#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_NAND	BIT(4)
+#define SYSMGR_FPGAINTF_SDMMC	BIT(8)
+#define SYSMGR_FPGAINTF_SPIM0	BIT(16)
+#define SYSMGR_FPGAINTF_SPIM1	BIT(24)
+#define SYSMGR_FPGAINTF_EMAC0	(0x11 << 0)
+#define SYSMGR_FPGAINTF_EMAC1	(0x11 << 8)
+#define SYSMGR_FPGAINTF_EMAC2	(0x11 << 16)
+
+#define SYSMGR_SDMMC_SMPLSEL_SHIFT	4
+#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_NOC_H2F_MSK		0x00000001
+#define SYSMGR_NOC_LWH2F_MSK		0x00000010
+#define SYSMGR_HMC_CLK_STATUS_MSK	0x00000001
+
+#define SYSMGR_DMA_IRQ_NS		0xFF000000
+#define SYSMGR_DMA_MGR_NS		0x00010000
+
+#define SYSMGR_DMAPERIPH_ALL_NS		0xFFFFFFFF
+
+#define SYSMGR_WDDBG_PAUSE_ALL_CPU	0x0F0F0F0F
+
+#endif /* _SYSTEM_MANAGER_S10_ */
arch/arm/mach-socfpga/system_manager_s10.c new file +91 -0
new file mode 100644
index 0000000..122828c
@@ -0,0 +1,91 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2016-2018 Intel Corporation <www.intel.com>
+ *
+ */
+
+#include <common.h>
+#include <asm/io.h>
+#include <asm/arch/system_manager.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+static struct socfpga_system_manager *sysmgr_regs =
+	(struct socfpga_system_manager *)SOCFPGA_SYSMGR_ADDRESS;
+
+/*
+ * Configure all the pin muxes
+ */
+void sysmgr_pinmux_init(void)
+{
+	populate_sysmgr_pinmux();
+	populate_sysmgr_fpgaintf_module();
+}
+
+/*
+ * Populate the value for SYSMGR.FPGAINTF.MODULE based on pinmux setting.
+ * The value is not wrote to SYSMGR.FPGAINTF.MODULE but
+ * CONFIG_SYSMGR_ISWGRP_HANDOFF.
+ */
+void populate_sysmgr_fpgaintf_module(void)
+{
+	u32 handoff_val = 0;
+
+	/* Enable the signal for those HPS peripherals that use FPGA. */
+	if (readl(&sysmgr_regs->nandusefpga) == SYSMGR_FPGAINTF_USEFPGA)
+		handoff_val |= SYSMGR_FPGAINTF_NAND;
+	if (readl(&sysmgr_regs->sdmmcusefpga) == SYSMGR_FPGAINTF_USEFPGA)
+		handoff_val |= SYSMGR_FPGAINTF_SDMMC;
+	if (readl(&sysmgr_regs->spim0usefpga) == SYSMGR_FPGAINTF_USEFPGA)
+		handoff_val |= SYSMGR_FPGAINTF_SPIM0;
+	if (readl(&sysmgr_regs->spim1usefpga) == SYSMGR_FPGAINTF_USEFPGA)
+		handoff_val |= SYSMGR_FPGAINTF_SPIM1;
+	writel(handoff_val, &sysmgr_regs->fpgaintf_en_2);
+
+	handoff_val = 0;
+	if (readl(&sysmgr_regs->rgmii0usefpga) == SYSMGR_FPGAINTF_USEFPGA)
+		handoff_val |= SYSMGR_FPGAINTF_EMAC0;
+	if (readl(&sysmgr_regs->rgmii1usefpga) == SYSMGR_FPGAINTF_USEFPGA)
+		handoff_val |= SYSMGR_FPGAINTF_EMAC1;
+	if (readl(&sysmgr_regs->rgmii2usefpga) == SYSMGR_FPGAINTF_USEFPGA)
+		handoff_val |= SYSMGR_FPGAINTF_EMAC2;
+	writel(handoff_val, &sysmgr_regs->fpgaintf_en_3);
+}
+
+/*
+ * Configure all the pin muxes
+ */
+void populate_sysmgr_pinmux(void)
+{
+	const u32 *sys_mgr_table_u32;
+	unsigned int len, i;
+
+	/* setup the pin sel */
+	sysmgr_pinmux_table_sel(&sys_mgr_table_u32, &len);
+	for (i = 0; i < len; i = i + 2) {
+		writel(sys_mgr_table_u32[i + 1],
+		       sys_mgr_table_u32[i] + (u8 *)&sysmgr_regs->pinsel0[0]);
+	}
+
+	/* setup the pin ctrl */
+	sysmgr_pinmux_table_ctrl(&sys_mgr_table_u32, &len);
+	for (i = 0; i < len; i = i + 2) {
+		writel(sys_mgr_table_u32[i + 1],
+		       sys_mgr_table_u32[i] + (u8 *)&sysmgr_regs->ioctrl0[0]);
+	}
+
+	/* setup the fpga use */
+	sysmgr_pinmux_table_fpga(&sys_mgr_table_u32, &len);
+	for (i = 0; i < len; i = i + 2) {
+		writel(sys_mgr_table_u32[i + 1],
+		       sys_mgr_table_u32[i] +
+		       (u8 *)&sysmgr_regs->rgmii0usefpga);
+	}
+
+	/* setup the IO delay */
+	sysmgr_pinmux_table_delay(&sys_mgr_table_u32, &len);
+	for (i = 0; i < len; i = i + 2) {
+		writel(sys_mgr_table_u32[i + 1],
+		       sys_mgr_table_u32[i] + (u8 *)&sysmgr_regs->iodelay0[0]);
+	}
+}
arch/arm/mach-socfpga/wrap_pinmux_config_s10.c new file +19 -0
new file mode 100644
index 0000000..0b497ec
@@ -0,0 +1,56 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2016-2018 Intel Corporation <www.intel.com>
+ *
+ */
+
+#include <common.h>
+#include <errno.h>
+#include <asm/io.h>
+#include <asm/arch/handoff_s10.h>
+
+static void sysmgr_pinmux_handoff_read(void *handoff_address,
+				       const u32 **table,
+				       unsigned int *table_len)
+{
+	unsigned int handoff_entry = (swab32(readl(handoff_address +
+					S10_HANDOFF_OFFSET_LENGTH)) -
+					S10_HANDOFF_OFFSET_DATA) /
+					sizeof(unsigned int);

arch/arm/mach-socfpga/wrap_pinmux_config_s10.c line 29

Quoted 10 lines
arch/arm/mach-socfpga/wrap_pinmux_config_s10.c new file +10 -0
+	unsigned int handoff_chunk[handoff_entry], temp, i;
+
+	if (swab32(readl(S10_HANDOFF_MUX)) == S10_HANDOFF_MAGIC_MUX) {
+		/* using handoff from Quartus tools if exists */
+		for (i = 0; i < handoff_entry; i++) {
+			temp = readl(handoff_address +
+				     S10_HANDOFF_OFFSET_DATA + (i * 4));
+			handoff_chunk[i] = swab32(temp);
+		}
+		*table = handoff_chunk;

Here you are passing a variable that only exists on the stack to the caller. Shouldn't you either define handoff_chunk as static or malloc it?

Indicated by CppCheck as [arch/arm/mach-socfpga/wrap_pinmux_config_s10.c:29]:
(error) Address of local auto-variable assigned to a function parameter.

Best regards

Heinrich

Quoted 28 lines
arch/arm/mach-socfpga/wrap_pinmux_config_s10.c new file +27 -0
+		*table_len = ARRAY_SIZE(handoff_chunk);
+	}
+}
+
+void sysmgr_pinmux_table_sel(const u32 **table, unsigned int *table_len)
+{
+	sysmgr_pinmux_handoff_read((void *)S10_HANDOFF_MUX, table,
+				   table_len);
+}
+
+void sysmgr_pinmux_table_ctrl(const u32 **table, unsigned int *table_len)
+{
+	sysmgr_pinmux_handoff_read((void *)S10_HANDOFF_IOCTL, table,
+				   table_len);
+}
+
+void sysmgr_pinmux_table_fpga(const u32 **table, unsigned int *table_len)
+{
+	sysmgr_pinmux_handoff_read((void *)S10_HANDOFF_FPGA, table,
+				   table_len);
+}
+
+void sysmgr_pinmux_table_delay(const u32 **table, unsigned int *table_len)
+{
+	sysmgr_pinmux_handoff_read((void *)S10_HANODFF_DELAY, table,
+				   table_len);
+}
#6 lore raw

PATCH v2 4/16 arm: socfpga: stratix10: Add pinmux support for Stratix10 SoC

Quoted 394 lines

-----Original Message-----
From: Heinrich Schuchardt <[email protected]>
Sent: Sunday, June 7, 2020 7:07 AM
To: Tan, Ley Foon <[email protected]>; u-boot at lists.denx.de
Cc: Marek Vasut <[email protected]>; See, Chin Liang <[email protected]>; Tom Rini <[email protected]>
Subject: Re: [U-Boot] [PATCH v2 04/16] arm: socfpga: stratix10: Add pinmux support for Stratix10 SoC

Quoted 8 lines · Ley Foon Tan

Add pinmux driver support for Stratix SoC

---
 arch/arm/mach-socfpga/Makefile                     |    2 +
 .../arm/mach-socfpga/include/mach/system_manager.h |    5 +-
 .../mach-socfpga/include/mach/system_manager_s10.h |  176

++++++++++++++++++++

Quoted 249 lines
 arch/arm/mach-socfpga/system_manager_s10.c         |   91 ++++++++++
 arch/arm/mach-socfpga/wrap_pinmux_config_s10.c     |   56 ++++++
 5 files changed, 329 insertions(+), 1 deletions(-)  create mode
100644 arch/arm/mach-socfpga/include/mach/system_manager_s10.h
 create mode 100644 arch/arm/mach-socfpga/system_manager_s10.c
 create mode 100644 arch/arm/mach-socfpga/wrap_pinmux_config_s10.c
(quoted diff) +0 -0

b/arch/arm/mach-socfpga/Makefile index 69bdb84..61f5778 100644

arch/arm/mach-socfpga/Makefile +2 -0
@@ -31,6 +31,8 @@ endif
 ifdef CONFIG_TARGET_SOCFPGA_STRATIX10
 obj-y	+= clock_manager_s10.o
 obj-y	+= reset_manager_s10.o
+obj-y	+= system_manager_s10.o
+obj-y	+= wrap_pinmux_config_s10.o
 obj-y	+= wrap_pll_config_s10.o
 endif
 ifdef CONFIG_SPL_BUILD
arch/arm/mach-socfpga/include/mach/system_manager.h +3 -1
index fbe2a8b..7e76df7 100644
@@ -6,6 +6,9 @@
 #ifndef _SYSTEM_MANAGER_H_
 #define _SYSTEM_MANAGER_H_
 
+#if defined(CONFIG_TARGET_SOCFPGA_STRATIX10)
+#include <asm/arch/system_manager_s10.h> #else
 #define SYSMGR_ROMCODEGRP_CTRL_WARMRSTCFGPINMUX	BIT(0)
 #define SYSMGR_ROMCODEGRP_CTRL_WARMRSTCFGIO	BIT(1)
 #define SYSMGR_ECC_OCRAM_EN	BIT(0)
@@ -88,5 +91,5 @@
 
 #define SYSMGR_GET_BOOTINFO_BSEL(bsel)		\
 		(((bsel) >> SYSMGR_BOOTINFO_BSEL_SHIFT) & 7)
-
+#endif
 #endif /* _SYSTEM_MANAGER_H_ */
arch/arm/mach-socfpga/include/mach/system_manager_s10.h new file +178 -0
new file mode 100644
index 0000000..813dff2
@@ -0,0 +1,176 @@
+/* SPDX-License-Identifier: GPL-2.0
+ *
+ * Copyright (C) 2016-2018 Intel Corporation <www.intel.com>
+ *
+ */
+
+#ifndef	_SYSTEM_MANAGER_S10_
+#define	_SYSTEM_MANAGER_S10_
+
+void sysmgr_pinmux_init(void);
+void populate_sysmgr_fpgaintf_module(void);
+void populate_sysmgr_pinmux(void);
+void sysmgr_pinmux_table_sel(const u32 **table, unsigned int
+*table_len); void sysmgr_pinmux_table_ctrl(const u32 **table,
+unsigned int *table_len); void sysmgr_pinmux_table_fpga(const u32
+**table, unsigned int *table_len); void
+sysmgr_pinmux_table_delay(const u32 **table, unsigned int
+*table_len);
+
+struct socfpga_system_manager {
+	/* System Manager Module */
+	u32	siliconid1;			/* 0x00 */
+	u32	siliconid2;
+	u32	wddbg;
+	u32	_pad_0xc;
+	u32	mpu_status;			/* 0x10 */
+	u32	mpu_ace;
+	u32	_pad_0x18_0x1c[2];
+	u32	dma;				/* 0x20 */
+	u32	dma_periph;
+	/* SDMMC Controller Group */
+	u32	sdmmcgrp_ctrl;
+	u32	sdmmcgrp_l3master;
+	/* NAND Flash Controller Register Group */
+	u32	nandgrp_bootstrap;		/* 0x30 */
+	u32	nandgrp_l3master;
+	/* USB Controller Group */
+	u32	usb0_l3master;
+	u32	usb1_l3master;
+	/* EMAC Group */
+	u32	emac_gbl;			/* 0x40 */
+	u32	emac0;
+	u32	emac1;
+	u32	emac2;
+	u32	emac0_ace;			/* 0x50 */
+	u32	emac1_ace;
+	u32	emac2_ace;
+	u32	nand_axuser;
+	u32	_pad_0x60_0x64[2];		/* 0x60 */
+	/* FPGA interface Group */
+	u32	fpgaintf_en_1;
+	u32	fpgaintf_en_2;
+	u32	fpgaintf_en_3;			/* 0x70 */
+	u32	dma_l3master;
+	u32	etr_l3master;
+	u32	_pad_0x7c;
+	u32	sec_ctrl_slt;			/* 0x80 */
+	u32	osc_trim;
+	u32	_pad_0x88_0x8c[2];
+	/* ECC Group */
+	u32	ecc_intmask_value;		/* 0x90 */
+	u32	ecc_intmask_set;
+	u32	ecc_intmask_clr;
+	u32	ecc_intstatus_serr;
+	u32	ecc_intstatus_derr;		/* 0xa0 */
+	u32	_pad_0xa4_0xac[3];
+	u32	noc_addr_remap;			/* 0xb0 */
+	u32	hmc_clk;
+	u32	io_pa_ctrl;
+	u32	_pad_0xbc;
+	/* NOC Group */
+	u32	noc_timeout;			/* 0xc0 */
+	u32	noc_idlereq_set;
+	u32	noc_idlereq_clr;
+	u32	noc_idlereq_value;
+	u32	noc_idleack;			/* 0xd0 */
+	u32	noc_idlestatus;
+	u32	fpga2soc_ctrl;
+	u32	fpga_config;
+	u32	iocsrclk_gate;			/* 0xe0 */
+	u32	gpo;
+	u32	gpi;
+	u32	_pad_0xec;
+	u32	mpu;				/* 0xf0 */
+	u32	sdm_hps_spare;
+	u32	hps_sdm_spare;
+	u32	_pad_0xfc_0x1fc[65];
+	/* Boot scratch register group */
+	u32	boot_scratch_cold0;		/* 0x200 */
+	u32	boot_scratch_cold1;
+	u32	boot_scratch_cold2;
+	u32	boot_scratch_cold3;
+	u32	boot_scratch_cold4;		/* 0x210 */
+	u32	boot_scratch_cold5;
+	u32	boot_scratch_cold6;
+	u32	boot_scratch_cold7;
+	u32	boot_scratch_cold8;		/* 0x220 */
+	u32	boot_scratch_cold9;
+	u32	_pad_0x228_0xffc[886];
+	/* Pin select and pin control group */
+	u32	pinsel0[40];			/* 0x1000 */
+	u32	_pad_0x10a0_0x10fc[24];
+	u32	pinsel40[8];
+	u32	_pad_0x1120_0x112c[4];
+	u32	ioctrl0[28];
+	u32	_pad_0x11a0_0x11fc[24];
+	u32	ioctrl28[20];
+	u32	_pad_0x1250_0x12fc[44];
+	/* Use FPGA mux */
+	u32	rgmii0usefpga;			/* 0x1300 */
+	u32	rgmii1usefpga;
+	u32	rgmii2usefpga;
+	u32	i2c0usefpga;
+	u32	i2c1usefpga;
+	u32	i2c_emac0_usefpga;
+	u32	i2c_emac1_usefpga;
+	u32	i2c_emac2_usefpga;
+	u32	nandusefpga;
+	u32	_pad_0x1324;
+	u32	spim0usefpga;
+	u32	spim1usefpga;
+	u32	spis0usefpga;
+	u32	spis1usefpga;
+	u32	uart0usefpga;
+	u32	uart1usefpga;
+	u32	mdio0usefpga;
+	u32	mdio1usefpga;
+	u32	mdio2usefpga;
+	u32	_pad_0x134c;
+	u32	jtagusefpga;
+	u32	sdmmcusefpga;
+	u32	hps_osc_clk;
+	u32	_pad_0x135c_0x13fc[41];
+	u32	iodelay0[40];
+	u32	_pad_0x14a0_0x14fc[24];
+	u32	iodelay40[8];
+
+};
+
+#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_NAND	BIT(4)
+#define SYSMGR_FPGAINTF_SDMMC	BIT(8)
+#define SYSMGR_FPGAINTF_SPIM0	BIT(16)
+#define SYSMGR_FPGAINTF_SPIM1	BIT(24)
+#define SYSMGR_FPGAINTF_EMAC0	(0x11 << 0)
+#define SYSMGR_FPGAINTF_EMAC1	(0x11 << 8)
+#define SYSMGR_FPGAINTF_EMAC2	(0x11 << 16)
+
+#define SYSMGR_SDMMC_SMPLSEL_SHIFT	4
+#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_NOC_H2F_MSK		0x00000001
+#define SYSMGR_NOC_LWH2F_MSK		0x00000010
+#define SYSMGR_HMC_CLK_STATUS_MSK	0x00000001
+
+#define SYSMGR_DMA_IRQ_NS		0xFF000000
+#define SYSMGR_DMA_MGR_NS		0x00010000
+
+#define SYSMGR_DMAPERIPH_ALL_NS		0xFFFFFFFF
+
+#define SYSMGR_WDDBG_PAUSE_ALL_CPU	0x0F0F0F0F
+
+#endif /* _SYSTEM_MANAGER_S10_ */
arch/arm/mach-socfpga/system_manager_s10.c new file +16 -0
new file mode 100644
index 0000000..122828c
@@ -0,0 +1,91 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2016-2018 Intel Corporation <www.intel.com>
+ *
+ */
+
+#include <common.h>
+#include <asm/io.h>
+#include <asm/arch/system_manager.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+static struct socfpga_system_manager *sysmgr_regs =
+	(struct socfpga_system_manager *)SOCFPGA_SYSMGR_ADDRESS;
+
+/*

arch/arm/mach-socfpga/system_manager_s10.c line 26

Quoted 10 lines
arch/arm/mach-socfpga/system_manager_s10.c new file +10 -0
+ * Configure all the pin muxes
+ */
+void sysmgr_pinmux_init(void)
+{
+	populate_sysmgr_pinmux();
+	populate_sysmgr_fpgaintf_module();
+}
+
+/*
+ * Populate the value for SYSMGR.FPGAINTF.MODULE based on pinmux

setting.

arch/arm/mach-socfpga/system_manager_s10.c

Quoted 9 lines
arch/arm/mach-socfpga/system_manager_s10.c new file +9 -0
+ * The value is not wrote to SYSMGR.FPGAINTF.MODULE but
+ * CONFIG_SYSMGR_ISWGRP_HANDOFF.
+ */
+void populate_sysmgr_fpgaintf_module(void)
+{
+	u32 handoff_val = 0;
+
+	/* Enable the signal for those HPS peripherals that use FPGA. */
+	if (readl(&sysmgr_regs->nandusefpga) ==

SYSMGR_FPGAINTF_USEFPGA)

arch/arm/mach-socfpga/system_manager_s10.c line 37

Quoted 2 lines
arch/arm/mach-socfpga/system_manager_s10.c new file +2 -0
+		handoff_val |= SYSMGR_FPGAINTF_NAND;
+	if (readl(&sysmgr_regs->sdmmcusefpga) ==

SYSMGR_FPGAINTF_USEFPGA)

arch/arm/mach-socfpga/system_manager_s10.c line 39

Quoted 2 lines
arch/arm/mach-socfpga/system_manager_s10.c new file +2 -0
+		handoff_val |= SYSMGR_FPGAINTF_SDMMC;
+	if (readl(&sysmgr_regs->spim0usefpga) ==

SYSMGR_FPGAINTF_USEFPGA)

arch/arm/mach-socfpga/system_manager_s10.c line 41

Quoted 2 lines
arch/arm/mach-socfpga/system_manager_s10.c new file +2 -0
+		handoff_val |= SYSMGR_FPGAINTF_SPIM0;
+	if (readl(&sysmgr_regs->spim1usefpga) ==

SYSMGR_FPGAINTF_USEFPGA)

arch/arm/mach-socfpga/system_manager_s10.c

Quoted 5 lines
arch/arm/mach-socfpga/system_manager_s10.c new file +5 -0
+		handoff_val |= SYSMGR_FPGAINTF_SPIM1;
+	writel(handoff_val, &sysmgr_regs->fpgaintf_en_2);
+
+	handoff_val = 0;
+	if (readl(&sysmgr_regs->rgmii0usefpga) ==

SYSMGR_FPGAINTF_USEFPGA)

arch/arm/mach-socfpga/system_manager_s10.c line 48

Quoted 2 lines
arch/arm/mach-socfpga/system_manager_s10.c new file +2 -0
+		handoff_val |= SYSMGR_FPGAINTF_EMAC0;
+	if (readl(&sysmgr_regs->rgmii1usefpga) ==

SYSMGR_FPGAINTF_USEFPGA)

arch/arm/mach-socfpga/system_manager_s10.c line 50

Quoted 2 lines
arch/arm/mach-socfpga/system_manager_s10.c new file +2 -0
+		handoff_val |= SYSMGR_FPGAINTF_EMAC1;
+	if (readl(&sysmgr_regs->rgmii2usefpga) ==

SYSMGR_FPGAINTF_USEFPGA)

Quoted 60 lines
arch/arm/mach-socfpga/system_manager_s10.c new file +38 -0
+		handoff_val |= SYSMGR_FPGAINTF_EMAC2;
+	writel(handoff_val, &sysmgr_regs->fpgaintf_en_3); }
+
+/*
+ * Configure all the pin muxes
+ */
+void populate_sysmgr_pinmux(void)
+{
+	const u32 *sys_mgr_table_u32;
+	unsigned int len, i;
+
+	/* setup the pin sel */
+	sysmgr_pinmux_table_sel(&sys_mgr_table_u32, &len);
+	for (i = 0; i < len; i = i + 2) {
+		writel(sys_mgr_table_u32[i + 1],
+		       sys_mgr_table_u32[i] + (u8 *)&sysmgr_regs->pinsel0[0]);
+	}
+
+	/* setup the pin ctrl */
+	sysmgr_pinmux_table_ctrl(&sys_mgr_table_u32, &len);
+	for (i = 0; i < len; i = i + 2) {
+		writel(sys_mgr_table_u32[i + 1],
+		       sys_mgr_table_u32[i] + (u8 *)&sysmgr_regs->ioctrl0[0]);
+	}
+
+	/* setup the fpga use */
+	sysmgr_pinmux_table_fpga(&sys_mgr_table_u32, &len);
+	for (i = 0; i < len; i = i + 2) {
+		writel(sys_mgr_table_u32[i + 1],
+		       sys_mgr_table_u32[i] +
+		       (u8 *)&sysmgr_regs->rgmii0usefpga);
+	}
+
+	/* setup the IO delay */
+	sysmgr_pinmux_table_delay(&sys_mgr_table_u32, &len);
+	for (i = 0; i < len; i = i + 2) {
+		writel(sys_mgr_table_u32[i + 1],
+		       sys_mgr_table_u32[i] + (u8 *)&sysmgr_regs-

iodelay0[0]);

arch/arm/mach-socfpga/system_manager_s10.c new file +2 -0
+	}
+}
arch/arm/mach-socfpga/wrap_pinmux_config_s10.c new file +12 -0
new file mode 100644
index 0000000..0b497ec
@@ -0,0 +1,56 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2016-2018 Intel Corporation <www.intel.com>
+ *
+ */
+
+#include <common.h>
+#include <errno.h>
+#include <asm/io.h>
+#include <asm/arch/handoff_s10.h>
+
+static void sysmgr_pinmux_handoff_read(void *handoff_address,

arch/arm/mach-socfpga/wrap_pinmux_config_s10.c line 22

Quoted 10 lines
arch/arm/mach-socfpga/wrap_pinmux_config_s10.c new file +10 -0
+				       const u32 **table,
+				       unsigned int *table_len)
+{
+	unsigned int handoff_entry = (swab32(readl(handoff_address +
+					S10_HANDOFF_OFFSET_LENGTH)) -
+					S10_HANDOFF_OFFSET_DATA) /
+					sizeof(unsigned int);
+	unsigned int handoff_chunk[handoff_entry], temp, i;
+
+	if (swab32(readl(S10_HANDOFF_MUX)) ==

S10_HANDOFF_MAGIC_MUX) {

arch/arm/mach-socfpga/wrap_pinmux_config_s10.c line 29

Quoted 7 lines
arch/arm/mach-socfpga/wrap_pinmux_config_s10.c new file +7 -0
+		/* using handoff from Quartus tools if exists */
+		for (i = 0; i < handoff_entry; i++) {
+			temp = readl(handoff_address +
+				     S10_HANDOFF_OFFSET_DATA + (i * 4));
+			handoff_chunk[i] = swab32(temp);
+		}
+		*table = handoff_chunk;

Here you are passing a variable that only exists on the stack to the caller. Shouldn't you either define handoff_chunk as static or malloc it?

Quoted 7 lines

Indicated by CppCheck as [arch/arm/mach-socfpga/wrap_pinmux_config_s10.c:29]:
(error) Address of local auto-variable assigned to a function parameter.

Best regards

Heinrich

Hi Heinrich

We are aware of this issue, we will work on the fix. Thanks.

Regards
Ley Foon

#7 lore raw

PATCH v2 5/16 arm: socfpga: misc: Add CONFIG_SYS_L2_PL310 switch

In reply to Ley Foon Tan

Preparation for Stratix 10 enablement. In ARM64, L2 cache controller is accessed through processor registers. So, add CONFIG_SYS_L2_PL310 switch conditional build in order this file can by shared across other SOCFPGAs.

---
 arch/arm/mach-socfpga/misc.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
arch/arm/mach-socfpga/misc.c +4 -0
index 5c27f19..8ec0917 100644
@@ -22,8 +22,10 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+#ifdef CONFIG_SYS_L2_PL310
 static const struct pl310_regs *const pl310 =
 	(struct pl310_regs *)CONFIG_SYS_PL310_BASE;
+#endif
 
 struct bsel bsel_str[] = {
 	{ "rsvd", "Reserved", },
@@ -52,6 +54,7 @@ void enable_caches(void)
 #endif
 }
 
+#ifdef CONFIG_SYS_L2_PL310
 void v7_outer_cache_enable(void)
 {
 	/* Disable the L2 cache */
@@ -72,6 +75,7 @@ void v7_outer_cache_disable(void)
 	/* Disable the L2 cache */
 	clrbits_le32(&pl310->pl310_ctrl, L2X0_CTRL_EN);
 }
+#endif
 
 #if defined(CONFIG_SYS_CONSOLE_IS_IN_ENV) && \
 defined(CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE)
Signature · 1 line
1.7.1
#8 lore raw

PATCH v2 5/16 arm: socfpga: misc: Add CONFIG_SYS_L2_PL310 switch

Quoted 6 lines · Ley Foon Tan

Preparation for Stratix 10 enablement. In ARM64, L2 cache controller is accessed through processor registers. So, add CONFIG_SYS_L2_PL310 switch conditional build in order this file can by shared across other SOCFPGAs.

Applied 01..05, thanks

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

PATCH v2 6/16 arm: socfpga: misc: Move bridge command to misc common

In reply to Ley Foon Tan

Move bridge command to misc common driver, in preparation to used by other platforms.

---
 arch/arm/mach-socfpga/include/mach/misc.h |    2 +
 arch/arm/mach-socfpga/misc.c              |   31 +++++++++++++++++++++++++++++
 arch/arm/mach-socfpga/misc_gen5.c         |   26 ++---------------------
 3 files changed, 36 insertions(+), 23 deletions(-)
arch/arm/mach-socfpga/include/mach/misc.h +2 -0
index 197f09a..7fe77ac 100644
@@ -27,4 +27,6 @@ unsigned int shared_uart_com_port(const void *blob);
 unsigned int uart_com_port(const void *blob);
 #endif
 
+void do_bridge_reset(int enable);
+
 #endif /* _MISC_H_ */
arch/arm/mach-socfpga/misc.c +31 -0
index 8ec0917..6e0f9a2 100644
@@ -139,3 +139,34 @@ int arch_cpu_init(void)
 
 	return 0;
 }
+
+#ifndef CONFIG_SPL_BUILD
+static int do_bridge(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+	if (argc != 2)
+		return CMD_RET_USAGE;
+
+	argv++;
+
+	switch (*argv[0]) {
+	case 'e':	/* Enable */
+		do_bridge_reset(1);
+		break;
+	case 'd':	/* Disable */
+		do_bridge_reset(0);
+		break;
+	default:
+		return CMD_RET_USAGE;
+	}
+
+	return 0;
+}
+
+U_BOOT_CMD(
+	bridge, 2, 1, do_bridge,
+	"SoCFPGA HPS FPGA bridge control",
+	"enable  - Enable HPS-to-FPGA, FPGA-to-HPS, LWHPS-to-FPGA bridges\n"
+	"bridge disable - Enable HPS-to-FPGA, FPGA-to-HPS, LWHPS-to-FPGA bridges\n"
+	""
+);
+#endif
arch/arm/mach-socfpga/misc_gen5.c +3 -23
index b9db3ae..84759a1 100644
@@ -322,40 +322,20 @@ static void socfpga_sdram_apply_static_cfg(void)
 	: : "r"(val), "r"(&sdr_ctrl->static_cfg) : "memory", "cc");
 }
 
-static int do_bridge(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+void do_bridge_reset(int enable)
 {
-	if (argc != 2)
-		return CMD_RET_USAGE;
-
-	argv++;
-
-	switch (*argv[0]) {
-	case 'e':	/* Enable */
+	if (enable) {
 		writel(iswgrp_handoff[2], &sysmgr_regs->fpgaintfgrp_module);
 		socfpga_sdram_apply_static_cfg();
 		writel(iswgrp_handoff[3], &sdr_ctrl->fpgaport_rst);
 		writel(iswgrp_handoff[0], &reset_manager_base->brg_mod_reset);
 		writel(iswgrp_handoff[1], &nic301_regs->remap);
-		break;
-	case 'd':	/* Disable */
+	} else {
 		writel(0, &sysmgr_regs->fpgaintfgrp_module);
 		writel(0, &sdr_ctrl->fpgaport_rst);
 		socfpga_sdram_apply_static_cfg();
 		writel(0, &reset_manager_base->brg_mod_reset);
 		writel(1, &nic301_regs->remap);
-		break;
-	default:
-		return CMD_RET_USAGE;
 	}
-
-	return 0;
 }
-
-U_BOOT_CMD(
-	bridge, 2, 1, do_bridge,
-	"SoCFPGA HPS FPGA bridge control",
-	"enable  - Enable HPS-to-FPGA, FPGA-to-HPS, LWHPS-to-FPGA bridges\n"
-	"bridge disable - Enable HPS-to-FPGA, FPGA-to-HPS, LWHPS-to-FPGA bridges\n"
-	""
-);
 #endif
Signature · 1 line
1.7.1
#10 lore raw

PATCH v2 6/16 arm: socfpga: misc: Move bridge command to misc common

Quoted 9 lines · Ley Foon Tan

Move bridge command to misc common driver, in preparation to used by other platforms.

---
 arch/arm/mach-socfpga/include/mach/misc.h |    2 +
 arch/arm/mach-socfpga/misc.c              |   31 +++++++++++++++++++++++++++++
 arch/arm/mach-socfpga/misc_gen5.c         |   26 ++---------------------
 3 files changed, 36 insertions(+), 23 deletions(-)

This looks fine, it just doesn't apply on u-boot-socfpga/master, can you rebase this one ?

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

PATCH v2 7/16 arm: socfpga: stratix10: Add misc support for Stratix10 SoC

In reply to Ley Foon Tan

Add misc support such as EMAC and cpu info printout for Stratix SoC

---
 arch/arm/mach-socfpga/Makefile   |    1 +
 arch/arm/mach-socfpga/misc_s10.c |  133 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 134 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-socfpga/misc_s10.c
arch/arm/mach-socfpga/Makefile +1 -0
index 61f5778..c74fec2 100644
@@ -30,6 +30,7 @@ endif
 
 ifdef CONFIG_TARGET_SOCFPGA_STRATIX10
 obj-y	+= clock_manager_s10.o
+obj-y	+= misc_s10.o
 obj-y	+= reset_manager_s10.o
 obj-y	+= system_manager_s10.o
 obj-y	+= wrap_pinmux_config_s10.o
arch/arm/mach-socfpga/misc_s10.c new file +133 -0

133 lines not on this page · raw message

Signature · 1 line
1.7.1
#12 lore raw

PATCH v2 7/16 arm: socfpga: stratix10: Add misc support for Stratix10 SoC

Quoted 71 lines · Ley Foon Tan

Add misc support such as EMAC and cpu info printout for Stratix SoC

---
 arch/arm/mach-socfpga/Makefile   |    1 +
 arch/arm/mach-socfpga/misc_s10.c |  133 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 134 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-socfpga/misc_s10.c
arch/arm/mach-socfpga/Makefile +1 -0
index 61f5778..c74fec2 100644
@@ -30,6 +30,7 @@ endif
 
 ifdef CONFIG_TARGET_SOCFPGA_STRATIX10
 obj-y	+= clock_manager_s10.o
+obj-y	+= misc_s10.o
 obj-y	+= reset_manager_s10.o
 obj-y	+= system_manager_s10.o
 obj-y	+= wrap_pinmux_config_s10.o
arch/arm/mach-socfpga/misc_s10.c new file +43 -0
new file mode 100644
index 0000000..918baac
@@ -0,0 +1,133 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2016-2018 Intel Corporation <www.intel.com>
+ *
+ */
+
+#include <altera.h>
+#include <common.h>
+#include <errno.h>
+#include <fdtdec.h>
+#include <miiphy.h>
+#include <netdev.h>
+#include <asm/io.h>
+#include <asm/arch/reset_manager.h>
+#include <asm/arch/system_manager.h>
+#include <asm/arch/misc.h>
+#include <asm/pl310.h>
+#include <linux/libfdt.h>
+
+#include <dt-bindings/reset/altr,rst-mgr-s10.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+static struct socfpga_system_manager *sysmgr_regs =
+	(struct socfpga_system_manager *)SOCFPGA_SYSMGR_ADDRESS;
+
+/*
+ * DesignWare Ethernet initialization
+ */
+#ifdef CONFIG_ETH_DESIGNWARE
+
+static u32 socfpga_phymode_setup(u32 gmac_index, const char *phymode)
+{
+	u32 modereg;
+
+	if (!phymode)
+		return -EINVAL;
+
+	if (!strcmp(phymode, "mii") || !strcmp(phymode, "gmii"))
+		modereg = SYSMGR_EMACGRP_CTRL_PHYSEL_ENUM_GMII_MII;
+	else if (!strcmp(phymode, "rgmii"))
+		modereg = SYSMGR_EMACGRP_CTRL_PHYSEL_ENUM_RGMII;
+	else if (!strcmp(phymode, "rmii"))

arch/arm/mach-socfpga/misc_s10.c line 53

Quoted 10 lines
arch/arm/mach-socfpga/misc_s10.c new file +10 -0
+		modereg = SYSMGR_EMACGRP_CTRL_PHYSEL_ENUM_RMII;
+	else
+		return -EINVAL;
+
+	clrsetbits_le32(&sysmgr_regs->emac0 + gmac_index,
+			SYSMGR_EMACGRP_CTRL_PHYSEL_MASK,
+			modereg);
+
+	return 0;
+}

This looks quite similar to what A10 does. Can you rebase this one on top of u-boot-socfpga/master ?

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

PATCH v2 8/16 arm: socfpga: stratix10: Add mailbox support for Stratix10 SoC

In reply to Ley Foon Tan

Add mailbox support for Stratix SoC

---
 arch/arm/mach-socfpga/Makefile                   |    1 +
 arch/arm/mach-socfpga/include/mach/mailbox_s10.h |  144 ++++++++
 arch/arm/mach-socfpga/mailbox_s10.c              |  380 ++++++++++++++++++++++
 3 files changed, 525 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-socfpga/include/mach/mailbox_s10.h
 create mode 100644 arch/arm/mach-socfpga/mailbox_s10.c
arch/arm/mach-socfpga/Makefile +1 -0
index c74fec2..5c22cc2 100644
@@ -30,6 +30,7 @@ endif
 
 ifdef CONFIG_TARGET_SOCFPGA_STRATIX10
 obj-y	+= clock_manager_s10.o
+obj-y	+= mailbox_s10.o
 obj-y	+= misc_s10.o
 obj-y	+= reset_manager_s10.o
 obj-y	+= system_manager_s10.o
arch/arm/mach-socfpga/include/mach/mailbox_s10.h new file +144 -0

144 lines not on this page · raw message

arch/arm/mach-socfpga/mailbox_s10.c new file +380 -0

380 lines not on this page · raw message

Signature · 1 line
1.7.1
#15 lore raw

PATCH v2 9/16 arm: socfpga: stratix10: Add MMU support for Stratix10 SoC

In reply to Ley Foon Tan

Add MMU memory mapping table for Stratix SoC.

---
 arch/arm/mach-socfpga/Makefile        |    1 +
 arch/arm/mach-socfpga/mmu-arm64_s10.c |   71 +++++++++++++++++++++++++++++++++
 2 files changed, 72 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-socfpga/mmu-arm64_s10.c
arch/arm/mach-socfpga/Makefile +1 -0
index 5c22cc2..478afe2 100644
@@ -32,6 +32,7 @@ ifdef CONFIG_TARGET_SOCFPGA_STRATIX10
 obj-y	+= clock_manager_s10.o
 obj-y	+= mailbox_s10.o
 obj-y	+= misc_s10.o
+obj-y	+= mmu-arm64_s10.o
 obj-y	+= reset_manager_s10.o
 obj-y	+= system_manager_s10.o
 obj-y	+= wrap_pinmux_config_s10.o
arch/arm/mach-socfpga/mmu-arm64_s10.c new file +71 -0

71 lines not on this page · raw message

Signature · 1 line
1.7.1
#16 lore raw

PATCH v2 9/16 arm: socfpga: stratix10: Add MMU support for Stratix10 SoC

Quoted 10 lines · Ley Foon Tan

Add MMU memory mapping table for Stratix SoC.

---
 arch/arm/mach-socfpga/Makefile        |    1 +
 arch/arm/mach-socfpga/mmu-arm64_s10.c |   71 +++++++++++++++++++++++++++++++++
 2 files changed, 72 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-socfpga/mmu-arm64_s10.c

Just rebase it on u-boot-socfpga/master please

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

PATCH v2 10/16 arm: socfpga: Restructure the SPL file

In reply to Ley Foon Tan

Restructure the SPL so each devices such as CV, A10 and S10 will have their own dedicated SPL file. SPL file determine the HW initialization flow which is device specific

---
 arch/arm/mach-socfpga/Makefile              |    5 +-
 arch/arm/mach-socfpga/spl_a10.c             |  105 +++++++++++++++++++++++++++
 arch/arm/mach-socfpga/{spl.c => spl_gen5.c} |   57 +++------------
 3 files changed, 120 insertions(+), 47 deletions(-)
 create mode 100644 arch/arm/mach-socfpga/spl_a10.c
 rename arch/arm/mach-socfpga/{spl.c => spl_gen5.c} (82%)
arch/arm/mach-socfpga/Makefile +4 -1
index 478afe2..e8a1c0f 100644
@@ -39,13 +39,16 @@ obj-y	+= wrap_pinmux_config_s10.o
 obj-y	+= wrap_pll_config_s10.o
 endif
 ifdef CONFIG_SPL_BUILD
-obj-y	+= spl.o
 ifdef CONFIG_TARGET_SOCFPGA_GEN5
+obj-y	+= spl_gen5.o
 obj-y	+= freeze_controller.o
 obj-y	+= wrap_iocsr_config.o
 obj-y	+= wrap_pinmux_config.o
 obj-y	+= wrap_sdram_config.o
 endif
+ifdef CONFIG_TARGET_SOCFPGA_ARRIA10
+obj-y	+= spl_a10.o
+endif
 endif
 
 ifdef CONFIG_TARGET_SOCFPGA_GEN5
arch/arm/mach-socfpga/spl_a10.c new file +105 -0

105 lines not on this page · raw message

arch/arm/mach-socfpga/spl_gen5.c renamed from arch/arm/mach-socfpga/spl.c +11 -46

81 lines not on this page · raw message

Signature · 1 line
1.7.1
#18 lore raw

PATCH v2 11/16 arm: socfpga: stratix10: Add SPL driver for Stratix10 SoC

In reply to Ley Foon Tan

Add SPL driver support for Stratix SoC

---
 arch/arm/mach-socfpga/Makefile                    |    4 +
 arch/arm/mach-socfpga/include/mach/firewall_s10.h |  120 +++++++++++++
 arch/arm/mach-socfpga/spl_s10.c                   |  199 +++++++++++++++++++++
 3 files changed, 323 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-socfpga/include/mach/firewall_s10.h
 create mode 100644 arch/arm/mach-socfpga/spl_s10.c
arch/arm/mach-socfpga/Makefile +4 -0
index e8a1c0f..3131949 100644
@@ -38,6 +38,7 @@ obj-y	+= system_manager_s10.o
 obj-y	+= wrap_pinmux_config_s10.o
 obj-y	+= wrap_pll_config_s10.o
 endif
+
 ifdef CONFIG_SPL_BUILD
 ifdef CONFIG_TARGET_SOCFPGA_GEN5
 obj-y	+= spl_gen5.o
@@ -49,6 +50,9 @@ endif
 ifdef CONFIG_TARGET_SOCFPGA_ARRIA10
 obj-y	+= spl_a10.o
 endif
+ifdef CONFIG_TARGET_SOCFPGA_STRATIX10
+obj-y	+= spl_s10.o
+endif
 endif
 
 ifdef CONFIG_TARGET_SOCFPGA_GEN5
arch/arm/mach-socfpga/include/mach/firewall_s10.h new file +120 -0

120 lines not on this page · raw message

arch/arm/mach-socfpga/spl_s10.c new file +199 -0

199 lines not on this page · raw message

Signature · 1 line
1.7.1
#19 lore raw

PATCH v2 12/16 arm: socfpga: stratix10: Add timer support for Stratix10 SoC

In reply to Ley Foon Tan

Add timer support for Stratix SoC

---
 arch/arm/mach-socfpga/Makefile    |    4 +++-
 arch/arm/mach-socfpga/timer_s10.c |   26 ++++++++++++++++++++++++++
 2 files changed, 29 insertions(+), 1 deletions(-)
 create mode 100644 arch/arm/mach-socfpga/timer_s10.c
arch/arm/mach-socfpga/Makefile +3 -1
index 3131949..654999c 100644
@@ -9,7 +9,6 @@ obj-y	+= board.o
 obj-y	+= clock_manager.o
 obj-y	+= misc.o
 obj-y	+= reset_manager.o
-obj-y	+= timer.o
 
 ifdef CONFIG_TARGET_SOCFPGA_GEN5
 obj-y	+= clock_manager_gen5.o
@@ -17,6 +16,7 @@ obj-y	+= misc_gen5.o
 obj-y	+= reset_manager_gen5.o
 obj-y	+= scan_manager.o
 obj-y	+= system_manager_gen5.o
+obj-y	+= timer.o
 obj-y	+= wrap_pll_config.o
 obj-y	+= fpga_manager.o
 endif
@@ -26,6 +26,7 @@ obj-y	+= clock_manager_arria10.o
 obj-y	+= misc_arria10.o
 obj-y	+= pinmux_arria10.o
 obj-y	+= reset_manager_arria10.o
+obj-y	+= timer.o
 endif
 
 ifdef CONFIG_TARGET_SOCFPGA_STRATIX10
@@ -35,6 +36,7 @@ obj-y	+= misc_s10.o
 obj-y	+= mmu-arm64_s10.o
 obj-y	+= reset_manager_s10.o
 obj-y	+= system_manager_s10.o
+obj-y	+= timer_s10.o
 obj-y	+= wrap_pinmux_config_s10.o
 obj-y	+= wrap_pll_config_s10.o
 endif
arch/arm/mach-socfpga/timer_s10.c new file +26 -0
new file mode 100644
index 0000000..5723789
@@ -0,0 +1,26 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2017-2018 Intel Corporation <www.intel.com>
+ *
+ */
+
+#include <common.h>
+#include <asm/io.h>
+#include <asm/arch/timer.h>
+
+/*
+ * Timer initialization
+ */
+int timer_init(void)
+{
+	int enable = 0x3;	/* timer enable + output signal masked */
+	int loadval = ~0;
+
+	/* enable system counter */
+	writel(enable, SOCFPGA_GTIMER_SEC_ADDRESS);
+	/* enable processor pysical counter */
+	asm volatile("msr cntp_ctl_el0, %0" : : "r" (enable));
+	asm volatile("msr cntp_tval_el0, %0" : : "r" (loadval));
+
+	return 0;
+}
Signature · 1 line
1.7.1
#21 lore raw

PATCH v2 13/16 ddr: altera: stratix10: Add DDR support for Stratix10 SoC

In reply to Ley Foon Tan

Add DDR support for Stratix SoC

---
 arch/arm/mach-socfpga/include/mach/sdram_s10.h |  183 +++++++++++
 arch/arm/mach-socfpga/misc.c                   |   11 +-
 drivers/ddr/altera/Makefile                    |    1 +
 drivers/ddr/altera/sdram_s10.c                 |  388 ++++++++++++++++++++++++
 4 files changed, 577 insertions(+), 6 deletions(-)
 create mode 100644 arch/arm/mach-socfpga/include/mach/sdram_s10.h
 create mode 100644 drivers/ddr/altera/sdram_s10.c
arch/arm/mach-socfpga/include/mach/sdram_s10.h new file +183 -0
new file mode 100644
index 0000000..91bfc0e
@@ -0,0 +1,183 @@
+/* SPDX-License-Identifier: GPL-2.0
+ *
+ * Copyright (C) 2017-2018 Intel Corporation <www.intel.com>
+ *
+ */
+
+#ifndef	_SDRAM_S10_H_
+#define	_SDRAM_S10_H_
+
+unsigned long sdram_calculate_size(void);
+int sdram_mmr_init_full(unsigned int sdr_phy_reg);
+int sdram_calibration_full(void);
+
+#define DDR_TWR				15
+#define DDR_READ_LATENCY_DELAY		40
+#define DDR_ACTIVATE_FAWBANK		0x1
+
+/* ECC HMC registers */
+#define DDRIOCTRL			0x8
+#define DDRCALSTAT			0xc
+#define DRAMADDRWIDTH			0xe0
+#define ECCCTRL1			0x100
+#define ECCCTRL2			0x104
+#define ERRINTEN			0x110
+#define INTMODE				0x11c
+#define INTSTAT				0x120
+#define AUTOWB_CORRADDR			0x138
+#define ECC_REG2WRECCDATABUS		0x144
+#define ECC_DIAGON			0x150
+#define ECC_DECSTAT			0x154
+#define HPSINTFCSEL			0x210
+#define RSTHANDSHAKECTRL		0x214
+#define RSTHANDSHAKESTAT		0x218
+
+#define DDR_HMC_DDRIOCTRL_IOSIZE_MSK		0x00000003
+#define DDR_HMC_DDRCALSTAT_CAL_MSK		BIT(0)
+#define DDR_HMC_ECCCTL_AWB_CNT_RST_SET_MSK	BIT(16)
+#define DDR_HMC_ECCCTL_CNT_RST_SET_MSK		BIT(8)
+#define DDR_HMC_ECCCTL_ECC_EN_SET_MSK		BIT(0)
+#define DDR_HMC_ECCCTL2_RMW_EN_SET_MSK		BIT(8)
+#define DDR_HMC_ECCCTL2_AWB_EN_SET_MSK		BIT(0)
+#define DDR_HMC_ECC_DIAGON_ECCDIAGON_EN_SET_MSK	BIT(16)
+#define DDR_HMC_ECC_DIAGON_WRDIAGON_EN_SET_MSK	BIT(0)
+#define DDR_HMC_ERRINTEN_SERRINTEN_EN_SET_MSK	BIT(0)
+#define DDR_HMC_ERRINTEN_DERRINTEN_EN_SET_MSK	BIT(1)
+#define DDR_HMC_INTSTAT_SERRPENA_SET_MSK	BIT(0)
+#define DDR_HMC_INTSTAT_DERRPENA_SET_MSK	BIT(1)
+#define DDR_HMC_INTSTAT_ADDRMTCFLG_SET_MSK	BIT(16)
+#define DDR_HMC_INTMODE_INTMODE_SET_MSK		BIT(0)
+#define DDR_HMC_RSTHANDSHAKE_MASK		0x000000ff
+#define DDR_HMC_CORE2SEQ_INT_REQ		0xF
+#define DDR_HMC_SEQ2CORE_INT_RESP_MASK		BIT(3)
+#define DDR_HMC_HPSINTFCSEL_ENABLE_MASK		0x001f1f1f
+
+/* NOC DDR scheduler */
+#define DDR_SCH_ID_COREID		0
+#define DDR_SCH_ID_REVID		0x4
+#define DDR_SCH_DDRCONF			0x8
+#define DDR_SCH_DDRTIMING		0xc
+#define DDR_SCH_DDRMODE			0x10
+#define DDR_SCH_READ_LATENCY		0x14
+#define DDR_SCH_ACTIVATE		0x38
+#define DDR_SCH_DEVTODEV		0x3c
+#define DDR_SCH_DDR4TIMING		0x40
+
+#define DDR_SCH_DDRTIMING_ACTTOACT_OFF		0
+#define DDR_SCH_DDRTIMING_RDTOMISS_OFF		6
+#define DDR_SCH_DDRTIMING_WRTOMISS_OFF		12
+#define DDR_SCH_DDRTIMING_BURSTLEN_OFF		18
+#define DDR_SCH_DDRTIMING_RDTOWR_OFF		21
+#define DDR_SCH_DDRTIMING_WRTORD_OFF		26
+#define DDR_SCH_DDRTIMING_BWRATIO_OFF		31
+#define DDR_SCH_DDRMOD_BWRATIOEXTENDED_OFF	1
+#define DDR_SCH_ACTIVATE_RRD_OFF		0
+#define DDR_SCH_ACTIVATE_FAW_OFF		4
+#define DDR_SCH_ACTIVATE_FAWBANK_OFF		10
+#define DDR_SCH_DEVTODEV_BUSRDTORD_OFF		0
+#define DDR_SCH_DEVTODEV_BUSRDTOWR_OFF		2
+#define DDR_SCH_DEVTODEV_BUSWRTORD_OFF		4
+
+/* HMC MMR IO48 registers */
+#define CTRLCFG0			0x28
+#define CTRLCFG1			0x2c
+#define DRAMTIMING0			0x50
+#define CALTIMING0			0x7c
+#define CALTIMING1			0x80
+#define CALTIMING2			0x84
+#define CALTIMING3			0x88
+#define CALTIMING4			0x8c
+#define CALTIMING9			0xa0
+#define DRAMADDRW			0xa8
+#define DRAMSTS				0xec
+#define NIOSRESERVED0			0x110
+#define NIOSRESERVED1			0x114
+#define NIOSRESERVED2			0x118
+
+#define DRAMADDRW_CFG_COL_ADDR_WIDTH(x)			\
+	(((x) >> 0) & 0x1F)
+#define DRAMADDRW_CFG_ROW_ADDR_WIDTH(x)			\
+	(((x) >> 5) & 0x1F)
+#define DRAMADDRW_CFG_BANK_ADDR_WIDTH(x)		\
+	(((x) >> 10) & 0xF)
+#define DRAMADDRW_CFG_BANK_GRP_ADDR_WIDTH(x)		\
+	(((x) >> 14) & 0x3)
+#define DRAMADDRW_CFG_CS_ADDR_WIDTH(x)			\
+	(((x) >> 16) & 0x7)
+
+#define CTRLCFG0_CFG_MEMTYPE(x)				\
+	(((x) >> 0) & 0xF)
+#define CTRLCFG0_CFG_DIMM_TYPE(x)			\
+	(((x) >> 4) & 0x7)
+#define CTRLCFG0_CFG_AC_POS(x)				\
+	(((x) >> 7) & 0x3)
+#define CTRLCFG0_CFG_CTRL_BURST_LEN(x)			\
+	(((x) >> 9) & 0x1F)
+
+#define CTRLCFG1_CFG_DBC3_BURST_LEN(x)			\
+	(((x) >> 0) & 0x1F)
+#define CTRLCFG1_CFG_ADDR_ORDER(x)			\
+	(((x) >> 5) & 0x3)
+#define CTRLCFG1_CFG_CTRL_EN_ECC(x)			\
+	(((x) >> 7) & 0x1)
+
+#define DRAMTIMING0_CFG_TCL(x)				\
+	(((x) >> 0) & 0x7F)
+
+#define CALTIMING0_CFG_ACT_TO_RDWR(x)			\
+	(((x) >> 0) & 0x3F)
+#define CALTIMING0_CFG_ACT_TO_PCH(x)			\
+	(((x) >> 6) & 0x3F)
+#define CALTIMING0_CFG_ACT_TO_ACT(x)			\
+	(((x) >> 12) & 0x3F)
+#define CALTIMING0_CFG_ACT_TO_ACT_DB(x)			\
+	(((x) >> 18) & 0x3F)
+
+#define CALTIMING1_CFG_RD_TO_RD(x)			\
+	(((x) >> 0) & 0x3F)
+#define CALTIMING1_CFG_RD_TO_RD_DC(x)			\
+	(((x) >> 6) & 0x3F)
+#define CALTIMING1_CFG_RD_TO_RD_DB(x)			\
+	(((x) >> 12) & 0x3F)
+#define CALTIMING1_CFG_RD_TO_WR(x)			\
+	(((x) >> 18) & 0x3F)
+#define CALTIMING1_CFG_RD_TO_WR_DC(x)			\
+	(((x) >> 24) & 0x3F)
+
+#define CALTIMING2_CFG_RD_TO_WR_DB(x)			\
+	(((x) >> 0) & 0x3F)
+#define CALTIMING2_CFG_RD_TO_WR_PCH(x)			\
+	(((x) >> 6) & 0x3F)
+#define CALTIMING2_CFG_RD_AP_TO_VALID(x)		\
+	(((x) >> 12) & 0x3F)
+#define CALTIMING2_CFG_WR_TO_WR(x)			\
+	(((x) >> 18) & 0x3F)
+#define CALTIMING2_CFG_WR_TO_WR_DC(x)			\
+	(((x) >> 24) & 0x3F)
+
+#define CALTIMING3_CFG_WR_TO_WR_DB(x)			\
+	(((x) >> 0) & 0x3F)
+#define CALTIMING3_CFG_WR_TO_RD(x)			\
+	(((x) >> 6) & 0x3F)
+#define CALTIMING3_CFG_WR_TO_RD_DC(x)			\
+	(((x) >> 12) & 0x3F)
+#define CALTIMING3_CFG_WR_TO_RD_DB(x)			\
+	(((x) >> 18) & 0x3F)
+#define CALTIMING3_CFG_WR_TO_PCH(x)			\
+	(((x) >> 24) & 0x3F)
+
+#define CALTIMING4_CFG_WR_AP_TO_VALID(x)		\
+	(((x) >> 0) & 0x3F)
+#define CALTIMING4_CFG_PCH_TO_VALID(x)			\
+	(((x) >> 6) & 0x3F)
+#define CALTIMING4_CFG_PCH_ALL_TO_VALID(x)		\
+	(((x) >> 12) & 0x3F)
+#define CALTIMING4_CFG_ARF_TO_VALID(x)			\
+	(((x) >> 18) & 0xFF)
+#define CALTIMING4_CFG_PDN_TO_VALID(x)			\
+	(((x) >> 26) & 0x3F)
+
+#define CALTIMING9_CFG_4_ACT_TO_ACT(x)			\
+	(((x) >> 0) & 0xFF)
+
+#endif /* _SDRAM_S10_H_ */
arch/arm/mach-socfpga/misc.c +5 -6
index 6e0f9a2..bb88f30 100644
@@ -162,11 +162,10 @@ static int do_bridge(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	return 0;
 }
 
-U_BOOT_CMD(
-	bridge, 2, 1, do_bridge,
-	"SoCFPGA HPS FPGA bridge control",
-	"enable  - Enable HPS-to-FPGA, FPGA-to-HPS, LWHPS-to-FPGA bridges\n"
-	"bridge disable - Enable HPS-to-FPGA, FPGA-to-HPS, LWHPS-to-FPGA bridges\n"
-	""
+U_BOOT_CMD(bridge, 2, 1, do_bridge,
+	   "SoCFPGA HPS FPGA bridge control",
+	   "enable  - Enable HPS-to-FPGA, FPGA-to-HPS, LWHPS-to-FPGA bridges\n"
+	   "bridge disable - Enable HPS-to-FPGA, FPGA-to-HPS, LWHPS-to-FPGA bridges\n"
+	   ""
 );
 #endif
drivers/ddr/altera/Makefile +1 -0
index d42fd44..34e50a3 100644
@@ -8,4 +8,5 @@
 
 ifdef CONFIG_ALTERA_SDRAM
 obj-$(CONFIG_TARGET_SOCFPGA_GEN5) += sdram.o sequencer.o
+obj-$(CONFIG_TARGET_SOCFPGA_STRATIX10) += sdram_s10.o
 endif
drivers/ddr/altera/sdram_s10.c new file +388 -0

388 lines not on this page · raw message

Signature · 1 line
1.7.1
#22 lore raw

PATCH v2 14/16 board: altera: stratix10: Add socdk board support for Stratix10 SoC

In reply to Ley Foon Tan

Add socdk board support for Stratix SoC

---
 board/altera/stratix10-socdk/MAINTAINERS |    7 +++++++
 board/altera/stratix10-socdk/Makefile    |    7 +++++++
 board/altera/stratix10-socdk/socfpga.c   |    7 +++++++
 3 files changed, 21 insertions(+), 0 deletions(-)
 create mode 100644 board/altera/stratix10-socdk/MAINTAINERS
 create mode 100644 board/altera/stratix10-socdk/Makefile
 create mode 100644 board/altera/stratix10-socdk/socfpga.c
board/altera/stratix10-socdk/MAINTAINERS new file +7 -0
new file mode 100644
index 0000000..6192bc9
@@ -0,0 +1,7 @@
+SOCFPGA BOARD
+M:	Chin-Liang See <[email protected]>
+M:	Dinh Nguyen <[email protected]>
+S:	Maintained
+F:	board/altera/stratix10-socdk/
+F:	include/configs/socfpga_stratix10_socdk.h
+F:	configs/socfpga_stratix10_defconfig
board/altera/stratix10-socdk/Makefile new file +7 -0
new file mode 100644
index 0000000..02a9cad
@@ -0,0 +1,7 @@
+#
+# Copyright (C) 2016-2017 Intel Corporation <www.intel.com>
+#
+# SPDX-License-Identifier:	GPL-2.0
+#
+
+obj-y	:= socfpga.o
board/altera/stratix10-socdk/socfpga.c new file +7 -0
new file mode 100644
index 0000000..043fc54
@@ -0,0 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2016-2018 Intel Corporation <www.intel.com>
+ *
+ */
+
+#include <common.h>
Signature · 1 line
1.7.1
#23 lore raw

PATCH v2 15/16 arm: dts: socfpga: stratix10: update dtsi and dts

In reply to Ley Foon Tan

Update dtsi and dts files for resets, phy node and other properties.

---
 arch/arm/dts/socfpga_stratix10.dtsi      |   22 +++++++++++++++++-----
 arch/arm/dts/socfpga_stratix10_socdk.dts |    3 +++
 2 files changed, 20 insertions(+), 5 deletions(-)
arch/arm/dts/socfpga_stratix10.dtsi +17 -5
index db8eb7c..ccd3f32 100644
@@ -80,6 +80,7 @@
 		device_type = "soc";
 		interrupt-parent = <&intc>;
 		ranges = <0 0 0 0xffffffff>;
+		u-boot,dm-pre-reloc;
 
 		clkmgr at ffd1000 {
 			compatible = "altr,clk-mgr";
@@ -92,7 +93,7 @@
 			interrupts = <0 90 4>;
 			interrupt-names = "macirq";
 			mac-address = [00 00 00 00 00 00];
-			resets = <&rst EMAC0_RESET>;
+			resets = <&rst EMAC0_RESET>, <&rst EMAC0_OCP_RESET>;
 			reset-names = "stmmaceth";
 			status = "disabled";
 		};
@@ -103,7 +104,7 @@
 			interrupts = <0 91 4>;
 			interrupt-names = "macirq";
 			mac-address = [00 00 00 00 00 00];
-			resets = <&rst EMAC1_RESET>;
+			resets = <&rst EMAC1_RESET>, <&rst EMAC1_OCP_RESET>;
 			reset-names = "stmmaceth";
 			status = "disabled";
 		};
@@ -114,7 +115,7 @@
 			interrupts = <0 92 4>;
 			interrupt-names = "macirq";
 			mac-address = [00 00 00 00 00 00];
-			resets = <&rst EMAC2_RESET>;
+			resets = <&rst EMAC2_RESET>, <&rst EMAC2_OCP_RESET>;
 			reset-names = "stmmaceth";
 			status = "disabled";
 		};
@@ -136,6 +137,7 @@
 				interrupt-controller;
 				#interrupt-cells = <2>;
 				interrupts = <0 110 4>;
+				bank-name = "porta";
 			};
 		};
 
@@ -156,6 +158,7 @@
 				interrupt-controller;
 				#interrupt-cells = <2>;
 				interrupts = <0 111 4>;
+				bank-name = "portb";
 			};
 		};
 
@@ -166,6 +169,7 @@
 			reg = <0xffc02800 0x100>;
 			interrupts = <0 103 4>;
 			resets = <&rst I2C0_RESET>;
+			reset-names = "i2c";
 			status = "disabled";
 		};
 
@@ -176,6 +180,7 @@
 			reg = <0xffc02900 0x100>;
 			interrupts = <0 104 4>;
 			resets = <&rst I2C1_RESET>;
+			reset-names = "i2c";
 			status = "disabled";
 		};
 
@@ -186,6 +191,7 @@
 			reg = <0xffc02a00 0x100>;
 			interrupts = <0 105 4>;
 			resets = <&rst I2C2_RESET>;
+			reset-names = "i2c";
 			status = "disabled";
 		};
 
@@ -196,6 +202,7 @@
 			reg = <0xffc02b00 0x100>;
 			interrupts = <0 106 4>;
 			resets = <&rst I2C3_RESET>;
+			reset-names = "i2c";
 			status = "disabled";
 		};
 
@@ -206,6 +213,7 @@
 			reg = <0xffc02c00 0x100>;
 			interrupts = <0 107 4>;
 			resets = <&rst I2C4_RESET>;
+			reset-names = "i2c";
 			status = "disabled";
 		};
 
@@ -216,8 +224,8 @@
 			reg = <0xff808000 0x1000>;
 			interrupts = <0 96 4>;
 			fifo-depth = <0x400>;
-			resets = <&rst SDMMC_RESET>;
-			reset-names = "reset";
+			resets = <&rst SDMMC_RESET>, <&rst SDMMC_OCP_RESET>;
+			u-boot,dm-pre-reloc;
 			status = "disabled";
 		};
 
@@ -231,6 +239,7 @@
 			compatible = "altr,rst-mgr";
 			reg = <0xffd11000 0x1000>;
 			altr,modrst-offset = <0x20>;
+			u-boot,dm-pre-reloc;
 		};
 
 		spi0: spi at ffda4000 {
@@ -304,6 +313,8 @@
 			reg-shift = <2>;
 			reg-io-width = <4>;
 			resets = <&rst UART0_RESET>;
+			clock-frequency = <100000000>;
+			u-boot,dm-pre-reloc;
 			status = "disabled";
 		};
 
@@ -350,6 +361,7 @@
 			reg = <0xffd00200 0x100>;
 			interrupts = <0 117 4>;
 			resets = <&rst WATCHDOG0_RESET>;
+			u-boot,dm-pre-reloc;
 			status = "disabled";
 		};
 
arch/arm/dts/socfpga_stratix10_socdk.dts +3 -0
index d5f43a2..c6ab0ae 100644
@@ -78,8 +78,11 @@
 &mmc {
 	status = "okay";
 	cap-sd-highspeed;
+	cap-mmc-highspeed;
 	broken-cd;
 	bus-width = <4>;
+	drvsel = <3>;
+	smplsel = <0>;
 };
 
 &uart0 {
Signature · 1 line
1.7.1
Applied
#24 lore raw

PATCH v2 15/16 arm: dts: socfpga: stratix10: update dtsi and dts

Quoted 3 lines · Ley Foon Tan

Update dtsi and dts files for resets, phy node and other properties.

Applied, thanks.

I'll run whatever I could pick through CI and push up for this release.

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

PATCH v2 16/16 arm: socfpga: stratix10: Enable Stratix10 SoC build

In reply to Ley Foon Tan

Add build support for Stratix SoC

---
 arch/arm/Kconfig                          |    9 +-
 arch/arm/mach-socfpga/Kconfig             |   16 ++
 configs/socfpga_stratix10_defconfig       |   58 ++++++++
 include/configs/socfpga_stratix10_socdk.h |  222 +++++++++++++++++++++++++++++
 4 files changed, 301 insertions(+), 4 deletions(-)
 create mode 100644 configs/socfpga_stratix10_defconfig
 create mode 100644 include/configs/socfpga_stratix10_socdk.h
arch/arm/Kconfig +5 -4
index c9d6e0a..f8d13a5 100644
@@ -733,22 +733,23 @@ config ARCH_SNAPDRAGON
 
 config ARCH_SOCFPGA
 	bool "Altera SOCFPGA family"
-	select CPU_V7A
+	select CPU_V7A if TARGET_SOCFPGA_GEN5 || TARGET_SOCFPGA_ARRIA10
+	select ARM64 if TARGET_SOCFPGA_STRATIX10
 	select SUPPORT_SPL
 	select OF_CONTROL
 	select SPL_OF_CONTROL
 	select DM
-	select ENABLE_ARM_SOC_BOOT0_HOOK
+	select ENABLE_ARM_SOC_BOOT0_HOOK if TARGET_SOCFPGA_GEN5 || TARGET_SOCFPGA_ARRIA10
 	select ARCH_EARLY_INIT_R
 	select ARCH_MISC_INIT
-	select SYS_THUMB_BUILD
+	select SYS_THUMB_BUILD if TARGET_SOCFPGA_GEN5 || TARGET_SOCFPGA_ARRIA10
 	imply CMD_MTDPARTS
 	imply CRC32_VERIFY
 	imply DM_SPI
 	imply DM_SPI_FLASH
 	imply FAT_WRITE
-	imply HW_WATCHDOG
 	imply SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION
+	select SPL_SEPARATE_BSS if TARGET_SOCFPGA_STRATIX10
 
 config ARCH_SUNXI
 	bool "Support sunxi (Allwinner) SoCs"
arch/arm/mach-socfpga/Kconfig +16 -0
index afc38d5..0caad36 100644
@@ -15,6 +15,9 @@ config SPL_MMC_SUPPORT
 config SPL_NAND_SUPPORT
 	default y if SPL_NAND_DENALI
 
+config SPL_RESET_SUPPORT
+	default y
+
 config SPL_SERIAL_SUPPORT
 	default y
 
@@ -49,6 +52,12 @@ config TARGET_SOCFPGA_GEN5
 	bool
 	select ALTERA_SDRAM
 
+config TARGET_SOCFPGA_STRATIX10
+	bool
+	select ARMV8_MULTIENTRY
+	select ARMV8_SPIN_TABLE
+	select ARMV8_SET_SMPEN
+
 choice
 	prompt "Altera SOCFPGA board select"
 	optional
@@ -90,6 +99,10 @@ config TARGET_SOCFPGA_SR1500
 	bool "SR1500 (Cyclone V)"
 	select TARGET_SOCFPGA_CYCLONE5
 
+config TARGET_SOCFPGA_STRATIX10_SOCDK
+	bool "Intel SOCFPGA SoCDK (Stratix 10)"
+	select TARGET_SOCFPGA_STRATIX10
+
 config TARGET_SOCFPGA_TERASIC_DE0_NANO
 	bool "Terasic DE0-Nano-Atlas (Cyclone V)"
 	select TARGET_SOCFPGA_CYCLONE5
@@ -121,12 +134,14 @@ config SYS_BOARD
 	default "sockit" if TARGET_SOCFPGA_TERASIC_SOCKIT
 	default "socrates" if TARGET_SOCFPGA_EBV_SOCRATES
 	default "sr1500" if TARGET_SOCFPGA_SR1500
+	default "stratix10-socdk" if TARGET_SOCFPGA_STRATIX10_SOCDK
 	default "vining_fpga" if TARGET_SOCFPGA_SAMTEC_VINING_FPGA
 
 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 "altera" if TARGET_SOCFPGA_STRATIX10_SOCDK
 	default "aries" if TARGET_SOCFPGA_ARIES_MCVEVK
 	default "devboards" if TARGET_SOCFPGA_DEVBOARDS_DBM_SOC1
 	default "ebv" if TARGET_SOCFPGA_EBV_SOCRATES
@@ -152,6 +167,7 @@ config SYS_CONFIG_NAME
 	default "socfpga_sockit" if TARGET_SOCFPGA_TERASIC_SOCKIT
 	default "socfpga_socrates" if TARGET_SOCFPGA_EBV_SOCRATES
 	default "socfpga_sr1500" if TARGET_SOCFPGA_SR1500
+	default "socfpga_stratix10_socdk" if TARGET_SOCFPGA_STRATIX10_SOCDK
 	default "socfpga_vining_fpga" if TARGET_SOCFPGA_SAMTEC_VINING_FPGA
 
 endif
configs/socfpga_stratix10_defconfig new file +58 -0

58 lines not on this page · raw message

include/configs/socfpga_stratix10_socdk.h new file +222 -0

222 lines not on this page · raw message

Signature · 1 line
1.7.1