]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ENGR00163510 MX6Q: AHCI: One brand 1T HDD can't pwr up properly
authorRichard Zhu <r65037@freescale.com>
Wed, 30 Nov 2011 07:28:52 +0000 (15:28 +0800)
committerLothar Waßmann <LW@KARO-electronics.de>
Fri, 24 May 2013 06:33:32 +0000 (08:33 +0200)
More time is required by one brand 1T HDD,
change the delay mechanism to fix it.

Signed-off-by: Richard Zhu <r65037@freescale.com>
arch/arm/mach-mx6/board-mx6q_arm2.c

index 8adf623e74eb903941eb631d90f62f8a3c2035ca..c80699995b217295f8086ca13075f4dc4b77d7b4 100644 (file)
@@ -816,7 +816,7 @@ static struct viv_gpu_platform_data imx6q_gpu_pdata __initdata = {
 static int mx6q_arm2_sata_init(struct device *dev, void __iomem *addr)
 {
        u32 tmpdata;
-       int ret = 0;
+       int ret = 0, iterations = 20;
        struct clk *clk;
 
        /* Enable SATA PWR CTRL_0 of MAX7310 */
@@ -868,12 +868,18 @@ static int mx6q_arm2_sata_init(struct device *dev, void __iomem *addr)
        sata_init(addr, tmpdata);
 
        /* Release resources when there is no device on the port */
-       msleep(200);
-       if ((readl(addr + PORT_SATA_SR) & 0xF) == 0) {
-               dev_info(dev, "NO sata disk.\n");
-               ret = -ENODEV;
-               goto release_sata_clk;
-       }
+       do {
+               if ((readl(addr + PORT_SATA_SR) & 0xF) == 0)
+                       msleep(25);
+               else
+                       break;
+
+               if (iterations == 0) {
+                       dev_info(dev, "NO sata disk.\n");
+                       ret = -ENODEV;
+                       goto release_sata_clk;
+               }
+       } while (iterations-- > 0);
 
        return ret;