Commit ab3ab7b6 authored by Linus Walleij's avatar Linus Walleij Committed by Miquel Raynal

mtd: rawnand: fsmc: Disable NAND on remove()

This disables the NAND on remove() and the errorpath,
making sure the chipselect gets deasserted when the
NAND is not in use.

Cc: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
parent 30c72ab1
...@@ -986,6 +986,19 @@ static const struct nand_controller_ops fsmc_nand_controller_ops = { ...@@ -986,6 +986,19 @@ static const struct nand_controller_ops fsmc_nand_controller_ops = {
.setup_data_interface = fsmc_setup_data_interface, .setup_data_interface = fsmc_setup_data_interface,
}; };
/**
* fsmc_nand_disable() - Disables the NAND bank
* @host: The instance to disable
*/
static void fsmc_nand_disable(struct fsmc_nand_data *host)
{
u32 val;
val = readl(host->regs_va + FSMC_PC);
val &= ~FSMC_ENABLE;
writel(val, host->regs_va + FSMC_PC);
}
/* /*
* fsmc_nand_probe - Probe function * fsmc_nand_probe - Probe function
* @pdev: platform device structure * @pdev: platform device structure
...@@ -1141,6 +1154,7 @@ static int __init fsmc_nand_probe(struct platform_device *pdev) ...@@ -1141,6 +1154,7 @@ static int __init fsmc_nand_probe(struct platform_device *pdev)
if (host->mode == USE_DMA_ACCESS) if (host->mode == USE_DMA_ACCESS)
dma_release_channel(host->read_dma_chan); dma_release_channel(host->read_dma_chan);
disable_clk: disable_clk:
fsmc_nand_disable(host);
clk_disable_unprepare(host->clk); clk_disable_unprepare(host->clk);
return ret; return ret;
...@@ -1155,6 +1169,7 @@ static int fsmc_nand_remove(struct platform_device *pdev) ...@@ -1155,6 +1169,7 @@ static int fsmc_nand_remove(struct platform_device *pdev)
if (host) { if (host) {
nand_release(&host->nand); nand_release(&host->nand);
fsmc_nand_disable(host);
if (host->mode == USE_DMA_ACCESS) { if (host->mode == USE_DMA_ACCESS) {
dma_release_channel(host->write_dma_chan); dma_release_channel(host->write_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