mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-28 01:51:33 +00:00
OneNAND: Additional sync with 2.6.27
- Add subpage write support - Add onenand_oob_64/32 ecclayout This has been missing and without it UBI has some incompatibilies issues with the current (>= 2.6.27) Linux kernel version. vid_hdr_offset is placed differently (2048 instead of 512) without this fix. Signed-off-by: Stefan Roese <sr@denx.de> Signed-off-by: Scott Wood <scottwood@freescale.com>
This commit is contained in:
parent
1714f51a20
commit
1ae3986204
2 changed files with 72 additions and 1 deletions
|
@ -36,6 +36,35 @@ static inline void *memcpy_16(void *dst, const void *src, unsigned int len)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* onenand_oob_64 - oob info for large (2KB) page
|
||||||
|
*/
|
||||||
|
static struct nand_ecclayout onenand_oob_64 = {
|
||||||
|
.eccbytes = 20,
|
||||||
|
.eccpos = {
|
||||||
|
8, 9, 10, 11, 12,
|
||||||
|
24, 25, 26, 27, 28,
|
||||||
|
40, 41, 42, 43, 44,
|
||||||
|
56, 57, 58, 59, 60,
|
||||||
|
},
|
||||||
|
.oobfree = {
|
||||||
|
{2, 3}, {14, 2}, {18, 3}, {30, 2},
|
||||||
|
{34, 3}, {46, 2}, {50, 3}, {62, 2}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* onenand_oob_32 - oob info for middle (1KB) page
|
||||||
|
*/
|
||||||
|
static struct nand_ecclayout onenand_oob_32 = {
|
||||||
|
.eccbytes = 10,
|
||||||
|
.eccpos = {
|
||||||
|
8, 9, 10, 11, 12,
|
||||||
|
24, 25, 26, 27, 28,
|
||||||
|
},
|
||||||
|
.oobfree = { {2, 3}, {14, 2}, {18, 3}, {30, 2} }
|
||||||
|
};
|
||||||
|
|
||||||
static const unsigned char ffchars[] = {
|
static const unsigned char ffchars[] = {
|
||||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* 16 */
|
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* 16 */
|
||||||
|
@ -1079,7 +1108,7 @@ static int onenand_verify(struct mtd_info *mtd, const u_char *buf, loff_t addr,
|
||||||
#define onenand_verify_oob(...) (0)
|
#define onenand_verify_oob(...) (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define NOTALIGNED(x) ((x & (mtd->writesize - 1)) != 0)
|
#define NOTALIGNED(x) ((x & (this->subpagesize - 1)) != 0)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* onenand_fill_auto_oob - [Internal] oob auto-placement transfer
|
* onenand_fill_auto_oob - [Internal] oob auto-placement transfer
|
||||||
|
@ -2058,6 +2087,7 @@ static int onenand_probe(struct mtd_info *mtd)
|
||||||
*/
|
*/
|
||||||
int onenand_scan(struct mtd_info *mtd, int maxchips)
|
int onenand_scan(struct mtd_info *mtd, int maxchips)
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
struct onenand_chip *this = mtd->priv;
|
struct onenand_chip *this = mtd->priv;
|
||||||
|
|
||||||
if (!this->read_word)
|
if (!this->read_word)
|
||||||
|
@ -2115,6 +2145,46 @@ int onenand_scan(struct mtd_info *mtd, int maxchips)
|
||||||
this->options |= ONENAND_OOBBUF_ALLOC;
|
this->options |= ONENAND_OOBBUF_ALLOC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this->state = FL_READY;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Allow subpage writes up to oobsize.
|
||||||
|
*/
|
||||||
|
switch (mtd->oobsize) {
|
||||||
|
case 64:
|
||||||
|
this->ecclayout = &onenand_oob_64;
|
||||||
|
mtd->subpage_sft = 2;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 32:
|
||||||
|
this->ecclayout = &onenand_oob_32;
|
||||||
|
mtd->subpage_sft = 1;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
printk(KERN_WARNING "No OOB scheme defined for oobsize %d\n",
|
||||||
|
mtd->oobsize);
|
||||||
|
mtd->subpage_sft = 0;
|
||||||
|
/* To prevent kernel oops */
|
||||||
|
this->ecclayout = &onenand_oob_32;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
this->subpagesize = mtd->writesize >> mtd->subpage_sft;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The number of bytes available for a client to place data into
|
||||||
|
* the out of band area
|
||||||
|
*/
|
||||||
|
this->ecclayout->oobavail = 0;
|
||||||
|
for (i = 0; i < MTD_MAX_OOBFREE_ENTRIES &&
|
||||||
|
this->ecclayout->oobfree[i].length; i++)
|
||||||
|
this->ecclayout->oobavail +=
|
||||||
|
this->ecclayout->oobfree[i].length;
|
||||||
|
mtd->oobavail = this->ecclayout->oobavail;
|
||||||
|
|
||||||
|
mtd->ecclayout = this->ecclayout;
|
||||||
|
|
||||||
/* Unlock whole block */
|
/* Unlock whole block */
|
||||||
onenand_unlock_all(mtd);
|
onenand_unlock_all(mtd);
|
||||||
|
|
||||||
|
|
|
@ -107,6 +107,7 @@ struct onenand_chip {
|
||||||
unsigned char *oob_buf;
|
unsigned char *oob_buf;
|
||||||
|
|
||||||
struct nand_oobinfo *autooob;
|
struct nand_oobinfo *autooob;
|
||||||
|
int subpagesize;
|
||||||
struct nand_ecclayout *ecclayout;
|
struct nand_ecclayout *ecclayout;
|
||||||
|
|
||||||
void *bbm;
|
void *bbm;
|
||||||
|
|
Loading…
Add table
Reference in a new issue