diff options
| author | Bastien Curutchet <[email protected]> | 2024-10-21 17:13:28 +0200 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2024-10-29 18:45:22 -0600 |
| commit | 4b43602c8b05ad51ec430f81319c56c40dd00c77 (patch) | |
| tree | 58e64baf1b84bf1cb09f9afda680c3f62c9fb8ab /drivers/memory | |
| parent | f437f786cdba7bd909c480977cfc4de5ab004c3f (diff) | |
memory: ti-aemif: Wrap the CS configuration into a function
Wrap the CS configuration into a aemif_configure_cs() to ease its
migration to another driver when adding DM support.
Signed-off-by: Bastien Curutchet <[email protected]>
Diffstat (limited to 'drivers/memory')
| -rw-r--r-- | drivers/memory/ti-aemif.c | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/drivers/memory/ti-aemif.c b/drivers/memory/ti-aemif.c index 82a9c8cf7b9..5e9514713f2 100644 --- a/drivers/memory/ti-aemif.c +++ b/drivers/memory/ti-aemif.c @@ -34,21 +34,10 @@ } \ } while (0) -static void aemif_configure(int cs, struct aemif_config *cfg) +static void aemif_cs_configure(int cs, struct aemif_config *cfg) { unsigned long tmp; - if (cfg->mode == AEMIF_MODE_NAND) { - tmp = __raw_readl(cfg->base + AEMIF_NAND_CONTROL); - tmp |= (1 << cs); - __raw_writel(tmp, cfg->base + AEMIF_NAND_CONTROL); - - } else if (cfg->mode == AEMIF_MODE_ONENAND) { - tmp = __raw_readl(cfg->base + AEMIF_ONENAND_CONTROL); - tmp |= (1 << cs); - __raw_writel(tmp, cfg->base + AEMIF_ONENAND_CONTROL); - } - tmp = __raw_readl(cfg->base + AEMIF_CONFIG(cs)); set_config_field(tmp, SELECT_STROBE, cfg->select_strobe); @@ -65,6 +54,24 @@ static void aemif_configure(int cs, struct aemif_config *cfg) __raw_writel(tmp, cfg->base + AEMIF_CONFIG(cs)); } +static void aemif_configure(int cs, struct aemif_config *cfg) +{ + unsigned long tmp; + + if (cfg->mode == AEMIF_MODE_NAND) { + tmp = __raw_readl(cfg->base + AEMIF_NAND_CONTROL); + tmp |= (1 << cs); + __raw_writel(tmp, cfg->base + AEMIF_NAND_CONTROL); + + } else if (cfg->mode == AEMIF_MODE_ONENAND) { + tmp = __raw_readl(cfg->base + AEMIF_ONENAND_CONTROL); + tmp |= (1 << cs); + __raw_writel(tmp, cfg->base + AEMIF_ONENAND_CONTROL); + } + + aemif_cs_configure(cs, cfg); +} + void aemif_init(int num_cs, struct aemif_config *config) { int cs; |
