* [PATCH v5 0/4] ata: ahci_platform: Add PHY support and OMAP support
@ 2014-01-20 14:41 Roger Quadros
2014-01-20 14:41 ` [PATCH v5 1/4] ata: ahci_platform: Add DT compatible for Synopsis DWC AHCI controller Roger Quadros
` (4 more replies)
0 siblings, 5 replies; 12+ messages in thread
From: Roger Quadros @ 2014-01-20 14:41 UTC (permalink / raw)
To: tj-DgEjT+Ai2ygdnm+yROfE0A
Cc: sergei.shtylyov-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8,
kishon-l0cyMroinI0, b.zolnierkie-Sze3O3UU22JBDgjK7y7TUQ,
hdegoede-H+wXaHxf7aLQT0dZR+AlfA, arnd-r2nGTMty4D4,
linux-ide-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA, Roger Quadros
Hi,
Some platforms have a PHY hooked up to the SATA controller.
The PHY needs to be initialized and powered up for SATA to work.
We do that using the Generic PHY framework in PATCH 3.
In order to support SATA on the OMAP platforms we need to runtime
resume the device before use. PATCH 4 takes care of that.
PATCH 1 & 2 updates the DT compatible list.
Changelog:
v5:
- Don't use break after goto in switch case. Rebased on v3.13
v4:
- Tackle error conditions while using PHY framework APIs.
v3:
- Addressed review comments and rebased on 3.13-rc7
- DT binding update moved to new patch.
v2:
- got rid of Texas Instruments SATA wrapper driver
- adressed review comments
cheers,
-roger
---
Balaji T K (1):
ata: ahci_platform: Manage SATA PHY
Roger Quadros (3):
ata: ahci_platform: Add DT compatible for Synopsis DWC AHCI controller
ata: ahci_platform: Update DT compatible list
ata: ahci_platform: runtime resume the device before use
.../devicetree/bindings/ata/ahci-platform.txt | 4 +-
drivers/ata/ahci.h | 2 +
drivers/ata/ahci_platform.c | 57 +++++++++++++++++++++-
3 files changed, 61 insertions(+), 2 deletions(-)
--
1.8.3.2
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 12+ messages in thread* [PATCH v5 1/4] ata: ahci_platform: Add DT compatible for Synopsis DWC AHCI controller 2014-01-20 14:41 [PATCH v5 0/4] ata: ahci_platform: Add PHY support and OMAP support Roger Quadros @ 2014-01-20 14:41 ` Roger Quadros 2014-01-20 14:41 ` [PATCH v5 2/4] ata: ahci_platform: Update DT compatible list Roger Quadros ` (3 subsequent siblings) 4 siblings, 0 replies; 12+ messages in thread From: Roger Quadros @ 2014-01-20 14:41 UTC (permalink / raw) To: tj Cc: sergei.shtylyov, kishon, b.zolnierkie, hdegoede, arnd, linux-ide, linux-kernel, devicetree, Roger Quadros Add compatible string "snps,dwc-ahci", which should be used for Synopsis Designware SATA cores. e.g. on TI OMAP5 and DRA7 platforms. Signed-off-by: Roger Quadros <rogerq@ti.com> Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> --- drivers/ata/ahci_platform.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c index 4b231ba..d5ced13 100644 --- a/drivers/ata/ahci_platform.c +++ b/drivers/ata/ahci_platform.c @@ -330,6 +330,7 @@ static const struct of_device_id ahci_of_match[] = { { .compatible = "snps,spear-ahci", }, { .compatible = "snps,exynos5440-ahci", }, { .compatible = "ibm,476gtr-ahci", }, + { .compatible = "snps,dwc-ahci", }, {}, }; MODULE_DEVICE_TABLE(of, ahci_of_match); -- 1.8.3.2 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v5 2/4] ata: ahci_platform: Update DT compatible list 2014-01-20 14:41 [PATCH v5 0/4] ata: ahci_platform: Add PHY support and OMAP support Roger Quadros 2014-01-20 14:41 ` [PATCH v5 1/4] ata: ahci_platform: Add DT compatible for Synopsis DWC AHCI controller Roger Quadros @ 2014-01-20 14:41 ` Roger Quadros 2014-01-20 14:51 ` Rob Herring 2014-01-20 14:41 ` [PATCH v5 3/4] ata: ahci_platform: Manage SATA PHY Roger Quadros ` (2 subsequent siblings) 4 siblings, 1 reply; 12+ messages in thread From: Roger Quadros @ 2014-01-20 14:41 UTC (permalink / raw) To: tj Cc: sergei.shtylyov, kishon, b.zolnierkie, hdegoede, arnd, linux-ide, linux-kernel, devicetree, Roger Quadros The ahci_platform driver supports "snps,exynos5440-ahci", "ibm,476gtr-ahci" and "snps,dwc-ahci". Add this to the DT binding information. Signed-off-by: Roger Quadros <rogerq@ti.com> Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> --- Documentation/devicetree/bindings/ata/ahci-platform.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/ata/ahci-platform.txt b/Documentation/devicetree/bindings/ata/ahci-platform.txt index 89de156..08ba647 100644 --- a/Documentation/devicetree/bindings/ata/ahci-platform.txt +++ b/Documentation/devicetree/bindings/ata/ahci-platform.txt @@ -4,7 +4,9 @@ SATA nodes are defined to describe on-chip Serial ATA controllers. Each SATA controller should have its own node. Required properties: -- compatible : compatible list, contains "snps,spear-ahci" +- compatible : compatible list, contains "snps,spear-ahci", + "snps,exynos5440-ahci", "ibm,476gtr-ahci", + or "snps,dwc-ahci" - interrupts : <interrupt mapping for SATA IRQ> - reg : <registers mapping> -- 1.8.3.2 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH v5 2/4] ata: ahci_platform: Update DT compatible list 2014-01-20 14:41 ` [PATCH v5 2/4] ata: ahci_platform: Update DT compatible list Roger Quadros @ 2014-01-20 14:51 ` Rob Herring 0 siblings, 0 replies; 12+ messages in thread From: Rob Herring @ 2014-01-20 14:51 UTC (permalink / raw) To: Roger Quadros Cc: Tejun Heo, Sergei Shtylyov, Kishon Vijay Abraham I, b.zolnierkie, hdegoede, Arnd Bergmann, linux-ide, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org On Mon, Jan 20, 2014 at 8:41 AM, Roger Quadros <rogerq@ti.com> wrote: > The ahci_platform driver supports "snps,exynos5440-ahci", "ibm,476gtr-ahci" > and "snps,dwc-ahci". Add this to the DT binding information. > > Signed-off-by: Roger Quadros <rogerq@ti.com> > Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Acked-by: Rob Herring <robh@kernel.org> > --- > Documentation/devicetree/bindings/ata/ahci-platform.txt | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/Documentation/devicetree/bindings/ata/ahci-platform.txt b/Documentation/devicetree/bindings/ata/ahci-platform.txt > index 89de156..08ba647 100644 > --- a/Documentation/devicetree/bindings/ata/ahci-platform.txt > +++ b/Documentation/devicetree/bindings/ata/ahci-platform.txt > @@ -4,7 +4,9 @@ SATA nodes are defined to describe on-chip Serial ATA controllers. > Each SATA controller should have its own node. > > Required properties: > -- compatible : compatible list, contains "snps,spear-ahci" > +- compatible : compatible list, contains "snps,spear-ahci", > + "snps,exynos5440-ahci", "ibm,476gtr-ahci", > + or "snps,dwc-ahci" > - interrupts : <interrupt mapping for SATA IRQ> > - reg : <registers mapping> > > -- > 1.8.3.2 > > -- > To unsubscribe from this list: send the line "unsubscribe devicetree" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v5 3/4] ata: ahci_platform: Manage SATA PHY 2014-01-20 14:41 [PATCH v5 0/4] ata: ahci_platform: Add PHY support and OMAP support Roger Quadros 2014-01-20 14:41 ` [PATCH v5 1/4] ata: ahci_platform: Add DT compatible for Synopsis DWC AHCI controller Roger Quadros 2014-01-20 14:41 ` [PATCH v5 2/4] ata: ahci_platform: Update DT compatible list Roger Quadros @ 2014-01-20 14:41 ` Roger Quadros 2014-01-20 14:41 ` [PATCH v5 4/4] ata: ahci_platform: runtime resume the device before use Roger Quadros 2014-01-20 16:48 ` [PATCH v5 0/4] ata: ahci_platform: Add PHY support and OMAP support Hans de Goede 4 siblings, 0 replies; 12+ messages in thread From: Roger Quadros @ 2014-01-20 14:41 UTC (permalink / raw) To: tj Cc: sergei.shtylyov, kishon, b.zolnierkie, hdegoede, arnd, linux-ide, linux-kernel, devicetree, Balaji T K, Roger Quadros From: Balaji T K <balajitk@ti.com> Some platforms have a PHY hooked up to the SATA controller. The PHY needs to be initialized and powered up for SATA to work. We do that using the PHY framework. [Roger Q] Cleaned up. Signed-off-by: Balaji T K <balajitk@ti.com> Signed-off-by: Roger Quadros <rogerq@ti.com> Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Acked-by: Kishon Vijay Abraham I <kishon@ti.com> --- drivers/ata/ahci.h | 2 ++ drivers/ata/ahci_platform.c | 44 +++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/drivers/ata/ahci.h b/drivers/ata/ahci.h index 2289efd..f9bbada 100644 --- a/drivers/ata/ahci.h +++ b/drivers/ata/ahci.h @@ -37,6 +37,7 @@ #include <linux/clk.h> #include <linux/libata.h> +#include <linux/phy/phy.h> /* Enclosure Management Control */ #define EM_CTRL_MSG_TYPE 0x000f0000 @@ -322,6 +323,7 @@ struct ahci_host_priv { u32 em_buf_sz; /* EM buffer size in byte */ u32 em_msg_type; /* EM message type */ struct clk *clk; /* Only for platforms supporting clk */ + struct phy *phy; /* If platform uses phy */ void *plat_data; /* Other platform data */ }; diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c index d5ced13..580567f 100644 --- a/drivers/ata/ahci_platform.c +++ b/drivers/ata/ahci_platform.c @@ -142,6 +142,37 @@ static int ahci_probe(struct platform_device *pdev) } } + hpriv->phy = devm_phy_get(dev, "sata-phy"); + if (IS_ERR(hpriv->phy)) { + rc = PTR_ERR(hpriv->phy); + switch (rc) { + case -ENODEV: + case -ENOSYS: + /* continue normally */ + hpriv->phy = NULL; + break; + + case -EPROBE_DEFER: + goto disable_unprepare_clk; + + default: + dev_err(dev, "couldn't get sata-phy\n"); + goto disable_unprepare_clk; + } + } + + if (hpriv->phy) { + rc = phy_init(hpriv->phy); + if (rc) + goto disable_unprepare_clk; + + rc = phy_power_on(hpriv->phy); + if (rc) { + phy_exit(hpriv->phy); + goto disable_unprepare_clk; + } + } + /* * Some platforms might need to prepare for mmio region access, * which could be done in the following init call. So, the mmio @@ -151,7 +182,7 @@ static int ahci_probe(struct platform_device *pdev) if (pdata && pdata->init) { rc = pdata->init(dev, hpriv->mmio); if (rc) - goto disable_unprepare_clk; + goto disable_phy; } ahci_save_initial_config(dev, hpriv, @@ -221,6 +252,12 @@ static int ahci_probe(struct platform_device *pdev) pdata_exit: if (pdata && pdata->exit) pdata->exit(dev); +disable_phy: + if (hpriv->phy) { + phy_power_off(hpriv->phy); + phy_exit(hpriv->phy); + } + disable_unprepare_clk: if (!IS_ERR(hpriv->clk)) clk_disable_unprepare(hpriv->clk); @@ -239,6 +276,11 @@ static void ahci_host_stop(struct ata_host *host) if (pdata && pdata->exit) pdata->exit(dev); + if (hpriv->phy) { + phy_power_off(hpriv->phy); + phy_exit(hpriv->phy); + } + if (!IS_ERR(hpriv->clk)) { clk_disable_unprepare(hpriv->clk); clk_put(hpriv->clk); -- 1.8.3.2 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v5 4/4] ata: ahci_platform: runtime resume the device before use 2014-01-20 14:41 [PATCH v5 0/4] ata: ahci_platform: Add PHY support and OMAP support Roger Quadros ` (2 preceding siblings ...) 2014-01-20 14:41 ` [PATCH v5 3/4] ata: ahci_platform: Manage SATA PHY Roger Quadros @ 2014-01-20 14:41 ` Roger Quadros 2014-01-20 16:48 ` [PATCH v5 0/4] ata: ahci_platform: Add PHY support and OMAP support Hans de Goede 4 siblings, 0 replies; 12+ messages in thread From: Roger Quadros @ 2014-01-20 14:41 UTC (permalink / raw) To: tj Cc: sergei.shtylyov, kishon, b.zolnierkie, hdegoede, arnd, linux-ide, linux-kernel, devicetree, Roger Quadros, Balaji T K On OMAP platforms the device needs to be runtime resumed before it can be accessed. The OMAP HWMOD framework takes care of enabling the module and its resources based on the device's runtime PM state. In this patch we runtime resume during .probe() and runtime suspend during .remove() (i.e. ahci_host_stop()). We also update the runtime PM state during .resume(). Signed-off-by: Roger Quadros <rogerq@ti.com> Signed-off-by: Balaji T K <balajitk@ti.com> Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> --- drivers/ata/ahci_platform.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c index 580567f..b3a48bb 100644 --- a/drivers/ata/ahci_platform.c +++ b/drivers/ata/ahci_platform.c @@ -23,6 +23,7 @@ #include <linux/platform_device.h> #include <linux/libata.h> #include <linux/ahci_platform.h> +#include <linux/pm_runtime.h> #include "ahci.h" static void ahci_host_stop(struct ata_host *host); @@ -142,6 +143,9 @@ static int ahci_probe(struct platform_device *pdev) } } + pm_runtime_enable(dev); + pm_runtime_get_sync(dev); + hpriv->phy = devm_phy_get(dev, "sata-phy"); if (IS_ERR(hpriv->phy)) { rc = PTR_ERR(hpriv->phy); @@ -285,6 +289,9 @@ static void ahci_host_stop(struct ata_host *host) clk_disable_unprepare(hpriv->clk); clk_put(hpriv->clk); } + + pm_runtime_put_sync(dev); + pm_runtime_disable(dev); } #ifdef CONFIG_PM_SLEEP @@ -356,6 +363,11 @@ static int ahci_resume(struct device *dev) ata_host_resume(host); + /* We resumed so update PM runtime state */ + pm_runtime_disable(dev); + pm_runtime_set_active(dev); + pm_runtime_enable(dev); + return 0; disable_unprepare_clk: -- 1.8.3.2 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH v5 0/4] ata: ahci_platform: Add PHY support and OMAP support 2014-01-20 14:41 [PATCH v5 0/4] ata: ahci_platform: Add PHY support and OMAP support Roger Quadros ` (3 preceding siblings ...) 2014-01-20 14:41 ` [PATCH v5 4/4] ata: ahci_platform: runtime resume the device before use Roger Quadros @ 2014-01-20 16:48 ` Hans de Goede [not found] ` <52DD5368.5020301-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> 4 siblings, 1 reply; 12+ messages in thread From: Hans de Goede @ 2014-01-20 16:48 UTC (permalink / raw) To: Roger Quadros, tj Cc: sergei.shtylyov, kishon, b.zolnierkie, arnd, linux-ide, linux-kernel, devicetree Hi, On 01/20/2014 03:41 PM, Roger Quadros wrote: > Hi, > > Some platforms have a PHY hooked up to the SATA controller. > The PHY needs to be initialized and powered up for SATA to work. > We do that using the Generic PHY framework in PATCH 3. > > In order to support SATA on the OMAP platforms we need to runtime > resume the device before use. PATCH 4 takes care of that. Thanks for keeping me in the loop on this. I'm afraid this conflicts quite a bit with my recent ahci_platform.c work, not a big problem really, the series can go in either way. Your phy support will slot nicely into the new ahci_platform_get_resources and ahci_platform_enable_resources functions my refactoring introduces, looking at it from this pov it might be better / easier to rebase your series on top of the v4 of my series I've just send. Which brings me to one comment about your series why are you not doing phy_exit and phy_init on suspend resp. resume ? The phy can use quite a bit of power, if the phy init / exit end up in ahci_platform_enable_resources / ahci_platform_disable_resources, this will happen automatically for better or worse. So it would be good to test if this would work or not ... Thanks & Regards, Hans ^ permalink raw reply [flat|nested] 12+ messages in thread
[parent not found: <52DD5368.5020301-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>]
* Re: [PATCH v5 0/4] ata: ahci_platform: Add PHY support and OMAP support [not found] ` <52DD5368.5020301-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> @ 2014-01-21 8:34 ` Roger Quadros [not found] ` <52DE3132.3000007-l0cyMroinI0@public.gmane.org> 0 siblings, 1 reply; 12+ messages in thread From: Roger Quadros @ 2014-01-21 8:34 UTC (permalink / raw) To: Hans de Goede, tj-DgEjT+Ai2ygdnm+yROfE0A, kishon-l0cyMroinI0 Cc: sergei.shtylyov-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8, b.zolnierkie-Sze3O3UU22JBDgjK7y7TUQ, arnd-r2nGTMty4D4, linux-ide-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA On 01/20/2014 06:48 PM, Hans de Goede wrote: > Hi, > > On 01/20/2014 03:41 PM, Roger Quadros wrote: >> Hi, >> >> Some platforms have a PHY hooked up to the SATA controller. >> The PHY needs to be initialized and powered up for SATA to work. >> We do that using the Generic PHY framework in PATCH 3. >> >> In order to support SATA on the OMAP platforms we need to runtime >> resume the device before use. PATCH 4 takes care of that. > > Thanks for keeping me in the loop on this. I'm afraid this conflicts > quite a bit with my recent ahci_platform.c work, not a big problem > really, the series can go in either way. > > Your phy support will slot nicely into the new ahci_platform_get_resources > and ahci_platform_enable_resources functions my refactoring introduces, > looking at it from this pov it might be better / easier to rebase your series > on top of the v4 of my series I've just send. > > Which brings me to one comment about your series why are you not doing phy_exit > and phy_init on suspend resp. resume ? The phy can use quite a bit of power, > if the phy init / exit end up in ahci_platform_enable_resources / > ahci_platform_disable_resources, this will happen automatically for better or > worse. So it would be good to test if this would work or not ... Right. Bartlomiej had pointed this out earlier, but I just wasn't very sure about it. Is it sufficient to just call phy_power_off() in suspend and phy_power_on() in resume? Or do we call phy_exit() and phy_init() respectively as well. Kishon, any suggestions? cheers, -roger -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 12+ messages in thread
[parent not found: <52DE3132.3000007-l0cyMroinI0@public.gmane.org>]
* Re: [PATCH v5 0/4] ata: ahci_platform: Add PHY support and OMAP support [not found] ` <52DE3132.3000007-l0cyMroinI0@public.gmane.org> @ 2014-01-21 11:59 ` Roger Quadros 2014-01-21 13:59 ` Hans de Goede 0 siblings, 1 reply; 12+ messages in thread From: Roger Quadros @ 2014-01-21 11:59 UTC (permalink / raw) To: Hans de Goede, tj-DgEjT+Ai2ygdnm+yROfE0A, kishon-l0cyMroinI0 Cc: sergei.shtylyov-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8, b.zolnierkie-Sze3O3UU22JBDgjK7y7TUQ, arnd-r2nGTMty4D4, linux-ide-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA On 01/21/2014 10:34 AM, Roger Quadros wrote: > On 01/20/2014 06:48 PM, Hans de Goede wrote: >> Hi, >> >> On 01/20/2014 03:41 PM, Roger Quadros wrote: >>> Hi, >>> >>> Some platforms have a PHY hooked up to the SATA controller. >>> The PHY needs to be initialized and powered up for SATA to work. >>> We do that using the Generic PHY framework in PATCH 3. >>> >>> In order to support SATA on the OMAP platforms we need to runtime >>> resume the device before use. PATCH 4 takes care of that. >> >> Thanks for keeping me in the loop on this. I'm afraid this conflicts >> quite a bit with my recent ahci_platform.c work, not a big problem >> really, the series can go in either way. >> >> Your phy support will slot nicely into the new ahci_platform_get_resources >> and ahci_platform_enable_resources functions my refactoring introduces, >> looking at it from this pov it might be better / easier to rebase your series >> on top of the v4 of my series I've just send. >> >> Which brings me to one comment about your series why are you not doing phy_exit >> and phy_init on suspend resp. resume ? The phy can use quite a bit of power, >> if the phy init / exit end up in ahci_platform_enable_resources / >> ahci_platform_disable_resources, this will happen automatically for better or >> worse. So it would be good to test if this would work or not ... > > Right. Bartlomiej had pointed this out earlier, but I just wasn't very sure about it. > > Is it sufficient to just call phy_power_off() in suspend and phy_power_on() in resume? > Or do we call phy_exit() and phy_init() respectively as well. > > Kishon, any suggestions? OK. Answering my own question. On OMAP platform we power down the phy in phy_power_off() and idle the DPLL in phy_exit(), so my guess is both should be called in suspend() to save the most power. cheers, -roger -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v5 0/4] ata: ahci_platform: Add PHY support and OMAP support 2014-01-21 11:59 ` Roger Quadros @ 2014-01-21 13:59 ` Hans de Goede 2014-01-22 8:11 ` Roger Quadros 0 siblings, 1 reply; 12+ messages in thread From: Hans de Goede @ 2014-01-21 13:59 UTC (permalink / raw) To: Roger Quadros, tj, kishon Cc: sergei.shtylyov, b.zolnierkie, arnd, linux-ide, linux-kernel, devicetree Hi, On 01/21/2014 12:59 PM, Roger Quadros wrote: > On 01/21/2014 10:34 AM, Roger Quadros wrote: >> On 01/20/2014 06:48 PM, Hans de Goede wrote: >>> Hi, >>> >>> On 01/20/2014 03:41 PM, Roger Quadros wrote: >>>> Hi, >>>> >>>> Some platforms have a PHY hooked up to the SATA controller. >>>> The PHY needs to be initialized and powered up for SATA to work. >>>> We do that using the Generic PHY framework in PATCH 3. >>>> >>>> In order to support SATA on the OMAP platforms we need to runtime >>>> resume the device before use. PATCH 4 takes care of that. >>> >>> Thanks for keeping me in the loop on this. I'm afraid this conflicts >>> quite a bit with my recent ahci_platform.c work, not a big problem >>> really, the series can go in either way. >>> >>> Your phy support will slot nicely into the new ahci_platform_get_resources >>> and ahci_platform_enable_resources functions my refactoring introduces, >>> looking at it from this pov it might be better / easier to rebase your series >>> on top of the v4 of my series I've just send. >>> >>> Which brings me to one comment about your series why are you not doing phy_exit >>> and phy_init on suspend resp. resume ? The phy can use quite a bit of power, >>> if the phy init / exit end up in ahci_platform_enable_resources / >>> ahci_platform_disable_resources, this will happen automatically for better or >>> worse. So it would be good to test if this would work or not ... >> >> Right. Bartlomiej had pointed this out earlier, but I just wasn't very sure about it. >> >> Is it sufficient to just call phy_power_off() in suspend and phy_power_on() in resume? >> Or do we call phy_exit() and phy_init() respectively as well. >> >> Kishon, any suggestions? > > OK. Answering my own question. > > On OMAP platform we power down the phy in phy_power_off() and idle the DPLL in phy_exit(), > so my guess is both should be called in suspend() to save the most power. Right, this would also match nicely with putting both the phy_init and the phy_power_on call in ahci_platform_enable_resources in ahci_platform.c as it looks after v4 of my ahci_platform rework patch-set, see: https://github.com/jwrdegoede/linux-sunxi/blob/sunxi-devel/drivers/ata/ahci_platform.c If this goes there it will be automatically called on both probe and resume (and the counterparts should go to ahci_platform_disable_resources, which will be called on suspend and remove). As said before I don't really have a preference for in which order these patches go upstream, but can you please check that calling phy_poweroff + phy_exit on suspend and undo on resume does not cause issues ? If it does I need to rethink how things will work after my refactoring, because currently all the clks / optional regulator and now also optional phy get en/disabled in one go through ahci_platform_en/disable_resources. Thanks & Regards, Hans ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v5 0/4] ata: ahci_platform: Add PHY support and OMAP support 2014-01-21 13:59 ` Hans de Goede @ 2014-01-22 8:11 ` Roger Quadros 2014-01-22 8:28 ` Hans de Goede 0 siblings, 1 reply; 12+ messages in thread From: Roger Quadros @ 2014-01-22 8:11 UTC (permalink / raw) To: Hans de Goede, tj, kishon Cc: sergei.shtylyov, b.zolnierkie, arnd, linux-ide, linux-kernel, devicetree Hi, On 01/21/2014 03:59 PM, Hans de Goede wrote: > Hi, > > On 01/21/2014 12:59 PM, Roger Quadros wrote: >> On 01/21/2014 10:34 AM, Roger Quadros wrote: >>> On 01/20/2014 06:48 PM, Hans de Goede wrote: >>>> Hi, >>>> >>>> On 01/20/2014 03:41 PM, Roger Quadros wrote: >>>>> Hi, >>>>> >>>>> Some platforms have a PHY hooked up to the SATA controller. >>>>> The PHY needs to be initialized and powered up for SATA to work. >>>>> We do that using the Generic PHY framework in PATCH 3. >>>>> >>>>> In order to support SATA on the OMAP platforms we need to runtime >>>>> resume the device before use. PATCH 4 takes care of that. >>>> >>>> Thanks for keeping me in the loop on this. I'm afraid this conflicts >>>> quite a bit with my recent ahci_platform.c work, not a big problem >>>> really, the series can go in either way. >>>> >>>> Your phy support will slot nicely into the new ahci_platform_get_resources >>>> and ahci_platform_enable_resources functions my refactoring introduces, >>>> looking at it from this pov it might be better / easier to rebase your series >>>> on top of the v4 of my series I've just send. >>>> >>>> Which brings me to one comment about your series why are you not doing phy_exit >>>> and phy_init on suspend resp. resume ? The phy can use quite a bit of power, >>>> if the phy init / exit end up in ahci_platform_enable_resources / >>>> ahci_platform_disable_resources, this will happen automatically for better or >>>> worse. So it would be good to test if this would work or not ... >>> >>> Right. Bartlomiej had pointed this out earlier, but I just wasn't very sure about it. >>> >>> Is it sufficient to just call phy_power_off() in suspend and phy_power_on() in resume? >>> Or do we call phy_exit() and phy_init() respectively as well. >>> >>> Kishon, any suggestions? >> >> OK. Answering my own question. >> >> On OMAP platform we power down the phy in phy_power_off() and idle the DPLL in phy_exit(), >> so my guess is both should be called in suspend() to save the most power. > > Right, this would also match nicely with putting both the phy_init and the phy_power_on call > in ahci_platform_enable_resources in ahci_platform.c as it looks after v4 of my ahci_platform > rework patch-set, see: > https://github.com/jwrdegoede/linux-sunxi/blob/sunxi-devel/drivers/ata/ahci_platform.c > > If this goes there it will be automatically called on both probe and resume (and the counterparts > should go to ahci_platform_disable_resources, which will be called on suspend and remove). > > As said before I don't really have a preference for in which order these patches go upstream, > but can you please check that calling phy_poweroff + phy_exit on suspend and undo on resume > does not cause issues ? If it does I need to rethink how things will work after my refactoring, > because currently all the clks / optional regulator and now also optional phy get en/disabled in > one go through ahci_platform_en/disable_resources. I too don't have any preference of the upstream path. Maybe i'll repost this series based on your v4 an then you can include them in your series if you like. BTW why is your series still RFC at v4? As far as OMAP platform is concerned, calling phy_power_off() + phy_exit() shouldn't be a problem for suspend. Not sure about other platforms as we can't really know for sure what they do in phy_exit(). If phy_power_on/off() and phy_init()/phy_exit() are always meant to be called together then what is the point of having 2 functions each for power up/down. cheers, -roger ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v5 0/4] ata: ahci_platform: Add PHY support and OMAP support 2014-01-22 8:11 ` Roger Quadros @ 2014-01-22 8:28 ` Hans de Goede 0 siblings, 0 replies; 12+ messages in thread From: Hans de Goede @ 2014-01-22 8:28 UTC (permalink / raw) To: Roger Quadros, tj, kishon Cc: sergei.shtylyov, b.zolnierkie, arnd, linux-ide, linux-kernel, devicetree Hi, On 01/22/2014 09:11 AM, Roger Quadros wrote: > Hi, > > On 01/21/2014 03:59 PM, Hans de Goede wrote: >> Hi, >> >> On 01/21/2014 12:59 PM, Roger Quadros wrote: >>> On 01/21/2014 10:34 AM, Roger Quadros wrote: >>>> On 01/20/2014 06:48 PM, Hans de Goede wrote: >>>>> Hi, >>>>> >>>>> On 01/20/2014 03:41 PM, Roger Quadros wrote: >>>>>> Hi, >>>>>> >>>>>> Some platforms have a PHY hooked up to the SATA controller. >>>>>> The PHY needs to be initialized and powered up for SATA to work. >>>>>> We do that using the Generic PHY framework in PATCH 3. >>>>>> >>>>>> In order to support SATA on the OMAP platforms we need to runtime >>>>>> resume the device before use. PATCH 4 takes care of that. >>>>> >>>>> Thanks for keeping me in the loop on this. I'm afraid this conflicts >>>>> quite a bit with my recent ahci_platform.c work, not a big problem >>>>> really, the series can go in either way. >>>>> >>>>> Your phy support will slot nicely into the new ahci_platform_get_resources >>>>> and ahci_platform_enable_resources functions my refactoring introduces, >>>>> looking at it from this pov it might be better / easier to rebase your series >>>>> on top of the v4 of my series I've just send. >>>>> >>>>> Which brings me to one comment about your series why are you not doing phy_exit >>>>> and phy_init on suspend resp. resume ? The phy can use quite a bit of power, >>>>> if the phy init / exit end up in ahci_platform_enable_resources / >>>>> ahci_platform_disable_resources, this will happen automatically for better or >>>>> worse. So it would be good to test if this would work or not ... >>>> >>>> Right. Bartlomiej had pointed this out earlier, but I just wasn't very sure about it. >>>> >>>> Is it sufficient to just call phy_power_off() in suspend and phy_power_on() in resume? >>>> Or do we call phy_exit() and phy_init() respectively as well. >>>> >>>> Kishon, any suggestions? >>> >>> OK. Answering my own question. >>> >>> On OMAP platform we power down the phy in phy_power_off() and idle the DPLL in phy_exit(), >>> so my guess is both should be called in suspend() to save the most power. >> >> Right, this would also match nicely with putting both the phy_init and the phy_power_on call >> in ahci_platform_enable_resources in ahci_platform.c as it looks after v4 of my ahci_platform >> rework patch-set, see: >> https://github.com/jwrdegoede/linux-sunxi/blob/sunxi-devel/drivers/ata/ahci_platform.c >> >> If this goes there it will be automatically called on both probe and resume (and the counterparts >> should go to ahci_platform_disable_resources, which will be called on suspend and remove). >> >> As said before I don't really have a preference for in which order these patches go upstream, >> but can you please check that calling phy_poweroff + phy_exit on suspend and undo on resume >> does not cause issues ? If it does I need to rethink how things will work after my refactoring, >> because currently all the clks / optional regulator and now also optional phy get en/disabled in >> one go through ahci_platform_en/disable_resources. > > I too don't have any preference of the upstream path. Maybe i'll repost this series based on your v4 an then you can include them in your series if you like. As indicated doing things in that order has my preference as rebase-conflict resolution should be a lot easier that way then the other way around. So if you could do that, that would be great. > BTW why is your series still RFC at v4? It was not RFC at v1 and v2, it became RFC at v3 because at that point it included changes which would also impact ahci_imx, and I did not have hardware to verify those changes. The wandboard I ordered for this has arrived yesterday, so my next version should not be RFC anymore :) > As far as OMAP platform is concerned, calling phy_power_off() + phy_exit() shouldn't be a problem for suspend. > Not sure about other platforms as we can't really know for sure what they do in phy_exit(). Good, after the rework my patch-series does, platforms which need something else can always override the ahci_platform_disable_resources behavior (by doing that part themselves) while still using other parts of ahci_platform.c as is, that is the whole idea of the rework. Thanks & Regards, Hans ^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2014-01-22 8:28 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-20 14:41 [PATCH v5 0/4] ata: ahci_platform: Add PHY support and OMAP support Roger Quadros
2014-01-20 14:41 ` [PATCH v5 1/4] ata: ahci_platform: Add DT compatible for Synopsis DWC AHCI controller Roger Quadros
2014-01-20 14:41 ` [PATCH v5 2/4] ata: ahci_platform: Update DT compatible list Roger Quadros
2014-01-20 14:51 ` Rob Herring
2014-01-20 14:41 ` [PATCH v5 3/4] ata: ahci_platform: Manage SATA PHY Roger Quadros
2014-01-20 14:41 ` [PATCH v5 4/4] ata: ahci_platform: runtime resume the device before use Roger Quadros
2014-01-20 16:48 ` [PATCH v5 0/4] ata: ahci_platform: Add PHY support and OMAP support Hans de Goede
[not found] ` <52DD5368.5020301-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2014-01-21 8:34 ` Roger Quadros
[not found] ` <52DE3132.3000007-l0cyMroinI0@public.gmane.org>
2014-01-21 11:59 ` Roger Quadros
2014-01-21 13:59 ` Hans de Goede
2014-01-22 8:11 ` Roger Quadros
2014-01-22 8:28 ` Hans de Goede
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).