Lines Matching +full:sparx5 +full:- +full:switch
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
16 #include <linux/reset-controller.h>
43 regmap_update_bits(ctx->cpu_ctrl, ctx->props->protect_reg, in sparx5_switch_reset()
44 ctx->props->protect_bit, ctx->props->protect_bit); in sparx5_switch_reset()
47 regmap_write(ctx->gcb_ctrl, ctx->props->reset_reg, in sparx5_switch_reset()
48 ctx->props->reset_bit); in sparx5_switch_reset()
51 return regmap_read_poll_timeout(ctx->gcb_ctrl, ctx->props->reset_reg, val, in sparx5_switch_reset()
52 (val & ctx->props->reset_bit) == 0, in sparx5_switch_reset()
89 return ERR_PTR(-ENOMEM); in mchp_lan966x_syscon_to_regmap()
91 regmap_config.max_register = resource_size(&res) - 4; in mchp_lan966x_syscon_to_regmap()
103 syscon_np = of_parse_phandle(pdev->dev.of_node, name, 0); in mchp_sparx5_map_syscon()
105 return -ENODEV; in mchp_sparx5_map_syscon()
109 * When used in LAN966x PCI device, the cpu-syscon device needs to be in mchp_sparx5_map_syscon()
114 if (of_device_is_compatible(pdev->dev.of_node, "microchip,lan966x-switch-reset")) in mchp_sparx5_map_syscon()
115 regmap = mchp_lan966x_syscon_to_regmap(&pdev->dev, syscon_np); in mchp_sparx5_map_syscon()
121 dev_err(&pdev->dev, "No '%s' map: %d\n", name, err); in mchp_sparx5_map_syscon()
137 dev_err(&pdev->dev, "Could not map resource %d\n", index); in mchp_sparx5_map_io()
140 sparx5_reset_regmap_config.name = res->name; in mchp_sparx5_map_io()
141 map = devm_regmap_init_mmio(&pdev->dev, mem, &sparx5_reset_regmap_config); in mchp_sparx5_map_io()
150 struct device_node *dn = pdev->dev.of_node; in mchp_sparx5_reset_probe()
154 ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL); in mchp_sparx5_reset_probe()
156 return -ENOMEM; in mchp_sparx5_reset_probe()
158 err = mchp_sparx5_map_syscon(pdev, "cpu-syscon", &ctx->cpu_ctrl); in mchp_sparx5_reset_probe()
161 err = mchp_sparx5_map_io(pdev, 0, &ctx->gcb_ctrl); in mchp_sparx5_reset_probe()
165 ctx->rcdev.owner = THIS_MODULE; in mchp_sparx5_reset_probe()
166 ctx->rcdev.dev = &pdev->dev; in mchp_sparx5_reset_probe()
167 ctx->rcdev.nr_resets = 1; in mchp_sparx5_reset_probe()
168 ctx->rcdev.ops = &sparx5_reset_ops; in mchp_sparx5_reset_probe()
169 ctx->rcdev.of_node = dn; in mchp_sparx5_reset_probe()
170 ctx->props = device_get_match_data(&pdev->dev); in mchp_sparx5_reset_probe()
177 return devm_reset_controller_register(&pdev->dev, &ctx->rcdev); in mchp_sparx5_reset_probe()
196 .compatible = "microchip,sparx5-switch-reset",
199 .compatible = "microchip,lan966x-switch-reset",
209 .name = "sparx5-switch-reset",
225 MODULE_DESCRIPTION("Microchip Sparx5 switch reset driver");