Hi,

I'm trying to port the imxrt SD Card driver (imxrt_usdhc.c) to the
sama5d27. Both chips appear to use similar Cadence IP blocks... the
registers appear to be almost identical. I know the SDMMC peripheral and
the SD Card both work since I can boot from it using U-Boot on the
SAMA5D2-XULT board.

I have the driver compiling and I can get SDMMC peripheral reset and the
clock started and stabilized. (I think.) However, I can't seem to receive
command responses from the SD Card... I just receive timeouts.
See below for some debug logging. Source code is here on this branch
<https://github.com/starcat-io/incubator-nuttx/tree/feature/sama5d27-sdmmc-support>.
Here's the sam_sdmmc.c driver file, which corresponds to the imxrt_usdhc.c
file.

Does anyone have any tips about how to debug this driver? Did anyone do a
port of this driver? If so how did you debug it or get it working? I know
the Sony cxd5602 and imxrt family both use this driver.

cheers
adam
-- 
Adam Feuer <a...@adamfeuer.com>

[    0.000000] sam_rng_initialize: Initializing TRNG hardware
[    3.450000] nsh_main: custinfo: Entry
[    3.450000] nsh_main: mcinfo: Entry
[    3.460000] nsh_initialize: Entry
[    3.460000] nsh_initialize: about to mount romfs
[    3.470000] board_app_initialize: custinfo: Here 0.1
[    3.470000] board_app_initialize: mcinfo: Here 0.2
[    3.480000] sam_sdmmc_initialize: Entry.
[    3.480000] sam_sdmmc_sdio_initialize: sdio init
[    3.490000] sam_reset: Reset complete
[    3.490000] sam_clock: DISABLED, SYSCTRL: 00000000
[    3.500000] sam_reset: SYSCTL: 00000000 PRSSTAT: 01ff0000 IRQSTATEN:
117f01ff
[    3.500000] sam_dumpsample: SDMMC Registers: After reset
[    3.510000] sam_dumpsample:    DSADDR[00000000]: 0000040e
[    3.520000] sam_dumpsample:   BLKATTR[00000004]: 0010040e
[    3.520000] sam_dumpsample:    CMDARG[00000008]: 0020040e
[    3.530000] sam_dumpsample:    XFERTY[0000000c]: 00300416
[    3.530000] sam_dumpsample:   CMDRSP0[00000010]: 00400416
[    3.540000] sam_dumpsample:   CMDRSP1[00000014]: 00500416
[    3.550000] sam_dumpsample:   CMDRSP2[00000018]: 00600416
[    3.550000] sam_dumpsample:   CMDRSP3[0000001c]: 00700416
[    3.560000] sam_dumpsample:   PRSSTAT[00000024]: 00000000
[    3.560000] sam_dumpsample:    PROCTL[00000028]: 00000000
[    3.570000] sam_dumpsample:    SYSCTL[0000002c]: 00000000
[    3.580000] sam_dumpsample:   IRQSTAT[00000030]: 00000000
[    3.580000] sam_dumpsample: IRQSTATEN[00000034]: 00000000
[    3.590000] sam_dumpsample:  IRQSIGEN[00000038]: 00000000
[    3.590000] sam_dumpsample:   AC12ERR[0000003c]: 00000000
[    3.600000] sam_dumpsample:  HTCAPBLT[00000040]: 00000000
[    3.600000] sam_dumpsample:       WML[00000044]: 00000000
[    3.610000] sam_dumpsample:    ADMAES[00000054]: 00000000
[    3.620000] sam_dumpsample:   ADSADDR[00000058]: 00000000
[    3.620000] sam_dumpsample:    VENDOR[000000c0]: 00000000
[    3.630000] sam_dumpsample:   MMCBOOT[000000c4]: 00000000
[    3.630000] sam_sdmmc_sdio_initialize: sdio init complete
[    3.640000] mmcsd_slotinitialize: minor: 0
[    3.640000] mmcsd_slotinitialize: in mmcd_slotinitnitialize
[    3.650000] mmcsd_slotinitialize: about to mmcd_hwinitialize
[    3.660000] mmcsd_hwinitialize: in mmcsd_hwinitialize
[    3.660000] mmcsd_hwinitialize: DMA supported: 0
[    3.670000] mmcsd_hwinitialize: Attached MMC/SD interrupts
[    3.670000] sam_registercallback: Register 0x2007374c(0x200ad880)
[    3.680000] sam_status: cdstatus=01
[    3.680000] mmcsd_probe: type: 0 probed: 0
[    3.690000] sam_status: cdstatus=01
[    3.690000] mmcsd_removed: type: 0 present: 1
[    3.700000] sam_clock: DISABLED, SYSCTRL: 00000000
[    3.700000] sam_status: cdstatus=01
[    3.710000] sam_status: cdstatus=01
[    3.710000] sam_clock: IDMODE
[    3.730000] sam_clock: Waiting for SDMMC clock to stablize.
[    3.730000] sam_clock: SYSCTRL: 00008003
[    3.740000] mmcsd_cardidentify: About to mmcsd_sendcmdpoll 1...
[    3.740000] sam_sendcmd: in sendcmd[    3.750000] sam_sendcmd: cmd:
00000000 arg: 00000000 regval: 00000000 mcrval: 80000000
[    3.750000] sam_sendcmd: sendcmd complete.
[    3.860000] sam_waitresponse: ERROR: Timeout cmd: 00000000 IRQSTAT:
00000000
[    3.860000] mmcsd_sendcmdpoll: ERROR: Wait for response to cmd: 00000000
failed: -116
[    3.870000] mmcsd_cardidentify: About to mmcsd_sendcmdpoll 2...
[    3.880000] sam_sendcmd: in sendcmd[    3.880000] sam_sendcmd: cmd:
00000000 arg: 00000000 regval: 00000000 mcrval: 80000000
[    3.990000] sam_sendcmd: ERROR: Timeout (waiting CIHB) cmd: 00000000
PRSSTAT: 01ff0001

Reply via email to