aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>2010-09-29 13:43:51 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2010-10-24 19:53:37 -0400
commitdf5b4e343c52fcdc54db3f9d07068c98cda6007b (patch)
tree44a949095d497ec3c0833071718dbec4bd3750e5 /drivers/mtd
parentcda320915db00a07e5c4cdfc79806c3b80c0c7f2 (diff)
mtd: nand: pull in td into read_bbt()
No code change. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/nand/nand_bbt.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/mtd/nand/nand_bbt.c b/drivers/mtd/nand/nand_bbt.c
index a2a4e179a355..587297e43554 100644
--- a/drivers/mtd/nand/nand_bbt.c
+++ b/drivers/mtd/nand/nand_bbt.c
@@ -161,21 +161,22 @@ static int check_short_pattern(uint8_t *buf, struct nand_bbt_descr *td)
161 * @buf: temporary buffer 161 * @buf: temporary buffer
162 * @page: the starting page 162 * @page: the starting page
163 * @num: the number of bbt descriptors to read 163 * @num: the number of bbt descriptors to read
164 * @bits: number of bits per block 164 * @td: the bbt describtion table
165 * @offs: offset in the memory table 165 * @offs: offset in the memory table
166 * @reserved_block_code: Pattern to identify reserved blocks
167 * 166 *
168 * Read the bad block table starting from page. 167 * Read the bad block table starting from page.
169 * 168 *
170 */ 169 */
171static int read_bbt(struct mtd_info *mtd, uint8_t *buf, int page, int num, 170static int read_bbt(struct mtd_info *mtd, uint8_t *buf, int page, int num,
172 int bits, int offs, int reserved_block_code) 171 struct nand_bbt_descr *td, int offs)
173{ 172{
174 int res, i, j, act = 0; 173 int res, i, j, act = 0;
175 struct nand_chip *this = mtd->priv; 174 struct nand_chip *this = mtd->priv;
176 size_t retlen, len, totlen; 175 size_t retlen, len, totlen;
177 loff_t from; 176 loff_t from;
177 int bits = td->options & NAND_BBT_NRBITS_MSK;
178 uint8_t msk = (uint8_t) ((1 << bits) - 1); 178 uint8_t msk = (uint8_t) ((1 << bits) - 1);
179 int reserved_block_code = td->reserved_block_code;
179 180
180 totlen = (num * bits) >> 3; 181 totlen = (num * bits) >> 3;
181 from = ((loff_t) page) << this->page_shift; 182 from = ((loff_t) page) << this->page_shift;
@@ -238,20 +239,21 @@ static int read_abs_bbt(struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_desc
238{ 239{
239 struct nand_chip *this = mtd->priv; 240 struct nand_chip *this = mtd->priv;
240 int res = 0, i; 241 int res = 0, i;
241 int bits;
242 242
243 bits = td->options & NAND_BBT_NRBITS_MSK;
244 if (td->options & NAND_BBT_PERCHIP) { 243 if (td->options & NAND_BBT_PERCHIP) {
245 int offs = 0; 244 int offs = 0;
246 for (i = 0; i < this->numchips; i++) { 245 for (i = 0; i < this->numchips; i++) {
247 if (chip == -1 || chip == i) 246 if (chip == -1 || chip == i)
248 res = read_bbt (mtd, buf, td->pages[i], this->chipsize >> this->bbt_erase_shift, bits, offs, td->reserved_block_code); 247 res = read_bbt(mtd, buf, td->pages[i],
248 this->chipsize >> this->bbt_erase_shift,
249 td, offs);
249 if (res) 250 if (res)
250 return res; 251 return res;
251 offs += this->chipsize >> (this->bbt_erase_shift + 2); 252 offs += this->chipsize >> (this->bbt_erase_shift + 2);
252 } 253 }
253 } else { 254 } else {
254 res = read_bbt (mtd, buf, td->pages[0], mtd->size >> this->bbt_erase_shift, bits, 0, td->reserved_block_code); 255 res = read_bbt(mtd, buf, td->pages[0],
256 mtd->size >> this->bbt_erase_shift, td, 0);
255 if (res) 257 if (res)
256 return res; 258 return res;
257 } 259 }