diff options
-rw-r--r-- | arch/sh/kernel/cpu/sh4a/setup-sh7722.c | 6 | ||||
-rw-r--r-- | arch/sh/kernel/cpu/sh4a/setup-sh7724.c | 54 | ||||
-rw-r--r-- | arch/sh/kernel/cpu/sh4a/setup-sh7780.c | 6 | ||||
-rw-r--r-- | arch/sh/kernel/cpu/sh4a/setup-sh7785.c | 6 | ||||
-rw-r--r-- | arch/sh/kernel/cpu/sh4a/setup-sh7786.c | 4 | ||||
-rw-r--r-- | drivers/dma/shdma.c | 12 | ||||
-rw-r--r-- | include/linux/sh_dma.h | 9 |
7 files changed, 30 insertions, 67 deletions
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7722.c b/arch/sh/kernel/cpu/sh4a/setup-sh7722.c index dc9b30d086a4..24c6167a7181 100644 --- a/arch/sh/kernel/cpu/sh4a/setup-sh7722.c +++ b/arch/sh/kernel/cpu/sh4a/setup-sh7722.c | |||
@@ -24,7 +24,7 @@ | |||
24 | #include <cpu/dma-register.h> | 24 | #include <cpu/dma-register.h> |
25 | #include <cpu/sh7722.h> | 25 | #include <cpu/sh7722.h> |
26 | 26 | ||
27 | static struct sh_dmae_slave_config sh7722_dmae_slaves[] = { | 27 | static const struct sh_dmae_slave_config sh7722_dmae_slaves[] = { |
28 | { | 28 | { |
29 | .slave_id = SHDMA_SLAVE_SCIF0_TX, | 29 | .slave_id = SHDMA_SLAVE_SCIF0_TX, |
30 | .addr = 0xffe0000c, | 30 | .addr = 0xffe0000c, |
@@ -78,7 +78,7 @@ static struct sh_dmae_slave_config sh7722_dmae_slaves[] = { | |||
78 | }, | 78 | }, |
79 | }; | 79 | }; |
80 | 80 | ||
81 | static struct sh_dmae_channel sh7722_dmae_channels[] = { | 81 | static const struct sh_dmae_channel sh7722_dmae_channels[] = { |
82 | { | 82 | { |
83 | .offset = 0, | 83 | .offset = 0, |
84 | .dmars = 0, | 84 | .dmars = 0, |
@@ -106,7 +106,7 @@ static struct sh_dmae_channel sh7722_dmae_channels[] = { | |||
106 | } | 106 | } |
107 | }; | 107 | }; |
108 | 108 | ||
109 | static unsigned int ts_shift[] = TS_SHIFT; | 109 | static const unsigned int ts_shift[] = TS_SHIFT; |
110 | 110 | ||
111 | static struct sh_dmae_pdata dma_platform_data = { | 111 | static struct sh_dmae_pdata dma_platform_data = { |
112 | .slave = sh7722_dmae_slaves, | 112 | .slave = sh7722_dmae_slaves, |
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7724.c b/arch/sh/kernel/cpu/sh4a/setup-sh7724.c index 8a0a4a99f86b..89fe16d20fdb 100644 --- a/arch/sh/kernel/cpu/sh4a/setup-sh7724.c +++ b/arch/sh/kernel/cpu/sh4a/setup-sh7724.c | |||
@@ -31,7 +31,7 @@ | |||
31 | #include <cpu/sh7724.h> | 31 | #include <cpu/sh7724.h> |
32 | 32 | ||
33 | /* DMA */ | 33 | /* DMA */ |
34 | static struct sh_dmae_channel sh7724_dmae0_channels[] = { | 34 | static const struct sh_dmae_channel sh7724_dmae_channels[] = { |
35 | { | 35 | { |
36 | .offset = 0, | 36 | .offset = 0, |
37 | .dmars = 0, | 37 | .dmars = 0, |
@@ -59,51 +59,11 @@ static struct sh_dmae_channel sh7724_dmae0_channels[] = { | |||
59 | } | 59 | } |
60 | }; | 60 | }; |
61 | 61 | ||
62 | static struct sh_dmae_channel sh7724_dmae1_channels[] = { | 62 | static const unsigned int ts_shift[] = TS_SHIFT; |
63 | { | ||
64 | .offset = 0, | ||
65 | .dmars = 0, | ||
66 | .dmars_bit = 0, | ||
67 | }, { | ||
68 | .offset = 0x10, | ||
69 | .dmars = 0, | ||
70 | .dmars_bit = 8, | ||
71 | }, { | ||
72 | .offset = 0x20, | ||
73 | .dmars = 4, | ||
74 | .dmars_bit = 0, | ||
75 | }, { | ||
76 | .offset = 0x30, | ||
77 | .dmars = 4, | ||
78 | .dmars_bit = 8, | ||
79 | }, { | ||
80 | .offset = 0x50, | ||
81 | .dmars = 8, | ||
82 | .dmars_bit = 0, | ||
83 | }, { | ||
84 | .offset = 0x60, | ||
85 | .dmars = 8, | ||
86 | .dmars_bit = 8, | ||
87 | } | ||
88 | }; | ||
89 | |||
90 | static unsigned int ts_shift[] = TS_SHIFT; | ||
91 | |||
92 | static struct sh_dmae_pdata dma0_platform_data = { | ||
93 | .channel = sh7724_dmae0_channels, | ||
94 | .channel_num = ARRAY_SIZE(sh7724_dmae0_channels), | ||
95 | .ts_low_shift = CHCR_TS_LOW_SHIFT, | ||
96 | .ts_low_mask = CHCR_TS_LOW_MASK, | ||
97 | .ts_high_shift = CHCR_TS_HIGH_SHIFT, | ||
98 | .ts_high_mask = CHCR_TS_HIGH_MASK, | ||
99 | .ts_shift = ts_shift, | ||
100 | .ts_shift_num = ARRAY_SIZE(ts_shift), | ||
101 | .dmaor_init = DMAOR_INIT, | ||
102 | }; | ||
103 | 63 | ||
104 | static struct sh_dmae_pdata dma1_platform_data = { | 64 | static struct sh_dmae_pdata dma_platform_data = { |
105 | .channel = sh7724_dmae1_channels, | 65 | .channel = sh7724_dmae_channels, |
106 | .channel_num = ARRAY_SIZE(sh7724_dmae1_channels), | 66 | .channel_num = ARRAY_SIZE(sh7724_dmae_channels), |
107 | .ts_low_shift = CHCR_TS_LOW_SHIFT, | 67 | .ts_low_shift = CHCR_TS_LOW_SHIFT, |
108 | .ts_low_mask = CHCR_TS_LOW_MASK, | 68 | .ts_low_mask = CHCR_TS_LOW_MASK, |
109 | .ts_high_shift = CHCR_TS_HIGH_SHIFT, | 69 | .ts_high_shift = CHCR_TS_HIGH_SHIFT, |
@@ -187,7 +147,7 @@ static struct platform_device dma0_device = { | |||
187 | .resource = sh7724_dmae0_resources, | 147 | .resource = sh7724_dmae0_resources, |
188 | .num_resources = ARRAY_SIZE(sh7724_dmae0_resources), | 148 | .num_resources = ARRAY_SIZE(sh7724_dmae0_resources), |
189 | .dev = { | 149 | .dev = { |
190 | .platform_data = &dma0_platform_data, | 150 | .platform_data = &dma_platform_data, |
191 | }, | 151 | }, |
192 | .archdata = { | 152 | .archdata = { |
193 | .hwblk_id = HWBLK_DMAC0, | 153 | .hwblk_id = HWBLK_DMAC0, |
@@ -200,7 +160,7 @@ static struct platform_device dma1_device = { | |||
200 | .resource = sh7724_dmae1_resources, | 160 | .resource = sh7724_dmae1_resources, |
201 | .num_resources = ARRAY_SIZE(sh7724_dmae1_resources), | 161 | .num_resources = ARRAY_SIZE(sh7724_dmae1_resources), |
202 | .dev = { | 162 | .dev = { |
203 | .platform_data = &dma1_platform_data, | 163 | .platform_data = &dma_platform_data, |
204 | }, | 164 | }, |
205 | .archdata = { | 165 | .archdata = { |
206 | .hwblk_id = HWBLK_DMAC1, | 166 | .hwblk_id = HWBLK_DMAC1, |
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7780.c b/arch/sh/kernel/cpu/sh4a/setup-sh7780.c index 05fc38df1582..b12f537e4dde 100644 --- a/arch/sh/kernel/cpu/sh4a/setup-sh7780.c +++ b/arch/sh/kernel/cpu/sh4a/setup-sh7780.c | |||
@@ -233,7 +233,7 @@ static struct platform_device rtc_device = { | |||
233 | }; | 233 | }; |
234 | 234 | ||
235 | /* DMA */ | 235 | /* DMA */ |
236 | static struct sh_dmae_channel sh7780_dmae0_channels[] = { | 236 | static const struct sh_dmae_channel sh7780_dmae0_channels[] = { |
237 | { | 237 | { |
238 | .offset = 0, | 238 | .offset = 0, |
239 | .dmars = 0, | 239 | .dmars = 0, |
@@ -261,7 +261,7 @@ static struct sh_dmae_channel sh7780_dmae0_channels[] = { | |||
261 | } | 261 | } |
262 | }; | 262 | }; |
263 | 263 | ||
264 | static struct sh_dmae_channel sh7780_dmae1_channels[] = { | 264 | static const struct sh_dmae_channel sh7780_dmae1_channels[] = { |
265 | { | 265 | { |
266 | .offset = 0, | 266 | .offset = 0, |
267 | }, { | 267 | }, { |
@@ -277,7 +277,7 @@ static struct sh_dmae_channel sh7780_dmae1_channels[] = { | |||
277 | } | 277 | } |
278 | }; | 278 | }; |
279 | 279 | ||
280 | static unsigned int ts_shift[] = TS_SHIFT; | 280 | static const unsigned int ts_shift[] = TS_SHIFT; |
281 | 281 | ||
282 | static struct sh_dmae_pdata dma0_platform_data = { | 282 | static struct sh_dmae_pdata dma0_platform_data = { |
283 | .channel = sh7780_dmae0_channels, | 283 | .channel = sh7780_dmae0_channels, |
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7785.c b/arch/sh/kernel/cpu/sh4a/setup-sh7785.c index 07bb2d4619f8..f3e3ea0ce050 100644 --- a/arch/sh/kernel/cpu/sh4a/setup-sh7785.c +++ b/arch/sh/kernel/cpu/sh4a/setup-sh7785.c | |||
@@ -275,7 +275,7 @@ static struct platform_device tmu5_device = { | |||
275 | }; | 275 | }; |
276 | 276 | ||
277 | /* DMA */ | 277 | /* DMA */ |
278 | static struct sh_dmae_channel sh7785_dmae0_channels[] = { | 278 | static const struct sh_dmae_channel sh7785_dmae0_channels[] = { |
279 | { | 279 | { |
280 | .offset = 0, | 280 | .offset = 0, |
281 | .dmars = 0, | 281 | .dmars = 0, |
@@ -303,7 +303,7 @@ static struct sh_dmae_channel sh7785_dmae0_channels[] = { | |||
303 | } | 303 | } |
304 | }; | 304 | }; |
305 | 305 | ||
306 | static struct sh_dmae_channel sh7785_dmae1_channels[] = { | 306 | static const struct sh_dmae_channel sh7785_dmae1_channels[] = { |
307 | { | 307 | { |
308 | .offset = 0, | 308 | .offset = 0, |
309 | }, { | 309 | }, { |
@@ -319,7 +319,7 @@ static struct sh_dmae_channel sh7785_dmae1_channels[] = { | |||
319 | } | 319 | } |
320 | }; | 320 | }; |
321 | 321 | ||
322 | static unsigned int ts_shift[] = TS_SHIFT; | 322 | static const unsigned int ts_shift[] = TS_SHIFT; |
323 | 323 | ||
324 | static struct sh_dmae_pdata dma0_platform_data = { | 324 | static struct sh_dmae_pdata dma0_platform_data = { |
325 | .channel = sh7785_dmae0_channels, | 325 | .channel = sh7785_dmae0_channels, |
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7786.c b/arch/sh/kernel/cpu/sh4a/setup-sh7786.c index d7336036d04d..81657091da46 100644 --- a/arch/sh/kernel/cpu/sh4a/setup-sh7786.c +++ b/arch/sh/kernel/cpu/sh4a/setup-sh7786.c | |||
@@ -445,7 +445,7 @@ static struct platform_device tmu11_device = { | |||
445 | .num_resources = ARRAY_SIZE(tmu11_resources), | 445 | .num_resources = ARRAY_SIZE(tmu11_resources), |
446 | }; | 446 | }; |
447 | 447 | ||
448 | static struct sh_dmae_channel dmac0_channels[] = { | 448 | static const struct sh_dmae_channel dmac0_channels[] = { |
449 | { | 449 | { |
450 | .offset = 0, | 450 | .offset = 0, |
451 | .dmars = 0, | 451 | .dmars = 0, |
@@ -473,7 +473,7 @@ static struct sh_dmae_channel dmac0_channels[] = { | |||
473 | } | 473 | } |
474 | }; | 474 | }; |
475 | 475 | ||
476 | static unsigned int ts_shift[] = TS_SHIFT; | 476 | static const unsigned int ts_shift[] = TS_SHIFT; |
477 | 477 | ||
478 | static struct sh_dmae_pdata dma0_platform_data = { | 478 | static struct sh_dmae_pdata dma0_platform_data = { |
479 | .channel = dmac0_channels, | 479 | .channel = dmac0_channels, |
diff --git a/drivers/dma/shdma.c b/drivers/dma/shdma.c index 7a18b580f626..aab352a63a4a 100644 --- a/drivers/dma/shdma.c +++ b/drivers/dma/shdma.c | |||
@@ -188,7 +188,7 @@ static int dmae_set_dmars(struct sh_dmae_chan *sh_chan, u16 val) | |||
188 | struct sh_dmae_device *shdev = container_of(sh_chan->common.device, | 188 | struct sh_dmae_device *shdev = container_of(sh_chan->common.device, |
189 | struct sh_dmae_device, common); | 189 | struct sh_dmae_device, common); |
190 | struct sh_dmae_pdata *pdata = shdev->pdata; | 190 | struct sh_dmae_pdata *pdata = shdev->pdata; |
191 | struct sh_dmae_channel *chan_pdata = &pdata->channel[sh_chan->id]; | 191 | const struct sh_dmae_channel *chan_pdata = &pdata->channel[sh_chan->id]; |
192 | u16 __iomem *addr = shdev->dmars + chan_pdata->dmars / sizeof(u16); | 192 | u16 __iomem *addr = shdev->dmars + chan_pdata->dmars / sizeof(u16); |
193 | int shift = chan_pdata->dmars_bit; | 193 | int shift = chan_pdata->dmars_bit; |
194 | 194 | ||
@@ -264,7 +264,7 @@ static struct sh_desc *sh_dmae_get_desc(struct sh_dmae_chan *sh_chan) | |||
264 | return NULL; | 264 | return NULL; |
265 | } | 265 | } |
266 | 266 | ||
267 | static struct sh_dmae_slave_config *sh_dmae_find_slave( | 267 | static const struct sh_dmae_slave_config *sh_dmae_find_slave( |
268 | struct sh_dmae_chan *sh_chan, struct sh_dmae_slave *param) | 268 | struct sh_dmae_chan *sh_chan, struct sh_dmae_slave *param) |
269 | { | 269 | { |
270 | struct dma_device *dma_dev = sh_chan->common.device; | 270 | struct dma_device *dma_dev = sh_chan->common.device; |
@@ -296,7 +296,7 @@ static int sh_dmae_alloc_chan_resources(struct dma_chan *chan) | |||
296 | * never runs concurrently with itself or free_chan_resources. | 296 | * never runs concurrently with itself or free_chan_resources. |
297 | */ | 297 | */ |
298 | if (param) { | 298 | if (param) { |
299 | struct sh_dmae_slave_config *cfg; | 299 | const struct sh_dmae_slave_config *cfg; |
300 | 300 | ||
301 | cfg = sh_dmae_find_slave(sh_chan, param); | 301 | cfg = sh_dmae_find_slave(sh_chan, param); |
302 | if (!cfg) | 302 | if (!cfg) |
@@ -557,12 +557,14 @@ static struct dma_async_tx_descriptor *sh_dmae_prep_slave_sg( | |||
557 | { | 557 | { |
558 | struct sh_dmae_slave *param; | 558 | struct sh_dmae_slave *param; |
559 | struct sh_dmae_chan *sh_chan; | 559 | struct sh_dmae_chan *sh_chan; |
560 | dma_addr_t slave_addr; | ||
560 | 561 | ||
561 | if (!chan) | 562 | if (!chan) |
562 | return NULL; | 563 | return NULL; |
563 | 564 | ||
564 | sh_chan = to_sh_chan(chan); | 565 | sh_chan = to_sh_chan(chan); |
565 | param = chan->private; | 566 | param = chan->private; |
567 | slave_addr = param->config->addr; | ||
566 | 568 | ||
567 | /* Someone calling slave DMA on a public channel? */ | 569 | /* Someone calling slave DMA on a public channel? */ |
568 | if (!param || !sg_len) { | 570 | if (!param || !sg_len) { |
@@ -575,7 +577,7 @@ static struct dma_async_tx_descriptor *sh_dmae_prep_slave_sg( | |||
575 | * if (param != NULL), this is a successfully requested slave channel, | 577 | * if (param != NULL), this is a successfully requested slave channel, |
576 | * therefore param->config != NULL too. | 578 | * therefore param->config != NULL too. |
577 | */ | 579 | */ |
578 | return sh_dmae_prep_sg(sh_chan, sgl, sg_len, ¶m->config->addr, | 580 | return sh_dmae_prep_sg(sh_chan, sgl, sg_len, &slave_addr, |
579 | direction, flags); | 581 | direction, flags); |
580 | } | 582 | } |
581 | 583 | ||
@@ -856,7 +858,7 @@ static int __devinit sh_dmae_chan_probe(struct sh_dmae_device *shdev, int id, | |||
856 | int irq, unsigned long flags) | 858 | int irq, unsigned long flags) |
857 | { | 859 | { |
858 | int err; | 860 | int err; |
859 | struct sh_dmae_channel *chan_pdata = &shdev->pdata->channel[id]; | 861 | const struct sh_dmae_channel *chan_pdata = &shdev->pdata->channel[id]; |
860 | struct platform_device *pdev = to_platform_device(shdev->common.dev); | 862 | struct platform_device *pdev = to_platform_device(shdev->common.dev); |
861 | struct sh_dmae_chan *new_sh_chan; | 863 | struct sh_dmae_chan *new_sh_chan; |
862 | 864 | ||
diff --git a/include/linux/sh_dma.h b/include/linux/sh_dma.h index cdaaff424211..b08cd4efa15c 100644 --- a/include/linux/sh_dma.h +++ b/include/linux/sh_dma.h | |||
@@ -17,7 +17,7 @@ | |||
17 | struct sh_dmae_slave { | 17 | struct sh_dmae_slave { |
18 | unsigned int slave_id; /* Set by the platform */ | 18 | unsigned int slave_id; /* Set by the platform */ |
19 | struct device *dma_dev; /* Set by the platform */ | 19 | struct device *dma_dev; /* Set by the platform */ |
20 | struct sh_dmae_slave_config *config; /* Set by the driver */ | 20 | const struct sh_dmae_slave_config *config; /* Set by the driver */ |
21 | }; | 21 | }; |
22 | 22 | ||
23 | struct sh_dmae_regs { | 23 | struct sh_dmae_regs { |
@@ -36,6 +36,7 @@ struct sh_desc { | |||
36 | int chunks; | 36 | int chunks; |
37 | int mark; | 37 | int mark; |
38 | }; | 38 | }; |
39 | |||
39 | struct sh_dmae_slave_config { | 40 | struct sh_dmae_slave_config { |
40 | unsigned int slave_id; | 41 | unsigned int slave_id; |
41 | dma_addr_t addr; | 42 | dma_addr_t addr; |
@@ -50,15 +51,15 @@ struct sh_dmae_channel { | |||
50 | }; | 51 | }; |
51 | 52 | ||
52 | struct sh_dmae_pdata { | 53 | struct sh_dmae_pdata { |
53 | struct sh_dmae_slave_config *slave; | 54 | const struct sh_dmae_slave_config *slave; |
54 | int slave_num; | 55 | int slave_num; |
55 | struct sh_dmae_channel *channel; | 56 | const struct sh_dmae_channel *channel; |
56 | int channel_num; | 57 | int channel_num; |
57 | unsigned int ts_low_shift; | 58 | unsigned int ts_low_shift; |
58 | unsigned int ts_low_mask; | 59 | unsigned int ts_low_mask; |
59 | unsigned int ts_high_shift; | 60 | unsigned int ts_high_shift; |
60 | unsigned int ts_high_mask; | 61 | unsigned int ts_high_mask; |
61 | unsigned int *ts_shift; | 62 | const unsigned int *ts_shift; |
62 | int ts_shift_num; | 63 | int ts_shift_num; |
63 | u16 dmaor_init; | 64 | u16 dmaor_init; |
64 | }; | 65 | }; |