aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiquel Raynal <miquel.raynal@bootlin.com>2019-04-08 04:31:45 -0400
committerRichard Weinberger <richard@nod.at>2019-04-25 17:21:51 -0400
commit9a8f612ca0d6a436e6471c9bed516d34a2cc626f (patch)
treea9bb12d20f8a09169275d178a5b5c48c82851a87
parent085b7755808aa11f78ab9377257e1dad2e6fa4bb (diff)
mtd: rawnand: marvell: Clean the controller state before each operation
Since the migration of the driver to stop using the legacy ->select_chip() hook, there is nothing deselecting the target anymore, thus the selection is not forced at the next access. Ensure the ND_RUN bit and the interrupts are always in a clean state. Cc: Daniel Mack <daniel@zonque.org> Cc: stable@vger.kernel.org Fixes: b25251414f6e00 ("mtd: rawnand: marvell: Stop implementing ->select_chip()") Suggested-by: Boris Brezillon <boris.brezillon@collabora.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Tested-by: Daniel Mack <daniel@zonque.org> Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com> Signed-off-by: Richard Weinberger <richard@nod.at>
-rw-r--r--drivers/mtd/nand/raw/marvell_nand.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/mtd/nand/raw/marvell_nand.c b/drivers/mtd/nand/raw/marvell_nand.c
index f38e5c1b87e4..d984538980e2 100644
--- a/drivers/mtd/nand/raw/marvell_nand.c
+++ b/drivers/mtd/nand/raw/marvell_nand.c
@@ -722,12 +722,6 @@ static void marvell_nfc_select_target(struct nand_chip *chip,
722 struct marvell_nfc *nfc = to_marvell_nfc(chip->controller); 722 struct marvell_nfc *nfc = to_marvell_nfc(chip->controller);
723 u32 ndcr_generic; 723 u32 ndcr_generic;
724 724
725 if (chip == nfc->selected_chip && die_nr == marvell_nand->selected_die)
726 return;
727
728 writel_relaxed(marvell_nand->ndtr0, nfc->regs + NDTR0);
729 writel_relaxed(marvell_nand->ndtr1, nfc->regs + NDTR1);
730
731 /* 725 /*
732 * Reset the NDCR register to a clean state for this particular chip, 726 * Reset the NDCR register to a clean state for this particular chip,
733 * also clear ND_RUN bit. 727 * also clear ND_RUN bit.
@@ -739,6 +733,12 @@ static void marvell_nfc_select_target(struct nand_chip *chip,
739 /* Also reset the interrupt status register */ 733 /* Also reset the interrupt status register */
740 marvell_nfc_clear_int(nfc, NDCR_ALL_INT); 734 marvell_nfc_clear_int(nfc, NDCR_ALL_INT);
741 735
736 if (chip == nfc->selected_chip && die_nr == marvell_nand->selected_die)
737 return;
738
739 writel_relaxed(marvell_nand->ndtr0, nfc->regs + NDTR0);
740 writel_relaxed(marvell_nand->ndtr1, nfc->regs + NDTR1);
741
742 nfc->selected_chip = chip; 742 nfc->selected_chip = chip;
743 marvell_nand->selected_die = die_nr; 743 marvell_nand->selected_die = die_nr;
744} 744}