SAMA5: A few early, easy bug fixes. The rest will all be difficult

This commit is contained in:
Gregory Nutt 2013-08-06 11:29:53 -06:00
parent b28e8c5dda
commit d1477f9811

View File

@ -136,10 +136,10 @@
struct sam_hsmci_info_s struct sam_hsmci_info_s
{ {
pio_pinset_t pincfg; pio_pinset_t pincfg; /* Card detect PIO pin configuratin */
uint8_t irq; uint8_t irq; /* Interrupt number (same as pid) */
xcpt_t handler; xcpt_t handler; /* Interrupt handler */
struct sdio_dev_s **hsmci; struct sdio_dev_s **hsmci; /* R/W device handle */
}; };
/**************************************************************************** /****************************************************************************
@ -264,9 +264,9 @@ int sam_hsmci_initialize(int slotno, int minor)
/* Get the HSMI description */ /* Get the HSMI description */
info = sam_hsmci_info(slotno); info = sam_hsmci_info(slotno);
if (info) if (!info)
{ {
fdbg("No info for slotno &d\n", slotno); fdbg("No info for slotno %d\n", slotno);
return -EINVAL; return -EINVAL;
} }
@ -325,16 +325,16 @@ bool sam_cardinserted(int slotno)
/* Get the HSMI description */ /* Get the HSMI description */
info = sam_hsmci_info(slotno); info = sam_hsmci_info(slotno);
if (info) if (!info)
{ {
fdbg("No info for slotno &d\n", slotno); fdbg("No info for slotno %d\n", slotno);
return false; return false;
} }
/* Get the state of the PIO pin */ /* Get the state of the PIO pin */
inserted = sam_pioread(PIO_MCI0_CD); inserted = sam_pioread(info->pincfg);
fvdbg("Slot 0 inserted: %s\n", slotno, inserted ? "NO" : "YES"); fvdbg("Slot %d inserted: %s\n", slotno, inserted ? "NO" : "YES");
return !inserted; return !inserted;
#else /* HAVE_MMCSD */ #else /* HAVE_MMCSD */