diff options
Diffstat (limited to 'arch/arm/mach-ux500/devices-common.h')
-rw-r--r-- | arch/arm/mach-ux500/devices-common.h | 83 |
1 files changed, 46 insertions, 37 deletions
diff --git a/arch/arm/mach-ux500/devices-common.h b/arch/arm/mach-ux500/devices-common.h index 7825705033bf..39c74ec82add 100644 --- a/arch/arm/mach-ux500/devices-common.h +++ b/arch/arm/mach-ux500/devices-common.h | |||
@@ -8,80 +8,89 @@ | |||
8 | #ifndef __DEVICES_COMMON_H | 8 | #ifndef __DEVICES_COMMON_H |
9 | #define __DEVICES_COMMON_H | 9 | #define __DEVICES_COMMON_H |
10 | 10 | ||
11 | extern struct amba_device * | 11 | #include <linux/platform_device.h> |
12 | dbx500_add_amba_device(const char *name, resource_size_t base, | 12 | #include <linux/dma-mapping.h> |
13 | int irq, void *pdata, unsigned int periphid); | 13 | #include <linux/sys_soc.h> |
14 | #include <plat/i2c.h> | ||
14 | 15 | ||
15 | extern struct platform_device * | 16 | extern struct amba_device * |
16 | dbx500_add_platform_device_4k1irq(const char *name, int id, | 17 | dbx500_add_amba_device(struct device *parent, const char *name, |
17 | resource_size_t base, | 18 | resource_size_t base, int irq, void *pdata, |
18 | int irq, void *pdata); | 19 | unsigned int periphid); |
19 | 20 | ||
20 | struct spi_master_cntlr; | 21 | struct spi_master_cntlr; |
21 | 22 | ||
22 | static inline struct amba_device * | 23 | static inline struct amba_device * |
23 | dbx500_add_msp_spi(const char *name, resource_size_t base, int irq, | 24 | dbx500_add_msp_spi(struct device *parent, const char *name, |
25 | resource_size_t base, int irq, | ||
24 | struct spi_master_cntlr *pdata) | 26 | struct spi_master_cntlr *pdata) |
25 | { | 27 | { |
26 | return dbx500_add_amba_device(name, base, irq, pdata, 0); | 28 | return dbx500_add_amba_device(parent, name, base, irq, |
29 | pdata, 0); | ||
27 | } | 30 | } |
28 | 31 | ||
29 | static inline struct amba_device * | 32 | static inline struct amba_device * |
30 | dbx500_add_spi(const char *name, resource_size_t base, int irq, | 33 | dbx500_add_spi(struct device *parent, const char *name, resource_size_t base, |
31 | struct spi_master_cntlr *pdata, | 34 | int irq, struct spi_master_cntlr *pdata, |
32 | u32 periphid) | 35 | u32 periphid) |
33 | { | 36 | { |
34 | return dbx500_add_amba_device(name, base, irq, pdata, periphid); | 37 | return dbx500_add_amba_device(parent, name, base, irq, |
38 | pdata, periphid); | ||
35 | } | 39 | } |
36 | 40 | ||
37 | struct mmci_platform_data; | 41 | struct mmci_platform_data; |
38 | 42 | ||
39 | static inline struct amba_device * | 43 | static inline struct amba_device * |
40 | dbx500_add_sdi(const char *name, resource_size_t base, int irq, | 44 | dbx500_add_sdi(struct device *parent, const char *name, resource_size_t base, |
41 | struct mmci_platform_data *pdata, | 45 | int irq, struct mmci_platform_data *pdata, u32 periphid) |
42 | u32 periphid) | ||
43 | { | 46 | { |
44 | return dbx500_add_amba_device(name, base, irq, pdata, periphid); | 47 | return dbx500_add_amba_device(parent, name, base, irq, |
48 | pdata, periphid); | ||
45 | } | 49 | } |
46 | 50 | ||
47 | struct amba_pl011_data; | 51 | struct amba_pl011_data; |
48 | 52 | ||
49 | static inline struct amba_device * | 53 | static inline struct amba_device * |
50 | dbx500_add_uart(const char *name, resource_size_t base, int irq, | 54 | dbx500_add_uart(struct device *parent, const char *name, resource_size_t base, |
51 | struct amba_pl011_data *pdata) | 55 | int irq, struct amba_pl011_data *pdata) |
52 | { | 56 | { |
53 | return dbx500_add_amba_device(name, base, irq, pdata, 0); | 57 | return dbx500_add_amba_device(parent, name, base, irq, pdata, 0); |
54 | } | 58 | } |
55 | 59 | ||
56 | struct nmk_i2c_controller; | 60 | struct nmk_i2c_controller; |
57 | 61 | ||
58 | static inline struct platform_device * | 62 | static inline struct platform_device * |
59 | dbx500_add_i2c(int id, resource_size_t base, int irq, | 63 | dbx500_add_i2c(struct device *parent, int id, resource_size_t base, int irq, |
60 | struct nmk_i2c_controller *pdata) | 64 | struct nmk_i2c_controller *data) |
61 | { | ||
62 | return dbx500_add_platform_device_4k1irq("nmk-i2c", id, base, irq, | ||
63 | pdata); | ||
64 | } | ||
65 | |||
66 | struct msp_i2s_platform_data; | ||
67 | |||
68 | static inline struct platform_device * | ||
69 | dbx500_add_msp_i2s(int id, resource_size_t base, int irq, | ||
70 | struct msp_i2s_platform_data *pdata) | ||
71 | { | 65 | { |
72 | return dbx500_add_platform_device_4k1irq("MSP_I2S", id, base, irq, | 66 | struct resource res[] = { |
73 | pdata); | 67 | DEFINE_RES_MEM(base, SZ_4K), |
68 | DEFINE_RES_IRQ(irq), | ||
69 | }; | ||
70 | |||
71 | struct platform_device_info pdevinfo = { | ||
72 | .parent = parent, | ||
73 | .name = "nmk-i2c", | ||
74 | .id = id, | ||
75 | .res = res, | ||
76 | .num_res = ARRAY_SIZE(res), | ||
77 | .data = data, | ||
78 | .size_data = sizeof(*data), | ||
79 | .dma_mask = DMA_BIT_MASK(32), | ||
80 | }; | ||
81 | |||
82 | return platform_device_register_full(&pdevinfo); | ||
74 | } | 83 | } |
75 | 84 | ||
76 | static inline struct amba_device * | 85 | static inline struct amba_device * |
77 | dbx500_add_rtc(resource_size_t base, int irq) | 86 | dbx500_add_rtc(struct device *parent, resource_size_t base, int irq) |
78 | { | 87 | { |
79 | return dbx500_add_amba_device("rtc-pl031", base, irq, NULL, 0); | 88 | return dbx500_add_amba_device(parent, "rtc-pl031", base, irq, NULL, 0); |
80 | } | 89 | } |
81 | 90 | ||
82 | struct nmk_gpio_platform_data; | 91 | struct nmk_gpio_platform_data; |
83 | 92 | ||
84 | void dbx500_add_gpios(resource_size_t *base, int num, int irq, | 93 | void dbx500_add_gpios(struct device *parent, resource_size_t *base, int num, |
85 | struct nmk_gpio_platform_data *pdata); | 94 | int irq, struct nmk_gpio_platform_data *pdata); |
86 | 95 | ||
87 | #endif | 96 | #endif |