The SDHCI v1 spec only defines the first 9 error_irq_enable bits and reserves other bits in the field. Don't enable the 10th bit (which was defined in the v2 spec) as it's not needed anyway.
Signed-off-by: Kevin O'Connor kevin@koconnor.net --- src/hw/sdcard.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/hw/sdcard.c b/src/hw/sdcard.c index be726d2..0617d24 100644 --- a/src/hw/sdcard.c +++ b/src/hw/sdcard.c @@ -493,7 +493,7 @@ sdcard_controller_setup(struct sdhci_s *regs, int prio) writew(®s->irq_enable, 0x01ff); writew(®s->irq_status, readw(®s->irq_status)); writew(®s->error_signal, 0); - writew(®s->error_irq_enable, 0x03ff); + writew(®s->error_irq_enable, 0x01ff); writew(®s->error_irq_status, readw(®s->error_irq_status)); writeb(®s->timeout_control, 0x0e); // Set to max timeout int volt = sdcard_set_power(regs);
The block_size field is 16bits and only 16bit writes should be used with it.
Signed-off-by: Kevin O'Connor kevin@koconnor.net --- src/hw/sdcard.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/hw/sdcard.c b/src/hw/sdcard.c index 0617d24..e01e1bb 100644 --- a/src/hw/sdcard.c +++ b/src/hw/sdcard.c @@ -224,7 +224,7 @@ sdcard_pio_transfer(struct sddrive_s *drive, int cmd, u32 addr , void *data, int count) { // Send command - writel(&drive->regs->block_size, DISK_SECTOR_SIZE); + writew(&drive->regs->block_size, DISK_SECTOR_SIZE); writew(&drive->regs->block_count, count); int isread = cmd != SC_WRITE_SINGLE && cmd != SC_WRITE_MULTIPLE; u16 tmode = ((count > 1 ? ST_MULTIPLE|ST_AUTO_CMD12|ST_BLOCKCOUNT : 0)
On a timeout, report what register failed to update.
Signed-off-by: Kevin O'Connor kevin@koconnor.net --- src/hw/sdcard.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/src/hw/sdcard.c b/src/hw/sdcard.c index e01e1bb..db3bbe1 100644 --- a/src/hw/sdcard.c +++ b/src/hw/sdcard.c @@ -154,6 +154,7 @@ sdcard_waitw(u16 *reg, u16 mask) if (v & mask) return v; if (timer_check(end)) { + dprintf(1, "scard_waitw: %p %x %x\n", reg, mask, v); warn_timeout(); return -1; }
On Tue, Nov 17, 2015 at 02:58:29PM -0500, Kevin O'Connor wrote:
The SDHCI v1 spec only defines the first 9 error_irq_enable bits and reserves other bits in the field. Don't enable the 10th bit (which was defined in the v2 spec) as it's not needed anyway.
FYI, I committed this series.
-Kevin