2 * Copyright (C) 2005-2006 Atmel Corporation
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
9 #include <linux/init.h>
10 #include <linux/platform_device.h>
14 #include <asm/arch/at32ap7000.h>
15 #include <asm/arch/board.h>
16 #include <asm/arch/portmux.h>
17 #include <asm/arch/sm.h>
26 .end = base + 0x3ff, \
27 .flags = IORESOURCE_MEM, \
33 .flags = IORESOURCE_IRQ, \
35 #define NAMED_IRQ(num, _name) \
40 .flags = IORESOURCE_IRQ, \
43 #define DEFINE_DEV(_name, _id) \
44 static struct platform_device _name##_id##_device = { \
47 .resource = _name##_id##_resource, \
48 .num_resources = ARRAY_SIZE(_name##_id##_resource), \
50 #define DEFINE_DEV_DATA(_name, _id) \
51 static struct platform_device _name##_id##_device = { \
55 .platform_data = &_name##_id##_data, \
57 .resource = _name##_id##_resource, \
58 .num_resources = ARRAY_SIZE(_name##_id##_resource), \
61 #define select_peripheral(pin, periph, flags) \
62 at32_select_periph(GPIO_PIN_##pin, GPIO_##periph, flags)
64 #define DEV_CLK(_name, devname, bus, _index) \
65 static struct clk devname##_##_name = { \
67 .dev = &devname##_device.dev, \
68 .parent = &bus##_clk, \
69 .mode = bus##_clk_mode, \
70 .get_rate = bus##_clk_get_rate, \
74 unsigned long at32ap7000_osc_rates[3] = {
76 /* FIXME: these are ATSTK1002-specific */
81 static unsigned long osc_get_rate(struct clk *clk)
83 return at32ap7000_osc_rates[clk->index];
86 static unsigned long pll_get_rate(struct clk *clk, unsigned long control)
88 unsigned long div, mul, rate;
90 if (!(control & SM_BIT(PLLEN)))
93 div = SM_BFEXT(PLLDIV, control) + 1;
94 mul = SM_BFEXT(PLLMUL, control) + 1;
96 rate = clk->parent->get_rate(clk->parent);
97 rate = (rate + div / 2) / div;
103 static unsigned long pll0_get_rate(struct clk *clk)
107 control = sm_readl(&system_manager, PM_PLL0);
109 return pll_get_rate(clk, control);
112 static unsigned long pll1_get_rate(struct clk *clk)
116 control = sm_readl(&system_manager, PM_PLL1);
118 return pll_get_rate(clk, control);
122 * The AT32AP7000 has five primary clock sources: One 32kHz
123 * oscillator, two crystal oscillators and two PLLs.
125 static struct clk osc32k = {
127 .get_rate = osc_get_rate,
131 static struct clk osc0 = {
133 .get_rate = osc_get_rate,
137 static struct clk osc1 = {
139 .get_rate = osc_get_rate,
142 static struct clk pll0 = {
144 .get_rate = pll0_get_rate,
147 static struct clk pll1 = {
149 .get_rate = pll1_get_rate,
154 * The main clock can be either osc0 or pll0. The boot loader may
155 * have chosen one for us, so we don't really know which one until we
156 * have a look at the SM.
158 static struct clk *main_clock;
161 * Synchronous clocks are generated from the main clock. The clocks
162 * must satisfy the constraint
163 * fCPU >= fHSB >= fPB
164 * i.e. each clock must not be faster than its parent.
166 static unsigned long bus_clk_get_rate(struct clk *clk, unsigned int shift)
168 return main_clock->get_rate(main_clock) >> shift;
171 static void cpu_clk_mode(struct clk *clk, int enabled)
173 struct at32_sm *sm = &system_manager;
177 spin_lock_irqsave(&sm->lock, flags);
178 mask = sm_readl(sm, PM_CPU_MASK);
180 mask |= 1 << clk->index;
182 mask &= ~(1 << clk->index);
183 sm_writel(sm, PM_CPU_MASK, mask);
184 spin_unlock_irqrestore(&sm->lock, flags);
187 static unsigned long cpu_clk_get_rate(struct clk *clk)
189 unsigned long cksel, shift = 0;
191 cksel = sm_readl(&system_manager, PM_CKSEL);
192 if (cksel & SM_BIT(CPUDIV))
193 shift = SM_BFEXT(CPUSEL, cksel) + 1;
195 return bus_clk_get_rate(clk, shift);
198 static void hsb_clk_mode(struct clk *clk, int enabled)
200 struct at32_sm *sm = &system_manager;
204 spin_lock_irqsave(&sm->lock, flags);
205 mask = sm_readl(sm, PM_HSB_MASK);
207 mask |= 1 << clk->index;
209 mask &= ~(1 << clk->index);
210 sm_writel(sm, PM_HSB_MASK, mask);
211 spin_unlock_irqrestore(&sm->lock, flags);
214 static unsigned long hsb_clk_get_rate(struct clk *clk)
216 unsigned long cksel, shift = 0;
218 cksel = sm_readl(&system_manager, PM_CKSEL);
219 if (cksel & SM_BIT(HSBDIV))
220 shift = SM_BFEXT(HSBSEL, cksel) + 1;
222 return bus_clk_get_rate(clk, shift);
225 static void pba_clk_mode(struct clk *clk, int enabled)
227 struct at32_sm *sm = &system_manager;
231 spin_lock_irqsave(&sm->lock, flags);
232 mask = sm_readl(sm, PM_PBA_MASK);
234 mask |= 1 << clk->index;
236 mask &= ~(1 << clk->index);
237 sm_writel(sm, PM_PBA_MASK, mask);
238 spin_unlock_irqrestore(&sm->lock, flags);
241 static unsigned long pba_clk_get_rate(struct clk *clk)
243 unsigned long cksel, shift = 0;
245 cksel = sm_readl(&system_manager, PM_CKSEL);
246 if (cksel & SM_BIT(PBADIV))
247 shift = SM_BFEXT(PBASEL, cksel) + 1;
249 return bus_clk_get_rate(clk, shift);
252 static void pbb_clk_mode(struct clk *clk, int enabled)
254 struct at32_sm *sm = &system_manager;
258 spin_lock_irqsave(&sm->lock, flags);
259 mask = sm_readl(sm, PM_PBB_MASK);
261 mask |= 1 << clk->index;
263 mask &= ~(1 << clk->index);
264 sm_writel(sm, PM_PBB_MASK, mask);
265 spin_unlock_irqrestore(&sm->lock, flags);
268 static unsigned long pbb_clk_get_rate(struct clk *clk)
270 unsigned long cksel, shift = 0;
272 cksel = sm_readl(&system_manager, PM_CKSEL);
273 if (cksel & SM_BIT(PBBDIV))
274 shift = SM_BFEXT(PBBSEL, cksel) + 1;
276 return bus_clk_get_rate(clk, shift);
279 static struct clk cpu_clk = {
281 .get_rate = cpu_clk_get_rate,
284 static struct clk hsb_clk = {
287 .get_rate = hsb_clk_get_rate,
289 static struct clk pba_clk = {
292 .mode = hsb_clk_mode,
293 .get_rate = pba_clk_get_rate,
296 static struct clk pbb_clk = {
299 .mode = hsb_clk_mode,
300 .get_rate = pbb_clk_get_rate,
305 /* --------------------------------------------------------------------
306 * Generic Clock operations
307 * -------------------------------------------------------------------- */
309 static void genclk_mode(struct clk *clk, int enabled)
313 BUG_ON(clk->index > 7);
315 control = sm_readl(&system_manager, PM_GCCTRL + 4 * clk->index);
317 control |= SM_BIT(CEN);
319 control &= ~SM_BIT(CEN);
320 sm_writel(&system_manager, PM_GCCTRL + 4 * clk->index, control);
323 static unsigned long genclk_get_rate(struct clk *clk)
326 unsigned long div = 1;
328 BUG_ON(clk->index > 7);
333 control = sm_readl(&system_manager, PM_GCCTRL + 4 * clk->index);
334 if (control & SM_BIT(DIVEN))
335 div = 2 * (SM_BFEXT(DIV, control) + 1);
337 return clk->parent->get_rate(clk->parent) / div;
340 static long genclk_set_rate(struct clk *clk, unsigned long rate, int apply)
343 unsigned long parent_rate, actual_rate, div;
345 BUG_ON(clk->index > 7);
350 parent_rate = clk->parent->get_rate(clk->parent);
351 control = sm_readl(&system_manager, PM_GCCTRL + 4 * clk->index);
353 if (rate > 3 * parent_rate / 4) {
354 actual_rate = parent_rate;
355 control &= ~SM_BIT(DIVEN);
357 div = (parent_rate + rate) / (2 * rate) - 1;
358 control = SM_BFINS(DIV, div, control) | SM_BIT(DIVEN);
359 actual_rate = parent_rate / (2 * (div + 1));
362 printk("clk %s: new rate %lu (actual rate %lu)\n",
363 clk->name, rate, actual_rate);
366 sm_writel(&system_manager, PM_GCCTRL + 4 * clk->index,
372 int genclk_set_parent(struct clk *clk, struct clk *parent)
376 BUG_ON(clk->index > 7);
378 printk("clk %s: new parent %s (was %s)\n",
379 clk->name, parent->name,
380 clk->parent ? clk->parent->name : "(null)");
382 control = sm_readl(&system_manager, PM_GCCTRL + 4 * clk->index);
384 if (parent == &osc1 || parent == &pll1)
385 control |= SM_BIT(OSCSEL);
386 else if (parent == &osc0 || parent == &pll0)
387 control &= ~SM_BIT(OSCSEL);
391 if (parent == &pll0 || parent == &pll1)
392 control |= SM_BIT(PLLSEL);
394 control &= ~SM_BIT(PLLSEL);
396 sm_writel(&system_manager, PM_GCCTRL + 4 * clk->index, control);
397 clk->parent = parent;
402 /* --------------------------------------------------------------------
404 * -------------------------------------------------------------------- */
405 static struct resource sm_resource[] = {
407 NAMED_IRQ(19, "eim"),
409 NAMED_IRQ(21, "rtc"),
411 struct platform_device at32_sm_device = {
414 .resource = sm_resource,
415 .num_resources = ARRAY_SIZE(sm_resource),
417 DEV_CLK(pclk, at32_sm, pbb, 0);
419 static struct resource intc0_resource[] = {
422 struct platform_device at32_intc0_device = {
425 .resource = intc0_resource,
426 .num_resources = ARRAY_SIZE(intc0_resource),
428 DEV_CLK(pclk, at32_intc0, pbb, 1);
430 static struct clk ebi_clk = {
433 .mode = hsb_clk_mode,
434 .get_rate = hsb_clk_get_rate,
437 static struct clk hramc_clk = {
440 .mode = hsb_clk_mode,
441 .get_rate = hsb_clk_get_rate,
445 static struct resource smc0_resource[] = {
449 DEV_CLK(pclk, smc0, pbb, 13);
450 DEV_CLK(mck, smc0, hsb, 0);
452 static struct platform_device pdc_device = {
456 DEV_CLK(hclk, pdc, hsb, 4);
457 DEV_CLK(pclk, pdc, pba, 16);
459 static struct clk pico_clk = {
462 .mode = cpu_clk_mode,
463 .get_rate = cpu_clk_get_rate,
467 /* --------------------------------------------------------------------
469 * -------------------------------------------------------------------- */
471 static struct resource pio0_resource[] = {
476 DEV_CLK(mck, pio0, pba, 10);
478 static struct resource pio1_resource[] = {
483 DEV_CLK(mck, pio1, pba, 11);
485 static struct resource pio2_resource[] = {
490 DEV_CLK(mck, pio2, pba, 12);
492 static struct resource pio3_resource[] = {
497 DEV_CLK(mck, pio3, pba, 13);
499 void __init at32_add_system_devices(void)
501 system_manager.eim_first_irq = NR_INTERNAL_IRQS;
503 platform_device_register(&at32_sm_device);
504 platform_device_register(&at32_intc0_device);
505 platform_device_register(&smc0_device);
506 platform_device_register(&pdc_device);
508 platform_device_register(&pio0_device);
509 platform_device_register(&pio1_device);
510 platform_device_register(&pio2_device);
511 platform_device_register(&pio3_device);
514 /* --------------------------------------------------------------------
516 * -------------------------------------------------------------------- */
518 static struct atmel_uart_data atmel_usart0_data = {
522 static struct resource atmel_usart0_resource[] = {
526 DEFINE_DEV_DATA(atmel_usart, 0);
527 DEV_CLK(usart, atmel_usart0, pba, 4);
529 static struct atmel_uart_data atmel_usart1_data = {
533 static struct resource atmel_usart1_resource[] = {
537 DEFINE_DEV_DATA(atmel_usart, 1);
538 DEV_CLK(usart, atmel_usart1, pba, 4);
540 static struct atmel_uart_data atmel_usart2_data = {
544 static struct resource atmel_usart2_resource[] = {
548 DEFINE_DEV_DATA(atmel_usart, 2);
549 DEV_CLK(usart, atmel_usart2, pba, 5);
551 static struct atmel_uart_data atmel_usart3_data = {
555 static struct resource atmel_usart3_resource[] = {
559 DEFINE_DEV_DATA(atmel_usart, 3);
560 DEV_CLK(usart, atmel_usart3, pba, 6);
562 static inline void configure_usart0_pins(void)
564 select_peripheral(PA(8), PERIPH_B, 0); /* RXD */
565 select_peripheral(PA(9), PERIPH_B, 0); /* TXD */
568 static inline void configure_usart1_pins(void)
570 select_peripheral(PA(17), PERIPH_A, 0); /* RXD */
571 select_peripheral(PA(18), PERIPH_A, 0); /* TXD */
574 static inline void configure_usart2_pins(void)
576 select_peripheral(PB(26), PERIPH_B, 0); /* RXD */
577 select_peripheral(PB(27), PERIPH_B, 0); /* TXD */
580 static inline void configure_usart3_pins(void)
582 select_peripheral(PB(18), PERIPH_B, 0); /* RXD */
583 select_peripheral(PB(17), PERIPH_B, 0); /* TXD */
586 static struct platform_device *at32_usarts[4];
588 void __init at32_map_usart(unsigned int hw_id, unsigned int line)
590 struct platform_device *pdev;
594 pdev = &atmel_usart0_device;
595 configure_usart0_pins();
598 pdev = &atmel_usart1_device;
599 configure_usart1_pins();
602 pdev = &atmel_usart2_device;
603 configure_usart2_pins();
606 pdev = &atmel_usart3_device;
607 configure_usart3_pins();
613 if (PXSEG(pdev->resource[0].start) == P4SEG) {
614 /* Addresses in the P4 segment are permanently mapped 1:1 */
615 struct atmel_uart_data *data = pdev->dev.platform_data;
616 data->regs = (void __iomem *)pdev->resource[0].start;
620 at32_usarts[line] = pdev;
623 struct platform_device *__init at32_add_device_usart(unsigned int id)
625 platform_device_register(at32_usarts[id]);
626 return at32_usarts[id];
629 struct platform_device *atmel_default_console_device;
631 void __init at32_setup_serial_console(unsigned int usart_id)
633 atmel_default_console_device = at32_usarts[usart_id];
636 /* --------------------------------------------------------------------
638 * -------------------------------------------------------------------- */
640 static struct eth_platform_data macb0_data;
641 static struct resource macb0_resource[] = {
645 DEFINE_DEV_DATA(macb, 0);
646 DEV_CLK(hclk, macb0, hsb, 8);
647 DEV_CLK(pclk, macb0, pbb, 6);
649 static struct eth_platform_data macb1_data;
650 static struct resource macb1_resource[] = {
654 DEFINE_DEV_DATA(macb, 1);
655 DEV_CLK(hclk, macb1, hsb, 9);
656 DEV_CLK(pclk, macb1, pbb, 7);
658 struct platform_device *__init
659 at32_add_device_eth(unsigned int id, struct eth_platform_data *data)
661 struct platform_device *pdev;
665 pdev = &macb0_device;
667 select_peripheral(PC(3), PERIPH_A, 0); /* TXD0 */
668 select_peripheral(PC(4), PERIPH_A, 0); /* TXD1 */
669 select_peripheral(PC(7), PERIPH_A, 0); /* TXEN */
670 select_peripheral(PC(8), PERIPH_A, 0); /* TXCK */
671 select_peripheral(PC(9), PERIPH_A, 0); /* RXD0 */
672 select_peripheral(PC(10), PERIPH_A, 0); /* RXD1 */
673 select_peripheral(PC(13), PERIPH_A, 0); /* RXER */
674 select_peripheral(PC(15), PERIPH_A, 0); /* RXDV */
675 select_peripheral(PC(16), PERIPH_A, 0); /* MDC */
676 select_peripheral(PC(17), PERIPH_A, 0); /* MDIO */
678 if (!data->is_rmii) {
679 select_peripheral(PC(0), PERIPH_A, 0); /* COL */
680 select_peripheral(PC(1), PERIPH_A, 0); /* CRS */
681 select_peripheral(PC(2), PERIPH_A, 0); /* TXER */
682 select_peripheral(PC(5), PERIPH_A, 0); /* TXD2 */
683 select_peripheral(PC(6), PERIPH_A, 0); /* TXD3 */
684 select_peripheral(PC(11), PERIPH_A, 0); /* RXD2 */
685 select_peripheral(PC(12), PERIPH_A, 0); /* RXD3 */
686 select_peripheral(PC(14), PERIPH_A, 0); /* RXCK */
687 select_peripheral(PC(18), PERIPH_A, 0); /* SPD */
692 pdev = &macb1_device;
694 select_peripheral(PD(13), PERIPH_B, 0); /* TXD0 */
695 select_peripheral(PD(14), PERIPH_B, 0); /* TXD1 */
696 select_peripheral(PD(11), PERIPH_B, 0); /* TXEN */
697 select_peripheral(PD(12), PERIPH_B, 0); /* TXCK */
698 select_peripheral(PD(10), PERIPH_B, 0); /* RXD0 */
699 select_peripheral(PD(6), PERIPH_B, 0); /* RXD1 */
700 select_peripheral(PD(5), PERIPH_B, 0); /* RXER */
701 select_peripheral(PD(4), PERIPH_B, 0); /* RXDV */
702 select_peripheral(PD(3), PERIPH_B, 0); /* MDC */
703 select_peripheral(PD(2), PERIPH_B, 0); /* MDIO */
705 if (!data->is_rmii) {
706 select_peripheral(PC(19), PERIPH_B, 0); /* COL */
707 select_peripheral(PC(23), PERIPH_B, 0); /* CRS */
708 select_peripheral(PC(26), PERIPH_B, 0); /* TXER */
709 select_peripheral(PC(27), PERIPH_B, 0); /* TXD2 */
710 select_peripheral(PC(28), PERIPH_B, 0); /* TXD3 */
711 select_peripheral(PC(29), PERIPH_B, 0); /* RXD2 */
712 select_peripheral(PC(30), PERIPH_B, 0); /* RXD3 */
713 select_peripheral(PC(24), PERIPH_B, 0); /* RXCK */
714 select_peripheral(PD(15), PERIPH_B, 0); /* SPD */
722 memcpy(pdev->dev.platform_data, data, sizeof(struct eth_platform_data));
723 platform_device_register(pdev);
728 /* --------------------------------------------------------------------
730 * -------------------------------------------------------------------- */
731 static struct resource spi0_resource[] = {
736 DEV_CLK(mck, spi0, pba, 0);
738 struct platform_device *__init at32_add_device_spi(unsigned int id)
740 struct platform_device *pdev;
745 select_peripheral(PA(0), PERIPH_A, 0); /* MISO */
746 select_peripheral(PA(1), PERIPH_A, 0); /* MOSI */
747 select_peripheral(PA(2), PERIPH_A, 0); /* SCK */
748 select_peripheral(PA(3), PERIPH_A, 0); /* NPCS0 */
749 select_peripheral(PA(4), PERIPH_A, 0); /* NPCS1 */
750 select_peripheral(PA(5), PERIPH_A, 0); /* NPCS2 */
757 platform_device_register(pdev);
761 /* --------------------------------------------------------------------
763 * -------------------------------------------------------------------- */
764 static struct lcdc_platform_data lcdc0_data;
765 static struct resource lcdc0_resource[] = {
769 .flags = IORESOURCE_MEM,
773 DEFINE_DEV_DATA(lcdc, 0);
774 DEV_CLK(hclk, lcdc0, hsb, 7);
775 static struct clk lcdc0_pixclk = {
777 .dev = &lcdc0_device.dev,
779 .get_rate = genclk_get_rate,
780 .set_rate = genclk_set_rate,
781 .set_parent = genclk_set_parent,
785 struct platform_device *__init
786 at32_add_device_lcdc(unsigned int id, struct lcdc_platform_data *data)
788 struct platform_device *pdev;
792 pdev = &lcdc0_device;
793 select_peripheral(PC(19), PERIPH_A, 0); /* CC */
794 select_peripheral(PC(20), PERIPH_A, 0); /* HSYNC */
795 select_peripheral(PC(21), PERIPH_A, 0); /* PCLK */
796 select_peripheral(PC(22), PERIPH_A, 0); /* VSYNC */
797 select_peripheral(PC(23), PERIPH_A, 0); /* DVAL */
798 select_peripheral(PC(24), PERIPH_A, 0); /* MODE */
799 select_peripheral(PC(25), PERIPH_A, 0); /* PWR */
800 select_peripheral(PC(26), PERIPH_A, 0); /* DATA0 */
801 select_peripheral(PC(27), PERIPH_A, 0); /* DATA1 */
802 select_peripheral(PC(28), PERIPH_A, 0); /* DATA2 */
803 select_peripheral(PC(29), PERIPH_A, 0); /* DATA3 */
804 select_peripheral(PC(30), PERIPH_A, 0); /* DATA4 */
805 select_peripheral(PC(31), PERIPH_A, 0); /* DATA5 */
806 select_peripheral(PD(0), PERIPH_A, 0); /* DATA6 */
807 select_peripheral(PD(1), PERIPH_A, 0); /* DATA7 */
808 select_peripheral(PD(2), PERIPH_A, 0); /* DATA8 */
809 select_peripheral(PD(3), PERIPH_A, 0); /* DATA9 */
810 select_peripheral(PD(4), PERIPH_A, 0); /* DATA10 */
811 select_peripheral(PD(5), PERIPH_A, 0); /* DATA11 */
812 select_peripheral(PD(6), PERIPH_A, 0); /* DATA12 */
813 select_peripheral(PD(7), PERIPH_A, 0); /* DATA13 */
814 select_peripheral(PD(8), PERIPH_A, 0); /* DATA14 */
815 select_peripheral(PD(9), PERIPH_A, 0); /* DATA15 */
816 select_peripheral(PD(10), PERIPH_A, 0); /* DATA16 */
817 select_peripheral(PD(11), PERIPH_A, 0); /* DATA17 */
818 select_peripheral(PD(12), PERIPH_A, 0); /* DATA18 */
819 select_peripheral(PD(13), PERIPH_A, 0); /* DATA19 */
820 select_peripheral(PD(14), PERIPH_A, 0); /* DATA20 */
821 select_peripheral(PD(15), PERIPH_A, 0); /* DATA21 */
822 select_peripheral(PD(16), PERIPH_A, 0); /* DATA22 */
823 select_peripheral(PD(17), PERIPH_A, 0); /* DATA23 */
825 clk_set_parent(&lcdc0_pixclk, &pll0);
826 clk_set_rate(&lcdc0_pixclk, clk_get_rate(&pll0));
833 memcpy(pdev->dev.platform_data, data,
834 sizeof(struct lcdc_platform_data));
836 platform_device_register(pdev);
840 struct clk *at32_clock_list[] = {
875 unsigned int at32_nr_clocks = ARRAY_SIZE(at32_clock_list);
877 void __init at32_portmux_init(void)
879 at32_init_pio(&pio0_device);
880 at32_init_pio(&pio1_device);
881 at32_init_pio(&pio2_device);
882 at32_init_pio(&pio3_device);
885 void __init at32_clock_init(void)
887 struct at32_sm *sm = &system_manager;
888 u32 cpu_mask = 0, hsb_mask = 0, pba_mask = 0, pbb_mask = 0;
891 if (sm_readl(sm, PM_MCCTRL) & SM_BIT(PLLSEL))
896 if (sm_readl(sm, PM_PLL0) & SM_BIT(PLLOSC))
898 if (sm_readl(sm, PM_PLL1) & SM_BIT(PLLOSC))
902 * Turn on all clocks that have at least one user already, and
903 * turn off everything else. We only do this for module
904 * clocks, and even though it isn't particularly pretty to
905 * check the address of the mode function, it should do the
908 for (i = 0; i < ARRAY_SIZE(at32_clock_list); i++) {
909 struct clk *clk = at32_clock_list[i];
911 if (clk->mode == &cpu_clk_mode)
912 cpu_mask |= 1 << clk->index;
913 else if (clk->mode == &hsb_clk_mode)
914 hsb_mask |= 1 << clk->index;
915 else if (clk->mode == &pba_clk_mode)
916 pba_mask |= 1 << clk->index;
917 else if (clk->mode == &pbb_clk_mode)
918 pbb_mask |= 1 << clk->index;
921 sm_writel(sm, PM_CPU_MASK, cpu_mask);
922 sm_writel(sm, PM_HSB_MASK, hsb_mask);
923 sm_writel(sm, PM_PBA_MASK, pba_mask);
924 sm_writel(sm, PM_PBB_MASK, pbb_mask);