SDIO Controller Known Issues and Work arounds

This document contains the collected knowledge from ATI/Nintendo/BroadOn and BroadCom on the Arasan host controller integrated with RVL Vegas. Any bugs in this document please report them, since we would like to keep it accurate.

1. Block Count Bug

Comment from Broadcom (w/ some small edits): “When doing a byte mode (non-block mode) write, the block count register should be a DontCare. However, the Arasan core was using this register to determine whether it was time to honor the interrupt period.  The proposed SW workaround is to set this register to 1 when starting a byte mode transfer thus indicating to the (faulty) Arasan logic that this will be the last xfer and thus time to honor the interrupt period.“

2. CMD12 false interrupt

During CMD12 may get false interrupts, CMD12 does not support interrupts in the specification, so not an issue to disable them on the slot when a CMD12 is sent (if memory card in slot, can disable interrupts all the time for that slot)

s/w work around, disable interrupts for the slot when doing CMD12, if slot has Memory card, disable interrupts always.

3. Suspend / Resume read / write bug.

When suspending w/ read suspend followed by non-DMA write.

s/w work around, do not do suspend / resume. ATi may have another workaround w/ 16-bit /8-bit write support.

Possible issue for multi-function card

4. Infinite-Read fails after Infinite-Write.

Detailed the sequence :
  1. Infinit-Write -> CMD12(Abort) -> SoftReset -> Infinit-Read (Got CRC Error & Read not Complete)
  2. Infinit-Write -> CMD12(Abort) -> SoftReset -> delay -> SoftReset -> Infinit-Read (No CRC Error But, Read not Complete)

5. Power is always on.

Power is always on (no control from host controller) in bring-up board. Reset may not work as expected. Work- around, always issue cmd52 with io-RESET (otherwise RCA is valid and CMD 5 fails). That is function 0, register 6, with value 0x08.

6. Only 32 bit access to Arasan host controller works.

There are two workarounds necessary. First use read modify write for write, and mask bits for read. See code below which is used in BroadOn SDIO driver. The exception is the transfer mode that has to be pre-combined with the command register (both 16bits in the same 32 bits). i.e.

    /* 5 Set Transfer Mode */
   
cmd32 = (transfer_mode) | (command<<16);

    /*
     * 6 Set Command
     *
     * Writing the upper byte of the command register starts the
     * command.  All register initialization must already be complete
     * by this point.
     */
    WRITE_HOST_U32((u32)pslot->m_base, HOSTREG_TRANSMODE, cmd32);

Read/Modify/Write code which works for most cases:

u8
READ_HOST_U8(u32 base, u16 reg)
{
    u8 ret;
    u32 absolute = base+reg;
    u32* bp32 = (u32*)(absolute&0xFFFFFFFC);
    u32 data = *bp32;
    int byte = (absolute&0x00000003);
   
    if (byte==0){

        ret = (data & 0x000000FF);
    } else if (byte==1){
        ret = (data & 0x0000FF00)>>8;
    } else if (byte==2){
        ret = (data & 0x00FF0000)>>16;
    } else if (byte==3){
        ret = (data & 0xFF000000)>>24;
    }        
    return ret;
}

void
WRITE_HOST_U8(u32 base, u16 reg, u8 val)
{
    u32 absolute = base+reg;
    u32* bp32 = (u32*)(absolute&0xFFFFFFFC);
    u32 data = *bp32;
    int byte = (absolute&0x00000003);

    if (byte==0){
        data = (data & 0xFFFFFF00)|val;
    } else if (byte==1){
        data = (data & 0xFFFF00FF)|(val<<8);
    } else if (byte==2){
        data = (data & 0xFF00FFFF)|(val<<16);
    } else if (byte==3){
        data = (data & 0x00FFFFFF)|(val<<24);
    }        
    *bp32 = data;
}

u16
READ_HOST_U16(u32 base, u16 reg)
{
    u16 ret;
    u32 absolute = base+reg;
    u32* bp32 = (u32*)(absolute&0xFFFFFFFC);
    u32 data = *bp32;
    int byte = (absolute&0x00000002);
    if (byte==0){
        ret = (data & 0x0000FFFF);
    } else if (byte==2){
        ret = (data & 0xFFFF0000)>>16;
    }        
    return ret;
}

void
WRITE_HOST_U16(u32 base, u16 reg, u16 val)
{
    u32 absolute = base+reg;
    u32* bp32 = (u32*)(absolute&0xFFFFFFFC);
    u32 data = *bp32;
    int byte = (absolute&0x00000002);
    if (byte==0){
        data = (data & 0xFFFF0000)|val;
    } else if (byte==2){
        data = (data & 0x0000FFFF)|(val<<16);
    }
    *bp32 = data;
}