[Letux-kernel] [PATCH 00/20] A bunch of JZ4730 fixups for letux-kernel
Paul Boddie
paul at boddie.org.uk
Sat Dec 12 14:57:42 CET 2020
On Saturday, 12 December 2020 12:04:31 CET H. Nikolaus Schaller wrote:
>
> Thanks for the patch!
>
> It has changed something:
>
> [ 0.157233] Waiting for root device /dev/mmcblk1p2...
> [ 0.157380] mmc0: unrecognised SCR structure version 4
> [ 0.162797] mmc0: error -22 whilst initialising SD card
> [ 0.172349] mmc0: card never left busy state
> [ 0.176875] mmc0: error -145 whilst initialising SD card
> [ 0.192446] mmc0: card never left busy state
> [ 0.196970] mmc0: error -145 whilst initialising SD card
> [ 0.212861] mmc0: card never left busy state
> [ 0.217387] mmc0: error -145 whilst initialising SD card
>
> The mmc0: messages are new.
I guess these messages could easily occur with bad read operations where the
transfers just produce nonsense or nothing, but there might be something else
involved.
> With some printk:
>
> [ 0.177922] ALSA device list:
> [ 0.181085] No soundcards found.
> [ 0.170902] mmc_gpio_set_rs
> [ 0.169238] mmc_gpio_set_rs
> [ 0.172284] mmc_gpiod_request_cd_irq
> [ 0.177171] mmc_gpio_get_cd
> [ 0.180338] jz4740-mmc 10021000.mmc: Ingenic SD/MMC card driver
> registered
> [ 0.170315] jz4740-mmc 10021000.mmc: Using DMA, 4-bit mode
> [ 0.182508] Waiting for root device /dev/mmcblk1p2...
> [ 0.182818] mmc0: unrecognised SCR structure version 4
> [ 0.188236] mmc0: error -22 whilst initialising SD card
> [ 0.177274] mmc_gpio_set_rs
> [ 0.177907] mmc_gpio_set_rs
> [ 0.197028] mmc0: card never left busy state
> [ 0.201554] mmc0: error -145 whilst initialising SD card
> [ 0.197475] mmc_gpio_set_rs
> [ 0.197603] mmc_gpio_set_rs
> [ 0.217022] mmc0: card never left busy state
> [ 0.221546] mmc0: error -145 whilst initialising SD card
> [ 0.217489] mmc_gpio_set_rs
> [ 0.217598] mmc_gpio_set_rs
> [ 0.237292] mmc0: card never left busy state
> [ 0.241818] mmc0: error -145 whilst initialising SD card
>
> I think I should print some values from mmc_gpio_set_rs,
> mmc_gpiod_request_cd_irq, mmc_gpio_get_cd.
Yes, the mmc_gpio_set_rs calls are probably related to power cycling, done by
mmc_power_up.
> And it *may* be that it has something to do with:
>
> https://www.spinics.net/lists/arm-kernel/msg40834.html (they removed the
> check for SCR structure version)
I don't think this is likely to be the solution. :-)
> https://www.at91.com/viewtopic.php?t=28764
> https://unix.stackexchange.com/questions/492611/mmc0-warning-on-sd-card-boot
> up-of-linux (here it did go away with kernel v4.20)
> https://e2e.ti.com/support/processors/f/791/t/263734?System-sometimes-stuck
> -at-Waiting-for-root-device-dev-mmcblk0p2-during-boot (here it was a CD
> hardware issue)
Yes, I think many of these just indicate that something else is going wrong.
> Anyways the error comes from
>
> https://elixir.bootlin.com/linux/latest/source/drivers/mmc/core/sd.c#L184
>
> and is *after* trying to read something from the SD. Either the SD card pins
> are not configured properly or our broken DMA makes problems.
>
> Do you know the location where the decision to choose DMA or not-DMA mode is
> made?
In drivers/mmc/host/jz4740_mmc.c within the function jz4740_mmc_probe:
ret = jz4740_mmc_acquire_dma_channels(host);
if (ret == -EPROBE_DEFER)
goto err_free_irq;
host->use_dma = !ret;
And in the function jz4740_mmc_acquire_dma_channels:
host->dma_tx = dma_request_chan(mmc_dev(host->mmc), "tx");
...
host->dma_rx = dma_request_chan(mmc_dev(host->mmc), "rx");
If you do not get a message saying "Failed to get dma_tx channel" or similar,
then the channels are acquired. Indeed, the "Using DMA, 4-bit mode" confirms
this.
It's probable that the DMA transfers aren't working. I guess I could try and
investigate this in other environments just to see if I have paid attention to
all the relevant details. My modifications to the driver are just tentative,
after all.
Paul
More information about the Letux-kernel
mailing list