diff options
author | Kukjin Kim <kgene.kim@samsung.com> | 2011-09-18 21:26:54 -0400 |
---|---|---|
committer | Kukjin Kim <kgene.kim@samsung.com> | 2011-09-18 21:26:54 -0400 |
commit | 219c8c866ceee3dbfeb1194ce06e9c729f1d379c (patch) | |
tree | 618b6761caa3316b535ad458d9dff3ee3bc4d86c /arch/arm/mach-s5p64x0 | |
parent | b6fd41e29dea9c6753b1843a77e50433e6123bcb (diff) | |
parent | 51ddf31da16b1ab9da861eafedad6d263faf4388 (diff) |
Merge branch 'samsung_dma' of git://git.infradead.org/users/vkoul/slave-dma into next/topic-dma-samsung
Diffstat (limited to 'arch/arm/mach-s5p64x0')
-rw-r--r-- | arch/arm/mach-s5p64x0/Kconfig | 4 | ||||
-rw-r--r-- | arch/arm/mach-s5p64x0/clock-s5p6440.c | 9 | ||||
-rw-r--r-- | arch/arm/mach-s5p64x0/clock-s5p6450.c | 9 | ||||
-rw-r--r-- | arch/arm/mach-s5p64x0/dma.c | 273 | ||||
-rw-r--r-- | arch/arm/mach-s5p64x0/include/mach/dma.h | 4 |
5 files changed, 202 insertions, 97 deletions
diff --git a/arch/arm/mach-s5p64x0/Kconfig b/arch/arm/mach-s5p64x0/Kconfig index 65c7518dad7f..9527ed24dbff 100644 --- a/arch/arm/mach-s5p64x0/Kconfig +++ b/arch/arm/mach-s5p64x0/Kconfig | |||
@@ -9,14 +9,14 @@ if ARCH_S5P64X0 | |||
9 | 9 | ||
10 | config CPU_S5P6440 | 10 | config CPU_S5P6440 |
11 | bool | 11 | bool |
12 | select S3C_PL330_DMA | 12 | select SAMSUNG_DMADEV |
13 | select S5P_HRT | 13 | select S5P_HRT |
14 | help | 14 | help |
15 | Enable S5P6440 CPU support | 15 | Enable S5P6440 CPU support |
16 | 16 | ||
17 | config CPU_S5P6450 | 17 | config CPU_S5P6450 |
18 | bool | 18 | bool |
19 | select S3C_PL330_DMA | 19 | select SAMSUNG_DMADEV |
20 | select S5P_HRT | 20 | select S5P_HRT |
21 | help | 21 | help |
22 | Enable S5P6450 CPU support | 22 | Enable S5P6450 CPU support |
diff --git a/arch/arm/mach-s5p64x0/clock-s5p6440.c b/arch/arm/mach-s5p64x0/clock-s5p6440.c index 0e9cd3092dd2..c1f548f69a0d 100644 --- a/arch/arm/mach-s5p64x0/clock-s5p6440.c +++ b/arch/arm/mach-s5p64x0/clock-s5p6440.c | |||
@@ -146,7 +146,7 @@ static struct clk init_clocks_off[] = { | |||
146 | .enable = s5p64x0_hclk0_ctrl, | 146 | .enable = s5p64x0_hclk0_ctrl, |
147 | .ctrlbit = (1 << 8), | 147 | .ctrlbit = (1 << 8), |
148 | }, { | 148 | }, { |
149 | .name = "pdma", | 149 | .name = "dma", |
150 | .parent = &clk_hclk_low.clk, | 150 | .parent = &clk_hclk_low.clk, |
151 | .enable = s5p64x0_hclk0_ctrl, | 151 | .enable = s5p64x0_hclk0_ctrl, |
152 | .ctrlbit = (1 << 12), | 152 | .ctrlbit = (1 << 12), |
@@ -499,6 +499,11 @@ static struct clksrc_clk *sysclks[] = { | |||
499 | &clk_pclk_low, | 499 | &clk_pclk_low, |
500 | }; | 500 | }; |
501 | 501 | ||
502 | static struct clk dummy_apb_pclk = { | ||
503 | .name = "apb_pclk", | ||
504 | .id = -1, | ||
505 | }; | ||
506 | |||
502 | void __init_or_cpufreq s5p6440_setup_clocks(void) | 507 | void __init_or_cpufreq s5p6440_setup_clocks(void) |
503 | { | 508 | { |
504 | struct clk *xtal_clk; | 509 | struct clk *xtal_clk; |
@@ -581,5 +586,7 @@ void __init s5p6440_register_clocks(void) | |||
581 | s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off)); | 586 | s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off)); |
582 | s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off)); | 587 | s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off)); |
583 | 588 | ||
589 | s3c24xx_register_clock(&dummy_apb_pclk); | ||
590 | |||
584 | s3c_pwmclk_init(); | 591 | s3c_pwmclk_init(); |
585 | } | 592 | } |
diff --git a/arch/arm/mach-s5p64x0/clock-s5p6450.c b/arch/arm/mach-s5p64x0/clock-s5p6450.c index d9dc16cde109..3d9b60975570 100644 --- a/arch/arm/mach-s5p64x0/clock-s5p6450.c +++ b/arch/arm/mach-s5p64x0/clock-s5p6450.c | |||
@@ -179,7 +179,7 @@ static struct clk init_clocks_off[] = { | |||
179 | .enable = s5p64x0_hclk0_ctrl, | 179 | .enable = s5p64x0_hclk0_ctrl, |
180 | .ctrlbit = (1 << 3), | 180 | .ctrlbit = (1 << 3), |
181 | }, { | 181 | }, { |
182 | .name = "pdma", | 182 | .name = "dma", |
183 | .parent = &clk_hclk_low.clk, | 183 | .parent = &clk_hclk_low.clk, |
184 | .enable = s5p64x0_hclk0_ctrl, | 184 | .enable = s5p64x0_hclk0_ctrl, |
185 | .ctrlbit = (1 << 12), | 185 | .ctrlbit = (1 << 12), |
@@ -553,6 +553,11 @@ static struct clksrc_clk *sysclks[] = { | |||
553 | &clk_sclk_audio0, | 553 | &clk_sclk_audio0, |
554 | }; | 554 | }; |
555 | 555 | ||
556 | static struct clk dummy_apb_pclk = { | ||
557 | .name = "apb_pclk", | ||
558 | .id = -1, | ||
559 | }; | ||
560 | |||
556 | void __init_or_cpufreq s5p6450_setup_clocks(void) | 561 | void __init_or_cpufreq s5p6450_setup_clocks(void) |
557 | { | 562 | { |
558 | struct clk *xtal_clk; | 563 | struct clk *xtal_clk; |
@@ -632,5 +637,7 @@ void __init s5p6450_register_clocks(void) | |||
632 | s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off)); | 637 | s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off)); |
633 | s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off)); | 638 | s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off)); |
634 | 639 | ||
640 | s3c24xx_register_clock(&dummy_apb_pclk); | ||
641 | |||
635 | s3c_pwmclk_init(); | 642 | s3c_pwmclk_init(); |
636 | } | 643 | } |
diff --git a/arch/arm/mach-s5p64x0/dma.c b/arch/arm/mach-s5p64x0/dma.c index d7ad944b3475..aebf3fcb1ebe 100644 --- a/arch/arm/mach-s5p64x0/dma.c +++ b/arch/arm/mach-s5p64x0/dma.c | |||
@@ -21,128 +21,219 @@ | |||
21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <linux/platform_device.h> | ||
25 | #include <linux/dma-mapping.h> | 24 | #include <linux/dma-mapping.h> |
25 | #include <linux/amba/bus.h> | ||
26 | #include <linux/amba/pl330.h> | ||
27 | |||
28 | #include <asm/irq.h> | ||
26 | 29 | ||
27 | #include <mach/map.h> | 30 | #include <mach/map.h> |
28 | #include <mach/irqs.h> | 31 | #include <mach/irqs.h> |
29 | #include <mach/regs-clock.h> | 32 | #include <mach/regs-clock.h> |
33 | #include <mach/dma.h> | ||
30 | 34 | ||
31 | #include <plat/devs.h> | 35 | #include <plat/devs.h> |
32 | #include <plat/s3c-pl330-pdata.h> | 36 | #include <plat/irqs.h> |
33 | 37 | ||
34 | static u64 dma_dmamask = DMA_BIT_MASK(32); | 38 | static u64 dma_dmamask = DMA_BIT_MASK(32); |
35 | 39 | ||
36 | static struct resource s5p64x0_pdma_resource[] = { | 40 | struct dma_pl330_peri s5p6440_pdma_peri[22] = { |
37 | [0] = { | 41 | { |
38 | .start = S5P64X0_PA_PDMA, | 42 | .peri_id = (u8)DMACH_UART0_RX, |
39 | .end = S5P64X0_PA_PDMA + SZ_4K, | 43 | .rqtype = DEVTOMEM, |
40 | .flags = IORESOURCE_MEM, | 44 | }, { |
41 | }, | 45 | .peri_id = (u8)DMACH_UART0_TX, |
42 | [1] = { | 46 | .rqtype = MEMTODEV, |
43 | .start = IRQ_DMA0, | 47 | }, { |
44 | .end = IRQ_DMA0, | 48 | .peri_id = (u8)DMACH_UART1_RX, |
45 | .flags = IORESOURCE_IRQ, | 49 | .rqtype = DEVTOMEM, |
50 | }, { | ||
51 | .peri_id = (u8)DMACH_UART1_TX, | ||
52 | .rqtype = MEMTODEV, | ||
53 | }, { | ||
54 | .peri_id = (u8)DMACH_UART2_RX, | ||
55 | .rqtype = DEVTOMEM, | ||
56 | }, { | ||
57 | .peri_id = (u8)DMACH_UART2_TX, | ||
58 | .rqtype = MEMTODEV, | ||
59 | }, { | ||
60 | .peri_id = (u8)DMACH_UART3_RX, | ||
61 | .rqtype = DEVTOMEM, | ||
62 | }, { | ||
63 | .peri_id = (u8)DMACH_UART3_TX, | ||
64 | .rqtype = MEMTODEV, | ||
65 | }, { | ||
66 | .peri_id = DMACH_MAX, | ||
67 | }, { | ||
68 | .peri_id = DMACH_MAX, | ||
69 | }, { | ||
70 | .peri_id = (u8)DMACH_PCM0_TX, | ||
71 | .rqtype = MEMTODEV, | ||
72 | }, { | ||
73 | .peri_id = (u8)DMACH_PCM0_RX, | ||
74 | .rqtype = DEVTOMEM, | ||
75 | }, { | ||
76 | .peri_id = (u8)DMACH_I2S0_TX, | ||
77 | .rqtype = MEMTODEV, | ||
78 | }, { | ||
79 | .peri_id = (u8)DMACH_I2S0_RX, | ||
80 | .rqtype = DEVTOMEM, | ||
81 | }, { | ||
82 | .peri_id = (u8)DMACH_SPI0_TX, | ||
83 | .rqtype = MEMTODEV, | ||
84 | }, { | ||
85 | .peri_id = (u8)DMACH_SPI0_RX, | ||
86 | .rqtype = DEVTOMEM, | ||
87 | }, { | ||
88 | .peri_id = (u8)DMACH_MAX, | ||
89 | }, { | ||
90 | .peri_id = (u8)DMACH_MAX, | ||
91 | }, { | ||
92 | .peri_id = (u8)DMACH_MAX, | ||
93 | }, { | ||
94 | .peri_id = (u8)DMACH_MAX, | ||
95 | }, { | ||
96 | .peri_id = (u8)DMACH_SPI1_TX, | ||
97 | .rqtype = MEMTODEV, | ||
98 | }, { | ||
99 | .peri_id = (u8)DMACH_SPI1_RX, | ||
100 | .rqtype = DEVTOMEM, | ||
46 | }, | 101 | }, |
47 | }; | 102 | }; |
48 | 103 | ||
49 | static struct s3c_pl330_platdata s5p6440_pdma_pdata = { | 104 | struct dma_pl330_platdata s5p6440_pdma_pdata = { |
50 | .peri = { | 105 | .nr_valid_peri = ARRAY_SIZE(s5p6440_pdma_peri), |
51 | [0] = DMACH_UART0_RX, | 106 | .peri = s5p6440_pdma_peri, |
52 | [1] = DMACH_UART0_TX, | ||
53 | [2] = DMACH_UART1_RX, | ||
54 | [3] = DMACH_UART1_TX, | ||
55 | [4] = DMACH_UART2_RX, | ||
56 | [5] = DMACH_UART2_TX, | ||
57 | [6] = DMACH_UART3_RX, | ||
58 | [7] = DMACH_UART3_TX, | ||
59 | [8] = DMACH_MAX, | ||
60 | [9] = DMACH_MAX, | ||
61 | [10] = DMACH_PCM0_TX, | ||
62 | [11] = DMACH_PCM0_RX, | ||
63 | [12] = DMACH_I2S0_TX, | ||
64 | [13] = DMACH_I2S0_RX, | ||
65 | [14] = DMACH_SPI0_TX, | ||
66 | [15] = DMACH_SPI0_RX, | ||
67 | [16] = DMACH_MAX, | ||
68 | [17] = DMACH_MAX, | ||
69 | [18] = DMACH_MAX, | ||
70 | [19] = DMACH_MAX, | ||
71 | [20] = DMACH_SPI1_TX, | ||
72 | [21] = DMACH_SPI1_RX, | ||
73 | [22] = DMACH_MAX, | ||
74 | [23] = DMACH_MAX, | ||
75 | [24] = DMACH_MAX, | ||
76 | [25] = DMACH_MAX, | ||
77 | [26] = DMACH_MAX, | ||
78 | [27] = DMACH_MAX, | ||
79 | [28] = DMACH_MAX, | ||
80 | [29] = DMACH_PWM, | ||
81 | [30] = DMACH_MAX, | ||
82 | [31] = DMACH_MAX, | ||
83 | }, | ||
84 | }; | 107 | }; |
85 | 108 | ||
86 | static struct s3c_pl330_platdata s5p6450_pdma_pdata = { | 109 | struct dma_pl330_peri s5p6450_pdma_peri[32] = { |
87 | .peri = { | 110 | { |
88 | [0] = DMACH_UART0_RX, | 111 | .peri_id = (u8)DMACH_UART0_RX, |
89 | [1] = DMACH_UART0_TX, | 112 | .rqtype = DEVTOMEM, |
90 | [2] = DMACH_UART1_RX, | 113 | }, { |
91 | [3] = DMACH_UART1_TX, | 114 | .peri_id = (u8)DMACH_UART0_TX, |
92 | [4] = DMACH_UART2_RX, | 115 | .rqtype = MEMTODEV, |
93 | [5] = DMACH_UART2_TX, | 116 | }, { |
94 | [6] = DMACH_UART3_RX, | 117 | .peri_id = (u8)DMACH_UART1_RX, |
95 | [7] = DMACH_UART3_TX, | 118 | .rqtype = DEVTOMEM, |
96 | [8] = DMACH_UART4_RX, | 119 | }, { |
97 | [9] = DMACH_UART4_TX, | 120 | .peri_id = (u8)DMACH_UART1_TX, |
98 | [10] = DMACH_PCM0_TX, | 121 | .rqtype = MEMTODEV, |
99 | [11] = DMACH_PCM0_RX, | 122 | }, { |
100 | [12] = DMACH_I2S0_TX, | 123 | .peri_id = (u8)DMACH_UART2_RX, |
101 | [13] = DMACH_I2S0_RX, | 124 | .rqtype = DEVTOMEM, |
102 | [14] = DMACH_SPI0_TX, | 125 | }, { |
103 | [15] = DMACH_SPI0_RX, | 126 | .peri_id = (u8)DMACH_UART2_TX, |
104 | [16] = DMACH_PCM1_TX, | 127 | .rqtype = MEMTODEV, |
105 | [17] = DMACH_PCM1_RX, | 128 | }, { |
106 | [18] = DMACH_PCM2_TX, | 129 | .peri_id = (u8)DMACH_UART3_RX, |
107 | [19] = DMACH_PCM2_RX, | 130 | .rqtype = DEVTOMEM, |
108 | [20] = DMACH_SPI1_TX, | 131 | }, { |
109 | [21] = DMACH_SPI1_RX, | 132 | .peri_id = (u8)DMACH_UART3_TX, |
110 | [22] = DMACH_USI_TX, | 133 | .rqtype = MEMTODEV, |
111 | [23] = DMACH_USI_RX, | 134 | }, { |
112 | [24] = DMACH_MAX, | 135 | .peri_id = (u8)DMACH_UART4_RX, |
113 | [25] = DMACH_I2S1_TX, | 136 | .rqtype = DEVTOMEM, |
114 | [26] = DMACH_I2S1_RX, | 137 | }, { |
115 | [27] = DMACH_I2S2_TX, | 138 | .peri_id = (u8)DMACH_UART4_TX, |
116 | [28] = DMACH_I2S2_RX, | 139 | .rqtype = MEMTODEV, |
117 | [29] = DMACH_PWM, | 140 | }, { |
118 | [30] = DMACH_UART5_RX, | 141 | .peri_id = (u8)DMACH_PCM0_TX, |
119 | [31] = DMACH_UART5_TX, | 142 | .rqtype = MEMTODEV, |
143 | }, { | ||
144 | .peri_id = (u8)DMACH_PCM0_RX, | ||
145 | .rqtype = DEVTOMEM, | ||
146 | }, { | ||
147 | .peri_id = (u8)DMACH_I2S0_TX, | ||
148 | .rqtype = MEMTODEV, | ||
149 | }, { | ||
150 | .peri_id = (u8)DMACH_I2S0_RX, | ||
151 | .rqtype = DEVTOMEM, | ||
152 | }, { | ||
153 | .peri_id = (u8)DMACH_SPI0_TX, | ||
154 | .rqtype = MEMTODEV, | ||
155 | }, { | ||
156 | .peri_id = (u8)DMACH_SPI0_RX, | ||
157 | .rqtype = DEVTOMEM, | ||
158 | }, { | ||
159 | .peri_id = (u8)DMACH_PCM1_TX, | ||
160 | .rqtype = MEMTODEV, | ||
161 | }, { | ||
162 | .peri_id = (u8)DMACH_PCM1_RX, | ||
163 | .rqtype = DEVTOMEM, | ||
164 | }, { | ||
165 | .peri_id = (u8)DMACH_PCM2_TX, | ||
166 | .rqtype = MEMTODEV, | ||
167 | }, { | ||
168 | .peri_id = (u8)DMACH_PCM2_RX, | ||
169 | .rqtype = DEVTOMEM, | ||
170 | }, { | ||
171 | .peri_id = (u8)DMACH_SPI1_TX, | ||
172 | .rqtype = MEMTODEV, | ||
173 | }, { | ||
174 | .peri_id = (u8)DMACH_SPI1_RX, | ||
175 | .rqtype = DEVTOMEM, | ||
176 | }, { | ||
177 | .peri_id = (u8)DMACH_USI_TX, | ||
178 | .rqtype = MEMTODEV, | ||
179 | }, { | ||
180 | .peri_id = (u8)DMACH_USI_RX, | ||
181 | .rqtype = DEVTOMEM, | ||
182 | }, { | ||
183 | .peri_id = (u8)DMACH_MAX, | ||
184 | }, { | ||
185 | .peri_id = (u8)DMACH_I2S1_TX, | ||
186 | .rqtype = MEMTODEV, | ||
187 | }, { | ||
188 | .peri_id = (u8)DMACH_I2S1_RX, | ||
189 | .rqtype = DEVTOMEM, | ||
190 | }, { | ||
191 | .peri_id = (u8)DMACH_I2S2_TX, | ||
192 | .rqtype = MEMTODEV, | ||
193 | }, { | ||
194 | .peri_id = (u8)DMACH_I2S2_RX, | ||
195 | .rqtype = DEVTOMEM, | ||
196 | }, { | ||
197 | .peri_id = (u8)DMACH_PWM, | ||
198 | }, { | ||
199 | .peri_id = (u8)DMACH_UART5_RX, | ||
200 | .rqtype = DEVTOMEM, | ||
201 | }, { | ||
202 | .peri_id = (u8)DMACH_UART5_TX, | ||
203 | .rqtype = MEMTODEV, | ||
120 | }, | 204 | }, |
121 | }; | 205 | }; |
122 | 206 | ||
123 | static struct platform_device s5p64x0_device_pdma = { | 207 | struct dma_pl330_platdata s5p6450_pdma_pdata = { |
124 | .name = "s3c-pl330", | 208 | .nr_valid_peri = ARRAY_SIZE(s5p6450_pdma_peri), |
125 | .id = -1, | 209 | .peri = s5p6450_pdma_peri, |
126 | .num_resources = ARRAY_SIZE(s5p64x0_pdma_resource), | 210 | }; |
127 | .resource = s5p64x0_pdma_resource, | 211 | |
128 | .dev = { | 212 | struct amba_device s5p64x0_device_pdma = { |
213 | .dev = { | ||
214 | .init_name = "dma-pl330", | ||
129 | .dma_mask = &dma_dmamask, | 215 | .dma_mask = &dma_dmamask, |
130 | .coherent_dma_mask = DMA_BIT_MASK(32), | 216 | .coherent_dma_mask = DMA_BIT_MASK(32), |
131 | }, | 217 | }, |
218 | .res = { | ||
219 | .start = S5P64X0_PA_PDMA, | ||
220 | .end = S5P64X0_PA_PDMA + SZ_4K, | ||
221 | .flags = IORESOURCE_MEM, | ||
222 | }, | ||
223 | .irq = {IRQ_DMA0, NO_IRQ}, | ||
224 | .periphid = 0x00041330, | ||
132 | }; | 225 | }; |
133 | 226 | ||
134 | static int __init s5p64x0_dma_init(void) | 227 | static int __init s5p64x0_dma_init(void) |
135 | { | 228 | { |
136 | unsigned int id; | 229 | unsigned int id = __raw_readl(S5P64X0_SYS_ID) & 0xFF000; |
137 | |||
138 | id = __raw_readl(S5P64X0_SYS_ID) & 0xFF000; | ||
139 | 230 | ||
140 | if (id == 0x50000) | 231 | if (id == 0x50000) |
141 | s5p64x0_device_pdma.dev.platform_data = &s5p6450_pdma_pdata; | 232 | s5p64x0_device_pdma.dev.platform_data = &s5p6450_pdma_pdata; |
142 | else | 233 | else |
143 | s5p64x0_device_pdma.dev.platform_data = &s5p6440_pdma_pdata; | 234 | s5p64x0_device_pdma.dev.platform_data = &s5p6440_pdma_pdata; |
144 | 235 | ||
145 | platform_device_register(&s5p64x0_device_pdma); | 236 | amba_device_register(&s5p64x0_device_pdma, &iomem_resource); |
146 | 237 | ||
147 | return 0; | 238 | return 0; |
148 | } | 239 | } |
diff --git a/arch/arm/mach-s5p64x0/include/mach/dma.h b/arch/arm/mach-s5p64x0/include/mach/dma.h index 81209eb1409b..5a622af461d7 100644 --- a/arch/arm/mach-s5p64x0/include/mach/dma.h +++ b/arch/arm/mach-s5p64x0/include/mach/dma.h | |||
@@ -20,7 +20,7 @@ | |||
20 | #ifndef __MACH_DMA_H | 20 | #ifndef __MACH_DMA_H |
21 | #define __MACH_DMA_H | 21 | #define __MACH_DMA_H |
22 | 22 | ||
23 | /* This platform uses the common S3C DMA API driver for PL330 */ | 23 | /* This platform uses the common common DMA API driver for PL330 */ |
24 | #include <plat/s3c-dma-pl330.h> | 24 | #include <plat/dma-pl330.h> |
25 | 25 | ||
26 | #endif /* __MACH_DMA_H */ | 26 | #endif /* __MACH_DMA_H */ |