LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] MIPS: lantiq: gphy: Drop reboot/remove reset asserts
@ 2018-04-08  8:30 Mathias Kresin
  2018-04-08 21:30 ` Martin Blumenstingl
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Mathias Kresin @ 2018-04-08  8:30 UTC (permalink / raw)
  To: john, linux-mips, linux-kernel; +Cc: martin.blumenstingl, hauke, stable

While doing a global software reset, these bits are not cleared and let
some bootloader fail to initialise the GPHYs. The bootloader don't
expect the GPHYs in reset, as they aren't during power on.

The asserts were a workaround for a wrong syscon-reboot mask. With a
mask set which includes the GPHY resets, these resets aren't required
any more.

Fixes: 126534141b45 ("MIPS: lantiq: Add a GPHY driver which uses the RCU syscon-mfd")
Cc: stable@vger.kernel.org # 4.14+
Signed-off-by: Mathias Kresin <dev@kresin.me>
---
 drivers/soc/lantiq/gphy.c | 34 ----------------------------------
 1 file changed, 34 deletions(-)

diff --git a/drivers/soc/lantiq/gphy.c b/drivers/soc/lantiq/gphy.c
index 8d86594..8c31ae7 100644
--- a/drivers/soc/lantiq/gphy.c
+++ b/drivers/soc/lantiq/gphy.c
@@ -30,7 +30,6 @@ struct xway_gphy_priv {
 	struct clk *gphy_clk_gate;
 	struct reset_control *gphy_reset;
 	struct reset_control *gphy_reset2;
-	struct notifier_block gphy_reboot_nb;
 	void __iomem *membase;
 	char *fw_name;
 };
@@ -64,24 +63,6 @@ static const struct of_device_id xway_gphy_match[] = {
 };
 MODULE_DEVICE_TABLE(of, xway_gphy_match);
 
-static struct xway_gphy_priv *to_xway_gphy_priv(struct notifier_block *nb)
-{
-	return container_of(nb, struct xway_gphy_priv, gphy_reboot_nb);
-}
-
-static int xway_gphy_reboot_notify(struct notifier_block *reboot_nb,
-				   unsigned long code, void *unused)
-{
-	struct xway_gphy_priv *priv = to_xway_gphy_priv(reboot_nb);
-
-	if (priv) {
-		reset_control_assert(priv->gphy_reset);
-		reset_control_assert(priv->gphy_reset2);
-	}
-
-	return NOTIFY_DONE;
-}
-
 static int xway_gphy_load(struct device *dev, struct xway_gphy_priv *priv,
 			  dma_addr_t *dev_addr)
 {
@@ -205,14 +186,6 @@ static int xway_gphy_probe(struct platform_device *pdev)
 	reset_control_deassert(priv->gphy_reset);
 	reset_control_deassert(priv->gphy_reset2);
 
-	/* assert the gphy reset because it can hang after a reboot: */
-	priv->gphy_reboot_nb.notifier_call = xway_gphy_reboot_notify;
-	priv->gphy_reboot_nb.priority = -1;
-
-	ret = register_reboot_notifier(&priv->gphy_reboot_nb);
-	if (ret)
-		dev_warn(dev, "Failed to register reboot notifier\n");
-
 	platform_set_drvdata(pdev, priv);
 
 	return ret;
@@ -224,17 +197,10 @@ static int xway_gphy_remove(struct platform_device *pdev)
 	struct xway_gphy_priv *priv = platform_get_drvdata(pdev);
 	int ret;
 
-	reset_control_assert(priv->gphy_reset);
-	reset_control_assert(priv->gphy_reset2);
-
 	iowrite32be(0, priv->membase);
 
 	clk_disable_unprepare(priv->gphy_clk_gate);
 
-	ret = unregister_reboot_notifier(&priv->gphy_reboot_nb);
-	if (ret)
-		dev_warn(dev, "Failed to unregister reboot notifier\n");
-
 	return 0;
 }
 
-- 
2.7.4

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] MIPS: lantiq: gphy: Drop reboot/remove reset asserts
  2018-04-08  8:30 [PATCH] MIPS: lantiq: gphy: Drop reboot/remove reset asserts Mathias Kresin
@ 2018-04-08 21:30 ` Martin Blumenstingl
  2018-04-22 19:18 ` Hauke Mehrtens
  2018-05-21 16:39 ` James Hogan
  2 siblings, 0 replies; 6+ messages in thread
From: Martin Blumenstingl @ 2018-04-08 21:30 UTC (permalink / raw)
  To: Mathias Kresin, Hauke Mehrtens; +Cc: john, linux-mips, linux-kernel, stable

On Sun, Apr 8, 2018 at 10:30 AM, Mathias Kresin <dev@kresin.me> wrote:
> While doing a global software reset, these bits are not cleared and let
> some bootloader fail to initialise the GPHYs. The bootloader don't
> expect the GPHYs in reset, as they aren't during power on.
>
> The asserts were a workaround for a wrong syscon-reboot mask. With a
> mask set which includes the GPHY resets, these resets aren't required
> any more.
>
> Fixes: 126534141b45 ("MIPS: lantiq: Add a GPHY driver which uses the RCU syscon-mfd")
> Cc: stable@vger.kernel.org # 4.14+
> Signed-off-by: Mathias Kresin <dev@kresin.me>
Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>

thank you Mathias!
@Hauke: maybe you can also review this and give feedback?

> ---
>  drivers/soc/lantiq/gphy.c | 34 ----------------------------------
>  1 file changed, 34 deletions(-)
>
> diff --git a/drivers/soc/lantiq/gphy.c b/drivers/soc/lantiq/gphy.c
> index 8d86594..8c31ae7 100644
> --- a/drivers/soc/lantiq/gphy.c
> +++ b/drivers/soc/lantiq/gphy.c
> @@ -30,7 +30,6 @@ struct xway_gphy_priv {
>         struct clk *gphy_clk_gate;
>         struct reset_control *gphy_reset;
>         struct reset_control *gphy_reset2;
> -       struct notifier_block gphy_reboot_nb;
>         void __iomem *membase;
>         char *fw_name;
>  };
> @@ -64,24 +63,6 @@ static const struct of_device_id xway_gphy_match[] = {
>  };
>  MODULE_DEVICE_TABLE(of, xway_gphy_match);
>
> -static struct xway_gphy_priv *to_xway_gphy_priv(struct notifier_block *nb)
> -{
> -       return container_of(nb, struct xway_gphy_priv, gphy_reboot_nb);
> -}
> -
> -static int xway_gphy_reboot_notify(struct notifier_block *reboot_nb,
> -                                  unsigned long code, void *unused)
> -{
> -       struct xway_gphy_priv *priv = to_xway_gphy_priv(reboot_nb);
> -
> -       if (priv) {
> -               reset_control_assert(priv->gphy_reset);
> -               reset_control_assert(priv->gphy_reset2);
> -       }
> -
> -       return NOTIFY_DONE;
> -}
> -
>  static int xway_gphy_load(struct device *dev, struct xway_gphy_priv *priv,
>                           dma_addr_t *dev_addr)
>  {
> @@ -205,14 +186,6 @@ static int xway_gphy_probe(struct platform_device *pdev)
>         reset_control_deassert(priv->gphy_reset);
>         reset_control_deassert(priv->gphy_reset2);
>
> -       /* assert the gphy reset because it can hang after a reboot: */
> -       priv->gphy_reboot_nb.notifier_call = xway_gphy_reboot_notify;
> -       priv->gphy_reboot_nb.priority = -1;
> -
> -       ret = register_reboot_notifier(&priv->gphy_reboot_nb);
> -       if (ret)
> -               dev_warn(dev, "Failed to register reboot notifier\n");
> -
>         platform_set_drvdata(pdev, priv);
>
>         return ret;
> @@ -224,17 +197,10 @@ static int xway_gphy_remove(struct platform_device *pdev)
>         struct xway_gphy_priv *priv = platform_get_drvdata(pdev);
>         int ret;
>
> -       reset_control_assert(priv->gphy_reset);
> -       reset_control_assert(priv->gphy_reset2);
> -
>         iowrite32be(0, priv->membase);
>
>         clk_disable_unprepare(priv->gphy_clk_gate);
>
> -       ret = unregister_reboot_notifier(&priv->gphy_reboot_nb);
> -       if (ret)
> -               dev_warn(dev, "Failed to unregister reboot notifier\n");
> -
>         return 0;
>  }
>
> --
> 2.7.4
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] MIPS: lantiq: gphy: Drop reboot/remove reset asserts
  2018-04-08  8:30 [PATCH] MIPS: lantiq: gphy: Drop reboot/remove reset asserts Mathias Kresin
  2018-04-08 21:30 ` Martin Blumenstingl
@ 2018-04-22 19:18 ` Hauke Mehrtens
  2018-05-21 16:39 ` James Hogan
  2 siblings, 0 replies; 6+ messages in thread
From: Hauke Mehrtens @ 2018-04-22 19:18 UTC (permalink / raw)
  To: Mathias Kresin, john, linux-mips, linux-kernel
  Cc: martin.blumenstingl, stable

On 04/08/2018 10:30 AM, Mathias Kresin wrote:
> While doing a global software reset, these bits are not cleared and let
> some bootloader fail to initialise the GPHYs. The bootloader don't
> expect the GPHYs in reset, as they aren't during power on.
> 
> The asserts were a workaround for a wrong syscon-reboot mask. With a
> mask set which includes the GPHY resets, these resets aren't required
> any more.
> 
> Fixes: 126534141b45 ("MIPS: lantiq: Add a GPHY driver which uses the RCU syscon-mfd")
> Cc: stable@vger.kernel.org # 4.14+
> Signed-off-by: Mathias Kresin <dev@kresin.me>

Acked-by: Hauke Mehrtens <hauke@hauke-m.de>

> ---
>  drivers/soc/lantiq/gphy.c | 34 ----------------------------------
>  1 file changed, 34 deletions(-)
> 
> diff --git a/drivers/soc/lantiq/gphy.c b/drivers/soc/lantiq/gphy.c
> index 8d86594..8c31ae7 100644
> --- a/drivers/soc/lantiq/gphy.c
> +++ b/drivers/soc/lantiq/gphy.c
> @@ -30,7 +30,6 @@ struct xway_gphy_priv {
>  	struct clk *gphy_clk_gate;
>  	struct reset_control *gphy_reset;
>  	struct reset_control *gphy_reset2;
> -	struct notifier_block gphy_reboot_nb;
>  	void __iomem *membase;
>  	char *fw_name;
>  };
> @@ -64,24 +63,6 @@ static const struct of_device_id xway_gphy_match[] = {
>  };
>  MODULE_DEVICE_TABLE(of, xway_gphy_match);
>  
> -static struct xway_gphy_priv *to_xway_gphy_priv(struct notifier_block *nb)
> -{
> -	return container_of(nb, struct xway_gphy_priv, gphy_reboot_nb);
> -}
> -
> -static int xway_gphy_reboot_notify(struct notifier_block *reboot_nb,
> -				   unsigned long code, void *unused)
> -{
> -	struct xway_gphy_priv *priv = to_xway_gphy_priv(reboot_nb);
> -
> -	if (priv) {
> -		reset_control_assert(priv->gphy_reset);
> -		reset_control_assert(priv->gphy_reset2);
> -	}
> -
> -	return NOTIFY_DONE;
> -}
> -
>  static int xway_gphy_load(struct device *dev, struct xway_gphy_priv *priv,
>  			  dma_addr_t *dev_addr)
>  {
> @@ -205,14 +186,6 @@ static int xway_gphy_probe(struct platform_device *pdev)
>  	reset_control_deassert(priv->gphy_reset);
>  	reset_control_deassert(priv->gphy_reset2);
>  
> -	/* assert the gphy reset because it can hang after a reboot: */
> -	priv->gphy_reboot_nb.notifier_call = xway_gphy_reboot_notify;
> -	priv->gphy_reboot_nb.priority = -1;
> -
> -	ret = register_reboot_notifier(&priv->gphy_reboot_nb);
> -	if (ret)
> -		dev_warn(dev, "Failed to register reboot notifier\n");
> -
>  	platform_set_drvdata(pdev, priv);
>  
>  	return ret;
> @@ -224,17 +197,10 @@ static int xway_gphy_remove(struct platform_device *pdev)
>  	struct xway_gphy_priv *priv = platform_get_drvdata(pdev);
>  	int ret;
>  
> -	reset_control_assert(priv->gphy_reset);
> -	reset_control_assert(priv->gphy_reset2);
> -
>  	iowrite32be(0, priv->membase);
>  
>  	clk_disable_unprepare(priv->gphy_clk_gate);
>  
> -	ret = unregister_reboot_notifier(&priv->gphy_reboot_nb);
> -	if (ret)
> -		dev_warn(dev, "Failed to unregister reboot notifier\n");
> -
>  	return 0;
>  }
>  
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] MIPS: lantiq: gphy: Drop reboot/remove reset asserts
  2018-04-08  8:30 [PATCH] MIPS: lantiq: gphy: Drop reboot/remove reset asserts Mathias Kresin
  2018-04-08 21:30 ` Martin Blumenstingl
  2018-04-22 19:18 ` Hauke Mehrtens
@ 2018-05-21 16:39 ` James Hogan
  2018-05-24 12:07   ` James Hogan
  2 siblings, 1 reply; 6+ messages in thread
From: James Hogan @ 2018-05-21 16:39 UTC (permalink / raw)
  To: Mathias Kresin
  Cc: john, linux-mips, linux-kernel, martin.blumenstingl, hauke, stable

[-- Attachment #1: Type: text/plain, Size: 686 bytes --]

On Sun, Apr 08, 2018 at 10:30:03AM +0200, Mathias Kresin wrote:
> While doing a global software reset, these bits are not cleared and let
> some bootloader fail to initialise the GPHYs. The bootloader don't
> expect the GPHYs in reset, as they aren't during power on.
> 
> The asserts were a workaround for a wrong syscon-reboot mask. With a
> mask set which includes the GPHY resets, these resets aren't required
> any more.
> 
> Fixes: 126534141b45 ("MIPS: lantiq: Add a GPHY driver which uses the RCU syscon-mfd")
> Cc: stable@vger.kernel.org # 4.14+
> Signed-off-by: Mathias Kresin <dev@kresin.me>

Applied for 4.17. Thanks for the acks/reviews folk!

Thanks
James

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] MIPS: lantiq: gphy: Drop reboot/remove reset asserts
  2018-05-21 16:39 ` James Hogan
@ 2018-05-24 12:07   ` James Hogan
  2018-05-25 10:12     ` Mathias Kresin
  0 siblings, 1 reply; 6+ messages in thread
From: James Hogan @ 2018-05-24 12:07 UTC (permalink / raw)
  To: Mathias Kresin
  Cc: john, linux-mips, linux-kernel, martin.blumenstingl, hauke, stable

[-- Attachment #1: Type: text/plain, Size: 1732 bytes --]

On Mon, May 21, 2018 at 05:39:32PM +0100, James Hogan wrote:
> On Sun, Apr 08, 2018 at 10:30:03AM +0200, Mathias Kresin wrote:
> > While doing a global software reset, these bits are not cleared and let
> > some bootloader fail to initialise the GPHYs. The bootloader don't
> > expect the GPHYs in reset, as they aren't during power on.
> > 
> > The asserts were a workaround for a wrong syscon-reboot mask. With a
> > mask set which includes the GPHY resets, these resets aren't required
> > any more.
> > 
> > Fixes: 126534141b45 ("MIPS: lantiq: Add a GPHY driver which uses the RCU syscon-mfd")
> > Cc: stable@vger.kernel.org # 4.14+
> > Signed-off-by: Mathias Kresin <dev@kresin.me>
> 
> Applied for 4.17. Thanks for the acks/reviews folk!

drivers/soc/lantiq/gphy.c: In function ‘xway_gphy_remove’:
drivers/soc/lantiq/gphy.c:198:6: warning: unused variable ‘ret’ [-Wunused-variable]
  int ret;
      ^~~
drivers/soc/lantiq/gphy.c:196:17: warning: unused variable ‘dev’ [-Wunused-variable]
  struct device *dev = &pdev->dev;
                 ^~~

Easily fixed, I can drop those two lines:

diff --git a/drivers/soc/lantiq/gphy.c b/drivers/soc/lantiq/gphy.c
index 8c31ae750987..feeb17cebc25 100644
--- a/drivers/soc/lantiq/gphy.c
+++ b/drivers/soc/lantiq/gphy.c
@@ -193,9 +193,7 @@ static int xway_gphy_probe(struct platform_device *pdev)

 static int xway_gphy_remove(struct platform_device *pdev)
 {
-	struct device *dev = &pdev->dev;
	struct xway_gphy_priv *priv = platform_get_drvdata(pdev);
-	int ret;

	iowrite32be(0, priv->membase);

However it does raise the question, it sounds like a fix, but was this
patch tested and the warning just overlooked?

Cheers
James

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] MIPS: lantiq: gphy: Drop reboot/remove reset asserts
  2018-05-24 12:07   ` James Hogan
@ 2018-05-25 10:12     ` Mathias Kresin
  0 siblings, 0 replies; 6+ messages in thread
From: Mathias Kresin @ 2018-05-25 10:12 UTC (permalink / raw)
  To: James Hogan
  Cc: John Crispin, linux-mips, linux-kernel, Martin Blumenstingl,
	hauke, stable

2018-05-24 15:07 GMT+03:00 James Hogan <jhogan@kernel.org>:
> On Mon, May 21, 2018 at 05:39:32PM +0100, James Hogan wrote:
>> On Sun, Apr 08, 2018 at 10:30:03AM +0200, Mathias Kresin wrote:
>> > While doing a global software reset, these bits are not cleared and let
>> > some bootloader fail to initialise the GPHYs. The bootloader don't
>> > expect the GPHYs in reset, as they aren't during power on.
>> >
>> > The asserts were a workaround for a wrong syscon-reboot mask. With a
>> > mask set which includes the GPHY resets, these resets aren't required
>> > any more.
>> >
>> > Fixes: 126534141b45 ("MIPS: lantiq: Add a GPHY driver which uses the RCU syscon-mfd")
>> > Cc: stable@vger.kernel.org # 4.14+
>> > Signed-off-by: Mathias Kresin <dev@kresin.me>
>>
>> Applied for 4.17. Thanks for the acks/reviews folk!
>
> drivers/soc/lantiq/gphy.c: In function ‘xway_gphy_remove’:
> drivers/soc/lantiq/gphy.c:198:6: warning: unused variable ‘ret’ [-Wunused-variable]
>   int ret;
>       ^~~
> drivers/soc/lantiq/gphy.c:196:17: warning: unused variable ‘dev’ [-Wunused-variable]
>   struct device *dev = &pdev->dev;
>                  ^~~
>
> Easily fixed, I can drop those two lines:
>
> diff --git a/drivers/soc/lantiq/gphy.c b/drivers/soc/lantiq/gphy.c
> index 8c31ae750987..feeb17cebc25 100644
> --- a/drivers/soc/lantiq/gphy.c
> +++ b/drivers/soc/lantiq/gphy.c
> @@ -193,9 +193,7 @@ static int xway_gphy_probe(struct platform_device *pdev)
>
>  static int xway_gphy_remove(struct platform_device *pdev)
>  {
> -       struct device *dev = &pdev->dev;
>         struct xway_gphy_priv *priv = platform_get_drvdata(pdev);
> -       int ret;
>
>         iowrite32be(0, priv->membase);
>
> However it does raise the question, it sounds like a fix, but was this
> patch tested and the warning just overlooked?

Yes the patch is tested. It is committed to OpenWrt on top of 4.14
since a while.

It is as simple as I didn't noticed the warnings.

Thanks a lot for fixing the warnings
Mathias

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-05-25 10:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-08  8:30 [PATCH] MIPS: lantiq: gphy: Drop reboot/remove reset asserts Mathias Kresin
2018-04-08 21:30 ` Martin Blumenstingl
2018-04-22 19:18 ` Hauke Mehrtens
2018-05-21 16:39 ` James Hogan
2018-05-24 12:07   ` James Hogan
2018-05-25 10:12     ` Mathias Kresin

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).