aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2010-12-21 19:48:20 -0500
committerTony Lindgren <tony@atomide.com>2010-12-21 19:48:20 -0500
commit6971071cdda79cad5f53ba390e466d696e7e9006 (patch)
treeafa3f33334ac8115caa05a53addea137bcbe9164 /arch/arm/mach-omap2
parent4584acc3ee236424b5d0b52f143d980cae3c2be5 (diff)
parentf31cc9622d75c1c6f041d786698daa425c0425c2 (diff)
Merge branch 'devel-dma' into omap-for-linus
Diffstat (limited to 'arch/arm/mach-omap2')
-rw-r--r--arch/arm/mach-omap2/Makefile2
-rw-r--r--arch/arm/mach-omap2/dma.c297
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2420_data.c86
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2430_data.c86
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_3xxx_data.c97
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_44xx_data.c102
6 files changed, 669 insertions, 1 deletions
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index b86b06292388..cdfb5faaec9d 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -4,7 +4,7 @@
4 4
5# Common support 5# Common support
6obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o timer-gp.o pm.o \ 6obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o timer-gp.o pm.o \
7 common.o gpio.o 7 common.o gpio.o dma.o
8 8
9omap-2-3-common = irq.o sdrc.o prm2xxx_3xxx.o 9omap-2-3-common = irq.o sdrc.o prm2xxx_3xxx.o
10hwmod-common = omap_hwmod.o \ 10hwmod-common = omap_hwmod.o \
diff --git a/arch/arm/mach-omap2/dma.c b/arch/arm/mach-omap2/dma.c
new file mode 100644
index 000000000000..d2f15f5cfd36
--- /dev/null
+++ b/arch/arm/mach-omap2/dma.c
@@ -0,0 +1,297 @@
1/*
2 * OMAP2+ DMA driver
3 *
4 * Copyright (C) 2003 - 2008 Nokia Corporation
5 * Author: Juha Yrjölä <juha.yrjola@nokia.com>
6 * DMA channel linking for 1610 by Samuel Ortiz <samuel.ortiz@nokia.com>
7 * Graphics DMA and LCD DMA graphics tranformations
8 * by Imre Deak <imre.deak@nokia.com>
9 * OMAP2/3 support Copyright (C) 2004-2007 Texas Instruments, Inc.
10 * Some functions based on earlier dma-omap.c Copyright (C) 2001 RidgeRun, Inc.
11 *
12 * Copyright (C) 2009 Texas Instruments
13 * Added OMAP4 support - Santosh Shilimkar <santosh.shilimkar@ti.com>
14 *
15 * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
16 * Converted DMA library into platform driver
17 * - G, Manjunath Kondaiah <manjugk@ti.com>
18 *
19 * This program is free software; you can redistribute it and/or modify
20 * it under the terms of the GNU General Public License version 2 as
21 * published by the Free Software Foundation.
22 */
23
24#include <linux/err.h>
25#include <linux/io.h>
26#include <linux/slab.h>
27#include <linux/module.h>
28#include <linux/init.h>
29#include <linux/device.h>
30
31#include <plat/omap_hwmod.h>
32#include <plat/omap_device.h>
33#include <plat/dma.h>
34
35#define OMAP2_DMA_STRIDE 0x60
36
37static u32 errata;
38static u8 dma_stride;
39
40static struct omap_dma_dev_attr *d;
41
42static enum omap_reg_offsets dma_common_ch_start, dma_common_ch_end;
43
44static u16 reg_map[] = {
45 [REVISION] = 0x00,
46 [GCR] = 0x78,
47 [IRQSTATUS_L0] = 0x08,
48 [IRQSTATUS_L1] = 0x0c,
49 [IRQSTATUS_L2] = 0x10,
50 [IRQSTATUS_L3] = 0x14,
51 [IRQENABLE_L0] = 0x18,
52 [IRQENABLE_L1] = 0x1c,
53 [IRQENABLE_L2] = 0x20,
54 [IRQENABLE_L3] = 0x24,
55 [SYSSTATUS] = 0x28,
56 [OCP_SYSCONFIG] = 0x2c,
57 [CAPS_0] = 0x64,
58 [CAPS_2] = 0x6c,
59 [CAPS_3] = 0x70,
60 [CAPS_4] = 0x74,
61
62 /* Common register offsets */
63 [CCR] = 0x80,
64 [CLNK_CTRL] = 0x84,
65 [CICR] = 0x88,
66 [CSR] = 0x8c,
67 [CSDP] = 0x90,
68 [CEN] = 0x94,
69 [CFN] = 0x98,
70 [CSEI] = 0xa4,
71 [CSFI] = 0xa8,
72 [CDEI] = 0xac,
73 [CDFI] = 0xb0,
74 [CSAC] = 0xb4,
75 [CDAC] = 0xb8,
76
77 /* Channel specific register offsets */
78 [CSSA] = 0x9c,
79 [CDSA] = 0xa0,
80 [CCEN] = 0xbc,
81 [CCFN] = 0xc0,
82 [COLOR] = 0xc4,
83
84 /* OMAP4 specific registers */
85 [CDP] = 0xd0,
86 [CNDP] = 0xd4,
87 [CCDN] = 0xd8,
88};
89
90static struct omap_device_pm_latency omap2_dma_latency[] = {
91 {
92 .deactivate_func = omap_device_idle_hwmods,
93 .activate_func = omap_device_enable_hwmods,
94 .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
95 },
96};
97
98static void __iomem *dma_base;
99static inline void dma_write(u32 val, int reg, int lch)
100{
101 u8 stride;
102 u32 offset;
103
104 stride = (reg >= dma_common_ch_start) ? dma_stride : 0;
105 offset = reg_map[reg] + (stride * lch);
106 __raw_writel(val, dma_base + offset);
107}
108
109static inline u32 dma_read(int reg, int lch)
110{
111 u8 stride;
112 u32 offset, val;
113
114 stride = (reg >= dma_common_ch_start) ? dma_stride : 0;
115 offset = reg_map[reg] + (stride * lch);
116 val = __raw_readl(dma_base + offset);
117 return val;
118}
119
120static inline void omap2_disable_irq_lch(int lch)
121{
122 u32 val;
123
124 val = dma_read(IRQENABLE_L0, lch);
125 val &= ~(1 << lch);
126 dma_write(val, IRQENABLE_L0, lch);
127}
128
129static void omap2_clear_dma(int lch)
130{
131 int i = dma_common_ch_start;
132
133 for (; i <= dma_common_ch_end; i += 1)
134 dma_write(0, i, lch);
135}
136
137static void omap2_show_dma_caps(void)
138{
139 u8 revision = dma_read(REVISION, 0) & 0xff;
140 printk(KERN_INFO "OMAP DMA hardware revision %d.%d\n",
141 revision >> 4, revision & 0xf);
142 return;
143}
144
145static u32 configure_dma_errata(void)
146{
147
148 /*
149 * Errata applicable for OMAP2430ES1.0 and all omap2420
150 *
151 * I.
152 * Erratum ID: Not Available
153 * Inter Frame DMA buffering issue DMA will wrongly
154 * buffer elements if packing and bursting is enabled. This might
155 * result in data gets stalled in FIFO at the end of the block.
156 * Workaround: DMA channels must have BUFFERING_DISABLED bit set to
157 * guarantee no data will stay in the DMA FIFO in case inter frame
158 * buffering occurs
159 *
160 * II.
161 * Erratum ID: Not Available
162 * DMA may hang when several channels are used in parallel
163 * In the following configuration, DMA channel hanging can occur:
164 * a. Channel i, hardware synchronized, is enabled
165 * b. Another channel (Channel x), software synchronized, is enabled.
166 * c. Channel i is disabled before end of transfer
167 * d. Channel i is reenabled.
168 * e. Steps 1 to 4 are repeated a certain number of times.
169 * f. A third channel (Channel y), software synchronized, is enabled.
170 * Channel x and Channel y may hang immediately after step 'f'.
171 * Workaround:
172 * For any channel used - make sure NextLCH_ID is set to the value j.
173 */
174 if (cpu_is_omap2420() || (cpu_is_omap2430() &&
175 (omap_type() == OMAP2430_REV_ES1_0))) {
176
177 SET_DMA_ERRATA(DMA_ERRATA_IFRAME_BUFFERING);
178 SET_DMA_ERRATA(DMA_ERRATA_PARALLEL_CHANNELS);
179 }
180
181 /*
182 * Erratum ID: i378: OMAP2+: sDMA Channel is not disabled
183 * after a transaction error.
184 * Workaround: SW should explicitely disable the channel.
185 */
186 if (cpu_class_is_omap2())
187 SET_DMA_ERRATA(DMA_ERRATA_i378);
188
189 /*
190 * Erratum ID: i541: sDMA FIFO draining does not finish
191 * If sDMA channel is disabled on the fly, sDMA enters standby even
192 * through FIFO Drain is still in progress
193 * Workaround: Put sDMA in NoStandby more before a logical channel is
194 * disabled, then put it back to SmartStandby right after the channel
195 * finishes FIFO draining.
196 */
197 if (cpu_is_omap34xx())
198 SET_DMA_ERRATA(DMA_ERRATA_i541);
199
200 /*
201 * Erratum ID: i88 : Special programming model needed to disable DMA
202 * before end of block.
203 * Workaround: software must ensure that the DMA is configured in No
204 * Standby mode(DMAx_OCP_SYSCONFIG.MIDLEMODE = "01")
205 */
206 if (omap_type() == OMAP3430_REV_ES1_0)
207 SET_DMA_ERRATA(DMA_ERRATA_i88);
208
209 /*
210 * Erratum 3.2/3.3: sometimes 0 is returned if CSAC/CDAC is
211 * read before the DMA controller finished disabling the channel.
212 */
213 SET_DMA_ERRATA(DMA_ERRATA_3_3);
214
215 /*
216 * Erratum ID: Not Available
217 * A bug in ROM code leaves IRQ status for channels 0 and 1 uncleared
218 * after secure sram context save and restore.
219 * Work around: Hence we need to manually clear those IRQs to avoid
220 * spurious interrupts. This affects only secure devices.
221 */
222 if (cpu_is_omap34xx() && (omap_type() != OMAP2_DEVICE_TYPE_GP))
223 SET_DMA_ERRATA(DMA_ROMCODE_BUG);
224
225 return errata;
226}
227
228/* One time initializations */
229static int __init omap2_system_dma_init_dev(struct omap_hwmod *oh, void *unused)
230{
231 struct omap_device *od;
232 struct omap_system_dma_plat_info *p;
233 struct resource *mem;
234 char *name = "omap_dma_system";
235
236 dma_stride = OMAP2_DMA_STRIDE;
237 dma_common_ch_start = CSDP;
238 if (cpu_is_omap3630() || cpu_is_omap4430())
239 dma_common_ch_end = CCDN;
240 else
241 dma_common_ch_end = CCFN;
242
243 p = kzalloc(sizeof(struct omap_system_dma_plat_info), GFP_KERNEL);
244 if (!p) {
245 pr_err("%s: Unable to allocate pdata for %s:%s\n",
246 __func__, name, oh->name);
247 return -ENOMEM;
248 }
249
250 p->dma_attr = (struct omap_dma_dev_attr *)oh->dev_attr;
251 p->disable_irq_lch = omap2_disable_irq_lch;
252 p->show_dma_caps = omap2_show_dma_caps;
253 p->clear_dma = omap2_clear_dma;
254 p->dma_write = dma_write;
255 p->dma_read = dma_read;
256
257 p->clear_lch_regs = NULL;
258
259 p->errata = configure_dma_errata();
260
261 od = omap_device_build(name, 0, oh, p, sizeof(*p),
262 omap2_dma_latency, ARRAY_SIZE(omap2_dma_latency), 0);
263 kfree(p);
264 if (IS_ERR(od)) {
265 pr_err("%s: Cant build omap_device for %s:%s.\n",
266 __func__, name, oh->name);
267 return IS_ERR(od);
268 }
269
270 mem = platform_get_resource(&od->pdev, IORESOURCE_MEM, 0);
271 if (!mem) {
272 dev_err(&od->pdev.dev, "%s: no mem resource\n", __func__);
273 return -EINVAL;
274 }
275 dma_base = ioremap(mem->start, resource_size(mem));
276 if (!dma_base) {
277 dev_err(&od->pdev.dev, "%s: ioremap fail\n", __func__);
278 return -ENOMEM;
279 }
280
281 d = oh->dev_attr;
282 d->chan = kzalloc(sizeof(struct omap_dma_lch) *
283 (d->lch_count), GFP_KERNEL);
284
285 if (!d->chan) {
286 dev_err(&od->pdev.dev, "%s: kzalloc fail\n", __func__);
287 return -ENOMEM;
288 }
289 return 0;
290}
291
292static int __init omap2_system_dma_init(void)
293{
294 return omap_hwmod_for_each_by_class("dma",
295 omap2_system_dma_init_dev, NULL);
296}
297arch_initcall(omap2_system_dma_init);
diff --git a/arch/arm/mach-omap2/omap_hwmod_2420_data.c b/arch/arm/mach-omap2/omap_hwmod_2420_data.c
index d95342599793..42606f6b0cdf 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2420_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2420_data.c
@@ -42,6 +42,7 @@ static struct omap_hwmod omap2420_gpio1_hwmod;
42static struct omap_hwmod omap2420_gpio2_hwmod; 42static struct omap_hwmod omap2420_gpio2_hwmod;
43static struct omap_hwmod omap2420_gpio3_hwmod; 43static struct omap_hwmod omap2420_gpio3_hwmod;
44static struct omap_hwmod omap2420_gpio4_hwmod; 44static struct omap_hwmod omap2420_gpio4_hwmod;
45static struct omap_hwmod omap2420_dma_system_hwmod;
45 46
46/* L3 -> L4_CORE interface */ 47/* L3 -> L4_CORE interface */
47static struct omap_hwmod_ocp_if omap2420_l3_main__l4_core = { 48static struct omap_hwmod_ocp_if omap2420_l3_main__l4_core = {
@@ -779,6 +780,88 @@ static struct omap_hwmod omap2420_gpio4_hwmod = {
779 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420), 780 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
780}; 781};
781 782
783/* system dma */
784static struct omap_hwmod_class_sysconfig omap2420_dma_sysc = {
785 .rev_offs = 0x0000,
786 .sysc_offs = 0x002c,
787 .syss_offs = 0x0028,
788 .sysc_flags = (SYSC_HAS_SOFTRESET | SYSC_HAS_MIDLEMODE |
789 SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_EMUFREE |
790 SYSC_HAS_AUTOIDLE),
791 .idlemodes = (MSTANDBY_FORCE | MSTANDBY_NO | MSTANDBY_SMART),
792 .sysc_fields = &omap_hwmod_sysc_type1,
793};
794
795static struct omap_hwmod_class omap2420_dma_hwmod_class = {
796 .name = "dma",
797 .sysc = &omap2420_dma_sysc,
798};
799
800/* dma attributes */
801static struct omap_dma_dev_attr dma_dev_attr = {
802 .dev_caps = RESERVE_CHANNEL | DMA_LINKED_LCH | GLOBAL_PRIORITY |
803 IS_CSSA_32 | IS_CDSA_32,
804 .lch_count = 32,
805};
806
807static struct omap_hwmod_irq_info omap2420_dma_system_irqs[] = {
808 { .name = "0", .irq = 12 }, /* INT_24XX_SDMA_IRQ0 */
809 { .name = "1", .irq = 13 }, /* INT_24XX_SDMA_IRQ1 */
810 { .name = "2", .irq = 14 }, /* INT_24XX_SDMA_IRQ2 */
811 { .name = "3", .irq = 15 }, /* INT_24XX_SDMA_IRQ3 */
812};
813
814static struct omap_hwmod_addr_space omap2420_dma_system_addrs[] = {
815 {
816 .pa_start = 0x48056000,
817 .pa_end = 0x4a0560ff,
818 .flags = ADDR_TYPE_RT
819 },
820};
821
822/* dma_system -> L3 */
823static struct omap_hwmod_ocp_if omap2420_dma_system__l3 = {
824 .master = &omap2420_dma_system_hwmod,
825 .slave = &omap2420_l3_main_hwmod,
826 .clk = "core_l3_ck",
827 .user = OCP_USER_MPU | OCP_USER_SDMA,
828};
829
830/* dma_system master ports */
831static struct omap_hwmod_ocp_if *omap2420_dma_system_masters[] = {
832 &omap2420_dma_system__l3,
833};
834
835/* l4_core -> dma_system */
836static struct omap_hwmod_ocp_if omap2420_l4_core__dma_system = {
837 .master = &omap2420_l4_core_hwmod,
838 .slave = &omap2420_dma_system_hwmod,
839 .clk = "sdma_ick",
840 .addr = omap2420_dma_system_addrs,
841 .addr_cnt = ARRAY_SIZE(omap2420_dma_system_addrs),
842 .user = OCP_USER_MPU | OCP_USER_SDMA,
843};
844
845/* dma_system slave ports */
846static struct omap_hwmod_ocp_if *omap2420_dma_system_slaves[] = {
847 &omap2420_l4_core__dma_system,
848};
849
850static struct omap_hwmod omap2420_dma_system_hwmod = {
851 .name = "dma",
852 .class = &omap2420_dma_hwmod_class,
853 .mpu_irqs = omap2420_dma_system_irqs,
854 .mpu_irqs_cnt = ARRAY_SIZE(omap2420_dma_system_irqs),
855 .main_clk = "core_l3_ck",
856 .slaves = omap2420_dma_system_slaves,
857 .slaves_cnt = ARRAY_SIZE(omap2420_dma_system_slaves),
858 .masters = omap2420_dma_system_masters,
859 .masters_cnt = ARRAY_SIZE(omap2420_dma_system_masters),
860 .dev_attr = &dma_dev_attr,
861 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
862 .flags = HWMOD_NO_IDLEST,
863};
864
782static __initdata struct omap_hwmod *omap2420_hwmods[] = { 865static __initdata struct omap_hwmod *omap2420_hwmods[] = {
783 &omap2420_l3_main_hwmod, 866 &omap2420_l3_main_hwmod,
784 &omap2420_l4_core_hwmod, 867 &omap2420_l4_core_hwmod,
@@ -797,6 +880,9 @@ static __initdata struct omap_hwmod *omap2420_hwmods[] = {
797 &omap2420_gpio2_hwmod, 880 &omap2420_gpio2_hwmod,
798 &omap2420_gpio3_hwmod, 881 &omap2420_gpio3_hwmod,
799 &omap2420_gpio4_hwmod, 882 &omap2420_gpio4_hwmod,
883
884 /* dma_system class*/
885 &omap2420_dma_system_hwmod,
800 NULL, 886 NULL,
801}; 887};
802 888
diff --git a/arch/arm/mach-omap2/omap_hwmod_2430_data.c b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
index ab1d662cb072..3315d241feef 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
@@ -43,6 +43,7 @@ static struct omap_hwmod omap2430_gpio2_hwmod;
43static struct omap_hwmod omap2430_gpio3_hwmod; 43static struct omap_hwmod omap2430_gpio3_hwmod;
44static struct omap_hwmod omap2430_gpio4_hwmod; 44static struct omap_hwmod omap2430_gpio4_hwmod;
45static struct omap_hwmod omap2430_gpio5_hwmod; 45static struct omap_hwmod omap2430_gpio5_hwmod;
46static struct omap_hwmod omap2430_dma_system_hwmod;
46 47
47/* L3 -> L4_CORE interface */ 48/* L3 -> L4_CORE interface */
48static struct omap_hwmod_ocp_if omap2430_l3_main__l4_core = { 49static struct omap_hwmod_ocp_if omap2430_l3_main__l4_core = {
@@ -838,6 +839,88 @@ static struct omap_hwmod omap2430_gpio5_hwmod = {
838 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430), 839 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
839}; 840};
840 841
842/* dma_system */
843static struct omap_hwmod_class_sysconfig omap2430_dma_sysc = {
844 .rev_offs = 0x0000,
845 .sysc_offs = 0x002c,
846 .syss_offs = 0x0028,
847 .sysc_flags = (SYSC_HAS_SOFTRESET | SYSC_HAS_MIDLEMODE |
848 SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_EMUFREE |
849 SYSC_HAS_AUTOIDLE),
850 .idlemodes = (MSTANDBY_FORCE | MSTANDBY_NO | MSTANDBY_SMART),
851 .sysc_fields = &omap_hwmod_sysc_type1,
852};
853
854static struct omap_hwmod_class omap2430_dma_hwmod_class = {
855 .name = "dma",
856 .sysc = &omap2430_dma_sysc,
857};
858
859/* dma attributes */
860static struct omap_dma_dev_attr dma_dev_attr = {
861 .dev_caps = RESERVE_CHANNEL | DMA_LINKED_LCH | GLOBAL_PRIORITY |
862 IS_CSSA_32 | IS_CDSA_32 | IS_RW_PRIORITY,
863 .lch_count = 32,
864};
865
866static struct omap_hwmod_irq_info omap2430_dma_system_irqs[] = {
867 { .name = "0", .irq = 12 }, /* INT_24XX_SDMA_IRQ0 */
868 { .name = "1", .irq = 13 }, /* INT_24XX_SDMA_IRQ1 */
869 { .name = "2", .irq = 14 }, /* INT_24XX_SDMA_IRQ2 */
870 { .name = "3", .irq = 15 }, /* INT_24XX_SDMA_IRQ3 */
871};
872
873static struct omap_hwmod_addr_space omap2430_dma_system_addrs[] = {
874 {
875 .pa_start = 0x48056000,
876 .pa_end = 0x4a0560ff,
877 .flags = ADDR_TYPE_RT
878 },
879};
880
881/* dma_system -> L3 */
882static struct omap_hwmod_ocp_if omap2430_dma_system__l3 = {
883 .master = &omap2430_dma_system_hwmod,
884 .slave = &omap2430_l3_main_hwmod,
885 .clk = "core_l3_ck",
886 .user = OCP_USER_MPU | OCP_USER_SDMA,
887};
888
889/* dma_system master ports */
890static struct omap_hwmod_ocp_if *omap2430_dma_system_masters[] = {
891 &omap2430_dma_system__l3,
892};
893
894/* l4_core -> dma_system */
895static struct omap_hwmod_ocp_if omap2430_l4_core__dma_system = {
896 .master = &omap2430_l4_core_hwmod,
897 .slave = &omap2430_dma_system_hwmod,
898 .clk = "sdma_ick",
899 .addr = omap2430_dma_system_addrs,
900 .addr_cnt = ARRAY_SIZE(omap2430_dma_system_addrs),
901 .user = OCP_USER_MPU | OCP_USER_SDMA,
902};
903
904/* dma_system slave ports */
905static struct omap_hwmod_ocp_if *omap2430_dma_system_slaves[] = {
906 &omap2430_l4_core__dma_system,
907};
908
909static struct omap_hwmod omap2430_dma_system_hwmod = {
910 .name = "dma",
911 .class = &omap2430_dma_hwmod_class,
912 .mpu_irqs = omap2430_dma_system_irqs,
913 .mpu_irqs_cnt = ARRAY_SIZE(omap2430_dma_system_irqs),
914 .main_clk = "core_l3_ck",
915 .slaves = omap2430_dma_system_slaves,
916 .slaves_cnt = ARRAY_SIZE(omap2430_dma_system_slaves),
917 .masters = omap2430_dma_system_masters,
918 .masters_cnt = ARRAY_SIZE(omap2430_dma_system_masters),
919 .dev_attr = &dma_dev_attr,
920 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
921 .flags = HWMOD_NO_IDLEST,
922};
923
841static __initdata struct omap_hwmod *omap2430_hwmods[] = { 924static __initdata struct omap_hwmod *omap2430_hwmods[] = {
842 &omap2430_l3_main_hwmod, 925 &omap2430_l3_main_hwmod,
843 &omap2430_l4_core_hwmod, 926 &omap2430_l4_core_hwmod,
@@ -857,6 +940,9 @@ static __initdata struct omap_hwmod *omap2430_hwmods[] = {
857 &omap2430_gpio3_hwmod, 940 &omap2430_gpio3_hwmod,
858 &omap2430_gpio4_hwmod, 941 &omap2430_gpio4_hwmod,
859 &omap2430_gpio5_hwmod, 942 &omap2430_gpio5_hwmod,
943
944 /* dma_system class*/
945 &omap2430_dma_system_hwmod,
860 NULL, 946 NULL,
861}; 947};
862 948
diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
index 2687be10d7aa..d5acb63ba9e0 100644
--- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
@@ -52,6 +52,8 @@ static struct omap_hwmod omap3xxx_gpio4_hwmod;
52static struct omap_hwmod omap3xxx_gpio5_hwmod; 52static struct omap_hwmod omap3xxx_gpio5_hwmod;
53static struct omap_hwmod omap3xxx_gpio6_hwmod; 53static struct omap_hwmod omap3xxx_gpio6_hwmod;
54 54
55static struct omap_hwmod omap3xxx_dma_system_hwmod;
56
55/* L3 -> L4_CORE interface */ 57/* L3 -> L4_CORE interface */
56static struct omap_hwmod_ocp_if omap3xxx_l3_main__l4_core = { 58static struct omap_hwmod_ocp_if omap3xxx_l3_main__l4_core = {
57 .master = &omap3xxx_l3_main_hwmod, 59 .master = &omap3xxx_l3_main_hwmod,
@@ -1090,6 +1092,98 @@ static struct omap_hwmod omap3xxx_gpio6_hwmod = {
1090 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430), 1092 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
1091}; 1093};
1092 1094
1095/* dma_system -> L3 */
1096static struct omap_hwmod_ocp_if omap3xxx_dma_system__l3 = {
1097 .master = &omap3xxx_dma_system_hwmod,
1098 .slave = &omap3xxx_l3_main_hwmod,
1099 .clk = "core_l3_ick",
1100 .user = OCP_USER_MPU | OCP_USER_SDMA,
1101};
1102
1103/* dma attributes */
1104static struct omap_dma_dev_attr dma_dev_attr = {
1105 .dev_caps = RESERVE_CHANNEL | DMA_LINKED_LCH | GLOBAL_PRIORITY |
1106 IS_CSSA_32 | IS_CDSA_32 | IS_RW_PRIORITY,
1107 .lch_count = 32,
1108};
1109
1110static struct omap_hwmod_class_sysconfig omap3xxx_dma_sysc = {
1111 .rev_offs = 0x0000,
1112 .sysc_offs = 0x002c,
1113 .syss_offs = 0x0028,
1114 .sysc_flags = (SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET |
1115 SYSC_HAS_MIDLEMODE | SYSC_HAS_CLOCKACTIVITY |
1116 SYSC_HAS_EMUFREE | SYSC_HAS_AUTOIDLE),
1117 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
1118 MSTANDBY_FORCE | MSTANDBY_NO | MSTANDBY_SMART),
1119 .sysc_fields = &omap_hwmod_sysc_type1,
1120};
1121
1122static struct omap_hwmod_class omap3xxx_dma_hwmod_class = {
1123 .name = "dma",
1124 .sysc = &omap3xxx_dma_sysc,
1125};
1126
1127/* dma_system */
1128static struct omap_hwmod_irq_info omap3xxx_dma_system_irqs[] = {
1129 { .name = "0", .irq = 12 }, /* INT_24XX_SDMA_IRQ0 */
1130 { .name = "1", .irq = 13 }, /* INT_24XX_SDMA_IRQ1 */
1131 { .name = "2", .irq = 14 }, /* INT_24XX_SDMA_IRQ2 */
1132 { .name = "3", .irq = 15 }, /* INT_24XX_SDMA_IRQ3 */
1133};
1134
1135static struct omap_hwmod_addr_space omap3xxx_dma_system_addrs[] = {
1136 {
1137 .pa_start = 0x48056000,
1138 .pa_end = 0x4a0560ff,
1139 .flags = ADDR_TYPE_RT
1140 },
1141};
1142
1143/* dma_system master ports */
1144static struct omap_hwmod_ocp_if *omap3xxx_dma_system_masters[] = {
1145 &omap3xxx_dma_system__l3,
1146};
1147
1148/* l4_cfg -> dma_system */
1149static struct omap_hwmod_ocp_if omap3xxx_l4_core__dma_system = {
1150 .master = &omap3xxx_l4_core_hwmod,
1151 .slave = &omap3xxx_dma_system_hwmod,
1152 .clk = "core_l4_ick",
1153 .addr = omap3xxx_dma_system_addrs,
1154 .addr_cnt = ARRAY_SIZE(omap3xxx_dma_system_addrs),
1155 .user = OCP_USER_MPU | OCP_USER_SDMA,
1156};
1157
1158/* dma_system slave ports */
1159static struct omap_hwmod_ocp_if *omap3xxx_dma_system_slaves[] = {
1160 &omap3xxx_l4_core__dma_system,
1161};
1162
1163static struct omap_hwmod omap3xxx_dma_system_hwmod = {
1164 .name = "dma",
1165 .class = &omap3xxx_dma_hwmod_class,
1166 .mpu_irqs = omap3xxx_dma_system_irqs,
1167 .mpu_irqs_cnt = ARRAY_SIZE(omap3xxx_dma_system_irqs),
1168 .main_clk = "core_l3_ick",
1169 .prcm = {
1170 .omap2 = {
1171 .module_offs = CORE_MOD,
1172 .prcm_reg_id = 1,
1173 .module_bit = OMAP3430_ST_SDMA_SHIFT,
1174 .idlest_reg_id = 1,
1175 .idlest_idle_bit = OMAP3430_ST_SDMA_SHIFT,
1176 },
1177 },
1178 .slaves = omap3xxx_dma_system_slaves,
1179 .slaves_cnt = ARRAY_SIZE(omap3xxx_dma_system_slaves),
1180 .masters = omap3xxx_dma_system_masters,
1181 .masters_cnt = ARRAY_SIZE(omap3xxx_dma_system_masters),
1182 .dev_attr = &dma_dev_attr,
1183 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
1184 .flags = HWMOD_NO_IDLEST,
1185};
1186
1093static __initdata struct omap_hwmod *omap3xxx_hwmods[] = { 1187static __initdata struct omap_hwmod *omap3xxx_hwmods[] = {
1094 &omap3xxx_l3_main_hwmod, 1188 &omap3xxx_l3_main_hwmod,
1095 &omap3xxx_l4_core_hwmod, 1189 &omap3xxx_l4_core_hwmod,
@@ -1113,6 +1207,9 @@ static __initdata struct omap_hwmod *omap3xxx_hwmods[] = {
1113 &omap3xxx_gpio4_hwmod, 1207 &omap3xxx_gpio4_hwmod,
1114 &omap3xxx_gpio5_hwmod, 1208 &omap3xxx_gpio5_hwmod,
1115 &omap3xxx_gpio6_hwmod, 1209 &omap3xxx_gpio6_hwmod,
1210
1211 /* dma_system class*/
1212 &omap3xxx_dma_system_hwmod,
1116 NULL, 1213 NULL,
1117}; 1214};
1118 1215
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index d258936410fb..f9778fba8322 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -23,6 +23,7 @@
23#include <plat/omap_hwmod.h> 23#include <plat/omap_hwmod.h>
24#include <plat/cpu.h> 24#include <plat/cpu.h>
25#include <plat/gpio.h> 25#include <plat/gpio.h>
26#include <plat/dma.h>
26 27
27#include "omap_hwmod_common_data.h" 28#include "omap_hwmod_common_data.h"
28 29
@@ -36,6 +37,7 @@
36#define OMAP44XX_DMA_REQ_START 1 37#define OMAP44XX_DMA_REQ_START 1
37 38
38/* Backward references (IPs with Bus Master capability) */ 39/* Backward references (IPs with Bus Master capability) */
40static struct omap_hwmod omap44xx_dma_system_hwmod;
39static struct omap_hwmod omap44xx_dmm_hwmod; 41static struct omap_hwmod omap44xx_dmm_hwmod;
40static struct omap_hwmod omap44xx_emif_fw_hwmod; 42static struct omap_hwmod omap44xx_emif_fw_hwmod;
41static struct omap_hwmod omap44xx_l3_instr_hwmod; 43static struct omap_hwmod omap44xx_l3_instr_hwmod;
@@ -216,6 +218,14 @@ static struct omap_hwmod_ocp_if omap44xx_l3_main_1__l3_main_2 = {
216 .user = OCP_USER_MPU | OCP_USER_SDMA, 218 .user = OCP_USER_MPU | OCP_USER_SDMA,
217}; 219};
218 220
221/* dma_system -> l3_main_2 */
222static struct omap_hwmod_ocp_if omap44xx_dma_system__l3_main_2 = {
223 .master = &omap44xx_dma_system_hwmod,
224 .slave = &omap44xx_l3_main_2_hwmod,
225 .clk = "l3_div_ck",
226 .user = OCP_USER_MPU | OCP_USER_SDMA,
227};
228
219/* l4_cfg -> l3_main_2 */ 229/* l4_cfg -> l3_main_2 */
220static struct omap_hwmod_ocp_if omap44xx_l4_cfg__l3_main_2 = { 230static struct omap_hwmod_ocp_if omap44xx_l4_cfg__l3_main_2 = {
221 .master = &omap44xx_l4_cfg_hwmod, 231 .master = &omap44xx_l4_cfg_hwmod,
@@ -226,6 +236,7 @@ static struct omap_hwmod_ocp_if omap44xx_l4_cfg__l3_main_2 = {
226 236
227/* l3_main_2 slave ports */ 237/* l3_main_2 slave ports */
228static struct omap_hwmod_ocp_if *omap44xx_l3_main_2_slaves[] = { 238static struct omap_hwmod_ocp_if *omap44xx_l3_main_2_slaves[] = {
239 &omap44xx_dma_system__l3_main_2,
229 &omap44xx_l3_main_1__l3_main_2, 240 &omap44xx_l3_main_1__l3_main_2,
230 &omap44xx_l4_cfg__l3_main_2, 241 &omap44xx_l4_cfg__l3_main_2,
231}; 242};
@@ -1376,6 +1387,93 @@ static struct omap_hwmod omap44xx_gpio6_hwmod = {
1376 .slaves_cnt = ARRAY_SIZE(omap44xx_gpio6_slaves), 1387 .slaves_cnt = ARRAY_SIZE(omap44xx_gpio6_slaves),
1377 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 1388 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
1378}; 1389};
1390
1391/*
1392 * 'dma' class
1393 * dma controller for data exchange between memory to memory (i.e. internal or
1394 * external memory) and gp peripherals to memory or memory to gp peripherals
1395 */
1396
1397static struct omap_hwmod_class_sysconfig omap44xx_dma_sysc = {
1398 .rev_offs = 0x0000,
1399 .sysc_offs = 0x002c,
1400 .syss_offs = 0x0028,
1401 .sysc_flags = (SYSC_HAS_AUTOIDLE | SYSC_HAS_CLOCKACTIVITY |
1402 SYSC_HAS_EMUFREE | SYSC_HAS_MIDLEMODE |
1403 SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET |
1404 SYSS_HAS_RESET_STATUS),
1405 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
1406 MSTANDBY_FORCE | MSTANDBY_NO | MSTANDBY_SMART),
1407 .sysc_fields = &omap_hwmod_sysc_type1,
1408};
1409
1410/* dma attributes */
1411static struct omap_dma_dev_attr dma_dev_attr = {
1412 .dev_caps = RESERVE_CHANNEL | DMA_LINKED_LCH | GLOBAL_PRIORITY |
1413 IS_CSSA_32 | IS_CDSA_32 | IS_RW_PRIORITY,
1414 .lch_count = 32,
1415};
1416
1417static struct omap_hwmod_class omap44xx_dma_hwmod_class = {
1418 .name = "dma",
1419 .sysc = &omap44xx_dma_sysc,
1420};
1421
1422/* dma_system */
1423static struct omap_hwmod_irq_info omap44xx_dma_system_irqs[] = {
1424 { .name = "0", .irq = 12 + OMAP44XX_IRQ_GIC_START },
1425 { .name = "1", .irq = 13 + OMAP44XX_IRQ_GIC_START },
1426 { .name = "2", .irq = 14 + OMAP44XX_IRQ_GIC_START },
1427 { .name = "3", .irq = 15 + OMAP44XX_IRQ_GIC_START },
1428};
1429
1430/* dma_system master ports */
1431static struct omap_hwmod_ocp_if *omap44xx_dma_system_masters[] = {
1432 &omap44xx_dma_system__l3_main_2,
1433};
1434
1435static struct omap_hwmod_addr_space omap44xx_dma_system_addrs[] = {
1436 {
1437 .pa_start = 0x4a056000,
1438 .pa_end = 0x4a0560ff,
1439 .flags = ADDR_TYPE_RT
1440 },
1441};
1442
1443/* l4_cfg -> dma_system */
1444static struct omap_hwmod_ocp_if omap44xx_l4_cfg__dma_system = {
1445 .master = &omap44xx_l4_cfg_hwmod,
1446 .slave = &omap44xx_dma_system_hwmod,
1447 .clk = "l4_div_ck",
1448 .addr = omap44xx_dma_system_addrs,
1449 .addr_cnt = ARRAY_SIZE(omap44xx_dma_system_addrs),
1450 .user = OCP_USER_MPU | OCP_USER_SDMA,
1451};
1452
1453/* dma_system slave ports */
1454static struct omap_hwmod_ocp_if *omap44xx_dma_system_slaves[] = {
1455 &omap44xx_l4_cfg__dma_system,
1456};
1457
1458static struct omap_hwmod omap44xx_dma_system_hwmod = {
1459 .name = "dma_system",
1460 .class = &omap44xx_dma_hwmod_class,
1461 .mpu_irqs = omap44xx_dma_system_irqs,
1462 .mpu_irqs_cnt = ARRAY_SIZE(omap44xx_dma_system_irqs),
1463 .main_clk = "l3_div_ck",
1464 .prcm = {
1465 .omap4 = {
1466 .clkctrl_reg = OMAP4430_CM_SDMA_SDMA_CLKCTRL,
1467 },
1468 },
1469 .slaves = omap44xx_dma_system_slaves,
1470 .slaves_cnt = ARRAY_SIZE(omap44xx_dma_system_slaves),
1471 .masters = omap44xx_dma_system_masters,
1472 .masters_cnt = ARRAY_SIZE(omap44xx_dma_system_masters),
1473 .dev_attr = &dma_dev_attr,
1474 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
1475};
1476
1379static __initdata struct omap_hwmod *omap44xx_hwmods[] = { 1477static __initdata struct omap_hwmod *omap44xx_hwmods[] = {
1380 /* dmm class */ 1478 /* dmm class */
1381 &omap44xx_dmm_hwmod, 1479 &omap44xx_dmm_hwmod,
@@ -1391,6 +1489,10 @@ static __initdata struct omap_hwmod *omap44xx_hwmods[] = {
1391 &omap44xx_l4_cfg_hwmod, 1489 &omap44xx_l4_cfg_hwmod,
1392 &omap44xx_l4_per_hwmod, 1490 &omap44xx_l4_per_hwmod,
1393 &omap44xx_l4_wkup_hwmod, 1491 &omap44xx_l4_wkup_hwmod,
1492
1493 /* dma class */
1494 &omap44xx_dma_system_hwmod,
1495
1394 /* i2c class */ 1496 /* i2c class */
1395 &omap44xx_i2c1_hwmod, 1497 &omap44xx_i2c1_hwmod,
1396 &omap44xx_i2c2_hwmod, 1498 &omap44xx_i2c2_hwmod,