aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-ux500
diff options
context:
space:
mode:
authorPer Forlin <per.forlin@linaro.org>2010-12-05 07:35:12 -0500
committerLinus Walleij <linus.walleij@stericsson.com>2010-12-08 07:21:31 -0500
commite8b1cc3a341684dfc02fd02f52308752b031668c (patch)
tree54146b6a0d7b70bdf794750577ca3990c2cf8cd1 /arch/arm/mach-ux500
parentbab263e0ce624b05bdcf568e83a9ca4ce71f5e3d (diff)
ux500: Add DMA support for U5500
Add basic DMA configuration for u5500 supporting memcpy. Make way for SDI0 dma support by setting SDI0 to -1, indicating it will be configured in runtime. Signed-off-by: Per Forlin <per.forlin@linaro.org> Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
Diffstat (limited to 'arch/arm/mach-ux500')
-rw-r--r--arch/arm/mach-ux500/Makefile2
-rw-r--r--arch/arm/mach-ux500/cpu-db5500.c2
-rw-r--r--arch/arm/mach-ux500/dma-db5500.c120
-rw-r--r--arch/arm/mach-ux500/include/mach/db5500-regs.h4
-rw-r--r--arch/arm/mach-ux500/include/mach/setup.h2
5 files changed, 129 insertions, 1 deletions
diff --git a/arch/arm/mach-ux500/Makefile b/arch/arm/mach-ux500/Makefile
index fb65e598bff..9720e428442 100644
--- a/arch/arm/mach-ux500/Makefile
+++ b/arch/arm/mach-ux500/Makefile
@@ -3,7 +3,7 @@
3# 3#
4 4
5obj-y := clock.o cpu.o devices.o devices-common.o 5obj-y := clock.o cpu.o devices.o devices-common.o
6obj-$(CONFIG_UX500_SOC_DB5500) += cpu-db5500.o devices-db5500.o 6obj-$(CONFIG_UX500_SOC_DB5500) += cpu-db5500.o devices-db5500.o dma-db5500.o
7obj-$(CONFIG_UX500_SOC_DB8500) += cpu-db8500.o devices-db8500.o prcmu.o 7obj-$(CONFIG_UX500_SOC_DB8500) += cpu-db8500.o devices-db8500.o prcmu.o
8obj-$(CONFIG_MACH_U8500_MOP) += board-mop500.o board-mop500-sdi.o 8obj-$(CONFIG_MACH_U8500_MOP) += board-mop500.o board-mop500-sdi.o
9obj-$(CONFIG_MACH_U5500) += board-u5500.o board-u5500-sdi.o 9obj-$(CONFIG_MACH_U5500) += board-u5500.o board-u5500-sdi.o
diff --git a/arch/arm/mach-ux500/cpu-db5500.c b/arch/arm/mach-ux500/cpu-db5500.c
index bcc0fd4fdc2..8816844d7e4 100644
--- a/arch/arm/mach-ux500/cpu-db5500.c
+++ b/arch/arm/mach-ux500/cpu-db5500.c
@@ -135,6 +135,8 @@ void __init u5500_map_io(void)
135 135
136void __init u5500_init_devices(void) 136void __init u5500_init_devices(void)
137{ 137{
138 db5500_dma_init();
139
138 db5500_add_rtc(); 140 db5500_add_rtc();
139 141
140 platform_add_devices(u5500_platform_devs, 142 platform_add_devices(u5500_platform_devs,
diff --git a/arch/arm/mach-ux500/dma-db5500.c b/arch/arm/mach-ux500/dma-db5500.c
new file mode 100644
index 00000000000..32a061f8a95
--- /dev/null
+++ b/arch/arm/mach-ux500/dma-db5500.c
@@ -0,0 +1,120 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2010
3 *
4 * Author: Per Forlin <per.forlin@stericsson.com> for ST-Ericsson
5 * Author: Jonas Aaberg <jonas.aberg@stericsson.com> for ST-Ericsson
6 * Author: Rabin Vincent <rabinv.vincent@stericsson.com> for ST-Ericsson
7 *
8 * License terms: GNU General Public License (GPL), version 2
9 */
10
11#include <linux/kernel.h>
12#include <linux/platform_device.h>
13
14#include <plat/ste_dma40.h>
15#include <mach/setup.h>
16#include <mach/hardware.h>
17
18#include "ste-dma40-db5500.h"
19
20static struct resource dma40_resources[] = {
21 [0] = {
22 .start = U5500_DMA_BASE,
23 .end = U5500_DMA_BASE + SZ_4K - 1,
24 .flags = IORESOURCE_MEM,
25 .name = "base",
26 },
27 [1] = {
28 .start = U5500_DMA_LCPA_BASE,
29 .end = U5500_DMA_LCPA_BASE + 2 * SZ_1K - 1,
30 .flags = IORESOURCE_MEM,
31 .name = "lcpa",
32 },
33 [2] = {
34 .start = IRQ_DB5500_DMA,
35 .end = IRQ_DB5500_DMA,
36 .flags = IORESOURCE_IRQ
37 }
38};
39
40/* Default configuration for physical memcpy */
41static struct stedma40_chan_cfg dma40_memcpy_conf_phy = {
42 .mode = STEDMA40_MODE_PHYSICAL,
43 .dir = STEDMA40_MEM_TO_MEM,
44
45 .src_info.data_width = STEDMA40_BYTE_WIDTH,
46 .src_info.psize = STEDMA40_PSIZE_PHY_1,
47 .src_info.flow_ctrl = STEDMA40_NO_FLOW_CTRL,
48
49 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
50 .dst_info.psize = STEDMA40_PSIZE_PHY_1,
51 .dst_info.flow_ctrl = STEDMA40_NO_FLOW_CTRL,
52};
53
54/* Default configuration for logical memcpy */
55static struct stedma40_chan_cfg dma40_memcpy_conf_log = {
56 .dir = STEDMA40_MEM_TO_MEM,
57
58 .src_info.data_width = STEDMA40_BYTE_WIDTH,
59 .src_info.psize = STEDMA40_PSIZE_LOG_1,
60 .src_info.flow_ctrl = STEDMA40_NO_FLOW_CTRL,
61
62 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
63 .dst_info.psize = STEDMA40_PSIZE_LOG_1,
64 .dst_info.flow_ctrl = STEDMA40_NO_FLOW_CTRL,
65};
66
67/*
68 * Mapping between soruce event lines and physical device address This was
69 * created assuming that the event line is tied to a device and therefore the
70 * address is constant, however this is not true for at least USB, and the
71 * values are just placeholders for USB. This table is preserved and used for
72 * now.
73 */
74static const dma_addr_t dma40_rx_map[DB5500_DMA_NR_DEV] = {
75 [DB5500_DMA_DEV24_SDMMC0_RX] = -1,
76};
77
78/* Mapping between destination event lines and physical device address */
79static const dma_addr_t dma40_tx_map[DB5500_DMA_NR_DEV] = {
80 [DB5500_DMA_DEV24_SDMMC0_TX] = -1,
81};
82
83static int dma40_memcpy_event[] = {
84 DB5500_DMA_MEMCPY_TX_1,
85 DB5500_DMA_MEMCPY_TX_2,
86 DB5500_DMA_MEMCPY_TX_3,
87 DB5500_DMA_MEMCPY_TX_4,
88 DB5500_DMA_MEMCPY_TX_5,
89};
90
91static struct stedma40_platform_data dma40_plat_data = {
92 .dev_len = ARRAY_SIZE(dma40_rx_map),
93 .dev_rx = dma40_rx_map,
94 .dev_tx = dma40_tx_map,
95 .memcpy = dma40_memcpy_event,
96 .memcpy_len = ARRAY_SIZE(dma40_memcpy_event),
97 .memcpy_conf_phy = &dma40_memcpy_conf_phy,
98 .memcpy_conf_log = &dma40_memcpy_conf_log,
99 .disabled_channels = {-1},
100};
101
102static struct platform_device dma40_device = {
103 .dev = {
104 .platform_data = &dma40_plat_data,
105 },
106 .name = "dma40",
107 .id = 0,
108 .num_resources = ARRAY_SIZE(dma40_resources),
109 .resource = dma40_resources
110};
111
112void __init db5500_dma_init(void)
113{
114 int ret;
115
116 ret = platform_device_register(&dma40_device);
117 if (ret)
118 dev_err(&dma40_device.dev, "unable to register device: %d\n", ret);
119
120}
diff --git a/arch/arm/mach-ux500/include/mach/db5500-regs.h b/arch/arm/mach-ux500/include/mach/db5500-regs.h
index 3eafc0e24ba..bd88c1e7406 100644
--- a/arch/arm/mach-ux500/include/mach/db5500-regs.h
+++ b/arch/arm/mach-ux500/include/mach/db5500-regs.h
@@ -114,4 +114,8 @@
114#define U5500_MBOX2_LOCAL_START (U5500_MBOX_BASE + 0x20) 114#define U5500_MBOX2_LOCAL_START (U5500_MBOX_BASE + 0x20)
115#define U5500_MBOX2_LOCAL_END (U5500_MBOX_BASE + 0x3F) 115#define U5500_MBOX2_LOCAL_END (U5500_MBOX_BASE + 0x3F)
116 116
117#define U5500_ESRAM_BASE 0x40000000
118#define U5500_ESRAM_DMA_LCPA_OFFSET 0x10000
119#define U5500_DMA_LCPA_BASE (U5500_ESRAM_BASE + U5500_ESRAM_DMA_LCPA_OFFSET)
120
117#endif 121#endif
diff --git a/arch/arm/mach-ux500/include/mach/setup.h b/arch/arm/mach-ux500/include/mach/setup.h
index 22788a7d35d..469877e0de9 100644
--- a/arch/arm/mach-ux500/include/mach/setup.h
+++ b/arch/arm/mach-ux500/include/mach/setup.h
@@ -25,6 +25,8 @@ extern void __init ux500_init_irq(void);
25 25
26extern void __init u5500_sdi_init(void); 26extern void __init u5500_sdi_init(void);
27 27
28extern void __init db5500_dma_init(void);
29
28/* We re-use nomadik_timer for this platform */ 30/* We re-use nomadik_timer for this platform */
29extern void nmdk_timer_init(void); 31extern void nmdk_timer_init(void);
30 32