Lines Matching +full:sparx5 +full:- +full:switch +full:- +full:reset
1 // SPDX-License-Identifier: GPL-2.0+
2 /* Microchip Sparx5 Switch Reset driver
6 * The Sparx5 Chip Register Model can be browsed at this location:
7 * https://github.com/microchip-ung/sparx-5_reginfo
14 #include <linux/reset-controller.h>
40 /* Make sure the core is PROTECTED from reset */ in sparx5_switch_reset()
41 regmap_update_bits(ctx->cpu_ctrl, PROTECT_REG, PROTECT_BIT, PROTECT_BIT); in sparx5_switch_reset()
43 /* Start soft reset */ in sparx5_switch_reset()
44 regmap_write(ctx->gcb_ctrl, SOFT_RESET_REG, SOFT_RESET_BIT); in sparx5_switch_reset()
46 /* Wait for soft reset done */ in sparx5_switch_reset()
47 return regmap_read_poll_timeout(ctx->gcb_ctrl, SOFT_RESET_REG, val, in sparx5_switch_reset()
53 .reset = sparx5_switch_reset,
63 syscon_np = of_parse_phandle(pdev->dev.of_node, name, 0); in mchp_sparx5_map_syscon()
65 return -ENODEV; in mchp_sparx5_map_syscon()
70 dev_err(&pdev->dev, "No '%s' map: %d\n", name, err); in mchp_sparx5_map_syscon()
86 dev_err(&pdev->dev, "Could not map resource %d\n", index); in mchp_sparx5_map_io()
89 sparx5_reset_regmap_config.name = res->name; in mchp_sparx5_map_io()
90 map = devm_regmap_init_mmio(&pdev->dev, mem, &sparx5_reset_regmap_config); in mchp_sparx5_map_io()
99 struct device_node *dn = pdev->dev.of_node; in mchp_sparx5_reset_probe()
103 ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL); in mchp_sparx5_reset_probe()
105 return -ENOMEM; in mchp_sparx5_reset_probe()
107 err = mchp_sparx5_map_syscon(pdev, "cpu-syscon", &ctx->cpu_ctrl); in mchp_sparx5_reset_probe()
110 err = mchp_sparx5_map_io(pdev, 0, &ctx->gcb_ctrl); in mchp_sparx5_reset_probe()
114 ctx->rcdev.owner = THIS_MODULE; in mchp_sparx5_reset_probe()
115 ctx->rcdev.nr_resets = 1; in mchp_sparx5_reset_probe()
116 ctx->rcdev.ops = &sparx5_reset_ops; in mchp_sparx5_reset_probe()
117 ctx->rcdev.of_node = dn; in mchp_sparx5_reset_probe()
119 return devm_reset_controller_register(&pdev->dev, &ctx->rcdev); in mchp_sparx5_reset_probe()
124 .compatible = "microchip,sparx5-switch-reset",
132 .name = "sparx5-switch-reset",
144 MODULE_DESCRIPTION("Microchip Sparx5 switch reset driver");