On Fri, Nov 8, 2019 at 1:33 PM Christophe Leroy <christophe.leroy@xxxxxx> wrote: > [ 3.227053] NIP [c0249054] gen_pool_free_owner+0xfc/0x100 > [ 3.232377] LR [c0249054] gen_pool_free_owner+0xfc/0x100 > [ 3.237588] Call Trace: > [ 3.240037] [c60e1d08] [c0249054] gen_pool_free_owner+0xfc/0x100 > (unreliable) > [ 3.247113] [c60e1d38] [c0299020] cpm_muram_free+0x84/0xf4 > [ 3.252517] [c60e1d58] [c030e7a4] fsl_spi_cpm_free+0x94/0x100 > [ 3.258198] [c60e1d68] [c030f2d4] of_fsl_spi_probe+0x260/0x3a0 Since fsl_spi_cpm_free() is called from of_fsl_spi_probe() and doesn't even exist on the errorpath of this function I suppose it is some kind inlining of_fsl_spi_probe() which goes on the errorpath and crashes there. I suspect EPROBE_DEFER (-517) to be behind this but it is just a guess. What happens if you add this: diff --git a/drivers/spi/spi-fsl-spi.c b/drivers/spi/spi-fsl-spi.c index 4b80ace1d137..a26b5e542006 100644 --- a/drivers/spi/spi-fsl-spi.c +++ b/drivers/spi/spi-fsl-spi.c @@ -678,6 +678,7 @@ static struct spi_master * fsl_spi_probe(struct device *dev, return master; err_probe: + dev_info(dev, "bail out with error code %d\n", ret); fsl_spi_cpm_free(mpc8xxx_spi); err_cpm_init: spi_master_put(master); I am assuming that the errorpath inside spi-fsl-cpm.c is crashing, as cpm_muram_free() is called under the wrong conditions, or simply not really working. So fixing the errorpath is a separate problem in itself. By just looking at the code and not understanding any more than that the error path on fsl_spi_cpm_free() should probably equal that of fsl_spi_cpm_init() I guess maybe this could fix it, could you test? diff --git a/drivers/spi/spi-fsl-cpm.c b/drivers/spi/spi-fsl-cpm.c index 858f0544289e..54ad0ac121e5 100644 --- a/drivers/spi/spi-fsl-cpm.c +++ b/drivers/spi/spi-fsl-cpm.c @@ -392,7 +392,8 @@ void fsl_spi_cpm_free(struct mpc8xxx_spi *mspi) dma_unmap_single(dev, mspi->dma_dummy_rx, SPI_MRBLR, DMA_FROM_DEVICE); dma_unmap_single(dev, mspi->dma_dummy_tx, PAGE_SIZE, DMA_TO_DEVICE); cpm_muram_free(cpm_muram_offset(mspi->tx_bd)); - cpm_muram_free(cpm_muram_offset(mspi->pram)); + if (!(mspi->flags & SPI_CPM1)) + cpm_muram_free(cpm_muram_offset(mspi->pram)); fsl_spi_free_dummy_rx(); } EXPORT_SYMBOL_GPL(fsl_spi_cpm_free); > Reverting 0f0581b24bd0 ("spi: fsl: Convert to use CS GPIO descriptors") > solves the issue. I hope we can fix the errorpath so we can see what the real problem is with this patch. > Renaming the gpios item to cs-gpios in the devicetree fixes the crash on > boot but the following warning appears during boot and SPI doesn't work > (can't read board temperature on LM74 chip): That's annoying. I hope we can get the code to work though, let's hammer on it a bit and see if we can fix it! Yours, Linus Walleij