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 resource dma40_resources
[] = {
24 .start
= U8500_DMA_BASE
,
25 .end
= U8500_DMA_BASE
+ SZ_4K
- 1,
26 .flags
= IORESOURCE_MEM
,
30 .start
= U8500_DMA_LCPA_BASE
,
31 .end
= U8500_DMA_LCPA_BASE
+ 2 * SZ_1K
- 1,
32 .flags
= IORESOURCE_MEM
,
36 .start
= IRQ_DB8500_DMA
,
37 .end
= IRQ_DB8500_DMA
,
38 .flags
= IORESOURCE_IRQ
,
42 /* Default configuration for physcial memcpy */
43 struct stedma40_chan_cfg dma40_memcpy_conf_phy
= {
44 .mode
= STEDMA40_MODE_PHYSICAL
,
45 .dir
= STEDMA40_MEM_TO_MEM
,
47 .src_info
.data_width
= STEDMA40_BYTE_WIDTH
,
48 .src_info
.psize
= STEDMA40_PSIZE_PHY_1
,
49 .src_info
.flow_ctrl
= STEDMA40_NO_FLOW_CTRL
,
51 .dst_info
.data_width
= STEDMA40_BYTE_WIDTH
,
52 .dst_info
.psize
= STEDMA40_PSIZE_PHY_1
,
53 .dst_info
.flow_ctrl
= STEDMA40_NO_FLOW_CTRL
,
55 /* Default configuration for logical memcpy */
56 struct stedma40_chan_cfg dma40_memcpy_conf_log
= {
57 .dir
= STEDMA40_MEM_TO_MEM
,
59 .src_info
.data_width
= STEDMA40_BYTE_WIDTH
,
60 .src_info
.psize
= STEDMA40_PSIZE_LOG_1
,
61 .src_info
.flow_ctrl
= STEDMA40_NO_FLOW_CTRL
,
63 .dst_info
.data_width
= STEDMA40_BYTE_WIDTH
,
64 .dst_info
.psize
= STEDMA40_PSIZE_LOG_1
,
65 .dst_info
.flow_ctrl
= STEDMA40_NO_FLOW_CTRL
,
69 * Mapping between destination event lines and physical device address.
70 * The event line is tied to a device and therefor the address is constant.
72 static const dma_addr_t dma40_tx_map
[DB8500_DMA_NR_DEV
];
74 /* Mapping between source event lines and physical device address */
75 static const dma_addr_t dma40_rx_map
[DB8500_DMA_NR_DEV
];
77 /* Reserved event lines for memcpy only */
78 static int dma40_memcpy_event
[] = {
79 DB8500_DMA_MEMCPY_TX_0
,
80 DB8500_DMA_MEMCPY_TX_1
,
81 DB8500_DMA_MEMCPY_TX_2
,
82 DB8500_DMA_MEMCPY_TX_3
,
83 DB8500_DMA_MEMCPY_TX_4
,
84 DB8500_DMA_MEMCPY_TX_5
,
87 static struct stedma40_platform_data dma40_plat_data
= {
88 .dev_len
= DB8500_DMA_NR_DEV
,
89 .dev_rx
= dma40_rx_map
,
90 .dev_tx
= dma40_tx_map
,
91 .memcpy
= dma40_memcpy_event
,
92 .memcpy_len
= ARRAY_SIZE(dma40_memcpy_event
),
93 .memcpy_conf_phy
= &dma40_memcpy_conf_phy
,
94 .memcpy_conf_log
= &dma40_memcpy_conf_log
,
95 .disabled_channels
= {-1},
98 struct platform_device u8500_dma40_device
= {
100 .platform_data
= &dma40_plat_data
,
104 .num_resources
= ARRAY_SIZE(dma40_resources
),
105 .resource
= dma40_resources
108 void dma40_u8500ed_fixup(void)
110 dma40_plat_data
.memcpy
= NULL
;
111 dma40_plat_data
.memcpy_len
= 0;
112 dma40_resources
[0].start
= U8500_DMA_BASE_ED
;
113 dma40_resources
[0].end
= U8500_DMA_BASE_ED
+ SZ_4K
- 1;
114 dma40_resources
[1].start
= U8500_DMA_LCPA_BASE_ED
;
115 dma40_resources
[1].end
= U8500_DMA_LCPA_BASE_ED
+ 2 * SZ_1K
- 1;
118 struct resource keypad_resources
[] = {
120 .start
= U8500_SKE_BASE
,
121 .end
= U8500_SKE_BASE
+ SZ_4K
- 1,
122 .flags
= IORESOURCE_MEM
,
125 .start
= IRQ_DB8500_KB
,
126 .end
= IRQ_DB8500_KB
,
127 .flags
= IORESOURCE_IRQ
,
131 struct platform_device u8500_ske_keypad_device
= {
132 .name
= "nmk-ske-keypad",
134 .num_resources
= ARRAY_SIZE(keypad_resources
),
135 .resource
= keypad_resources
,