Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Liu Shuo and committed by
David Woodhouse
9ae84fe8 556f0635

+10 -3
+10 -3
drivers/mtd/nand/fsl_elbc_nand.c
··· 166 166 167 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 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 175 out_be32(&lbc->fpar, 174 176 ((page_addr << FPAR_LP_PI_SHIFT) & FPAR_LP_PI) | 175 177 (oob ? FPAR_LP_MS : 0) | column); 176 178 buf_num = (page_addr & 1) << 2; 177 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 185 out_be32(&lbc->fpar, 179 186 ((page_addr << FPAR_SP_PI_SHIFT) & FPAR_SP_PI) | 180 187 (oob ? FPAR_SP_MS : 0) | column);