ata: ahci_brcm: Follow-up changes for BCM7216
v3 cover ata: ahci_brcm: Follow-up changes for BCM7216
Hi Jens, Philipp,
These three patches are a follow-up to my previous series titled: ata:ahci_brcm: Fixes and new device support.
After submitting the BCM7216 RESCAL reset driver, Philipp the reset controller maintained indicated that the reset line should be self de-asserting and so reset_control_reset() should be used instead.
These three patches update the driver in that regard. It would be great if you could apply those and get them queued up for 5.6 since they are directly related to the previous series.
Changes in v3:
- introduced a preliminary patch making use of the proper reset control API in order to manage the optional reset controller line
- updated patches after introducing that preliminary patch
Changes in v2:
- updated error path after moving the reset line control
Thanks!
Florian Fainelli (3):
ata: ahci_brcm: Correct reset control API usage
ata: ahci_brcm: Perform reset after obtaining resources
ata: ahci_brcm: BCM7216 reset is self de-asserting
drivers/ata/ahci_brcm.c | 42 +++++++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 16 deletions(-)
Signature · 1 line
2.17.1
PATCH v3 1/3 ata: ahci_brcm: Correct reset control API usage
Philipp provided suggestions on using the devm_reset_control_get_optional_*() API such that checks against a NULL or error reset control resource could be eliminated. In the process, make sure that we also grab the BCM7216 reset control line using the shared semantics, since the "rescal" reset fits that model.
--- drivers/ata/ahci_brcm.c | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-)
drivers/ata/ahci_brcm.c +17 -15
@@ -349,11 +349,10 @@ static int brcm_ahci_suspend(struct device *dev)brcm_sata_phys_disable (priv); ret =ahci_platform_suspend (dev); +if (ret) +return ret; -if (!IS_ERR_OR_NULL (priv->rcdev)) -reset_control_assert (priv->rcdev); - -return ret; +return reset_control_assert (priv->rcdev); }static int brcm_ahci_resume (struct device *dev)
@@ -363,8 +362,7 @@ static int brcm_ahci_resume(struct device *dev)struct brcm_ahci_priv *priv = hpriv->plat_data;int ret =0 ; -if (!IS_ERR_OR_NULL (priv->rcdev)) - ret =reset_control_deassert (priv->rcdev); + ret =reset_control_deassert (priv->rcdev);if (ret)return ret;
@@ -425,7 +423,6 @@ static int brcm_ahci_probe(struct platform_device *pdev) {const struct of_device_id *of_id;struct device *dev = &pdev->dev; -const char *reset_name =NULL ;struct brcm_ahci_priv *priv;struct ahci_host_priv *hpriv;struct resource *res;
@@ -447,15 +444,21 @@ static int brcm_ahci_probe(struct platform_device *pdev)if (IS_ERR (priv->top_ctrl))return PTR_ERR (priv->top_ctrl); -/* Reset is optional depending on platform and named differently */ +/* Reset is optional depending on platform and named differently +* and of different kind (shared vs. exclusive) +*/ if (priv->version ==BRCM_SATA_BCM7216 ) - reset_name ="rescal" ; + priv->rcdev =devm_reset_control_get_optional_shared (dev, +"rescal" );else - reset_name ="ahci" ; + priv->rcdev =devm_reset_control_get_optional_exclusive (dev, +"ahci" ); +if (IS_ERR (priv->rcdev)) +return PTR_ERR (priv->rcdev); - priv->rcdev =devm_reset_control_get (&pdev->dev, reset_name); -if (!IS_ERR_OR_NULL (priv->rcdev)) -reset_control_deassert (priv->rcdev); + ret =reset_control_deassert (priv->rcdev); +if (ret) +return ret; hpriv =ahci_platform_get_resources (pdev,0 );if (IS_ERR (hpriv)) {
@@ -519,8 +522,7 @@ static int brcm_ahci_probe(struct platform_device *pdev) out_disable_clks:ahci_platform_disable_clks (hpriv); out_reset: -if (!IS_ERR_OR_NULL (priv->rcdev)) -reset_control_assert (priv->rcdev); +reset_control_assert (priv->rcdev);return ret; }
Signature · 1 line
2.17.1
PATCH v3 2/3 ata: ahci_brcm: Perform reset after obtaining resources
In reply to Florian FainelliResources such as clocks, PHYs, regulators are likely to get a probe deferral return code, which could lead to the AHCI controller being reset a few times until it gets successfully probed. Since this is typically the most time consuming operation, move it after the resources have been acquired.
--- drivers/ata/ahci_brcm.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
drivers/ata/ahci_brcm.c +6 -8
@@ -456,15 +456,9 @@ static int brcm_ahci_probe(struct platform_device *pdev)if (IS_ERR (priv->rcdev))return PTR_ERR (priv->rcdev); - ret =reset_control_deassert (priv->rcdev); -if (ret) -return ret; - hpriv =ahci_platform_get_resources (pdev,0 ); -if (IS_ERR (hpriv)) { - ret =PTR_ERR (hpriv); - goto out_reset; - } +if (IS_ERR (hpriv)) +return PTR_ERR (hpriv); hpriv->plat_data = priv; hpriv->flags =AHCI_HFLAG_WAKE_BEFORE_STOP |AHCI_HFLAG_NO_WRITE_TO_RO ;
@@ -481,6 +475,10 @@ static int brcm_ahci_probe(struct platform_device *pdev)break ; } + ret =reset_control_deassert (priv->rcdev); +if (ret) +return ret; + ret =ahci_platform_enable_clks (hpriv);if (ret) goto out_reset;
Signature · 1 line
2.17.1
PATCH v3 3/3 ata: ahci_brcm: BCM7216 reset is self de-asserting
In reply to Florian FainelliThe BCM7216 reset controller line is self-deasserting, unlike other platforms, so make use of reset_control_reset() instead of reset_control_deassert().
--- drivers/ata/ahci_brcm.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)
drivers/ata/ahci_brcm.c +14 -4
@@ -352,7 +352,10 @@ static int brcm_ahci_suspend(struct device *dev)if (ret)return ret; -return reset_control_assert (priv->rcdev); +if (priv->version !=BRCM_SATA_BCM7216 ) + ret =reset_control_assert (priv->rcdev); + +return ret; }static int brcm_ahci_resume (struct device *dev)
@@ -362,7 +365,10 @@ static int brcm_ahci_resume(struct device *dev)struct brcm_ahci_priv *priv = hpriv->plat_data;int ret =0 ; - ret =reset_control_deassert (priv->rcdev); +if (priv->version ==BRCM_SATA_BCM7216 ) + ret =reset_control_reset (priv->rcdev); +else + ret =reset_control_deassert (priv->rcdev);if (ret)return ret;
@@ -475,7 +481,10 @@ static int brcm_ahci_probe(struct platform_device *pdev)break ; } - ret =reset_control_deassert (priv->rcdev); +if (priv->version ==BRCM_SATA_BCM7216 ) + ret =reset_control_reset (priv->rcdev); +else + ret =reset_control_deassert (priv->rcdev);if (ret)return ret;
@@ -520,7 +529,8 @@ static int brcm_ahci_probe(struct platform_device *pdev) out_disable_clks:ahci_platform_disable_clks (hpriv); out_reset: -reset_control_assert (priv->rcdev); +if (priv->version !=BRCM_SATA_BCM7216 ) +reset_control_assert (priv->rcdev);return ret; }
Signature · 1 line
2.17.1
Hi,
Quoted 13 lines · Florian Fainelli
Hi Jens, Philipp,
These three patches are a follow-up to my previous series titled: ata:
ahci_brcm: Fixes and new device support.After submitting the BCM7216 RESCAL reset driver, Philipp the reset controller maintained indicated that the reset line should be self de-asserting and so
reset_control_reset()should be used instead.These three patches update the driver in that regard. It would be great if you could apply those and get them queued up for 5.6 since they are directly related to the previous series.
Quoted 7 lines
Changes in v3:
- introduced a preliminary patch making use of the proper reset control API in order to manage the optional reset controller line
- updated patches after introducing that preliminary patchChanges in v2:
- updated error path after moving the reset line control
Series looks good to me:
Regards,
Hans
Quoted 11 lines
Thanks!
Florian Fainelli (3):
ata:ahci_brcm: Correct reset control API usage
ata:ahci_brcm: Perform reset after obtaining resources
ata:ahci_brcm: BCM7216 reset is self de-assertingdrivers/ata/ahci_brcm.c | 42 +++++++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 16 deletions(-)
Hi Florian,
Quoted 9 lines · Florian Fainelli
Hi Jens, Philipp,
These three patches are a follow-up to my previous series titled: ata:
ahci_brcm: Fixes and new device support.After submitting the BCM7216 RESCAL reset driver, Philipp the reset controller maintained indicated that the reset line should be self de-asserting and so
reset_control_reset()should be used instead.
Quoted 8 lines
These three patches update the driver in that regard. It would be great if you could apply those and get them queued up for 5.6 since they are directly related to the previous series.
Changes in v3:
- introduced a preliminary patch making use of the proper reset control API in order to manage the optional reset controller line
- updated patches after introducing that preliminary patch
The third patch could be simplified by storing the rescal reset control in a separate struct member and relying on the optional reset control API more. This is just a suggestion though, the series looks fine as-is.
regards
Philipp
Quoted 21 lines · Philipp Zabel
Hi Florian,
Quoted 9 lines · Florian Fainelli
Hi Jens, Philipp,
These three patches are a follow-up to my previous series titled: ata:
ahci_brcm: Fixes and new device support.After submitting the BCM7216 RESCAL reset driver, Philipp the reset controller maintained indicated that the reset line should be self de-asserting and so
reset_control_reset()should be used instead.Quoted 8 lines
These three patches update the driver in that regard. It would be great if you could apply those and get them queued up for 5.6 since they are directly related to the previous series.
Changes in v3:
- introduced a preliminary patch making use of the proper reset control API in order to manage the optional reset controller line
- updated patches after introducing that preliminary patch
Quoted 5 lines
The third patch could be simplified by storing the rescal reset control in a separate struct member and relying on the optional reset control API more. This is just a suggestion though, the series looks fine as-is.
Reviewed-by Philipp Zabel <[email protected]>
Thanks! Jens is that good for you?
Signature · 1 line
Florian
Quoted 24 lines · Florian Fainelli
Quoted 21 lines · Philipp Zabel
Hi Florian,
Quoted 17 lines · Florian Fainelli
Hi Jens, Philipp,
These three patches are a follow-up to my previous series titled: ata:
ahci_brcm: Fixes and new device support.After submitting the BCM7216 RESCAL reset driver, Philipp the reset controller maintained indicated that the reset line should be self de-asserting and so
reset_control_reset()should be used instead.These three patches update the driver in that regard. It would be great if you could apply those and get them queued up for 5.6 since they are directly related to the previous series.
Changes in v3:
- introduced a preliminary patch making use of the proper reset control API in order to manage the optional reset controller line
- updated patches after introducing that preliminary patch
Quoted 7 lines
Quoted 5 lines
The third patch could be simplified by storing the rescal reset control in a separate struct member and relying on the optional reset control API more. This is just a suggestion though, the series looks fine as-is.
Reviewed-by Philipp Zabel <[email protected]>Thanks! Jens is that good for you?
Can you re-send against the current branch and include the reviewed-bys from here as well?
Signature · 1 line
Jens Axboe