blob: 3c8010f4fb3f355f75d313bddc5ddd54fc5f6e51 [file] [log] [blame]
Rabin Vincentfbf1eadf2010-09-29 19:46:32 +05301/*
2 * Copyright (C) ST-Ericsson SA 2010
3 *
4 * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson
5 * License terms: GNU General Public License (GPL), version 2.
6 */
7
8#ifndef __DEVICES_DB8500_H
9#define __DEVICES_DB8500_H
10
11#include "devices-common.h"
12
13struct ske_keypad_platform_data;
14struct pl022_ssp_controller;
15
16static inline struct platform_device *
Lee Jones18403422012-02-06 11:22:21 -080017db8500_add_ske_keypad(struct device *parent,
18 struct ske_keypad_platform_data *pdata,
19 size_t size)
Rabin Vincentfbf1eadf2010-09-29 19:46:32 +053020{
Lee Jones3510ec62012-02-06 11:22:26 -080021 struct resource resources[] = {
22 DEFINE_RES_MEM(U8500_SKE_BASE, SZ_4K),
23 DEFINE_RES_IRQ(IRQ_DB8500_KB),
24 };
25
26 return platform_device_register_resndata(parent, "nmk-ske-keypad", -1,
27 resources, 2, pdata, size);
Rabin Vincentfbf1eadf2010-09-29 19:46:32 +053028}
29
30static inline struct amba_device *
Lee Jones18403422012-02-06 11:22:21 -080031db8500_add_ssp(struct device *parent, const char *name, resource_size_t base,
32 int irq, struct pl022_ssp_controller *pdata)
Rabin Vincentfbf1eadf2010-09-29 19:46:32 +053033{
Linus Walleij08956a02012-04-03 12:00:18 +010034 return amba_ahb_device_add(parent, name, base, SZ_4K, irq, 0, pdata, 0);
Rabin Vincentfbf1eadf2010-09-29 19:46:32 +053035}
36
Lee Jones18403422012-02-06 11:22:21 -080037#define db8500_add_i2c0(parent, pdata) \
38 dbx500_add_i2c(parent, 0, U8500_I2C0_BASE, IRQ_DB8500_I2C0, pdata)
39#define db8500_add_i2c1(parent, pdata) \
40 dbx500_add_i2c(parent, 1, U8500_I2C1_BASE, IRQ_DB8500_I2C1, pdata)
41#define db8500_add_i2c2(parent, pdata) \
42 dbx500_add_i2c(parent, 2, U8500_I2C2_BASE, IRQ_DB8500_I2C2, pdata)
43#define db8500_add_i2c3(parent, pdata) \
44 dbx500_add_i2c(parent, 3, U8500_I2C3_BASE, IRQ_DB8500_I2C3, pdata)
45#define db8500_add_i2c4(parent, pdata) \
46 dbx500_add_i2c(parent, 4, U8500_I2C4_BASE, IRQ_DB8500_I2C4, pdata)
Rabin Vincentfbf1eadf2010-09-29 19:46:32 +053047
Lee Jones18403422012-02-06 11:22:21 -080048#define db8500_add_msp0_spi(parent, pdata) \
49 dbx500_add_msp_spi(parent, "msp0", U8500_MSP0_BASE, \
50 IRQ_DB8500_MSP0, pdata)
51#define db8500_add_msp1_spi(parent, pdata) \
52 dbx500_add_msp_spi(parent, "msp1", U8500_MSP1_BASE, \
53 IRQ_DB8500_MSP1, pdata)
54#define db8500_add_msp2_spi(parent, pdata) \
55 dbx500_add_msp_spi(parent, "msp2", U8500_MSP2_BASE, \
56 IRQ_DB8500_MSP2, pdata)
57#define db8500_add_msp3_spi(parent, pdata) \
58 dbx500_add_msp_spi(parent, "msp3", U8500_MSP3_BASE, \
59 IRQ_DB8500_MSP1, pdata)
Rabin Vincentfbf1eadf2010-09-29 19:46:32 +053060
Lee Jones18403422012-02-06 11:22:21 -080061#define db8500_add_rtc(parent) \
62 dbx500_add_rtc(parent, U8500_RTC_BASE, IRQ_DB8500_RTC);
Rabin Vincentfbf1eadf2010-09-29 19:46:32 +053063
Lee Jones18403422012-02-06 11:22:21 -080064#define db8500_add_usb(parent, rx_cfg, tx_cfg) \
65 ux500_add_usb(parent, U8500_USBOTG_BASE, \
66 IRQ_DB8500_USBOTG, rx_cfg, tx_cfg)
Mian Yousaf Kaukab6f3f3c3f2011-01-21 18:21:50 +010067
Lee Jones18403422012-02-06 11:22:21 -080068#define db8500_add_sdi0(parent, pdata, pid) \
69 dbx500_add_sdi(parent, "sdi0", U8500_SDI0_BASE, \
70 IRQ_DB8500_SDMMC0, pdata, pid)
71#define db8500_add_sdi1(parent, pdata, pid) \
72 dbx500_add_sdi(parent, "sdi1", U8500_SDI1_BASE, \
73 IRQ_DB8500_SDMMC1, pdata, pid)
74#define db8500_add_sdi2(parent, pdata, pid) \
75 dbx500_add_sdi(parent, "sdi2", U8500_SDI2_BASE, \
76 IRQ_DB8500_SDMMC2, pdata, pid)
77#define db8500_add_sdi3(parent, pdata, pid) \
78 dbx500_add_sdi(parent, "sdi3", U8500_SDI3_BASE, \
79 IRQ_DB8500_SDMMC3, pdata, pid)
80#define db8500_add_sdi4(parent, pdata, pid) \
81 dbx500_add_sdi(parent, "sdi4", U8500_SDI4_BASE, \
82 IRQ_DB8500_SDMMC4, pdata, pid)
83#define db8500_add_sdi5(parent, pdata, pid) \
84 dbx500_add_sdi(parent, "sdi5", U8500_SDI5_BASE, \
85 IRQ_DB8500_SDMMC5, pdata, pid)
Rabin Vincentfbf1eadf2010-09-29 19:46:32 +053086
Lee Jones18403422012-02-06 11:22:21 -080087#define db8500_add_ssp0(parent, pdata) \
88 db8500_add_ssp(parent, "ssp0", U8500_SSP0_BASE, \
89 IRQ_DB8500_SSP0, pdata)
90#define db8500_add_ssp1(parent, pdata) \
91 db8500_add_ssp(parent, "ssp1", U8500_SSP1_BASE, \
92 IRQ_DB8500_SSP1, pdata)
Rabin Vincentfbf1eadf2010-09-29 19:46:32 +053093
Lee Jones18403422012-02-06 11:22:21 -080094#define db8500_add_spi0(parent, pdata) \
95 dbx500_add_spi(parent, "spi0", U8500_SPI0_BASE, \
96 IRQ_DB8500_SPI0, pdata, 0)
97#define db8500_add_spi1(parent, pdata) \
98 dbx500_add_spi(parent, "spi1", U8500_SPI1_BASE, \
99 IRQ_DB8500_SPI1, pdata, 0)
100#define db8500_add_spi2(parent, pdata) \
101 dbx500_add_spi(parent, "spi2", U8500_SPI2_BASE, \
102 IRQ_DB8500_SPI2, pdata, 0)
103#define db8500_add_spi3(parent, pdata) \
104 dbx500_add_spi(parent, "spi3", U8500_SPI3_BASE, \
105 IRQ_DB8500_SPI3, pdata, 0)
Rabin Vincentfbf1eadf2010-09-29 19:46:32 +0530106
Lee Jones18403422012-02-06 11:22:21 -0800107#define db8500_add_uart0(parent, pdata) \
108 dbx500_add_uart(parent, "uart0", U8500_UART0_BASE, \
109 IRQ_DB8500_UART0, pdata)
110#define db8500_add_uart1(parent, pdata) \
111 dbx500_add_uart(parent, "uart1", U8500_UART1_BASE, \
112 IRQ_DB8500_UART1, pdata)
113#define db8500_add_uart2(parent, pdata) \
114 dbx500_add_uart(parent, "uart2", U8500_UART2_BASE, \
115 IRQ_DB8500_UART2, pdata)
Rabin Vincentfbf1eadf2010-09-29 19:46:32 +0530116
Andreas Westin585d1882012-05-10 10:14:06 +0200117#define db8500_add_cryp1(parent, pdata) \
118 dbx500_add_cryp1(parent, -1, U8500_CRYP1_BASE, IRQ_DB8500_CRYP1, pdata)
119#define db8500_add_hash1(parent, pdata) \
120 dbx500_add_hash1(parent, -1, U8500_HASH1_BASE, pdata)
Rabin Vincentfbf1eadf2010-09-29 19:46:32 +0530121#endif