Move Stratix 10 SDRAM driver to DM
Subsystems (4)
v5 cover Move Stratix 10 SDRAM driver to DM
Compile ALTERA_SDRAM driver in SPL only and move Stratix 10 SDRAM driver to DM.
v4->v5:
- Rebase patches to u-boot/master branch.
v3 -> v4:
- Add CONFIG_SPL_ALTERA_SDRAM to config_whitelist.txt in patch [1/3] and remove it in patch [3/3]
- Remove _remove().
- Update commit message in patch [2/3]
v2->v3:
-------
- Compile ALTERA_SDRAM driver in SPL only
- Separate dts change to new patch
- Change to use #if CONFIG_IS_ENABLED(ALTERA_SDRAM)
- Add _remove()
- Remove #ifdef CONFIG_SPL_BUILD checking in sdram_s10.c
History:
--------
[v1]: https://patchwork.ozlabs.org/patch/1066765/
[v2]: https://patchwork.ozlabs.org/patch/1089957/
[v3]: https://patchwork.ozlabs.org/cover/1093091/
[v4]: https://patchwork.ozlabs.org/cover/1094672/
Ley Foon Tan (3):
ddr: altera: Compile ALTERA SDRAM in SPL only
arm: dts: Stratix10: Add SDRAM node
arm: socfpga: Move Stratix 10 SDRAM driver to DM
Makefile | 2 +-
arch/arm/dts/socfpga_stratix10.dtsi | 9 +
arch/arm/mach-socfpga/Kconfig | 4 +-
arch/arm/mach-socfpga/spl_s10.c | 16 +-
configs/socfpga_stratix10_defconfig | 1 +
drivers/Makefile | 2 +-
drivers/ddr/altera/Kconfig | 11 +-
drivers/ddr/altera/Makefile | 2 +-
drivers/ddr/altera/sdram_s10.c | 243 ++++++++++++------
.../mach => drivers/ddr/altera}/sdram_s10.h | 4 -
include/configs/socfpga_stratix10_socdk.h | 5 -
11 files changed, 200 insertions(+), 99 deletions(-)
rename {arch/arm/mach-socfpga/include/mach => drivers/ddr/altera}/sdram_s10.h (97%)Signature · 1 line
2.19.0
PATCH v5 1/3 ddr: altera: Compile ALTERA SDRAM in SPL only
Compile ALTERA_SDRAM driver in SPL only.
Rename ALTERA_SDRAM to SPL_ALTERA_SDRAM.
--- Makefile | 2 +- arch/arm/mach-socfpga/Kconfig | 4 ++-- drivers/Makefile | 2 +- drivers/ddr/altera/Kconfig | 5 +++-- drivers/ddr/altera/Makefile | 2 +- include/configs/socfpga_stratix10_socdk.h | 2 +- scripts/config_whitelist.txt | 1 + 7 files changed, 10 insertions(+), 8 deletions(-)
Makefile +1 -1
@@ -713,7 +713,7 @@ libs-y += drivers/spi/ libs-$(CONFIG_FMAN_ENET) += drivers/net/fm/ libs-$(CONFIG_SYS_FSL_DDR) += drivers/ddr/fsl/ libs-$(CONFIG_SYS_FSL_MMDC) += drivers/ddr/fsl/ -libs-$(CONFIG_ALTERA_SDRAM) += drivers/ddr/altera/ +libs-$(CONFIG_$(SPL_)ALTERA_SDRAM) += drivers/ddr/altera/ libs-y += drivers/serial/ libs-y += drivers/usb/dwc3/ libs-y += drivers/usb/common/
arch/arm/mach-socfpga/Kconfig +2 -2
@@ -26,7 +26,7 @@ config TARGET_SOCFPGA_ARRIA5 config TARGET_SOCFPGA_ARRIA10 bool - select ALTERA_SDRAM + select SPL_ALTERA_SDRAM select SPL_BOARD_INIT if SPL select CLK select SPL_CLK if SPL
@@ -47,7 +47,7 @@ config TARGET_SOCFPGA_CYCLONE5 config TARGET_SOCFPGA_GEN5 bool - select ALTERA_SDRAM + select SPL_ALTERA_SDRAM imply FPGA_SOCFPGA imply SPL_STACK_R imply SPL_SYS_MALLOC_SIMPLE
drivers/Makefile +1 -1
@@ -34,7 +34,7 @@ obj-$(CONFIG_SPL_CRYPTO_SUPPORT) += crypto/ obj-$(CONFIG_SPL_MPC8XXX_INIT_DDR_SUPPORT) += ddr/fsl/ obj-$(CONFIG_ARMADA_38X) += ddr/marvell/a38x/ obj-$(CONFIG_ARMADA_XP) += ddr/marvell/axp/ -obj-$(CONFIG_ALTERA_SDRAM) += ddr/altera/ +obj-$(CONFIG_$(SPL_)ALTERA_SDRAM) += ddr/altera/ obj-$(CONFIG_ARCH_IMX8M) += ddr/imx/imx8m/ obj-$(CONFIG_SPL_POWER_SUPPORT) += power/ power/pmic/ obj-$(CONFIG_SPL_POWER_SUPPORT) += power/regulator/
drivers/ddr/altera/Kconfig +3 -2
@@ -1,5 +1,6 @@ -config ALTERA_SDRAM - bool "SoCFPGA DDR SDRAM driver" +config SPL_ALTERA_SDRAM + bool "SoCFPGA DDR SDRAM driver in SPL" + depends on SPL depends on TARGET_SOCFPGA_GEN5 || TARGET_SOCFPGA_ARRIA10 select RAM if TARGET_SOCFPGA_GEN5 select SPL_RAM if TARGET_SOCFPGA_GEN5
drivers/ddr/altera/Makefile +1 -1
@@ -6,7 +6,7 @@ # (C) Copyright 2010, Thomas Chou <[email protected]> # Copyright (C) 2014 Altera Corporation <www.altera.com> -ifdef CONFIG_ALTERA_SDRAM +ifdef CONFIG_$(SPL_)ALTERA_SDRAM obj-$(CONFIG_TARGET_SOCFPGA_GEN5) += sdram_gen5.o sequencer.o obj-$(CONFIG_TARGET_SOCFPGA_ARRIA10) += sdram_arria10.o obj-$(CONFIG_TARGET_SOCFPGA_STRATIX10) += sdram_s10.o
include/configs/socfpga_stratix10_socdk.h +1 -1
@@ -132,7 +132,7 @@ unsigned int cm_get_qspi_controller_clk_hz(void);/* * SDRAM controller */ -#define CONFIG_ALTERA_SDRAM +#define CONFIG_SPL_ALTERA_SDRAM /* * Serial / UART configurations
scripts/config_whitelist.txt +1 -0
@@ -1824,6 +1824,7 @@ CONFIG_SPLASH_SCREEN_ALIGN CONFIG_SPLASH_SOURCE CONFIG_SPLL_FREQ CONFIG_SPL_ +CONFIG_SPL_ALTERA_SDRAM CONFIG_SPL_ATMEL_SIZE CONFIG_SPL_BOARD_LOAD_IMAGE CONFIG_SPL_BOOTROM_SAVE
Signature · 1 line
2.19.0
PATCH v5 2/3 arm: dts: Stratix10: Add SDRAM node
In reply to Ley Foon TanAdd SDRAM device tree node.
--- arch/arm/dts/socfpga_stratix10.dtsi | 9 +++++++++ 1 file changed, 9 insertions(+)
arch/arm/dts/socfpga_stratix10.dtsi +9 -0
@@ -258,6 +258,15 @@ u-boot,dm-pre-reloc; }; + sdr: sdr at f8000400 { + compatible = "altr,sdr-ctl-s10"; + reg = <0xf8000400 0x80>, + <0xf8010000 0x190>, + <0xf8011000 0x500>; + resets = <&rst DDRSCH_RESET>; + u-boot,dm-pre-reloc; + }; + spi0: spi at ffda4000 { compatible = "snps,dw-apb-ssi"; #address-cells = <1>;
Signature · 1 line
2.19.0
PATCH v5 3/3 arm: socfpga: Move Stratix 10 SDRAM driver to DM
In reply to Ley Foon TanConvert Stratix 10 SDRAM driver to device model.
Get rid of call to socfpga_per_reset() and use reset framework.
SPL is changed from calling function in SDRAM driver directly to just probing UCLASS_RAM.
Move sdram_s10.h from arch to driver/ddr/altera directory.
---
arch/arm/mach-socfpga/spl_s10.c | 16 +-
configs/socfpga_stratix10_defconfig | 1 +
drivers/ddr/altera/Kconfig | 6 +-
drivers/ddr/altera/sdram_s10.c | 243 ++++++++++++------
.../mach => drivers/ddr/altera}/sdram_s10.h | 4 -
include/configs/socfpga_stratix10_socdk.h | 5 -
scripts/config_whitelist.txt | 1 -
7 files changed, 183 insertions(+), 93 deletions(-)
rename {arch/arm/mach-socfpga/include/mach => drivers/ddr/altera}/sdram_s10.h (97%)arch/arm/mach-socfpga/spl_s10.c +10 -6
@@ -15,9 +15,9 @@#include <asm/arch/firewall_s10.h> #include <asm/arch/mailbox_s10.h> #include <asm/arch/reset_manager.h> -#include <asm/arch/sdram_s10.h> #include <asm/arch/system_manager.h> #include <watchdog.h> +#include <dm/uclass.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -175,11 +175,15 @@ void board_init_f(ulong dummy)clrbits_le32 (CCU_REG_ADDR (CCU_IOM_MPRT_ADMASK_MEM_RAM0 ),CCU_ADMASK_P_MASK |CCU_ADMASK_NS_MASK ); -debug ("DDR: Initializing Hard Memory Controller\n" ); -if (sdram_mmr_init_full (0 )) { -puts ("DDR: Initialization failed.\n" ); -hang (); - } +#if CONFIG_IS_ENABLED (ALTERA_SDRAM ) +struct udevice *dev; + + ret =uclass_get_device (UCLASS_RAM ,0 , &dev); +if (ret) { +debug ("DRAM init failed: %d\n" , ret); +hang (); + } +#endif mbox_init ();
configs/socfpga_stratix10_defconfig +1 -0
@@ -31,6 +31,7 @@ CONFIG_DEFAULT_DEVICE_TREE="socfpga_stratix10_socdk" CONFIG_ENV_IS_IN_MMC=y CONFIG_NET_RANDOM_ETHADDR=y CONFIG_SPL_DM_SEQ_ALIAS=y +CONFIG_SPL_ALTERA_SDRAM=y CONFIG_DM_GPIO=y CONFIG_DWAPB_GPIO=y CONFIG_DM_I2C=y
drivers/ddr/altera/Kconfig +3 -3
@@ -1,8 +1,8 @@ config SPL_ALTERA_SDRAM bool "SoCFPGA DDR SDRAM driver in SPL" depends on SPL - depends on TARGET_SOCFPGA_GEN5 || TARGET_SOCFPGA_ARRIA10 - select RAM if TARGET_SOCFPGA_GEN5 - select SPL_RAM if TARGET_SOCFPGA_GEN5 + depends on TARGET_SOCFPGA_GEN5 || TARGET_SOCFPGA_ARRIA10 || TARGET_SOCFPGA_STRATIX10 + select RAM if TARGET_SOCFPGA_GEN5 || TARGET_SOCFPGA_STRATIX10 + select SPL_RAM if TARGET_SOCFPGA_GEN5 || TARGET_SOCFPGA_STRATIX10 help Enable DDR SDRAM controller for the SoCFPGA devices.
drivers/ddr/altera/sdram_s10.c +169 -74
422 lines not on this page · raw message
drivers/ddr/altera/sdram_s10.h renamed from arch/arm/mach-socfpga/include/mach/sdram_s10.h +0 -4
@@ -7,10 +7,6 @@#ifndef _SDRAM_S10_H_#define _SDRAM_S10_H_ -phys_size_t 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
include/configs/socfpga_stratix10_socdk.h +0 -5
@@ -129,11 +129,6 @@ unsigned int cm_get_qspi_controller_clk_hz(void);#define CONFIG_SYS_MEMTEST_START 0#define CONFIG_SYS_MEMTEST_END PHYS_SDRAM_1_SIZE - 0x200000 -/* -* SDRAM controller -*/ -#define CONFIG_SPL_ALTERA_SDRAM -/* * Serial / UART configurations */
scripts/config_whitelist.txt +0 -1
@@ -1824,7 +1824,6 @@ CONFIG_SPLASH_SCREEN_ALIGN CONFIG_SPLASH_SOURCE CONFIG_SPLL_FREQ CONFIG_SPL_ -CONFIG_SPL_ALTERA_SDRAM CONFIG_SPL_ATMEL_SIZE CONFIG_SPL_BOARD_LOAD_IMAGE CONFIG_SPL_BOOTROM_SAVE
Signature · 1 line
2.19.0
Marek Vasut
Appliedv5 cover Move Stratix 10 SDRAM driver to DM
In reply to Ley Foon TanQuoted 30 lines · Ley Foon Tan
Compile
ALTERA_SDRAMdriver in SPL only and move Stratix 10 SDRAM driver to DM.
v4->v5:
- Rebase patches to u-boot/master branch.v3 -> v4:
- AddCONFIG_SPL_ALTERA_SDRAMto config_whitelist.txt in patch [1/3] and remove it in patch [3/3]
- Remove_remove().
- Update commit message in patch [2/3]
v2->v3:
-------
- CompileALTERA_SDRAMdriver in SPL only
- Separate dts change to new patch
- Change to use #ifCONFIG_IS_ENABLED(ALTERA_SDRAM)
- Add_remove()
- Remove #ifdefCONFIG_SPL_BUILDchecking insdram_s10.cHistory:
--------
[v1]: https://patchwork.ozlabs.org/patch/1066765/
[v2]: https://patchwork.ozlabs.org/patch/1089957/
[v3]: https://patchwork.ozlabs.org/cover/1093091/
[v4]: https://patchwork.ozlabs.org/cover/1094672/Ley Foon Tan (3):
ddr: altera: Compile ALTERA SDRAM in SPL only
arm: dts: Stratix10: Add SDRAM node
arm: socfpga: Move Stratix 10 SDRAM driver to DM
Quoted 14 lines
Makefile | 2 +-
arch/arm/dts/socfpga_stratix10.dtsi | 9 +
arch/arm/mach-socfpga/Kconfig | 4 +-
arch/arm/mach-socfpga/spl_s10.c | 16 +-
configs/socfpga_stratix10_defconfig | 1 +
drivers/Makefile | 2 +-
drivers/ddr/altera/Kconfig | 11 +-
drivers/ddr/altera/Makefile | 2 +-
drivers/ddr/altera/sdram_s10.c | 243 ++++++++++++------
.../mach => drivers/ddr/altera}/sdram_s10.h | 4 -
include/configs/socfpga_stratix10_socdk.h | 5 -
11 files changed, 200 insertions(+), 99 deletions(-)
rename {arch/arm/mach-socfpga/include/mach => drivers/ddr/altera}/sdram_s10.h (97%)Applied all to master, thanks!
Signature · 2 lines
Best regards, Marek Vasut