summaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-imx/nand.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2012-10-08 20:52:35 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2012-10-17 20:22:01 +0200
commit632b04f8a6880e9022e09655baad7377c8ade0f5 (patch)
tree6a90efb11d1564fb7e39f5d7f6e1dab586097a6d /arch/arm/mach-imx/nand.c
parent7a334ccdece70ed769af6c1604e488b942685a03 (diff)
downloadbarebox-632b04f8a6880e9022e09655baad7377c8ade0f5.tar.gz
barebox-632b04f8a6880e9022e09655baad7377c8ade0f5.tar.xz
ARM i.MX nand layout: make multisoc safe
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/mach-imx/nand.c')
-rw-r--r--arch/arm/mach-imx/nand.c53
1 files changed, 29 insertions, 24 deletions
diff --git a/arch/arm/mach-imx/nand.c b/arch/arm/mach-imx/nand.c
index fff9a12379..b347664292 100644
--- a/arch/arm/mach-imx/nand.c
+++ b/arch/arm/mach-imx/nand.c
@@ -12,20 +12,20 @@
*/
#include <common.h>
+#include <mach/generic.h>
#include <mach/imx-regs.h>
#include <io.h>
-#if defined(CONFIG_ARCH_IMX35) || defined (CONFIG_ARCH_IMX25)
-
#define RCSR_NFC_FMS (1 << 8)
#define RCSR_NFC_4K (1 << 9)
#define RCSR_NFC_16BIT_SEL (1 << 14)
-void imx_nand_set_layout(int writesize, int datawidth)
+static __maybe_unused void imx25_35_nand_set_layout(void __iomem *reg_rcsr,
+ int writesize, int datawidth)
{
unsigned int rcsr;
- rcsr = readl(IMX_CCM_BASE + CCM_RCSR);
+ rcsr = readl(reg_rcsr);
switch (writesize) {
case 512:
@@ -52,19 +52,18 @@ void imx_nand_set_layout(int writesize, int datawidth)
break;
}
- writel(rcsr, IMX_CCM_BASE + CCM_RCSR);
+ writel(rcsr, reg_rcsr);
}
-#elif defined(CONFIG_ARCH_IMX21) || defined (CONFIG_ARCH_IMX27)
-
#define FMCR_NF_FMS (1 << 5)
#define FMCR_NF_16BIT_SEL (1 << 4)
-void imx_nand_set_layout(int writesize, int datawidth)
+static __maybe_unused void imx21_27_nand_set_layout(void __iomem *reg_fmcr,
+ int writesize, int datawidth)
{
unsigned int fmcr;
- fmcr = FMCR;
+ fmcr = readl(reg_fmcr);
switch (writesize) {
case 512:
@@ -88,23 +87,29 @@ void imx_nand_set_layout(int writesize, int datawidth)
break;
}
- FMCR = fmcr;
-}
-
-#elif defined CONFIG_ARCH_IMX51 || defined CONFIG_ARCH_IMX53
-
-void imx_nand_set_layout(int writesize, int datawidth)
-{
- /* Just silence the compiler warning below. On i.MX51 we don't
- * have external boot.
- */
+ writel(fmcr, reg_fmcr);
}
-#else
-#warning using empty imx_nand_set_layout(). NAND flash will not work properly if not booting from it
-
void imx_nand_set_layout(int writesize, int datawidth)
{
-}
-
+#ifdef CONFIG_ARCH_IMX21
+ if (cpu_is_mx21())
+ imx21_27_nand_set_layout((void *)(MX21_SYSCTRL_BASE_ADDR +
+ 0x14), writesize, datawidth);
#endif
+#ifdef CONFIG_ARCH_IMX27
+ if (cpu_is_mx27())
+ imx21_27_nand_set_layout((void *)(MX27_SYSCTRL_BASE_ADDR +
+ 0x14), writesize, datawidth);
+#endif
+#ifdef CONFIG_ARCH_IMX25
+ if (cpu_is_mx25())
+ imx25_35_nand_set_layout((void *)MX25_CCM_BASE_ADDR +
+ CCM_RCSR, writesize, datawidth);
+#endif
+#ifdef CONFIG_ARCH_IMX35
+ if (cpu_is_mx35())
+ imx25_35_nand_set_layout((void *)MX35_CCM_BASE_ADDR +
+ CCM_RCSR, writesize, datawidth);
+#endif
+}