blob: 321998320f98536abf4ef603b498d430ab0e1ac0 [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
Linus Walleij2cdda352012-12-14 16:26:28 +010011#include <linux/platform_data/usb-musb-ux500.h>
Arnd Bergmanneba52742013-03-21 22:51:08 +010012#include "irqs.h"
Linus Walleij174e7792013-03-19 15:41:55 +010013#include "db8500-regs.h"
Rabin Vincentfbf1eadf2010-09-29 19:46:32 +053014#include "devices-common.h"
15
16struct ske_keypad_platform_data;
17struct pl022_ssp_controller;
Linus Walleij05ec2602013-02-07 10:17:31 +010018struct platform_device;
19
20extern struct ab8500_platform_data ab8500_platdata;
21extern struct prcmu_pdata db8500_prcmu_pdata;
22extern struct platform_device db8500_prcmu_device;
Rabin Vincentfbf1eadf2010-09-29 19:46:32 +053023
24static inline struct platform_device *
Lee Jones18403422012-02-06 11:22:21 -080025db8500_add_ske_keypad(struct device *parent,
26 struct ske_keypad_platform_data *pdata,
27 size_t size)
Rabin Vincentfbf1eadf2010-09-29 19:46:32 +053028{
Lee Jones3510ec62012-02-06 11:22:26 -080029 struct resource resources[] = {
30 DEFINE_RES_MEM(U8500_SKE_BASE, SZ_4K),
31 DEFINE_RES_IRQ(IRQ_DB8500_KB),
32 };
33
34 return platform_device_register_resndata(parent, "nmk-ske-keypad", -1,
35 resources, 2, pdata, size);
Rabin Vincentfbf1eadf2010-09-29 19:46:32 +053036}
37
38static inline struct amba_device *
Lee Jones18403422012-02-06 11:22:21 -080039db8500_add_ssp(struct device *parent, const char *name, resource_size_t base,
40 int irq, struct pl022_ssp_controller *pdata)
Rabin Vincentfbf1eadf2010-09-29 19:46:32 +053041{
Linus Walleij08956a02012-04-03 12:00:18 +010042 return amba_ahb_device_add(parent, name, base, SZ_4K, irq, 0, pdata, 0);
Rabin Vincentfbf1eadf2010-09-29 19:46:32 +053043}
44
Lee Jones18403422012-02-06 11:22:21 -080045#define db8500_add_i2c0(parent, pdata) \
46 dbx500_add_i2c(parent, 0, U8500_I2C0_BASE, IRQ_DB8500_I2C0, pdata)
47#define db8500_add_i2c1(parent, pdata) \
48 dbx500_add_i2c(parent, 1, U8500_I2C1_BASE, IRQ_DB8500_I2C1, pdata)
49#define db8500_add_i2c2(parent, pdata) \
50 dbx500_add_i2c(parent, 2, U8500_I2C2_BASE, IRQ_DB8500_I2C2, pdata)
51#define db8500_add_i2c3(parent, pdata) \
52 dbx500_add_i2c(parent, 3, U8500_I2C3_BASE, IRQ_DB8500_I2C3, pdata)
53#define db8500_add_i2c4(parent, pdata) \
54 dbx500_add_i2c(parent, 4, U8500_I2C4_BASE, IRQ_DB8500_I2C4, pdata)
Rabin Vincentfbf1eadf2010-09-29 19:46:32 +053055
Lee Jones18403422012-02-06 11:22:21 -080056#define db8500_add_msp0_spi(parent, pdata) \
57 dbx500_add_msp_spi(parent, "msp0", U8500_MSP0_BASE, \
58 IRQ_DB8500_MSP0, pdata)
59#define db8500_add_msp1_spi(parent, pdata) \
60 dbx500_add_msp_spi(parent, "msp1", U8500_MSP1_BASE, \
61 IRQ_DB8500_MSP1, pdata)
62#define db8500_add_msp2_spi(parent, pdata) \
63 dbx500_add_msp_spi(parent, "msp2", U8500_MSP2_BASE, \
64 IRQ_DB8500_MSP2, pdata)
65#define db8500_add_msp3_spi(parent, pdata) \
66 dbx500_add_msp_spi(parent, "msp3", U8500_MSP3_BASE, \
67 IRQ_DB8500_MSP1, pdata)
Rabin Vincentfbf1eadf2010-09-29 19:46:32 +053068
Lee Jones18403422012-02-06 11:22:21 -080069#define db8500_add_rtc(parent) \
70 dbx500_add_rtc(parent, U8500_RTC_BASE, IRQ_DB8500_RTC);
Rabin Vincentfbf1eadf2010-09-29 19:46:32 +053071
Lee Jones18403422012-02-06 11:22:21 -080072#define db8500_add_usb(parent, rx_cfg, tx_cfg) \
73 ux500_add_usb(parent, U8500_USBOTG_BASE, \
74 IRQ_DB8500_USBOTG, rx_cfg, tx_cfg)
Mian Yousaf Kaukab6f3f3c3f2011-01-21 18:21:50 +010075
Lee Jones18403422012-02-06 11:22:21 -080076#define db8500_add_sdi0(parent, pdata, pid) \
77 dbx500_add_sdi(parent, "sdi0", U8500_SDI0_BASE, \
78 IRQ_DB8500_SDMMC0, pdata, pid)
79#define db8500_add_sdi1(parent, pdata, pid) \
80 dbx500_add_sdi(parent, "sdi1", U8500_SDI1_BASE, \
81 IRQ_DB8500_SDMMC1, pdata, pid)
82#define db8500_add_sdi2(parent, pdata, pid) \
83 dbx500_add_sdi(parent, "sdi2", U8500_SDI2_BASE, \
84 IRQ_DB8500_SDMMC2, pdata, pid)
85#define db8500_add_sdi3(parent, pdata, pid) \
86 dbx500_add_sdi(parent, "sdi3", U8500_SDI3_BASE, \
87 IRQ_DB8500_SDMMC3, pdata, pid)
88#define db8500_add_sdi4(parent, pdata, pid) \
89 dbx500_add_sdi(parent, "sdi4", U8500_SDI4_BASE, \
90 IRQ_DB8500_SDMMC4, pdata, pid)
91#define db8500_add_sdi5(parent, pdata, pid) \
92 dbx500_add_sdi(parent, "sdi5", U8500_SDI5_BASE, \
93 IRQ_DB8500_SDMMC5, pdata, pid)
Rabin Vincentfbf1eadf2010-09-29 19:46:32 +053094
Lee Jones18403422012-02-06 11:22:21 -080095#define db8500_add_ssp0(parent, pdata) \
96 db8500_add_ssp(parent, "ssp0", U8500_SSP0_BASE, \
97 IRQ_DB8500_SSP0, pdata)
98#define db8500_add_ssp1(parent, pdata) \
99 db8500_add_ssp(parent, "ssp1", U8500_SSP1_BASE, \
100 IRQ_DB8500_SSP1, pdata)
Rabin Vincentfbf1eadf2010-09-29 19:46:32 +0530101
Lee Jones18403422012-02-06 11:22:21 -0800102#define db8500_add_spi0(parent, pdata) \
103 dbx500_add_spi(parent, "spi0", U8500_SPI0_BASE, \
104 IRQ_DB8500_SPI0, pdata, 0)
105#define db8500_add_spi1(parent, pdata) \
106 dbx500_add_spi(parent, "spi1", U8500_SPI1_BASE, \
107 IRQ_DB8500_SPI1, pdata, 0)
108#define db8500_add_spi2(parent, pdata) \
109 dbx500_add_spi(parent, "spi2", U8500_SPI2_BASE, \
110 IRQ_DB8500_SPI2, pdata, 0)
111#define db8500_add_spi3(parent, pdata) \
112 dbx500_add_spi(parent, "spi3", U8500_SPI3_BASE, \
113 IRQ_DB8500_SPI3, pdata, 0)
Rabin Vincentfbf1eadf2010-09-29 19:46:32 +0530114
Lee Jones18403422012-02-06 11:22:21 -0800115#define db8500_add_uart0(parent, pdata) \
116 dbx500_add_uart(parent, "uart0", U8500_UART0_BASE, \
117 IRQ_DB8500_UART0, pdata)
118#define db8500_add_uart1(parent, pdata) \
119 dbx500_add_uart(parent, "uart1", U8500_UART1_BASE, \
120 IRQ_DB8500_UART1, pdata)
121#define db8500_add_uart2(parent, pdata) \
122 dbx500_add_uart(parent, "uart2", U8500_UART2_BASE, \
123 IRQ_DB8500_UART2, pdata)
Rabin Vincentfbf1eadf2010-09-29 19:46:32 +0530124
Andreas Westin585d1882012-05-10 10:14:06 +0200125#define db8500_add_cryp1(parent, pdata) \
126 dbx500_add_cryp1(parent, -1, U8500_CRYP1_BASE, IRQ_DB8500_CRYP1, pdata)
127#define db8500_add_hash1(parent, pdata) \
128 dbx500_add_hash1(parent, -1, U8500_HASH1_BASE, pdata)
Rabin Vincentfbf1eadf2010-09-29 19:46:32 +0530129#endif