Skip to contentSkip to conversation

Refactor ASPEED AST2500 DDR SDRAM driver structure

PATCH New Dylan Hung 1 participant 3 messages Sep 7, 2020

Subsystems (3)
lore
Share & tools
lore

Dylan Hung

author
#0 lore raw

cover 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%)
Signature · 1 line
2.17.1
author
#1 lore raw

PATCH 1/2 ram: move aspeed ram driver into drivers/ directory

to improve the maintainability. It is more easier to modify and add configurations of the driver in the centralized ram driver directory.

---
 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%)
arch/arm/mach-aspeed/ast2500/Makefile +1 -1
index 4c27c8fc46..db70432ad0 100644
@@ -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
drivers/ram/Makefile +1 -0
index 769c9d6218..a57d506752 100644
@@ -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
drivers/ram/aspeed/Makefile new file +3 -0
new file mode 100644
index 0000000000..af604f8a4b
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+obj-$(CONFIG_ASPEED_AST2500) += sdram_ast2500.o
\ No newline at end of file
drivers/ram/aspeed/sdram_ast2500.c renamed from arch/arm/mach-aspeed/ast2500/sdram_ast2500.c +0 -0
similarity index 100%
rename from arch/arm/mach-aspeed/ast2500/sdram_ast2500.c
rename to drivers/ram/aspeed/sdram_ast2500.c
Signature · 1 line
2.17.1
author
#2 lore raw

PATCH 2/2 ram: add ddr4 dual x8 configuration

In reply to Dylan Hung

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.

---
 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
drivers/ram/Kconfig +1 -0
index 7e6e981897..d277237288 100644
@@ -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"
drivers/ram/aspeed/Kconfig new file +10 -0
new file mode 100644
index 0000000000..020c913188
@@ -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
drivers/ram/aspeed/sdram_ast2500.c +1 -1
index a3adaa8a99..8bfbf562c3 100644
@@ -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;
Signature · 1 line
2.17.1