2 * Copyright (C) ST-Ericsson SA 2010
4 * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson
5 * License terms: GNU General Public License (GPL), version 2.
8 #ifndef __DEVICES_COMMON_H
9 #define __DEVICES_COMMON_H
11 #include <linux/platform_device.h>
12 #include <linux/dma-mapping.h>
13 #include <linux/sys_soc.h>
14 #include <linux/amba/bus.h>
15 #include <linux/platform_data/i2c-nomadik.h>
16 #include <mach/crypto-ux500.h>
18 struct spi_master_cntlr
;
20 static inline struct amba_device
*
21 dbx500_add_msp_spi(struct device
*parent
, const char *name
,
22 resource_size_t base
, int irq
,
23 struct spi_master_cntlr
*pdata
)
25 return amba_ahb_device_add(parent
, name
, base
, SZ_4K
, irq
, 0,
29 static inline struct amba_device
*
30 dbx500_add_spi(struct device
*parent
, const char *name
, resource_size_t base
,
31 int irq
, struct spi_master_cntlr
*pdata
,
34 return amba_ahb_device_add(parent
, name
, base
, SZ_4K
, irq
, 0,
38 struct mmci_platform_data
;
40 static inline struct amba_device
*
41 dbx500_add_sdi(struct device
*parent
, const char *name
, resource_size_t base
,
42 int irq
, struct mmci_platform_data
*pdata
, u32 periphid
)
44 return amba_ahb_device_add(parent
, name
, base
, SZ_4K
, irq
, 0,
48 struct amba_pl011_data
;
50 static inline struct amba_device
*
51 dbx500_add_uart(struct device
*parent
, const char *name
, resource_size_t base
,
52 int irq
, struct amba_pl011_data
*pdata
)
54 return amba_ahb_device_add(parent
, name
, base
, SZ_4K
, irq
, 0, pdata
, 0);
57 struct nmk_i2c_controller
;
59 static inline struct amba_device
*
60 dbx500_add_i2c(struct device
*parent
, int id
, resource_size_t base
, int irq
,
61 struct nmk_i2c_controller
*data
)
63 /* Conjure a name similar to what the platform device used to have */
66 snprintf(name
, sizeof(name
), "nmk-i2c.%d", id
);
67 return amba_apb_device_add(parent
, name
, base
, SZ_4K
, irq
, 0, data
, 0);
70 static inline struct amba_device
*
71 dbx500_add_rtc(struct device
*parent
, resource_size_t base
, int irq
)
73 return amba_apb_device_add(parent
, "rtc-pl031", base
, SZ_4K
, irq
,
77 struct cryp_platform_data
;
79 static inline struct platform_device
*
80 dbx500_add_cryp1(struct device
*parent
, int id
, resource_size_t base
, int irq
,
81 struct cryp_platform_data
*pdata
)
83 struct resource res
[] = {
84 DEFINE_RES_MEM(base
, SZ_4K
),
88 struct platform_device_info pdevinfo
= {
93 .num_res
= ARRAY_SIZE(res
),
95 .size_data
= sizeof(*pdata
),
96 .dma_mask
= DMA_BIT_MASK(32),
99 return platform_device_register_full(&pdevinfo
);
102 struct hash_platform_data
;
104 static inline struct platform_device
*
105 dbx500_add_hash1(struct device
*parent
, int id
, resource_size_t base
,
106 struct hash_platform_data
*pdata
)
108 struct resource res
[] = {
109 DEFINE_RES_MEM(base
, SZ_4K
),
112 struct platform_device_info pdevinfo
= {
117 .num_res
= ARRAY_SIZE(res
),
119 .size_data
= sizeof(*pdata
),
120 .dma_mask
= DMA_BIT_MASK(32),
123 return platform_device_register_full(&pdevinfo
);
126 struct nmk_gpio_platform_data
;
128 void dbx500_add_gpios(struct device
*parent
, resource_size_t
*base
, int num
,
129 int irq
, struct nmk_gpio_platform_data
*pdata
);
132 dbx500_add_pinctrl(struct device
*parent
, const char *name
)
134 struct platform_device_info pdevinfo
= {
140 platform_device_register_full(&pdevinfo
);