Dear all,
i am facing a strange issue developing a small Linux driver, based on existing sdhci.c, for this device. The driver uses SDMA.
In short, after ACMD51 is issued, i get, in order, 3 interrupts: "cmd trasferred OK", "dma (rx) transfer completed ok", and finally "data crc error". The data received in the SDMA buffer (SCR register) seems well formed and to be correct),
In details:
[ 5.300000] esdhc_pltfm_set_clock() at 400000 done
[ 5.320000] sdhci.c sdhci_send_command() : cmd 52 arg 3072
[ 5.320000] sdhci_irq() : IRQ status 0x00010001
[ 5.340000] sdhci_irq() : IRQ status 0x00000080
[ 5.340000] sdhci.c sdhci_send_command() : cmd 52 arg -2147480568
[ 5.340000] sdhci_irq() : IRQ status 0x00010001
[ 5.350000] sdhci_irq() : IRQ status 0x00000080
[ 5.370000] sdhci.c sdhci_send_command() : cmd 0 arg 0
[ 5.370000] sdhci_irq() : IRQ status 0x00000001
[ 5.410000] sdhci.c sdhci_send_command() : cmd 8 arg 426
[ 5.410000] sdhci_irq() : IRQ status 0x00000001
[ 5.420000] sdhci.c sdhci_send_command() : cmd 5 arg 0
[ 5.420000] sdhci_irq() : IRQ status 0x00010001
[ 5.430000] sdhci_irq() : IRQ status 0x00000080
[ 5.430000] sdhci.c sdhci_send_command() : cmd 5 arg 0
[ 5.430000] sdhci_irq() : IRQ status 0x00010001
[ 5.440000] sdhci_irq() : IRQ status 0x00000080
[ 5.450000] sdhci.c sdhci_send_command() : cmd 5 arg 0
[ 5.450000] sdhci_irq() : IRQ status 0x00010001
[ 5.460000] sdhci_irq() : IRQ status 0x00000080
[ 5.460000] sdhci.c sdhci_send_command() : cmd 5 arg 0
[ 5.460000] sdhci_irq() : IRQ status 0x00010001
[ 5.470000] sdhci_irq() : IRQ status 0x00000080
[ 5.480000] sdhci.c sdhci_send_command() : cmd 55 arg 0
[ 5.480000] sdhci_irq() : IRQ status 0x00000001
[ 5.490000] sdhci.c sdhci_send_command() : cmd 41 arg 0
[ 5.490000] sdhci_irq() : IRQ status 0x00000001
[ 5.510000] sdhci.c sdhci_send_command() : cmd 0 arg 0
[ 5.510000] sdhci_irq() : IRQ status 0x00000001
[ 5.540000] sdhci.c sdhci_send_command() : cmd 8 arg 426
[ 5.540000] sdhci_irq() : IRQ status 0x00000001
[ 5.560000] sdhci.c sdhci_send_command() : cmd 55 arg 0
[ 5.560000] sdhci_irq() : IRQ status 0x00000001
[ 5.580000] sdhci.c sdhci_send_command() : cmd 41 arg 1075838976
[ 5.580000] sdhci_irq() : IRQ status 0x00000001
[ 5.610000] sdhci.c sdhci_send_command() : cmd 55 arg 0
[ 5.610000] sdhci_irq() : IRQ status 0x00000001
[ 5.620000] sdhci.c sdhci_send_command() : cmd 41 arg 1075838976
[ 5.620000] sdhci_irq() : IRQ status 0x00000001
[ 5.630000] sdhci.c sdhci_send_command() : cmd 2 arg 0
[ 5.630000] sdhci_irq() : IRQ status 0x00000001
[ 5.640000] sdhci.c sdhci_send_command() : cmd 3 arg 0
[ 5.640000] sdhci_irq() : IRQ status 0x00000001
[ 5.650000] sdhci.c sdhci_send_command() : cmd 9 arg 305397760
[ 5.650000] sdhci_irq() : IRQ status 0x00000001
[ 5.660000] sdhci.c sdhci_send_command() : cmd 7 arg 305397760
[ 5.660000] sdhci_irq() : IRQ status 0x00000001
[ 5.670000] sdhci.c sdhci_send_command() : cmd 55 arg 305397760
[ 5.670000] sdhci_irq() : IRQ status 0x00000001
[ 5.680000] sdhci.c sdhci_send_command() : cmd 51 arg 0
[ 5.680000] sdhci_irq() : IRQ status 0x00000001
[ 5.770000] sdhci_irq() : IRQ status 0x00000008
[ 5.770000] sdhci_irq() : IRQ status 0x00200002 <---- CRC data error
[ 5.770000] sdhci_irq() : IRQ status 0x00000080
[ 5.780000] sdhci_irq() : IRQ status 0x00000040
[ 5.780000] mmc0: error -84 whilst initialising SD card
If i disable the error check/flag, the driver works fine, i can access the card content accessing /dev/mmcblk0 and data is correct (still need to swap it to LE btw).
I have looked into the errata, none of the issues seems to apply to this.
Any help is really appreciated.
Thanks
Angelo
Hi Tom and Fang,
many thanks for your help,
well, proceeding really slow due to family tasks, btw had a look on the quirks and i don't seems to see anything useful,
but will check better.
Also, i don't see anything directly related to this in the errata.
What is happening here is that, i send a ACMD51, and just after i get a DMA transfer completed succesfully (DINT bit only set, no errors), and this seems true, since reading the dma buffer i see always the same and correct data read (zeroed the buffer before).
Then, sdhci.c common the irq handler, before exiting, reads again the interrupt status register, in a loop, since the sdhci.c driver is organized to perform a loop in the irq, to check if some other events are happening. And in this second read of int status reg, a TC + DAT (data crc error) is reported.
It is like, after the proper DMA read, a transfer completed + error is reported. How does it work the DATA CRC check after a DMA read ? The controller inspects the dma buffer ?
Regards,
Angelo
Have you looked through the Linux drivers for these NXP SDHC modules?
Do they enable the CRC check or not?
Have you looked at the "QUIRKS" listed for these modules?
Linux source code: drivers/mmc/host/sdhci-esdhc.h (v4.20.13) - Bootlin
Tom
Hello,
What are the"small Linux driver, based on existing sdhci.c"? Did you use the Linux BSP NXP provide for TWR-MCF5441X? And what is your hardware? The NXP board or customer designed board?