mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-24 09:13:20 -05:00
reset: microchip-sparx5: issue a reset on startup
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 Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Link: https://lore.kernel.org/r/20220826115607.1148489-2-michael@walle.cc
This commit is contained in:
parent
051d9eb403
commit
51fd191422
1 changed files with 17 additions and 5 deletions
|
@ -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");
|
||||
|
|
Loading…
Add table
Reference in a new issue