aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiu Shuo <b35362@freescale.com>2011-12-09 04:42:54 -0500
committerDavid Woodhouse <David.Woodhouse@intel.com>2012-01-09 13:18:29 -0500
commit9ae84fe8c18cabc348b9c7cd1e98419cd0cbf481 (patch)
tree28805967c5d4b64c30d3c8de01d1b067bba55ac1
parent556f063580db2953a7e53cd46b47724246320f60 (diff)
mtd: fsl_elbc_nand: set Nand flash page address to FBAR and FPAR correctly
If we use the Nand flash chip whose number of pages in a block is greater than 64(for large page), we must treat the low bit of FBAR as being the high bit of the page address due to the limitation of FCM, it simply uses the low 6-bits (for large page) of the combined block/page address as the FPAR component, rather than considering the actual block size. Signed-off-by: Liu Shuo <b35362@freescale.com> Signed-off-by: Jerry Huang <Chang-Ming.Huang@freescale.com> Signed-off-by: Tang Yuantian <b29983@freescale.com> Signed-off-by: Li Yang <leoli@freescale.com> Acked-by: Scott Wood <scottwood@freescale.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
-rw-r--r--drivers/mtd/nand/fsl_elbc_nand.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/mtd/nand/fsl_elbc_nand.c b/drivers/mtd/nand/fsl_elbc_nand.c
index 7db573e9bf78..d29479abe504 100644
--- a/drivers/mtd/nand/fsl_elbc_nand.c
+++ b/drivers/mtd/nand/fsl_elbc_nand.c
@@ -166,15 +166,22 @@ static void set_addr(struct mtd_info *mtd, int column, int page_addr, int oob)
166 166
167 elbc_fcm_ctrl->page = page_addr; 167 elbc_fcm_ctrl->page = page_addr;
168 168
169 out_be32(&lbc->fbar,
170 page_addr >> (chip->phys_erase_shift - chip->page_shift));
171
172 if (priv->page_size) { 169 if (priv->page_size) {
170 /*
171 * large page size chip : FPAR[PI] save the lowest 6 bits,
172 * FBAR[BLK] save the other bits.
173 */
174 out_be32(&lbc->fbar, page_addr >> 6);
173 out_be32(&lbc->fpar, 175 out_be32(&lbc->fpar,
174 ((page_addr << FPAR_LP_PI_SHIFT) & FPAR_LP_PI) | 176 ((page_addr << FPAR_LP_PI_SHIFT) & FPAR_LP_PI) |
175 (oob ? FPAR_LP_MS : 0) | column); 177 (oob ? FPAR_LP_MS : 0) | column);
176 buf_num = (page_addr & 1) << 2; 178 buf_num = (page_addr & 1) << 2;
177 } else { 179 } else {
180 /*
181 * small page size chip : FPAR[PI] save the lowest 5 bits,
182 * FBAR[BLK] save the other bits.
183 */
184 out_be32(&lbc->fbar, page_addr >> 5);
178 out_be32(&lbc->fpar, 185 out_be32(&lbc->fpar,
179 ((page_addr << FPAR_SP_PI_SHIFT) & FPAR_SP_PI) | 186 ((page_addr << FPAR_SP_PI_SHIFT) & FPAR_SP_PI) |
180 (oob ? FPAR_SP_MS : 0) | column); 187 (oob ? FPAR_SP_MS : 0) | column);