[Letux-kernel] X1600 / LX16 support - here: adding MMC

H. Nikolaus Schaller hns at goldelico.com
Fri Feb 9 18:10:49 CET 2024



> Am 09.02.2024 um 17:49 schrieb Andreas Kemnade <andreas at kemnade.info>:
> 
> On Fri, 9 Feb 2024 17:02:51 +0100
> "H. Nikolaus Schaller" <hns at goldelico.com> wrote:
> 
>> Hi Andreas,
>> 
>>> Am 09.02.2024 um 16:20 schrieb Andreas Kemnade <andreas at kemnade.info>:
>>> 
>>> Hi Nikolaus,
>>> 
>>> On Fri, 9 Feb 2024 15:14:11 +0100
>>> "H. Nikolaus Schaller" <hns at goldelico.com> wrote:
>>> 
>>>> Unfortunately we can't look into /sys/kernel/debug...  
>>> 
>>> well, you can either use an initrd (haven't a nice mips one lying
>>> around here, but maybe just an alpine image suffices),  
>> 
>> Or one of the letux rootfs? http://download.goldelico.com/letux-debian-rootfs/wheezy-mipsel-minimal.tbz
>> 
>> But I think it is far too big for an initrd (ca. 100 MB).
>> 
> my alpine arm image is 4.7MB uncompressed combined with scripts

Yes that is much smaller. I remember that the letux 400 (jz4730)
needed some initrd and it was a stripped down Debian Etch (just
kept busybox and init and some important tools but removed all
man entries) to ca. 3 MB.

> ready to run to produce various things out of it, so I can easily 
> just boot it.
> 
>>> or configure  
>> 
>> Yes, that yould work but is probably the same complexity as fixing
>> the real bug.
>> 
>>> one of the slots as gpio and use mmc over spi over gpio.  
>> 
>> In both cases we disable the mmc initialization we want to analyse.
>> To understand why the setup isn't correct.
>> 
> no, we do not disable it we just have the ability to examine things
> from userspace as rootfs does not depend on successful initialisation of
> mmc.

Is there a devmem2 available?

> I have debugged several other emmc/sd problems on other boards this way.

I agree that it can work but IMHO setting it up is quite a distraction
and in the saved time the problem can be analysed by different methods.

But we can of course work in parallel - and one method will find the bugs.

> 
> BTW: how do we boot the board from USB? With tools are needed on host  side?

Well, that is complex... Basically one needs a special tool that only exists
as Windows.exe or some Linux binary requiring Xfce4. I was able last year
to wrap that into a package so that it can be used more easily (would have to
search for it).

But after we had debugged the hardware issues which made this tool report
errors and learned how to format a µSD we did give up using it. The only reason
to revive it would be if we replace the µSD with eMMC. Then, the tool can
be used to flash it in circuit. Basically the boot mode is described in the
x1600 PM and on hardware side one needs to press the Boot button while doing
a reset.

===

Here is now an interesting log just by replacing pr_debug by pr_info (I have
deleted all non-mmc messages - and disabled mmc1 completely in DTS):

[    0.000199] mmc0: clock 0Hz busmode 2 powermode 1 cs 0 Vdd 21 width 1 timing 0
[    0.000199] mmc0: clock 400000Hz busmode 2 powermode 2 cs 0 Vdd 21 width 1 timing 0
[    0.000199] jz4740-mmc 13450000.mmc: Ingenic SD/MMC card driver registered
[    0.000199] jz4740-mmc 13450000.mmc: Using DMA, 4-bit mode
[    0.000199] mmc0: mmc_rescan_try_freq: trying to init card at 400000 Hz
[    0.000199] mmc_rescan_try_freq
[    0.000199] mmc0: starting CMD52 arg 00000c00 flags 00000195
[    0.000199] Waiting for root device /dev/mmcblk0p2...
[    0.000199] mmc0: req done (CMD52): -145: 00000000 00000000 00000000 00000000
[    0.000199] mmc0: starting CMD52 arg 80000c08 flags 00000195
[    0.000199] mmc0: req done (CMD52): -145: 00000000 00000000 00000000 00000000
[    0.000199] mmc0: clock 400000Hz busmode 2 powermode 2 cs 1 Vdd 21 width 1 timing 0
[    0.000199] mmc0: starting CMD0 arg 00000000 flags 000000c0
[    0.000199] mmc0: req done (CMD0): 0: 00000000 00000000 00000000 00000000
[    0.000199] mmc0: clock 400000Hz busmode 2 powermode 2 cs 0 Vdd 21 width 1 timing 0
[    0.000199] mmc0: starting CMD8 arg 000001aa flags 000002f5
[    0.000199] mmc0: req done (CMD8): 0: 000001aa 00000000 00000000 00000000
[    0.000199] mmc_attach_sdio
[    0.000199] mmc0: starting CMD5 arg 00000000 flags 000002e1
[    0.000199] mmc0: req failed (CMD5): -145, retrying...
[    0.000199] mmc0: req failed (CMD5): -145, retrying...
[    0.000199] mmc0: req failed (CMD5): -145, retrying...
[    0.000199] mmc0: req done (CMD5): -145: 00000000 00000000 00000000 00000000
[    0.000199] mmc0: starting CMD55 arg 00000000 flags 000000f5
[    0.000199] mmc0: req done (CMD55): 0: 00400120 00000000 00000000 00000000
[    0.000199] mmc0: starting CMD41 arg 00000000 flags 000000e1
[    0.000199] mmc0: req done (CMD41): 0: 00ff8000 00000000 00000000 00000000
[    0.000199] mmc_select_voltage: ocr=00ff8000
[    0.000199] mmc0: clock 400000Hz busmode 2 powermode 2 cs 1 Vdd 21 width 1 timing 0
[    0.000199] mmc0: starting CMD0 arg 00000000 flags 000000c0
[    0.000199] mmc0: req done (CMD0): 0: 00000000 00000000 00000000 00000000
[    0.000199] mmc0: clock 400000Hz busmode 2 powermode 2 cs 0 Vdd 21 width 1 timing 0
[    0.000199] mmc0: starting CMD8 arg 000001aa flags 000002f5
[    0.000199] mmc0: req done (CMD8): 0: 000001aa 00000000 00000000 00000000
[    0.000199] mmc0: starting CMD55 arg 00000000 flags 000000f5
[    0.000199] mmc0: req done (CMD55): 0: 00000120 00000000 00000000 00000000
[    0.000199] mmc0: starting CMD41 arg 40300000 flags 000000e1
[    0.000199] mmc0: req done (CMD41): 0: 00ff8000 00000000 00000000 00000000
[    0.000199] mmc0: starting CMD55 arg 00000000 flags 000000f5
[    0.000199] mmc0: req done (CMD55): 0: 00000120 00000000 00000000 00000000
[    0.000199] mmc0: starting CMD41 arg 40300000 flags 000000e1
[    0.000199] mmc0: req done (CMD41): 0: c0ff8000 00000000 00000000 00000000
[    0.000199] mmc0: starting CMD2 arg 00000000 flags 00000007
[    0.000199] mmc0: req done (CMD2): 0: 744a6055 53445531 208038a9 8e01783f
[    0.000199] mmc0: starting CMD3 arg 00000000 flags 00000075
[    0.000199] mmc0: req done (CMD3): 0: 59b40520 00000000 00000000 00000000
[    0.000199] mmc0: starting CMD9 arg 59b40000 flags 00000007
[    0.000199] mmc0: req done (CMD9): 0: 400e0032 5b590000 76ed7f80 0a40003f
[    0.000199] mmc0: starting CMD7 arg 59b40000 flags 00000015
[    0.000199] mmc0: req done (CMD7): 0: 00000700 00000000 00000000 00000000
[    0.000199] mmc0: starting CMD55 arg 59b40000 flags 00000095
[    0.000199] mmc0: req done (CMD55): 0: 00000920 00000000 00000000 00000000
[    0.000199] mmc0: starting CMD51 arg 00000000 flags 000000b5
[    0.000199] mmc0:     blksz 8 blocks 1 flags 00000200 tsac 100 ms nsac 0
[    0.000199] mmc0: req done (CMD51): 0: 00000920 00000000 00000000 00000000
[    0.000199] mmc0:     8 bytes transferred: 0
[    0.000199] mmc0: starting CMD55 arg 59b40000 flags 00000095
[    0.000199] mmc0: req done (CMD55): 0: 00000920 00000000 00000000 00000000
[    0.000199] mmc0: starting CMD13 arg 00000000 flags 000001b5
[    0.000199] mmc0:     blksz 64 blocks 1 flags 00000200 tsac 100 ms nsac 0
[    0.000199] mmc0: req done (CMD13): 0: 00000920 00000000 00000000 00000000
[    0.000199] mmc0:     64 bytes transferred: 0
[    0.000199] mmc0: starting CMD6 arg 00fffff0 flags 000000b5
[    0.000199] mmc0:     blksz 64 blocks 1 flags 00000200 tsac 100 ms nsac 0
[    0.000199] mmc0: req done (CMD6): 0: 00000900 00000000 00000000 00000000
[    0.000199] mmc0:     64 bytes transferred: 0
[    0.000199] mmc0: host does not support reading read-only switch, assuming write-enable
[    0.000199] mmc0: starting CMD6 arg 80fffff1 flags 000000b5
[    0.000199] mmc0:     blksz 64 blocks 1 flags 00000200 tsac 100 ms nsac 0
[    0.000199] mmc0: req done (CMD6): 0: 00000900 00000000 00000000 00000000
[    0.000199] mmc0:     64 bytes transferred: 0
[    0.000199] mmc0: clock 400000Hz busmode 2 powermode 2 cs 0 Vdd 21 width 1 timing 2
[    0.000199] mmc0: clock 50000000Hz busmode 2 powermode 2 cs 0 Vdd 21 width 1 timing 2
[    0.000199] mmc0: starting CMD55 arg 59b40000 flags 00000095
[    0.000199] mmc0: req done (CMD55): 0: 00000920 00000000 00000000 00000000
[    0.000199] mmc0: starting CMD6 arg 00000002 flags 00000015
[    0.000199] mmc0: req done (CMD6): -145: 00000000 00000000 00000000 00000000
[    0.000199] mmc0: starting CMD55 arg 59b40000 flags 00000095
[    0.000199] mmc0: req done (CMD55): -5: 00000000 00000000 00000000 00000000
[    0.000199] mmc0: starting CMD55 arg 59b40000 flags 00000095
[    0.000199] mmc0: req done (CMD55): -145: 00000000 00000000 00000000 00000000
[    0.000199] mmc0: starting CMD55 arg 59b40000 flags 00000095
[    0.000199] mmc0: req done (CMD55): -5: 00000000 00000000 00000000 00000000
[    0.000199] mmc0: error -5 whilst initialising SD card
[    0.000199] mmc_attach_mmc
[    0.000199] mmc0: clock 50000000Hz busmode 1 powermode 2 cs 0 Vdd 21 width 1 timing 2
[    0.000199] mmc0: starting CMD1 arg 00000000 flags 000000e1
[    0.000199] mmc0: req done (CMD1): 0: ffffffff 00000000 00000000 00000000
[    0.000199] mmc_select_voltage: ocr=ffffffff
[    0.000199] jz4740-mmc 13450000.mmc: card claims to support voltages below defined range
[    0.000199] mmc0: clock 50000000Hz busmode 1 powermode 2 cs 0 Vdd 21 width 1 timing 2
[    0.000199] mmc0: clock 50000000Hz busmode 1 powermode 2 cs 1 Vdd 21 width 1 timing 2
[    0.000199] mmc0: starting CMD0 arg 00000000 flags 000000c0
[    0.000199] mmc0: req done (CMD0): 0: 00000000 00000000 00000000 00000000
[    0.000199] mmc0: clock 50000000Hz busmode 1 powermode 2 cs 0 Vdd 21 width 1 timing 2
[    0.000199] mmc0: starting CMD1 arg 40300000 flags 000000e1
[    0.000199] mmc0: req done (CMD1): -145: 00000000 00000000 00000000 00000000
[    0.000199] mmc0: error -145 whilst initialising MMC card
[    0.000199] mmc0: clock 0Hz busmode 2 powermode 0 cs 0 Vdd 0 width 1 timing 0
[    0.000199] mmc0: mmc_rescan_try_freq: trying to init card at 390625 Hz
[    0.000199] mmc_rescan_try_freq
[    0.000199] mmc0: clock 0Hz busmode 2 powermode 1 cs 0 Vdd 21 width 1 timing 0
[    0.000199] mmc0: clock 390625Hz busmode 2 powermode 2 cs 0 Vdd 21 width 1 timing 0
[    0.000199] mmc0: starting CMD52 arg 00000c00 flags 00000195
[    0.000199] mmc0: req done (CMD52): -145: 00000000 00000000 00000000 00000000
[    0.000199] mmc0: starting CMD52 arg 80000c08 flags 00000195
[    0.000199] mmc0: req done (CMD52): -145: 00000000 00000000 00000000 00000000
[    0.000199] mmc0: clock 390625Hz busmode 2 powermode 2 cs 1 Vdd 21 width 1 timing 0
[    0.000199] mmc0: starting CMD0 arg 00000000 flags 000000c0
[    0.000199] mmc0: req done (CMD0): 0: 00000000 00000000 00000000 00000000
[    0.000199] mmc0: clock 390625Hz busmode 2 powermode 2 cs 0 Vdd 21 width 1 timing 0
[    0.000199] mmc0: starting CMD8 arg 000001aa flags 000002f5
[    0.000199] mmc0: req done (CMD8): 0: 000001aa 00000000 00000000 00000000
[    0.000199] mmc_attach_sdio
[    0.000199] mmc0: starting CMD5 arg 00000000 flags 000002e1
[    0.000199] mmc0: req failed (CMD5): -145, retrying...
[    0.000199] mmc0: req failed (CMD5): -145, retrying...
[    0.000199] mmc0: req failed (CMD5): -145, retrying...
[    0.000199] mmc0: req done (CMD5): -145: 00000000 00000000 00000000 00000000
[    0.000199] mmc0: starting CMD55 arg 00000000 flags 000000f5
[    0.000199] mmc0: req done (CMD55): 0: 00400120 00000000 00000000 00000000
[    0.000199] mmc0: starting CMD41 arg 00000000 flags 000000e1
[    0.000199] mmc0: req done (CMD41): 0: 00ff8000 00000000 00000000 00000000
[    0.000199] mmc_select_voltage: ocr=00ff8000
[    0.000199] mmc0: clock 390625Hz busmode 2 powermode 2 cs 1 Vdd 21 width 1 timing 0
[    0.000199] mmc0: starting CMD0 arg 00000000 flags 000000c0
[    0.000199] mmc0: req done (CMD0): 0: 00000000 00000000 00000000 00000000
[    0.000199] mmc0: clock 390625Hz busmode 2 powermode 2 cs 0 Vdd 21 width 1 timing 0

As we can see there are attempts to switch the clock to 50 MHz. But the first
CMD52 already fails.

So we may just have to look at clock divider and switching.

BR,
Nikolaus




More information about the Letux-kernel mailing list