1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-11-25 07:23:07 +02:00

jz4740_nand: Add ident_callback

Add ident_callback which is called after the nand chip has been identified and
before it is setup. This can be used by board code to set partition and ecc info
depending on the chip.
This commit is contained in:
Lars-Peter Clausen 2009-10-12 01:28:13 +02:00 committed by Xiangfu Liu
parent 7fa87373a8
commit cc05485408
2 changed files with 24 additions and 15 deletions

View File

@ -322,25 +322,31 @@ static int __devinit jz_nand_probe(struct platform_device *pdev)
nand->pdata = pdata; nand->pdata = pdata;
platform_set_drvdata(pdev, nand); platform_set_drvdata(pdev, nand);
ret = nand_scan(mtd, 1); ret = nand_scan_ident(mtd, 1);
if (ret) { if (ret) {
dev_err(&pdev->dev, "Failed to scan nand\n"); dev_err(&pdev->dev, "Failed to scan nand\n");
goto err_gpio_free; goto err_gpio_free;
} }
if (pdata && pdata->ident_callback) {
pdata->ident_callback(pdev, chip, &pdata->partitions, &pdata->num_partitions);
}
ret = nand_scan_tail(mtd);
if (ret) {
dev_err(&pdev->dev, "Failed to scan nand\n");
goto err_gpio_free;
}
#ifdef CONFIG_MTD_PARTITIONS #ifdef CONFIG_MTD_PARTITIONS
#ifdef CONFIG_MTD_CMDLINE_PARTS #ifdef CONFIG_MTD_CMDLINE_PARTS
num_partitions = parse_mtd_partitions(mtd, part_probes, num_partitions = parse_mtd_partitions(mtd, part_probes,
&partition_info, 0); &partition_info, 0);
#endif
if (num_partitions <= 0 && pdata) { if (num_partitions <= 0 && pdata) {
num_partitions = pdata->num_partitions; num_partitions = pdata->num_partitions;
partition_info = pdata->partitions; partition_info = pdata->partitions;
} }
#else
if (pdata) {
num_partitions = pdata->num_partitions;
partition_info = pdata->partitions;
}
#endif
if (num_partitions > 0) if (num_partitions > 0)
ret = add_mtd_partitions(mtd, partition_info, num_partitions); ret = add_mtd_partitions(mtd, partition_info, num_partitions);

View File

@ -26,6 +26,9 @@ struct jz_nand_platform_data {
struct nand_ecclayout *ecc_layout; struct nand_ecclayout *ecc_layout;
unsigned int busy_gpio; unsigned int busy_gpio;
void (*ident_callback)(struct platform_device *, struct nand_chip *,
struct mtd_partition **, int *num_partitions);
}; };
#endif #endif