.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright (C) 2013-2015 Fujitsu Semiconductor Ltd. |
---|
3 | 4 | * Copyright (C) 2015 Linaro Ltd. |
---|
4 | 5 | * Author: Jassi Brar <jaswinder.singh@linaro.org> |
---|
5 | | - * |
---|
6 | | - * This program is free software: you can redistribute it and/or modify |
---|
7 | | - * it under the terms of the GNU General Public License as published by |
---|
8 | | - * the Free Software Foundation, version 2 of the License. |
---|
9 | | - * |
---|
10 | | - * This program is distributed in the hope that it will be useful, |
---|
11 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
12 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
13 | | - * GNU General Public License for more details. |
---|
14 | 6 | */ |
---|
15 | 7 | |
---|
16 | | -#include <linux/interrupt.h> |
---|
17 | | -#include <linux/spinlock.h> |
---|
18 | | -#include <linux/mutex.h> |
---|
19 | | -#include <linux/delay.h> |
---|
20 | | -#include <linux/slab.h> |
---|
21 | | -#include <linux/err.h> |
---|
22 | | -#include <linux/io.h> |
---|
23 | | -#include <linux/module.h> |
---|
24 | 8 | #include <linux/amba/bus.h> |
---|
| 9 | +#include <linux/device.h> |
---|
| 10 | +#include <linux/err.h> |
---|
| 11 | +#include <linux/interrupt.h> |
---|
| 12 | +#include <linux/io.h> |
---|
25 | 13 | #include <linux/mailbox_controller.h> |
---|
| 14 | +#include <linux/module.h> |
---|
26 | 15 | |
---|
27 | 16 | #define INTR_STAT_OFS 0x0 |
---|
28 | 17 | #define INTR_SET_OFS 0x8 |
---|
.. | .. |
---|
124 | 113 | struct device *dev = &adev->dev; |
---|
125 | 114 | int mhu_reg[MHU_CHANS] = {MHU_LP_OFFSET, MHU_HP_OFFSET, MHU_SEC_OFFSET}; |
---|
126 | 115 | |
---|
| 116 | + if (!of_device_is_compatible(dev->of_node, "arm,mhu")) |
---|
| 117 | + return -ENODEV; |
---|
| 118 | + |
---|
127 | 119 | /* Allocate memory for device */ |
---|
128 | 120 | mhu = devm_kzalloc(dev, sizeof(*mhu), GFP_KERNEL); |
---|
129 | 121 | if (!mhu) |
---|
.. | .. |
---|
152 | 144 | |
---|
153 | 145 | amba_set_drvdata(adev, mhu); |
---|
154 | 146 | |
---|
155 | | - err = mbox_controller_register(&mhu->mbox); |
---|
| 147 | + err = devm_mbox_controller_register(dev, &mhu->mbox); |
---|
156 | 148 | if (err) { |
---|
157 | 149 | dev_err(dev, "Failed to register mailboxes %d\n", err); |
---|
158 | 150 | return err; |
---|
159 | 151 | } |
---|
160 | 152 | |
---|
161 | 153 | dev_info(dev, "ARM MHU Mailbox registered\n"); |
---|
162 | | - return 0; |
---|
163 | | -} |
---|
164 | | - |
---|
165 | | -static int mhu_remove(struct amba_device *adev) |
---|
166 | | -{ |
---|
167 | | - struct arm_mhu *mhu = amba_get_drvdata(adev); |
---|
168 | | - |
---|
169 | | - mbox_controller_unregister(&mhu->mbox); |
---|
170 | | - |
---|
171 | 154 | return 0; |
---|
172 | 155 | } |
---|
173 | 156 | |
---|
.. | .. |
---|
186 | 169 | }, |
---|
187 | 170 | .id_table = mhu_ids, |
---|
188 | 171 | .probe = mhu_probe, |
---|
189 | | - .remove = mhu_remove, |
---|
190 | 172 | }; |
---|
191 | 173 | module_amba_driver(arm_mhu_driver); |
---|
192 | 174 | |
---|