]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
serial: sh-sci: clkdev updates for MSTP gating.
authorPaul Mundt <lethal@linux-sh.org>
Wed, 10 Mar 2010 09:35:14 +0000 (18:35 +0900)
committerPaul Mundt <lethal@linux-sh.org>
Wed, 10 Mar 2010 09:35:14 +0000 (18:35 +0900)
This fixes up some of the I/D/F clock ambiguity in the sh-sci driver.
The interface clock in most cases just wraps back to the peripheral
clock, while the function clock wraps in to the MSTP bits. As the logic
was somewhat inverted, this cleans that up, and also enables all CPUs
with SCI MSTP bits to match function clocks through clkdev lookup.

As a result, this gets rid of the clk string abuse on the sh side, and
the clock string will be killed off once the ARM code has had a chance to
sync up. This also enables MSTP gating on CPUs like 7786 which had never
wired it up before. Impacted CPUs are primarily all SH-Mobiles, SH7785,
and SH7786.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
14 files changed:
arch/sh/kernel/cpu/sh4a/clock-sh7343.c
arch/sh/kernel/cpu/sh4a/clock-sh7366.c
arch/sh/kernel/cpu/sh4a/clock-sh7722.c
arch/sh/kernel/cpu/sh4a/clock-sh7723.c
arch/sh/kernel/cpu/sh4a/clock-sh7724.c
arch/sh/kernel/cpu/sh4a/clock-sh7785.c
arch/sh/kernel/cpu/sh4a/clock-sh7786.c
arch/sh/kernel/cpu/sh4a/setup-sh7343.c
arch/sh/kernel/cpu/sh4a/setup-sh7366.c
arch/sh/kernel/cpu/sh4a/setup-sh7722.c
arch/sh/kernel/cpu/sh4a/setup-sh7723.c
arch/sh/kernel/cpu/sh4a/setup-sh7724.c
arch/sh/kernel/cpu/sh4a/setup-sh7785.c
drivers/serial/sh-sci.c

index 2c16df37eda64bd836baf45dbefb8e26aa7ee269..c541301c7f2b23df4613c47be10be0b510178bdf 100644 (file)
@@ -159,10 +159,10 @@ static struct clk mstp_clks[] = {
        MSTP("rwdt0", &r_clk, MSTPCR0, 13, 0),
        MSTP("mfi0", &div4_clks[DIV4_P], MSTPCR0, 11, 0),
        MSTP("flctl0", &div4_clks[DIV4_P], MSTPCR0, 10, 0),
-       MSTP("scif0", &div4_clks[DIV4_P], MSTPCR0, 7, 0),
-       MSTP("scif1", &div4_clks[DIV4_P], MSTPCR0, 6, 0),
-       MSTP("scif2", &div4_clks[DIV4_P], MSTPCR0, 5, 0),
-       MSTP("scif3", &div4_clks[DIV4_P], MSTPCR0, 4, 0),
+       SH_CLK_MSTP32("sci_fck", 0, &div4_clks[DIV4_P], MSTPCR0, 7, 0),
+       SH_CLK_MSTP32("sci_fck", 1, &div4_clks[DIV4_P], MSTPCR0, 6, 0),
+       SH_CLK_MSTP32("sci_fck", 2, &div4_clks[DIV4_P], MSTPCR0, 5, 0),
+       SH_CLK_MSTP32("sci_fck", 3, &div4_clks[DIV4_P], MSTPCR0, 4, 0),
        MSTP("sio0", &div4_clks[DIV4_P], MSTPCR0, 3, 0),
        MSTP("siof0", &div4_clks[DIV4_P], MSTPCR0, 2, 0),
        MSTP("siof1", &div4_clks[DIV4_P], MSTPCR0, 1, 0),
index 91588d280cd83a1e68d68246ecfcc00dd83ed9fd..e10c64fd80951dbbf4a68107ca8f0aebad2d3092 100644 (file)
@@ -163,9 +163,9 @@ static struct clk mstp_clks[] = {
        MSTP("rwdt0", &r_clk, MSTPCR0, 13, 0),
        MSTP("mfi0", &div4_clks[DIV4_P], MSTPCR0, 11, 0),
        MSTP("flctl0", &div4_clks[DIV4_P], MSTPCR0, 10, 0),
-       MSTP("scif0", &div4_clks[DIV4_P], MSTPCR0, 7, 0),
-       MSTP("scif1", &div4_clks[DIV4_P], MSTPCR0, 6, 0),
-       MSTP("scif2", &div4_clks[DIV4_P], MSTPCR0, 5, 0),
+       SH_CLK_MSTP32("sci_fck", 0, &div4_clks[DIV4_P], MSTPCR0, 7, 0),
+       SH_CLK_MSTP32("sci_fck", 1, &div4_clks[DIV4_P], MSTPCR0, 6, 0),
+       SH_CLK_MSTP32("sci_fck", 2, &div4_clks[DIV4_P], MSTPCR0, 5, 0),
        MSTP("msiof0", &div4_clks[DIV4_P], MSTPCR0, 2, 0),
        MSTP("sbr0", &div4_clks[DIV4_P], MSTPCR0, 1, 0),
 
index 15db6d521c5cb39a0548c72a6d5974f03f6726f4..0732c8bab1e2c762178cbdb3c28636f74cd37f24 100644 (file)
@@ -164,9 +164,9 @@ static struct clk mstp_clks[] = {
        SH_HWBLK_CLK("cmt0", -1, R_CLK, HWBLK_CMT, 0),
        SH_HWBLK_CLK("rwdt0", -1, R_CLK, HWBLK_RWDT, 0),
        SH_HWBLK_CLK("flctl0", -1, P_CLK, HWBLK_FLCTL, 0),
-       SH_HWBLK_CLK("scif0", -1, P_CLK, HWBLK_SCIF0, 0),
-       SH_HWBLK_CLK("scif1", -1, P_CLK, HWBLK_SCIF1, 0),
-       SH_HWBLK_CLK("scif2", -1, P_CLK, HWBLK_SCIF2, 0),
+       SH_HWBLK_CLK("sci_fck", 0, P_CLK, HWBLK_SCIF0, 0),
+       SH_HWBLK_CLK("sci_fck", 1, P_CLK, HWBLK_SCIF1, 0),
+       SH_HWBLK_CLK("sci_fck", 2, P_CLK, HWBLK_SCIF2, 0),
 
        SH_HWBLK_CLK("i2c0", -1, P_CLK, HWBLK_IIC, 0),
        SH_HWBLK_CLK("rtc0", -1, R_CLK, HWBLK_RTC, 0),
index 50babe01fe44eabaee9300652286c0881c883727..4d4c123d02c4626c5e7b4fe94252c62df8367ad7 100644 (file)
@@ -177,12 +177,12 @@ static struct clk mstp_clks[] = {
        SH_HWBLK_CLK("dmac1", -1, B_CLK, HWBLK_DMAC1, 0),
        SH_HWBLK_CLK("tmu1", -1, P_CLK, HWBLK_TMU1, 0),
        SH_HWBLK_CLK("flctl0", -1, P_CLK, HWBLK_FLCTL, 0),
-       SH_HWBLK_CLK("scif0", -1, P_CLK, HWBLK_SCIF0, 0),
-       SH_HWBLK_CLK("scif1", -1, P_CLK, HWBLK_SCIF1, 0),
-       SH_HWBLK_CLK("scif2", -1, P_CLK, HWBLK_SCIF2, 0),
-       SH_HWBLK_CLK("scif3", -1, B_CLK, HWBLK_SCIF3, 0),
-       SH_HWBLK_CLK("scif4", -1, B_CLK, HWBLK_SCIF4, 0),
-       SH_HWBLK_CLK("scif5", -1, B_CLK, HWBLK_SCIF5, 0),
+       SH_HWBLK_CLK("sci_fck", 0, P_CLK, HWBLK_SCIF0, 0),
+       SH_HWBLK_CLK("sci_fck", 1, P_CLK, HWBLK_SCIF1, 0),
+       SH_HWBLK_CLK("sci_fck", 2, P_CLK, HWBLK_SCIF2, 0),
+       SH_HWBLK_CLK("sci_fck", 3, B_CLK, HWBLK_SCIF3, 0),
+       SH_HWBLK_CLK("sci_fck", 4, B_CLK, HWBLK_SCIF4, 0),
+       SH_HWBLK_CLK("sci_fck", 5, B_CLK, HWBLK_SCIF5, 0),
        SH_HWBLK_CLK("msiof0", -1, B_CLK, HWBLK_MSIOF0, 0),
        SH_HWBLK_CLK("msiof1", -1, B_CLK, HWBLK_MSIOF1, 0),
        SH_HWBLK_CLK("meram0", -1, SH_CLK, HWBLK_MERAM, 0),
index 6707061fbf54daa05c21b0d2e52b873028f511ef..bcf2b97db3004fc493ecdfec24fc870e735bcd20 100644 (file)
@@ -194,12 +194,12 @@ static struct clk mstp_clks[] = {
        SH_HWBLK_CLK("rwdt0", -1, R_CLK, HWBLK_RWDT, 0),
        SH_HWBLK_CLK("dmac1", -1, B_CLK, HWBLK_DMAC1, 0),
        SH_HWBLK_CLK("tmu1", -1, P_CLK, HWBLK_TMU1, 0),
-       SH_HWBLK_CLK("scif0", -1, P_CLK, HWBLK_SCIF0, 0),
-       SH_HWBLK_CLK("scif1", -1, P_CLK, HWBLK_SCIF1, 0),
-       SH_HWBLK_CLK("scif2", -1, P_CLK, HWBLK_SCIF2, 0),
-       SH_HWBLK_CLK("scif3", -1, B_CLK, HWBLK_SCIF3, 0),
-       SH_HWBLK_CLK("scif4", -1, B_CLK, HWBLK_SCIF4, 0),
-       SH_HWBLK_CLK("scif5", -1, B_CLK, HWBLK_SCIF5, 0),
+       SH_HWBLK_CLK("sci_fck", 0, P_CLK, HWBLK_SCIF0, 0),
+       SH_HWBLK_CLK("sci_fck", 1, P_CLK, HWBLK_SCIF1, 0),
+       SH_HWBLK_CLK("sci_fck", 2, P_CLK, HWBLK_SCIF2, 0),
+       SH_HWBLK_CLK("sci_fck", 3, B_CLK, HWBLK_SCIF3, 0),
+       SH_HWBLK_CLK("sci_fck", 4, B_CLK, HWBLK_SCIF4, 0),
+       SH_HWBLK_CLK("sci_fck", 5, B_CLK, HWBLK_SCIF5, 0),
        SH_HWBLK_CLK("msiof0", -1, B_CLK, HWBLK_MSIOF0, 0),
        SH_HWBLK_CLK("msiof1", -1, B_CLK, HWBLK_MSIOF1, 0),
 
index d997f0a25b104a519a7854d101fbd06a9472a5e0..6061c736c2819052e73ff1b5fa523ed5ace0e964 100644 (file)
@@ -88,12 +88,12 @@ struct clk div4_clks[DIV4_NR] = {
 
 static struct clk mstp_clks[] = {
        /* MSTPCR0 */
-       SH_CLK_MSTP32("scif_fck", 5, &div4_clks[DIV4_P], MSTPCR0, 29, 0),
-       SH_CLK_MSTP32("scif_fck", 4, &div4_clks[DIV4_P], MSTPCR0, 28, 0),
-       SH_CLK_MSTP32("scif_fck", 3, &div4_clks[DIV4_P], MSTPCR0, 27, 0),
-       SH_CLK_MSTP32("scif_fck", 2, &div4_clks[DIV4_P], MSTPCR0, 26, 0),
-       SH_CLK_MSTP32("scif_fck", 1, &div4_clks[DIV4_P], MSTPCR0, 25, 0),
-       SH_CLK_MSTP32("scif_fck", 0, &div4_clks[DIV4_P], MSTPCR0, 24, 0),
+       SH_CLK_MSTP32("sci_fck", 5, &div4_clks[DIV4_P], MSTPCR0, 29, 0),
+       SH_CLK_MSTP32("sci_fck", 4, &div4_clks[DIV4_P], MSTPCR0, 28, 0),
+       SH_CLK_MSTP32("sci_fck", 3, &div4_clks[DIV4_P], MSTPCR0, 27, 0),
+       SH_CLK_MSTP32("sci_fck", 2, &div4_clks[DIV4_P], MSTPCR0, 26, 0),
+       SH_CLK_MSTP32("sci_fck", 1, &div4_clks[DIV4_P], MSTPCR0, 25, 0),
+       SH_CLK_MSTP32("sci_fck", 0, &div4_clks[DIV4_P], MSTPCR0, 24, 0),
        SH_CLK_MSTP32("ssi_fck", 1, &div4_clks[DIV4_P], MSTPCR0, 21, 0),
        SH_CLK_MSTP32("ssi_fck", 0, &div4_clks[DIV4_P], MSTPCR0, 20, 0),
        SH_CLK_MSTP32("hac_fck", 1, &div4_clks[DIV4_P], MSTPCR0, 17, 0),
index af69fd4687038e5eecd53a5e95c988c600cdc956..85e8d57f497112d6d6aaa399527a8409c018a854 100644 (file)
@@ -87,12 +87,12 @@ struct clk div4_clks[DIV4_NR] = {
 
 static struct clk mstp_clks[] = {
        /* MSTPCR0 */
-       SH_CLK_MSTP32("scif_fck", 5, &div4_clks[DIV4_P], MSTPCR0, 29, 0),
-       SH_CLK_MSTP32("scif_fck", 4, &div4_clks[DIV4_P], MSTPCR0, 28, 0),
-       SH_CLK_MSTP32("scif_fck", 3, &div4_clks[DIV4_P], MSTPCR0, 27, 0),
-       SH_CLK_MSTP32("scif_fck", 2, &div4_clks[DIV4_P], MSTPCR0, 26, 0),
-       SH_CLK_MSTP32("scif_fck", 1, &div4_clks[DIV4_P], MSTPCR0, 25, 0),
-       SH_CLK_MSTP32("scif_fck", 0, &div4_clks[DIV4_P], MSTPCR0, 24, 0),
+       SH_CLK_MSTP32("sci_fck", 5, &div4_clks[DIV4_P], MSTPCR0, 29, 0),
+       SH_CLK_MSTP32("sci_fck", 4, &div4_clks[DIV4_P], MSTPCR0, 28, 0),
+       SH_CLK_MSTP32("sci_fck", 3, &div4_clks[DIV4_P], MSTPCR0, 27, 0),
+       SH_CLK_MSTP32("sci_fck", 2, &div4_clks[DIV4_P], MSTPCR0, 26, 0),
+       SH_CLK_MSTP32("sci_fck", 1, &div4_clks[DIV4_P], MSTPCR0, 25, 0),
+       SH_CLK_MSTP32("sci_fck", 0, &div4_clks[DIV4_P], MSTPCR0, 24, 0),
        SH_CLK_MSTP32("ssi_fck", 3, &div4_clks[DIV4_P], MSTPCR0, 23, 0),
        SH_CLK_MSTP32("ssi_fck", 2, &div4_clks[DIV4_P], MSTPCR0, 22, 0),
        SH_CLK_MSTP32("ssi_fck", 1, &div4_clks[DIV4_P], MSTPCR0, 21, 0),
index fdbd7d07a69fdca4322fe874ef1908e9866f27e3..6f8394942fc58485c05c715643a4a2a662065d36 100644 (file)
@@ -21,7 +21,6 @@ static struct plat_sci_port scif0_platform_data = {
        .flags          = UPF_BOOT_AUTOCONF,
        .type           = PORT_SCIF,
        .irqs           = { 80, 80, 80, 80 },
-       .clk            = "scif0",
 };
 
 static struct platform_device scif0_device = {
@@ -37,7 +36,6 @@ static struct plat_sci_port scif1_platform_data = {
        .flags          = UPF_BOOT_AUTOCONF,
        .type           = PORT_SCIF,
        .irqs           = { 81, 81, 81, 81 },
-       .clk            = "scif1",
 };
 
 static struct platform_device scif1_device = {
@@ -53,7 +51,6 @@ static struct plat_sci_port scif2_platform_data = {
        .flags          = UPF_BOOT_AUTOCONF,
        .type           = PORT_SCIF,
        .irqs           = { 82, 82, 82, 82 },
-       .clk            = "scif2",
 };
 
 static struct platform_device scif2_device = {
@@ -69,7 +66,6 @@ static struct plat_sci_port scif3_platform_data = {
        .flags          = UPF_BOOT_AUTOCONF,
        .type           = PORT_SCIF,
        .irqs           = { 83, 83, 83, 83 },
-       .clk            = "scif3",
 };
 
 static struct platform_device scif3_device = {
index d90fe0a65c2a5874698dc06b8cd407cda4c59206..1d897ed256b031d2bd9876bfb1b904cba3662d71 100644 (file)
@@ -23,7 +23,6 @@ static struct plat_sci_port scif0_platform_data = {
        .flags          = UPF_BOOT_AUTOCONF,
        .type           = PORT_SCIF,
        .irqs           = { 80, 80, 80, 80 },
-       .clk            = "scif0",
 };
 
 static struct platform_device scif0_device = {
index 83ae9ad19874cdcbf09430ccde9d8cdd59a9e8f4..847a27619af5ae0f683ba6bc78b9c33a484fd5a7 100644 (file)
@@ -174,7 +174,6 @@ static struct plat_sci_port scif0_platform_data = {
        .flags          = UPF_BOOT_AUTOCONF,
        .type           = PORT_SCIF,
        .irqs           = { 80, 80, 80, 80 },
-       .clk            = "scif0",
 };
 
 static struct platform_device scif0_device = {
@@ -190,7 +189,6 @@ static struct plat_sci_port scif1_platform_data = {
        .flags          = UPF_BOOT_AUTOCONF,
        .type           = PORT_SCIF,
        .irqs           = { 81, 81, 81, 81 },
-       .clk            = "scif1",
 };
 
 static struct platform_device scif1_device = {
@@ -206,7 +204,6 @@ static struct plat_sci_port scif2_platform_data = {
        .flags          = UPF_BOOT_AUTOCONF,
        .type           = PORT_SCIF,
        .irqs           = { 82, 82, 82, 82 },
-       .clk            = "scif2",
 };
 
 static struct platform_device scif2_device = {
index 68446b3f06af02a29e8026fb8545cd0d4a3b4d7f..187462b51be040c4e35af72a1dd234dc53204e10 100644 (file)
@@ -26,7 +26,6 @@ static struct plat_sci_port scif0_platform_data = {
        .flags          = UPF_BOOT_AUTOCONF,
        .type           = PORT_SCIF,
        .irqs           = { 80, 80, 80, 80 },
-       .clk            = "scif0",
 };
 
 static struct platform_device scif0_device = {
@@ -42,7 +41,6 @@ static struct plat_sci_port scif1_platform_data = {
        .flags          = UPF_BOOT_AUTOCONF,
        .type           = PORT_SCIF,
        .irqs           = { 81, 81, 81, 81 },
-       .clk            = "scif1",
 };
 
 static struct platform_device scif1_device = {
@@ -58,7 +56,6 @@ static struct plat_sci_port scif2_platform_data = {
        .flags          = UPF_BOOT_AUTOCONF,
        .type           = PORT_SCIF,
        .irqs           = { 82, 82, 82, 82 },
-       .clk            = "scif2",
 };
 
 static struct platform_device scif2_device = {
@@ -74,7 +71,6 @@ static struct plat_sci_port scif3_platform_data = {
        .flags          = UPF_BOOT_AUTOCONF,
        .type           = PORT_SCIFA,
        .irqs           = { 56, 56, 56, 56 },
-       .clk            = "scif3",
 };
 
 static struct platform_device scif3_device = {
@@ -90,7 +86,6 @@ static struct plat_sci_port scif4_platform_data = {
        .flags          = UPF_BOOT_AUTOCONF,
        .type           = PORT_SCIFA,
        .irqs           = { 88, 88, 88, 88 },
-       .clk            = "scif4",
 };
 
 static struct platform_device scif4_device = {
@@ -106,7 +101,6 @@ static struct plat_sci_port scif5_platform_data = {
        .flags          = UPF_BOOT_AUTOCONF,
        .type           = PORT_SCIFA,
        .irqs           = { 109, 109, 109, 109 },
-       .clk            = "scif5",
 };
 
 static struct platform_device scif5_device = {
index abc98b0fef913ac2adbdd9d10a674b277d9029c1..ee978900319392e9fa2fc96d2df0420116e5548b 100644 (file)
@@ -213,7 +213,6 @@ static struct plat_sci_port scif0_platform_data = {
        .flags          = UPF_BOOT_AUTOCONF,
        .type           = PORT_SCIF,
        .irqs           = { 80, 80, 80, 80 },
-       .clk            = "scif0",
 };
 
 static struct platform_device scif0_device = {
@@ -229,7 +228,6 @@ static struct plat_sci_port scif1_platform_data = {
        .flags          = UPF_BOOT_AUTOCONF,
        .type           = PORT_SCIF,
        .irqs           = { 81, 81, 81, 81 },
-       .clk            = "scif1",
 };
 
 static struct platform_device scif1_device = {
@@ -245,7 +243,6 @@ static struct plat_sci_port scif2_platform_data = {
        .flags          = UPF_BOOT_AUTOCONF,
        .type           = PORT_SCIF,
        .irqs           = { 82, 82, 82, 82 },
-       .clk            = "scif2",
 };
 
 static struct platform_device scif2_device = {
@@ -261,7 +258,6 @@ static struct plat_sci_port scif3_platform_data = {
        .flags          = UPF_BOOT_AUTOCONF,
        .type           = PORT_SCIFA,
        .irqs           = { 56, 56, 56, 56 },
-       .clk            = "scif3",
 };
 
 static struct platform_device scif3_device = {
@@ -277,7 +273,6 @@ static struct plat_sci_port scif4_platform_data = {
        .flags          = UPF_BOOT_AUTOCONF,
        .type           = PORT_SCIFA,
        .irqs           = { 88, 88, 88, 88 },
-       .clk            = "scif4",
 };
 
 static struct platform_device scif4_device = {
@@ -293,7 +288,6 @@ static struct plat_sci_port scif5_platform_data = {
        .flags          = UPF_BOOT_AUTOCONF,
        .type           = PORT_SCIFA,
        .irqs           = { 109, 109, 109, 109 },
-       .clk            = "scif5",
 };
 
 static struct platform_device scif5_device = {
index 05e9308505cf95c39453cf3cda6d2bfe0f79f683..76afe571f3a27a6408fd52d1f07c5dec300cc5d4 100644 (file)
@@ -25,7 +25,6 @@ static struct plat_sci_port scif0_platform_data = {
        .flags          = UPF_BOOT_AUTOCONF,
        .type           = PORT_SCIF,
        .irqs           = { 40, 40, 40, 40 },
-       .clk            = "scif_fck",
 };
 
 static struct platform_device scif0_device = {
@@ -41,7 +40,6 @@ static struct plat_sci_port scif1_platform_data = {
        .flags          = UPF_BOOT_AUTOCONF,
        .type           = PORT_SCIF,
        .irqs           = { 44, 44, 44, 44 },
-       .clk            = "scif_fck",
 };
 
 static struct platform_device scif1_device = {
@@ -57,7 +55,6 @@ static struct plat_sci_port scif2_platform_data = {
        .flags          = UPF_BOOT_AUTOCONF,
        .type           = PORT_SCIF,
        .irqs           = { 60, 60, 60, 60 },
-       .clk            = "scif_fck",
 };
 
 static struct platform_device scif2_device = {
@@ -73,7 +70,6 @@ static struct plat_sci_port scif3_platform_data = {
        .flags          = UPF_BOOT_AUTOCONF,
        .type           = PORT_SCIF,
        .irqs           = { 61, 61, 61, 61 },
-       .clk            = "scif_fck",
 };
 
 static struct platform_device scif3_device = {
@@ -89,7 +85,6 @@ static struct plat_sci_port scif4_platform_data = {
        .flags          = UPF_BOOT_AUTOCONF,
        .type           = PORT_SCIF,
        .irqs           = { 62, 62, 62, 62 },
-       .clk            = "scif_fck",
 };
 
 static struct platform_device scif4_device = {
@@ -105,7 +100,6 @@ static struct plat_sci_port scif5_platform_data = {
        .flags          = UPF_BOOT_AUTOCONF,
        .type           = PORT_SCIF,
        .irqs           = { 63, 63, 63, 63 },
-       .clk            = "scif_fck",
 };
 
 static struct platform_device scif5_device = {
index 980f39449ee5635ccb7b4f681151892e92a493b0..054a8427c739c519472e60c25f8076d94728bab4 100644 (file)
@@ -83,8 +83,8 @@ struct sci_port {
 
        /* Interface clock */
        struct clk              *iclk;
-       /* Data clock */
-       struct clk              *dclk;
+       /* Function clock */
+       struct clk              *fclk;
 
        struct list_head        node;
        struct dma_chan                 *chan_tx;
@@ -803,7 +803,7 @@ static int sci_notifier(struct notifier_block *self,
            (phase == CPUFREQ_RESUMECHANGE)) {
                spin_lock_irqsave(&priv->lock, flags);
                list_for_each_entry(sci_port, &priv->ports, node)
-                       sci_port->port.uartclk = clk_get_rate(sci_port->dclk);
+                       sci_port->port.uartclk = clk_get_rate(sci_port->iclk);
                spin_unlock_irqrestore(&priv->lock, flags);
        }
 
@@ -814,21 +814,17 @@ static void sci_clk_enable(struct uart_port *port)
 {
        struct sci_port *sci_port = to_sci_port(port);
 
-       clk_enable(sci_port->dclk);
-       sci_port->port.uartclk = clk_get_rate(sci_port->dclk);
-
-       if (sci_port->iclk)
-               clk_enable(sci_port->iclk);
+       clk_enable(sci_port->iclk);
+       sci_port->port.uartclk = clk_get_rate(sci_port->iclk);
+       clk_enable(sci_port->fclk);
 }
 
 static void sci_clk_disable(struct uart_port *port)
 {
        struct sci_port *sci_port = to_sci_port(port);
 
-       if (sci_port->iclk)
-               clk_disable(sci_port->iclk);
-
-       clk_disable(sci_port->dclk);
+       clk_disable(sci_port->fclk);
+       clk_disable(sci_port->iclk);
 }
 
 static int sci_request_irq(struct sci_port *port)
@@ -1557,10 +1553,10 @@ static struct uart_ops sci_uart_ops = {
 #endif
 };
 
-static void __devinit sci_init_single(struct platform_device *dev,
-                                     struct sci_port *sci_port,
-                                     unsigned int index,
-                                     struct plat_sci_port *p)
+static int __devinit sci_init_single(struct platform_device *dev,
+                                    struct sci_port *sci_port,
+                                    unsigned int index,
+                                    struct plat_sci_port *p)
 {
        struct uart_port *port = &sci_port->port;
 
@@ -1581,8 +1577,23 @@ static void __devinit sci_init_single(struct platform_device *dev,
        }
 
        if (dev) {
-               sci_port->iclk = p->clk ? clk_get(&dev->dev, p->clk) : NULL;
-               sci_port->dclk = clk_get(&dev->dev, "peripheral_clk");
+               sci_port->iclk = clk_get(&dev->dev, "sci_ick");
+               if (IS_ERR(sci_port->iclk)) {
+                       sci_port->iclk = clk_get(&dev->dev, "peripheral_clk");
+                       if (IS_ERR(sci_port->iclk)) {
+                               dev_err(&dev->dev, "can't get iclk\n");
+                               return PTR_ERR(sci_port->iclk);
+                       }
+               }
+
+               /*
+                * The function clock is optional, ignore it if we can't
+                * find it.
+                */
+               sci_port->fclk = clk_get(&dev->dev, "sci_fck");
+               if (IS_ERR(sci_port->fclk))
+                       sci_port->fclk = NULL;
+
                sci_port->enable = sci_clk_enable;
                sci_port->disable = sci_clk_disable;
                port->dev = &dev->dev;
@@ -1609,6 +1620,7 @@ static void __devinit sci_init_single(struct platform_device *dev,
 #endif
 
        memcpy(&sci_port->irqs, &p->irqs, sizeof(p->irqs));
+       return 0;
 }
 
 #ifdef CONFIG_SERIAL_SH_SCI_CONSOLE
@@ -1758,8 +1770,11 @@ static int sci_remove(struct platform_device *dev)
        cpufreq_unregister_notifier(&priv->clk_nb, CPUFREQ_TRANSITION_NOTIFIER);
 
        spin_lock_irqsave(&priv->lock, flags);
-       list_for_each_entry(p, &priv->ports, node)
+       list_for_each_entry(p, &priv->ports, node) {
                uart_remove_one_port(&sci_uart_driver, &p->port);
+               clk_put(p->iclk);
+               clk_put(p->fclk);
+       }
        spin_unlock_irqrestore(&priv->lock, flags);
 
        kfree(priv);
@@ -1785,7 +1800,9 @@ static int __devinit sci_probe_single(struct platform_device *dev,
                return 0;
        }
 
-       sci_init_single(dev, sciport, index, p);
+       ret = sci_init_single(dev, sciport, index, p);
+       if (ret)
+               return ret;
 
        ret = uart_add_one_port(&sci_uart_driver, &sciport->port);
        if (ret)