I'm trying to write a bare metal driver for the iMX6 uSDHC peripheral. It's wired up to an eMMC device. I'm able to initialize the emmc device and read blocks successfully. But when I try to do a write block command (CMD24 or CMD25), the BWEN bit in the PRES_STATE register never gets set so the driver is never able to proceed on with writing data to the DATA_BUF_ACC_PORT register.
I am using the polled mode, no interrupts or DMA. The read operation is doing the same thing except polling the BREN bit to determine when it can read data, and this method is working fine. I've been through all the INT_STATUS_EN register settings, BWRSEN and BRRSEN are both set.
From the datasheet: "A change of this bit from 0 to 1 occurs when the buffer can hold valid data greater than the write watermark level and the Buffer Write Ready interrupt is generated and enabled."
I'm sure the buffer write ready interrupt is being enabled, and nothing has been written to the buffer register yet so why is the bit not setting? I have the watermark level set at 0x40 (half the FIFO). Can you see anything I'm missing?