aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/amba/bus.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/amba/bus.h')
-rw-r--r--include/linux/amba/bus.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/include/linux/amba/bus.h b/include/linux/amba/bus.h
index 724c69c40bb8..a9fab831caf8 100644
--- a/include/linux/amba/bus.h
+++ b/include/linux/amba/bus.h
@@ -60,6 +60,9 @@ extern struct bus_type amba_bustype;
60 60
61int amba_driver_register(struct amba_driver *); 61int amba_driver_register(struct amba_driver *);
62void amba_driver_unregister(struct amba_driver *); 62void amba_driver_unregister(struct amba_driver *);
63struct amba_device *amba_device_alloc(const char *, resource_size_t, size_t);
64void amba_device_put(struct amba_device *);
65int amba_device_add(struct amba_device *, struct resource *);
63int amba_device_register(struct amba_device *, struct resource *); 66int amba_device_register(struct amba_device *, struct resource *);
64void amba_device_unregister(struct amba_device *); 67void amba_device_unregister(struct amba_device *);
65struct amba_device *amba_find_device(const char *, struct device *, unsigned int, unsigned int); 68struct amba_device *amba_find_device(const char *, struct device *, unsigned int, unsigned int);
@@ -89,4 +92,37 @@ void amba_release_regions(struct amba_device *);
89#define amba_manf(d) AMBA_MANF_BITS((d)->periphid) 92#define amba_manf(d) AMBA_MANF_BITS((d)->periphid)
90#define amba_part(d) AMBA_PART_BITS((d)->periphid) 93#define amba_part(d) AMBA_PART_BITS((d)->periphid)
91 94
95#define __AMBA_DEV(busid, data, mask) \
96 { \
97 .coherent_dma_mask = mask, \
98 .init_name = busid, \
99 .platform_data = data, \
100 }
101
102/*
103 * APB devices do not themselves have the ability to address memory,
104 * so DMA masks should be zero (much like USB peripheral devices.)
105 * The DMA controller DMA masks should be used instead (much like
106 * USB host controllers in conventional PCs.)
107 */
108#define AMBA_APB_DEVICE(name, busid, id, base, irqs, data) \
109struct amba_device name##_device = { \
110 .dev = __AMBA_DEV(busid, data, 0), \
111 .res = DEFINE_RES_MEM(base, SZ_4K), \
112 .irq = irqs, \
113 .periphid = id, \
114}
115
116/*
117 * AHB devices are DMA capable, so set their DMA masks
118 */
119#define AMBA_AHB_DEVICE(name, busid, id, base, irqs, data) \
120struct amba_device name##_device = { \
121 .dev = __AMBA_DEV(busid, data, ~0ULL), \
122 .res = DEFINE_RES_MEM(base, SZ_4K), \
123 .dma_mask = ~0ULL, \
124 .irq = irqs, \
125 .periphid = id, \
126}
127
92#endif 128#endif