summaryrefslogtreecommitdiff
path: root/include/asm-arm
diff options
context:
space:
mode:
authorJason Liu <r64343@freescale.com>2010-12-03 11:08:12 +0800
committerJason Liu <r64343@freescale.com>2010-12-07 15:33:56 +0800
commitd509a056972ea643382f4763768faeeb3aecc6f0 (patch)
tree4f9f21cc9f46522774ec773e9054c4098bf85f27 /include/asm-arm
parent298e4cf6838aca016388f6fdfc7ce80cb7902228 (diff)
downloadu-boot-imx-d509a056972ea643382f4763768faeeb3aecc6f0.zip
u-boot-imx-d509a056972ea643382f4763768faeeb3aecc6f0.tar.gz
u-boot-imx-d509a056972ea643382f4763768faeeb3aecc6f0.tar.bz2
ENGR00134220-1 NAND: fix up the chip select handling
When the NAND has multi-cs, the chip select other than cs0 is not handled correctly which will lead to NAND not function as expected Signed-off-by: Jason Liu <r64343@freescale.com>
Diffstat (limited to 'include/asm-arm')
-rw-r--r--include/asm-arm/arch-mx51/mxc_nand.h6
-rw-r--r--include/asm-arm/arch-mx53/mxc_nand.h6
2 files changed, 10 insertions, 2 deletions
diff --git a/include/asm-arm/arch-mx51/mxc_nand.h b/include/asm-arm/arch-mx51/mxc_nand.h
index 843f080..4c37620 100644
--- a/include/asm-arm/arch-mx51/mxc_nand.h
+++ b/include/asm-arm/arch-mx51/mxc_nand.h
@@ -287,7 +287,7 @@ do { \
#define UNLOCK_ADDR(start_addr, end_addr) \
{ \
int i = 0; \
- for (; i < NAND_MAX_CHIPS; i++) \
+ for (; i < NFC_GET_MAXCHIP_SP(); i++) \
raw_write(start_addr | \
(end_addr << NFC_UNLOCK_END_ADDR_SHIFT), \
REG_UNLOCK_BLK_ADD0 + (i << 2)); \
@@ -298,6 +298,10 @@ do { \
(NFC_FIELD_RESET(NFC_ACTIVE_CS_WIDTH, NFC_ACTIVE_CS_SHIFT))) | \
((val) << NFC_ACTIVE_CS_SHIFT), NFC_CONFIG1);
+#define NFC_GET_NFC_ACTIVE_CS() \
+ ((raw_read(NFC_CONFIG1) >> NFC_ACTIVE_CS_SHIFT) & \
+ ((1 << NFC_ACTIVE_CS_WIDTH) - 1))
+
#define NFC_GET_MAXCHIP_SP() 8
#define NFC_SET_BLS(val) ((raw_read(REG_NFC_BLS) & NFC_BLS_RESET) | val)
diff --git a/include/asm-arm/arch-mx53/mxc_nand.h b/include/asm-arm/arch-mx53/mxc_nand.h
index 68c2dc6..eb0a3b4 100644
--- a/include/asm-arm/arch-mx53/mxc_nand.h
+++ b/include/asm-arm/arch-mx53/mxc_nand.h
@@ -275,7 +275,7 @@ do { \
#define UNLOCK_ADDR(start_addr, end_addr) \
{ \
int i = 0; \
- for (; i < NAND_MAX_CHIPS; i++) \
+ for (; i < NFC_GET_MAXCHIP_SP(); i++) \
raw_write(start_addr | \
(end_addr << NFC_UNLOCK_END_ADDR_SHIFT), \
REG_UNLOCK_BLK_ADD0 + (i << 2)); \
@@ -286,6 +286,10 @@ do { \
(NFC_FIELD_RESET(NFC_ACTIVE_CS_WIDTH, NFC_ACTIVE_CS_SHIFT))) | \
((val) << NFC_ACTIVE_CS_SHIFT), NFC_CONFIG1);
+#define NFC_GET_NFC_ACTIVE_CS() \
+ ((raw_read(NFC_CONFIG1) >> NFC_ACTIVE_CS_SHIFT) & \
+ ((1 << NFC_ACTIVE_CS_WIDTH) - 1))
+
#define NFC_GET_MAXCHIP_SP() 8
#define NFC_SET_BLS(val) ((raw_read(REG_NFC_BLS) & NFC_BLS_RESET) | val)