diff options
Diffstat (limited to 'drivers/clk/hisilicon/reset.c')
-rw-r--r-- | drivers/clk/hisilicon/reset.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/drivers/clk/hisilicon/reset.c b/drivers/clk/hisilicon/reset.c index 6aa49c2204d0..2a5015c736ce 100644 --- a/drivers/clk/hisilicon/reset.c +++ b/drivers/clk/hisilicon/reset.c | |||
@@ -19,6 +19,7 @@ | |||
19 | 19 | ||
20 | #include <linux/io.h> | 20 | #include <linux/io.h> |
21 | #include <linux/of_address.h> | 21 | #include <linux/of_address.h> |
22 | #include <linux/platform_device.h> | ||
22 | #include <linux/reset-controller.h> | 23 | #include <linux/reset-controller.h> |
23 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
24 | #include <linux/spinlock.h> | 25 | #include <linux/spinlock.h> |
@@ -98,25 +99,25 @@ static const struct reset_control_ops hisi_reset_ops = { | |||
98 | .deassert = hisi_reset_deassert, | 99 | .deassert = hisi_reset_deassert, |
99 | }; | 100 | }; |
100 | 101 | ||
101 | struct hisi_reset_controller *hisi_reset_init(struct device_node *np) | 102 | struct hisi_reset_controller *hisi_reset_init(struct platform_device *pdev) |
102 | { | 103 | { |
103 | struct hisi_reset_controller *rstc; | 104 | struct hisi_reset_controller *rstc; |
105 | struct resource *res; | ||
104 | 106 | ||
105 | rstc = kzalloc(sizeof(*rstc), GFP_KERNEL); | 107 | rstc = devm_kmalloc(&pdev->dev, sizeof(*rstc), GFP_KERNEL); |
106 | if (!rstc) | 108 | if (!rstc) |
107 | return NULL; | 109 | return NULL; |
108 | 110 | ||
109 | rstc->membase = of_iomap(np, 0); | 111 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
110 | if (!rstc->membase) { | 112 | rstc->membase = devm_ioremap(&pdev->dev, |
111 | kfree(rstc); | 113 | res->start, resource_size(res)); |
114 | if (!rstc->membase) | ||
112 | return NULL; | 115 | return NULL; |
113 | } | ||
114 | 116 | ||
115 | spin_lock_init(&rstc->lock); | 117 | spin_lock_init(&rstc->lock); |
116 | |||
117 | rstc->rcdev.owner = THIS_MODULE; | 118 | rstc->rcdev.owner = THIS_MODULE; |
118 | rstc->rcdev.ops = &hisi_reset_ops; | 119 | rstc->rcdev.ops = &hisi_reset_ops; |
119 | rstc->rcdev.of_node = np; | 120 | rstc->rcdev.of_node = pdev->dev.of_node; |
120 | rstc->rcdev.of_reset_n_cells = 2; | 121 | rstc->rcdev.of_reset_n_cells = 2; |
121 | rstc->rcdev.of_xlate = hisi_reset_of_xlate; | 122 | rstc->rcdev.of_xlate = hisi_reset_of_xlate; |
122 | reset_controller_register(&rstc->rcdev); | 123 | reset_controller_register(&rstc->rcdev); |
@@ -128,7 +129,5 @@ EXPORT_SYMBOL_GPL(hisi_reset_init); | |||
128 | void hisi_reset_exit(struct hisi_reset_controller *rstc) | 129 | void hisi_reset_exit(struct hisi_reset_controller *rstc) |
129 | { | 130 | { |
130 | reset_controller_unregister(&rstc->rcdev); | 131 | reset_controller_unregister(&rstc->rcdev); |
131 | iounmap(rstc->membase); | ||
132 | kfree(rstc); | ||
133 | } | 132 | } |
134 | EXPORT_SYMBOL_GPL(hisi_reset_exit); | 133 | EXPORT_SYMBOL_GPL(hisi_reset_exit); |