aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/kernel/cpu/sh4a/setup-sh7724.c
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2010-02-11 11:50:10 -0500
committerPaul Mundt <lethal@linux-sh.org>2010-03-01 21:09:02 -0500
commit027811b9b81a6b3ae5aa20c3302897bee9dcf09e (patch)
treecde9b764d10d7ba9d0a41d9c780bf9032214dcae /arch/sh/kernel/cpu/sh4a/setup-sh7724.c
parent47a4dc26eeb89a3746f9b1e2092602b40469640a (diff)
dmaengine: shdma: convert to platform device resources
The shdma dmaengine driver currently uses numerous macros to support various platforms, selected by ifdef's. Convert it to use platform device resources and lists of channel descriptors to specify register locations, interrupt numbers and other system-specific configuration variants. Unavoidably, we have to simultaneously convert all shdma users to provide those resources. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/kernel/cpu/sh4a/setup-sh7724.c')
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7724.c159
1 files changed, 151 insertions, 8 deletions
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7724.c b/arch/sh/kernel/cpu/sh4a/setup-sh7724.c
index 31e3451f7e3d..aca1fb2c571b 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7724.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7724.c
@@ -28,15 +28,157 @@
28#include <cpu/sh7724.h> 28#include <cpu/sh7724.h>
29 29
30/* DMA */ 30/* DMA */
31static struct sh_dmae_pdata dma_platform_data = { 31static struct sh_dmae_channel sh7724_dmae0_channels[] = {
32 .mode = SHDMA_DMAOR1, 32 {
33 .offset = 0,
34 .dmars = 0,
35 .dmars_bit = 0,
36 }, {
37 .offset = 0x10,
38 .dmars = 0,
39 .dmars_bit = 8,
40 }, {
41 .offset = 0x20,
42 .dmars = 4,
43 .dmars_bit = 0,
44 }, {
45 .offset = 0x30,
46 .dmars = 4,
47 .dmars_bit = 8,
48 }, {
49 .offset = 0x50,
50 .dmars = 8,
51 .dmars_bit = 0,
52 }, {
53 .offset = 0x60,
54 .dmars = 8,
55 .dmars_bit = 8,
56 }
57};
58
59static struct sh_dmae_channel sh7724_dmae1_channels[] = {
60 {
61 .offset = 0,
62 .dmars = 0,
63 .dmars_bit = 0,
64 }, {
65 .offset = 0x10,
66 .dmars = 0,
67 .dmars_bit = 8,
68 }, {
69 .offset = 0x20,
70 .dmars = 4,
71 .dmars_bit = 0,
72 }, {
73 .offset = 0x30,
74 .dmars = 4,
75 .dmars_bit = 8,
76 }, {
77 .offset = 0x50,
78 .dmars = 8,
79 .dmars_bit = 0,
80 }, {
81 .offset = 0x60,
82 .dmars = 8,
83 .dmars_bit = 8,
84 }
85};
86
87static struct sh_dmae_pdata dma0_platform_data = {
88 .channel = sh7724_dmae0_channels,
89 .channel_num = ARRAY_SIZE(sh7724_dmae0_channels),
90};
91
92static struct sh_dmae_pdata dma1_platform_data = {
93 .channel = sh7724_dmae1_channels,
94 .channel_num = ARRAY_SIZE(sh7724_dmae1_channels),
95};
96
97/* Resource order important! */
98static struct resource sh7724_dmae0_resources[] = {
99 {
100 /* Channel registers and DMAOR */
101 .start = 0xfe008020,
102 .end = 0xfe00808f,
103 .flags = IORESOURCE_MEM,
104 },
105 {
106 /* DMARSx */
107 .start = 0xfe009000,
108 .end = 0xfe00900b,
109 .flags = IORESOURCE_MEM,
110 },
111 {
112 /* DMA error IRQ */
113 .start = 78,
114 .end = 78,
115 .flags = IORESOURCE_IRQ,
116 },
117 {
118 /* IRQ for channels 0-3 */
119 .start = 48,
120 .end = 51,
121 .flags = IORESOURCE_IRQ,
122 },
123 {
124 /* IRQ for channels 4-5 */
125 .start = 76,
126 .end = 77,
127 .flags = IORESOURCE_IRQ,
128 },
33}; 129};
34 130
35static struct platform_device dma_device = { 131/* Resource order important! */
36 .name = "sh-dma-engine", 132static struct resource sh7724_dmae1_resources[] = {
37 .id = -1, 133 {
38 .dev = { 134 /* Channel registers and DMAOR */
39 .platform_data = &dma_platform_data, 135 .start = 0xfdc08020,
136 .end = 0xfdc0808f,
137 .flags = IORESOURCE_MEM,
138 },
139 {
140 /* DMARSx */
141 .start = 0xfdc09000,
142 .end = 0xfdc0900b,
143 .flags = IORESOURCE_MEM,
144 },
145 {
146 /* DMA error IRQ */
147 .start = 74,
148 .end = 74,
149 .flags = IORESOURCE_IRQ,
150 },
151 {
152 /* IRQ for channels 0-3 */
153 .start = 40,
154 .end = 43,
155 .flags = IORESOURCE_IRQ,
156 },
157 {
158 /* IRQ for channels 4-5 */
159 .start = 72,
160 .end = 73,
161 .flags = IORESOURCE_IRQ,
162 },
163};
164
165static struct platform_device dma0_device = {
166 .name = "sh-dma-engine",
167 .id = 0,
168 .resource = sh7724_dmae0_resources,
169 .num_resources = ARRAY_SIZE(sh7724_dmae0_resources),
170 .dev = {
171 .platform_data = &dma0_platform_data,
172 },
173};
174
175static struct platform_device dma1_device = {
176 .name = "sh-dma-engine",
177 .id = 1,
178 .resource = sh7724_dmae1_resources,
179 .num_resources = ARRAY_SIZE(sh7724_dmae1_resources),
180 .dev = {
181 .platform_data = &dma1_platform_data,
40 }, 182 },
41}; 183};
42 184
@@ -663,7 +805,8 @@ static struct platform_device *sh7724_devices[] __initdata = {
663 &tmu3_device, 805 &tmu3_device,
664 &tmu4_device, 806 &tmu4_device,
665 &tmu5_device, 807 &tmu5_device,
666 &dma_device, 808 &dma0_device,
809 &dma1_device,
667 &rtc_device, 810 &rtc_device,
668 &iic0_device, 811 &iic0_device,
669 &iic1_device, 812 &iic1_device,