Lines Matching +full:sparx5 +full:- +full:cpu +full:- +full:syscon

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
9 #include <linux/mfd/syscon.h>
15 #include <linux/reset-controller.h>
42 regmap_update_bits(ctx->cpu_ctrl, ctx->props->protect_reg, in sparx5_switch_reset()
43 ctx->props->protect_bit, ctx->props->protect_bit); in sparx5_switch_reset()
46 regmap_write(ctx->gcb_ctrl, ctx->props->reset_reg, in sparx5_switch_reset()
47 ctx->props->reset_bit); in sparx5_switch_reset()
50 return regmap_read_poll_timeout(ctx->gcb_ctrl, ctx->props->reset_reg, val, in sparx5_switch_reset()
51 (val & ctx->props->reset_bit) == 0, in sparx5_switch_reset()
72 syscon_np = of_parse_phandle(pdev->dev.of_node, name, 0); in mchp_sparx5_map_syscon()
74 return -ENODEV; in mchp_sparx5_map_syscon()
79 dev_err(&pdev->dev, "No '%s' map: %d\n", name, err); in mchp_sparx5_map_syscon()
95 dev_err(&pdev->dev, "Could not map resource %d\n", index); in mchp_sparx5_map_io()
98 sparx5_reset_regmap_config.name = res->name; in mchp_sparx5_map_io()
99 map = devm_regmap_init_mmio(&pdev->dev, mem, &sparx5_reset_regmap_config); in mchp_sparx5_map_io()
108 struct device_node *dn = pdev->dev.of_node; in mchp_sparx5_reset_probe()
112 ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL); in mchp_sparx5_reset_probe()
114 return -ENOMEM; in mchp_sparx5_reset_probe()
116 err = mchp_sparx5_map_syscon(pdev, "cpu-syscon", &ctx->cpu_ctrl); in mchp_sparx5_reset_probe()
119 err = mchp_sparx5_map_io(pdev, 0, &ctx->gcb_ctrl); in mchp_sparx5_reset_probe()
123 ctx->rcdev.owner = THIS_MODULE; in mchp_sparx5_reset_probe()
124 ctx->rcdev.nr_resets = 1; in mchp_sparx5_reset_probe()
125 ctx->rcdev.ops = &sparx5_reset_ops; in mchp_sparx5_reset_probe()
126 ctx->rcdev.of_node = dn; in mchp_sparx5_reset_probe()
127 ctx->props = device_get_match_data(&pdev->dev); in mchp_sparx5_reset_probe()
134 return devm_reset_controller_register(&pdev->dev, &ctx->rcdev); in mchp_sparx5_reset_probe()
153 .compatible = "microchip,sparx5-switch-reset",
156 .compatible = "microchip,lan966x-switch-reset",
165 .name = "sparx5-switch-reset",
181 MODULE_DESCRIPTION("Microchip Sparx5 switch reset driver");