Commit f0a7b7e38004b974d98af7b50ffa62afbe613bd3

Authored by Richard Zhu
1 parent fd48f6bfa2
Exists in imx_3.0.35_4.1.0

ENGR00291110 sata: can not link up after suspend resume

issue:
sata phy link down after suspend resume on imx6q TO1.3.
solution:
sata phy ref clock should be gated off/on in suspend/resume

Signed-off-by: Richard Zhu <r65037@freescale.com>

Showing 4 changed files with 92 additions and 0 deletions Side-by-side Diff

arch/arm/mach-mx6/board-mx6q_arm2.c
... ... @@ -1357,9 +1357,32 @@
1357 1357  
1358 1358 }
1359 1359  
  1360 +static int imx_ahci_suspend(struct device *dev)
  1361 +{
  1362 + writel((readl(IOMUXC_GPR13) & ~0x2), IOMUXC_GPR13);
  1363 + clk_disable(sata_clk);
  1364 +
  1365 + return 0;
  1366 +}
  1367 +
  1368 +static int imx_ahci_resume(struct device *dev)
  1369 +{
  1370 + int ret;
  1371 +
  1372 + ret = clk_enable(sata_clk);
  1373 + if (ret)
  1374 + dev_err(dev, "can't enable sata clock.\n");
  1375 +
  1376 + writel(((readl(IOMUXC_GPR13) & ~0x2) | 0x2), IOMUXC_GPR13);
  1377 +
  1378 + return 0;
  1379 +}
  1380 +
1360 1381 static struct ahci_platform_data mx6_arm2_sata_data = {
1361 1382 .init = mx6_arm2_sata_init,
1362 1383 .exit = mx6_arm2_sata_exit,
  1384 + .suspend = imx_ahci_suspend,
  1385 + .resume = imx_ahci_resume,
1363 1386 };
1364 1387 #endif
1365 1388  
arch/arm/mach-mx6/board-mx6q_sabreauto.c
... ... @@ -953,9 +953,32 @@
953 953  
954 954 }
955 955  
  956 +static int imx_ahci_suspend(struct device *dev)
  957 +{
  958 + writel((readl(IOMUXC_GPR13) & ~0x2), IOMUXC_GPR13);
  959 + clk_disable(sata_clk);
  960 +
  961 + return 0;
  962 +}
  963 +
  964 +static int imx_ahci_resume(struct device *dev)
  965 +{
  966 + int ret;
  967 +
  968 + ret = clk_enable(sata_clk);
  969 + if (ret)
  970 + dev_err(dev, "can't enable sata clock.\n");
  971 +
  972 + writel(((readl(IOMUXC_GPR13) & ~0x2) | 0x2), IOMUXC_GPR13);
  973 +
  974 + return 0;
  975 +}
  976 +
956 977 static struct ahci_platform_data mx6q_sabreauto_sata_data = {
957 978 .init = mx6q_sabreauto_sata_init,
958 979 .exit = mx6q_sabreauto_sata_exit,
  980 + .suspend = imx_ahci_suspend,
  981 + .resume = imx_ahci_resume,
959 982 };
960 983 #endif
961 984  
arch/arm/mach-mx6/board-mx6q_sabrelite.c
... ... @@ -757,9 +757,32 @@
757 757 clk_put(sata_clk);
758 758 }
759 759  
  760 +static int imx_ahci_suspend(struct device *dev)
  761 +{
  762 + writel((readl(IOMUXC_GPR13) & ~0x2), IOMUXC_GPR13);
  763 + clk_disable(sata_clk);
  764 +
  765 + return 0;
  766 +}
  767 +
  768 +static int imx_ahci_resume(struct device *dev)
  769 +{
  770 + int ret;
  771 +
  772 + ret = clk_enable(sata_clk);
  773 + if (ret)
  774 + dev_err(dev, "can't enable sata clock.\n");
  775 +
  776 + writel(((readl(IOMUXC_GPR13) & ~0x2) | 0x2), IOMUXC_GPR13);
  777 +
  778 + return 0;
  779 +}
  780 +
760 781 static struct ahci_platform_data mx6q_sabrelite_sata_data = {
761 782 .init = mx6q_sabrelite_sata_init,
762 783 .exit = mx6q_sabrelite_sata_exit,
  784 + .suspend = imx_ahci_suspend,
  785 + .resume = imx_ahci_resume,
763 786 };
764 787 #endif
765 788  
arch/arm/mach-mx6/board-mx6q_sabresd.c
... ... @@ -1220,9 +1220,32 @@
1220 1220 clk_put(sata_clk);
1221 1221 }
1222 1222  
  1223 +static int imx_ahci_suspend(struct device *dev)
  1224 +{
  1225 + writel((readl(IOMUXC_GPR13) & ~0x2), IOMUXC_GPR13);
  1226 + clk_disable(sata_clk);
  1227 +
  1228 + return 0;
  1229 +}
  1230 +
  1231 +static int imx_ahci_resume(struct device *dev)
  1232 +{
  1233 + int ret;
  1234 +
  1235 + ret = clk_enable(sata_clk);
  1236 + if (ret)
  1237 + dev_err(dev, "can't enable sata clock.\n");
  1238 +
  1239 + writel(((readl(IOMUXC_GPR13) & ~0x2) | 0x2), IOMUXC_GPR13);
  1240 +
  1241 + return 0;
  1242 +}
  1243 +
1223 1244 static struct ahci_platform_data mx6q_sabresd_sata_data = {
1224 1245 .init = mx6q_sabresd_sata_init,
1225 1246 .exit = mx6q_sabresd_sata_exit,
  1247 + .suspend = imx_ahci_suspend,
  1248 + .resume = imx_ahci_resume,
1226 1249 };
1227 1250 #endif
1228 1251