Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 274845
b: refs/heads/master
c: 0d04eda
h: refs/heads/master
i:
  274843: 501c7a0
v: v3
  • Loading branch information
Dmitry Eremin-Solenikov authored and Artem Bityutskiy committed Sep 11, 2011
1 parent abec1cb commit b90437f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 58 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: 6cb03c9cb520186859a034e4e829fb591aea78b6
refs/heads/master: 0d04eda1430e9a796214bee644b7e05d99cfe613
66 changes: 9 additions & 57 deletions trunk/drivers/mtd/nand/fsmc_nand.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ static struct mtd_partition partition_info_16KB_blk[] = {
{
.name = "Root File System",
.offset = 0x460000,
.size = 0,
.size = MTDPART_SIZ_FULL,
},
};

Expand All @@ -173,7 +173,7 @@ static struct mtd_partition partition_info_128KB_blk[] = {
{
.name = "Root File System",
.offset = 0x800000,
.size = 0,
.size = MTDPART_SIZ_FULL,
},
};

Expand All @@ -184,8 +184,6 @@ static struct mtd_partition partition_info_128KB_blk[] = {
* @pid: Part ID on the AMBA PrimeCell format
* @mtd: MTD info for a NAND flash.
* @nand: Chip related info for a NAND flash.
* @partitions: Partition info for a NAND Flash.
* @nr_partitions: Total number of partition of a NAND flash.
*
* @ecc_place: ECC placing locations in oobfree type format.
* @bank: Bank number for probed device.
Expand All @@ -200,8 +198,6 @@ struct fsmc_nand_data {
u32 pid;
struct mtd_info mtd;
struct nand_chip nand;
struct mtd_partition *partitions;
unsigned int nr_partitions;

struct fsmc_eccplace *ecc_place;
unsigned int bank;
Expand Down Expand Up @@ -717,57 +713,13 @@ static int __init fsmc_nand_probe(struct platform_device *pdev)
* Check for partition info passed
*/
host->mtd.name = "nand";
host->nr_partitions = parse_mtd_partitions(&host->mtd, NULL,
&host->partitions, 0);
if (host->nr_partitions <= 0) {
/*
* Check if partition info passed via command line
*/
if (pdata->partitions) {
host->partitions = pdata->partitions;
host->nr_partitions = pdata->nr_partitions;
} else {
struct mtd_partition *partition;
int i;

/* Select the default partitions info */
switch (host->mtd.size) {
case 0x01000000:
case 0x02000000:
case 0x04000000:
host->partitions = partition_info_16KB_blk;
host->nr_partitions =
sizeof(partition_info_16KB_blk) /
sizeof(struct mtd_partition);
break;
case 0x08000000:
case 0x10000000:
case 0x20000000:
case 0x40000000:
host->partitions = partition_info_128KB_blk;
host->nr_partitions =
sizeof(partition_info_128KB_blk) /
sizeof(struct mtd_partition);
break;
default:
ret = -ENXIO;
pr_err("Unsupported NAND size\n");
goto err_probe;
}

partition = host->partitions;
for (i = 0; i < host->nr_partitions; i++, partition++) {
if (partition->size == 0) {
partition->size = host->mtd.size -
partition->offset;
break;
}
}
}
}

ret = mtd_device_register(&host->mtd, host->partitions,
host->nr_partitions);
ret = mtd_device_parse_register(&host->mtd, NULL, 0,
host->mtd.size <= 0x04000000 ?
partition_info_16KB_blk :
partition_info_128KB_blk,
host->mtd.size <= 0x04000000 ?
ARRAY_SIZE(partition_info_16KB_blk) :
ARRAY_SIZE(partition_info_128KB_blk));
if (ret)
goto err_probe;

Expand Down

0 comments on commit b90437f

Please sign in to comment.