15 #include <linux/slab.h>
20 #include <mach/atmel-mci.h>
27 #include <mach/board.h>
29 #include <mach/portmux.h>
30 #include <mach/sram.h>
45 .end = base + 0x3ff, \
46 .flags = IORESOURCE_MEM, \
52 .flags = IORESOURCE_IRQ, \
54 #define NAMED_IRQ(num, _name) \
59 .flags = IORESOURCE_IRQ, \
65 #define DEFINE_DEV(_name, _id) \
66 static u64 _name##_id##_dma_mask = DMA_BIT_MASK(32); \
67 static struct platform_device _name##_id##_device = { \
71 .dma_mask = &_name##_id##_dma_mask, \
72 .coherent_dma_mask = DMA_BIT_MASK(32), \
74 .resource = _name##_id##_resource, \
75 .num_resources = ARRAY_SIZE(_name##_id##_resource), \
77 #define DEFINE_DEV_DATA(_name, _id) \
78 static u64 _name##_id##_dma_mask = DMA_BIT_MASK(32); \
79 static struct platform_device _name##_id##_device = { \
83 .dma_mask = &_name##_id##_dma_mask, \
84 .platform_data = &_name##_id##_data, \
85 .coherent_dma_mask = DMA_BIT_MASK(32), \
87 .resource = _name##_id##_resource, \
88 .num_resources = ARRAY_SIZE(_name##_id##_resource), \
91 #define select_peripheral(port, pin_mask, periph, flags) \
92 at32_select_periph(GPIO_##port##_BASE, pin_mask, \
95 #define DEV_CLK(_name, devname, bus, _index) \
96 static struct clk devname##_##_name = { \
98 .dev = &devname##_device.dev, \
99 .parent = &bus##_clk, \
100 .mode = bus##_clk_mode, \
101 .get_rate = bus##_clk_get_rate, \
107 static struct clk osc0;
108 static struct clk osc1;
110 static unsigned long osc_get_rate(
struct clk *
clk)
119 div =
PM_BFEXT(PLLDIV, control) + 1;
120 mul =
PM_BFEXT(PLLMUL, control) + 1;
123 rate = (rate + div / 2) / div;
129 static long pll_set_rate(
struct clk *clk,
unsigned long rate,
133 unsigned long mul_best_fit = 0;
135 unsigned long div_min;
136 unsigned long div_max;
137 unsigned long div_best_fit = 0;
139 unsigned long pll_in;
140 unsigned long actual = 0;
141 unsigned long rate_error;
142 unsigned long rate_error_prev = ~0
UL;
146 if (rate < 80000000UL || rate > 200000000
UL)
149 ctrl =
PM_BF(PLLOPT, 4);
154 div_max = base / 6000000
UL;
156 if (div_max < div_min)
159 for (div = div_min; div <= div_max; div++) {
160 pll_in = (base + div / 2) / div;
161 mul = (rate + pll_in / 2) / pll_in;
166 actual = pll_in * mul;
167 rate_error =
abs(actual - rate);
169 if (rate_error < rate_error_prev) {
172 rate_error_prev = rate_error;
179 if (div_best_fit == 0)
182 ctrl |=
PM_BF(PLLMUL, mul_best_fit - 1);
183 ctrl |=
PM_BF(PLLDIV, div_best_fit - 1);
184 ctrl |=
PM_BF(PLLCOUNT, 16);
194 static unsigned long pll0_get_rate(
struct clk *clk)
203 static void pll1_mode(
struct clk *clk,
int enabled)
213 pr_debug(
"clk %s: failed to enable, rate not set\n",
222 for (timeout = 10000; timeout; timeout--) {
224 if (status &
PM_BIT(LOCK1))
229 if (!(status &
PM_BIT(LOCK1)))
238 static unsigned long pll1_get_rate(
struct clk *clk)
247 static long pll1_set_rate(
struct clk *clk,
unsigned long rate,
int apply)
250 unsigned long actual_rate;
255 if (actual_rate != rate)
260 clk->
name, rate, actual_rate);
267 static int pll1_set_parent(
struct clk *clk,
struct clk *
parent)
279 else if (parent == &osc1)
294 static struct clk osc32k = {
296 .get_rate = osc_get_rate,
300 static struct clk osc0 = {
302 .get_rate = osc_get_rate,
306 static struct clk osc1 = {
308 .get_rate = osc_get_rate,
311 static struct clk
pll0 = {
313 .get_rate = pll0_get_rate,
316 static struct clk
pll1 = {
319 .get_rate = pll1_get_rate,
320 .set_rate = pll1_set_rate,
321 .set_parent = pll1_set_parent,
330 static struct clk *main_clock;
338 static unsigned long bus_clk_get_rate(
struct clk *clk,
unsigned int shift)
343 static void cpu_clk_mode(
struct clk *clk,
int enabled)
351 mask |= 1 << clk->
index;
353 mask &= ~(1 << clk->
index);
355 spin_unlock_irqrestore(&pm_lock, flags);
358 static unsigned long cpu_clk_get_rate(
struct clk *clk)
360 unsigned long cksel, shift = 0;
363 if (cksel &
PM_BIT(CPUDIV))
364 shift =
PM_BFEXT(CPUSEL, cksel) + 1;
366 return bus_clk_get_rate(clk, shift);
369 static long cpu_clk_set_rate(
struct clk *clk,
unsigned long rate,
int apply)
372 unsigned long parent_rate, child_div, actual_rate,
div;
377 if (control &
PM_BIT(HSBDIV))
378 child_div = 1 << (
PM_BFEXT(HSBSEL, control) + 1);
382 if (rate > 3 * (parent_rate / 4) || child_div == 1) {
383 actual_rate = parent_rate;
384 control &= ~
PM_BIT(CPUDIV);
387 div = (parent_rate + rate / 2) / rate;
390 cpusel = (div > 1) ? (fls(div) - 2) : 0;
392 actual_rate = parent_rate / (1 << (cpusel + 1));
395 pr_debug(
"clk %s: new rate %lu (actual rate %lu)\n",
396 clk->
name, rate, actual_rate);
404 static void hsb_clk_mode(
struct clk *clk,
int enabled)
412 mask |= 1 << clk->
index;
414 mask &= ~(1 << clk->
index);
416 spin_unlock_irqrestore(&pm_lock, flags);
419 static unsigned long hsb_clk_get_rate(
struct clk *clk)
421 unsigned long cksel, shift = 0;
424 if (cksel &
PM_BIT(HSBDIV))
425 shift =
PM_BFEXT(HSBSEL, cksel) + 1;
427 return bus_clk_get_rate(clk, shift);
438 mask |= 1 << clk->
index;
440 mask &= ~(1 << clk->
index);
442 spin_unlock_irqrestore(&pm_lock, flags);
447 unsigned long cksel, shift = 0;
450 if (cksel &
PM_BIT(PBADIV))
451 shift =
PM_BFEXT(PBASEL, cksel) + 1;
453 return bus_clk_get_rate(clk, shift);
456 static void pbb_clk_mode(
struct clk *clk,
int enabled)
464 mask |= 1 << clk->
index;
466 mask &= ~(1 << clk->
index);
468 spin_unlock_irqrestore(&pm_lock, flags);
471 static unsigned long pbb_clk_get_rate(
struct clk *clk)
473 unsigned long cksel, shift = 0;
476 if (cksel &
PM_BIT(PBBDIV))
477 shift =
PM_BFEXT(PBBSEL, cksel) + 1;
479 return bus_clk_get_rate(clk, shift);
482 static struct clk cpu_clk = {
484 .get_rate = cpu_clk_get_rate,
485 .set_rate = cpu_clk_set_rate,
488 static struct clk hsb_clk = {
493 static struct clk pba_clk = {
496 .
mode = hsb_clk_mode,
500 static struct clk pbb_clk = {
503 .
mode = hsb_clk_mode,
504 .get_rate = pbb_clk_get_rate,
513 static void genclk_mode(
struct clk *clk,
int enabled)
525 static unsigned long genclk_get_rate(
struct clk *clk)
528 unsigned long div = 1;
531 if (control &
PM_BIT(DIVEN))
532 div = 2 * (
PM_BFEXT(DIV, control) + 1);
537 static long genclk_set_rate(
struct clk *clk,
unsigned long rate,
int apply)
540 unsigned long parent_rate, actual_rate,
div;
545 if (rate > 3 * parent_rate / 4) {
546 actual_rate = parent_rate;
547 control &= ~
PM_BIT(DIVEN);
549 div = (parent_rate +
rate) / (2 * rate) - 1;
551 actual_rate = parent_rate / (2 * (div + 1));
554 dev_dbg(clk->
dev,
"clk %s: new rate %lu (actual rate %lu)\n",
555 clk->
name, rate, actual_rate);
567 dev_dbg(clk->
dev,
"clk %s: new parent %s (was %s)\n",
572 if (parent == &osc1 || parent == &pll1)
573 control |=
PM_BIT(OSCSEL);
574 else if (parent == &osc0 || parent == &pll0)
575 control &= ~
PM_BIT(OSCSEL);
579 if (parent == &pll0 || parent == &pll1)
580 control |=
PM_BIT(PLLSEL);
582 control &= ~
PM_BIT(PLLSEL);
590 static void __init genclk_init_parent(
struct clk *clk)
598 if (control &
PM_BIT(OSCSEL))
599 parent = (control &
PM_BIT(PLLSEL)) ? &pll1 : &osc1;
601 parent = (control &
PM_BIT(PLLSEL)) ? &pll0 : &osc0;
610 .data_width = { 2, 2, 0, 0 },
613 static struct resource dw_dmac0_resource[] = {
623 static struct resource at32_pm0_resource[] = {
632 static struct resource at32ap700x_rtc0_resource[] = {
641 static struct resource at32_wdt0_resource[] = {
649 static struct resource at32_eic0_resource[] = {
667 static struct clk at32_pm_pclk = {
669 .dev = &at32_pm0_device.dev,
671 .
mode = pbb_clk_mode,
672 .get_rate = pbb_clk_get_rate,
677 static struct resource intc0_resource[] = {
683 .resource = intc0_resource,
686 DEV_CLK(pclk, at32_intc0, pbb, 1);
688 static struct clk ebi_clk = {
691 .
mode = hsb_clk_mode,
692 .get_rate = hsb_clk_get_rate,
695 static struct clk hramc_clk = {
698 .
mode = hsb_clk_mode,
699 .get_rate = hsb_clk_get_rate,
703 static struct clk sdramc_clk = {
704 .name =
"sdramc_clk",
706 .
mode = pbb_clk_mode,
707 .get_rate = pbb_clk_get_rate,
712 static struct resource smc0_resource[] = {
726 static struct clk pico_clk = {
729 .
mode = cpu_clk_mode,
730 .get_rate = cpu_clk_get_rate,
739 .name =
"hmatrix_clk",
741 .
mode = pbb_clk_mode,
742 .get_rate = pbb_clk_get_rate,
753 static inline void set_ebi_sfr_bits(
u32 mask)
762 static struct resource at32_tcb0_resource[] = {
769 .resource = at32_tcb0_resource,
770 .num_resources =
ARRAY_SIZE(at32_tcb0_resource),
772 DEV_CLK(t0_clk, at32_tcb0, pbb, 3);
774 static struct resource at32_tcb1_resource[] = {
781 .resource = at32_tcb1_resource,
782 .num_resources =
ARRAY_SIZE(at32_tcb1_resource),
784 DEV_CLK(t0_clk, at32_tcb1, pbb, 4);
790 static struct resource pio0_resource[] = {
797 static struct resource pio1_resource[] = {
804 static struct resource pio2_resource[] = {
811 static struct resource pio3_resource[] = {
818 static struct resource pio4_resource[] = {
825 static int __init system_device_init(
void)
860 static struct clk atmel_psif0_pclk = {
868 static struct resource atmel_psif1_resource[] __initdata = {
876 static struct clk atmel_psif1_pclk = {
889 if (!(
id == 0 ||
id == 1))
898 pin_mask = (1 << 8) | (1 << 9);
902 goto err_add_resources;
903 atmel_psif0_pclk.
dev = &pdev->
dev;
907 pin_mask = (1 << 11) | (1 << 12);
911 goto err_add_resources;
912 atmel_psif1_pclk.
dev = &pdev->
dev;
935 static struct resource atmel_usart0_resource[] = {
940 DEV_CLK(usart, atmel_usart0, pba, 3);
946 static struct resource atmel_usart1_resource[] = {
951 DEV_CLK(usart, atmel_usart1, pba, 4);
957 static struct resource atmel_usart2_resource[] = {
962 DEV_CLK(usart, atmel_usart2, pba, 5);
968 static struct resource atmel_usart3_resource[] = {
973 DEV_CLK(usart, atmel_usart3, pba, 6);
975 static inline void configure_usart0_pins(
int flags)
977 u32 pin_mask = (1 << 8) | (1 << 9);
985 static inline void configure_usart1_pins(
int flags)
987 u32 pin_mask = (1 << 17) | (1 << 18);
988 if (flags & ATMEL_USART_RTS) pin_mask |= (1 << 19);
989 if (flags & ATMEL_USART_CTS) pin_mask |= (1 << 20);
995 static inline void configure_usart2_pins(
int flags)
997 u32 pin_mask = (1 << 26) | (1 << 27);
998 if (flags & ATMEL_USART_RTS) pin_mask |= (1 << 30);
999 if (flags & ATMEL_USART_CTS) pin_mask |= (1 << 29);
1005 static inline void configure_usart3_pins(
int flags)
1007 u32 pin_mask = (1 << 18) | (1 << 17);
1008 if (flags & ATMEL_USART_RTS) pin_mask |= (1 << 16);
1009 if (flags & ATMEL_USART_CTS) pin_mask |= (1 << 15);
1024 pdev = &atmel_usart0_device;
1025 configure_usart0_pins(flags);
1028 pdev = &atmel_usart1_device;
1029 configure_usart1_pins(flags);
1032 pdev = &atmel_usart2_device;
1033 configure_usart2_pins(flags);
1036 pdev = &atmel_usart3_device;
1037 configure_usart3_pins(flags);
1050 pdata = pdev->
dev.platform_data;
1052 at32_usarts[line] = pdev;
1058 return at32_usarts[
id];
1070 #ifdef CONFIG_CPU_AT32AP7000
1072 static struct resource macb0_resource[] = {
1081 static struct resource macb1_resource[] = {
1097 pdev = &macb0_device;
1099 pin_mask = (1 << 3);
1100 pin_mask |= (1 << 4);
1101 pin_mask |= (1 << 7);
1102 pin_mask |= (1 << 8);
1103 pin_mask |= (1 << 9);
1104 pin_mask |= (1 << 10);
1105 pin_mask |= (1 << 13);
1106 pin_mask |= (1 << 15);
1107 pin_mask |= (1 << 16);
1108 pin_mask |= (1 << 17);
1111 pin_mask |= (1 << 0);
1112 pin_mask |= (1 << 1);
1113 pin_mask |= (1 << 2);
1114 pin_mask |= (1 << 5);
1115 pin_mask |= (1 << 6);
1116 pin_mask |= (1 << 11);
1117 pin_mask |= (1 << 12);
1118 pin_mask |= (1 << 14);
1119 #ifndef CONFIG_BOARD_MIMC200
1120 pin_mask |= (1 << 18);
1129 pdev = &macb1_device;
1131 pin_mask = (1 << 13);
1132 pin_mask |= (1 << 14);
1133 pin_mask |= (1 << 11);
1134 pin_mask |= (1 << 12);
1135 pin_mask |= (1 << 10);
1136 pin_mask |= (1 << 6);
1137 pin_mask |= (1 << 5);
1138 pin_mask |= (1 << 4);
1139 pin_mask |= (1 << 3);
1140 pin_mask |= (1 << 2);
1142 #ifndef CONFIG_BOARD_MIMC200
1144 pin_mask |= (1 << 15);
1150 pin_mask = (1 << 19);
1151 pin_mask |= (1 << 23);
1152 pin_mask |= (1 << 26);
1153 pin_mask |= (1 << 27);
1154 pin_mask |= (1 << 28);
1155 pin_mask |= (1 << 29);
1156 pin_mask |= (1 << 30);
1157 pin_mask |= (1 << 24);
1177 static struct resource atmel_spi0_resource[] = {
1182 DEV_CLK(spi_clk, atmel_spi0, pba, 0);
1184 static struct resource atmel_spi1_resource[] = {
1189 DEV_CLK(spi_clk, atmel_spi1, pba, 1);
1198 static u8 __initdata spi_pins[][4] = {
1210 for (;
n; n--, b++) {
1234 pdev = &atmel_spi0_device;
1235 pin_mask = (1 << 1) | (1 << 2);
1245 pdev = &atmel_spi1_device;
1246 pin_mask = (1 << 1) | (1 << 5);
1267 static struct resource atmel_twi0_resource[] __initdata = {
1271 static struct clk atmel_twi0_pclk = {
1295 goto err_add_resources;
1297 pin_mask = (1 << 6) | (1 << 7);
1301 atmel_twi0_pclk.
dev = &pdev->
dev;
1317 static struct resource atmel_mci0_resource[] __initdata = {
1321 static struct clk atmel_mci0_pclk = {
1324 .
mode = pbb_clk_mode,
1325 .get_rate = pbb_clk_get_rate,
1337 if (
id != 0 || !data)
1341 if (!data->
slot[0].bus_width && !data->
slot[1].bus_width)
1356 slave->
sdata.dma_dev = &dw_dmac0_device.dev;
1369 pioa_mask = 1 << 10;
1371 switch (data->
slot[0].bus_width) {
1373 pioa_mask |= 1 << 13;
1374 pioa_mask |= 1 << 14;
1375 pioa_mask |= 1 << 15;
1378 pioa_mask |= 1 << 11;
1379 pioa_mask |= 1 << 12;
1381 if (gpio_is_valid(data->
slot[0].detect_pin))
1383 if (gpio_is_valid(data->
slot[0].wp_pin))
1396 switch (data->
slot[1].bus_width) {
1398 piob_mask |= 1 << 8;
1399 piob_mask |= 1 << 9;
1400 piob_mask |= 1 << 10;
1403 piob_mask |= 1 << 6;
1404 piob_mask |= 1 << 7;
1407 if (gpio_is_valid(data->
slot[1].detect_pin))
1409 if (gpio_is_valid(data->
slot[1].wp_pin))
1416 if (!data->
slot[0].bus_width)
1419 data->
slot[1].bus_width = 0;
1423 atmel_mci0_pclk.
dev = &pdev->
dev;
1439 #if defined(CONFIG_CPU_AT32AP7000) || defined(CONFIG_CPU_AT32AP7002)
1441 static struct resource atmel_lcdfb0_resource[] = {
1443 .
start = 0xff000000,
1450 .start = 0x00000000,
1456 DEV_CLK(hck1, atmel_lcdfb0, hsb, 7);
1457 static struct clk atmel_lcdfb0_pixclk = {
1459 .dev = &atmel_lcdfb0_device.dev,
1460 .mode = genclk_mode,
1461 .get_rate = genclk_get_rate,
1462 .set_rate = genclk_set_rate,
1469 unsigned long fbmem_start,
unsigned long fbmem_len,
1476 unsigned int modedb_size;
1477 u32 portc_mask, portd_mask, porte_mask;
1492 goto err_dup_modedb;
1493 monspecs->
modedb = modedb;
1497 pdev = &atmel_lcdfb0_device;
1499 if (pin_mask == 0ULL)
1504 portc_mask = pin_mask & 0xfff80000;
1508 portd_mask = pin_mask & 0x0003ffff;
1512 porte_mask = (pin_mask >> 32) & 0x0007ffff;
1520 goto err_invalid_id;
1525 pdev->
resource[2].end = fbmem_start + fbmem_len - 1;
1529 info = pdev->
dev.platform_data;
1547 static struct resource atmel_pwm0_resource[] __initdata = {
1551 static struct clk atmel_pwm0_mck = {
1554 .
mode = pbb_clk_mode,
1555 .get_rate = pbb_clk_get_rate,
1579 if (mask & (1 << 0))
1580 pin_mask |= (1 << 28);
1581 if (mask & (1 << 1))
1582 pin_mask |= (1 << 29);
1587 if (mask & (1 << 2))
1588 pin_mask |= (1 << 21);
1589 if (mask & (1 << 3))
1590 pin_mask |= (1 << 22);
1594 atmel_pwm0_mck.
dev = &pdev->
dev;
1608 static struct resource ssc0_resource[] = {
1615 static struct resource ssc1_resource[] = {
1622 static struct resource ssc2_resource[] = {
1637 pdev = &ssc0_device;
1639 pin_mask |= (1 << 21);
1641 pin_mask |= (1 << 22);
1643 pin_mask |= (1 << 23);
1645 pin_mask |= (1 << 24);
1647 pin_mask |= (1 << 25);
1649 pin_mask |= (1 << 26);
1656 pdev = &ssc1_device;
1657 if (flags & ATMEL_SSC_RF)
1658 pin_mask |= (1 << 0);
1659 if (flags & ATMEL_SSC_RK)
1660 pin_mask |= (1 << 1);
1661 if (flags & ATMEL_SSC_TK)
1662 pin_mask |= (1 << 2);
1663 if (flags & ATMEL_SSC_TF)
1664 pin_mask |= (1 << 3);
1665 if (flags & ATMEL_SSC_TD)
1666 pin_mask |= (1 << 4);
1667 if (flags & ATMEL_SSC_RD)
1668 pin_mask |= (1 << 5);
1675 pdev = &ssc2_device;
1676 if (flags & ATMEL_SSC_TD)
1677 pin_mask |= (1 << 13);
1678 if (flags & ATMEL_SSC_RD)
1679 pin_mask |= (1 << 14);
1680 if (flags & ATMEL_SSC_TK)
1681 pin_mask |= (1 << 15);
1682 if (flags & ATMEL_SSC_TF)
1683 pin_mask |= (1 << 16);
1684 if (flags & ATMEL_SSC_RF)
1685 pin_mask |= (1 << 17);
1686 if (flags & ATMEL_SSC_RK)
1687 pin_mask |= (1 << 18);
1704 static struct resource usba0_resource[] __initdata = {
1706 .
start = 0xff300000,
1710 .start = 0xfff03000,
1716 static struct clk usba0_pclk = {
1719 .
mode = pbb_clk_mode,
1720 .get_rate = pbb_clk_get_rate,
1723 static struct clk usba0_hclk = {
1726 .
mode = hsb_clk_mode,
1727 .get_rate = hsb_clk_get_rate,
1731 #define EP(nam, idx, maxpkt, maxbk, dma, isoc) \
1735 .fifo_size = maxpkt, \
1736 .nr_banks = maxbk, \
1741 static struct usba_ep_data at32_usba_ep[] __initdata = {
1742 EP(
"ep0", 0, 64, 1, 0, 0),
1743 EP(
"ep1", 1, 512, 2, 1, 1),
1744 EP(
"ep2", 2, 512, 2, 1, 1),
1745 EP(
"ep3-int", 3, 64, 3, 1, 0),
1746 EP(
"ep4-int", 4, 64, 3, 1, 0),
1747 EP(
"ep5", 5, 1024, 3, 1, 1),
1748 EP(
"ep6", 6, 1024, 3, 1, 1),
1778 usba_data.pdata.vbus_pin = data->
vbus_pin;
1781 usba_data.pdata.vbus_pin = -
EINVAL;
1782 usba_data.pdata.vbus_pin_inverted = -
EINVAL;
1785 data = &usba_data.pdata;
1787 memcpy(data->
ep, at32_usba_ep,
sizeof(at32_usba_ep));
1795 usba0_pclk.
dev = &pdev->
dev;
1796 usba0_hclk.
dev = &pdev->
dev;
1810 #if defined(CONFIG_CPU_AT32AP7000) || defined(CONFIG_CPU_AT32AP7001)
1811 static struct resource at32_smc_cs4_resource[] __initdata = {
1813 .start = 0x04000000,
1819 static struct resource at32_smc_cs5_resource[] __initdata = {
1821 .
start = 0x20000000,
1829 unsigned int cs,
unsigned int extint)
1831 static unsigned int extint_pin_map[4] __initdata = {
1837 static bool common_pins_initialized __initdata =
false;
1838 unsigned int extint_pin;
1844 extint_pin = extint_pin_map[extint];
1849 at32_smc_cs4_resource,
1860 at32_smc_cs5_resource,
1873 if (!common_pins_initialized) {
1874 pin_mask = (1 << 19);
1875 pin_mask |= (1 << 20);
1876 pin_mask |= (1 << 23);
1877 pin_mask |= (1 << 24);
1881 common_pins_initialized =
true;
1906 if (at32_init_ide_or_cf(pdev, data->
cs, extint))
1931 if (at32_init_ide_or_cf(pdev, data->
cs, extint))
1938 if (gpio_is_valid(data->
vcc_pin))
1954 static struct resource smc_cs3_resource[] __initdata = {
1956 .
start = 0x0c000000,
1960 .start = 0xfff03c00,
1971 if (
id != 0 || !data)
2006 static struct resource atmel_ac97c0_resource[] __initdata = {
2010 static struct clk atmel_ac97c0_pclk = {
2013 .
mode = pbb_clk_mode,
2014 .get_rate = pbb_clk_get_rate,
2037 goto out_free_resources;
2050 rx_dws->
dma_dev = &dw_dmac0_device.dev;
2059 tx_dws->
dma_dev = &dw_dmac0_device.dev;
2068 goto out_free_resources;
2071 pin_mask = (1 << 20) | (1 << 21) | (1 << 22) | (1 << 23);
2079 atmel_ac97c0_pclk.
dev = &pdev->
dev;
2092 static struct resource abdac0_resource[] __initdata = {
2096 static struct clk abdac0_pclk = {
2099 .
mode = pbb_clk_mode,
2100 .get_rate = pbb_clk_get_rate,
2103 static struct clk abdac0_sample_clk = {
2104 .name =
"sample_clk",
2105 .mode = genclk_mode,
2106 .get_rate = genclk_get_rate,
2107 .set_rate = genclk_set_rate,
2119 if (
id != 0 || !data)
2128 goto out_free_resources;
2132 dws->
dma_dev = &dw_dmac0_device.dev;
2140 goto out_free_resources;
2142 pin_mask = (1 << 20) | (1 << 22);
2143 pin_mask |= (1 << 21) | (1 << 23);
2147 abdac0_pclk.
dev = &pdev->
dev;
2148 abdac0_sample_clk.
dev = &pdev->
dev;
2161 static struct clk gclk0 = {
2163 .mode = genclk_mode,
2164 .get_rate = genclk_get_rate,
2165 .set_rate = genclk_set_rate,
2169 static struct clk gclk1 = {
2171 .mode = genclk_mode,
2172 .get_rate = genclk_get_rate,
2173 .set_rate = genclk_set_rate,
2177 static struct clk gclk2 = {
2179 .mode = genclk_mode,
2180 .get_rate = genclk_get_rate,
2181 .set_rate = genclk_set_rate,
2185 static struct clk gclk3 = {
2187 .mode = genclk_mode,
2188 .get_rate = genclk_get_rate,
2189 .set_rate = genclk_set_rate,
2193 static struct clk gclk4 = {
2195 .mode = genclk_mode,
2196 .get_rate = genclk_get_rate,
2197 .set_rate = genclk_set_rate,
2202 static __initdata
struct clk *init_clocks[] = {
2233 &atmel_usart0_usart,
2234 &atmel_usart1_usart,
2235 &atmel_usart2_usart,
2236 &atmel_usart3_usart,
2238 #if defined(CONFIG_CPU_AT32AP7000)
2244 &atmel_spi0_spi_clk,
2245 &atmel_spi1_spi_clk,
2248 #if defined(CONFIG_CPU_AT32AP7000) || defined(CONFIG_CPU_AT32AP7002)
2250 &atmel_lcdfb0_pixclk,
2269 u32 cpu_mask = 0, hsb_mask = 0, pba_mask = 0, pbb_mask = 0;
2285 genclk_init_parent(&gclk0);
2286 genclk_init_parent(&gclk1);
2287 genclk_init_parent(&gclk2);
2288 genclk_init_parent(&gclk3);
2289 genclk_init_parent(&gclk4);
2290 #if defined(CONFIG_CPU_AT32AP7000) || defined(CONFIG_CPU_AT32AP7002)
2291 genclk_init_parent(&atmel_lcdfb0_pixclk);
2293 genclk_init_parent(&abdac0_sample_clk);
2304 for (i = 0; i <
ARRAY_SIZE(init_clocks); i++) {
2305 struct clk *clk = init_clocks[
i];
2310 if (clk->
users == 0)
2313 if (clk->
mode == &cpu_clk_mode)
2314 cpu_mask |= 1 << clk->
index;
2315 else if (clk->
mode == &hsb_clk_mode)
2316 hsb_mask |= 1 << clk->
index;
2318 pba_mask |= 1 << clk->
index;
2319 else if (clk->
mode == &pbb_clk_mode)
2320 pbb_mask |= 1 << clk->
index;
2338 static int __init sram_init(
void)
2347 if (gen_pool_add(pool, 0x24000000, 0x8000, -1))
2356 pr_err(
"Failed to create SRAM pool\n");