aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-shmobile/clock-r8a7740.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-shmobile/clock-r8a7740.c')
-rw-r--r--arch/arm/mach-shmobile/clock-r8a7740.c34
1 files changed, 34 insertions, 0 deletions
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 */
69static struct clk extalr_clk = { 72static 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 */
191static struct clk *usb24s_parents[] = { 210static 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 */
450enum { FSIDIV_A, FSIDIV_B, FSIDIV_REPARENT_NR };
451
452static 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 */
431enum { 458enum {
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
601void __init r8a7740_clock_init(u8 md_ck) 632void __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)