diff options
author | Arnd Bergmann <arnd@arndb.de> | 2012-11-12 15:59:00 -0500 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2012-11-12 15:59:00 -0500 |
commit | 94c78a55b8404396e3b8d9463c1b5c562664c893 (patch) | |
tree | 4fc4371853788170e9e9523807cb8385df3acf40 | |
parent | fd2e1dd7bb2e4f19e063aff9194b795be8510464 (diff) | |
parent | 2944628607f76e4755660cd710f22a4748ef88d8 (diff) |
Merge branches 'depends/asoc', 'renesas/boards', 'renesas/soc' and 'renesas/soc2' into next/boards2
These are all dependencies for the next set of renesas shmobile board
changes.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
-rw-r--r-- | arch/arm/mach-shmobile/board-ap4evb.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/board-mackerel.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/clock-r8a7740.c | 34 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/clock-r8a7779.c | 7 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/clock-sh7372.c | 94 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/include/mach/r8a7779.h | 2 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/include/mach/sh7372.h | 2 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/pfc-r8a7779.c | 16 | ||||
-rw-r--r-- | drivers/sh/clk/cpg.c | 86 | ||||
-rw-r--r-- | include/linux/sh_clk.h | 9 |
10 files changed, 159 insertions, 95 deletions
diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c index 790dc68c4312..cefdd030361d 100644 --- a/arch/arm/mach-shmobile/board-ap4evb.c +++ b/arch/arm/mach-shmobile/board-ap4evb.c | |||
@@ -728,7 +728,7 @@ fsia_ick_out: | |||
728 | static int fsi_hdmi_set_rate(struct device *dev, int rate, int enable) | 728 | static int fsi_hdmi_set_rate(struct device *dev, int rate, int enable) |
729 | { | 729 | { |
730 | struct clk *fsib_clk; | 730 | struct clk *fsib_clk; |
731 | struct clk *fdiv_clk = &sh7372_fsidivb_clk; | 731 | struct clk *fdiv_clk = clk_get(NULL, "fsidivb"); |
732 | long fsib_rate = 0; | 732 | long fsib_rate = 0; |
733 | long fdiv_rate = 0; | 733 | long fdiv_rate = 0; |
734 | int ackmd_bpfmd; | 734 | int ackmd_bpfmd; |
diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c index 39b8f2e70638..f274252e4705 100644 --- a/arch/arm/mach-shmobile/board-mackerel.c +++ b/arch/arm/mach-shmobile/board-mackerel.c | |||
@@ -882,7 +882,7 @@ static int __fsi_set_round_rate(struct clk *clk, long rate, int enable) | |||
882 | static int fsi_b_set_rate(struct device *dev, int rate, int enable) | 882 | static int fsi_b_set_rate(struct device *dev, int rate, int enable) |
883 | { | 883 | { |
884 | struct clk *fsib_clk; | 884 | struct clk *fsib_clk; |
885 | struct clk *fdiv_clk = &sh7372_fsidivb_clk; | 885 | struct clk *fdiv_clk = clk_get(NULL, "fsidivb"); |
886 | long fsib_rate = 0; | 886 | long fsib_rate = 0; |
887 | long fdiv_rate = 0; | 887 | long fdiv_rate = 0; |
888 | int ackmd_bpfmd; | 888 | int ackmd_bpfmd; |
diff --git a/arch/arm/mach-shmobile/clock-r8a7740.c b/arch/arm/mach-shmobile/clock-r8a7740.c index 6729e0032180..eac49d59782f 100644 --- a/arch/arm/mach-shmobile/clock-r8a7740.c +++ b/arch/arm/mach-shmobile/clock-r8a7740.c | |||
@@ -65,6 +65,9 @@ | |||
65 | #define SMSTPCR3 IOMEM(0xe615013c) | 65 | #define SMSTPCR3 IOMEM(0xe615013c) |
66 | #define SMSTPCR4 IOMEM(0xe6150140) | 66 | #define SMSTPCR4 IOMEM(0xe6150140) |
67 | 67 | ||
68 | #define FSIDIVA IOMEM(0xFE1F8000) | ||
69 | #define FSIDIVB IOMEM(0xFE1F8008) | ||
70 | |||
68 | /* Fixed 32 KHz root clock from EXTALR pin */ | 71 | /* Fixed 32 KHz root clock from EXTALR pin */ |
69 | static struct clk extalr_clk = { | 72 | static struct clk extalr_clk = { |
70 | .rate = 32768, | 73 | .rate = 32768, |
@@ -188,6 +191,22 @@ static struct clk pllc1_div2_clk = { | |||
188 | }; | 191 | }; |
189 | 192 | ||
190 | /* USB clock */ | 193 | /* USB clock */ |
194 | /* | ||
195 | * USBCKCR is controlling usb24 clock | ||
196 | * bit[7] : parent clock | ||
197 | * bit[6] : clock divide rate | ||
198 | * And this bit[7] is used as a "usb24s" from other devices. | ||
199 | * (Video clock / Sub clock / SPU clock) | ||
200 | * You can controll this clock as a below. | ||
201 | * | ||
202 | * struct clk *usb24 = clk_get(dev, "usb24"); | ||
203 | * struct clk *usb24s = clk_get(NULL, "usb24s"); | ||
204 | * struct clk *system = clk_get(NULL, "system_clk"); | ||
205 | * int rate = clk_get_rate(system); | ||
206 | * | ||
207 | * clk_set_parent(usb24s, system); // for bit[7] | ||
208 | * clk_set_rate(usb24, rate / 2); // for bit[6] | ||
209 | */ | ||
191 | static struct clk *usb24s_parents[] = { | 210 | static struct clk *usb24s_parents[] = { |
192 | [0] = &system_clk, | 211 | [0] = &system_clk, |
193 | [1] = &extal2_clk | 212 | [1] = &extal2_clk |
@@ -427,6 +446,14 @@ static struct clk *late_main_clks[] = { | |||
427 | &hdmi2_clk, | 446 | &hdmi2_clk, |
428 | }; | 447 | }; |
429 | 448 | ||
449 | /* FSI DIV */ | ||
450 | enum { FSIDIV_A, FSIDIV_B, FSIDIV_REPARENT_NR }; | ||
451 | |||
452 | static struct clk fsidivs[] = { | ||
453 | [FSIDIV_A] = SH_CLK_FSIDIV(FSIDIVA, &div6_reparent_clks[DIV6_FSIA]), | ||
454 | [FSIDIV_B] = SH_CLK_FSIDIV(FSIDIVB, &div6_reparent_clks[DIV6_FSIB]), | ||
455 | }; | ||
456 | |||
430 | /* MSTP */ | 457 | /* MSTP */ |
431 | enum { | 458 | enum { |
432 | DIV4_I, DIV4_ZG, DIV4_B, DIV4_M1, DIV4_HP, | 459 | DIV4_I, DIV4_ZG, DIV4_B, DIV4_M1, DIV4_HP, |
@@ -596,6 +623,10 @@ static struct clk_lookup lookups[] = { | |||
596 | 623 | ||
597 | CLKDEV_ICK_ID("icka", "sh_fsi2", &div6_reparent_clks[DIV6_FSIA]), | 624 | CLKDEV_ICK_ID("icka", "sh_fsi2", &div6_reparent_clks[DIV6_FSIA]), |
598 | CLKDEV_ICK_ID("ickb", "sh_fsi2", &div6_reparent_clks[DIV6_FSIB]), | 625 | CLKDEV_ICK_ID("ickb", "sh_fsi2", &div6_reparent_clks[DIV6_FSIB]), |
626 | CLKDEV_ICK_ID("diva", "sh_fsi2", &fsidivs[FSIDIV_A]), | ||
627 | CLKDEV_ICK_ID("divb", "sh_fsi2", &fsidivs[FSIDIV_B]), | ||
628 | CLKDEV_ICK_ID("xcka", "sh_fsi2", &fsiack_clk), | ||
629 | CLKDEV_ICK_ID("xckb", "sh_fsi2", &fsibck_clk), | ||
599 | }; | 630 | }; |
600 | 631 | ||
601 | void __init r8a7740_clock_init(u8 md_ck) | 632 | void __init r8a7740_clock_init(u8 md_ck) |
@@ -641,6 +672,9 @@ void __init r8a7740_clock_init(u8 md_ck) | |||
641 | for (k = 0; !ret && (k < ARRAY_SIZE(late_main_clks)); k++) | 672 | for (k = 0; !ret && (k < ARRAY_SIZE(late_main_clks)); k++) |
642 | ret = clk_register(late_main_clks[k]); | 673 | ret = clk_register(late_main_clks[k]); |
643 | 674 | ||
675 | if (!ret) | ||
676 | ret = sh_clk_fsidiv_register(fsidivs, FSIDIV_REPARENT_NR); | ||
677 | |||
644 | clkdev_add_table(lookups, ARRAY_SIZE(lookups)); | 678 | clkdev_add_table(lookups, ARRAY_SIZE(lookups)); |
645 | 679 | ||
646 | if (!ret) | 680 | if (!ret) |
diff --git a/arch/arm/mach-shmobile/clock-r8a7779.c b/arch/arm/mach-shmobile/clock-r8a7779.c index e48509b938cf..c019609da660 100644 --- a/arch/arm/mach-shmobile/clock-r8a7779.c +++ b/arch/arm/mach-shmobile/clock-r8a7779.c | |||
@@ -87,6 +87,7 @@ static struct clk div4_clks[DIV4_NR] = { | |||
87 | }; | 87 | }; |
88 | 88 | ||
89 | enum { MSTP323, MSTP322, MSTP321, MSTP320, | 89 | enum { MSTP323, MSTP322, MSTP321, MSTP320, |
90 | MSTP101, MSTP100, | ||
90 | MSTP030, | 91 | MSTP030, |
91 | MSTP029, MSTP028, MSTP027, MSTP026, MSTP025, MSTP024, MSTP023, MSTP022, MSTP021, | 92 | MSTP029, MSTP028, MSTP027, MSTP026, MSTP025, MSTP024, MSTP023, MSTP022, MSTP021, |
92 | MSTP016, MSTP015, MSTP014, | 93 | MSTP016, MSTP015, MSTP014, |
@@ -98,6 +99,8 @@ static struct clk mstp_clks[MSTP_NR] = { | |||
98 | [MSTP322] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR3, 22, 0), /* SDHI1 */ | 99 | [MSTP322] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR3, 22, 0), /* SDHI1 */ |
99 | [MSTP321] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR3, 21, 0), /* SDHI2 */ | 100 | [MSTP321] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR3, 21, 0), /* SDHI2 */ |
100 | [MSTP320] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR3, 20, 0), /* SDHI3 */ | 101 | [MSTP320] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR3, 20, 0), /* SDHI3 */ |
102 | [MSTP101] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR1, 1, 0), /* USB2 */ | ||
103 | [MSTP100] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR1, 0, 0), /* USB0/1 */ | ||
101 | [MSTP030] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR0, 30, 0), /* I2C0 */ | 104 | [MSTP030] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR0, 30, 0), /* I2C0 */ |
102 | [MSTP029] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR0, 29, 0), /* I2C1 */ | 105 | [MSTP029] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR0, 29, 0), /* I2C1 */ |
103 | [MSTP028] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR0, 28, 0), /* I2C2 */ | 106 | [MSTP028] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR0, 28, 0), /* I2C2 */ |
@@ -153,6 +156,10 @@ static struct clk_lookup lookups[] = { | |||
153 | CLKDEV_CON_ID("peripheral_clk", &div4_clks[DIV4_P]), | 156 | CLKDEV_CON_ID("peripheral_clk", &div4_clks[DIV4_P]), |
154 | 157 | ||
155 | /* MSTP32 clocks */ | 158 | /* MSTP32 clocks */ |
159 | CLKDEV_DEV_ID("ehci-platform.1", &mstp_clks[MSTP101]), /* USB EHCI port2 */ | ||
160 | CLKDEV_DEV_ID("ohci-platform.1", &mstp_clks[MSTP101]), /* USB OHCI port2 */ | ||
161 | CLKDEV_DEV_ID("ehci-platform.0", &mstp_clks[MSTP100]), /* USB EHCI port0/1 */ | ||
162 | CLKDEV_DEV_ID("ohci-platform.0", &mstp_clks[MSTP100]), /* USB OHCI port0/1 */ | ||
156 | CLKDEV_DEV_ID("sh_tmu.0", &mstp_clks[MSTP016]), /* TMU00 */ | 163 | CLKDEV_DEV_ID("sh_tmu.0", &mstp_clks[MSTP016]), /* TMU00 */ |
157 | CLKDEV_DEV_ID("sh_tmu.1", &mstp_clks[MSTP016]), /* TMU01 */ | 164 | CLKDEV_DEV_ID("sh_tmu.1", &mstp_clks[MSTP016]), /* TMU01 */ |
158 | CLKDEV_DEV_ID("i2c-rcar.0", &mstp_clks[MSTP030]), /* I2C0 */ | 165 | CLKDEV_DEV_ID("i2c-rcar.0", &mstp_clks[MSTP030]), /* I2C0 */ |
diff --git a/arch/arm/mach-shmobile/clock-sh7372.c b/arch/arm/mach-shmobile/clock-sh7372.c index 430a90ffa120..4d57e342537b 100644 --- a/arch/arm/mach-shmobile/clock-sh7372.c +++ b/arch/arm/mach-shmobile/clock-sh7372.c | |||
@@ -420,87 +420,11 @@ static struct clk div6_reparent_clks[DIV6_REPARENT_NR] = { | |||
420 | }; | 420 | }; |
421 | 421 | ||
422 | /* FSI DIV */ | 422 | /* FSI DIV */ |
423 | static unsigned long fsidiv_recalc(struct clk *clk) | 423 | enum { FSIDIV_A, FSIDIV_B, FSIDIV_REPARENT_NR }; |
424 | { | ||
425 | unsigned long value; | ||
426 | |||
427 | value = __raw_readl(clk->mapping->base); | ||
428 | |||
429 | value >>= 16; | ||
430 | if (value < 2) | ||
431 | return 0; | ||
432 | |||
433 | return clk->parent->rate / value; | ||
434 | } | ||
435 | |||
436 | static long fsidiv_round_rate(struct clk *clk, unsigned long rate) | ||
437 | { | ||
438 | return clk_rate_div_range_round(clk, 2, 0xffff, rate); | ||
439 | } | ||
440 | |||
441 | static void fsidiv_disable(struct clk *clk) | ||
442 | { | ||
443 | __raw_writel(0, clk->mapping->base); | ||
444 | } | ||
445 | |||
446 | static int fsidiv_enable(struct clk *clk) | ||
447 | { | ||
448 | unsigned long value; | ||
449 | |||
450 | value = __raw_readl(clk->mapping->base) >> 16; | ||
451 | if (value < 2) | ||
452 | return -EIO; | ||
453 | |||
454 | __raw_writel((value << 16) | 0x3, clk->mapping->base); | ||
455 | |||
456 | return 0; | ||
457 | } | ||
458 | 424 | ||
459 | static int fsidiv_set_rate(struct clk *clk, unsigned long rate) | 425 | static struct clk fsidivs[] = { |
460 | { | 426 | [FSIDIV_A] = SH_CLK_FSIDIV(FSIDIVA, &div6_reparent_clks[DIV6_FSIA]), |
461 | int idx; | 427 | [FSIDIV_B] = SH_CLK_FSIDIV(FSIDIVB, &div6_reparent_clks[DIV6_FSIB]), |
462 | |||
463 | idx = (clk->parent->rate / rate) & 0xffff; | ||
464 | if (idx < 2) | ||
465 | return -EINVAL; | ||
466 | |||
467 | __raw_writel(idx << 16, clk->mapping->base); | ||
468 | return 0; | ||
469 | } | ||
470 | |||
471 | static struct sh_clk_ops fsidiv_clk_ops = { | ||
472 | .recalc = fsidiv_recalc, | ||
473 | .round_rate = fsidiv_round_rate, | ||
474 | .set_rate = fsidiv_set_rate, | ||
475 | .enable = fsidiv_enable, | ||
476 | .disable = fsidiv_disable, | ||
477 | }; | ||
478 | |||
479 | static struct clk_mapping fsidiva_clk_mapping = { | ||
480 | .phys = FSIDIVA, | ||
481 | .len = 8, | ||
482 | }; | ||
483 | |||
484 | struct clk sh7372_fsidiva_clk = { | ||
485 | .ops = &fsidiv_clk_ops, | ||
486 | .parent = &div6_reparent_clks[DIV6_FSIA], /* late install */ | ||
487 | .mapping = &fsidiva_clk_mapping, | ||
488 | }; | ||
489 | |||
490 | static struct clk_mapping fsidivb_clk_mapping = { | ||
491 | .phys = FSIDIVB, | ||
492 | .len = 8, | ||
493 | }; | ||
494 | |||
495 | struct clk sh7372_fsidivb_clk = { | ||
496 | .ops = &fsidiv_clk_ops, | ||
497 | .parent = &div6_reparent_clks[DIV6_FSIB], /* late install */ | ||
498 | .mapping = &fsidivb_clk_mapping, | ||
499 | }; | ||
500 | |||
501 | static struct clk *late_main_clks[] = { | ||
502 | &sh7372_fsidiva_clk, | ||
503 | &sh7372_fsidivb_clk, | ||
504 | }; | 428 | }; |
505 | 429 | ||
506 | enum { MSTP001, MSTP000, | 430 | enum { MSTP001, MSTP000, |
@@ -583,6 +507,8 @@ static struct clk_lookup lookups[] = { | |||
583 | CLKDEV_CON_ID("pllc1_clk", &pllc1_clk), | 507 | CLKDEV_CON_ID("pllc1_clk", &pllc1_clk), |
584 | CLKDEV_CON_ID("pllc1_div2_clk", &pllc1_div2_clk), | 508 | CLKDEV_CON_ID("pllc1_div2_clk", &pllc1_div2_clk), |
585 | CLKDEV_CON_ID("pllc2_clk", &sh7372_pllc2_clk), | 509 | CLKDEV_CON_ID("pllc2_clk", &sh7372_pllc2_clk), |
510 | CLKDEV_CON_ID("fsidiva", &fsidivs[FSIDIV_A]), | ||
511 | CLKDEV_CON_ID("fsidivb", &fsidivs[FSIDIV_B]), | ||
586 | 512 | ||
587 | /* DIV4 clocks */ | 513 | /* DIV4 clocks */ |
588 | CLKDEV_CON_ID("i_clk", &div4_clks[DIV4_I]), | 514 | CLKDEV_CON_ID("i_clk", &div4_clks[DIV4_I]), |
@@ -678,6 +604,10 @@ static struct clk_lookup lookups[] = { | |||
678 | CLKDEV_ICK_ID("icka", "sh_fsi2", &div6_reparent_clks[DIV6_FSIA]), | 604 | CLKDEV_ICK_ID("icka", "sh_fsi2", &div6_reparent_clks[DIV6_FSIA]), |
679 | CLKDEV_ICK_ID("ickb", "sh_fsi2", &div6_reparent_clks[DIV6_FSIB]), | 605 | CLKDEV_ICK_ID("ickb", "sh_fsi2", &div6_reparent_clks[DIV6_FSIB]), |
680 | CLKDEV_ICK_ID("spu2", "sh_fsi2", &mstp_clks[MSTP223]), | 606 | CLKDEV_ICK_ID("spu2", "sh_fsi2", &mstp_clks[MSTP223]), |
607 | CLKDEV_ICK_ID("diva", "sh_fsi2", &fsidivs[FSIDIV_A]), | ||
608 | CLKDEV_ICK_ID("divb", "sh_fsi2", &fsidivs[FSIDIV_B]), | ||
609 | CLKDEV_ICK_ID("xcka", "sh_fsi2", &sh7372_fsiack_clk), | ||
610 | CLKDEV_ICK_ID("xckb", "sh_fsi2", &sh7372_fsibck_clk), | ||
681 | }; | 611 | }; |
682 | 612 | ||
683 | void __init sh7372_clock_init(void) | 613 | void __init sh7372_clock_init(void) |
@@ -706,8 +636,8 @@ void __init sh7372_clock_init(void) | |||
706 | if (!ret) | 636 | if (!ret) |
707 | ret = sh_clk_mstp_register(mstp_clks, MSTP_NR); | 637 | ret = sh_clk_mstp_register(mstp_clks, MSTP_NR); |
708 | 638 | ||
709 | for (k = 0; !ret && (k < ARRAY_SIZE(late_main_clks)); k++) | 639 | if (!ret) |
710 | ret = clk_register(late_main_clks[k]); | 640 | ret = sh_clk_fsidiv_register(fsidivs, FSIDIV_REPARENT_NR); |
711 | 641 | ||
712 | clkdev_add_table(lookups, ARRAY_SIZE(lookups)); | 642 | clkdev_add_table(lookups, ARRAY_SIZE(lookups)); |
713 | 643 | ||
diff --git a/arch/arm/mach-shmobile/include/mach/r8a7779.h b/arch/arm/mach-shmobile/include/mach/r8a7779.h index 499f52d2a4a1..8ab0cd6ad6b0 100644 --- a/arch/arm/mach-shmobile/include/mach/r8a7779.h +++ b/arch/arm/mach-shmobile/include/mach/r8a7779.h | |||
@@ -71,7 +71,7 @@ enum { | |||
71 | GPIO_FN_A19, | 71 | GPIO_FN_A19, |
72 | 72 | ||
73 | /* IPSR0 */ | 73 | /* IPSR0 */ |
74 | GPIO_FN_PENC2, GPIO_FN_SCK0, GPIO_FN_PWM1, GPIO_FN_PWMFSW0, | 74 | GPIO_FN_USB_PENC2, GPIO_FN_SCK0, GPIO_FN_PWM1, GPIO_FN_PWMFSW0, |
75 | GPIO_FN_SCIF_CLK, GPIO_FN_TCLK0_C, GPIO_FN_BS, GPIO_FN_SD1_DAT2, | 75 | GPIO_FN_SCIF_CLK, GPIO_FN_TCLK0_C, GPIO_FN_BS, GPIO_FN_SD1_DAT2, |
76 | GPIO_FN_MMC0_D2, GPIO_FN_FD2, GPIO_FN_ATADIR0, GPIO_FN_SDSELF, | 76 | GPIO_FN_MMC0_D2, GPIO_FN_FD2, GPIO_FN_ATADIR0, GPIO_FN_SDSELF, |
77 | GPIO_FN_HCTS1, GPIO_FN_TX4_C, GPIO_FN_A0, GPIO_FN_SD1_DAT3, | 77 | GPIO_FN_HCTS1, GPIO_FN_TX4_C, GPIO_FN_A0, GPIO_FN_SD1_DAT3, |
diff --git a/arch/arm/mach-shmobile/include/mach/sh7372.h b/arch/arm/mach-shmobile/include/mach/sh7372.h index d65fbbe84678..26cd1016fad8 100644 --- a/arch/arm/mach-shmobile/include/mach/sh7372.h +++ b/arch/arm/mach-shmobile/include/mach/sh7372.h | |||
@@ -479,8 +479,6 @@ extern struct clk sh7372_dv_clki_div2_clk; | |||
479 | extern struct clk sh7372_pllc2_clk; | 479 | extern struct clk sh7372_pllc2_clk; |
480 | extern struct clk sh7372_fsiack_clk; | 480 | extern struct clk sh7372_fsiack_clk; |
481 | extern struct clk sh7372_fsibck_clk; | 481 | extern struct clk sh7372_fsibck_clk; |
482 | extern struct clk sh7372_fsidiva_clk; | ||
483 | extern struct clk sh7372_fsidivb_clk; | ||
484 | 482 | ||
485 | extern void sh7372_intcs_suspend(void); | 483 | extern void sh7372_intcs_suspend(void); |
486 | extern void sh7372_intcs_resume(void); | 484 | extern void sh7372_intcs_resume(void); |
diff --git a/arch/arm/mach-shmobile/pfc-r8a7779.c b/arch/arm/mach-shmobile/pfc-r8a7779.c index cbc26ba2a0a2..9513234d322b 100644 --- a/arch/arm/mach-shmobile/pfc-r8a7779.c +++ b/arch/arm/mach-shmobile/pfc-r8a7779.c | |||
@@ -140,7 +140,7 @@ enum { | |||
140 | FN_IP7_3_2, FN_IP7_6_4, FN_IP7_9_7, FN_IP7_12_10, | 140 | FN_IP7_3_2, FN_IP7_6_4, FN_IP7_9_7, FN_IP7_12_10, |
141 | FN_IP7_14_13, FN_IP2_7_4, FN_IP2_11_8, FN_IP2_15_12, | 141 | FN_IP7_14_13, FN_IP2_7_4, FN_IP2_11_8, FN_IP2_15_12, |
142 | FN_IP1_28_25, FN_IP2_3_0, FN_IP8_3_0, FN_IP8_7_4, | 142 | FN_IP1_28_25, FN_IP2_3_0, FN_IP8_3_0, FN_IP8_7_4, |
143 | FN_IP8_11_8, FN_IP8_15_12, FN_PENC0, FN_PENC1, | 143 | FN_IP8_11_8, FN_IP8_15_12, FN_USB_PENC0, FN_USB_PENC1, |
144 | FN_IP0_2_0, FN_IP8_17_16, FN_IP8_18, FN_IP8_19, | 144 | FN_IP0_2_0, FN_IP8_17_16, FN_IP8_18, FN_IP8_19, |
145 | 145 | ||
146 | /* GPSR5 */ | 146 | /* GPSR5 */ |
@@ -176,7 +176,7 @@ enum { | |||
176 | FN_A0, FN_SD1_DAT3, FN_MMC0_D3, FN_FD3, | 176 | FN_A0, FN_SD1_DAT3, FN_MMC0_D3, FN_FD3, |
177 | FN_BS, FN_SD1_DAT2, FN_MMC0_D2, FN_FD2, | 177 | FN_BS, FN_SD1_DAT2, FN_MMC0_D2, FN_FD2, |
178 | FN_ATADIR0, FN_SDSELF, FN_HCTS1, FN_TX4_C, | 178 | FN_ATADIR0, FN_SDSELF, FN_HCTS1, FN_TX4_C, |
179 | FN_PENC2, FN_SCK0, FN_PWM1, FN_PWMFSW0, | 179 | FN_USB_PENC2, FN_SCK0, FN_PWM1, FN_PWMFSW0, |
180 | FN_SCIF_CLK, FN_TCLK0_C, | 180 | FN_SCIF_CLK, FN_TCLK0_C, |
181 | 181 | ||
182 | /* IPSR1 */ | 182 | /* IPSR1 */ |
@@ -447,7 +447,7 @@ enum { | |||
447 | A0_MARK, SD1_DAT3_MARK, MMC0_D3_MARK, FD3_MARK, | 447 | A0_MARK, SD1_DAT3_MARK, MMC0_D3_MARK, FD3_MARK, |
448 | BS_MARK, SD1_DAT2_MARK, MMC0_D2_MARK, FD2_MARK, | 448 | BS_MARK, SD1_DAT2_MARK, MMC0_D2_MARK, FD2_MARK, |
449 | ATADIR0_MARK, SDSELF_MARK, HCTS1_MARK, TX4_C_MARK, | 449 | ATADIR0_MARK, SDSELF_MARK, HCTS1_MARK, TX4_C_MARK, |
450 | PENC2_MARK, SCK0_MARK, PWM1_MARK, PWMFSW0_MARK, | 450 | USB_PENC2_MARK, SCK0_MARK, PWM1_MARK, PWMFSW0_MARK, |
451 | SCIF_CLK_MARK, TCLK0_C_MARK, | 451 | SCIF_CLK_MARK, TCLK0_C_MARK, |
452 | 452 | ||
453 | EX_CS0_MARK, RX3_C_IRDA_RX_C_MARK, MMC0_D6_MARK, | 453 | EX_CS0_MARK, RX3_C_IRDA_RX_C_MARK, MMC0_D6_MARK, |
@@ -658,7 +658,7 @@ static pinmux_enum_t pinmux_data[] = { | |||
658 | PINMUX_DATA(A18_MARK, FN_A18), | 658 | PINMUX_DATA(A18_MARK, FN_A18), |
659 | PINMUX_DATA(A19_MARK, FN_A19), | 659 | PINMUX_DATA(A19_MARK, FN_A19), |
660 | 660 | ||
661 | PINMUX_IPSR_DATA(IP0_2_0, PENC2), | 661 | PINMUX_IPSR_DATA(IP0_2_0, USB_PENC2), |
662 | PINMUX_IPSR_MODSEL_DATA(IP0_2_0, SCK0, SEL_SCIF0_0), | 662 | PINMUX_IPSR_MODSEL_DATA(IP0_2_0, SCK0, SEL_SCIF0_0), |
663 | PINMUX_IPSR_DATA(IP0_2_0, PWM1), | 663 | PINMUX_IPSR_DATA(IP0_2_0, PWM1), |
664 | PINMUX_IPSR_MODSEL_DATA(IP0_2_0, PWMFSW0, SEL_PWMFSW_0), | 664 | PINMUX_IPSR_MODSEL_DATA(IP0_2_0, PWMFSW0, SEL_PWMFSW_0), |
@@ -1456,7 +1456,7 @@ static struct pinmux_gpio pinmux_gpios[] = { | |||
1456 | GPIO_FN(A19), | 1456 | GPIO_FN(A19), |
1457 | 1457 | ||
1458 | /* IPSR0 */ | 1458 | /* IPSR0 */ |
1459 | GPIO_FN(PENC2), GPIO_FN(SCK0), GPIO_FN(PWM1), GPIO_FN(PWMFSW0), | 1459 | GPIO_FN(USB_PENC2), GPIO_FN(SCK0), GPIO_FN(PWM1), GPIO_FN(PWMFSW0), |
1460 | GPIO_FN(SCIF_CLK), GPIO_FN(TCLK0_C), GPIO_FN(BS), GPIO_FN(SD1_DAT2), | 1460 | GPIO_FN(SCIF_CLK), GPIO_FN(TCLK0_C), GPIO_FN(BS), GPIO_FN(SD1_DAT2), |
1461 | GPIO_FN(MMC0_D2), GPIO_FN(FD2), GPIO_FN(ATADIR0), GPIO_FN(SDSELF), | 1461 | GPIO_FN(MMC0_D2), GPIO_FN(FD2), GPIO_FN(ATADIR0), GPIO_FN(SDSELF), |
1462 | GPIO_FN(HCTS1), GPIO_FN(TX4_C), GPIO_FN(A0), GPIO_FN(SD1_DAT3), | 1462 | GPIO_FN(HCTS1), GPIO_FN(TX4_C), GPIO_FN(A0), GPIO_FN(SD1_DAT3), |
@@ -1865,8 +1865,8 @@ static struct pinmux_cfg_reg pinmux_config_regs[] = { | |||
1865 | GP_4_30_FN, FN_IP8_18, | 1865 | GP_4_30_FN, FN_IP8_18, |
1866 | GP_4_29_FN, FN_IP8_17_16, | 1866 | GP_4_29_FN, FN_IP8_17_16, |
1867 | GP_4_28_FN, FN_IP0_2_0, | 1867 | GP_4_28_FN, FN_IP0_2_0, |
1868 | GP_4_27_FN, FN_PENC1, | 1868 | GP_4_27_FN, FN_USB_PENC1, |
1869 | GP_4_26_FN, FN_PENC0, | 1869 | GP_4_26_FN, FN_USB_PENC0, |
1870 | GP_4_25_FN, FN_IP8_15_12, | 1870 | GP_4_25_FN, FN_IP8_15_12, |
1871 | GP_4_24_FN, FN_IP8_11_8, | 1871 | GP_4_24_FN, FN_IP8_11_8, |
1872 | GP_4_23_FN, FN_IP8_7_4, | 1872 | GP_4_23_FN, FN_IP8_7_4, |
@@ -1981,7 +1981,7 @@ static struct pinmux_cfg_reg pinmux_config_regs[] = { | |||
1981 | FN_BS, FN_SD1_DAT2, FN_MMC0_D2, FN_FD2, | 1981 | FN_BS, FN_SD1_DAT2, FN_MMC0_D2, FN_FD2, |
1982 | FN_ATADIR0, FN_SDSELF, FN_HCTS1, FN_TX4_C, | 1982 | FN_ATADIR0, FN_SDSELF, FN_HCTS1, FN_TX4_C, |
1983 | /* IP0_2_0 [3] */ | 1983 | /* IP0_2_0 [3] */ |
1984 | FN_PENC2, FN_SCK0, FN_PWM1, FN_PWMFSW0, | 1984 | FN_USB_PENC2, FN_SCK0, FN_PWM1, FN_PWMFSW0, |
1985 | FN_SCIF_CLK, FN_TCLK0_C, 0, 0 } | 1985 | FN_SCIF_CLK, FN_TCLK0_C, 0, 0 } |
1986 | }, | 1986 | }, |
1987 | { PINMUX_CFG_REG_VAR("IPSR1", 0xfffc0024, 32, | 1987 | { PINMUX_CFG_REG_VAR("IPSR1", 0xfffc0024, 32, |
diff --git a/drivers/sh/clk/cpg.c b/drivers/sh/clk/cpg.c index 07e9fb4f8041..b3dc44146ca0 100644 --- a/drivers/sh/clk/cpg.c +++ b/drivers/sh/clk/cpg.c | |||
@@ -361,3 +361,89 @@ int __init sh_clk_div4_reparent_register(struct clk *clks, int nr, | |||
361 | return sh_clk_div_register_ops(clks, nr, table, | 361 | return sh_clk_div_register_ops(clks, nr, table, |
362 | &sh_clk_div4_reparent_clk_ops); | 362 | &sh_clk_div4_reparent_clk_ops); |
363 | } | 363 | } |
364 | |||
365 | /* FSI-DIV */ | ||
366 | static unsigned long fsidiv_recalc(struct clk *clk) | ||
367 | { | ||
368 | u32 value; | ||
369 | |||
370 | value = __raw_readl(clk->mapping->base); | ||
371 | |||
372 | value >>= 16; | ||
373 | if (value < 2) | ||
374 | return clk->parent->rate; | ||
375 | |||
376 | return clk->parent->rate / value; | ||
377 | } | ||
378 | |||
379 | static long fsidiv_round_rate(struct clk *clk, unsigned long rate) | ||
380 | { | ||
381 | return clk_rate_div_range_round(clk, 1, 0xffff, rate); | ||
382 | } | ||
383 | |||
384 | static void fsidiv_disable(struct clk *clk) | ||
385 | { | ||
386 | __raw_writel(0, clk->mapping->base); | ||
387 | } | ||
388 | |||
389 | static int fsidiv_enable(struct clk *clk) | ||
390 | { | ||
391 | u32 value; | ||
392 | |||
393 | value = __raw_readl(clk->mapping->base) >> 16; | ||
394 | if (value < 2) | ||
395 | return 0; | ||
396 | |||
397 | __raw_writel((value << 16) | 0x3, clk->mapping->base); | ||
398 | |||
399 | return 0; | ||
400 | } | ||
401 | |||
402 | static int fsidiv_set_rate(struct clk *clk, unsigned long rate) | ||
403 | { | ||
404 | u32 val; | ||
405 | int idx; | ||
406 | |||
407 | idx = (clk->parent->rate / rate) & 0xffff; | ||
408 | if (idx < 2) | ||
409 | __raw_writel(0, clk->mapping->base); | ||
410 | else | ||
411 | __raw_writel(idx << 16, clk->mapping->base); | ||
412 | |||
413 | return 0; | ||
414 | } | ||
415 | |||
416 | static struct sh_clk_ops fsidiv_clk_ops = { | ||
417 | .recalc = fsidiv_recalc, | ||
418 | .round_rate = fsidiv_round_rate, | ||
419 | .set_rate = fsidiv_set_rate, | ||
420 | .enable = fsidiv_enable, | ||
421 | .disable = fsidiv_disable, | ||
422 | }; | ||
423 | |||
424 | int __init sh_clk_fsidiv_register(struct clk *clks, int nr) | ||
425 | { | ||
426 | struct clk_mapping *map; | ||
427 | int i; | ||
428 | |||
429 | for (i = 0; i < nr; i++) { | ||
430 | |||
431 | map = kzalloc(sizeof(struct clk_mapping), GFP_KERNEL); | ||
432 | if (!map) { | ||
433 | pr_err("%s: unable to alloc memory\n", __func__); | ||
434 | return -ENOMEM; | ||
435 | } | ||
436 | |||
437 | /* clks[i].enable_reg came from SH_CLK_FSIDIV() */ | ||
438 | map->phys = (phys_addr_t)clks[i].enable_reg; | ||
439 | map->len = 8; | ||
440 | |||
441 | clks[i].enable_reg = 0; /* remove .enable_reg */ | ||
442 | clks[i].ops = &fsidiv_clk_ops; | ||
443 | clks[i].mapping = map; | ||
444 | |||
445 | clk_register(&clks[i]); | ||
446 | } | ||
447 | |||
448 | return 0; | ||
449 | } | ||
diff --git a/include/linux/sh_clk.h b/include/linux/sh_clk.h index 50910913b268..60c72395ec6b 100644 --- a/include/linux/sh_clk.h +++ b/include/linux/sh_clk.h | |||
@@ -199,4 +199,13 @@ int sh_clk_div6_reparent_register(struct clk *clks, int nr); | |||
199 | #define CLKDEV_DEV_ID(_id, _clk) { .dev_id = _id, .clk = _clk } | 199 | #define CLKDEV_DEV_ID(_id, _clk) { .dev_id = _id, .clk = _clk } |
200 | #define CLKDEV_ICK_ID(_cid, _did, _clk) { .con_id = _cid, .dev_id = _did, .clk = _clk } | 200 | #define CLKDEV_ICK_ID(_cid, _did, _clk) { .con_id = _cid, .dev_id = _did, .clk = _clk } |
201 | 201 | ||
202 | /* .enable_reg will be updated to .mapping on sh_clk_fsidiv_register() */ | ||
203 | #define SH_CLK_FSIDIV(_reg, _parent) \ | ||
204 | { \ | ||
205 | .enable_reg = (void __iomem *)_reg, \ | ||
206 | .parent = _parent, \ | ||
207 | } | ||
208 | |||
209 | int sh_clk_fsidiv_register(struct clk *clks, int nr); | ||
210 | |||
202 | #endif /* __SH_CLOCK_H */ | 211 | #endif /* __SH_CLOCK_H */ |