diff options
Diffstat (limited to 'include/linux/amba/bus.h')
| -rw-r--r-- | include/linux/amba/bus.h | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/include/linux/amba/bus.h b/include/linux/amba/bus.h index 724c69c40bb8..7847e197730a 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 | ||
| 61 | int amba_driver_register(struct amba_driver *); | 61 | int amba_driver_register(struct amba_driver *); |
| 62 | void amba_driver_unregister(struct amba_driver *); | 62 | void amba_driver_unregister(struct amba_driver *); |
| 63 | struct amba_device *amba_device_alloc(const char *, resource_size_t, size_t); | ||
| 64 | void amba_device_put(struct amba_device *); | ||
| 65 | int amba_device_add(struct amba_device *, struct resource *); | ||
| 63 | int amba_device_register(struct amba_device *, struct resource *); | 66 | int amba_device_register(struct amba_device *, struct resource *); |
| 64 | void amba_device_unregister(struct amba_device *); | 67 | void amba_device_unregister(struct amba_device *); |
| 65 | struct amba_device *amba_find_device(const char *, struct device *, unsigned int, unsigned int); | 68 | struct amba_device *amba_find_device(const char *, struct device *, unsigned int, unsigned int); |
| @@ -89,4 +92,46 @@ 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) \ | ||
| 109 | struct 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) \ | ||
| 120 | struct 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 | |||
| 128 | /* | ||
| 129 | * module_amba_driver() - Helper macro for drivers that don't do anything | ||
| 130 | * special in module init/exit. This eliminates a lot of boilerplate. Each | ||
| 131 | * module may only use this macro once, and calling it replaces module_init() | ||
| 132 | * and module_exit() | ||
| 133 | */ | ||
| 134 | #define module_amba_driver(__amba_drv) \ | ||
| 135 | module_driver(__amba_drv, amba_driver_register, amba_driver_unregister) | ||
| 136 | |||
| 92 | #endif | 137 | #endif |
