2 * TI DaVinci DM644x chip specific setup
4 * Author: Kevin Hilman, Deep Root Systems, LLC
6 * 2007 (c) Deep Root Systems, LLC. This file is licensed under
7 * the terms of the GNU General Public License version 2. This program
8 * is licensed "as is" without any warranty of any kind, whether express
11 #include <linux/kernel.h>
12 #include <linux/init.h>
13 #include <linux/clk.h>
14 #include <linux/platform_device.h>
16 #include <mach/dm646x.h>
17 #include <mach/clock.h>
19 #include <mach/edma.h>
20 #include <mach/irqs.h>
28 * Device specific clocks
30 #define DM646X_REF_FREQ 27000000
31 #define DM646X_AUX_FREQ 24000000
33 static struct pll_data pll1_data
= {
35 .phys_base
= DAVINCI_PLL1_BASE
,
38 static struct pll_data pll2_data
= {
40 .phys_base
= DAVINCI_PLL2_BASE
,
43 static struct clk ref_clk
= {
45 .rate
= DM646X_REF_FREQ
,
48 static struct clk aux_clkin
= {
50 .rate
= DM646X_AUX_FREQ
,
53 static struct clk pll1_clk
= {
56 .pll_data
= &pll1_data
,
60 static struct clk pll1_sysclk1
= {
61 .name
= "pll1_sysclk1",
67 static struct clk pll1_sysclk2
= {
68 .name
= "pll1_sysclk2",
74 static struct clk pll1_sysclk3
= {
75 .name
= "pll1_sysclk3",
81 static struct clk pll1_sysclk4
= {
82 .name
= "pll1_sysclk4",
88 static struct clk pll1_sysclk5
= {
89 .name
= "pll1_sysclk5",
95 static struct clk pll1_sysclk6
= {
96 .name
= "pll1_sysclk6",
102 static struct clk pll1_sysclk8
= {
103 .name
= "pll1_sysclk8",
109 static struct clk pll1_sysclk9
= {
110 .name
= "pll1_sysclk9",
116 static struct clk pll1_sysclkbp
= {
117 .name
= "pll1_sysclkbp",
119 .flags
= CLK_PLL
| PRE_PLL
,
123 static struct clk pll1_aux_clk
= {
124 .name
= "pll1_aux_clk",
126 .flags
= CLK_PLL
| PRE_PLL
,
129 static struct clk pll2_clk
= {
132 .pll_data
= &pll2_data
,
136 static struct clk pll2_sysclk1
= {
137 .name
= "pll2_sysclk1",
143 static struct clk dsp_clk
= {
145 .parent
= &pll1_sysclk1
,
146 .lpsc
= DM646X_LPSC_C64X_CPU
,
148 .usecount
= 1, /* REVISIT how to disable? */
151 static struct clk arm_clk
= {
153 .parent
= &pll1_sysclk2
,
154 .lpsc
= DM646X_LPSC_ARM
,
155 .flags
= ALWAYS_ENABLED
,
158 static struct clk uart0_clk
= {
160 .parent
= &aux_clkin
,
161 .lpsc
= DM646X_LPSC_UART0
,
164 static struct clk uart1_clk
= {
166 .parent
= &aux_clkin
,
167 .lpsc
= DM646X_LPSC_UART1
,
170 static struct clk uart2_clk
= {
172 .parent
= &aux_clkin
,
173 .lpsc
= DM646X_LPSC_UART2
,
176 static struct clk i2c_clk
= {
178 .parent
= &pll1_sysclk3
,
179 .lpsc
= DM646X_LPSC_I2C
,
182 static struct clk gpio_clk
= {
184 .parent
= &pll1_sysclk3
,
185 .lpsc
= DM646X_LPSC_GPIO
,
188 static struct clk aemif_clk
= {
190 .parent
= &pll1_sysclk3
,
191 .lpsc
= DM646X_LPSC_AEMIF
,
192 .flags
= ALWAYS_ENABLED
,
195 static struct clk emac_clk
= {
197 .parent
= &pll1_sysclk3
,
198 .lpsc
= DM646X_LPSC_EMAC
,
201 static struct clk pwm0_clk
= {
203 .parent
= &pll1_sysclk3
,
204 .lpsc
= DM646X_LPSC_PWM0
,
205 .usecount
= 1, /* REVIST: disabling hangs system */
208 static struct clk pwm1_clk
= {
210 .parent
= &pll1_sysclk3
,
211 .lpsc
= DM646X_LPSC_PWM1
,
212 .usecount
= 1, /* REVIST: disabling hangs system */
215 static struct clk timer0_clk
= {
217 .parent
= &pll1_sysclk3
,
218 .lpsc
= DM646X_LPSC_TIMER0
,
221 static struct clk timer1_clk
= {
223 .parent
= &pll1_sysclk3
,
224 .lpsc
= DM646X_LPSC_TIMER1
,
227 static struct clk timer2_clk
= {
229 .parent
= &pll1_sysclk3
,
230 .flags
= ALWAYS_ENABLED
, /* no LPSC, always enabled; c.f. spruep9a */
233 struct davinci_clk dm646x_clks
[] = {
234 CLK(NULL
, "ref", &ref_clk
),
235 CLK(NULL
, "aux", &aux_clkin
),
236 CLK(NULL
, "pll1", &pll1_clk
),
237 CLK(NULL
, "pll1_sysclk", &pll1_sysclk1
),
238 CLK(NULL
, "pll1_sysclk", &pll1_sysclk2
),
239 CLK(NULL
, "pll1_sysclk", &pll1_sysclk3
),
240 CLK(NULL
, "pll1_sysclk", &pll1_sysclk4
),
241 CLK(NULL
, "pll1_sysclk", &pll1_sysclk5
),
242 CLK(NULL
, "pll1_sysclk", &pll1_sysclk6
),
243 CLK(NULL
, "pll1_sysclk", &pll1_sysclk8
),
244 CLK(NULL
, "pll1_sysclk", &pll1_sysclk9
),
245 CLK(NULL
, "pll1_sysclk", &pll1_sysclkbp
),
246 CLK(NULL
, "pll1_aux", &pll1_aux_clk
),
247 CLK(NULL
, "pll2", &pll2_clk
),
248 CLK(NULL
, "pll2_sysclk1", &pll2_sysclk1
),
249 CLK(NULL
, "dsp", &dsp_clk
),
250 CLK(NULL
, "arm", &arm_clk
),
251 CLK(NULL
, "uart0", &uart0_clk
),
252 CLK(NULL
, "uart1", &uart1_clk
),
253 CLK(NULL
, "uart2", &uart2_clk
),
254 CLK("i2c_davinci.1", NULL
, &i2c_clk
),
255 CLK(NULL
, "gpio", &gpio_clk
),
256 CLK(NULL
, "aemif", &aemif_clk
),
257 CLK("davinci_emac.1", NULL
, &emac_clk
),
258 CLK(NULL
, "pwm0", &pwm0_clk
),
259 CLK(NULL
, "pwm1", &pwm1_clk
),
260 CLK(NULL
, "timer0", &timer0_clk
),
261 CLK(NULL
, "timer1", &timer1_clk
),
262 CLK("watchdog", NULL
, &timer2_clk
),
263 CLK(NULL
, NULL
, NULL
),
267 * Device specific mux setup
269 * soc description mux mode mode mux dbg
270 * reg offset mask mode
272 static const struct mux_config dm646x_pins
[] = {
273 MUX_CFG(DM646X
, ATAEN
, 0, 0, 1, 1, true)
275 MUX_CFG(DM646X
, AUDCK1
, 0, 29, 1, 0, false)
277 MUX_CFG(DM646X
, AUDCK0
, 0, 28, 1, 0, false)
280 /*----------------------------------------------------------------------*/
282 static const s8 dma_chan_dm646x_no_event
[] = {
290 static struct edma_soc_info dm646x_edma_info
= {
292 .n_region
= 6, /* 0-1, 4-7 */
295 .noevent
= dma_chan_dm646x_no_event
,
298 static struct resource edma_resources
[] = {
302 .end
= 0x01c00000 + SZ_64K
- 1,
303 .flags
= IORESOURCE_MEM
,
308 .end
= 0x01c10000 + SZ_1K
- 1,
309 .flags
= IORESOURCE_MEM
,
314 .end
= 0x01c10400 + SZ_1K
- 1,
315 .flags
= IORESOURCE_MEM
,
320 .end
= 0x01c10800 + SZ_1K
- 1,
321 .flags
= IORESOURCE_MEM
,
326 .end
= 0x01c10c00 + SZ_1K
- 1,
327 .flags
= IORESOURCE_MEM
,
331 .flags
= IORESOURCE_IRQ
,
334 .start
= IRQ_CCERRINT
,
335 .flags
= IORESOURCE_IRQ
,
337 /* not using TC*_ERR */
340 static struct platform_device dm646x_edma_device
= {
343 .dev
.platform_data
= &dm646x_edma_info
,
344 .num_resources
= ARRAY_SIZE(edma_resources
),
345 .resource
= edma_resources
,
348 /*----------------------------------------------------------------------*/
351 void __init
dm646x_init(void)
353 davinci_clk_init(dm646x_clks
);
354 davinci_mux_register(dm646x_pins
, ARRAY_SIZE(dm646x_pins
));
357 static int __init
dm646x_init_devices(void)
359 if (!cpu_is_davinci_dm646x())
362 platform_device_register(&dm646x_edma_device
);
365 postcore_initcall(dm646x_init_devices
);