On Thu, Oct 26, 2017 at 11:26 AM, Kevin O'Connor <kevin@koconnor.net> wrote:
On Thu, Oct 26, 2017 at 11:14:53AM -0400, Matt DeVillier wrote:
> On Thu, Oct 26, 2017 at 10:59 AM, Kevin O'Connor <kevin@koconnor.net> wrote:
>
> with the patch, USB devices are not available from the boot menu either (it
> appears to hang?), and therefore device cannot be booted to get said log

That sounds like a bad compile then - nothing in the patch should have
impacted usb.

In any case, the patch below tests the same thing and it should work
on eMMC also.

-Kevin


--- a/src/hw/sdcard.c
+++ b/src/hw/sdcard.c
@@ -404,19 +404,8 @@ sdcard_card_setup(struct sddrive_s *drive, int volt, int prio)
     ret = sdcard_pio(regs, SC_SEND_IF_COND, param);
     if (!ret && param[0] == vrange)
         hcs = (1<<30);
-    // Verify SD card (instead of MMC or SDIO)
-    param[0] = 0x00;
-    ret = sdcard_pio_app(regs, SC_APP_SEND_OP_COND, param);
-    if (ret) {
-        // Check for MMC card
-        param[0] = 0x00;
-        ret = sdcard_pio(regs, SC_SEND_OP_COND, param);
-        if (ret)
-            return ret;
-        drive->card_type |= SF_MMC;
-        hcs = (1<<30);
-    }
     // Init card
+    int firstloop = 1;
     u32 end = timer_calc(SDHCI_POWERUP_TIMEOUT);
     for (;;) {
         param[0] = hcs | volt; // high-capacity support and voltage level
@@ -424,8 +413,18 @@ sdcard_card_setup(struct sddrive_s *drive, int volt, int prio)
             ret = sdcard_pio(regs, SC_SEND_OP_COND, param);
         else
             ret = sdcard_pio_app(regs, SC_APP_SEND_OP_COND, param);
-        if (ret)
+        if (ret) {
+            if (firstloop) {
+                // Check for MMC card
+                firstloop = 0;
+                drive->card_type |= SF_MMC;
+                hcs = (1<<30);
+                end = timer_calc(SDHCI_POWERUP_TIMEOUT);
+                continue;
+            }
             return ret;
+        }
+        firstloop = 0;
         if (param[0] & SR_OCR_NOTBUSY)
             break;
         if (timer_check(end)) {

still timing out on detection: https://paste.ubuntu.com/25826387/