24 #include <mach/irqs.h>
25 #include <mach/cputype.h>
26 #include <mach/common.h>
27 #include <mach/time.h>
29 #include <mach/cpufreq.h>
37 #define DA850_CLK_ASYNC3 BIT(16)
39 #define DA850_PLL1_BASE 0x01e1a000
40 #define DA850_TIMER64P2_BASE 0x01f0c000
41 #define DA850_TIMER64P3_BASE 0x01f0d000
43 #define DA850_REF_FREQ 24000000
45 #define CFGCHIP3_ASYNC3_CLKSRC BIT(4)
46 #define CFGCHIP3_PLL1_MASTER_LOCK BIT(5)
47 #define CFGCHIP0_PLL_MASTER_LOCK BIT(4)
49 static int da850_set_armrate(
struct clk *
clk,
unsigned long rate);
50 static int da850_round_armrate(
struct clk *
clk,
unsigned long rate);
51 static int da850_set_pll0rate(
struct clk *
clk,
unsigned long armrate);
59 static struct clk ref_clk = {
65 static struct clk pll0_clk = {
70 .set_rate = da850_set_pll0rate,
73 static struct clk pll0_aux_clk = {
74 .name =
"pll0_aux_clk",
79 static struct clk pll0_sysclk2 = {
80 .name =
"pll0_sysclk2",
86 static struct clk pll0_sysclk3 = {
87 .name =
"pll0_sysclk3",
95 static struct clk pll0_sysclk4 = {
96 .name =
"pll0_sysclk4",
102 static struct clk pll0_sysclk5 = {
103 .name =
"pll0_sysclk5",
109 static struct clk pll0_sysclk6 = {
110 .name =
"pll0_sysclk6",
116 static struct clk pll0_sysclk7 = {
117 .name =
"pll0_sysclk7",
123 static struct pll_data pll1_data = {
129 static struct clk pll1_clk = {
136 static struct clk pll1_aux_clk = {
137 .name =
"pll1_aux_clk",
142 static struct clk pll1_sysclk2 = {
143 .name =
"pll1_sysclk2",
149 static struct clk pll1_sysclk3 = {
150 .name =
"pll1_sysclk3",
156 static struct clk i2c0_clk = {
158 .parent = &pll0_aux_clk,
161 static struct clk timerp64_0_clk = {
163 .parent = &pll0_aux_clk,
166 static struct clk timerp64_1_clk = {
168 .parent = &pll0_aux_clk,
171 static struct clk arm_rom_clk = {
173 .parent = &pll0_sysclk2,
178 static struct clk tpcc0_clk = {
180 .parent = &pll0_sysclk2,
185 static struct clk tptc0_clk = {
187 .parent = &pll0_sysclk2,
192 static struct clk tptc1_clk = {
194 .parent = &pll0_sysclk2,
199 static struct clk tpcc1_clk = {
201 .parent = &pll0_sysclk2,
207 static struct clk tptc2_clk = {
209 .parent = &pll0_sysclk2,
215 static struct clk uart0_clk = {
217 .parent = &pll0_sysclk2,
221 static struct clk uart1_clk = {
223 .parent = &pll0_sysclk2,
229 static struct clk uart2_clk = {
231 .parent = &pll0_sysclk2,
237 static struct clk aintc_clk = {
239 .parent = &pll0_sysclk4,
244 static struct clk gpio_clk = {
246 .parent = &pll0_sysclk4,
251 static struct clk i2c1_clk = {
253 .parent = &pll0_sysclk4,
258 static struct clk emif3_clk = {
260 .parent = &pll0_sysclk5,
266 static struct clk arm_clk = {
268 .parent = &pll0_sysclk6,
271 .set_rate = da850_set_armrate,
272 .round_rate = da850_round_armrate,
275 static struct clk rmii_clk = {
277 .parent = &pll0_sysclk7,
280 static struct clk emac_clk = {
282 .parent = &pll0_sysclk4,
287 static struct clk mcasp_clk = {
289 .parent = &pll0_sysclk2,
295 static struct clk lcdc_clk = {
297 .parent = &pll0_sysclk2,
302 static struct clk mmcsd0_clk = {
304 .parent = &pll0_sysclk2,
308 static struct clk mmcsd1_clk = {
310 .parent = &pll0_sysclk2,
315 static struct clk aemif_clk = {
317 .parent = &pll0_sysclk3,
322 static struct clk usb11_clk = {
324 .parent = &pll0_sysclk4,
329 static struct clk usb20_clk = {
331 .parent = &pll0_sysclk2,
336 static struct clk spi0_clk = {
338 .parent = &pll0_sysclk2,
342 static struct clk spi1_clk = {
344 .parent = &pll0_sysclk2,
352 .parent = &pll0_sysclk2,
357 static struct clk sata_clk = {
359 .parent = &pll0_sysclk2,
368 CLK(
NULL,
"pll0_aux", &pll0_aux_clk),
369 CLK(
NULL,
"pll0_sysclk2", &pll0_sysclk2),
370 CLK(
NULL,
"pll0_sysclk3", &pll0_sysclk3),
371 CLK(
NULL,
"pll0_sysclk4", &pll0_sysclk4),
372 CLK(
NULL,
"pll0_sysclk5", &pll0_sysclk5),
373 CLK(
NULL,
"pll0_sysclk6", &pll0_sysclk6),
374 CLK(
NULL,
"pll0_sysclk7", &pll0_sysclk7),
376 CLK(
NULL,
"pll1_aux", &pll1_aux_clk),
377 CLK(
NULL,
"pll1_sysclk2", &pll1_sysclk2),
378 CLK(
NULL,
"pll1_sysclk3", &pll1_sysclk3),
379 CLK(
"i2c_davinci.1",
NULL, &i2c0_clk),
380 CLK(
NULL,
"timer0", &timerp64_0_clk),
381 CLK(
"watchdog",
NULL, &timerp64_1_clk),
382 CLK(
NULL,
"arm_rom", &arm_rom_clk),
383 CLK(
NULL,
"tpcc0", &tpcc0_clk),
384 CLK(
NULL,
"tptc0", &tptc0_clk),
385 CLK(
NULL,
"tptc1", &tptc1_clk),
386 CLK(
NULL,
"tpcc1", &tpcc1_clk),
387 CLK(
NULL,
"tptc2", &tptc2_clk),
388 CLK(
NULL,
"uart0", &uart0_clk),
389 CLK(
NULL,
"uart1", &uart1_clk),
390 CLK(
NULL,
"uart2", &uart2_clk),
391 CLK(
NULL,
"aintc", &aintc_clk),
393 CLK(
"i2c_davinci.2",
NULL, &i2c1_clk),
394 CLK(
NULL,
"emif3", &emif3_clk),
397 CLK(
"davinci_emac.1",
NULL, &emac_clk),
398 CLK(
"davinci-mcasp.0",
NULL, &mcasp_clk),
399 CLK(
"da8xx_lcdc.0",
NULL, &lcdc_clk),
400 CLK(
"davinci_mmc.0",
NULL, &mmcsd0_clk),
401 CLK(
"davinci_mmc.1",
NULL, &mmcsd1_clk),
402 CLK(
NULL,
"aemif", &aemif_clk),
403 CLK(
NULL,
"usb11", &usb11_clk),
404 CLK(
NULL,
"usb20", &usb20_clk),
405 CLK(
"spi_davinci.0",
NULL, &spi0_clk),
406 CLK(
"spi_davinci.1",
NULL, &spi1_clk),
418 static const struct mux_config da850_pins[] = {
419 #ifdef CONFIG_DAVINCI_MUX
421 MUX_CFG(DA850, NUART0_CTS, 3, 24, 15, 2,
false)
771 static struct map_desc da850_io_desc[] = {
799 .manufacturer = 0x017,
801 .name =
"da850/omap-l138",
806 .manufacturer = 0x017,
808 .name =
"da850/omap-l138/am18x",
841 .timers = da850_timer_instance,
846 static void da850_set_async3_src(
int pllnum)
848 struct clk *
clk, *newparent = pllnum ? &pll1_sysclk2 : &pll0_sysclk2;
853 for (c = da850_clks; c->
clk; c++) {
857 WARN(ret,
"DA850: unable to re-parent clock %s",
870 #ifdef CONFIG_CPU_FREQ
882 unsigned int postdiv;
883 unsigned int cvdd_min;
884 unsigned int cvdd_max;
887 static const struct da850_opp da850_opp_456 = {
896 static const struct da850_opp da850_opp_408 = {
905 static const struct da850_opp da850_opp_372 = {
914 static const struct da850_opp da850_opp_300 = {
923 static const struct da850_opp da850_opp_200 = {
932 static const struct da850_opp da850_opp_96 = {
943 .index = (unsigned int) &da850_opp_##freq, \
944 .frequency = freq * 1000, \
960 #ifdef CONFIG_REGULATOR
961 static int da850_set_voltage(
unsigned int index);
962 static int da850_regulator_init(
void);
967 #ifdef CONFIG_REGULATOR
968 .init = da850_regulator_init,
969 .set_voltage = da850_set_voltage,
973 #ifdef CONFIG_REGULATOR
976 static int da850_set_voltage(
unsigned int index)
978 struct da850_opp *
opp;
983 opp = (
struct da850_opp *) cpufreq_info.
freq_table[index].index;
988 static int da850_regulator_init(
void)
991 if (
WARN(IS_ERR(cvdd),
"Unable to obtain voltage regulator for CVDD;"
992 " voltage scaling unsupported\n")) {
993 return PTR_ERR(cvdd);
1001 .
name =
"cpufreq-davinci",
1003 .platform_data = &cpufreq_info,
1018 for (i = 0; i <
ARRAY_SIZE(da850_freq_table); i++) {
1019 if (da850_freq_table[i].
frequency <= da850_max_speed) {
1028 static int da850_round_armrate(
struct clk *clk,
unsigned long rate)
1030 int i, ret = 0, diff;
1031 unsigned int best = (
unsigned int) -1;
1050 static int da850_set_armrate(
struct clk *clk,
unsigned long index)
1052 struct clk *pllclk = &pll0_clk;
1057 static int da850_set_pll0rate(
struct clk *clk,
unsigned long index)
1059 unsigned int prediv,
mult, postdiv;
1060 struct da850_opp *opp;
1064 opp = (
struct da850_opp *) cpufreq_info.
freq_table[index].index;
1065 prediv = opp->prediv;
1067 postdiv = opp->postdiv;
1081 static int da850_set_armrate(
struct clk *clk,
unsigned long rate)
1086 static int da850_set_pll0rate(
struct clk *clk,
unsigned long armrate)
1091 static int da850_round_armrate(
struct clk *clk,
unsigned long rate)
1138 static struct resource da850_vpif_resource[] = {
1150 .dma_mask = &da850_vpif_dma_mask,
1153 .resource = da850_vpif_resource,
1154 .num_resources =
ARRAY_SIZE(da850_vpif_resource),
1157 static struct resource da850_vpif_display_resource[] = {
1166 .name =
"vpif_display",
1169 .dma_mask = &da850_vpif_dma_mask,
1172 .resource = da850_vpif_display_resource,
1173 .num_resources =
ARRAY_SIZE(da850_vpif_display_resource),
1176 static struct resource da850_vpif_capture_resource[] = {
1190 .name =
"vpif_capture",
1193 .dma_mask = &da850_vpif_dma_mask,
1196 .resource = da850_vpif_capture_resource,
1197 .num_resources =
ARRAY_SIZE(da850_vpif_capture_resource),
1208 da850_vpif_display_dev.
dev.platform_data = display_config;
1215 da850_vpif_capture_dev.
dev.platform_data = capture_config;
1220 .io_desc = da850_io_desc,
1225 .cpu_clks = da850_clks,
1226 .psc_bases = da850_psc_bases,
1227 .psc_bases_num =
ARRAY_SIZE(da850_psc_bases),
1229 .pinmux_pins = da850_pins,
1233 .intc_irq_prios = da850_default_priorities,
1235 .timer_info = &da850_timer_info,
1267 da850_set_async3_src(1);