* [PATCH 0/3] reset: microchip-sparx5: fix the broken switch reset
@ 2022-08-26 11:56 ` Michael Walle
0 siblings, 0 replies; 18+ messages in thread
From: Michael Walle @ 2022-08-26 11:56 UTC (permalink / raw)
To: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Rob Herring, Krzysztof Kozlowski, Lars Povlsen, Steen Hegelund,
Horatiu Vultur, Philipp Zabel
Cc: UNGLinuxDriver, netdev, devicetree, linux-arm-kernel,
linux-kernel, Michael Walle
The reset which is used by the switch to reset the switch core has many
different side effects. It is not just a switch reset. Thus don't treat it
as one, but just issue the reset early during boot.
Michael Walle (3):
reset: microchip-sparx5: issue a reset on startup
dt-bindings: net: sparx5: don't require a reset line
net: lan966x: make reset optional
.../bindings/net/microchip,sparx5-switch.yaml | 2 --
.../ethernet/microchip/lan966x/lan966x_main.c | 3 ++-
drivers/reset/reset-microchip-sparx5.c | 22 ++++++++++++++-----
3 files changed, 19 insertions(+), 8 deletions(-)
--
2.30.2
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 0/3] reset: microchip-sparx5: fix the broken switch reset
@ 2022-08-26 11:56 ` Michael Walle
0 siblings, 0 replies; 18+ messages in thread
From: Michael Walle @ 2022-08-26 11:56 UTC (permalink / raw)
To: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Rob Herring, Krzysztof Kozlowski, Lars Povlsen, Steen Hegelund,
Horatiu Vultur, Philipp Zabel
Cc: UNGLinuxDriver, netdev, devicetree, linux-arm-kernel,
linux-kernel, Michael Walle
The reset which is used by the switch to reset the switch core has many
different side effects. It is not just a switch reset. Thus don't treat it
as one, but just issue the reset early during boot.
Michael Walle (3):
reset: microchip-sparx5: issue a reset on startup
dt-bindings: net: sparx5: don't require a reset line
net: lan966x: make reset optional
.../bindings/net/microchip,sparx5-switch.yaml | 2 --
.../ethernet/microchip/lan966x/lan966x_main.c | 3 ++-
drivers/reset/reset-microchip-sparx5.c | 22 ++++++++++++++-----
3 files changed, 19 insertions(+), 8 deletions(-)
--
2.30.2
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 1/3] reset: microchip-sparx5: issue a reset on startup
2022-08-26 11:56 ` Michael Walle
@ 2022-08-26 11:56 ` Michael Walle
-1 siblings, 0 replies; 18+ messages in thread
From: Michael Walle @ 2022-08-26 11:56 UTC (permalink / raw)
To: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Rob Herring, Krzysztof Kozlowski, Lars Povlsen, Steen Hegelund,
Horatiu Vultur, Philipp Zabel
Cc: UNGLinuxDriver, netdev, devicetree, linux-arm-kernel,
linux-kernel, Michael Walle
Originally this was used in by the switch core driver to issue a reset.
But it turns out, this isn't just a switch core reset but instead it
will reset almost the complete SoC.
Instead of adding almost all devices of the SoC a shared reset line,
issue the reset once early on startup. Keep the reset controller for
backwards compatibility, but make the actual reset a noop.
Suggested-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Michael Walle <michael@walle.cc>
---
drivers/reset/reset-microchip-sparx5.c | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/drivers/reset/reset-microchip-sparx5.c b/drivers/reset/reset-microchip-sparx5.c
index 00b612a0effa..f3528dd1d084 100644
--- a/drivers/reset/reset-microchip-sparx5.c
+++ b/drivers/reset/reset-microchip-sparx5.c
@@ -33,11 +33,8 @@ static struct regmap_config sparx5_reset_regmap_config = {
.reg_stride = 4,
};
-static int sparx5_switch_reset(struct reset_controller_dev *rcdev,
- unsigned long id)
+static int sparx5_switch_reset(struct mchp_reset_context *ctx)
{
- struct mchp_reset_context *ctx =
- container_of(rcdev, struct mchp_reset_context, rcdev);
u32 val;
/* Make sure the core is PROTECTED from reset */
@@ -54,8 +51,14 @@ static int sparx5_switch_reset(struct reset_controller_dev *rcdev,
1, 100);
}
+static int sparx5_reset_noop(struct reset_controller_dev *rcdev,
+ unsigned long id)
+{
+ return 0;
+}
+
static const struct reset_control_ops sparx5_reset_ops = {
- .reset = sparx5_switch_reset,
+ .reset = sparx5_reset_noop,
};
static int mchp_sparx5_map_syscon(struct platform_device *pdev, char *name,
@@ -122,6 +125,11 @@ static int mchp_sparx5_reset_probe(struct platform_device *pdev)
ctx->rcdev.of_node = dn;
ctx->props = device_get_match_data(&pdev->dev);
+ /* Issue the reset very early, our actual reset callback is a noop. */
+ err = sparx5_switch_reset(ctx);
+ if (err)
+ return err;
+
return devm_reset_controller_register(&pdev->dev, &ctx->rcdev);
}
@@ -163,6 +171,10 @@ static int __init mchp_sparx5_reset_init(void)
return platform_driver_register(&mchp_sparx5_reset_driver);
}
+/*
+ * Because this is a global reset, keep this postcore_initcall() to issue the
+ * reset as early as possible during the kernel startup.
+ */
postcore_initcall(mchp_sparx5_reset_init);
MODULE_DESCRIPTION("Microchip Sparx5 switch reset driver");
--
2.30.2
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 1/3] reset: microchip-sparx5: issue a reset on startup
@ 2022-08-26 11:56 ` Michael Walle
0 siblings, 0 replies; 18+ messages in thread
From: Michael Walle @ 2022-08-26 11:56 UTC (permalink / raw)
To: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Rob Herring, Krzysztof Kozlowski, Lars Povlsen, Steen Hegelund,
Horatiu Vultur, Philipp Zabel
Cc: UNGLinuxDriver, netdev, devicetree, linux-arm-kernel,
linux-kernel, Michael Walle
Originally this was used in by the switch core driver to issue a reset.
But it turns out, this isn't just a switch core reset but instead it
will reset almost the complete SoC.
Instead of adding almost all devices of the SoC a shared reset line,
issue the reset once early on startup. Keep the reset controller for
backwards compatibility, but make the actual reset a noop.
Suggested-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Michael Walle <michael@walle.cc>
---
drivers/reset/reset-microchip-sparx5.c | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/drivers/reset/reset-microchip-sparx5.c b/drivers/reset/reset-microchip-sparx5.c
index 00b612a0effa..f3528dd1d084 100644
--- a/drivers/reset/reset-microchip-sparx5.c
+++ b/drivers/reset/reset-microchip-sparx5.c
@@ -33,11 +33,8 @@ static struct regmap_config sparx5_reset_regmap_config = {
.reg_stride = 4,
};
-static int sparx5_switch_reset(struct reset_controller_dev *rcdev,
- unsigned long id)
+static int sparx5_switch_reset(struct mchp_reset_context *ctx)
{
- struct mchp_reset_context *ctx =
- container_of(rcdev, struct mchp_reset_context, rcdev);
u32 val;
/* Make sure the core is PROTECTED from reset */
@@ -54,8 +51,14 @@ static int sparx5_switch_reset(struct reset_controller_dev *rcdev,
1, 100);
}
+static int sparx5_reset_noop(struct reset_controller_dev *rcdev,
+ unsigned long id)
+{
+ return 0;
+}
+
static const struct reset_control_ops sparx5_reset_ops = {
- .reset = sparx5_switch_reset,
+ .reset = sparx5_reset_noop,
};
static int mchp_sparx5_map_syscon(struct platform_device *pdev, char *name,
@@ -122,6 +125,11 @@ static int mchp_sparx5_reset_probe(struct platform_device *pdev)
ctx->rcdev.of_node = dn;
ctx->props = device_get_match_data(&pdev->dev);
+ /* Issue the reset very early, our actual reset callback is a noop. */
+ err = sparx5_switch_reset(ctx);
+ if (err)
+ return err;
+
return devm_reset_controller_register(&pdev->dev, &ctx->rcdev);
}
@@ -163,6 +171,10 @@ static int __init mchp_sparx5_reset_init(void)
return platform_driver_register(&mchp_sparx5_reset_driver);
}
+/*
+ * Because this is a global reset, keep this postcore_initcall() to issue the
+ * reset as early as possible during the kernel startup.
+ */
postcore_initcall(mchp_sparx5_reset_init);
MODULE_DESCRIPTION("Microchip Sparx5 switch reset driver");
--
2.30.2
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 2/3] dt-bindings: net: sparx5: don't require a reset line
2022-08-26 11:56 ` Michael Walle
@ 2022-08-26 11:56 ` Michael Walle
-1 siblings, 0 replies; 18+ messages in thread
From: Michael Walle @ 2022-08-26 11:56 UTC (permalink / raw)
To: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Rob Herring, Krzysztof Kozlowski, Lars Povlsen, Steen Hegelund,
Horatiu Vultur, Philipp Zabel
Cc: UNGLinuxDriver, netdev, devicetree, linux-arm-kernel,
linux-kernel, Michael Walle
Make the reset line optional. It turns out, there is no dedicated reset
for the switch. Instead, the reset which was used up until now, was kind
of a global reset. This is now handled elsewhere, thus don't require a
reset.
Signed-off-by: Michael Walle <michael@walle.cc>
---
.../devicetree/bindings/net/microchip,sparx5-switch.yaml | 2 --
1 file changed, 2 deletions(-)
diff --git a/Documentation/devicetree/bindings/net/microchip,sparx5-switch.yaml b/Documentation/devicetree/bindings/net/microchip,sparx5-switch.yaml
index 6c86d3d85e99..4a959639eb08 100644
--- a/Documentation/devicetree/bindings/net/microchip,sparx5-switch.yaml
+++ b/Documentation/devicetree/bindings/net/microchip,sparx5-switch.yaml
@@ -144,8 +144,6 @@ required:
- reg-names
- interrupts
- interrupt-names
- - resets
- - reset-names
- ethernet-ports
additionalProperties: false
--
2.30.2
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 2/3] dt-bindings: net: sparx5: don't require a reset line
@ 2022-08-26 11:56 ` Michael Walle
0 siblings, 0 replies; 18+ messages in thread
From: Michael Walle @ 2022-08-26 11:56 UTC (permalink / raw)
To: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Rob Herring, Krzysztof Kozlowski, Lars Povlsen, Steen Hegelund,
Horatiu Vultur, Philipp Zabel
Cc: UNGLinuxDriver, netdev, devicetree, linux-arm-kernel,
linux-kernel, Michael Walle
Make the reset line optional. It turns out, there is no dedicated reset
for the switch. Instead, the reset which was used up until now, was kind
of a global reset. This is now handled elsewhere, thus don't require a
reset.
Signed-off-by: Michael Walle <michael@walle.cc>
---
.../devicetree/bindings/net/microchip,sparx5-switch.yaml | 2 --
1 file changed, 2 deletions(-)
diff --git a/Documentation/devicetree/bindings/net/microchip,sparx5-switch.yaml b/Documentation/devicetree/bindings/net/microchip,sparx5-switch.yaml
index 6c86d3d85e99..4a959639eb08 100644
--- a/Documentation/devicetree/bindings/net/microchip,sparx5-switch.yaml
+++ b/Documentation/devicetree/bindings/net/microchip,sparx5-switch.yaml
@@ -144,8 +144,6 @@ required:
- reg-names
- interrupts
- interrupt-names
- - resets
- - reset-names
- ethernet-ports
additionalProperties: false
--
2.30.2
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 3/3] net: lan966x: make reset optional
2022-08-26 11:56 ` Michael Walle
@ 2022-08-26 11:56 ` Michael Walle
-1 siblings, 0 replies; 18+ messages in thread
From: Michael Walle @ 2022-08-26 11:56 UTC (permalink / raw)
To: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Rob Herring, Krzysztof Kozlowski, Lars Povlsen, Steen Hegelund,
Horatiu Vultur, Philipp Zabel
Cc: UNGLinuxDriver, netdev, devicetree, linux-arm-kernel,
linux-kernel, Michael Walle
There is no dedicated reset for just the switch core. The reset which
is used up until now, is more of a global reset, resetting almost the
whole SoC and cause spurious errors by doing so. Make it possible to
handle the reset elsewhere and mark the reset as optional.
Signed-off-by: Michael Walle <michael@walle.cc>
---
drivers/net/ethernet/microchip/lan966x/lan966x_main.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c b/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
index 2ad078608c45..e2c77f954a3d 100644
--- a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
+++ b/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
@@ -971,7 +971,8 @@ static int lan966x_reset_switch(struct lan966x *lan966x)
int val = 0;
int ret;
- switch_reset = devm_reset_control_get_shared(lan966x->dev, "switch");
+ switch_reset = devm_reset_control_get_optional_shared(lan966x->dev,
+ "switch");
if (IS_ERR(switch_reset))
return dev_err_probe(lan966x->dev, PTR_ERR(switch_reset),
"Could not obtain switch reset");
--
2.30.2
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 3/3] net: lan966x: make reset optional
@ 2022-08-26 11:56 ` Michael Walle
0 siblings, 0 replies; 18+ messages in thread
From: Michael Walle @ 2022-08-26 11:56 UTC (permalink / raw)
To: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Rob Herring, Krzysztof Kozlowski, Lars Povlsen, Steen Hegelund,
Horatiu Vultur, Philipp Zabel
Cc: UNGLinuxDriver, netdev, devicetree, linux-arm-kernel,
linux-kernel, Michael Walle
There is no dedicated reset for just the switch core. The reset which
is used up until now, is more of a global reset, resetting almost the
whole SoC and cause spurious errors by doing so. Make it possible to
handle the reset elsewhere and mark the reset as optional.
Signed-off-by: Michael Walle <michael@walle.cc>
---
drivers/net/ethernet/microchip/lan966x/lan966x_main.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c b/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
index 2ad078608c45..e2c77f954a3d 100644
--- a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
+++ b/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
@@ -971,7 +971,8 @@ static int lan966x_reset_switch(struct lan966x *lan966x)
int val = 0;
int ret;
- switch_reset = devm_reset_control_get_shared(lan966x->dev, "switch");
+ switch_reset = devm_reset_control_get_optional_shared(lan966x->dev,
+ "switch");
if (IS_ERR(switch_reset))
return dev_err_probe(lan966x->dev, PTR_ERR(switch_reset),
"Could not obtain switch reset");
--
2.30.2
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [PATCH 2/3] dt-bindings: net: sparx5: don't require a reset line
2022-08-26 11:56 ` Michael Walle
@ 2022-08-26 17:41 ` Krzysztof Kozlowski
-1 siblings, 0 replies; 18+ messages in thread
From: Krzysztof Kozlowski @ 2022-08-26 17:41 UTC (permalink / raw)
To: Michael Walle, David S . Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Lars Povlsen,
Steen Hegelund, Horatiu Vultur, Philipp Zabel
Cc: UNGLinuxDriver, netdev, devicetree, linux-arm-kernel, linux-kernel
On 26/08/2022 14:56, Michael Walle wrote:
> Make the reset line optional. It turns out, there is no dedicated reset
> for the switch. Instead, the reset which was used up until now, was kind
> of a global reset. This is now handled elsewhere, thus don't require a
> reset.
>
> Signed-off-by: Michael Walle <michael@walle.cc>
> ---
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 2/3] dt-bindings: net: sparx5: don't require a reset line
@ 2022-08-26 17:41 ` Krzysztof Kozlowski
0 siblings, 0 replies; 18+ messages in thread
From: Krzysztof Kozlowski @ 2022-08-26 17:41 UTC (permalink / raw)
To: Michael Walle, David S . Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Lars Povlsen,
Steen Hegelund, Horatiu Vultur, Philipp Zabel
Cc: UNGLinuxDriver, netdev, devicetree, linux-arm-kernel, linux-kernel
On 26/08/2022 14:56, Michael Walle wrote:
> Make the reset line optional. It turns out, there is no dedicated reset
> for the switch. Instead, the reset which was used up until now, was kind
> of a global reset. This is now handled elsewhere, thus don't require a
> reset.
>
> Signed-off-by: Michael Walle <michael@walle.cc>
> ---
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Best regards,
Krzysztof
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 1/3] reset: microchip-sparx5: issue a reset on startup
2022-08-26 11:56 ` Michael Walle
@ 2022-08-29 9:14 ` Steen Hegelund
-1 siblings, 0 replies; 18+ messages in thread
From: Steen Hegelund @ 2022-08-29 9:14 UTC (permalink / raw)
To: Michael Walle, David S . Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Lars Povlsen,
Horatiu Vultur, Philipp Zabel
Cc: UNGLinuxDriver, netdev, devicetree, linux-arm-kernel, linux-kernel
Hi Michael,
On Fri, 2022-08-26 at 13:56 +0200, Michael Walle wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>
> Originally this was used in by the switch core driver to issue a reset.
> But it turns out, this isn't just a switch core reset but instead it
> will reset almost the complete SoC.
>
> Instead of adding almost all devices of the SoC a shared reset line,
> issue the reset once early on startup. Keep the reset controller for
> backwards compatibility, but make the actual reset a noop.
>
> Suggested-by: Philipp Zabel <p.zabel@pengutronix.de>
> Signed-off-by: Michael Walle <michael@walle.cc>
> ---
> drivers/reset/reset-microchip-sparx5.c | 22 +++++++++++++++++-----
> 1 file changed, 17 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/reset/reset-microchip-sparx5.c b/drivers/reset/reset-microchip-sparx5.c
> index 00b612a0effa..f3528dd1d084 100644
> --- a/drivers/reset/reset-microchip-sparx5.c
> +++ b/drivers/reset/reset-microchip-sparx5.c
> @@ -33,11 +33,8 @@ static struct regmap_config sparx5_reset_regmap_config = {
> .reg_stride = 4,
> };
>
> -static int sparx5_switch_reset(struct reset_controller_dev *rcdev,
> - unsigned long id)
> +static int sparx5_switch_reset(struct mchp_reset_context *ctx)
> {
> - struct mchp_reset_context *ctx =
> - container_of(rcdev, struct mchp_reset_context, rcdev);
> u32 val;
>
> /* Make sure the core is PROTECTED from reset */
> @@ -54,8 +51,14 @@ static int sparx5_switch_reset(struct reset_controller_dev *rcdev,
> 1, 100);
> }
>
> +static int sparx5_reset_noop(struct reset_controller_dev *rcdev,
> + unsigned long id)
> +{
> + return 0;
> +}
> +
> static const struct reset_control_ops sparx5_reset_ops = {
> - .reset = sparx5_switch_reset,
> + .reset = sparx5_reset_noop,
> };
>
> static int mchp_sparx5_map_syscon(struct platform_device *pdev, char *name,
> @@ -122,6 +125,11 @@ static int mchp_sparx5_reset_probe(struct platform_device *pdev)
> ctx->rcdev.of_node = dn;
> ctx->props = device_get_match_data(&pdev->dev);
>
> + /* Issue the reset very early, our actual reset callback is a noop. */
> + err = sparx5_switch_reset(ctx);
> + if (err)
> + return err;
> +
> return devm_reset_controller_register(&pdev->dev, &ctx->rcdev);
> }
>
> @@ -163,6 +171,10 @@ static int __init mchp_sparx5_reset_init(void)
> return platform_driver_register(&mchp_sparx5_reset_driver);
> }
>
> +/*
> + * Because this is a global reset, keep this postcore_initcall() to issue the
> + * reset as early as possible during the kernel startup.
> + */
> postcore_initcall(mchp_sparx5_reset_init);
>
> MODULE_DESCRIPTION("Microchip Sparx5 switch reset driver");
> --
> 2.30.2
>
Tested-by: Steen Hegelund <Steen.Hegelund@microchip.com> on Sparx5
BR
Steen
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 1/3] reset: microchip-sparx5: issue a reset on startup
@ 2022-08-29 9:14 ` Steen Hegelund
0 siblings, 0 replies; 18+ messages in thread
From: Steen Hegelund @ 2022-08-29 9:14 UTC (permalink / raw)
To: Michael Walle, David S . Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Lars Povlsen,
Horatiu Vultur, Philipp Zabel
Cc: UNGLinuxDriver, netdev, devicetree, linux-arm-kernel, linux-kernel
Hi Michael,
On Fri, 2022-08-26 at 13:56 +0200, Michael Walle wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>
> Originally this was used in by the switch core driver to issue a reset.
> But it turns out, this isn't just a switch core reset but instead it
> will reset almost the complete SoC.
>
> Instead of adding almost all devices of the SoC a shared reset line,
> issue the reset once early on startup. Keep the reset controller for
> backwards compatibility, but make the actual reset a noop.
>
> Suggested-by: Philipp Zabel <p.zabel@pengutronix.de>
> Signed-off-by: Michael Walle <michael@walle.cc>
> ---
> drivers/reset/reset-microchip-sparx5.c | 22 +++++++++++++++++-----
> 1 file changed, 17 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/reset/reset-microchip-sparx5.c b/drivers/reset/reset-microchip-sparx5.c
> index 00b612a0effa..f3528dd1d084 100644
> --- a/drivers/reset/reset-microchip-sparx5.c
> +++ b/drivers/reset/reset-microchip-sparx5.c
> @@ -33,11 +33,8 @@ static struct regmap_config sparx5_reset_regmap_config = {
> .reg_stride = 4,
> };
>
> -static int sparx5_switch_reset(struct reset_controller_dev *rcdev,
> - unsigned long id)
> +static int sparx5_switch_reset(struct mchp_reset_context *ctx)
> {
> - struct mchp_reset_context *ctx =
> - container_of(rcdev, struct mchp_reset_context, rcdev);
> u32 val;
>
> /* Make sure the core is PROTECTED from reset */
> @@ -54,8 +51,14 @@ static int sparx5_switch_reset(struct reset_controller_dev *rcdev,
> 1, 100);
> }
>
> +static int sparx5_reset_noop(struct reset_controller_dev *rcdev,
> + unsigned long id)
> +{
> + return 0;
> +}
> +
> static const struct reset_control_ops sparx5_reset_ops = {
> - .reset = sparx5_switch_reset,
> + .reset = sparx5_reset_noop,
> };
>
> static int mchp_sparx5_map_syscon(struct platform_device *pdev, char *name,
> @@ -122,6 +125,11 @@ static int mchp_sparx5_reset_probe(struct platform_device *pdev)
> ctx->rcdev.of_node = dn;
> ctx->props = device_get_match_data(&pdev->dev);
>
> + /* Issue the reset very early, our actual reset callback is a noop. */
> + err = sparx5_switch_reset(ctx);
> + if (err)
> + return err;
> +
> return devm_reset_controller_register(&pdev->dev, &ctx->rcdev);
> }
>
> @@ -163,6 +171,10 @@ static int __init mchp_sparx5_reset_init(void)
> return platform_driver_register(&mchp_sparx5_reset_driver);
> }
>
> +/*
> + * Because this is a global reset, keep this postcore_initcall() to issue the
> + * reset as early as possible during the kernel startup.
> + */
> postcore_initcall(mchp_sparx5_reset_init);
>
> MODULE_DESCRIPTION("Microchip Sparx5 switch reset driver");
> --
> 2.30.2
>
Tested-by: Steen Hegelund <Steen.Hegelund@microchip.com> on Sparx5
BR
Steen
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 1/3] reset: microchip-sparx5: issue a reset on startup
2022-08-29 9:14 ` Steen Hegelund
@ 2022-08-29 9:22 ` Michael Walle
-1 siblings, 0 replies; 18+ messages in thread
From: Michael Walle @ 2022-08-29 9:22 UTC (permalink / raw)
To: Steen Hegelund
Cc: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Rob Herring, Krzysztof Kozlowski, Lars Povlsen, Horatiu Vultur,
Philipp Zabel, UNGLinuxDriver, netdev, devicetree,
linux-arm-kernel, linux-kernel
Hi Steen,
Am 2022-08-29 11:14, schrieb Steen Hegelund:
> On Fri, 2022-08-26 at 13:56 +0200, Michael Walle wrote:
>> EXTERNAL EMAIL: Do not click links or open attachments unless you know
>> the content is safe
>>
>> Originally this was used in by the switch core driver to issue a
>> reset.
>> But it turns out, this isn't just a switch core reset but instead it
>> will reset almost the complete SoC.
>>
>> Instead of adding almost all devices of the SoC a shared reset line,
>> issue the reset once early on startup. Keep the reset controller for
>> backwards compatibility, but make the actual reset a noop.
>>
>> Suggested-by: Philipp Zabel <p.zabel@pengutronix.de>
>> Signed-off-by: Michael Walle <michael@walle.cc>
..
> Tested-by: Steen Hegelund <Steen.Hegelund@microchip.com> on Sparx5
Thanks for testing!
-michael
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 1/3] reset: microchip-sparx5: issue a reset on startup
@ 2022-08-29 9:22 ` Michael Walle
0 siblings, 0 replies; 18+ messages in thread
From: Michael Walle @ 2022-08-29 9:22 UTC (permalink / raw)
To: Steen Hegelund
Cc: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Rob Herring, Krzysztof Kozlowski, Lars Povlsen, Horatiu Vultur,
Philipp Zabel, UNGLinuxDriver, netdev, devicetree,
linux-arm-kernel, linux-kernel
Hi Steen,
Am 2022-08-29 11:14, schrieb Steen Hegelund:
> On Fri, 2022-08-26 at 13:56 +0200, Michael Walle wrote:
>> EXTERNAL EMAIL: Do not click links or open attachments unless you know
>> the content is safe
>>
>> Originally this was used in by the switch core driver to issue a
>> reset.
>> But it turns out, this isn't just a switch core reset but instead it
>> will reset almost the complete SoC.
>>
>> Instead of adding almost all devices of the SoC a shared reset line,
>> issue the reset once early on startup. Keep the reset controller for
>> backwards compatibility, but make the actual reset a noop.
>>
>> Suggested-by: Philipp Zabel <p.zabel@pengutronix.de>
>> Signed-off-by: Michael Walle <michael@walle.cc>
..
> Tested-by: Steen Hegelund <Steen.Hegelund@microchip.com> on Sparx5
Thanks for testing!
-michael
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 0/3] reset: microchip-sparx5: fix the broken switch reset
2022-08-26 11:56 ` Michael Walle
@ 2022-08-29 11:43 ` Michael Walle
-1 siblings, 0 replies; 18+ messages in thread
From: Michael Walle @ 2022-08-29 11:43 UTC (permalink / raw)
To: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Rob Herring, Krzysztof Kozlowski, Lars Povlsen, Steen Hegelund,
Horatiu Vultur, Philipp Zabel
Cc: UNGLinuxDriver, netdev, devicetree, linux-arm-kernel, linux-kernel
Am 2022-08-26 13:56, schrieb Michael Walle:
> The reset which is used by the switch to reset the switch core has many
> different side effects. It is not just a switch reset. Thus don't treat
> it
> as one, but just issue the reset early during boot.
>
> Michael Walle (3):
> reset: microchip-sparx5: issue a reset on startup
> dt-bindings: net: sparx5: don't require a reset line
> net: lan966x: make reset optional
>
> .../bindings/net/microchip,sparx5-switch.yaml | 2 --
> .../ethernet/microchip/lan966x/lan966x_main.c | 3 ++-
> drivers/reset/reset-microchip-sparx5.c | 22 ++++++++++++++-----
> 3 files changed, 19 insertions(+), 8 deletions(-)
Philipp, you could just patch #1, I guess. I'd then
resend patches #2 and #3 to the netdev ML targetting net-next.
As long as the device tree itself isn't changed, there should
be no dependency between these two.
-michael
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 0/3] reset: microchip-sparx5: fix the broken switch reset
@ 2022-08-29 11:43 ` Michael Walle
0 siblings, 0 replies; 18+ messages in thread
From: Michael Walle @ 2022-08-29 11:43 UTC (permalink / raw)
To: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Rob Herring, Krzysztof Kozlowski, Lars Povlsen, Steen Hegelund,
Horatiu Vultur, Philipp Zabel
Cc: UNGLinuxDriver, netdev, devicetree, linux-arm-kernel, linux-kernel
Am 2022-08-26 13:56, schrieb Michael Walle:
> The reset which is used by the switch to reset the switch core has many
> different side effects. It is not just a switch reset. Thus don't treat
> it
> as one, but just issue the reset early during boot.
>
> Michael Walle (3):
> reset: microchip-sparx5: issue a reset on startup
> dt-bindings: net: sparx5: don't require a reset line
> net: lan966x: make reset optional
>
> .../bindings/net/microchip,sparx5-switch.yaml | 2 --
> .../ethernet/microchip/lan966x/lan966x_main.c | 3 ++-
> drivers/reset/reset-microchip-sparx5.c | 22 ++++++++++++++-----
> 3 files changed, 19 insertions(+), 8 deletions(-)
Philipp, you could just patch #1, I guess. I'd then
resend patches #2 and #3 to the netdev ML targetting net-next.
As long as the device tree itself isn't changed, there should
be no dependency between these two.
-michael
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 1/3] reset: microchip-sparx5: issue a reset on startup
2022-08-26 11:56 ` Michael Walle
@ 2022-08-30 16:46 ` Philipp Zabel
-1 siblings, 0 replies; 18+ messages in thread
From: Philipp Zabel @ 2022-08-30 16:46 UTC (permalink / raw)
To: Michael Walle, David S . Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Lars Povlsen,
Steen Hegelund, Horatiu Vultur
Cc: UNGLinuxDriver, netdev, devicetree, linux-arm-kernel, linux-kernel
On Fr, 2022-08-26 at 13:56 +0200, Michael Walle wrote:
> Originally this was used in by the switch core driver to issue a reset.
> But it turns out, this isn't just a switch core reset but instead it
> will reset almost the complete SoC.
>
> Instead of adding almost all devices of the SoC a shared reset line,
> issue the reset once early on startup. Keep the reset controller for
> backwards compatibility, but make the actual reset a noop.
>
> Suggested-by: Philipp Zabel <p.zabel@pengutronix.de>
> Signed-off-by: Michael Walle <michael@walle.cc>
I've applied this patch to the reset/fixes branch.
regards
Philipp
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 1/3] reset: microchip-sparx5: issue a reset on startup
@ 2022-08-30 16:46 ` Philipp Zabel
0 siblings, 0 replies; 18+ messages in thread
From: Philipp Zabel @ 2022-08-30 16:46 UTC (permalink / raw)
To: Michael Walle, David S . Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Lars Povlsen,
Steen Hegelund, Horatiu Vultur
Cc: UNGLinuxDriver, netdev, devicetree, linux-arm-kernel, linux-kernel
On Fr, 2022-08-26 at 13:56 +0200, Michael Walle wrote:
> Originally this was used in by the switch core driver to issue a reset.
> But it turns out, this isn't just a switch core reset but instead it
> will reset almost the complete SoC.
>
> Instead of adding almost all devices of the SoC a shared reset line,
> issue the reset once early on startup. Keep the reset controller for
> backwards compatibility, but make the actual reset a noop.
>
> Suggested-by: Philipp Zabel <p.zabel@pengutronix.de>
> Signed-off-by: Michael Walle <michael@walle.cc>
I've applied this patch to the reset/fixes branch.
regards
Philipp
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2022-08-30 16:48 UTC | newest]
Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-26 11:56 [PATCH 0/3] reset: microchip-sparx5: fix the broken switch reset Michael Walle
2022-08-26 11:56 ` Michael Walle
2022-08-26 11:56 ` [PATCH 1/3] reset: microchip-sparx5: issue a reset on startup Michael Walle
2022-08-26 11:56 ` Michael Walle
2022-08-29 9:14 ` Steen Hegelund
2022-08-29 9:14 ` Steen Hegelund
2022-08-29 9:22 ` Michael Walle
2022-08-29 9:22 ` Michael Walle
2022-08-30 16:46 ` Philipp Zabel
2022-08-30 16:46 ` Philipp Zabel
2022-08-26 11:56 ` [PATCH 2/3] dt-bindings: net: sparx5: don't require a reset line Michael Walle
2022-08-26 11:56 ` Michael Walle
2022-08-26 17:41 ` Krzysztof Kozlowski
2022-08-26 17:41 ` Krzysztof Kozlowski
2022-08-26 11:56 ` [PATCH 3/3] net: lan966x: make reset optional Michael Walle
2022-08-26 11:56 ` Michael Walle
2022-08-29 11:43 ` [PATCH 0/3] reset: microchip-sparx5: fix the broken switch reset Michael Walle
2022-08-29 11:43 ` Michael Walle
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.