[PATCH] [MTD] [ONENAND] supports custom bbm<br><br>In onenand driv=
Mon Aug 24 09:56:15 EDT 2009
er, the default bad block management is embedded. Custom BBM<br>can't b=
e used. Now make it to support custom BBM.<br><br>Signed-off-by: Haojian Zh=
uang <<a href=3D"mailto:haojian.zhuang at marvell.com">haojian.zhuang at marve=
ll.com</a>><br>
---<br>=A0drivers/mtd/onenand/onenand_base.c |=A0=A0 23 +++++++++++++++++++=
++++<br>=A01 files changed, 23 insertions(+), 0 deletions(-)<br><br>diff --=
git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base=
.c<br>
index 8f7c73a..cc6bccb 100644<br>--- a/drivers/mtd/onenand/onenand_base.c<b=
r>+++ b/drivers/mtd/onenand/onenand_base.c<br>@@ -2136,6 +2136,29 @@ static=
int onenand_block_isbad_nolock(struct mtd_info *mtd, loff_t ofs, int allo<=
br>
=A0{<br>=A0=A0=A0=A0 struct onenand_chip *this =3D mtd->priv;<br>=A0=A0=
=A0=A0 struct bbm_info *bbm =3D this->bbm;<br>+=A0=A0=A0 struct mtd_oob_=
ops ops;<br>+=A0=A0=A0 unsigned char *buf =3D this->page_buf;<br>+=A0=A0=
=A0 int ret;<br>+<br>+=A0=A0=A0 if (!bbm) {<br>
+=A0=A0=A0 =A0=A0=A0 ops.mode =3D MTD_OOB_PLACE;<br>+=A0=A0=A0 =A0=A0=A0 op=
s.ooblen =3D 2;<br>+=A0=A0=A0 =A0=A0=A0 ops.oobbuf =3D buf;<br>+=A0=A0=A0 =
=A0=A0=A0 ops.len =3D 0;<br>+=A0=A0=A0 =A0=A0=A0 ops.ooboffs =3D 0;<br>+=A0=
=A0=A0 =A0=A0=A0 ops.retlen =3D 0;<br>+=A0=A0=A0 =A0=A0=A0 ops.oobretlen =
=3D 0;<br>+<br>+=A0=A0=A0 =A0=A0=A0 ofs =3D (ofs >> this->erase_sh=
ift) << this->erase_shift;<br>
+=A0=A0=A0 =A0=A0=A0 ret =3D onenand_read_oob_nolock(mtd, ofs, &ops);<b=
r>+=A0=A0=A0 =A0=A0=A0 if (ret =3D=3D ONENAND_BBT_READ_FATAL_ERROR)<br>+=A0=
=A0=A0 =A0=A0=A0 =A0=A0=A0 return -EIO;<br>+<br>+=A0=A0=A0 =A0=A0=A0 if ((b=
uf[ONENAND_BADBLOCK_POS] & 0x01) =3D=3D 0) {<br>+=A0=A0=A0 =A0=A0=A0 =
=A0=A0=A0 return -EIO;<br>
+=A0=A0=A0 =A0=A0=A0 }<br>+=A0=A0=A0 =A0=A0=A0 return 0;<br>+=A0=A0=A0 }<br=
>=A0<br>=A0=A0=A0=A0 /* Return info from the table */<br>=A0=A0=A0=A0 retur=
n bbm->isbad_bbt(mtd, ofs, allowbbt);<br>-- <br>1.5.6.5<br><br>
--0015175ce06877dbdd047465b2b8--
--0015175ce06877dbe4047465b2ba
Content-Type: text/x-patch; charset=US-ASCII;
name="0003--MTD-ONENAND-supports-custom-bbm.patch"
Content-Disposition: attachment;
filename="0003--MTD-ONENAND-supports-custom-bbm.patch"
Content-Transfer-Encoding: base64
X-Attachment-Id: f_g01coo1l0
RnJvbSA4ZTMyZjQ5NDJkYzgzOWZlNzZhYzMzYmM3MGFhNzQwMWRlNDk2YzU1IE1vbiBTZXAgMTcg
MDA6MDA6MDAgMjAwMQpGcm9tOiBIYW9qaWFuIFpodWFuZyA8aGFvamlhbi56aHVhbmdAbWFydmVs
bC5jb20+CkRhdGU6IEZyaSwgMjUgU2VwIDIwMDkgMTU6MjE6NTAgLTA0MDAKU3ViamVjdDogW1BB
VENIXSBbTVREXSBbT05FTkFORF0gc3VwcG9ydHMgY3VzdG9tIGJibQoKSW4gb25lbmFuZCBkcml2
ZXIsIHRoZSBkZWZhdWx0IGJhZCBibG9jayBtYW5hZ2VtZW50IGlzIGVtYmVkZGVkLiBDdXN0b20g
QkJNCmNhbid0IGJlIHVzZWQuIE5vdyBtYWtlIGl0IHRvIHN1cHBvcnQgY3VzdG9tIEJCTS4KClNp
Z25lZC1vZmYtY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