[Letux-kernel] [PATCH 00/20] A bunch of JZ4730 fixups for letux-kernel

H. Nikolaus Schaller hns at goldelico.com
Sat Dec 12 12:04:31 CET 2020


Hi Paul,

> Am 11.12.2020 um 23:58 schrieb Paul Boddie <paul at boddie.org.uk>:
> 
> On Friday, 11 December 2020 08:38:36 CET H. Nikolaus Schaller wrote:
>> 
>> No, there was already reward because it made the jz4370 dma succeed in
>> probe. Even if it is still wrong we would not have found other minor
>> issues.
> 
> I have been updating the documentation with some discoveries about the JZ4730 
> from the legacy kernel and other documentation:
> 
> https://projects.goldelico.com/p/letux400/page/DMA/
> 
> To attempt to provide no-descriptor transfer support, I have made a patch that 
> populates the registers from prepared descriptors when DMA is initiated. I 
> don't know how reasonable this idea is, though.
> 
>> What I think we should also try to identify is why the MMC is not detected
>> at all. At least there should be some indication, even if DMA can not read.
>> 
>> This could be an gpio or regulator or mmc-host driver issue.
>> 
>> If I find time for a debug session I could try to find how card insert
>> detection works and if it works...
> 
> I guess I can review this at some point. From a quick look at the board-
> minipc.h file from the legacy kernel, the pin assignments look correct in our 
> device tree:
> 
> * Power is on PA21 (pin 21) and is active low
> * Card detect is on PC0 (pin 64) and is active low
> * Write protect is on PC2 (pin 66)
> 
> One interesting thing I see in the legacy code is when an explicit test is 
> made for the card, the pin mode is changed to being a plain GPIO before 
> testing and then restored to IRQ generation afterwards. However, this may just 
> be relevant for this old code and its particular way of doing things.
> 
> With regard to the modern kernel, I see that the MMC driver should revert to a 
> non-DMA operating mode if the DMA channels cannot be acquired.

Well, it seems they are acquired but do not work.

> 
> Anyway, those are my thoughts for today!
> 
> Paul<0001-Introduce-JZ4730-no-descriptor-transfers-instead.patch>

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.

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.

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)
https://www.at91.com/viewtopic.php?t=28764
https://unix.stackexchange.com/questions/492611/mmc0-warning-on-sd-card-bootup-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)

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? 

BR and thanks,
Nikolaus



More information about the Letux-kernel mailing list