summaryrefslogtreecommitdiff
path: root/drivers/memory
diff options
context:
space:
mode:
authorBastien Curutchet <[email protected]>2024-10-21 17:13:26 +0200
committerTom Rini <[email protected]>2024-10-29 18:45:22 -0600
commit1ba44c8eed7c1c623f7010401bb0b8d2e59a8d8a (patch)
tree3fd441e6d1fba932c8198603cc6d66ec1f8dd5cc /drivers/memory
parent7a7b13838f11f6dbb3049a44b8884e9139f39b5e (diff)
memory: ti-aemif: Make AEMIF driver architecture agnostic
AEMIF controller is present on other SoCs than the Keystone ones. Remove Keystone specificities from the driver to be able to use it from other architectures. Adapt the ks2_evm/board.c to fit the new driver. Signed-off-by: Bastien Curutchet <[email protected]> Reviewed-by: Tom Rini <[email protected]>
Diffstat (limited to 'drivers/memory')
-rw-r--r--drivers/memory/ti-aemif.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/memory/ti-aemif.c b/drivers/memory/ti-aemif.c
index 127a262894a..8e7ddde970b 100644
--- a/drivers/memory/ti-aemif.c
+++ b/drivers/memory/ti-aemif.c
@@ -9,10 +9,10 @@
#include <asm/arch/hardware.h>
#include <asm/ti-common/ti-aemif.h>
-#define AEMIF_WAITCYCLE_CONFIG (KS2_AEMIF_CNTRL_BASE + 0x4)
-#define AEMIF_NAND_CONTROL (KS2_AEMIF_CNTRL_BASE + 0x60)
-#define AEMIF_ONENAND_CONTROL (KS2_AEMIF_CNTRL_BASE + 0x5c)
-#define AEMIF_CONFIG(cs) (KS2_AEMIF_CNTRL_BASE + 0x10 + ((cs) * 4))
+#define AEMIF_WAITCYCLE_CONFIG (0x4)
+#define AEMIF_NAND_CONTROL (0x60)
+#define AEMIF_ONENAND_CONTROL (0x5c)
+#define AEMIF_CONFIG(cs) (0x10 + ((cs) * 4))
#define AEMIF_CFG_SELECT_STROBE(v) ((v) ? 1 << 31 : 0)
#define AEMIF_CFG_EXTEND_WAIT(v) ((v) ? 1 << 30 : 0)
@@ -38,17 +38,17 @@ static void aemif_configure(int cs, struct aemif_config *cfg)
unsigned long tmp;
if (cfg->mode == AEMIF_MODE_NAND) {
- tmp = __raw_readl(AEMIF_NAND_CONTROL);
+ tmp = __raw_readl(cfg->base + AEMIF_NAND_CONTROL);
tmp |= (1 << cs);
- __raw_writel(tmp, AEMIF_NAND_CONTROL);
+ __raw_writel(tmp, cfg->base + AEMIF_NAND_CONTROL);
} else if (cfg->mode == AEMIF_MODE_ONENAND) {
- tmp = __raw_readl(AEMIF_ONENAND_CONTROL);
+ tmp = __raw_readl(cfg->base + AEMIF_ONENAND_CONTROL);
tmp |= (1 << cs);
- __raw_writel(tmp, AEMIF_ONENAND_CONTROL);
+ __raw_writel(tmp, cfg->base + AEMIF_ONENAND_CONTROL);
}
- tmp = __raw_readl(AEMIF_CONFIG(cs));
+ tmp = __raw_readl(cfg->base + AEMIF_CONFIG(cs));
set_config_field(tmp, SELECT_STROBE, cfg->select_strobe);
set_config_field(tmp, EXTEND_WAIT, cfg->extend_wait);
@@ -61,7 +61,7 @@ static void aemif_configure(int cs, struct aemif_config *cfg)
set_config_field(tmp, TURN_AROUND, cfg->turn_around);
set_config_field(tmp, WIDTH, cfg->width);
- __raw_writel(tmp, AEMIF_CONFIG(cs));
+ __raw_writel(tmp, cfg->base + AEMIF_CONFIG(cs));
}
void aemif_init(int num_cs, struct aemif_config *config)