mtd: nand: bcm47xx: use the mtd instance embedded in struct nand_chip
struct nand_chip now embeds an mtd device. Make use of this mtd instance. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
This commit is contained in:
parent
4883090bed
commit
17dd20bd7d
|
@ -12,7 +12,6 @@ struct bcm47xxnflash {
|
||||||
struct bcma_drv_cc *cc;
|
struct bcma_drv_cc *cc;
|
||||||
|
|
||||||
struct nand_chip nand_chip;
|
struct nand_chip nand_chip;
|
||||||
struct mtd_info mtd;
|
|
||||||
|
|
||||||
unsigned curr_command;
|
unsigned curr_command;
|
||||||
int curr_page_addr;
|
int curr_page_addr;
|
||||||
|
|
|
@ -27,6 +27,7 @@ static int bcm47xxnflash_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct bcma_nflash *nflash = dev_get_platdata(&pdev->dev);
|
struct bcma_nflash *nflash = dev_get_platdata(&pdev->dev);
|
||||||
struct bcm47xxnflash *b47n;
|
struct bcm47xxnflash *b47n;
|
||||||
|
struct mtd_info *mtd;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
b47n = devm_kzalloc(&pdev->dev, sizeof(*b47n), GFP_KERNEL);
|
b47n = devm_kzalloc(&pdev->dev, sizeof(*b47n), GFP_KERNEL);
|
||||||
|
@ -34,8 +35,9 @@ static int bcm47xxnflash_probe(struct platform_device *pdev)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
b47n->nand_chip.priv = b47n;
|
b47n->nand_chip.priv = b47n;
|
||||||
b47n->mtd.dev.parent = &pdev->dev;
|
mtd = nand_to_mtd(&b47n->nand_chip);
|
||||||
b47n->mtd.priv = &b47n->nand_chip; /* Required */
|
mtd->dev.parent = &pdev->dev;
|
||||||
|
mtd->priv = &b47n->nand_chip; /* Required */
|
||||||
b47n->cc = container_of(nflash, struct bcma_drv_cc, nflash);
|
b47n->cc = container_of(nflash, struct bcma_drv_cc, nflash);
|
||||||
|
|
||||||
if (b47n->cc->core->bus->chipinfo.id == BCMA_CHIP_ID_BCM4706) {
|
if (b47n->cc->core->bus->chipinfo.id == BCMA_CHIP_ID_BCM4706) {
|
||||||
|
@ -51,7 +53,7 @@ static int bcm47xxnflash_probe(struct platform_device *pdev)
|
||||||
|
|
||||||
platform_set_drvdata(pdev, b47n);
|
platform_set_drvdata(pdev, b47n);
|
||||||
|
|
||||||
err = mtd_device_parse_register(&b47n->mtd, probes, NULL, NULL, 0);
|
err = mtd_device_parse_register(mtd, probes, NULL, NULL, 0);
|
||||||
if (err) {
|
if (err) {
|
||||||
pr_err("Failed to register MTD device: %d\n", err);
|
pr_err("Failed to register MTD device: %d\n", err);
|
||||||
return err;
|
return err;
|
||||||
|
@ -64,7 +66,7 @@ static int bcm47xxnflash_remove(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct bcm47xxnflash *nflash = platform_get_drvdata(pdev);
|
struct bcm47xxnflash *nflash = platform_get_drvdata(pdev);
|
||||||
|
|
||||||
nand_release(&nflash->mtd);
|
nand_release(nand_to_mtd(&nflash->nand_chip));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -421,7 +421,7 @@ int bcm47xxnflash_ops_bcm4706_init(struct bcm47xxnflash *b47n)
|
||||||
(w4 << 24 | w3 << 18 | w2 << 12 | w1 << 6 | w0));
|
(w4 << 24 | w3 << 18 | w2 << 12 | w1 << 6 | w0));
|
||||||
|
|
||||||
/* Scan NAND */
|
/* Scan NAND */
|
||||||
err = nand_scan(&b47n->mtd, 1);
|
err = nand_scan(nand_to_mtd(&b47n->nand_chip), 1);
|
||||||
if (err) {
|
if (err) {
|
||||||
pr_err("Could not scan NAND flash: %d\n", err);
|
pr_err("Could not scan NAND flash: %d\n", err);
|
||||||
goto exit;
|
goto exit;
|
||||||
|
|
Loading…
Reference in New Issue