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 #include <linux/kernel.h>
9 #include <linux/platform_device.h>
10 #include <linux/interrupt.h>
12 #include <linux/gpio.h>
13 #include <linux/amba/bus.h>
15 #include <plat/ste_dma40.h>
17 #include <mach/hardware.h>
18 #include <mach/setup.h>
20 #include "ste-dma40-db8500.h"
22 static struct nmk_gpio_platform_data u8500_gpio_data
[] = {
23 GPIO_DATA("GPIO-0-31", 0),
24 GPIO_DATA("GPIO-32-63", 32), /* 37..63 not routed to pin */
25 GPIO_DATA("GPIO-64-95", 64),
26 GPIO_DATA("GPIO-96-127", 96), /* 98..127 not routed to pin */
27 GPIO_DATA("GPIO-128-159", 128),
28 GPIO_DATA("GPIO-160-191", 160), /* 172..191 not routed to pin */
29 GPIO_DATA("GPIO-192-223", 192),
30 GPIO_DATA("GPIO-224-255", 224), /* 231..255 not routed to pin */
31 GPIO_DATA("GPIO-256-288", 256), /* 268..288 not routed to pin */
34 static struct resource u8500_gpio_resources
[] = {
46 struct platform_device u8500_gpio_devs
[] = {
58 static struct resource dma40_resources
[] = {
60 .start
= U8500_DMA_BASE
,
61 .end
= U8500_DMA_BASE
+ SZ_4K
- 1,
62 .flags
= IORESOURCE_MEM
,
66 .start
= U8500_DMA_LCPA_BASE
,
67 .end
= U8500_DMA_LCPA_BASE
+ 2 * SZ_1K
- 1,
68 .flags
= IORESOURCE_MEM
,
72 .start
= IRQ_DB8500_DMA
,
73 .end
= IRQ_DB8500_DMA
,
74 .flags
= IORESOURCE_IRQ
,
78 /* Default configuration for physcial memcpy */
79 struct stedma40_chan_cfg dma40_memcpy_conf_phy
= {
80 .mode
= STEDMA40_MODE_PHYSICAL
,
81 .dir
= STEDMA40_MEM_TO_MEM
,
83 .src_info
.data_width
= STEDMA40_BYTE_WIDTH
,
84 .src_info
.psize
= STEDMA40_PSIZE_PHY_1
,
85 .src_info
.flow_ctrl
= STEDMA40_NO_FLOW_CTRL
,
87 .dst_info
.data_width
= STEDMA40_BYTE_WIDTH
,
88 .dst_info
.psize
= STEDMA40_PSIZE_PHY_1
,
89 .dst_info
.flow_ctrl
= STEDMA40_NO_FLOW_CTRL
,
91 /* Default configuration for logical memcpy */
92 struct stedma40_chan_cfg dma40_memcpy_conf_log
= {
93 .dir
= STEDMA40_MEM_TO_MEM
,
95 .src_info
.data_width
= STEDMA40_BYTE_WIDTH
,
96 .src_info
.psize
= STEDMA40_PSIZE_LOG_1
,
97 .src_info
.flow_ctrl
= STEDMA40_NO_FLOW_CTRL
,
99 .dst_info
.data_width
= STEDMA40_BYTE_WIDTH
,
100 .dst_info
.psize
= STEDMA40_PSIZE_LOG_1
,
101 .dst_info
.flow_ctrl
= STEDMA40_NO_FLOW_CTRL
,
105 * Mapping between destination event lines and physical device address.
106 * The event line is tied to a device and therefor the address is constant.
108 static const dma_addr_t dma40_tx_map
[DB8500_DMA_NR_DEV
];
110 /* Mapping between source event lines and physical device address */
111 static const dma_addr_t dma40_rx_map
[DB8500_DMA_NR_DEV
];
113 /* Reserved event lines for memcpy only */
114 static int dma40_memcpy_event
[] = {
115 DB8500_DMA_MEMCPY_TX_0
,
116 DB8500_DMA_MEMCPY_TX_1
,
117 DB8500_DMA_MEMCPY_TX_2
,
118 DB8500_DMA_MEMCPY_TX_3
,
119 DB8500_DMA_MEMCPY_TX_4
,
120 DB8500_DMA_MEMCPY_TX_5
,
123 static struct stedma40_platform_data dma40_plat_data
= {
124 .dev_len
= DB8500_DMA_NR_DEV
,
125 .dev_rx
= dma40_rx_map
,
126 .dev_tx
= dma40_tx_map
,
127 .memcpy
= dma40_memcpy_event
,
128 .memcpy_len
= ARRAY_SIZE(dma40_memcpy_event
),
129 .memcpy_conf_phy
= &dma40_memcpy_conf_phy
,
130 .memcpy_conf_log
= &dma40_memcpy_conf_log
,
131 .disabled_channels
= {-1},
134 struct platform_device u8500_dma40_device
= {
136 .platform_data
= &dma40_plat_data
,
140 .num_resources
= ARRAY_SIZE(dma40_resources
),
141 .resource
= dma40_resources
144 void dma40_u8500ed_fixup(void)
146 dma40_plat_data
.memcpy
= NULL
;
147 dma40_plat_data
.memcpy_len
= 0;
148 dma40_resources
[0].start
= U8500_DMA_BASE_ED
;
149 dma40_resources
[0].end
= U8500_DMA_BASE_ED
+ SZ_4K
- 1;
150 dma40_resources
[1].start
= U8500_DMA_LCPA_BASE_ED
;
151 dma40_resources
[1].end
= U8500_DMA_LCPA_BASE_ED
+ 2 * SZ_1K
- 1;
154 struct resource keypad_resources
[] = {
156 .start
= U8500_SKE_BASE
,
157 .end
= U8500_SKE_BASE
+ SZ_4K
- 1,
158 .flags
= IORESOURCE_MEM
,
161 .start
= IRQ_DB8500_KB
,
162 .end
= IRQ_DB8500_KB
,
163 .flags
= IORESOURCE_IRQ
,
167 struct platform_device ux500_ske_keypad_device
= {
168 .name
= "nmk-ske-keypad",
170 .num_resources
= ARRAY_SIZE(keypad_resources
),
171 .resource
= keypad_resources
,