diff options
author | Richard Zhu <r65037@freescale.com> | 2013-02-05 14:11:08 +0800 |
---|---|---|
committer | Richard Zhu <r65037@freescale.com> | 2013-02-05 15:12:17 +0800 |
commit | 3470c22143fa8a8ed4b9a6d0d5b02cdad36f782d (patch) | |
tree | 3d8a5bd379ac7f53d69cce506f8856ce8f257eef /arch/arm/mach-mx6/board-mx6q_sabrelite.c | |
parent | c1e3dbbcf7a886d2c5c6f1ccb184659a9fa6c832 (diff) |
ENGR00243339 imx: sata: disable sata phy when sata is not enabled
In order to save power consumption, disable sata phy
(enable PDDQ mode) in kernel level, if the sata module
is not enabled in kernel configuration.
Signed-off-by: Richard Zhu <r65037@freescale.com>
Diffstat (limited to 'arch/arm/mach-mx6/board-mx6q_sabrelite.c')
-rw-r--r-- | arch/arm/mach-mx6/board-mx6q_sabrelite.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/arch/arm/mach-mx6/board-mx6q_sabrelite.c b/arch/arm/mach-mx6/board-mx6q_sabrelite.c index 736b4231d341..ac4b3394be77 100644 --- a/arch/arm/mach-mx6/board-mx6q_sabrelite.c +++ b/arch/arm/mach-mx6/board-mx6q_sabrelite.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011-2012 Freescale Semiconductor, Inc. All Rights Reserved. + * Copyright (C) 2011-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 @@ -721,11 +721,22 @@ static int mx6q_sabrelite_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); @@ -733,6 +744,7 @@ put_sata_clk: return ret; } +#ifdef CONFIG_SATA_AHCI_PLATFORM static void mx6q_sabrelite_sata_exit(struct device *dev) { clk_disable(sata_clk); @@ -743,6 +755,7 @@ static struct ahci_platform_data mx6q_sabrelite_sata_data = { .init = mx6q_sabrelite_sata_init, .exit = mx6q_sabrelite_sata_exit, }; +#endif static struct gpio mx6q_sabrelite_flexcan_gpios[] = { { MX6Q_SABRELITE_CAN1_EN, GPIOF_OUT_INIT_LOW, "flexcan1-en" }, @@ -1191,7 +1204,15 @@ static void __init mx6_sabrelite_board_init(void) imx6q_add_sdhci_usdhc_imx(2, &mx6q_sabrelite_sd3_data); imx_add_viv_gpu(&imx6_gpu_data, &imx6q_gpu_pdata); imx6q_sabrelite_init_usb(); - imx6q_add_ahci(0, &mx6q_sabrelite_sata_data); + + if (cpu_is_mx6q()) { +#ifdef CONFIG_SATA_AHCI_PLATFORM + imx6q_add_ahci(0, &mx6q_sabrelite_sata_data); +#else + mx6q_sabrelite_sata_init(NULL, + (void __iomem *)ioremap(MX6Q_SATA_BASE_ADDR, SZ_4K)); +#endif + } imx6q_add_vpu(); imx6q_init_audio(); platform_device_register(&sabrelite_vmmc_reg_devices); |