Commit 7085a3be authored by Boris BREZILLON's avatar Boris BREZILLON Committed by Brian Norris

mtd: nand: bf5xx: 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: default avatarBoris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
parent ff70f354
...@@ -142,7 +142,6 @@ static struct nand_ecclayout bootrom_ecclayout = { ...@@ -142,7 +142,6 @@ static struct nand_ecclayout bootrom_ecclayout = {
struct bf5xx_nand_info { struct bf5xx_nand_info {
/* mtd info */ /* mtd info */
struct nand_hw_control controller; struct nand_hw_control controller;
struct mtd_info mtd;
struct nand_chip chip; struct nand_chip chip;
/* platform info */ /* platform info */
...@@ -160,7 +159,8 @@ struct bf5xx_nand_info { ...@@ -160,7 +159,8 @@ struct bf5xx_nand_info {
*/ */
static struct bf5xx_nand_info *mtd_to_nand_info(struct mtd_info *mtd) static struct bf5xx_nand_info *mtd_to_nand_info(struct mtd_info *mtd)
{ {
return container_of(mtd, struct bf5xx_nand_info, mtd); return container_of(mtd_to_nand(mtd), struct bf5xx_nand_info,
chip);
} }
static struct bf5xx_nand_info *to_nand_info(struct platform_device *pdev) static struct bf5xx_nand_info *to_nand_info(struct platform_device *pdev)
...@@ -660,7 +660,7 @@ static int bf5xx_nand_hw_init(struct bf5xx_nand_info *info) ...@@ -660,7 +660,7 @@ static int bf5xx_nand_hw_init(struct bf5xx_nand_info *info)
*/ */
static int bf5xx_nand_add_partition(struct bf5xx_nand_info *info) static int bf5xx_nand_add_partition(struct bf5xx_nand_info *info)
{ {
struct mtd_info *mtd = &info->mtd; struct mtd_info *mtd = nand_to_mtd(&info->chip);
struct mtd_partition *parts = info->platform->partitions; struct mtd_partition *parts = info->platform->partitions;
int nr = info->platform->nr_partitions; int nr = info->platform->nr_partitions;
...@@ -675,7 +675,7 @@ static int bf5xx_nand_remove(struct platform_device *pdev) ...@@ -675,7 +675,7 @@ static int bf5xx_nand_remove(struct platform_device *pdev)
* and their partitions, then go through freeing the * and their partitions, then go through freeing the
* resources used * resources used
*/ */
nand_release(&info->mtd); nand_release(nand_to_mtd(&info->chip));
peripheral_free_list(bfin_nfc_pin_req); peripheral_free_list(bfin_nfc_pin_req);
bf5xx_nand_dma_remove(info); bf5xx_nand_dma_remove(info);
...@@ -756,6 +756,7 @@ static int bf5xx_nand_probe(struct platform_device *pdev) ...@@ -756,6 +756,7 @@ static int bf5xx_nand_probe(struct platform_device *pdev)
/* initialise chip data struct */ /* initialise chip data struct */
chip = &info->chip; chip = &info->chip;
mtd = nand_to_mtd(&info->chip);
if (plat->data_width) if (plat->data_width)
chip->options |= NAND_BUSWIDTH_16; chip->options |= NAND_BUSWIDTH_16;
...@@ -772,7 +773,7 @@ static int bf5xx_nand_probe(struct platform_device *pdev) ...@@ -772,7 +773,7 @@ static int bf5xx_nand_probe(struct platform_device *pdev)
chip->cmd_ctrl = bf5xx_nand_hwcontrol; chip->cmd_ctrl = bf5xx_nand_hwcontrol;
chip->dev_ready = bf5xx_nand_devready; chip->dev_ready = bf5xx_nand_devready;
chip->priv = &info->mtd; chip->priv = mtd;
chip->controller = &info->controller; chip->controller = &info->controller;
chip->IO_ADDR_R = (void __iomem *) NFC_READ; chip->IO_ADDR_R = (void __iomem *) NFC_READ;
...@@ -781,7 +782,6 @@ static int bf5xx_nand_probe(struct platform_device *pdev) ...@@ -781,7 +782,6 @@ static int bf5xx_nand_probe(struct platform_device *pdev)
chip->chip_delay = 0; chip->chip_delay = 0;
/* initialise mtd info data struct */ /* initialise mtd info data struct */
mtd = &info->mtd;
mtd->priv = chip; mtd->priv = chip;
mtd->dev.parent = &pdev->dev; mtd->dev.parent = &pdev->dev;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment