Lines Matching +full:xrx200 +full:- +full:reset
1 // SPDX-License-Identifier: GPL-2.0
13 #include <linux/reset-controller.h>
39 .name = "intel-reset",
47 * Reset status register offset relative to
48 * the reset control register(X) is X + 4
57 if (data->soc_data->legacy) in id_to_reg_and_bit_offsets()
62 if (data->soc_data->legacy && *rst_req == RCU_RST_REQ) in id_to_reg_and_bit_offsets()
78 ret = regmap_update_bits(data->regmap, rst_req, BIT(req_bit), val); in intel_set_clr_bits()
82 return regmap_read_poll_timeout(data->regmap, rst_stat, val, in intel_set_clr_bits()
95 dev_err(data->dev, "Reset assert failed %d\n", ret); in intel_assert_device()
108 dev_err(data->dev, "Reset deassert failed %d\n", ret); in intel_deassert_device()
122 ret = regmap_read(data->regmap, rst_stat, &val); in intel_reset_status()
141 if (spec->args[1] > 31) in intel_reset_xlate()
142 return -EINVAL; in intel_reset_xlate()
144 id = FIELD_PREP(REG_OFFSET_MASK, spec->args[0]); in intel_reset_xlate()
145 id |= FIELD_PREP(BIT_OFFSET_MASK, spec->args[1]); in intel_reset_xlate()
147 if (data->soc_data->legacy) { in intel_reset_xlate()
148 if (spec->args[2] > 31) in intel_reset_xlate()
149 return -EINVAL; in intel_reset_xlate()
151 id |= FIELD_PREP(STAT_BIT_OFFSET_MASK, spec->args[2]); in intel_reset_xlate()
163 intel_assert_device(&reset_data->rcdev, reset_data->reboot_id); in intel_reset_restart_handler()
170 struct device_node *np = pdev->dev.of_node; in intel_reset_probe()
171 struct device *dev = &pdev->dev; in intel_reset_probe()
179 return -ENOMEM; in intel_reset_probe()
181 data->soc_data = of_device_get_match_data(dev); in intel_reset_probe()
182 if (!data->soc_data) in intel_reset_probe()
183 return -ENODEV; in intel_reset_probe()
189 data->regmap = devm_regmap_init_mmio(dev, base, in intel_reset_probe()
191 if (IS_ERR(data->regmap)) { in intel_reset_probe()
193 return PTR_ERR(data->regmap); in intel_reset_probe()
196 ret = device_property_read_u32_array(dev, "intel,global-reset", rb_id, in intel_reset_probe()
197 data->soc_data->reset_cell_count); in intel_reset_probe()
199 dev_err(dev, "Failed to get global reset offset!\n"); in intel_reset_probe()
203 data->dev = dev; in intel_reset_probe()
204 data->rcdev.of_node = np; in intel_reset_probe()
205 data->rcdev.owner = dev->driver->owner; in intel_reset_probe()
206 data->rcdev.ops = &intel_reset_ops; in intel_reset_probe()
207 data->rcdev.of_xlate = intel_reset_xlate; in intel_reset_probe()
208 data->rcdev.of_reset_n_cells = data->soc_data->reset_cell_count; in intel_reset_probe()
209 ret = devm_reset_controller_register(&pdev->dev, &data->rcdev); in intel_reset_probe()
213 data->reboot_id = FIELD_PREP(REG_OFFSET_MASK, rb_id[0]); in intel_reset_probe()
214 data->reboot_id |= FIELD_PREP(BIT_OFFSET_MASK, rb_id[1]); in intel_reset_probe()
216 if (data->soc_data->legacy) in intel_reset_probe()
217 data->reboot_id |= FIELD_PREP(STAT_BIT_OFFSET_MASK, rb_id[2]); in intel_reset_probe()
219 data->restart_nb.notifier_call = intel_reset_restart_handler; in intel_reset_probe()
220 data->restart_nb.priority = 128; in intel_reset_probe()
221 register_restart_handler(&data->restart_nb); in intel_reset_probe()
237 { .compatible = "intel,rcu-lgm", .data = &lgm_data },
238 { .compatible = "intel,rcu-xrx200", .data = &xrx200_data },
245 .name = "intel-reset",
259 * specific devices to perform reset operation as part of initialization.