]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - arch/arm/mach-mx6/board-mx6q_sabresd.c
ENGR00243339 imx: sata: disable sata phy when sata is not enabled
[karo-tx-linux.git] / arch / arm / mach-mx6 / board-mx6q_sabresd.c
index 69afc3576522c6604eaf6057441e9e90d5e1fcab..986d291cf5dad284837af0263a0c16056a9619f0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012 Freescale Semiconductor, Inc. All Rights Reserved.
+ * Copyright (C) 2012-2013 Freescale Semiconductor, Inc. All Rights Reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -1165,11 +1165,22 @@ static int mx6q_sabresd_sata_init(struct device *dev, void __iomem *addr)
        tmpdata = clk_get_rate(clk) / 1000;
        clk_put(clk);
 
+#ifdef CONFIG_SATA_AHCI_PLATFORM
        ret = sata_init(addr, tmpdata);
        if (ret == 0)
                return ret;
+#else
+       usleep_range(1000, 2000);
+       /* AHCI PHY enter into PDDQ mode if the AHCI module is not enabled */
+       tmpdata = readl(addr + PORT_PHY_CTL);
+       writel(tmpdata | PORT_PHY_CTL_PDDQ_LOC, addr + PORT_PHY_CTL);
+       pr_info("No AHCI save PWR: PDDQ %s\n", ((readl(addr + PORT_PHY_CTL)
+                                       >> 20) & 1) ? "enabled" : "disabled");
+#endif
 
 release_sata_clk:
+       /* disable SATA_PHY PLL */
+       writel((readl(IOMUXC_GPR13) & ~0x2), IOMUXC_GPR13);
        clk_disable(sata_clk);
 put_sata_clk:
        clk_put(sata_clk);
@@ -1177,6 +1188,7 @@ put_sata_clk:
        return ret;
 }
 
+#ifdef CONFIG_SATA_AHCI_PLATFORM
 static void mx6q_sabresd_sata_exit(struct device *dev)
 {
        clk_disable(sata_clk);
@@ -1187,6 +1199,7 @@ static struct ahci_platform_data mx6q_sabresd_sata_data = {
        .init = mx6q_sabresd_sata_init,
        .exit = mx6q_sabresd_sata_exit,
 };
+#endif
 
 static void mx6q_sabresd_flexcan0_switch(int enable)
 {
@@ -1776,8 +1789,14 @@ static void __init mx6_sabresd_board_init(void)
        imx_add_viv_gpu(&imx6_gpu_data, &imx6q_gpu_pdata);
        imx6q_sabresd_init_usb();
        /* SATA is not supported by MX6DL/Solo */
-       if (cpu_is_mx6q())
+       if (cpu_is_mx6q()) {
+#ifdef CONFIG_SATA_AHCI_PLATFORM
                imx6q_add_ahci(0, &mx6q_sabresd_sata_data);
+#else
+               mx6q_sabresd_sata_init(NULL,
+                       (void __iomem *)ioremap(MX6Q_SATA_BASE_ADDR, SZ_4K));
+#endif
+       }
        imx6q_add_vpu();
        imx6q_init_audio();
        platform_device_register(&sabresd_vmmc_reg_devices);