Commit 0faf8c39 authored by Boris BREZILLON's avatar Boris BREZILLON Committed by Brian Norris

mtd: nand: lpc32xx: 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 d25cc7ab
...@@ -173,7 +173,6 @@ struct lpc32xx_nand_host { ...@@ -173,7 +173,6 @@ struct lpc32xx_nand_host {
struct nand_chip nand_chip; struct nand_chip nand_chip;
struct lpc32xx_mlc_platform_data *pdata; struct lpc32xx_mlc_platform_data *pdata;
struct clk *clk; struct clk *clk;
struct mtd_info mtd;
void __iomem *io_base; void __iomem *io_base;
int irq; int irq;
struct lpc32xx_nand_cfg_mlc *ncfg; struct lpc32xx_nand_cfg_mlc *ncfg;
...@@ -566,7 +565,7 @@ static void lpc32xx_ecc_enable(struct mtd_info *mtd, int mode) ...@@ -566,7 +565,7 @@ static void lpc32xx_ecc_enable(struct mtd_info *mtd, int mode)
static int lpc32xx_dma_setup(struct lpc32xx_nand_host *host) static int lpc32xx_dma_setup(struct lpc32xx_nand_host *host)
{ {
struct mtd_info *mtd = &host->mtd; struct mtd_info *mtd = nand_to_mtd(&host->nand_chip);
dma_cap_mask_t mask; dma_cap_mask_t mask;
if (!host->pdata || !host->pdata->dma_filter) { if (!host->pdata || !host->pdata->dma_filter) {
...@@ -660,8 +659,8 @@ static int lpc32xx_nand_probe(struct platform_device *pdev) ...@@ -660,8 +659,8 @@ static int lpc32xx_nand_probe(struct platform_device *pdev)
host->io_base_phy = rc->start; host->io_base_phy = rc->start;
mtd = &host->mtd;
nand_chip = &host->nand_chip; nand_chip = &host->nand_chip;
mtd = nand_to_mtd(nand_chip);
if (pdev->dev.of_node) if (pdev->dev.of_node)
host->ncfg = lpc32xx_parse_dt(&pdev->dev); host->ncfg = lpc32xx_parse_dt(&pdev->dev);
if (!host->ncfg) { if (!host->ncfg) {
...@@ -814,7 +813,7 @@ static int lpc32xx_nand_probe(struct platform_device *pdev) ...@@ -814,7 +813,7 @@ static int lpc32xx_nand_probe(struct platform_device *pdev)
static int lpc32xx_nand_remove(struct platform_device *pdev) static int lpc32xx_nand_remove(struct platform_device *pdev)
{ {
struct lpc32xx_nand_host *host = platform_get_drvdata(pdev); struct lpc32xx_nand_host *host = platform_get_drvdata(pdev);
struct mtd_info *mtd = &host->mtd; struct mtd_info *mtd = nand_to_mtd(&host->nand_chip);
nand_release(mtd); nand_release(mtd);
free_irq(host->irq, host); free_irq(host->irq, host);
......
...@@ -204,7 +204,6 @@ struct lpc32xx_nand_host { ...@@ -204,7 +204,6 @@ struct lpc32xx_nand_host {
struct nand_chip nand_chip; struct nand_chip nand_chip;
struct lpc32xx_slc_platform_data *pdata; struct lpc32xx_slc_platform_data *pdata;
struct clk *clk; struct clk *clk;
struct mtd_info mtd;
void __iomem *io_base; void __iomem *io_base;
struct lpc32xx_nand_cfg_slc *ncfg; struct lpc32xx_nand_cfg_slc *ncfg;
...@@ -703,7 +702,7 @@ static int lpc32xx_nand_write_page_raw_syndrome(struct mtd_info *mtd, ...@@ -703,7 +702,7 @@ static int lpc32xx_nand_write_page_raw_syndrome(struct mtd_info *mtd,
static int lpc32xx_nand_dma_setup(struct lpc32xx_nand_host *host) static int lpc32xx_nand_dma_setup(struct lpc32xx_nand_host *host)
{ {
struct mtd_info *mtd = &host->mtd; struct mtd_info *mtd = nand_to_mtd(&host->nand_chip);
dma_cap_mask_t mask; dma_cap_mask_t mask;
if (!host->pdata || !host->pdata->dma_filter) { if (!host->pdata || !host->pdata->dma_filter) {
...@@ -799,8 +798,8 @@ static int lpc32xx_nand_probe(struct platform_device *pdev) ...@@ -799,8 +798,8 @@ static int lpc32xx_nand_probe(struct platform_device *pdev)
host->pdata = dev_get_platdata(&pdev->dev); host->pdata = dev_get_platdata(&pdev->dev);
mtd = &host->mtd;
chip = &host->nand_chip; chip = &host->nand_chip;
mtd = nand_to_mtd(chip);
chip->priv = host; chip->priv = host;
nand_set_flash_node(chip, pdev->dev.of_node); nand_set_flash_node(chip, pdev->dev.of_node);
mtd->priv = chip; mtd->priv = chip;
...@@ -932,7 +931,7 @@ static int lpc32xx_nand_remove(struct platform_device *pdev) ...@@ -932,7 +931,7 @@ static int lpc32xx_nand_remove(struct platform_device *pdev)
{ {
uint32_t tmp; uint32_t tmp;
struct lpc32xx_nand_host *host = platform_get_drvdata(pdev); struct lpc32xx_nand_host *host = platform_get_drvdata(pdev);
struct mtd_info *mtd = &host->mtd; struct mtd_info *mtd = nand_to_mtd(&host->nand_chip);
nand_release(mtd); nand_release(mtd);
dma_release_channel(host->dma_chan); dma_release_channel(host->dma_chan);
......
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