* [U-Boot] [PATCH v1 0/3] MXC: Add NAND support for i.MX31
@ 2009-11-11 19:18 Magnus Lilja
2009-11-11 19:18 ` [U-Boot] [PATCH v1 1/3] MX31: Add struct definition for clock control module in i.MX31 Magnus Lilja
0 siblings, 1 reply; 5+ messages in thread
From: Magnus Lilja @ 2009-11-11 19:18 UTC (permalink / raw)
To: u-boot
Hi all,
This series adds NAND support for i.MX31 using the mxc_nand driver
that was added for i.MX27. The same NAND flash controller is used
in i.MX31.
Tested on i.MX31 Litekit. MAKEALL ARM11&ARM9 performed.
Regards, Magnus
Magnus Lilja (3):
MX31: Add struct definition for clock control module in i.MX31.
mxc_nand: Update driver to work with i.MX31.
MX31: Activate NAND support for i.MX31 Litekit board.
drivers/mtd/nand/mxc_nand.c | 34 ++++++++++++++++++++++++++--
include/asm-arm/arch-mx31/mx31-regs.h | 39 +++++++++++++++++++++++++++++++++
include/configs/imx31_litekit.h | 10 ++++++++
3 files changed, 80 insertions(+), 3 deletions(-)
^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot] [PATCH v1 1/3] MX31: Add struct definition for clock control module in i.MX31.
2009-11-11 19:18 [U-Boot] [PATCH v1 0/3] MXC: Add NAND support for i.MX31 Magnus Lilja
@ 2009-11-11 19:18 ` Magnus Lilja
2009-11-11 19:18 ` [U-Boot] [PATCH v1 2/3] mxc_nand: Update driver to work with i.MX31 Magnus Lilja
0 siblings, 1 reply; 5+ messages in thread
From: Magnus Lilja @ 2009-11-11 19:18 UTC (permalink / raw)
To: u-boot
Signed-off-by: Magnus Lilja <lilja.magnus@gmail.com>
---
include/asm-arm/arch-mx31/mx31-regs.h | 39 +++++++++++++++++++++++++++++++++
1 files changed, 39 insertions(+), 0 deletions(-)
diff --git a/include/asm-arm/arch-mx31/mx31-regs.h b/include/asm-arm/arch-mx31/mx31-regs.h
index 51b02a2..6f6e9a4 100644
--- a/include/asm-arm/arch-mx31/mx31-regs.h
+++ b/include/asm-arm/arch-mx31/mx31-regs.h
@@ -24,6 +24,45 @@
#ifndef __ASM_ARCH_MX31_REGS_H
#define __ASM_ARCH_MX31_REGS_H
+#if !(defined(__KERNEL_STRICT_NAMES) || defined(__ASSEMBLY__))
+#include <asm/types.h>
+
+/* Clock control module registers */
+struct clock_control_regs {
+ u32 ccmr;
+ u32 pdr0;
+ u32 pdr1;
+ u32 rcsr;
+ u32 mpctl;
+ u32 upctl;
+ u32 spctl;
+ u32 cosr;
+ u32 cgr0;
+ u32 cgr1;
+ u32 cgr2;
+ u32 wimr0;
+ u32 ldc;
+ u32 dcvr0;
+ u32 dcvr1;
+ u32 dcvr2;
+ u32 dcvr3;
+ u32 ltr0;
+ u32 ltr1;
+ u32 ltr2;
+ u32 ltr3;
+ u32 ltbr0;
+ u32 ltbr1;
+ u32 pmcr0;
+ u32 pmcr1;
+ u32 pdr2;
+};
+
+/* Bit definitions for RCSR register in CCM */
+#define CCM_RCSR_NF16B (1 << 31)
+#define CCM_RCSR_NFMS (1 << 30)
+
+#endif
+
#define __REG(x) (*((volatile u32 *)(x)))
#define __REG16(x) (*((volatile u16 *)(x)))
#define __REG8(x) (*((volatile u8 *)(x)))
--
1.5.6
^ permalink raw reply related [flat|nested] 5+ messages in thread* [U-Boot] [PATCH v1 2/3] mxc_nand: Update driver to work with i.MX31.
2009-11-11 19:18 ` [U-Boot] [PATCH v1 1/3] MX31: Add struct definition for clock control module in i.MX31 Magnus Lilja
@ 2009-11-11 19:18 ` Magnus Lilja
2009-11-11 19:18 ` [U-Boot] [PATCH v1 3/3] MX31: Activate NAND support for i.MX31 Litekit board Magnus Lilja
2009-11-11 20:56 ` [U-Boot] [PATCH v1 2/3] mxc_nand: Update driver to work with i.MX31 Scott Wood
0 siblings, 2 replies; 5+ messages in thread
From: Magnus Lilja @ 2009-11-11 19:18 UTC (permalink / raw)
To: u-boot
Tested on i.MX31 Litekit.
Signed-off-by: Magnus Lilja <lilja.magnus@gmail.com>
---
drivers/mtd/nand/mxc_nand.c | 34 +++++++++++++++++++++++++++++++---
1 files changed, 31 insertions(+), 3 deletions(-)
diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c
index eb0323f..fc111b5 100644
--- a/drivers/mtd/nand/mxc_nand.c
+++ b/drivers/mtd/nand/mxc_nand.c
@@ -149,6 +149,36 @@ static struct nand_ecclayout nand_soft_eccoob = {
};
#endif
+#ifdef CONFIG_MX27
+static int is_16bit_nand(void)
+{
+ struct system_control_regs *sc_regs =
+ (struct system_control_regs *)IMX_SYSTEM_CTL_BASE;
+
+ if (readl(&sc_regs->fmcr) & NF_16BIT_SEL)
+ return 1;
+ else
+ return 0;
+}
+#elif defined(CONFIG_MX31)
+static int is_16bit_nand(void)
+{
+ struct clock_control_regs *sc_regs =
+ (struct clock_control_regs *)CCM_BASE;
+
+ if (readl(&sc_regs->rcsr) & CCM_RCSR_NF16B)
+ return 1;
+ else
+ return 0;
+}
+#else
+#warning "8/16 bit NAND autodetection not supported"
+static int is_16bit_nand(void)
+{
+ return 0;
+}
+#endif
+
static uint32_t *mxc_nand_memcpy32(uint32_t *dest, uint32_t *source, size_t size)
{
uint32_t *d = dest;
@@ -808,8 +838,6 @@ static void mxc_nand_command(struct mtd_info *mtd, unsigned command,
int board_nand_init(struct nand_chip *this)
{
- struct system_control_regs *sc_regs =
- (struct system_control_regs *)IMX_SYSTEM_CTL_BASE;
struct mtd_info *mtd;
uint16_t tmp;
int err = 0;
@@ -871,7 +899,7 @@ int board_nand_init(struct nand_chip *this)
writew(0x4, &host->regs->nfc_wrprot);
/* NAND bus width determines access funtions used by upper layer */
- if (readl(&sc_regs->fmcr) & NF_16BIT_SEL)
+ if (is_16bit_nand())
this->options |= NAND_BUSWIDTH_16;
host->pagesize_2k = 0;
--
1.5.6
^ permalink raw reply related [flat|nested] 5+ messages in thread* [U-Boot] [PATCH v1 3/3] MX31: Activate NAND support for i.MX31 Litekit board.
2009-11-11 19:18 ` [U-Boot] [PATCH v1 2/3] mxc_nand: Update driver to work with i.MX31 Magnus Lilja
@ 2009-11-11 19:18 ` Magnus Lilja
2009-11-11 20:56 ` [U-Boot] [PATCH v1 2/3] mxc_nand: Update driver to work with i.MX31 Scott Wood
1 sibling, 0 replies; 5+ messages in thread
From: Magnus Lilja @ 2009-11-11 19:18 UTC (permalink / raw)
To: u-boot
Signed-off-by: Magnus Lilja <lilja.magnus@gmail.com>
---
include/configs/imx31_litekit.h | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/include/configs/imx31_litekit.h b/include/configs/imx31_litekit.h
index 6131008..f413994 100644
--- a/include/configs/imx31_litekit.h
+++ b/include/configs/imx31_litekit.h
@@ -89,6 +89,7 @@
#define CONFIG_CMD_PING
#define CONFIG_CMD_SPI
#define CONFIG_CMD_DATE
+#define CONFIG_CMD_NAND
#define CONFIG_BOOTDELAY 3
@@ -174,4 +175,13 @@
#undef CONFIG_CMD_MTDPARTS
#define CONFIG_JFFS2_DEV "nor0"
+/*
+ * NAND
+ */
+#define CONFIG_NAND_MXC
+#define CONFIG_MXC_NAND_REGS_BASE NFC_BASE_ADDR
+#define CONFIG_SYS_MAX_NAND_DEVICE 1
+#define CONFIG_SYS_NAND_BASE NFC_BASE_ADDR
+#define CONFIG_MXC_NAND_HWECC
+
#endif /* __CONFIG_H */
--
1.5.6
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [U-Boot] [PATCH v1 2/3] mxc_nand: Update driver to work with i.MX31.
2009-11-11 19:18 ` [U-Boot] [PATCH v1 2/3] mxc_nand: Update driver to work with i.MX31 Magnus Lilja
2009-11-11 19:18 ` [U-Boot] [PATCH v1 3/3] MX31: Activate NAND support for i.MX31 Litekit board Magnus Lilja
@ 2009-11-11 20:56 ` Scott Wood
1 sibling, 0 replies; 5+ messages in thread
From: Scott Wood @ 2009-11-11 20:56 UTC (permalink / raw)
To: u-boot
On Wed, Nov 11, 2009 at 08:18:43PM +0100, Magnus Lilja wrote:
> +#ifdef CONFIG_MX27
> +static int is_16bit_nand(void)
> +{
> + struct system_control_regs *sc_regs =
> + (struct system_control_regs *)IMX_SYSTEM_CTL_BASE;
> +
> + if (readl(&sc_regs->fmcr) & NF_16BIT_SEL)
> + return 1;
> + else
> + return 0;
> +}
> +#elif defined(CONFIG_MX31)
> +static int is_16bit_nand(void)
> +{
> + struct clock_control_regs *sc_regs =
> + (struct clock_control_regs *)CCM_BASE;
Maybe call the clock_control regs cc_regs?
Otherwise ACK, assuming this is ARM-tree bound.
-Scott
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-11-11 20:56 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-11 19:18 [U-Boot] [PATCH v1 0/3] MXC: Add NAND support for i.MX31 Magnus Lilja
2009-11-11 19:18 ` [U-Boot] [PATCH v1 1/3] MX31: Add struct definition for clock control module in i.MX31 Magnus Lilja
2009-11-11 19:18 ` [U-Boot] [PATCH v1 2/3] mxc_nand: Update driver to work with i.MX31 Magnus Lilja
2009-11-11 19:18 ` [U-Boot] [PATCH v1 3/3] MX31: Activate NAND support for i.MX31 Litekit board Magnus Lilja
2009-11-11 20:56 ` [U-Boot] [PATCH v1 2/3] mxc_nand: Update driver to work with i.MX31 Scott Wood
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox