Re: [PATCH] ahci: retry enabling AHCI a few times before spitting out WARN_ON()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

patch -p1 <  ../ahci.patch
patching file drivers/ata/ahci.c
Hunk #1 FAILED at 556.
1 out of 1 hunk FAILED -- saving rejects to file drivers/ata/ahci.c.rej

cat drivers/ata/ahci.c.rej
***************
*** 556,571 ****

  static void ahci_enable_ahci(void __iomem *mmio)
  {
         u32 tmp;

         /* turn on AHCI_EN */
         tmp = readl(mmio + HOST_CTL);
-        if (!(tmp & HOST_AHCI_EN)) {
                 tmp |= HOST_AHCI_EN;
                 writel(tmp, mmio + HOST_CTL);
                 tmp = readl(mmio + HOST_CTL);   /* flush && sanity check */
-                WARN_ON(!(tmp & HOST_AHCI_EN));
         }
  }

  /**
--- 556,582 ----

  static void ahci_enable_ahci(void __iomem *mmio)
  {
+        int i;
         u32 tmp;

         /* turn on AHCI_EN */
         tmp = readl(mmio + HOST_CTL);
+        if (tmp & HOST_AHCI_EN)
+                return;
+
+        /* Some controllers need AHCI_EN to be written multiple times.
+         * Try a few times before giving up.
+         */
+        for (i = 0; i < 5; i++) {
                 tmp |= HOST_AHCI_EN;
                 writel(tmp, mmio + HOST_CTL);
                 tmp = readl(mmio + HOST_CTL);   /* flush && sanity check */
+                if (tmp & HOST_AHCI_EN)
+                        return;
+                msleep(10);
         }
+
+        WARN_ON(1);
  }

  /**


with 2.6.25+reiser4.
--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux