diff options
author | Padmavathi Venna <padma.v@samsung.com> | 2011-11-02 07:04:08 -0400 |
---|---|---|
committer | Kukjin Kim <kgene.kim@samsung.com> | 2011-12-22 20:10:28 -0500 |
commit | ba47917c686b287430bd6e3e019e187666df3e33 (patch) | |
tree | bfcbadbf512feed323a67c502df3ba097258d970 | |
parent | a24d850b9b317b6168a65ff8918c5b0820ca0675 (diff) |
ARM: S3C64XX: Add SPI clkdev support
Registered the SPI bus clocks with clkdev using generic
connection id.
Signed-off-by: Padmavathi Venna <padma.v@samsung.com>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
-rw-r--r-- | arch/arm/mach-s3c64xx/clock.c | 80 |
1 files changed, 49 insertions, 31 deletions
diff --git a/arch/arm/mach-s3c64xx/clock.c b/arch/arm/mach-s3c64xx/clock.c index 415c5406b17c..0187cde3a5dc 100644 --- a/arch/arm/mach-s3c64xx/clock.c +++ b/arch/arm/mach-s3c64xx/clock.c | |||
@@ -184,18 +184,6 @@ static struct clk init_clocks_off[] = { | |||
184 | .enable = s3c64xx_pclk_ctrl, | 184 | .enable = s3c64xx_pclk_ctrl, |
185 | .ctrlbit = S3C_CLKCON_PCLK_SPI1, | 185 | .ctrlbit = S3C_CLKCON_PCLK_SPI1, |
186 | }, { | 186 | }, { |
187 | .name = "spi_48m", | ||
188 | .devname = "s3c64xx-spi.0", | ||
189 | .parent = &clk_48m, | ||
190 | .enable = s3c64xx_sclk_ctrl, | ||
191 | .ctrlbit = S3C_CLKCON_SCLK_SPI0_48, | ||
192 | }, { | ||
193 | .name = "spi_48m", | ||
194 | .devname = "s3c64xx-spi.1", | ||
195 | .parent = &clk_48m, | ||
196 | .enable = s3c64xx_sclk_ctrl, | ||
197 | .ctrlbit = S3C_CLKCON_SCLK_SPI1_48, | ||
198 | }, { | ||
199 | .name = "48m", | 187 | .name = "48m", |
200 | .devname = "s3c-sdhci.0", | 188 | .devname = "s3c-sdhci.0", |
201 | .parent = &clk_48m, | 189 | .parent = &clk_48m, |
@@ -226,6 +214,22 @@ static struct clk init_clocks_off[] = { | |||
226 | }, | 214 | }, |
227 | }; | 215 | }; |
228 | 216 | ||
217 | static struct clk clk_48m_spi0 = { | ||
218 | .name = "spi_48m", | ||
219 | .devname = "s3c64xx-spi.0", | ||
220 | .parent = &clk_48m, | ||
221 | .enable = s3c64xx_sclk_ctrl, | ||
222 | .ctrlbit = S3C_CLKCON_SCLK_SPI0_48, | ||
223 | }; | ||
224 | |||
225 | static struct clk clk_48m_spi1 = { | ||
226 | .name = "spi_48m", | ||
227 | .devname = "s3c64xx-spi.1", | ||
228 | .parent = &clk_48m, | ||
229 | .enable = s3c64xx_sclk_ctrl, | ||
230 | .ctrlbit = S3C_CLKCON_SCLK_SPI1_48, | ||
231 | }; | ||
232 | |||
229 | static struct clk init_clocks[] = { | 233 | static struct clk init_clocks[] = { |
230 | { | 234 | { |
231 | .name = "lcd", | 235 | .name = "lcd", |
@@ -592,25 +596,6 @@ static struct clksrc_clk clksrcs[] = { | |||
592 | .sources = &clkset_uhost, | 596 | .sources = &clkset_uhost, |
593 | }, { | 597 | }, { |
594 | .clk = { | 598 | .clk = { |
595 | .name = "spi-bus", | ||
596 | .devname = "s3c64xx-spi.0", | ||
597 | .ctrlbit = S3C_CLKCON_SCLK_SPI0, | ||
598 | .enable = s3c64xx_sclk_ctrl, | ||
599 | }, | ||
600 | .reg_src = { .reg = S3C_CLK_SRC, .shift = 14, .size = 2 }, | ||
601 | .reg_div = { .reg = S3C_CLK_DIV2, .shift = 0, .size = 4 }, | ||
602 | .sources = &clkset_spi_mmc, | ||
603 | }, { | ||
604 | .clk = { | ||
605 | .name = "spi-bus", | ||
606 | .devname = "s3c64xx-spi.1", | ||
607 | .enable = s3c64xx_sclk_ctrl, | ||
608 | }, | ||
609 | .reg_src = { .reg = S3C_CLK_SRC, .shift = 16, .size = 2 }, | ||
610 | .reg_div = { .reg = S3C_CLK_DIV2, .shift = 4, .size = 4 }, | ||
611 | .sources = &clkset_spi_mmc, | ||
612 | }, { | ||
613 | .clk = { | ||
614 | .name = "audio-bus", | 599 | .name = "audio-bus", |
615 | .devname = "samsung-i2s.0", | 600 | .devname = "samsung-i2s.0", |
616 | .ctrlbit = S3C_CLKCON_SCLK_AUDIO0, | 601 | .ctrlbit = S3C_CLKCON_SCLK_AUDIO0, |
@@ -708,6 +693,30 @@ static struct clksrc_clk clk_sclk_mmc2 = { | |||
708 | .sources = &clkset_spi_mmc, | 693 | .sources = &clkset_spi_mmc, |
709 | }; | 694 | }; |
710 | 695 | ||
696 | static struct clksrc_clk clk_sclk_spi0 = { | ||
697 | .clk = { | ||
698 | .name = "spi-bus", | ||
699 | .devname = "s3c64xx-spi.0", | ||
700 | .ctrlbit = S3C_CLKCON_SCLK_SPI0, | ||
701 | .enable = s3c64xx_sclk_ctrl, | ||
702 | }, | ||
703 | .reg_src = { .reg = S3C_CLK_SRC, .shift = 14, .size = 2 }, | ||
704 | .reg_div = { .reg = S3C_CLK_DIV2, .shift = 0, .size = 4 }, | ||
705 | .sources = &clkset_spi_mmc, | ||
706 | }; | ||
707 | |||
708 | static struct clksrc_clk clk_sclk_spi1 = { | ||
709 | .clk = { | ||
710 | .name = "spi-bus", | ||
711 | .devname = "s3c64xx-spi.1", | ||
712 | .ctrlbit = S3C_CLKCON_SCLK_SPI1, | ||
713 | .enable = s3c64xx_sclk_ctrl, | ||
714 | }, | ||
715 | .reg_src = { .reg = S3C_CLK_SRC, .shift = 16, .size = 2 }, | ||
716 | .reg_div = { .reg = S3C_CLK_DIV2, .shift = 4, .size = 4 }, | ||
717 | .sources = &clkset_spi_mmc, | ||
718 | }; | ||
719 | |||
711 | /* Clock initialisation code */ | 720 | /* Clock initialisation code */ |
712 | 721 | ||
713 | static struct clksrc_clk *init_parents[] = { | 722 | static struct clksrc_clk *init_parents[] = { |
@@ -721,12 +730,16 @@ static struct clksrc_clk *clksrc_cdev[] = { | |||
721 | &clk_sclk_mmc0, | 730 | &clk_sclk_mmc0, |
722 | &clk_sclk_mmc1, | 731 | &clk_sclk_mmc1, |
723 | &clk_sclk_mmc2, | 732 | &clk_sclk_mmc2, |
733 | &clk_sclk_spi0, | ||
734 | &clk_sclk_spi1, | ||
724 | }; | 735 | }; |
725 | 736 | ||
726 | static struct clk *clk_cdev[] = { | 737 | static struct clk *clk_cdev[] = { |
727 | &clk_hsmmc0, | 738 | &clk_hsmmc0, |
728 | &clk_hsmmc1, | 739 | &clk_hsmmc1, |
729 | &clk_hsmmc2, | 740 | &clk_hsmmc2, |
741 | &clk_48m_spi0, | ||
742 | &clk_48m_spi1, | ||
730 | }; | 743 | }; |
731 | 744 | ||
732 | static struct clk_lookup s3c64xx_clk_lookup[] = { | 745 | static struct clk_lookup s3c64xx_clk_lookup[] = { |
@@ -738,6 +751,11 @@ static struct clk_lookup s3c64xx_clk_lookup[] = { | |||
738 | CLKDEV_INIT("s3c-sdhci.0", "mmc_busclk.2", &clk_sclk_mmc0.clk), | 751 | CLKDEV_INIT("s3c-sdhci.0", "mmc_busclk.2", &clk_sclk_mmc0.clk), |
739 | CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.2", &clk_sclk_mmc1.clk), | 752 | CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.2", &clk_sclk_mmc1.clk), |
740 | CLKDEV_INIT("s3c-sdhci.2", "mmc_busclk.2", &clk_sclk_mmc2.clk), | 753 | CLKDEV_INIT("s3c-sdhci.2", "mmc_busclk.2", &clk_sclk_mmc2.clk), |
754 | CLKDEV_INIT(NULL, "spi_busclk0", &clk_p), | ||
755 | CLKDEV_INIT("s3c64xx-spi.0", "spi_busclk1", &clk_sclk_spi0.clk), | ||
756 | CLKDEV_INIT("s3c64xx-spi.0", "spi_busclk2", &clk_48m_spi0), | ||
757 | CLKDEV_INIT("s3c64xx-spi.1", "spi_busclk1", &clk_sclk_spi1.clk), | ||
758 | CLKDEV_INIT("s3c64xx-spi.1", "spi_busclk2", &clk_48m_spi1), | ||
741 | }; | 759 | }; |
742 | 760 | ||
743 | #define GET_DIV(clk, field) ((((clk) & field##_MASK) >> field##_SHIFT) + 1) | 761 | #define GET_DIV(clk, field) ((((clk) & field##_MASK) >> field##_SHIFT) + 1) |