Hi,

since Commit a3bf6c16f77d ("dts: update to v6.19-rc1"), barebox fails to
initialize the SD card on my Radxa ROCK T5 board.

I tracked the failure down to a change of the pinctrl setting for the
card detect pin to RK_FUNC_GPIO (see sdmmc_det_pin). If I change the
pinctrl mux back to 1, the SD card is initialized correctly.

If the error happens, the dw_mmc driver reports a DATA ERROR on CMD13
with BIT(13) set (DWMCI_INTMSK_SBE) and runs into a timeout afterward:

        dw_mmc [email protected]: registered as mmc1
        dw_mmc [email protected]: Using fifo-depth=256
        mmc1: clock 0.0MHz width 1 timing legacy
        dw_mmc [email protected]: Buswidth = 0, clock: 0
        mmc1: clock 0.400000MHz width 1 timing legacy
        dw_mmc [email protected]: Buswidth = 0, clock: 400000
        dw_mmc [email protected]: Sending CMD0
        dw_mmc [email protected]: Sending CMD8
        mmc1: SD Card Rev. 2.00 or later detected
        dw_mmc [email protected]: Sending CMD55
        dw_mmc [email protected]: Sending CMD41
        dw_mmc [email protected]: Sending CMD55
        dw_mmc [email protected]: Sending CMD41
        dw_mmc [email protected]: Sending CMD55
        dw_mmc [email protected]: Sending CMD41
        dw_mmc [email protected]: Sending CMD55
        dw_mmc [email protected]: Sending CMD41
        dw_mmc [email protected]: Sending CMD55
        dw_mmc [email protected]: Sending CMD41
        mmc1: Put the Card in Identify Mode
        dw_mmc [email protected]: Sending CMD2
        mmc1: Card's identification data is: 03534453-44333247-8555412B-AC0191F5
        mmc1: Get/Set relative address
        dw_mmc [email protected]: Sending CMD3
        mmc1: Get card's specific data
        dw_mmc [email protected]: Sending CMD9
        mmc1: Card's specific data is: 400E0032-5B590000-EDC87F80-0A4040C3
        mmc1: Transfer speed: 25000000
        mmc1: Max. block length are: Write=512, Read=512 Bytes
        mmc1: Read block length: 512, Write block length: 512
        mmc1: Select the card, and put it into Transfer Mode
        dw_mmc [email protected]: Sending CMD7
        mmc1: Changing transfer frequency
        dw_mmc [email protected]: Sending CMD55
        mmc1: Trying to read the SCR (try 1 of 3)
        dw_mmc [email protected]: desc@ 0x00000000ad25b000 0x8000001c 
0x00000008 0xad25aac0 0xad25b010
        dw_mmc [email protected]: Sending CMD51
        dw_mmc [email protected]: desc@ 0x00000000ad25b000 0x8000001c 
0x00000040 0xad25aac0 0xad25b010
        dw_mmc [email protected]: Sending CMD6
        dw_mmc [email protected]: desc@ 0x00000000ad25b000 0x8000001c 
0x00000040 0xad25aac0 0xad25b010
        dw_mmc [email protected]: Sending CMD6
        mmc1: detected SD card version 2.0
        mmc1: Capacity: 30436 MiB
        mmc1: Erase group is 1 sector(s). Trim not supported
        mmc1: Prepare for bus width change
        dw_mmc [email protected]: Sending CMD55
        mmc1: Set SD bus width to 4 bit
        dw_mmc [email protected]: Sending CMD6
        mmc1: clock 0.400000MHz width 4 timing legacy
        dw_mmc [email protected]: Buswidth = 2, clock: 400000
        mmc1: clock 50.0MHz width 4 timing SD HS
        dw_mmc [email protected]: Buswidth = 2, clock: 50000000
        dw_mmc [email protected]: Sending CMD55
        dw_mmc [email protected]: desc@ 0x00000000ad25b000 0x8000001c 
0x00000040 0xad25d780 0xad25b010
        dw_mmc [email protected]: Sending CMD13
        dw_mmc [email protected]: DATA ERROR!
        dw_mmc [email protected]: desc@ 0x00000000ad25b000 0x8000001c 
0x00000040 0xad25d780 0xad25b010
        dw_mmc [email protected]: Sending CMD13
        dw_mmc [email protected]: Send command timeout..
        dw_mmc [email protected]: desc@ 0x00000000ad25b000 0x8000001c 
0x00000040 0xad25d780 0xad25b010
        dw_mmc [email protected]: Sending CMD13
        dw_mmc [email protected]: Send command timeout..
        dw_mmc [email protected]: desc@ 0x00000000ad25b000 0x8000001c 
0x00000040 0xad25d780 0xad25b010
        dw_mmc [email protected]: Sending CMD13
        dw_mmc [email protected]: Send command timeout..
        mmc1: unable to read ssr: Connection timed out
        dw_mmc [email protected]: Sending CMD16
        dw_mmc [email protected]: Send command timeout..
        dw_mmc [email protected]: Sending CMD16
        dw_mmc [email protected]: Send command timeout..
        dw_mmc [email protected]: Sending CMD16
        dw_mmc [email protected]: Send command timeout..
        dw_mmc [email protected]: Sending CMD16
        dw_mmc [email protected]: Send command timeout..
        dw_mmc [email protected]: Sending CMD16
        dw_mmc [email protected]: Send command timeout..
        WARNING: mmc1: Card's startup fails with -110

It seems to me that the SD host controller fails to correctly initialize
if the card detect it directly muxed as GPIO instead of muxing it to the
SD host controller. At least that's what I understand from
https://lore.kernel.org/linux-rockchip/4920950.GXAFRqVoOG@diego/.

May there be some configuration in the SD host controller that needs to
be changed to ignore the card detect?

Michael

Reply via email to