Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 4527
b: refs/heads/master
c: 1a78ff6
h: refs/heads/master
i:
  4525: ba84662
  4523: b3ad772
  4519: d5e3dc4
  4511: 26bf128
v: v3
  • Loading branch information
Dan Brown authored and Thomas Gleixner committed May 23, 2005
1 parent 3c220b4 commit e6fb3a3
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 23 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 15fc108606a499df44549274a95d1e3455823347
refs/heads/master: 1a78ff6b4114cfb0f734b7df217759315d692683
50 changes: 28 additions & 22 deletions trunk/drivers/mtd/nand/diskonchip.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
* Interface to generic NAND code for M-Systems DiskOnChip devices
*
* $Id: diskonchip.c,v 1.49 2005/02/22 21:48:21 gleixner Exp $
* $Id: diskonchip.c,v 1.50 2005/03/29 20:57:45 dbrown Exp $
*/

#include <linux/kernel.h>
Expand Down Expand Up @@ -81,11 +81,6 @@ struct doc_priv {
struct mtd_info *nextdoc;
};

/* Max number of eraseblocks to scan (from start of device) for the (I)NFTL
MediaHeader. The spec says to just keep going, I think, but that's just
silly. */
#define MAX_MEDIAHEADER_SCAN 8

/* This is the syndrome computed by the HW ecc generator upon reading an empty
page, one with all 0xff for data and stored ecc code. */
static u_char empty_read_syndrome[6] = { 0x26, 0xff, 0x6d, 0x47, 0x73, 0x7a };
Expand Down Expand Up @@ -114,6 +109,9 @@ module_param(no_ecc_failures, int, 0);
#ifdef CONFIG_MTD_PARTITIONS
static int no_autopart=0;
module_param(no_autopart, int, 0);

static int show_firmware_partition=0;
module_param(show_firmware_partition, int, 0);
#endif

#ifdef MTD_NAND_DISKONCHIP_BBTWRITE
Expand Down Expand Up @@ -1071,12 +1069,11 @@ static int __init find_media_headers(struct mtd_info *mtd, u_char *buf,
{
struct nand_chip *this = mtd->priv;
struct doc_priv *doc = this->priv;
unsigned offs, end = (MAX_MEDIAHEADER_SCAN << this->phys_erase_shift);
unsigned offs;
int ret;
size_t retlen;

end = min(end, mtd->size); // paranoia
for (offs = 0; offs < end; offs += mtd->erasesize) {
for (offs = 0; offs < mtd->size; offs += mtd->erasesize) {
ret = mtd->read(mtd, offs, mtd->oobblock, &retlen, buf);
if (retlen != mtd->oobblock) continue;
if (ret) {
Expand Down Expand Up @@ -1118,6 +1115,7 @@ static inline int __init nftl_partscan(struct mtd_info *mtd,
u_char *buf;
struct NFTLMediaHeader *mh;
const unsigned psize = 1 << this->page_shift;
int numparts = 0;
unsigned blocks, maxblocks;
int offs, numheaders;

Expand Down Expand Up @@ -1183,19 +1181,28 @@ static inline int __init nftl_partscan(struct mtd_info *mtd,
offs <<= this->page_shift;
offs += mtd->erasesize;

parts[0].name = " DiskOnChip BDTL partition";
parts[0].offset = offs;
parts[0].size = (mh->NumEraseUnits - numheaders) << this->bbt_erase_shift;
if (show_firmware_partition == 1) {
parts[0].name = " DiskOnChip Firmware / Media Header partition";
parts[0].offset = 0;
parts[0].size = offs;
numparts = 1;
}

parts[numparts].name = " DiskOnChip BDTL partition";
parts[numparts].offset = offs;
parts[numparts].size = (mh->NumEraseUnits - numheaders) << this->bbt_erase_shift;

offs += parts[numparts].size;
numparts++;

offs += parts[0].size;
if (offs < mtd->size) {
parts[1].name = " DiskOnChip Remainder partition";
parts[1].offset = offs;
parts[1].size = mtd->size - offs;
ret = 2;
goto out;
parts[numparts].name = " DiskOnChip Remainder partition";
parts[numparts].offset = offs;
parts[numparts].size = mtd->size - offs;
numparts++;
}
ret = 1;

ret = numparts;
out:
kfree(buf);
return ret;
Expand Down Expand Up @@ -1289,14 +1296,13 @@ static inline int __init inftl_partscan(struct mtd_info *mtd,
ip->lastUnit, ip->flags,
ip->spareUnits);

#if 0
if ((i == 0) && (ip->firstUnit > 0)) {
if ((show_firmware_partition == 1) &&
(i == 0) && (ip->firstUnit > 0)) {
parts[0].name = " DiskOnChip IPL / Media Header partition";
parts[0].offset = 0;
parts[0].size = mtd->erasesize * ip->firstUnit;
numparts = 1;
}
#endif

if (ip->flags & INFTL_BINARY)
parts[numparts].name = " DiskOnChip BDK partition";
Expand Down

0 comments on commit e6fb3a3

Please sign in to comment.