Thomas Gleixner | d2912cb | 2019-06-04 10:11:33 +0200 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0-only |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | /* |
| 3 | * linux/arch/arm/common/amba.c |
| 4 | * |
| 5 | * Copyright (C) 2003 Deep Blue Solutions Ltd, All Rights Reserved. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6 | */ |
| 7 | #include <linux/module.h> |
| 8 | #include <linux/init.h> |
| 9 | #include <linux/device.h> |
Tim Schmielau | 4e57b68 | 2005-10-30 15:03:48 -0800 | [diff] [blame] | 10 | #include <linux/string.h> |
| 11 | #include <linux/slab.h> |
Russell King | 934848d | 2009-01-08 09:58:51 +0000 | [diff] [blame] | 12 | #include <linux/io.h> |
Rabin Vincent | ba74ec7 | 2011-02-23 04:33:17 +0100 | [diff] [blame] | 13 | #include <linux/pm.h> |
| 14 | #include <linux/pm_runtime.h> |
Ulf Hansson | f48c767 | 2014-09-29 13:58:47 +0200 | [diff] [blame] | 15 | #include <linux/pm_domain.h> |
Russell King | a62c80e | 2006-01-07 13:52:45 +0000 | [diff] [blame] | 16 | #include <linux/amba/bus.h> |
Alessandro Rubini | a875cfb | 2012-06-24 12:46:16 +0100 | [diff] [blame] | 17 | #include <linux/sizes.h> |
Antonios Motakis | 3cf3857 | 2015-01-06 11:15:11 +0100 | [diff] [blame] | 18 | #include <linux/limits.h> |
Stephen Boyd | bcd3006 | 2016-08-10 20:17:34 +0100 | [diff] [blame] | 19 | #include <linux/clk/clk-conf.h> |
Nipun Gupta | 07397df | 2018-04-28 08:21:58 +0530 | [diff] [blame] | 20 | #include <linux/platform_device.h> |
DINH L NGUYEN | 79bdcb20 | 2019-09-04 02:13:08 +0100 | [diff] [blame] | 21 | #include <linux/reset.h> |
Wang Kefeng | 854f695 | 2021-08-23 10:41:43 +0100 | [diff] [blame^] | 22 | #include <linux/of_irq.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 23 | |
Russell King | 934848d | 2009-01-08 09:58:51 +0000 | [diff] [blame] | 24 | #include <asm/irq.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 25 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | #define to_amba_driver(d) container_of(d, struct amba_driver, drv) |
| 27 | |
Mike Leach | 4a2910f | 2019-02-13 14:41:50 +0100 | [diff] [blame] | 28 | /* called on periphid match and class 0x9 coresight device. */ |
| 29 | static int |
| 30 | amba_cs_uci_id_match(const struct amba_id *table, struct amba_device *dev) |
| 31 | { |
| 32 | int ret = 0; |
| 33 | struct amba_cs_uci_id *uci; |
| 34 | |
| 35 | uci = table->data; |
| 36 | |
| 37 | /* no table data or zero mask - return match on periphid */ |
| 38 | if (!uci || (uci->devarch_mask == 0)) |
| 39 | return 1; |
| 40 | |
| 41 | /* test against read devtype and masked devarch value */ |
| 42 | ret = (dev->uci.devtype == uci->devtype) && |
| 43 | ((dev->uci.devarch & uci->devarch_mask) == uci->devarch); |
| 44 | return ret; |
| 45 | } |
| 46 | |
Russell King | c862aab | 2011-02-19 15:55:26 +0000 | [diff] [blame] | 47 | static const struct amba_id * |
| 48 | amba_lookup(const struct amba_id *table, struct amba_device *dev) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 49 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 50 | while (table->mask) { |
Mike Leach | 4a2910f | 2019-02-13 14:41:50 +0100 | [diff] [blame] | 51 | if (((dev->periphid & table->mask) == table->id) && |
| 52 | ((dev->cid != CORESIGHT_CID) || |
| 53 | (amba_cs_uci_id_match(table, dev)))) |
| 54 | return table; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 55 | table++; |
| 56 | } |
Mike Leach | 4a2910f | 2019-02-13 14:41:50 +0100 | [diff] [blame] | 57 | return NULL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 58 | } |
| 59 | |
Uwe Kleine-König | 5150a8f | 2021-01-26 17:58:32 +0100 | [diff] [blame] | 60 | static int amba_get_enable_pclk(struct amba_device *pcdev) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 61 | { |
Uwe Kleine-König | 5150a8f | 2021-01-26 17:58:32 +0100 | [diff] [blame] | 62 | int ret; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 63 | |
Uwe Kleine-König | 5150a8f | 2021-01-26 17:58:32 +0100 | [diff] [blame] | 64 | pcdev->pclk = clk_get(&pcdev->dev, "apb_pclk"); |
| 65 | if (IS_ERR(pcdev->pclk)) |
| 66 | return PTR_ERR(pcdev->pclk); |
Antonios Motakis | 3cf3857 | 2015-01-06 11:15:11 +0100 | [diff] [blame] | 67 | |
Uwe Kleine-König | 5150a8f | 2021-01-26 17:58:32 +0100 | [diff] [blame] | 68 | ret = clk_prepare_enable(pcdev->pclk); |
| 69 | if (ret) |
| 70 | clk_put(pcdev->pclk); |
| 71 | |
| 72 | return ret; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 73 | } |
| 74 | |
Uwe Kleine-König | 5150a8f | 2021-01-26 17:58:32 +0100 | [diff] [blame] | 75 | static void amba_put_disable_pclk(struct amba_device *pcdev) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 76 | { |
Uwe Kleine-König | 5150a8f | 2021-01-26 17:58:32 +0100 | [diff] [blame] | 77 | clk_disable_unprepare(pcdev->pclk); |
| 78 | clk_put(pcdev->pclk); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 79 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 80 | |
Uwe Kleine-König | 5150a8f | 2021-01-26 17:58:32 +0100 | [diff] [blame] | 81 | |
Antonios Motakis | 3cf3857 | 2015-01-06 11:15:11 +0100 | [diff] [blame] | 82 | static ssize_t driver_override_show(struct device *_dev, |
| 83 | struct device_attribute *attr, char *buf) |
| 84 | { |
| 85 | struct amba_device *dev = to_amba_device(_dev); |
Geert Uytterhoeven | 6a7228d | 2018-04-10 15:21:44 +0200 | [diff] [blame] | 86 | ssize_t len; |
Antonios Motakis | 3cf3857 | 2015-01-06 11:15:11 +0100 | [diff] [blame] | 87 | |
Geert Uytterhoeven | 6a7228d | 2018-04-10 15:21:44 +0200 | [diff] [blame] | 88 | device_lock(_dev); |
| 89 | len = sprintf(buf, "%s\n", dev->driver_override); |
| 90 | device_unlock(_dev); |
| 91 | return len; |
Antonios Motakis | 3cf3857 | 2015-01-06 11:15:11 +0100 | [diff] [blame] | 92 | } |
| 93 | |
| 94 | static ssize_t driver_override_store(struct device *_dev, |
| 95 | struct device_attribute *attr, |
| 96 | const char *buf, size_t count) |
| 97 | { |
| 98 | struct amba_device *dev = to_amba_device(_dev); |
Geert Uytterhoeven | 6a7228d | 2018-04-10 15:21:44 +0200 | [diff] [blame] | 99 | char *driver_override, *old, *cp; |
Antonios Motakis | 3cf3857 | 2015-01-06 11:15:11 +0100 | [diff] [blame] | 100 | |
Geert Uytterhoeven | d2ffed5 | 2018-04-10 15:21:45 +0200 | [diff] [blame] | 101 | /* We need to keep extra room for a newline */ |
| 102 | if (count >= (PAGE_SIZE - 1)) |
Antonios Motakis | 3cf3857 | 2015-01-06 11:15:11 +0100 | [diff] [blame] | 103 | return -EINVAL; |
| 104 | |
| 105 | driver_override = kstrndup(buf, count, GFP_KERNEL); |
| 106 | if (!driver_override) |
| 107 | return -ENOMEM; |
| 108 | |
| 109 | cp = strchr(driver_override, '\n'); |
| 110 | if (cp) |
| 111 | *cp = '\0'; |
| 112 | |
Geert Uytterhoeven | 6a7228d | 2018-04-10 15:21:44 +0200 | [diff] [blame] | 113 | device_lock(_dev); |
| 114 | old = dev->driver_override; |
Antonios Motakis | 3cf3857 | 2015-01-06 11:15:11 +0100 | [diff] [blame] | 115 | if (strlen(driver_override)) { |
| 116 | dev->driver_override = driver_override; |
| 117 | } else { |
Geert Uytterhoeven | 6be5b5b | 2018-04-10 15:21:46 +0200 | [diff] [blame] | 118 | kfree(driver_override); |
| 119 | dev->driver_override = NULL; |
Antonios Motakis | 3cf3857 | 2015-01-06 11:15:11 +0100 | [diff] [blame] | 120 | } |
Geert Uytterhoeven | 6a7228d | 2018-04-10 15:21:44 +0200 | [diff] [blame] | 121 | device_unlock(_dev); |
Antonios Motakis | 3cf3857 | 2015-01-06 11:15:11 +0100 | [diff] [blame] | 122 | |
| 123 | kfree(old); |
| 124 | |
| 125 | return count; |
| 126 | } |
Greg Kroah-Hartman | 966449a | 2017-06-06 14:16:49 +0200 | [diff] [blame] | 127 | static DEVICE_ATTR_RW(driver_override); |
Antonios Motakis | 3cf3857 | 2015-01-06 11:15:11 +0100 | [diff] [blame] | 128 | |
Russell King | 96b13f5 | 2006-11-30 14:04:49 +0000 | [diff] [blame] | 129 | #define amba_attr_func(name,fmt,arg...) \ |
| 130 | static ssize_t name##_show(struct device *_dev, \ |
| 131 | struct device_attribute *attr, char *buf) \ |
| 132 | { \ |
| 133 | struct amba_device *dev = to_amba_device(_dev); \ |
| 134 | return sprintf(buf, fmt, arg); \ |
Greg Kroah-Hartman | 966449a | 2017-06-06 14:16:49 +0200 | [diff] [blame] | 135 | } \ |
| 136 | static DEVICE_ATTR_RO(name) |
Russell King | 96b13f5 | 2006-11-30 14:04:49 +0000 | [diff] [blame] | 137 | |
| 138 | amba_attr_func(id, "%08x\n", dev->periphid); |
Greg Kroah-Hartman | 966449a | 2017-06-06 14:16:49 +0200 | [diff] [blame] | 139 | amba_attr_func(irq0, "%u\n", dev->irq[0]); |
| 140 | amba_attr_func(irq1, "%u\n", dev->irq[1]); |
Russell King | 96b13f5 | 2006-11-30 14:04:49 +0000 | [diff] [blame] | 141 | amba_attr_func(resource, "\t%016llx\t%016llx\t%016lx\n", |
| 142 | (unsigned long long)dev->res.start, (unsigned long long)dev->res.end, |
| 143 | dev->res.flags); |
| 144 | |
Greg Kroah-Hartman | 966449a | 2017-06-06 14:16:49 +0200 | [diff] [blame] | 145 | static struct attribute *amba_dev_attrs[] = { |
| 146 | &dev_attr_id.attr, |
| 147 | &dev_attr_resource.attr, |
| 148 | &dev_attr_driver_override.attr, |
| 149 | NULL, |
Russell King | 96b13f5 | 2006-11-30 14:04:49 +0000 | [diff] [blame] | 150 | }; |
Greg Kroah-Hartman | 966449a | 2017-06-06 14:16:49 +0200 | [diff] [blame] | 151 | ATTRIBUTE_GROUPS(amba_dev); |
Russell King | 96b13f5 | 2006-11-30 14:04:49 +0000 | [diff] [blame] | 152 | |
Uwe Kleine-König | 5150a8f | 2021-01-26 17:58:32 +0100 | [diff] [blame] | 153 | static int amba_match(struct device *dev, struct device_driver *drv) |
| 154 | { |
| 155 | struct amba_device *pcdev = to_amba_device(dev); |
| 156 | struct amba_driver *pcdrv = to_amba_driver(drv); |
| 157 | |
| 158 | /* When driver_override is set, only bind to the matching driver */ |
| 159 | if (pcdev->driver_override) |
| 160 | return !strcmp(pcdev->driver_override, drv->name); |
| 161 | |
| 162 | return amba_lookup(pcdrv->id_table, pcdev) != NULL; |
| 163 | } |
| 164 | |
| 165 | static int amba_uevent(struct device *dev, struct kobj_uevent_env *env) |
| 166 | { |
| 167 | struct amba_device *pcdev = to_amba_device(dev); |
| 168 | int retval = 0; |
| 169 | |
| 170 | retval = add_uevent_var(env, "AMBA_ID=%08x", pcdev->periphid); |
| 171 | if (retval) |
| 172 | return retval; |
| 173 | |
| 174 | retval = add_uevent_var(env, "MODALIAS=amba:d%08X", pcdev->periphid); |
| 175 | return retval; |
| 176 | } |
| 177 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 178 | /* |
| 179 | * These are the device model conversion veneers; they convert the |
| 180 | * device model structures to our more specific structures. |
| 181 | */ |
| 182 | static int amba_probe(struct device *dev) |
| 183 | { |
| 184 | struct amba_device *pcdev = to_amba_device(dev); |
| 185 | struct amba_driver *pcdrv = to_amba_driver(dev->driver); |
Russell King | c862aab | 2011-02-19 15:55:26 +0000 | [diff] [blame] | 186 | const struct amba_id *id = amba_lookup(pcdrv->id_table, pcdev); |
Russell King | 7cfe249 | 2010-07-15 10:47:14 +0100 | [diff] [blame] | 187 | int ret; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 188 | |
Russell King | 7cfe249 | 2010-07-15 10:47:14 +0100 | [diff] [blame] | 189 | do { |
Stephen Boyd | bcd3006 | 2016-08-10 20:17:34 +0100 | [diff] [blame] | 190 | ret = of_clk_set_defaults(dev->of_node, false); |
| 191 | if (ret < 0) |
| 192 | break; |
| 193 | |
Ulf Hansson | 207f1a2 | 2014-09-19 20:27:42 +0200 | [diff] [blame] | 194 | ret = dev_pm_domain_attach(dev, true); |
Ulf Hansson | d21bc89 | 2018-04-26 10:53:05 +0200 | [diff] [blame] | 195 | if (ret) |
Russell King | 7cfe249 | 2010-07-15 10:47:14 +0100 | [diff] [blame] | 196 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 197 | |
Ulf Hansson | 207f1a2 | 2014-09-19 20:27:42 +0200 | [diff] [blame] | 198 | ret = amba_get_enable_pclk(pcdev); |
| 199 | if (ret) { |
| 200 | dev_pm_domain_detach(dev, true); |
| 201 | break; |
| 202 | } |
| 203 | |
Russell King | 92b97f0 | 2011-08-14 09:13:48 +0100 | [diff] [blame] | 204 | pm_runtime_get_noresume(dev); |
| 205 | pm_runtime_set_active(dev); |
| 206 | pm_runtime_enable(dev); |
| 207 | |
Russell King | 7cfe249 | 2010-07-15 10:47:14 +0100 | [diff] [blame] | 208 | ret = pcdrv->probe(pcdev, id); |
| 209 | if (ret == 0) |
| 210 | break; |
| 211 | |
Russell King | 92b97f0 | 2011-08-14 09:13:48 +0100 | [diff] [blame] | 212 | pm_runtime_disable(dev); |
| 213 | pm_runtime_set_suspended(dev); |
| 214 | pm_runtime_put_noidle(dev); |
| 215 | |
Russell King | 7cfe249 | 2010-07-15 10:47:14 +0100 | [diff] [blame] | 216 | amba_put_disable_pclk(pcdev); |
Ulf Hansson | 207f1a2 | 2014-09-19 20:27:42 +0200 | [diff] [blame] | 217 | dev_pm_domain_detach(dev, true); |
Russell King | 7cfe249 | 2010-07-15 10:47:14 +0100 | [diff] [blame] | 218 | } while (0); |
| 219 | |
| 220 | return ret; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 221 | } |
| 222 | |
Uwe Kleine-König | fc7a620 | 2021-07-13 21:35:22 +0200 | [diff] [blame] | 223 | static void amba_remove(struct device *dev) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 224 | { |
Russell King | 7cfe249 | 2010-07-15 10:47:14 +0100 | [diff] [blame] | 225 | struct amba_device *pcdev = to_amba_device(dev); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 226 | struct amba_driver *drv = to_amba_driver(dev->driver); |
Russell King | 92b97f0 | 2011-08-14 09:13:48 +0100 | [diff] [blame] | 227 | |
| 228 | pm_runtime_get_sync(dev); |
Uwe Kleine-König | de5d7ad | 2021-01-26 17:58:31 +0100 | [diff] [blame] | 229 | if (drv->remove) |
Uwe Kleine-König | 3fd269e | 2021-01-26 17:58:34 +0100 | [diff] [blame] | 230 | drv->remove(pcdev); |
Russell King | 92b97f0 | 2011-08-14 09:13:48 +0100 | [diff] [blame] | 231 | pm_runtime_put_noidle(dev); |
| 232 | |
| 233 | /* Undo the runtime PM settings in amba_probe() */ |
| 234 | pm_runtime_disable(dev); |
| 235 | pm_runtime_set_suspended(dev); |
| 236 | pm_runtime_put_noidle(dev); |
Russell King | 7cfe249 | 2010-07-15 10:47:14 +0100 | [diff] [blame] | 237 | |
| 238 | amba_put_disable_pclk(pcdev); |
Ulf Hansson | 207f1a2 | 2014-09-19 20:27:42 +0200 | [diff] [blame] | 239 | dev_pm_domain_detach(dev, true); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 240 | } |
| 241 | |
| 242 | static void amba_shutdown(struct device *dev) |
| 243 | { |
Uwe Kleine-König | f170b59 | 2021-01-26 17:58:35 +0100 | [diff] [blame] | 244 | struct amba_driver *drv; |
Uwe Kleine-König | de5d7ad | 2021-01-26 17:58:31 +0100 | [diff] [blame] | 245 | |
Uwe Kleine-König | f170b59 | 2021-01-26 17:58:35 +0100 | [diff] [blame] | 246 | if (!dev->driver) |
| 247 | return; |
| 248 | |
| 249 | drv = to_amba_driver(dev->driver); |
Uwe Kleine-König | de5d7ad | 2021-01-26 17:58:31 +0100 | [diff] [blame] | 250 | if (drv->shutdown) |
| 251 | drv->shutdown(to_amba_device(dev)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 252 | } |
| 253 | |
Uwe Kleine-König | f170b59 | 2021-01-26 17:58:35 +0100 | [diff] [blame] | 254 | #ifdef CONFIG_PM |
| 255 | /* |
| 256 | * Hooks to provide runtime PM of the pclk (bus clock). It is safe to |
| 257 | * enable/disable the bus clock at runtime PM suspend/resume as this |
| 258 | * does not result in loss of context. |
| 259 | */ |
| 260 | static int amba_pm_runtime_suspend(struct device *dev) |
| 261 | { |
| 262 | struct amba_device *pcdev = to_amba_device(dev); |
| 263 | int ret = pm_generic_runtime_suspend(dev); |
| 264 | |
| 265 | if (ret == 0 && dev->driver) { |
| 266 | if (pm_runtime_is_irq_safe(dev)) |
| 267 | clk_disable(pcdev->pclk); |
| 268 | else |
| 269 | clk_disable_unprepare(pcdev->pclk); |
| 270 | } |
| 271 | |
| 272 | return ret; |
| 273 | } |
| 274 | |
| 275 | static int amba_pm_runtime_resume(struct device *dev) |
| 276 | { |
| 277 | struct amba_device *pcdev = to_amba_device(dev); |
| 278 | int ret; |
| 279 | |
| 280 | if (dev->driver) { |
| 281 | if (pm_runtime_is_irq_safe(dev)) |
| 282 | ret = clk_enable(pcdev->pclk); |
| 283 | else |
| 284 | ret = clk_prepare_enable(pcdev->pclk); |
| 285 | /* Failure is probably fatal to the system, but... */ |
| 286 | if (ret) |
| 287 | return ret; |
| 288 | } |
| 289 | |
| 290 | return pm_generic_runtime_resume(dev); |
| 291 | } |
| 292 | #endif /* CONFIG_PM */ |
| 293 | |
| 294 | static const struct dev_pm_ops amba_pm = { |
| 295 | .suspend = pm_generic_suspend, |
| 296 | .resume = pm_generic_resume, |
| 297 | .freeze = pm_generic_freeze, |
| 298 | .thaw = pm_generic_thaw, |
| 299 | .poweroff = pm_generic_poweroff, |
| 300 | .restore = pm_generic_restore, |
| 301 | SET_RUNTIME_PM_OPS( |
| 302 | amba_pm_runtime_suspend, |
| 303 | amba_pm_runtime_resume, |
| 304 | NULL |
| 305 | ) |
| 306 | }; |
| 307 | |
| 308 | /* |
| 309 | * Primecells are part of the Advanced Microcontroller Bus Architecture, |
| 310 | * so we call the bus "amba". |
| 311 | * DMA configuration for platform and AMBA bus is same. So here we reuse |
| 312 | * platform's DMA config routine. |
| 313 | */ |
| 314 | struct bus_type amba_bustype = { |
| 315 | .name = "amba", |
| 316 | .dev_groups = amba_dev_groups, |
| 317 | .match = amba_match, |
| 318 | .uevent = amba_uevent, |
| 319 | .probe = amba_probe, |
| 320 | .remove = amba_remove, |
| 321 | .shutdown = amba_shutdown, |
| 322 | .dma_configure = platform_dma_configure, |
| 323 | .pm = &amba_pm, |
| 324 | }; |
| 325 | EXPORT_SYMBOL_GPL(amba_bustype); |
| 326 | |
| 327 | static int __init amba_init(void) |
| 328 | { |
| 329 | return bus_register(&amba_bustype); |
| 330 | } |
| 331 | |
| 332 | postcore_initcall(amba_init); |
| 333 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 334 | /** |
| 335 | * amba_driver_register - register an AMBA device driver |
| 336 | * @drv: amba device driver structure |
| 337 | * |
| 338 | * Register an AMBA device driver with the Linux device model |
| 339 | * core. If devices pre-exist, the drivers probe function will |
| 340 | * be called. |
| 341 | */ |
| 342 | int amba_driver_register(struct amba_driver *drv) |
| 343 | { |
Uwe Kleine-König | de5d7ad | 2021-01-26 17:58:31 +0100 | [diff] [blame] | 344 | if (!drv->probe) |
| 345 | return -EINVAL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 346 | |
Uwe Kleine-König | de5d7ad | 2021-01-26 17:58:31 +0100 | [diff] [blame] | 347 | drv->drv.bus = &amba_bustype; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 348 | |
| 349 | return driver_register(&drv->drv); |
| 350 | } |
| 351 | |
| 352 | /** |
| 353 | * amba_driver_unregister - remove an AMBA device driver |
| 354 | * @drv: AMBA device driver structure to remove |
| 355 | * |
| 356 | * Unregister an AMBA device driver from the Linux device |
| 357 | * model. The device model will call the drivers remove function |
| 358 | * for each device the device driver is currently handling. |
| 359 | */ |
| 360 | void amba_driver_unregister(struct amba_driver *drv) |
| 361 | { |
| 362 | driver_unregister(&drv->drv); |
| 363 | } |
| 364 | |
| 365 | |
| 366 | static void amba_device_release(struct device *dev) |
| 367 | { |
| 368 | struct amba_device *d = to_amba_device(dev); |
| 369 | |
| 370 | if (d->res.parent) |
| 371 | release_resource(&d->res); |
| 372 | kfree(d); |
| 373 | } |
| 374 | |
Wang Kefeng | 854f695 | 2021-08-23 10:41:43 +0100 | [diff] [blame^] | 375 | static int of_amba_device_decode_irq(struct amba_device *dev) |
| 376 | { |
| 377 | struct device_node *node = dev->dev.of_node; |
| 378 | int i, irq = 0; |
| 379 | |
| 380 | if (IS_ENABLED(CONFIG_OF_IRQ) && node) { |
| 381 | /* Decode the IRQs and address ranges */ |
| 382 | for (i = 0; i < AMBA_NR_IRQS; i++) { |
| 383 | irq = of_irq_get(node, i); |
| 384 | if (irq < 0) { |
| 385 | if (irq == -EPROBE_DEFER) |
| 386 | return irq; |
| 387 | irq = 0; |
| 388 | } |
| 389 | |
| 390 | dev->irq[i] = irq; |
| 391 | } |
| 392 | } |
| 393 | |
| 394 | return 0; |
| 395 | } |
| 396 | |
Marek Szyprowski | a41980f | 2016-04-21 07:58:35 +0100 | [diff] [blame] | 397 | static int amba_device_try_add(struct amba_device *dev, struct resource *parent) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 398 | { |
Leo Chen | 8afe0b9 | 2009-07-28 23:34:59 +0100 | [diff] [blame] | 399 | u32 size; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 400 | void __iomem *tmp; |
| 401 | int i, ret; |
| 402 | |
Wang Kefeng | 854f695 | 2021-08-23 10:41:43 +0100 | [diff] [blame^] | 403 | ret = of_amba_device_decode_irq(dev); |
| 404 | if (ret) |
| 405 | goto err_out; |
| 406 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 407 | ret = request_resource(parent, &dev->res); |
Russell King | 96b13f5 | 2006-11-30 14:04:49 +0000 | [diff] [blame] | 408 | if (ret) |
| 409 | goto err_out; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 410 | |
Linus Walleij | 97ceed1 | 2011-03-24 16:12:40 +0100 | [diff] [blame] | 411 | /* Hard-coded primecell ID instead of plug-n-play */ |
| 412 | if (dev->periphid != 0) |
| 413 | goto skip_probe; |
| 414 | |
Leo Chen | 8afe0b9 | 2009-07-28 23:34:59 +0100 | [diff] [blame] | 415 | /* |
| 416 | * Dynamically calculate the size of the resource |
| 417 | * and use this for iomap |
| 418 | */ |
| 419 | size = resource_size(&dev->res); |
| 420 | tmp = ioremap(dev->res.start, size); |
Russell King | 96b13f5 | 2006-11-30 14:04:49 +0000 | [diff] [blame] | 421 | if (!tmp) { |
| 422 | ret = -ENOMEM; |
| 423 | goto err_release; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 424 | } |
Russell King | 96b13f5 | 2006-11-30 14:04:49 +0000 | [diff] [blame] | 425 | |
Marek Szyprowski | a41980f | 2016-04-21 07:58:35 +0100 | [diff] [blame] | 426 | ret = dev_pm_domain_attach(&dev->dev, true); |
Ulf Hansson | d21bc89 | 2018-04-26 10:53:05 +0200 | [diff] [blame] | 427 | if (ret) { |
Marek Szyprowski | a41980f | 2016-04-21 07:58:35 +0100 | [diff] [blame] | 428 | iounmap(tmp); |
| 429 | goto err_release; |
| 430 | } |
| 431 | |
Russell King | 7cfe249 | 2010-07-15 10:47:14 +0100 | [diff] [blame] | 432 | ret = amba_get_enable_pclk(dev); |
| 433 | if (ret == 0) { |
| 434 | u32 pid, cid; |
DINH L NGUYEN | 79bdcb20 | 2019-09-04 02:13:08 +0100 | [diff] [blame] | 435 | struct reset_control *rstc; |
| 436 | |
| 437 | /* |
| 438 | * Find reset control(s) of the amba bus and de-assert them. |
| 439 | */ |
| 440 | rstc = of_reset_control_array_get_optional_shared(dev->dev.of_node); |
| 441 | if (IS_ERR(rstc)) { |
Russell King | e963408 | 2019-10-02 17:45:11 +0100 | [diff] [blame] | 442 | ret = PTR_ERR(rstc); |
| 443 | if (ret != -EPROBE_DEFER) |
| 444 | dev_err(&dev->dev, "can't get reset: %d\n", |
| 445 | ret); |
| 446 | goto err_reset; |
DINH L NGUYEN | 79bdcb20 | 2019-09-04 02:13:08 +0100 | [diff] [blame] | 447 | } |
| 448 | reset_control_deassert(rstc); |
| 449 | reset_control_put(rstc); |
Russell King | 7cfe249 | 2010-07-15 10:47:14 +0100 | [diff] [blame] | 450 | |
| 451 | /* |
| 452 | * Read pid and cid based on size of resource |
| 453 | * they are located at end of region |
| 454 | */ |
| 455 | for (pid = 0, i = 0; i < 4; i++) |
| 456 | pid |= (readl(tmp + size - 0x20 + 4 * i) & 255) << |
| 457 | (i * 8); |
| 458 | for (cid = 0, i = 0; i < 4; i++) |
| 459 | cid |= (readl(tmp + size - 0x10 + 4 * i) & 255) << |
| 460 | (i * 8); |
| 461 | |
Mike Leach | 4a2910f | 2019-02-13 14:41:50 +0100 | [diff] [blame] | 462 | if (cid == CORESIGHT_CID) { |
| 463 | /* set the base to the start of the last 4k block */ |
| 464 | void __iomem *csbase = tmp + size - 4096; |
| 465 | |
| 466 | dev->uci.devarch = |
| 467 | readl(csbase + UCI_REG_DEVARCH_OFFSET); |
| 468 | dev->uci.devtype = |
| 469 | readl(csbase + UCI_REG_DEVTYPE_OFFSET) & 0xff; |
| 470 | } |
| 471 | |
Russell King | 7cfe249 | 2010-07-15 10:47:14 +0100 | [diff] [blame] | 472 | amba_put_disable_pclk(dev); |
| 473 | |
Mike Leach | 4a2910f | 2019-02-13 14:41:50 +0100 | [diff] [blame] | 474 | if (cid == AMBA_CID || cid == CORESIGHT_CID) { |
Russell King | 7cfe249 | 2010-07-15 10:47:14 +0100 | [diff] [blame] | 475 | dev->periphid = pid; |
Mike Leach | 4a2910f | 2019-02-13 14:41:50 +0100 | [diff] [blame] | 476 | dev->cid = cid; |
| 477 | } |
Russell King | 7cfe249 | 2010-07-15 10:47:14 +0100 | [diff] [blame] | 478 | |
| 479 | if (!dev->periphid) |
| 480 | ret = -ENODEV; |
| 481 | } |
Russell King | 96b13f5 | 2006-11-30 14:04:49 +0000 | [diff] [blame] | 482 | |
| 483 | iounmap(tmp); |
Marek Szyprowski | a41980f | 2016-04-21 07:58:35 +0100 | [diff] [blame] | 484 | dev_pm_domain_detach(&dev->dev, true); |
Russell King | 96b13f5 | 2006-11-30 14:04:49 +0000 | [diff] [blame] | 485 | |
Russell King | 7cfe249 | 2010-07-15 10:47:14 +0100 | [diff] [blame] | 486 | if (ret) |
Russell King | 96b13f5 | 2006-11-30 14:04:49 +0000 | [diff] [blame] | 487 | goto err_release; |
Russell King | 96b13f5 | 2006-11-30 14:04:49 +0000 | [diff] [blame] | 488 | |
Linus Walleij | 97ceed1 | 2011-03-24 16:12:40 +0100 | [diff] [blame] | 489 | skip_probe: |
Russell King | 557dca5 | 2009-07-05 22:39:08 +0100 | [diff] [blame] | 490 | ret = device_add(&dev->dev); |
Russell King | 96b13f5 | 2006-11-30 14:04:49 +0000 | [diff] [blame] | 491 | if (ret) |
| 492 | goto err_release; |
| 493 | |
Russell King | dfb8518 | 2012-05-03 11:33:15 +0100 | [diff] [blame] | 494 | if (dev->irq[0]) |
Russell King | 96b13f5 | 2006-11-30 14:04:49 +0000 | [diff] [blame] | 495 | ret = device_create_file(&dev->dev, &dev_attr_irq0); |
Russell King | dfb8518 | 2012-05-03 11:33:15 +0100 | [diff] [blame] | 496 | if (ret == 0 && dev->irq[1]) |
Russell King | 96b13f5 | 2006-11-30 14:04:49 +0000 | [diff] [blame] | 497 | ret = device_create_file(&dev->dev, &dev_attr_irq1); |
| 498 | if (ret == 0) |
| 499 | return ret; |
| 500 | |
| 501 | device_unregister(&dev->dev); |
| 502 | |
| 503 | err_release: |
| 504 | release_resource(&dev->res); |
| 505 | err_out: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 506 | return ret; |
Russell King | e963408 | 2019-10-02 17:45:11 +0100 | [diff] [blame] | 507 | |
| 508 | err_reset: |
| 509 | amba_put_disable_pclk(dev); |
| 510 | iounmap(tmp); |
| 511 | dev_pm_domain_detach(&dev->dev, true); |
| 512 | goto err_release; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 513 | } |
Marek Szyprowski | a41980f | 2016-04-21 07:58:35 +0100 | [diff] [blame] | 514 | |
| 515 | /* |
| 516 | * Registration of AMBA device require reading its pid and cid registers. |
| 517 | * To do this, the device must be turned on (if it is a part of power domain) |
| 518 | * and have clocks enabled. However in some cases those resources might not be |
| 519 | * yet available. Returning EPROBE_DEFER is not a solution in such case, |
| 520 | * because callers don't handle this special error code. Instead such devices |
| 521 | * are added to the special list and their registration is retried from |
| 522 | * periodic worker, until all resources are available and registration succeeds. |
| 523 | */ |
| 524 | struct deferred_device { |
| 525 | struct amba_device *dev; |
| 526 | struct resource *parent; |
| 527 | struct list_head node; |
| 528 | }; |
| 529 | |
| 530 | static LIST_HEAD(deferred_devices); |
| 531 | static DEFINE_MUTEX(deferred_devices_lock); |
| 532 | |
| 533 | static void amba_deferred_retry_func(struct work_struct *dummy); |
| 534 | static DECLARE_DELAYED_WORK(deferred_retry_work, amba_deferred_retry_func); |
| 535 | |
| 536 | #define DEFERRED_DEVICE_TIMEOUT (msecs_to_jiffies(5 * 1000)) |
| 537 | |
Rob Herring | 039599c | 2020-04-29 15:58:12 -0500 | [diff] [blame] | 538 | static int amba_deferred_retry(void) |
Marek Szyprowski | a41980f | 2016-04-21 07:58:35 +0100 | [diff] [blame] | 539 | { |
| 540 | struct deferred_device *ddev, *tmp; |
| 541 | |
| 542 | mutex_lock(&deferred_devices_lock); |
| 543 | |
| 544 | list_for_each_entry_safe(ddev, tmp, &deferred_devices, node) { |
| 545 | int ret = amba_device_try_add(ddev->dev, ddev->parent); |
| 546 | |
| 547 | if (ret == -EPROBE_DEFER) |
| 548 | continue; |
| 549 | |
| 550 | list_del_init(&ddev->node); |
| 551 | kfree(ddev); |
| 552 | } |
| 553 | |
Rob Herring | 039599c | 2020-04-29 15:58:12 -0500 | [diff] [blame] | 554 | mutex_unlock(&deferred_devices_lock); |
| 555 | |
| 556 | return 0; |
| 557 | } |
| 558 | late_initcall(amba_deferred_retry); |
| 559 | |
| 560 | static void amba_deferred_retry_func(struct work_struct *dummy) |
| 561 | { |
| 562 | amba_deferred_retry(); |
| 563 | |
Marek Szyprowski | a41980f | 2016-04-21 07:58:35 +0100 | [diff] [blame] | 564 | if (!list_empty(&deferred_devices)) |
| 565 | schedule_delayed_work(&deferred_retry_work, |
| 566 | DEFERRED_DEVICE_TIMEOUT); |
Marek Szyprowski | a41980f | 2016-04-21 07:58:35 +0100 | [diff] [blame] | 567 | } |
| 568 | |
| 569 | /** |
| 570 | * amba_device_add - add a previously allocated AMBA device structure |
| 571 | * @dev: AMBA device allocated by amba_device_alloc |
| 572 | * @parent: resource parent for this devices resources |
| 573 | * |
| 574 | * Claim the resource, and read the device cell ID if not already |
| 575 | * initialized. Register the AMBA device with the Linux device |
| 576 | * manager. |
| 577 | */ |
| 578 | int amba_device_add(struct amba_device *dev, struct resource *parent) |
| 579 | { |
| 580 | int ret = amba_device_try_add(dev, parent); |
| 581 | |
| 582 | if (ret == -EPROBE_DEFER) { |
| 583 | struct deferred_device *ddev; |
| 584 | |
| 585 | ddev = kmalloc(sizeof(*ddev), GFP_KERNEL); |
| 586 | if (!ddev) |
| 587 | return -ENOMEM; |
| 588 | |
| 589 | ddev->dev = dev; |
| 590 | ddev->parent = parent; |
| 591 | ret = 0; |
| 592 | |
| 593 | mutex_lock(&deferred_devices_lock); |
| 594 | |
| 595 | if (list_empty(&deferred_devices)) |
| 596 | schedule_delayed_work(&deferred_retry_work, |
| 597 | DEFERRED_DEVICE_TIMEOUT); |
| 598 | list_add_tail(&ddev->node, &deferred_devices); |
| 599 | |
| 600 | mutex_unlock(&deferred_devices_lock); |
| 601 | } |
| 602 | return ret; |
| 603 | } |
Russell King | d5dc927 | 2011-12-18 11:07:47 +0000 | [diff] [blame] | 604 | EXPORT_SYMBOL_GPL(amba_device_add); |
| 605 | |
| 606 | static void amba_device_initialize(struct amba_device *dev, const char *name) |
| 607 | { |
| 608 | device_initialize(&dev->dev); |
| 609 | if (name) |
| 610 | dev_set_name(&dev->dev, "%s", name); |
| 611 | dev->dev.release = amba_device_release; |
| 612 | dev->dev.bus = &amba_bustype; |
Russell King | 446b2a9 | 2013-06-27 10:25:33 +0100 | [diff] [blame] | 613 | dev->dev.dma_mask = &dev->dev.coherent_dma_mask; |
Ulf Hansson | f458488 | 2020-04-22 12:10:13 +0200 | [diff] [blame] | 614 | dev->dev.dma_parms = &dev->dma_parms; |
Russell King | d5dc927 | 2011-12-18 11:07:47 +0000 | [diff] [blame] | 615 | dev->res.name = dev_name(&dev->dev); |
| 616 | } |
| 617 | |
| 618 | /** |
| 619 | * amba_device_alloc - allocate an AMBA device |
| 620 | * @name: sysfs name of the AMBA device |
| 621 | * @base: base of AMBA device |
| 622 | * @size: size of AMBA device |
| 623 | * |
| 624 | * Allocate and initialize an AMBA device structure. Returns %NULL |
| 625 | * on failure. |
| 626 | */ |
| 627 | struct amba_device *amba_device_alloc(const char *name, resource_size_t base, |
| 628 | size_t size) |
| 629 | { |
| 630 | struct amba_device *dev; |
| 631 | |
| 632 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); |
| 633 | if (dev) { |
| 634 | amba_device_initialize(dev, name); |
| 635 | dev->res.start = base; |
| 636 | dev->res.end = base + size - 1; |
| 637 | dev->res.flags = IORESOURCE_MEM; |
| 638 | } |
| 639 | |
| 640 | return dev; |
| 641 | } |
| 642 | EXPORT_SYMBOL_GPL(amba_device_alloc); |
| 643 | |
| 644 | /** |
| 645 | * amba_device_register - register an AMBA device |
| 646 | * @dev: AMBA device to register |
| 647 | * @parent: parent memory resource |
| 648 | * |
| 649 | * Setup the AMBA device, reading the cell ID if present. |
| 650 | * Claim the resource, and register the AMBA device with |
| 651 | * the Linux device manager. |
| 652 | */ |
| 653 | int amba_device_register(struct amba_device *dev, struct resource *parent) |
| 654 | { |
| 655 | amba_device_initialize(dev, dev->dev.init_name); |
| 656 | dev->dev.init_name = NULL; |
| 657 | |
Russell King | d5dc927 | 2011-12-18 11:07:47 +0000 | [diff] [blame] | 658 | return amba_device_add(dev, parent); |
| 659 | } |
| 660 | |
| 661 | /** |
| 662 | * amba_device_put - put an AMBA device |
| 663 | * @dev: AMBA device to put |
| 664 | */ |
| 665 | void amba_device_put(struct amba_device *dev) |
| 666 | { |
| 667 | put_device(&dev->dev); |
| 668 | } |
| 669 | EXPORT_SYMBOL_GPL(amba_device_put); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 670 | |
| 671 | /** |
| 672 | * amba_device_unregister - unregister an AMBA device |
| 673 | * @dev: AMBA device to remove |
| 674 | * |
| 675 | * Remove the specified AMBA device from the Linux device |
| 676 | * manager. All files associated with this object will be |
| 677 | * destroyed, and device drivers notified that the device has |
| 678 | * been removed. The AMBA device's resources including |
| 679 | * the amba_device structure will be freed once all |
| 680 | * references to it have been dropped. |
| 681 | */ |
| 682 | void amba_device_unregister(struct amba_device *dev) |
| 683 | { |
| 684 | device_unregister(&dev->dev); |
| 685 | } |
| 686 | |
| 687 | |
| 688 | struct find_data { |
| 689 | struct amba_device *dev; |
| 690 | struct device *parent; |
| 691 | const char *busid; |
| 692 | unsigned int id; |
| 693 | unsigned int mask; |
| 694 | }; |
| 695 | |
| 696 | static int amba_find_match(struct device *dev, void *data) |
| 697 | { |
| 698 | struct find_data *d = data; |
| 699 | struct amba_device *pcdev = to_amba_device(dev); |
| 700 | int r; |
| 701 | |
| 702 | r = (pcdev->periphid & d->mask) == d->id; |
| 703 | if (d->parent) |
| 704 | r &= d->parent == dev->parent; |
| 705 | if (d->busid) |
Kay Sievers | 9d6b4c8 | 2009-03-24 16:38:22 -0700 | [diff] [blame] | 706 | r &= strcmp(dev_name(dev), d->busid) == 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 707 | |
| 708 | if (r) { |
| 709 | get_device(dev); |
| 710 | d->dev = pcdev; |
| 711 | } |
| 712 | |
| 713 | return r; |
| 714 | } |
| 715 | |
| 716 | /** |
| 717 | * amba_find_device - locate an AMBA device given a bus id |
| 718 | * @busid: bus id for device (or NULL) |
| 719 | * @parent: parent device (or NULL) |
| 720 | * @id: peripheral ID (or 0) |
| 721 | * @mask: peripheral ID mask (or 0) |
| 722 | * |
| 723 | * Return the AMBA device corresponding to the supplied parameters. |
| 724 | * If no device matches, returns NULL. |
| 725 | * |
| 726 | * NOTE: When a valid device is found, its refcount is |
| 727 | * incremented, and must be decremented before the returned |
| 728 | * reference. |
| 729 | */ |
| 730 | struct amba_device * |
| 731 | amba_find_device(const char *busid, struct device *parent, unsigned int id, |
| 732 | unsigned int mask) |
| 733 | { |
| 734 | struct find_data data; |
| 735 | |
| 736 | data.dev = NULL; |
| 737 | data.parent = parent; |
| 738 | data.busid = busid; |
| 739 | data.id = id; |
| 740 | data.mask = mask; |
| 741 | |
| 742 | bus_for_each_dev(&amba_bustype, NULL, &data, amba_find_match); |
| 743 | |
| 744 | return data.dev; |
| 745 | } |
| 746 | |
| 747 | /** |
| 748 | * amba_request_regions - request all mem regions associated with device |
| 749 | * @dev: amba_device structure for device |
| 750 | * @name: name, or NULL to use driver name |
| 751 | */ |
| 752 | int amba_request_regions(struct amba_device *dev, const char *name) |
| 753 | { |
| 754 | int ret = 0; |
Leo Chen | 8afe0b9 | 2009-07-28 23:34:59 +0100 | [diff] [blame] | 755 | u32 size; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 756 | |
| 757 | if (!name) |
| 758 | name = dev->dev.driver->name; |
| 759 | |
Leo Chen | 8afe0b9 | 2009-07-28 23:34:59 +0100 | [diff] [blame] | 760 | size = resource_size(&dev->res); |
| 761 | |
| 762 | if (!request_mem_region(dev->res.start, size, name)) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 763 | ret = -EBUSY; |
| 764 | |
| 765 | return ret; |
| 766 | } |
| 767 | |
| 768 | /** |
Lucas De Marchi | 25985ed | 2011-03-30 22:57:33 -0300 | [diff] [blame] | 769 | * amba_release_regions - release mem regions associated with device |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 770 | * @dev: amba_device structure for device |
| 771 | * |
| 772 | * Release regions claimed by a successful call to amba_request_regions. |
| 773 | */ |
| 774 | void amba_release_regions(struct amba_device *dev) |
| 775 | { |
Leo Chen | 8afe0b9 | 2009-07-28 23:34:59 +0100 | [diff] [blame] | 776 | u32 size; |
| 777 | |
| 778 | size = resource_size(&dev->res); |
| 779 | release_mem_region(dev->res.start, size); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 780 | } |
| 781 | |
| 782 | EXPORT_SYMBOL(amba_driver_register); |
| 783 | EXPORT_SYMBOL(amba_driver_unregister); |
| 784 | EXPORT_SYMBOL(amba_device_register); |
| 785 | EXPORT_SYMBOL(amba_device_unregister); |
| 786 | EXPORT_SYMBOL(amba_find_device); |
| 787 | EXPORT_SYMBOL(amba_request_regions); |
| 788 | EXPORT_SYMBOL(amba_release_regions); |