[PATCH 0/2] Refactor ASPEED AST2500 DDR SDRAM driver structure

This patch series improves the maintainability of the ASPEED DDR SDRAM driver. It moves the source code files from arch/arm/mach-aspeed to drives/ram/aspeed and so that it is more easier to add configurations such as dual-x8-die configs.
Dylan Hung (2): ram: move aspeed ram driver into drivers/ directory ram: add ddr4 dual x8 configuration
arch/arm/mach-aspeed/ast2500/Makefile | 2 +- drivers/ram/Kconfig | 1 + drivers/ram/Makefile | 1 + drivers/ram/aspeed/Kconfig | 10 ++++++++++ drivers/ram/aspeed/Makefile | 3 +++ .../ast2500 => drivers/ram/aspeed}/sdram_ast2500.c | 2 +- 6 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 drivers/ram/aspeed/Kconfig create mode 100644 drivers/ram/aspeed/Makefile rename {arch/arm/mach-aspeed/ast2500 => drivers/ram/aspeed}/sdram_ast2500.c (99%)

to improve the maintainability. It is more easier to modify and add configurations of the driver in the centralized ram driver directory.
Signed-off-by: Dylan Hung dylan_hung@aspeedtech.com --- arch/arm/mach-aspeed/ast2500/Makefile | 2 +- drivers/ram/Makefile | 1 + drivers/ram/aspeed/Makefile | 3 +++ .../mach-aspeed/ast2500 => drivers/ram/aspeed}/sdram_ast2500.c | 0 4 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 drivers/ram/aspeed/Makefile rename {arch/arm/mach-aspeed/ast2500 => drivers/ram/aspeed}/sdram_ast2500.c (100%)
diff --git a/arch/arm/mach-aspeed/ast2500/Makefile b/arch/arm/mach-aspeed/ast2500/Makefile index 4c27c8fc46..db70432ad0 100644 --- a/arch/arm/mach-aspeed/ast2500/Makefile +++ b/arch/arm/mach-aspeed/ast2500/Makefile @@ -1,3 +1,3 @@ obj-y += lowlevel_init.o obj-y += board_common.o -obj-y += clk_ast2500.o sdram_ast2500.o +obj-y += clk_ast2500.o diff --git a/drivers/ram/Makefile b/drivers/ram/Makefile index 769c9d6218..a57d506752 100644 --- a/drivers/ram/Makefile +++ b/drivers/ram/Makefile @@ -14,6 +14,7 @@ obj-$(CONFIG_ARCH_ROCKCHIP) += rockchip/
obj-$(CONFIG_K3_AM654_DDRSS) += k3-am654-ddrss.o obj-$(CONFIG_ARCH_MEDIATEK) += mediatek/ +obj-$(CONFIG_ARCH_ASPEED) += aspeed/ obj-$(CONFIG_K3_J721E_DDRSS) += k3-j721e/
obj-$(CONFIG_IMXRT_SDRAM) += imxrt_sdram.o diff --git a/drivers/ram/aspeed/Makefile b/drivers/ram/aspeed/Makefile new file mode 100644 index 0000000000..af604f8a4b --- /dev/null +++ b/drivers/ram/aspeed/Makefile @@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +obj-$(CONFIG_ASPEED_AST2500) += sdram_ast2500.o \ No newline at end of file diff --git a/arch/arm/mach-aspeed/ast2500/sdram_ast2500.c b/drivers/ram/aspeed/sdram_ast2500.c similarity index 100% rename from arch/arm/mach-aspeed/ast2500/sdram_ast2500.c rename to drivers/ram/aspeed/sdram_ast2500.c

the aspeed ddr sdram controller needs to know if the memory chip mounted on the board is dual x8 die or not. Or it may get the wrong size of the memory space.
Signed-off-by: Dylan Hung dylan_hung@aspeedtech.com --- drivers/ram/Kconfig | 1 + drivers/ram/aspeed/Kconfig | 10 ++++++++++ drivers/ram/aspeed/sdram_ast2500.c | 2 +- 3 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 drivers/ram/aspeed/Kconfig
diff --git a/drivers/ram/Kconfig b/drivers/ram/Kconfig index 7e6e981897..d277237288 100644 --- a/drivers/ram/Kconfig +++ b/drivers/ram/Kconfig @@ -76,3 +76,4 @@ config IMXRT_SDRAM source "drivers/ram/rockchip/Kconfig" source "drivers/ram/sifive/Kconfig" source "drivers/ram/stm32mp1/Kconfig" +source "drivers/ram/aspeed/Kconfig" diff --git a/drivers/ram/aspeed/Kconfig b/drivers/ram/aspeed/Kconfig new file mode 100644 index 0000000000..020c913188 --- /dev/null +++ b/drivers/ram/aspeed/Kconfig @@ -0,0 +1,10 @@ +if RAM || SPL_RAM +config ASPEED_DDR4_DUALX8 + bool "Enable Dual X8 DDR4 die" + depends on DM && OF_CONTROL && ARCH_ASPEED + default n + help + Say Y if dual X8 DDR4 die is used on the board. The aspeed ddr sdram + controller needs to know if the memory chip mounted on the board is dual + x8 die or not. Or it may get the wrong size of the memory space. +endif diff --git a/drivers/ram/aspeed/sdram_ast2500.c b/drivers/ram/aspeed/sdram_ast2500.c index a3adaa8a99..8bfbf562c3 100644 --- a/drivers/ram/aspeed/sdram_ast2500.c +++ b/drivers/ram/aspeed/sdram_ast2500.c @@ -247,7 +247,7 @@ static int ast2500_sdrammc_init_ddr4(struct dram_info *info) | SDRAM_PCR_RESETN_DIS | SDRAM_PCR_RGAP_CTRL_EN | SDRAM_PCR_ODT_EN | SDRAM_PCR_ODT_EXT_EN; const u32 conf = (SDRAM_CONF_CAP_1024M << SDRAM_CONF_CAP_SHIFT) -#ifdef CONFIG_DUALX8_RAM +#ifdef CONFIG_ASPEED_DDR4_DUALX8 | SDRAM_CONF_DUALX8 #endif | SDRAM_CONF_SCRAMBLE | SDRAM_CONF_SCRAMBLE_PAT2 | SDRAM_CONF_DDR4;
participants (1)
-
Dylan Hung