Add Intel Arria 10 SoC support
Subsystems (7)
v3 cover Add Intel Arria 10 SoC support
This is the 3rd version of patchset to adds support for Intel Arria 10 SoC. This version mainly resolved comments from Marek in [v2].
This is initial patchset enables the basic support for Arria 10 and other features will come after this.
This series is working on top of “arm: socfpga: Move to using distro boot” series [1] from Dalon Westergreen.
[1]: https://www.mail-archive.com/u-boot at lists.denx.de/msg239560.html
v2 -> v3 changes:
-----------------
- Drop "[PATCH v2 02/20] arm: socfpga: Update clock for Gen5" in [v2] from this A10 patch series, since it is non Arria 10 related.
- Add socfpga_ prefix for exported functions in reset driver.
- Check return value from wait_for_bit().
- Remove extra parenthesis around statement
- Refactor cm_calc_safe_pll_numer() clock driver.
- Use BIT(n) for bit shifting.
- Resolved warnings and errors from checkpatch.pl.
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
Ley Foon Tan (19):
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 misc support for Arria 10
arm: socfpga: Add pinmux for Arria 10
fdt: Add compatible strings for Arria 10
arm: dts: Add dts and dtsi for Arria 10
arm: socfpga: Add SPL support for Arria 10
drivers: fpga: Add compile switch for Gen5 only registers
arm: socfpga: Convert Altera DDR SDRAM driver to use Kconfig
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 | 859 +++++++++++++++
arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts | 30 +
.../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} | 104 +-
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 | 15 +
arch/arm/mach-socfpga/include/mach/reset_manager.h | 50 +-
.../include/mach/reset_manager_arria10.h | 144 +++
.../mach-socfpga/include/mach/reset_manager_gen5.h | 47 +
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 | 361 +------
arch/arm/mach-socfpga/misc_arria10.c | 258 +++++
arch/arm/mach-socfpga/{misc.c => misc_gen5.c} | 149 +--
arch/arm/mach-socfpga/pinmux_arria10.c | 96 ++
arch/arm/mach-socfpga/reset_manager.c | 93 +-
arch/arm/mach-socfpga/reset_manager_arria10.c | 389 +++++++
.../{reset_manager.c => reset_manager_gen5.c} | 51 +-
arch/arm/mach-socfpga/spl.c | 74 +-
.../{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 | 28 +
drivers/Kconfig | 2 +
drivers/ddr/Kconfig | 1 +
drivers/ddr/altera/Kconfig | 6 +
drivers/ddr/altera/Makefile | 4 +-
drivers/fpga/socfpga.c | 6 +
include/configs/socfpga_arria10_socdk.h | 66 ++
include/configs/socfpga_common.h | 33 +-
include/dt-bindings/reset/altr,rst-mgr-a10.h | 103 ++
include/fdtdec.h | 8 +
lib/fdtdec.c | 8 +
45 files changed, 4824 insertions(+), 1786 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} (88%)
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} (80%)
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} (73%)
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 drivers/ddr/Kconfig
create mode 100644 drivers/ddr/altera/Kconfig
create mode 100644 include/configs/socfpga_arria10_socdk.h
create mode 100644 include/dt-bindings/reset/altr,rst-mgr-a10.hSignature · 1 line
2.2.0
PATCH v3 1/19 arm: socfpga: Restructure clock manager driver
Restructure clock manager driver in the preparation to support A10. Move the Gen5 specific code to _gen5 files. No functional change.
Change all uint32_t to u32 and change to use macro BIT(n) for bit shift.
---
arch/arm/mach-socfpga/Makefile | 3 +-
arch/arm/mach-socfpga/clock_manager.c | 515 +--------------------
.../{clock_manager.c => clock_manager_gen5.c} | 104 ++---
arch/arm/mach-socfpga/include/mach/clock_manager.h | 316 +------------
.../mach/{clock_manager.h => clock_manager_gen5.h} | 151 +++---
5 files changed, 125 insertions(+), 964 deletions(-)
copy arch/arm/mach-socfpga/{clock_manager.c => clock_manager_gen5.c} (88%)
copy arch/arm/mach-socfpga/include/mach/{clock_manager.h => clock_manager_gen5.h} (80%)arch/arm/mach-socfpga/Makefile +2 -1
@@ -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 +28 -76
231 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
Signature · 1 line
2.2.0
PATCH v3 2/19 arm: socfpga: Restructure reset manager driver
In reply to Ley Foon TanRestructure reset manager driver in the preparation to support A10. Move the Gen5 specific code to gen5 files. Minor update in socfpga_per_reset(). No functional change.
---
arch/arm/mach-socfpga/Makefile | 2 +-
arch/arm/mach-socfpga/include/mach/reset_manager.h | 48 ++---------
.../mach-socfpga/include/mach/reset_manager_gen5.h | 47 +++++++++++
arch/arm/mach-socfpga/reset_manager.c | 93 +---------------------
.../{reset_manager.c => reset_manager_gen5.c} | 51 ++++++------
5 files changed, 81 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
@@ -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 +47 -0
47 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
2.2.0
PATCH v3 3/19 arm: socfpga: Restructure system manager
In reply to Ley Foon TanRestructure 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
@@ -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
@@ -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
@@ -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
2.2.0
PATCH v3 4/19 arm: socfpga: Restructure misc driver
In reply to Ley Foon TanRestructure misc driver in the preparation to support A10. Move the Gen5 specific code to gen5 file. No functional change.
Change all uint32_t_to u32.
---
arch/arm/mach-socfpga/Makefile | 2 +-
arch/arm/mach-socfpga/include/mach/misc.h | 25 ++
arch/arm/mach-socfpga/misc.c | 361 ++------------------------
arch/arm/mach-socfpga/{misc.c => misc_gen5.c} | 149 ++---------
4 files changed, 60 insertions(+), 477 deletions(-)
create mode 100644 arch/arm/mach-socfpga/include/mach/misc.h
copy arch/arm/mach-socfpga/{misc.c => misc_gen5.c} (73%)arch/arm/mach-socfpga/Makefile +1 -1
@@ -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
@@ -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 -346
399 lines not on this page · raw message
arch/arm/mach-socfpga/misc_gen5.c renamed from arch/arm/mach-socfpga/misc.c +19 -130
218 lines not on this page · raw message
Signature · 1 line
2.2.0
PATCH v3 5/19 arm: socfpga: Add A10 macros
In reply to Ley Foon TanAdd 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
@@ -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,14 +29,20 @@#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_NOC_FW_H2F_SCR_OFST 0xffd13500#define SOCFPGA_SDR_SCHEDULER_ADDRESS 0xffd12400#define SOCFPGA_SDR_FIREWALL_OCRAM_ADDRESS 0xffd13200#define SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS 0xffd13300
Signature · 1 line
2.2.0
PATCH v3 6/19 arm: socfpga: Add reset driver support for Arria 10
In reply to Ley Foon TanAdd 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 | 144 ++++++++ arch/arm/mach-socfpga/reset_manager_arria10.c | 389 +++++++++++++++++++++ include/dt-bindings/reset/altr,rst-mgr-a10.h | 103 ++++++ 5 files changed, 640 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
@@ -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
@@ -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 +144 -0
144 lines not on this page · raw message
arch/arm/mach-socfpga/reset_manager_arria10.c new file +389 -0
389 lines not on this page · raw message
include/dt-bindings/reset/altr,rst-mgr-a10.h new file +103 -0
103 lines not on this page · raw message
Signature · 1 line
2.2.0
PATCH v3 7/19 arm: socfpga: Add clock driver for Arria 10
In reply to Ley Foon TanAdd clock driver support for Arria 10.
Conflicts:
arch/arm/mach-socfpga/clock_manager.c
--- 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
@@ -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
@@ -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
@@ -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
2.2.0
PATCH v3 8/19 arm: socfpga: Add system manager for Arria 10
In reply to Ley Foon TanAdd 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
@@ -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
2.2.0
PATCH v3 9/19 arm: socfpga: Add sdram header file for Arria 10
In reply to Ley Foon TanAdd 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
@@ -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
2.2.0
PATCH v3 10/19 arm: socfpga: Add misc support for Arria 10
In reply to Ley Foon TanAdd 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 | 258 ++++++++++++++++++++++++++++++ 3 files changed, 265 insertions(+) create mode 100644 arch/arm/mach-socfpga/misc_arria10.c
arch/arm/mach-socfpga/Makefile +1 -0
@@ -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 \ + 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
@@ -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 +258 -0
258 lines not on this page · raw message
Signature · 1 line
2.2.0
PATCH v3 11/19 arm: socfpga: Add pinmux for Arria 10
In reply to Ley Foon TanAdd pinmux support for Arria 10.
--- arch/arm/mach-socfpga/Makefile | 1 + arch/arm/mach-socfpga/include/mach/pinmux.h | 15 +++++ arch/arm/mach-socfpga/pinmux_arria10.c | 96 +++++++++++++++++++++++++++++ 3 files changed, 112 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
@@ -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 \ misc_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 +15 -0
@@ -0,0 +1,15 @@ +/* +* Copyright (C) 2016-2017 Intel Corporation <www.intel.com> +* +* SPDX-License-Identifier: GPL-2.0 +*/ + +#ifndef _PINMUX_H_ +#define _PINMUX_H_ + +#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
2.2.0
PATCH v3 12/19 fdt: Add compatible strings for Arria 10
In reply to Ley Foon TanAdd compatible strings for Intel Arria 10 SoCFPGA device.
--- include/fdtdec.h | 8 ++++++++ lib/fdtdec.c | 8 ++++++++ 2 files changed, 16 insertions(+)
include/fdtdec.h +8 -0
@@ -155,6 +155,14 @@ enum fdt_compat_id {COMPAT_INTEL_BAYTRAIL_FSP_MDP ,/* Intel FSP memory-down params */ COMPAT_INTEL_IVYBRIDGE_FSP ,/* Intel Ivy Bridge FSP */ COMPAT_SUNXI_NAND ,/* SUNXI NAND controller */ +COMPAT_ALTERA_SOCFPGA_CLK ,/* SoCFPGA Clock initialization */ +COMPAT_ALTERA_SOCFPGA_PINCTRL_SINGLE ,/* SoCFPGA pinctrl-single */ +COMPAT_ALTERA_SOCFPGA_H2F_BRG ,/* SoCFPGA hps2fpga bridge */ +COMPAT_ALTERA_SOCFPGA_LWH2F_BRG ,/* SoCFPGA lwhps2fpga bridge */ +COMPAT_ALTERA_SOCFPGA_F2H_BRG ,/* SoCFPGA fpga2hps bridge */ +COMPAT_ALTERA_SOCFPGA_F2SDR0 ,/* SoCFPGA fpga2SDRAM0 bridge */ +COMPAT_ALTERA_SOCFPGA_F2SDR1 ,/* SoCFPGA fpga2SDRAM1 bridge */ +COMPAT_ALTERA_SOCFPGA_F2SDR2 ,/* SoCFPGA fpga2SDRAM2 bridge */ COMPAT_COUNT, };
lib/fdtdec.c +8 -0
@@ -66,6 +66,14 @@ static const char * const compat_names[COMPAT_COUNT] = {COMPAT (INTEL_BAYTRAIL_FSP_MDP ,"intel,baytrail-fsp-mdp" ),COMPAT (INTEL_IVYBRIDGE_FSP ,"intel,ivybridge-fsp" ),COMPAT (COMPAT_SUNXI_NAND ,"allwinner,sun4i-a10-nand" ), +COMPAT (ALTERA_SOCFPGA_CLK ,"altr,clk-mgr" ), +COMPAT (ALTERA_SOCFPGA_PINCTRL_SINGLE ,"pinctrl-single" ), +COMPAT (ALTERA_SOCFPGA_H2F_BRG ,"altr,socfpga-hps2fpga-bridge" ), +COMPAT (ALTERA_SOCFPGA_LWH2F_BRG ,"altr,socfpga-lwhps2fpga-bridge" ), +COMPAT (ALTERA_SOCFPGA_F2H_BRG ,"altr,socfpga-fpga2hps-bridge" ), +COMPAT (ALTERA_SOCFPGA_F2SDR0 ,"altr,socfpga-fpga2sdram0-bridge" ), +COMPAT (ALTERA_SOCFPGA_F2SDR1 ,"altr,socfpga-fpga2sdram1-bridge" ), + COMPAT(ALTERA_SOCFPGA_F2SDR2, "altr,socfpga-fpga2sdram2-bridge"), };const char *fdtdec_get_compatible (enum fdt_compat_id id)
Signature · 1 line
2.2.0
PATCH v3 13/19 arm: dts: Add dts and dtsi for Arria 10
In reply to Ley Foon TanDevice tree files for Arria 10
--- arch/arm/dts/Makefile | 1 + arch/arm/dts/socfpga_arria10.dtsi | 859 +++++++++++++++++++++ arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts | 30 + .../dts/socfpga_arria10_socdk_sdmmc_handoff.dtsi | 481 ++++++++++++ 4 files changed, 1371 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
@@ -139,6 +139,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 +859 -0
859 lines not on this page · raw message
arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts new file +30 -0
@@ -0,0 +1,30 @@ +/* + * Copyright (C) 2016-2017 Intel Corporation + * + * SPDX-License-Identifier: GPL-2.0 X11 + */ + +/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>; + altr,dw-mshc-ciu-div = <3>; + altr,dw-mshc-sdr-timing = <0 3>; +};
arch/arm/dts/socfpga_arria10_socdk_sdmmc_handoff.dtsi new file +481 -0
481 lines not on this page · raw message
Signature · 1 line
2.2.0
PATCH v3 14/19 arm: socfpga: Add SPL support for Arria 10
In reply to Ley Foon TanAdd SPL support for Arria 10.
--- arch/arm/mach-socfpga/spl.c | 74 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 69 insertions(+), 5 deletions(-)
arch/arm/mach-socfpga/spl.c +69 -5
@@ -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) { +debug ("socfpga_bridges_reset() failed: %d\n" , ret); +hang (); + }socfpga_per_reset (SOCFPGA_RESET (SDR ),0 );socfpga_per_reset (SOCFPGA_RESET (UART0 ),0 );
@@ -147,7 +162,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) { +debug ("socfpga_bridges_reset() failed: %d\n" , ret); +hang (); + }debug ("Unfreezing/Thaw all I/O banks\n" );/* unfreeze / thaw all IO banks */
@@ -177,8 +196,53 @@ void board_init_f(ulong dummy) hang(); } -socfpga_bridges_reset (1 ); + ret =socfpga_bridges_reset (1 ); +if (ret) { +debug ("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) +#ifdef CONFIG_SPL_BOARD_INIT +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 (); +} +#endif + +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
2.2.0
PATCH v3 15/19 drivers: fpga: Add compile switch for Gen5 only registers
In reply to Ley Foon TanThese registers only available for Gen5 device, exclude them from Arria 10 build.
--- drivers/fpga/socfpga.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/fpga/socfpga.c +6 -0
@@ -19,8 +19,10 @@ DECLARE_GLOBAL_DATA_PTR;static struct socfpga_fpga_manager *fpgamgr_regs = (struct socfpga_fpga_manager *)SOCFPGA_FPGAMGRREGS_ADDRESS ; +#if defined(CONFIG_TARGET_SOCFPGA_GEN5 )static struct socfpga_system_manager *sysmgr_regs = (struct socfpga_system_manager *)SOCFPGA_SYSMGR_ADDRESS ; +#endif /* Set CD ratio */ static void fpgamgr_set_cd_ratio (unsigned long ratio)
@@ -268,8 +270,10 @@ int socfpga_load(Altera_desc *desc, const void *rbf_data, size_t rbf_size)/* Prior programming the FPGA, all bridges need to be shut off */ +#if defined(CONFIG_TARGET_SOCFPGA_GEN5 )/* Disable all signals from hps peripheral controller to fpga */ writel (0 , &sysmgr_regs->fpgaintfgrp_module); +#endif /* Disable all signals from FPGA to HPS SDRAM */ #define SDR_CTRLGRP_FPGAPORTRST_ADDRESS 0x5080
@@ -278,8 +282,10 @@ int socfpga_load(Altera_desc *desc, const void *rbf_data, size_t rbf_size)/* Disable all axi bridge (hps2fpga, lwhps2fpga & fpga2hps) */ socfpga_bridges_reset (1 ); +#if defined(CONFIG_TARGET_SOCFPGA_GEN5 )/* Unmap the bridges from NIC-301 */ writel (0x1 ,SOCFPGA_L3REGS_ADDRESS ); +#endif /* Initialize the FPGA Manager */ status =fpgamgr_program_init ();
Signature · 1 line
2.2.0
PATCH v3 16/19 arm: socfpga: Convert Altera DDR SDRAM driver to use Kconfig
In reply to Ley Foon TanConvert Altera DDR SDRAM driver to use Kconfig method. Enable ALTERA_SDRAM by default if it is on Gen5 target. Arria 10 will have different driver.
--- drivers/Kconfig | 2 ++ drivers/ddr/Kconfig | 1 + drivers/ddr/altera/Kconfig | 6 ++++++ drivers/ddr/altera/Makefile | 4 +++- include/configs/socfpga_common.h | 5 ----- 5 files changed, 12 insertions(+), 6 deletions(-) create mode 100644 drivers/ddr/Kconfig create mode 100644 drivers/ddr/altera/Kconfig
drivers/Kconfig +2 -0
@@ -14,6 +14,8 @@ source "drivers/cpu/Kconfig" source "drivers/crypto/Kconfig" +source "drivers/ddr/Kconfig" + source "drivers/demo/Kconfig" source "drivers/ddr/fsl/Kconfig"
drivers/ddr/Kconfig new file +1 -0
@@ -0,0 +1 @@ +source "drivers/ddr/altera/Kconfig"
drivers/ddr/altera/Kconfig new file +6 -0
@@ -0,0 +1,6 @@ +config ALTERA_SDRAM + bool "SoCFPGA DDR SDRAM driver" + depends on TARGET_SOCFPGA_GEN5 + default y if TARGET_SOCFPGA_GEN5 + help + Enable DDR SDRAM controller for the SoCFPGA devices.
drivers/ddr/altera/Makefile +3 -1
@@ -8,4 +8,6 @@ # SPDX-License-Identifier: GPL-2.0+ # -obj-$(CONFIG_ALTERA_SDRAM) += sdram.o sequencer.o +ifdef CONFIG_ALTERA_SDRAM +obj-$(CONFIG_TARGET_SOCFPGA_GEN5) += sdram.o sequencer.o +endif
include/configs/socfpga_common.h +0 -5
@@ -77,11 +77,6 @@#define CONFIG_SYS_PL310_BASE SOCFPGA_MPUL2_ADDRESS/* -* SDRAM controller -*/ -#define CONFIG_ALTERA_SDRAM - -/* * EPCS/EPCQx1 Serial Flash Controller */ #ifdef CONFIG_ALTERA_SPI
Signature · 1 line
2.2.0
PATCH v3 17/19 arm: socfpga: Add config and defconfig for Arria 10
In reply to Ley Foon TanAdd config and defconfig for the Arria10 and update socfpga_common.h.
--- configs/socfpga_arria10_defconfig | 28 ++++++++++++++ include/configs/socfpga_arria10_socdk.h | 66 +++++++++++++++++++++++++++++++++ include/configs/socfpga_common.h | 28 +++++++++++--- 3 files changed, 117 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 +28 -0
@@ -0,0 +1,28 @@ +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_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 +23 -5
@@ -34,9 +34,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 \
@@ -67,8 +71,10 @@#define CONFIG_SYS_HOSTNAME CONFIG_SYS_BOARD#endif +#if defined(CONFIG_TARGET_SOCFPGA_GEN5 )#define CONFIG_CMD_PXE #define CONFIG_MENU +#endif /* * Cache
@@ -103,13 +109,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 */
@@ -209,11 +216,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#define CONFIG_BAUDRATE 115200
@@ -301,7 +311,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
@@ -349,10 +362,15 @@ unsigned int cm_get_qspi_controller_clk_hz(void);#define BOOT_TARGET_DEVICES_MMC (func)#endif +#if defined(CONFIG_TARGET_SOCFPGA_GEN5 )#define BOOT_TARGET_DEVICES (func) \ BOOT_TARGET_DEVICES_MMC(func) \ BOOT_TARGET_DEVICES_PXE(func) \ func(DHCP, dhcp, na) +#elif defined(CONFIG_TARGET_SOCFPGA_ARRIA10 ) +#define BOOT_TARGET_DEVICES (func) \ + BOOT_TARGET_DEVICES_MMC(func) +#endif #include <config_distro_bootcmd.h>
Signature · 1 line
2.2.0
PATCH v3 18/19 arm: socfpga: Add board files for the Arria10
In reply to Ley Foon TanAdd 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
@@ -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
@@ -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
@@ -0,0 +1,7 @@ +/* +* Copyright (C) 2015 Altera Corporation <www.altera.com> +* +* SPDX-License-Identifier: GPL-2.0 +*/ + +#include <common.h>
Signature · 1 line
2.2.0
PATCH v3 19/19 arm: socfpga: Enable build for Arria 10
In reply to Ley Foon TanUpdate 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
@@ -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
@@ -48,6 +51,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
@@ -93,6 +100,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
@@ -105,6 +113,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 "denx" if TARGET_SOCFPGA_DENX_MCVEVK default "ebv" if TARGET_SOCFPGA_EBV_SOCRATES
@@ -118,6 +127,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
2.2.0
PATCH v3 1/19 arm: socfpga: Restructure clock manager driver
In reply to Ley Foon TanQuoted 18 lines · Ley Foon Tan
Restructure clock manager driver in the preparation to support A10. Move the Gen5 specific code to
_gen5files. No functional change.Change all
uint32_tto u32 and change to use macro BIT(n) for bit shift.Signed-off-by Ley Foon Tan <[email protected]>--- arch/arm/mach-socfpga/Makefile | 3 +- arch/arm/mach-socfpga/clock_manager.c | 515 +-------------------- .../{clock_manager.c => clock_manager_gen5.c} | 104 ++--- arch/arm/mach-socfpga/include/mach/clock_manager.h | 316 +------------ .../mach/{clock_manager.h => clock_manager_gen5.h} | 151 +++--- 5 files changed, 125 insertions(+), 964 deletions(-) copy arch/arm/mach-socfpga/{clock_manager.c => clock_manager_gen5.c} (88%) copy arch/arm/mach-socfpga/include/mach/{clock_manager.h => clock_manager_gen5.h} (80%)arch/arm/mach-socfpga/Makefile +0
-0
[snip]
arch/arm/mach-socfpga/Makefile
Quoted 5 lines
/* function to write a clock register that has phase information */
arch/arm/mach-socfpga/Makefile +1
-2-static void cm_write_with_phase(uint32_t value, - uint32_t reg_address, uint32_t mask) +static int cm_write_with_phase(u32 value, u32 reg_address, u32 mask)
You changed the return type of this function here...
Quoted 8 lines
{
arch/arm/mach-socfpga/Makefile +4
-2+ int ret; + /* poll until phase is zero */ - while (readl(reg_address) & mask) - ; + ret = wait_for_bit(__func__, (const u32 *)reg_address, mask, + false, 20000, false);
arch/arm/mach-socfpga/Makefile
Quoted 10 lines
arch/arm/mach-socfpga/Makefile +4
-2+ if (ret) + return ret; writel(value, reg_address); - while (readl(reg_address) & mask) - ; + return wait_for_bit(__func__, (const u32 *)reg_address, mask, + false, 20000, false); }
because now, you got a 20 seconds timeout and a return value if there is a timeout,
Quoted 44 lines
/*
arch/arm/mach-socfpga/Makefile +4
-9@@ -233,11 +215,6 @@ void cm_basic_init(const struct cm_config * const cfg) writel(cfg->gpiodiv, &clock_manager_base->per_pll.gpiodiv); -#define LOCKED_MASK \ - (CLKMGR_INTER_SDRPLLLOCKED_MASK | \ - CLKMGR_INTER_PERPLLLOCKED_MASK | \ - CLKMGR_INTER_MAINPLLLOCKED_MASK) - cm_wait_for_lock(LOCKED_MASK); /* write the sdram clock counters before toggling outreset all */@@ -257,13 +234,13 @@ void cm_basic_init(const struct cm_config * const cfg) * after locking, but before taking out of bypass * assert/deassert outresetall */ - uint32_t mainvco = readl(&clock_manager_base->main_pll.vco); + u32 mainvco = readl(&clock_manager_base->main_pll.vco); /* assert main outresetall */ writel(mainvco | CLKMGR_MAINPLLGRP_VCO_OUTRESETALL_MASK, &clock_manager_base->main_pll.vco); - uint32_t periphvco = readl(&clock_manager_base->per_pll.vco); + u32 periphvco = readl(&clock_manager_base->per_pll.vco); /* assert pheriph outresetall */ writel(periphvco | CLKMGR_PERPLLGRP_VCO_OUTRESETALL_MASK,@@ -291,20 +268,20 @@ void cm_basic_init(const struct cm_config * const cfg) * are aligned nicely; so we can change any phase. */ cm_write_with_phase(cfg->ddrdqsclk, - (uint32_t)&clock_manager_base->sdr_pll.ddrdqsclk, + (u32)&clock_manager_base->sdr_pll.ddrdqsclk, CLKMGR_SDRPLLGRP_DDRDQSCLK_PHASE_MASK); /* SDRAM DDR2XDQSCLK */ cm_write_with_phase(cfg->ddr2xdqsclk, - (uint32_t)&clock_manager_base->sdr_pll.ddr2xdqsclk, + (u32)&clock_manager_base->sdr_pll.ddr2xdqsclk, CLKMGR_SDRPLLGRP_DDR2XDQSCLK_PHASE_MASK);
arch/arm/mach-socfpga/Makefile void cm_basic_init(const struct cm_config * const cfg) · line 286
Quoted 10 lines
arch/arm/mach-socfpga/Makefile +2
-2cm_write_with_phase(cfg->ddrdqclk, - (uint32_t)&clock_manager_base->sdr_pll.ddrdqclk, + (u32)&clock_manager_base->sdr_pll.ddrdqclk, CLKMGR_SDRPLLGRP_DDRDQCLK_PHASE_MASK); cm_write_with_phase(cfg->s2fuser2clk, - (uint32_t)&clock_manager_base->sdr_pll.s2fuser2clk, + (u32)&clock_manager_base->sdr_pll.s2fuser2clk, CLKMGR_SDRPLLGRP_S2FUSER2CLK_PHASE_MASK);
but you're not checking the return value at all?
Dinh
PATCH v3 2/19 arm: socfpga: Restructure reset manager driver
In reply to Ley Foon TanQuoted 20 lines · Ley Foon Tan
Restructure reset manager driver in the preparation to support A10. Move the Gen5 specific code to gen5 files. Minor update in
socfpga_per_reset(). No functional change.Signed-off-by Ley Foon Tan <[email protected]>--- arch/arm/mach-socfpga/Makefile | 2 +- arch/arm/mach-socfpga/include/mach/reset_manager.h | 48 ++--------- .../mach-socfpga/include/mach/reset_manager_gen5.h | 47 +++++++++++ arch/arm/mach-socfpga/reset_manager.c | 93 +--------------------- .../{reset_manager.c => reset_manager_gen5.c} | 51 ++++++------ 5 files changed, 81 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 +0
-0@@ -14,7 +14,7 @@ obj-$(CONFIG_SPL_BUILD) += spl.o freeze_controller.o
[snip]
arch/arm/mach-socfpga/Makefile
Quoted 3 lines
arch/arm/mach-socfpga/Makefile +1
-1-void socfpga_bridges_reset(int enable); +int socfpga_bridges_reset(int enable);
You're changing the return type, to me, that's a functional change.
[snip]
arch/arm/mach-socfpga/Makefile void socfpga_per_reset_all(void) · line 24
Quoted 10 lines
/*
* Write the reset manager register to cause resetarch/arm/mach-socfpga/Makefile +2
-2@@ -61,8 +20,8 @@ void socfpga_per_reset_all(void) void reset_cpu(ulong addr) { /* request a warm reset */ - writel((1 << RSTMGR_CTRL_SWWARMRSTREQ_LSB), - &reset_manager_base->ctrl); + writel(1 << RSTMGR_CTRL_SWWARMRSTREQ_LSB, + &reset_manager_base->ctrl);
What's the reason for the above change?
[snip]
Quoted 23 lines
arch/arm/mach-socfpga/Makefile +3
-3@@ -90,9 +84,9 @@ void socfpga_bridges_reset(int enable) #define L3REGS_REMAP_HPS2FPGA_MASK 0x08 #define L3REGS_REMAP_OCRAM_MASK 0x01 -void socfpga_bridges_reset(int enable) +int socfpga_bridges_reset(int enable) { - const uint32_t l3mask = L3REGS_REMAP_LWHPS2FPGA_MASK | + const u32 l3mask = L3REGS_REMAP_LWHPS2FPGA_MASK | L3REGS_REMAP_HPS2FPGA_MASK | L3REGS_REMAP_OCRAM_MASK;@@ -107,7 +101,7 @@ void socfpga_bridges_reset(int enable) if (!fpgamgr_test_fpga_ready()) { /* FPGA not ready, do nothing. */ printf("%s: FPGA not ready, aborting.\n", __func__); - return; + return -EINVAL; } /* brdmodrst */
arch/arm/mach-socfpga/Makefile void socfpga_bridges_reset(int enable) · line 113
Quoted 4 lines
arch/arm/mach-socfpga/Makefile +1
-0@@ -116,5 +110,6 @@ void socfpga_bridges_reset(int enable) /* Remap the bridges into memory map */ writel(l3mask, SOCFPGA_L3REGS_ADDRESS); } + return 0;
How are you intending to use these return values?
Dinh
PATCH v3 4/19 arm: socfpga: Restructure misc driver
In reply to Ley Foon TanQuoted 34 lines · Ley Foon Tan
Restructure misc driver in the preparation to support A10. Move the Gen5 specific code to gen5 file. No functional change.
Change all
uint32_t_tou32.Signed-off-by Ley Foon Tan <[email protected]>--- arch/arm/mach-socfpga/Makefile | 2 +- arch/arm/mach-socfpga/include/mach/misc.h | 25 ++ arch/arm/mach-socfpga/misc.c | 361 ++------------------------ arch/arm/mach-socfpga/{misc.c => misc_gen5.c} | 149 ++--------- 4 files changed, 60 insertions(+), 477 deletions(-) create mode 100644 arch/arm/mach-socfpga/include/mach/misc.h copy arch/arm/mach-socfpga/{misc.c => misc_gen5.c} (73%)arch/arm/mach-socfpga/Makefile +1
-1@@ -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 +0
-0
arch/arm/mach-socfpga/include/mach/misc.h line 5
Quoted 5 lines
arch/arm/mach-socfpga/include/mach/misc.h new file +5
-0@@ -0,0 +1,25 @@ +/* +* Copyright (C) 2016-2017 Intel Corporation +* +* SPDX-License-Identifier: GPL-2.0 +*/
In the reset_manager_gen5.h file, patch #02, you are still using Altera in the header and it was GPL-2.0+ license.
Now you're using Intel and GPL-2.0, I'm not sure which is right, but I think it should be Intel for all new files?
Let's be consistent?
Dinh
PATCH v3 5/19 arm: socfpga: Add A10 macros
In reply to Ley Foon TanQuoted 19 lines · Ley Foon Tan
Add i2c, timer and other A10 macros.
Signed-off-by Ley Foon Tan <[email protected]>--- 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 +1
-1@@ -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+ */
arch/arm/mach-socfpga/include/mach/base_addr_a10.h line 34
Quoted 6 lines
arch/arm/mach-socfpga/include/mach/base_addr_a10.h +3
-0@@ -29,14 +29,20 @@#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
Do we need to add these if we have DTS support?
Dinh
PATCH v3 7/19 arm: socfpga: Add clock driver for Arria 10
In reply to Ley Foon TanQuoted 7 lines · Ley Foon Tan
Add clock driver support for Arria 10.
Signed-off-by Tien Fong Chee <[email protected]>Signed-off-by Ley Foon Tan <[email protected]>Conflicts:
arch/arm/mach-socfpga/clock_manager.c
^ what's this "conflicts" about ?
Signature · 2 lines
Best regards, Marek Vasut
PATCH v3 14/19 arm: socfpga: Add SPL support for Arria 10
In reply to Ley Foon TanQuoted 64 lines · Ley Foon Tan
Add SPL support for Arria 10.
Signed-off-by Tien Fong Chee <[email protected]>Signed-off-by Ley Foon Tan <[email protected]>--- arch/arm/mach-socfpga/spl.c | 74 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 69 insertions(+), 5 deletions(-)arch/arm/mach-socfpga/spl.c +13
-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) */ @@ -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 void board_init_f(ulong dummy) · line 133
Quoted 7 lines
arch/arm/mach-socfpga/spl.c +3
-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) { +debug ("socfpga_bridges_reset() failed: %d\n" , ret);
Shouldn't this be printf() ?
arch/arm/mach-socfpga/spl.c void board_init_f(ulong dummy) · line 167
Quoted 13 lines
arch/arm/mach-socfpga/spl.c +5
-1+hang (); + }socfpga_per_reset (SOCFPGA_RESET (SDR ),0 );socfpga_per_reset (SOCFPGA_RESET (UART0 ),0 );@@ -147,7 +162,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) { +debug ("socfpga_bridges_reset() failed: %d\n" , ret);
DTTO ?
arch/arm/mach-socfpga/spl.c void board_init_f(ulong dummy) · line 201
Quoted 13 lines
arch/arm/mach-socfpga/spl.c +5
-1+hang (); + }debug ("Unfreezing/Thaw all I/O banks\n" );/* unfreeze / thaw all IO banks */ @@ -177,8 +196,53 @@ void board_init_f(ulong dummy)hang (); } -socfpga_bridges_reset (1 ); + ret =socfpga_bridges_reset (1 ); +if (ret) { +debug ("socfpga_bridges_reset() failed: %d\n" , ret);
DTTO ?
Quoted 48 lines
arch/arm/mach-socfpga/spl.c +43
-0+ hang(); + }/* Configure simple malloc base pointer into RAM. */ gd->malloc_base =CONFIG_SYS_TEXT_BASE + (1024 *1024 ); } +#elif defined(CONFIG_TARGET_SOCFPGA_ARRIA10) +#ifdef CONFIG_SPL_BOARD_INIT +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 (); +} +#endif + +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 · 2 lines
Best regards, Marek Vasut
PATCH v3 16/19 arm: socfpga: Convert Altera DDR SDRAM driver to use Kconfig
In reply to Ley Foon TanQuoted 42 lines · Ley Foon Tan
Convert Altera DDR SDRAM driver to use
Kconfigmethod. EnableALTERA_SDRAMby default if it is on Gen5 target. Arria 10 will have different driver.Signed-off-by Tien Fong Chee <[email protected]>Signed-off-by Ley Foon Tan <[email protected]>--- drivers/Kconfig | 2 ++ drivers/ddr/Kconfig | 1 + drivers/ddr/altera/Kconfig | 6 ++++++ drivers/ddr/altera/Makefile | 4 +++- include/configs/socfpga_common.h | 5 ----- 5 files changed, 12 insertions(+), 6 deletions(-) create mode 100644 drivers/ddr/Kconfig create mode 100644 drivers/ddr/altera/Kconfigdrivers/Kconfig +2
-0@@ -14,6 +14,8 @@ source "drivers/cpu/Kconfig" source "drivers/crypto/Kconfig" +source "drivers/ddr/Kconfig" + source "drivers/demo/Kconfig" source "drivers/ddr/fsl/Kconfig"drivers/ddr/Kconfig new file +1
-0@@ -0,0 +1 @@ +source "drivers/ddr/altera/Kconfig"drivers/ddr/altera/Kconfig new file +0
-0
drivers/ddr/altera/Kconfig line 4
Quoted 4 lines
drivers/ddr/altera/Kconfig new file +4
-0@@ -0,0 +1,6 @@ +config ALTERA_SDRAM + bool "SoCFPGA DDR SDRAM driver" + depends on TARGET_SOCFPGA_GEN5 + default y if TARGET_SOCFPGA_GEN5
The arch/arm/mach-socfpga/Kconfig should select this, so drop the default y part
Quoted 31 lines
drivers/ddr/altera/Kconfig new file +2
-0+ help + Enable DDR SDRAM controller for the SoCFPGA devices.drivers/ddr/altera/Makefile +3
-1@@ -8,4 +8,6 @@ # SPDX-License-Identifier: GPL-2.0+ # -obj-$(CONFIG_ALTERA_SDRAM) += sdram.o sequencer.o +ifdef CONFIG_ALTERA_SDRAM +obj-$(CONFIG_TARGET_SOCFPGA_GEN5) += sdram.o sequencer.o +endifinclude/configs/socfpga_common.h +0
-5@@ -77,11 +77,6 @@#define CONFIG_SYS_PL310_BASE SOCFPGA_MPUL2_ADDRESS/* -* SDRAM controller -*/ -#define CONFIG_ALTERA_SDRAM - -/* * EPCS/EPCQx1 Serial Flash Controller */ #ifdef CONFIG_ALTERA_SPI
Signature · 2 lines
Best regards, Marek Vasut
PATCH v3 16/19 arm: socfpga: Convert Altera DDR SDRAM driver to use Kconfig
Quoted 42 lines · Marek Vasut
Quoted 41 lines · Ley Foon Tan
Convert Altera DDR SDRAM driver to use
Kconfigmethod. EnableALTERA_SDRAMby default if it is on Gen5 target. Arria 10 will have different driver.Signed-off-by Tien Fong Chee <[email protected]>Signed-off-by Ley Foon Tan <[email protected]>--- drivers/Kconfig | 2 ++ drivers/ddr/Kconfig | 1 + drivers/ddr/altera/Kconfig | 6 ++++++ drivers/ddr/altera/Makefile | 4 +++- include/configs/socfpga_common.h | 5 ----- 5 files changed, 12 insertions(+), 6 deletions(-) create mode 100644 drivers/ddr/Kconfig create mode 100644 drivers/ddr/altera/Kconfigdrivers/Kconfig +2
-0@@ -14,6 +14,8 @@ source "drivers/cpu/Kconfig" source "drivers/crypto/Kconfig" +source "drivers/ddr/Kconfig" + source "drivers/demo/Kconfig" source "drivers/ddr/fsl/Kconfig"drivers/ddr/Kconfig new file +1
-0@@ -0,0 +1 @@ +source "drivers/ddr/altera/Kconfig"drivers/ddr/altera/Kconfig new file +0
-0
Quoted 8 lines
drivers/ddr/altera/Kconfig line 4
Quoted 5 lines
drivers/ddr/altera/Kconfig new file +4
-0@@ -0,0 +1,6 @@ +config ALTERA_SDRAM + bool "SoCFPGA DDR SDRAM driver" + depends on TARGET_SOCFPGA_GEN5 + default y if TARGET_SOCFPGA_GEN5The
arch/arm/mach-socfpga/Kconfigshould select this, so drop the default y part
Okay.
Thanks.
Regards
Ley Foon
[...]
PATCH v3 7/19 arm: socfpga: Add clock driver for Arria 10
In reply to Marek VasutQuoted 11 lines · Marek Vasut
Quoted 7 lines · Ley Foon Tan
Add clock driver support for Arria 10.
Signed-off-by Tien Fong Chee <[email protected]>Signed-off-by Ley Foon Tan <[email protected]>Conflicts:
arch/arm/mach-socfpga/clock_manager.c^ what's this "conflicts" about ?
It was leave over from git rebase, will remove it.
Regards
Ley Foon
PATCH v3 4/19 arm: socfpga: Restructure misc driver
In reply to Dinh NguyenQuoted 38 lines · Dinh Nguyen
Quoted 37 lines · Ley Foon Tan
Restructure misc driver in the preparation to support A10. Move the Gen5 specific code to gen5 file. No functional change.
Change all
uint32_t_tou32.Signed-off-by Ley Foon Tan <[email protected]>--- arch/arm/mach-socfpga/Makefile | 2 +- arch/arm/mach-socfpga/include/mach/misc.h | 25 ++ arch/arm/mach-socfpga/misc.c | 361 ++------------------------ arch/arm/mach-socfpga/{misc.c => misc_gen5.c} | 149 ++--------- 4 files changed, 60 insertions(+), 477 deletions(-) create mode 100644 arch/arm/mach-socfpga/include/mach/misc.h copy arch/arm/mach-socfpga/{misc.c => misc_gen5.c} (73%)arch/arm/mach-socfpga/Makefile +1
-1@@ -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 +3
-0@@ -0,0 +1,25 @@ +/* +* Copyright (C) 2016-2017 Intel Corporation +*
Quoted 8 lines
arch/arm/mach-socfpga/include/mach/misc.h line 5
Quoted 2 lines
arch/arm/mach-socfpga/include/mach/misc.h new file +2
-0+* SPDX-License-Identifier: GPL-2.0 +*/ In the
reset_manager_gen5.hfile, patch #02, you are still using Altera in the header and it was GPL-2.0+ license.
Now you're using Intel and GPL-2.0, I'm not sure which is right, but I think it should be Intel for all new files?
Let's be consistent?
reset_manager_gen5.h is moved from reset_manager.h. So, I keep its original license header for it.
But, arch/arm/mach-socfpga/include/mach/misc.h is a new file. So, we use Intel license header for all new files.
Regards
Ley Foon
PATCH v3 2/19 arm: socfpga: Restructure reset manager driver
In reply to Dinh NguyenQuoted 24 lines · Dinh Nguyen
Quoted 20 lines · Ley Foon Tan
Restructure reset manager driver in the preparation to support A10. Move the Gen5 specific code to gen5 files. Minor update in
socfpga_per_reset(). No functional change.Signed-off-by Ley Foon Tan <[email protected]>--- arch/arm/mach-socfpga/Makefile | 2 +- arch/arm/mach-socfpga/include/mach/reset_manager.h | 48 ++--------- .../mach-socfpga/include/mach/reset_manager_gen5.h | 47 +++++++++++ arch/arm/mach-socfpga/reset_manager.c | 93 +--------------------- .../{reset_manager.c => reset_manager_gen5.c} | 51 ++++++------ 5 files changed, 81 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 +0
-0@@ -14,7 +14,7 @@ obj-$(CONFIG_SPL_BUILD) += spl.o freeze_controller.o[snip]
Quoted 1 line
Quoted 4 lines
arch/arm/mach-socfpga/Makefile
Quoted 2 lines
arch/arm/mach-socfpga/Makefile +1
-1-void socfpga_bridges_reset(int enable); +int socfpga_bridges_reset(int enable);You're changing the return type, to me, that's a functional change.
Will update the commit message.
Quoted 15 lines
[snip]
arch/arm/mach-socfpga/Makefile void socfpga_per_reset_all(void) · line 24
Quoted 10 lines
/*
* Write the reset manager register to cause resetarch/arm/mach-socfpga/Makefile +2
-2@@ -61,8 +20,8 @@ void socfpga_per_reset_all(void) void reset_cpu(ulong addr) { /* request a warm reset */ - writel((1 << RSTMGR_CTRL_SWWARMRSTREQ_LSB), - &reset_manager_base->ctrl); + writel(1 << RSTMGR_CTRL_SWWARMRSTREQ_LSB, + &reset_manager_base->ctrl);What's the reason for the above change?
Requested by Marek to remove extra parenthesis.
Quoted 23 lines
[snip]
Quoted 21 lines
arch/arm/mach-socfpga/Makefile +3
-3@@ -90,9 +84,9 @@ void socfpga_bridges_reset(int enable) #define L3REGS_REMAP_HPS2FPGA_MASK 0x08 #define L3REGS_REMAP_OCRAM_MASK 0x01 -void socfpga_bridges_reset(int enable) +int socfpga_bridges_reset(int enable) { - const uint32_t l3mask = L3REGS_REMAP_LWHPS2FPGA_MASK | + const u32 l3mask = L3REGS_REMAP_LWHPS2FPGA_MASK | L3REGS_REMAP_HPS2FPGA_MASK | L3REGS_REMAP_OCRAM_MASK;@@ -107,7 +101,7 @@ void socfpga_bridges_reset(int enable) if (!fpgamgr_test_fpga_ready()) { /* FPGA not ready, do nothing. */ printf("%s: FPGA not ready, aborting.\n", __func__); - return; + return -EINVAL; }
Quoted 8 lines
arch/arm/mach-socfpga/Makefile void socfpga_bridges_reset(int enable) · line 113
Quoted 6 lines
arch/arm/mach-socfpga/Makefile +1
-0/* brdmodrst */@@ -116,5 +110,6 @@ void socfpga_bridges_reset(int enable) /* Remap the bridges into memory map */ writel(l3mask, SOCFPGA_L3REGS_ADDRESS); } + return 0;How are you intending to use these return values?
Will display error when error and hang().
Regards
Ley Foon
PATCH v3 1/19 arm: socfpga: Restructure clock manager driver
In reply to Dinh NguyenQuoted 23 lines · Dinh Nguyen
Quoted 18 lines · Ley Foon Tan
Restructure clock manager driver in the preparation to support A10. Move the Gen5 specific code to
_gen5files. No functional change.Change all
uint32_tto u32 and change to use macro BIT(n) for bit shift.Signed-off-by Ley Foon Tan <[email protected]>--- arch/arm/mach-socfpga/Makefile | 3 +- arch/arm/mach-socfpga/clock_manager.c | 515 +-------------------- .../{clock_manager.c => clock_manager_gen5.c} | 104 ++--- arch/arm/mach-socfpga/include/mach/clock_manager.h | 316 +------------ .../mach/{clock_manager.h => clock_manager_gen5.h} | 151 +++--- 5 files changed, 125 insertions(+), 964 deletions(-) copy arch/arm/mach-socfpga/{clock_manager.c => clock_manager_gen5.c} (88%) copy arch/arm/mach-socfpga/include/mach/{clock_manager.h => clock_manager_gen5.h} (80%)arch/arm/mach-socfpga/Makefile +0
-0[snip]
Quoted 1 line
Quoted 6 lines
arch/arm/mach-socfpga/Makefile
Quoted 4 lines
/* function to write a clock register that has phase information */
arch/arm/mach-socfpga/Makefile +1
-2-static void cm_write_with_phase(uint32_t value, - uint32_t reg_address, uint32_t mask) +static int cm_write_with_phase(u32 value, u32 reg_address, u32 mask)You changed the return type of this function here...
Will update commit message for more detail.
Quoted 72 lines
Quoted 9 lines
{
arch/arm/mach-socfpga/Makefile +4
-2+ int ret; + /* poll until phase is zero */ - while (readl(reg_address) & mask) - ; + ret = wait_for_bit(__func__, (const u32 *)reg_address, mask, + false, 20000, false);arch/arm/mach-socfpga/Makefile
Quoted 10 lines
arch/arm/mach-socfpga/Makefile +4
-2+ if (ret) + return ret; writel(value, reg_address); - while (readl(reg_address) & mask) - ; + return wait_for_bit(__func__, (const u32 *)reg_address, mask, + false, 20000, false); }because now, you got a 20 seconds timeout and a return value if there is a timeout,
Quoted 49 lines
/*
arch/arm/mach-socfpga/Makefile +5
-10@@ -233,11 +215,6 @@ void cm_basic_init(const struct cm_config * const cfg) writel(cfg->gpiodiv, &clock_manager_base->per_pll.gpiodiv); -#define LOCKED_MASK \ - (CLKMGR_INTER_SDRPLLLOCKED_MASK | \ - CLKMGR_INTER_PERPLLLOCKED_MASK | \ - CLKMGR_INTER_MAINPLLLOCKED_MASK) - cm_wait_for_lock(LOCKED_MASK); /* write the sdram clock counters before toggling outreset all */@@ -257,13 +234,13 @@ void cm_basic_init(const struct cm_config * const cfg) * after locking, but before taking out of bypass * assert/deassert outresetall */ - uint32_t mainvco = readl(&clock_manager_base->main_pll.vco); + u32 mainvco = readl(&clock_manager_base->main_pll.vco); /* assert main outresetall */ writel(mainvco | CLKMGR_MAINPLLGRP_VCO_OUTRESETALL_MASK, &clock_manager_base->main_pll.vco); - uint32_t periphvco = readl(&clock_manager_base->per_pll.vco); + u32 periphvco = readl(&clock_manager_base->per_pll.vco); /* assert pheriph outresetall */ writel(periphvco | CLKMGR_PERPLLGRP_VCO_OUTRESETALL_MASK,@@ -291,20 +268,20 @@ void cm_basic_init(const struct cm_config * const cfg) * are aligned nicely; so we can change any phase. */ cm_write_with_phase(cfg->ddrdqsclk, - (uint32_t)&clock_manager_base->sdr_pll.ddrdqsclk, + (u32)&clock_manager_base->sdr_pll.ddrdqsclk, CLKMGR_SDRPLLGRP_DDRDQSCLK_PHASE_MASK); /* SDRAM DDR2XDQSCLK */ cm_write_with_phase(cfg->ddr2xdqsclk, - (uint32_t)&clock_manager_base->sdr_pll.ddr2xdqsclk, + (u32)&clock_manager_base->sdr_pll.ddr2xdqsclk, CLKMGR_SDRPLLGRP_DDR2XDQSCLK_PHASE_MASK); cm_write_with_phase(cfg->ddrdqclk, - (uint32_t)&clock_manager_base->sdr_pll.ddrdqclk, + (u32)&clock_manager_base->sdr_pll.ddrdqclk, CLKMGR_SDRPLLGRP_DDRDQCLK_PHASE_MASK);
Quoted 7 lines
arch/arm/mach-socfpga/Makefile void cm_basic_init(const struct cm_config * const cfg) · line 286
Quoted 5 lines
arch/arm/mach-socfpga/Makefile +1
-1cm_write_with_phase(cfg->s2fuser2clk, - (uint32_t)&clock_manager_base->sdr_pll.s2fuser2clk, + (u32)&clock_manager_base->sdr_pll.s2fuser2clk, CLKMGR_SDRPLLGRP_S2FUSER2CLK_PHASE_MASK);but you're not checking the return value at all?
Will check the return value from cm_write_with_phase() and cm_basic_init(). Thanks.
Regards
Ley Foon