|
9 | 9 | #include <linux/iopoll.h>
|
10 | 10 | #include <linux/of.h>
|
11 | 11 | #include <linux/of_address.h>
|
| 12 | +#include <linux/platform_device.h> |
12 | 13 | #include <linux/reset-controller.h>
|
13 | 14 | #include <linux/smp.h>
|
14 | 15 | #include <asm/smp_plat.h>
|
@@ -81,11 +82,6 @@ static const struct reset_control_ops imx_src_ops = {
|
81 | 82 | .reset = imx_src_reset_module,
|
82 | 83 | };
|
83 | 84 |
|
84 |
| -static struct reset_controller_dev imx_reset_controller = { |
85 |
| - .ops = &imx_src_ops, |
86 |
| - .nr_resets = ARRAY_SIZE(sw_reset_bits), |
87 |
| -}; |
88 |
| - |
89 | 85 | static void imx_gpcv2_set_m_core_pgc(bool enable, u32 offset)
|
90 | 86 | {
|
91 | 87 | writel_relaxed(enable, gpc_base + offset);
|
@@ -177,10 +173,6 @@ void __init imx_src_init(void)
|
177 | 173 | src_base = of_iomap(np, 0);
|
178 | 174 | WARN_ON(!src_base);
|
179 | 175 |
|
180 |
| - imx_reset_controller.of_node = np; |
181 |
| - if (IS_ENABLED(CONFIG_RESET_CONTROLLER)) |
182 |
| - reset_controller_register(&imx_reset_controller); |
183 |
| - |
184 | 176 | /*
|
185 | 177 | * force warm reset sources to generate cold reset
|
186 | 178 | * for a more reliable restart
|
@@ -214,3 +206,33 @@ void __init imx7_src_init(void)
|
214 | 206 | if (!gpc_base)
|
215 | 207 | return;
|
216 | 208 | }
|
| 209 | + |
| 210 | +static const struct of_device_id imx_src_dt_ids[] = { |
| 211 | + { .compatible = "fsl,imx51-src" }, |
| 212 | + { /* sentinel */ } |
| 213 | +}; |
| 214 | + |
| 215 | +static int imx_src_probe(struct platform_device *pdev) |
| 216 | +{ |
| 217 | + struct reset_controller_dev *rcdev; |
| 218 | + |
| 219 | + rcdev = devm_kzalloc(&pdev->dev, sizeof(*rcdev), GFP_KERNEL); |
| 220 | + if (!rcdev) |
| 221 | + return -ENOMEM; |
| 222 | + |
| 223 | + rcdev->ops = &imx_src_ops; |
| 224 | + rcdev->dev = &pdev->dev; |
| 225 | + rcdev->of_node = pdev->dev.of_node; |
| 226 | + rcdev->nr_resets = ARRAY_SIZE(sw_reset_bits); |
| 227 | + |
| 228 | + return devm_reset_controller_register(&pdev->dev, rcdev); |
| 229 | +} |
| 230 | + |
| 231 | +static struct platform_driver imx_src_driver = { |
| 232 | + .driver = { |
| 233 | + .name = "imx-src", |
| 234 | + .of_match_table = imx_src_dt_ids, |
| 235 | + }, |
| 236 | + .probe = imx_src_probe, |
| 237 | +}; |
| 238 | +builtin_platform_driver(imx_src_driver); |
0 commit comments