Lines Matching +full:xrx200 +full:- +full:reset
1 // SPDX-License-Identifier: GPL-2.0-only
5 * Copyright (C) 2013-2015 Lantiq Beteiligungs-GmbH & Co.KG
7 * Copyright (C) 2017 Hauke Mehrtens <hauke@hauke-m.de>
13 #include <linux/reset-controller.h>
43 ret = regmap_read(priv->regmap, priv->status_offset, &val); in lantiq_rcu_reset_status()
63 } while (--retry); in lantiq_rcu_reset_status_timeout()
65 return -ETIMEDOUT; in lantiq_rcu_reset_status_timeout()
76 ret = regmap_update_bits(priv->regmap, priv->reset_offset, BIT(set), in lantiq_rcu_reset_update()
79 dev_err(priv->dev, "Failed to set reset bit %u\n", set); in lantiq_rcu_reset_update()
86 dev_err(priv->dev, "Failed to %s bit %u\n", in lantiq_rcu_reset_update()
120 .reset = lantiq_rcu_reset_reset,
126 struct device *dev = &pdev->dev; in lantiq_rcu_reset_of_parse()
129 priv->regmap = syscon_node_to_regmap(dev->of_node->parent); in lantiq_rcu_reset_of_parse()
130 if (IS_ERR(priv->regmap)) { in lantiq_rcu_reset_of_parse()
131 dev_err(&pdev->dev, "Failed to lookup RCU regmap\n"); in lantiq_rcu_reset_of_parse()
132 return PTR_ERR(priv->regmap); in lantiq_rcu_reset_of_parse()
135 offset = of_get_address(dev->of_node, 0, NULL, NULL); in lantiq_rcu_reset_of_parse()
137 dev_err(&pdev->dev, "Failed to get RCU reset offset\n"); in lantiq_rcu_reset_of_parse()
138 return -ENOENT; in lantiq_rcu_reset_of_parse()
140 priv->reset_offset = __be32_to_cpu(*offset); in lantiq_rcu_reset_of_parse()
142 offset = of_get_address(dev->of_node, 1, NULL, NULL); in lantiq_rcu_reset_of_parse()
144 dev_err(&pdev->dev, "Failed to get RCU status offset\n"); in lantiq_rcu_reset_of_parse()
145 return -ENOENT; in lantiq_rcu_reset_of_parse()
147 priv->status_offset = __be32_to_cpu(*offset); in lantiq_rcu_reset_of_parse()
157 set = reset_spec->args[0]; in lantiq_rcu_reset_xlate()
158 status = reset_spec->args[1]; in lantiq_rcu_reset_xlate()
160 if (set >= rcdev->nr_resets || status >= rcdev->nr_resets) in lantiq_rcu_reset_xlate()
161 return -EINVAL; in lantiq_rcu_reset_xlate()
171 priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); in lantiq_rcu_reset_probe()
173 return -ENOMEM; in lantiq_rcu_reset_probe()
175 priv->dev = &pdev->dev; in lantiq_rcu_reset_probe()
181 priv->rcdev.ops = &lantiq_rcu_reset_ops; in lantiq_rcu_reset_probe()
182 priv->rcdev.owner = THIS_MODULE; in lantiq_rcu_reset_probe()
183 priv->rcdev.of_node = pdev->dev.of_node; in lantiq_rcu_reset_probe()
184 priv->rcdev.nr_resets = 32; in lantiq_rcu_reset_probe()
185 priv->rcdev.of_xlate = lantiq_rcu_reset_xlate; in lantiq_rcu_reset_probe()
186 priv->rcdev.of_reset_n_cells = 2; in lantiq_rcu_reset_probe()
188 return devm_reset_controller_register(&pdev->dev, &priv->rcdev); in lantiq_rcu_reset_probe()
192 { .compatible = "lantiq,danube-reset", },
193 { .compatible = "lantiq,xrx200-reset", },
201 .name = "lantiq-reset",
208 MODULE_DESCRIPTION("Lantiq XWAY RCU Reset Controller Driver");