[PATCH v2 1/2] mtd: rawnand: qcom: Fix clock sequencing in qcom_nandc_probe()
Miquel Raynal
miquel.raynal at bootlin.com
Sun Jan 23 07:32:10 PST 2022
miquel.raynal at bootlin.com wrote on Sun, 23 Jan 2022 16:23:26 +0100:
> On Mon, 2022-01-03 at 03:03:15 UTC, Bryan O'Donoghue wrote:
> > Interacting with a NAND chip on an IPQ6018 I found that the qcomsmem NAND
> > partition parser was returning -EPROBE_DEFER waiting for the main smem
> > driver to load.
> >
> > This caused the board to reset. Playing about with the probe() function
> > shows that the problem lies in the core clock being switched off before the
> > nandc_unalloc() routine has completed.
> >
> > If we look at how qcom_nandc_remove() tears down allocated resources we see
> > the expected order is
> >
> > qcom_nandc_unalloc(nandc);
> >
> > clk_disable_unprepare(nandc->aon_clk);
> > clk_disable_unprepare(nandc->core_clk);
> >
> > dma_unmap_resource(&pdev->dev, nandc->base_dma, resource_size(res),
> > DMA_BIDIRECTIONAL, 0);
> >
> > Tweaking probe() to both bring up and tear-down in that order removes the
> > reset if we end up deferring elsewhere.
> >
> > Fixes: c76b78d8ec05 ("mtd: nand: Qualcomm NAND controller driver")
> > Signed-off-by: Bryan O'Donoghue <bryan.odonoghue at linaro.org>
> > Reviewed-by: Manivannan Sadhasivam <mani at kernel.org>
>
> Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/next, thanks.
Both patches pushed to mtd/fixes, actually.
More information about the linux-mtd
mailing list