diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-09 17:30:28 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-09 17:30:28 -0500 |
commit | 190a44e65b0f32eaf5b4db3969f5eb224f83a7a2 (patch) | |
tree | 577c9a3949ba06e62d082eb11894b7045ebe3ef3 /arch/arm/mach-s3c64xx | |
parent | dfc1ebe76663d582a01c9dc572395cf8086d01de (diff) | |
parent | b48741cce3be32a48af9a2b272f3f13a077375cf (diff) |
Merge tag 'cleanup2' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Cleanups for the Samsung platforms
Various cleanup changes that the device driver changes are built upon.
Since the samsung cleanups depend on the device tree series, which
depends on the first set of cleanups for tegra.
* tag 'cleanup2' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc:
ARM: EXYNOS: Use gpio_request_one
ARM: S5PV210: Use gpio_request_one
ARM: S3C64XX: Modified according to SPI consolidation work
ARM: S5PV210: Modified files for SPI consolidation work
ARM: S5P64X0: Modified files for SPI consolidation work
ARM: S5PC100: Modified files for SPI consolidation work
ARM: S3C64XX: Modified files for SPI consolidation work
ARM: SAMSUNG: Consolidation of SPI platform devices to plat-samsung
ARM: SAMSUNG: Remove SPI bus clocks from platform data
ARM: S5PV210: Add SPI clkdev support
ARM: S5P64X0: Add SPI clkdev support
ARM: S5PC100: Add SPI clkdev support
ARM: S3C64XX: Add SPI clkdev support
spi/s3c64xx: Use bus clocks created using clkdev
mmc: sdhci-s3c: Use generic clock names for sdhci bus clock options
ARM: SAMSUNG: Add lookup of sdhci-s3c clocks using generic names
ARM: SAMSUNG: Remove SDHCI bus clocks from platform data
ARM: SAMSUNG: Use kmemdup rather than duplicating its implementation
ARM: EXYNOS: remove exynos4_scu_enable()
Diffstat (limited to 'arch/arm/mach-s3c64xx')
-rw-r--r-- | arch/arm/mach-s3c64xx/Kconfig | 8 | ||||
-rw-r--r-- | arch/arm/mach-s3c64xx/Makefile | 2 | ||||
-rw-r--r-- | arch/arm/mach-s3c64xx/clock.c | 206 | ||||
-rw-r--r-- | arch/arm/mach-s3c64xx/dev-spi.c | 180 | ||||
-rw-r--r-- | arch/arm/mach-s3c64xx/include/mach/map.h | 2 | ||||
-rw-r--r-- | arch/arm/mach-s3c64xx/setup-sdhci.c | 24 | ||||
-rw-r--r-- | arch/arm/mach-s3c64xx/setup-spi.c | 45 |
7 files changed, 182 insertions, 285 deletions
diff --git a/arch/arm/mach-s3c64xx/Kconfig b/arch/arm/mach-s3c64xx/Kconfig index 381586c7b1b2..e42e26d7fd38 100644 --- a/arch/arm/mach-s3c64xx/Kconfig +++ b/arch/arm/mach-s3c64xx/Kconfig | |||
@@ -78,6 +78,11 @@ config S3C64XX_SETUP_SDHCI_GPIO | |||
78 | help | 78 | help |
79 | Common setup code for S3C64XX SDHCI GPIO configurations | 79 | Common setup code for S3C64XX SDHCI GPIO configurations |
80 | 80 | ||
81 | config S3C64XX_SETUP_SPI | ||
82 | bool | ||
83 | help | ||
84 | Common setup code for SPI GPIO configurations | ||
85 | |||
81 | # S36400 Macchine support | 86 | # S36400 Macchine support |
82 | 87 | ||
83 | config MACH_SMDK6400 | 88 | config MACH_SMDK6400 |
@@ -277,6 +282,7 @@ config MACH_WLF_CRAGG_6410 | |||
277 | select S3C64XX_SETUP_IDE | 282 | select S3C64XX_SETUP_IDE |
278 | select S3C64XX_SETUP_FB_24BPP | 283 | select S3C64XX_SETUP_FB_24BPP |
279 | select S3C64XX_SETUP_KEYPAD | 284 | select S3C64XX_SETUP_KEYPAD |
285 | select S3C64XX_SETUP_SPI | ||
280 | select SAMSUNG_DEV_ADC | 286 | select SAMSUNG_DEV_ADC |
281 | select SAMSUNG_DEV_KEYPAD | 287 | select SAMSUNG_DEV_KEYPAD |
282 | select S3C_DEV_USB_HOST | 288 | select S3C_DEV_USB_HOST |
@@ -287,7 +293,7 @@ config MACH_WLF_CRAGG_6410 | |||
287 | select S3C_DEV_I2C1 | 293 | select S3C_DEV_I2C1 |
288 | select S3C_DEV_WDT | 294 | select S3C_DEV_WDT |
289 | select S3C_DEV_RTC | 295 | select S3C_DEV_RTC |
290 | select S3C64XX_DEV_SPI | 296 | select S3C64XX_DEV_SPI0 |
291 | select S3C24XX_GPIO_EXTRA128 | 297 | select S3C24XX_GPIO_EXTRA128 |
292 | select I2C | 298 | select I2C |
293 | help | 299 | help |
diff --git a/arch/arm/mach-s3c64xx/Makefile b/arch/arm/mach-s3c64xx/Makefile index f37016cebbe3..1822ac2eba31 100644 --- a/arch/arm/mach-s3c64xx/Makefile +++ b/arch/arm/mach-s3c64xx/Makefile | |||
@@ -40,8 +40,8 @@ obj-$(CONFIG_S3C64XX_SETUP_I2C0) += setup-i2c0.o | |||
40 | obj-$(CONFIG_S3C64XX_SETUP_I2C1) += setup-i2c1.o | 40 | obj-$(CONFIG_S3C64XX_SETUP_I2C1) += setup-i2c1.o |
41 | obj-$(CONFIG_S3C64XX_SETUP_IDE) += setup-ide.o | 41 | obj-$(CONFIG_S3C64XX_SETUP_IDE) += setup-ide.o |
42 | obj-$(CONFIG_S3C64XX_SETUP_KEYPAD) += setup-keypad.o | 42 | obj-$(CONFIG_S3C64XX_SETUP_KEYPAD) += setup-keypad.o |
43 | obj-$(CONFIG_S3C64XX_SETUP_SDHCI) += setup-sdhci.o | ||
44 | obj-$(CONFIG_S3C64XX_SETUP_SDHCI_GPIO) += setup-sdhci-gpio.o | 43 | obj-$(CONFIG_S3C64XX_SETUP_SDHCI_GPIO) += setup-sdhci-gpio.o |
44 | obj-$(CONFIG_S3C64XX_SETUP_SPI) += setup-spi.o | ||
45 | 45 | ||
46 | # Machine support | 46 | # Machine support |
47 | 47 | ||
diff --git a/arch/arm/mach-s3c64xx/clock.c b/arch/arm/mach-s3c64xx/clock.c index a3aafb6768c9..31bb27dc4aeb 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", |
@@ -243,24 +247,6 @@ static struct clk init_clocks[] = { | |||
243 | .enable = s3c64xx_hclk_ctrl, | 247 | .enable = s3c64xx_hclk_ctrl, |
244 | .ctrlbit = S3C_CLKCON_HCLK_UHOST, | 248 | .ctrlbit = S3C_CLKCON_HCLK_UHOST, |
245 | }, { | 249 | }, { |
246 | .name = "hsmmc", | ||
247 | .devname = "s3c-sdhci.0", | ||
248 | .parent = &clk_h, | ||
249 | .enable = s3c64xx_hclk_ctrl, | ||
250 | .ctrlbit = S3C_CLKCON_HCLK_HSMMC0, | ||
251 | }, { | ||
252 | .name = "hsmmc", | ||
253 | .devname = "s3c-sdhci.1", | ||
254 | .parent = &clk_h, | ||
255 | .enable = s3c64xx_hclk_ctrl, | ||
256 | .ctrlbit = S3C_CLKCON_HCLK_HSMMC1, | ||
257 | }, { | ||
258 | .name = "hsmmc", | ||
259 | .devname = "s3c-sdhci.2", | ||
260 | .parent = &clk_h, | ||
261 | .enable = s3c64xx_hclk_ctrl, | ||
262 | .ctrlbit = S3C_CLKCON_HCLK_HSMMC2, | ||
263 | }, { | ||
264 | .name = "otg", | 250 | .name = "otg", |
265 | .parent = &clk_h, | 251 | .parent = &clk_h, |
266 | .enable = s3c64xx_hclk_ctrl, | 252 | .enable = s3c64xx_hclk_ctrl, |
@@ -310,6 +296,29 @@ static struct clk init_clocks[] = { | |||
310 | } | 296 | } |
311 | }; | 297 | }; |
312 | 298 | ||
299 | static struct clk clk_hsmmc0 = { | ||
300 | .name = "hsmmc", | ||
301 | .devname = "s3c-sdhci.0", | ||
302 | .parent = &clk_h, | ||
303 | .enable = s3c64xx_hclk_ctrl, | ||
304 | .ctrlbit = S3C_CLKCON_HCLK_HSMMC0, | ||
305 | }; | ||
306 | |||
307 | static struct clk clk_hsmmc1 = { | ||
308 | .name = "hsmmc", | ||
309 | .devname = "s3c-sdhci.1", | ||
310 | .parent = &clk_h, | ||
311 | .enable = s3c64xx_hclk_ctrl, | ||
312 | .ctrlbit = S3C_CLKCON_HCLK_HSMMC1, | ||
313 | }; | ||
314 | |||
315 | static struct clk clk_hsmmc2 = { | ||
316 | .name = "hsmmc", | ||
317 | .devname = "s3c-sdhci.2", | ||
318 | .parent = &clk_h, | ||
319 | .enable = s3c64xx_hclk_ctrl, | ||
320 | .ctrlbit = S3C_CLKCON_HCLK_HSMMC2, | ||
321 | }; | ||
313 | 322 | ||
314 | static struct clk clk_fout_apll = { | 323 | static struct clk clk_fout_apll = { |
315 | .name = "fout_apll", | 324 | .name = "fout_apll", |
@@ -578,36 +587,6 @@ static struct clksrc_sources clkset_camif = { | |||
578 | static struct clksrc_clk clksrcs[] = { | 587 | static struct clksrc_clk clksrcs[] = { |
579 | { | 588 | { |
580 | .clk = { | 589 | .clk = { |
581 | .name = "mmc_bus", | ||
582 | .devname = "s3c-sdhci.0", | ||
583 | .ctrlbit = S3C_CLKCON_SCLK_MMC0, | ||
584 | .enable = s3c64xx_sclk_ctrl, | ||
585 | }, | ||
586 | .reg_src = { .reg = S3C_CLK_SRC, .shift = 18, .size = 2 }, | ||
587 | .reg_div = { .reg = S3C_CLK_DIV1, .shift = 0, .size = 4 }, | ||
588 | .sources = &clkset_spi_mmc, | ||
589 | }, { | ||
590 | .clk = { | ||
591 | .name = "mmc_bus", | ||
592 | .devname = "s3c-sdhci.1", | ||
593 | .ctrlbit = S3C_CLKCON_SCLK_MMC1, | ||
594 | .enable = s3c64xx_sclk_ctrl, | ||
595 | }, | ||
596 | .reg_src = { .reg = S3C_CLK_SRC, .shift = 20, .size = 2 }, | ||
597 | .reg_div = { .reg = S3C_CLK_DIV1, .shift = 4, .size = 4 }, | ||
598 | .sources = &clkset_spi_mmc, | ||
599 | }, { | ||
600 | .clk = { | ||
601 | .name = "mmc_bus", | ||
602 | .devname = "s3c-sdhci.2", | ||
603 | .ctrlbit = S3C_CLKCON_SCLK_MMC2, | ||
604 | .enable = s3c64xx_sclk_ctrl, | ||
605 | }, | ||
606 | .reg_src = { .reg = S3C_CLK_SRC, .shift = 22, .size = 2 }, | ||
607 | .reg_div = { .reg = S3C_CLK_DIV1, .shift = 8, .size = 4 }, | ||
608 | .sources = &clkset_spi_mmc, | ||
609 | }, { | ||
610 | .clk = { | ||
611 | .name = "usb-bus-host", | 590 | .name = "usb-bus-host", |
612 | .ctrlbit = S3C_CLKCON_SCLK_UHOST, | 591 | .ctrlbit = S3C_CLKCON_SCLK_UHOST, |
613 | .enable = s3c64xx_sclk_ctrl, | 592 | .enable = s3c64xx_sclk_ctrl, |
@@ -617,25 +596,6 @@ static struct clksrc_clk clksrcs[] = { | |||
617 | .sources = &clkset_uhost, | 596 | .sources = &clkset_uhost, |
618 | }, { | 597 | }, { |
619 | .clk = { | 598 | .clk = { |
620 | .name = "spi-bus", | ||
621 | .devname = "s3c64xx-spi.0", | ||
622 | .ctrlbit = S3C_CLKCON_SCLK_SPI0, | ||
623 | .enable = s3c64xx_sclk_ctrl, | ||
624 | }, | ||
625 | .reg_src = { .reg = S3C_CLK_SRC, .shift = 14, .size = 2 }, | ||
626 | .reg_div = { .reg = S3C_CLK_DIV2, .shift = 0, .size = 4 }, | ||
627 | .sources = &clkset_spi_mmc, | ||
628 | }, { | ||
629 | .clk = { | ||
630 | .name = "spi-bus", | ||
631 | .devname = "s3c64xx-spi.1", | ||
632 | .enable = s3c64xx_sclk_ctrl, | ||
633 | }, | ||
634 | .reg_src = { .reg = S3C_CLK_SRC, .shift = 16, .size = 2 }, | ||
635 | .reg_div = { .reg = S3C_CLK_DIV2, .shift = 4, .size = 4 }, | ||
636 | .sources = &clkset_spi_mmc, | ||
637 | }, { | ||
638 | .clk = { | ||
639 | .name = "audio-bus", | 599 | .name = "audio-bus", |
640 | .devname = "samsung-i2s.0", | 600 | .devname = "samsung-i2s.0", |
641 | .ctrlbit = S3C_CLKCON_SCLK_AUDIO0, | 601 | .ctrlbit = S3C_CLKCON_SCLK_AUDIO0, |
@@ -697,6 +657,66 @@ static struct clksrc_clk clk_sclk_uclk = { | |||
697 | .sources = &clkset_uart, | 657 | .sources = &clkset_uart, |
698 | }; | 658 | }; |
699 | 659 | ||
660 | static struct clksrc_clk clk_sclk_mmc0 = { | ||
661 | .clk = { | ||
662 | .name = "mmc_bus", | ||
663 | .devname = "s3c-sdhci.0", | ||
664 | .ctrlbit = S3C_CLKCON_SCLK_MMC0, | ||
665 | .enable = s3c64xx_sclk_ctrl, | ||
666 | }, | ||
667 | .reg_src = { .reg = S3C_CLK_SRC, .shift = 18, .size = 2 }, | ||
668 | .reg_div = { .reg = S3C_CLK_DIV1, .shift = 0, .size = 4 }, | ||
669 | .sources = &clkset_spi_mmc, | ||
670 | }; | ||
671 | |||
672 | static struct clksrc_clk clk_sclk_mmc1 = { | ||
673 | .clk = { | ||
674 | .name = "mmc_bus", | ||
675 | .devname = "s3c-sdhci.1", | ||
676 | .ctrlbit = S3C_CLKCON_SCLK_MMC1, | ||
677 | .enable = s3c64xx_sclk_ctrl, | ||
678 | }, | ||
679 | .reg_src = { .reg = S3C_CLK_SRC, .shift = 20, .size = 2 }, | ||
680 | .reg_div = { .reg = S3C_CLK_DIV1, .shift = 4, .size = 4 }, | ||
681 | .sources = &clkset_spi_mmc, | ||
682 | }; | ||
683 | |||
684 | static struct clksrc_clk clk_sclk_mmc2 = { | ||
685 | .clk = { | ||
686 | .name = "mmc_bus", | ||
687 | .devname = "s3c-sdhci.2", | ||
688 | .ctrlbit = S3C_CLKCON_SCLK_MMC2, | ||
689 | .enable = s3c64xx_sclk_ctrl, | ||
690 | }, | ||
691 | .reg_src = { .reg = S3C_CLK_SRC, .shift = 22, .size = 2 }, | ||
692 | .reg_div = { .reg = S3C_CLK_DIV1, .shift = 8, .size = 4 }, | ||
693 | .sources = &clkset_spi_mmc, | ||
694 | }; | ||
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 | |||
700 | /* Clock initialisation code */ | 720 | /* Clock initialisation code */ |
701 | 721 | ||
702 | static struct clksrc_clk *init_parents[] = { | 722 | static struct clksrc_clk *init_parents[] = { |
@@ -707,11 +727,35 @@ static struct clksrc_clk *init_parents[] = { | |||
707 | 727 | ||
708 | static struct clksrc_clk *clksrc_cdev[] = { | 728 | static struct clksrc_clk *clksrc_cdev[] = { |
709 | &clk_sclk_uclk, | 729 | &clk_sclk_uclk, |
730 | &clk_sclk_mmc0, | ||
731 | &clk_sclk_mmc1, | ||
732 | &clk_sclk_mmc2, | ||
733 | &clk_sclk_spi0, | ||
734 | &clk_sclk_spi1, | ||
735 | }; | ||
736 | |||
737 | static struct clk *clk_cdev[] = { | ||
738 | &clk_hsmmc0, | ||
739 | &clk_hsmmc1, | ||
740 | &clk_hsmmc2, | ||
741 | &clk_48m_spi0, | ||
742 | &clk_48m_spi1, | ||
710 | }; | 743 | }; |
711 | 744 | ||
712 | static struct clk_lookup s3c64xx_clk_lookup[] = { | 745 | static struct clk_lookup s3c64xx_clk_lookup[] = { |
713 | CLKDEV_INIT(NULL, "clk_uart_baud2", &clk_p), | 746 | CLKDEV_INIT(NULL, "clk_uart_baud2", &clk_p), |
714 | CLKDEV_INIT(NULL, "clk_uart_baud3", &clk_sclk_uclk.clk), | 747 | CLKDEV_INIT(NULL, "clk_uart_baud3", &clk_sclk_uclk.clk), |
748 | CLKDEV_INIT("s3c-sdhci.0", "mmc_busclk.0", &clk_hsmmc0), | ||
749 | CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.0", &clk_hsmmc1), | ||
750 | CLKDEV_INIT("s3c-sdhci.2", "mmc_busclk.0", &clk_hsmmc2), | ||
751 | CLKDEV_INIT("s3c-sdhci.0", "mmc_busclk.2", &clk_sclk_mmc0.clk), | ||
752 | CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.2", &clk_sclk_mmc1.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), | ||
715 | }; | 759 | }; |
716 | 760 | ||
717 | #define GET_DIV(clk, field) ((((clk) & field##_MASK) >> field##_SHIFT) + 1) | 761 | #define GET_DIV(clk, field) ((((clk) & field##_MASK) >> field##_SHIFT) + 1) |
@@ -834,6 +878,10 @@ void __init s3c64xx_register_clocks(unsigned long xtal, | |||
834 | s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off)); | 878 | s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off)); |
835 | s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off)); | 879 | s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off)); |
836 | 880 | ||
881 | s3c24xx_register_clocks(clk_cdev, ARRAY_SIZE(clk_cdev)); | ||
882 | for (cnt = 0; cnt < ARRAY_SIZE(clk_cdev); cnt++) | ||
883 | s3c_disable_clocks(clk_cdev[cnt], 1); | ||
884 | |||
837 | s3c24xx_register_clocks(clks1, ARRAY_SIZE(clks1)); | 885 | s3c24xx_register_clocks(clks1, ARRAY_SIZE(clks1)); |
838 | s3c_register_clksrc(clksrcs, ARRAY_SIZE(clksrcs)); | 886 | s3c_register_clksrc(clksrcs, ARRAY_SIZE(clksrcs)); |
839 | for (cnt = 0; cnt < ARRAY_SIZE(clksrc_cdev); cnt++) | 887 | for (cnt = 0; cnt < ARRAY_SIZE(clksrc_cdev); cnt++) |
diff --git a/arch/arm/mach-s3c64xx/dev-spi.c b/arch/arm/mach-s3c64xx/dev-spi.c deleted file mode 100644 index 3341fd118723..000000000000 --- a/arch/arm/mach-s3c64xx/dev-spi.c +++ /dev/null | |||
@@ -1,180 +0,0 @@ | |||
1 | /* linux/arch/arm/plat-s3c64xx/dev-spi.c | ||
2 | * | ||
3 | * Copyright (C) 2009 Samsung Electronics Ltd. | ||
4 | * Jaswinder Singh <jassi.brar@samsung.com> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | |||
11 | #include <linux/kernel.h> | ||
12 | #include <linux/string.h> | ||
13 | #include <linux/export.h> | ||
14 | #include <linux/platform_device.h> | ||
15 | #include <linux/dma-mapping.h> | ||
16 | #include <linux/gpio.h> | ||
17 | |||
18 | #include <mach/dma.h> | ||
19 | #include <mach/map.h> | ||
20 | #include <mach/spi-clocks.h> | ||
21 | #include <mach/irqs.h> | ||
22 | |||
23 | #include <plat/s3c64xx-spi.h> | ||
24 | #include <plat/gpio-cfg.h> | ||
25 | #include <plat/devs.h> | ||
26 | |||
27 | static char *spi_src_clks[] = { | ||
28 | [S3C64XX_SPI_SRCCLK_PCLK] = "pclk", | ||
29 | [S3C64XX_SPI_SRCCLK_SPIBUS] = "spi-bus", | ||
30 | [S3C64XX_SPI_SRCCLK_48M] = "spi_48m", | ||
31 | }; | ||
32 | |||
33 | /* SPI Controller platform_devices */ | ||
34 | |||
35 | /* Since we emulate multi-cs capability, we do not touch the GPC-3,7. | ||
36 | * The emulated CS is toggled by board specific mechanism, as it can | ||
37 | * be either some immediate GPIO or some signal out of some other | ||
38 | * chip in between ... or some yet another way. | ||
39 | * We simply do not assume anything about CS. | ||
40 | */ | ||
41 | static int s3c64xx_spi_cfg_gpio(struct platform_device *pdev) | ||
42 | { | ||
43 | unsigned int base; | ||
44 | |||
45 | switch (pdev->id) { | ||
46 | case 0: | ||
47 | base = S3C64XX_GPC(0); | ||
48 | break; | ||
49 | |||
50 | case 1: | ||
51 | base = S3C64XX_GPC(4); | ||
52 | break; | ||
53 | |||
54 | default: | ||
55 | dev_err(&pdev->dev, "Invalid SPI Controller number!"); | ||
56 | return -EINVAL; | ||
57 | } | ||
58 | |||
59 | s3c_gpio_cfgall_range(base, 3, | ||
60 | S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP); | ||
61 | |||
62 | return 0; | ||
63 | } | ||
64 | |||
65 | static struct resource s3c64xx_spi0_resource[] = { | ||
66 | [0] = { | ||
67 | .start = S3C64XX_PA_SPI0, | ||
68 | .end = S3C64XX_PA_SPI0 + 0x100 - 1, | ||
69 | .flags = IORESOURCE_MEM, | ||
70 | }, | ||
71 | [1] = { | ||
72 | .start = DMACH_SPI0_TX, | ||
73 | .end = DMACH_SPI0_TX, | ||
74 | .flags = IORESOURCE_DMA, | ||
75 | }, | ||
76 | [2] = { | ||
77 | .start = DMACH_SPI0_RX, | ||
78 | .end = DMACH_SPI0_RX, | ||
79 | .flags = IORESOURCE_DMA, | ||
80 | }, | ||
81 | [3] = { | ||
82 | .start = IRQ_SPI0, | ||
83 | .end = IRQ_SPI0, | ||
84 | .flags = IORESOURCE_IRQ, | ||
85 | }, | ||
86 | }; | ||
87 | |||
88 | static struct s3c64xx_spi_info s3c64xx_spi0_pdata = { | ||
89 | .cfg_gpio = s3c64xx_spi_cfg_gpio, | ||
90 | .fifo_lvl_mask = 0x7f, | ||
91 | .rx_lvl_offset = 13, | ||
92 | .tx_st_done = 21, | ||
93 | }; | ||
94 | |||
95 | static u64 spi_dmamask = DMA_BIT_MASK(32); | ||
96 | |||
97 | struct platform_device s3c64xx_device_spi0 = { | ||
98 | .name = "s3c64xx-spi", | ||
99 | .id = 0, | ||
100 | .num_resources = ARRAY_SIZE(s3c64xx_spi0_resource), | ||
101 | .resource = s3c64xx_spi0_resource, | ||
102 | .dev = { | ||
103 | .dma_mask = &spi_dmamask, | ||
104 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
105 | .platform_data = &s3c64xx_spi0_pdata, | ||
106 | }, | ||
107 | }; | ||
108 | EXPORT_SYMBOL(s3c64xx_device_spi0); | ||
109 | |||
110 | static struct resource s3c64xx_spi1_resource[] = { | ||
111 | [0] = { | ||
112 | .start = S3C64XX_PA_SPI1, | ||
113 | .end = S3C64XX_PA_SPI1 + 0x100 - 1, | ||
114 | .flags = IORESOURCE_MEM, | ||
115 | }, | ||
116 | [1] = { | ||
117 | .start = DMACH_SPI1_TX, | ||
118 | .end = DMACH_SPI1_TX, | ||
119 | .flags = IORESOURCE_DMA, | ||
120 | }, | ||
121 | [2] = { | ||
122 | .start = DMACH_SPI1_RX, | ||
123 | .end = DMACH_SPI1_RX, | ||
124 | .flags = IORESOURCE_DMA, | ||
125 | }, | ||
126 | [3] = { | ||
127 | .start = IRQ_SPI1, | ||
128 | .end = IRQ_SPI1, | ||
129 | .flags = IORESOURCE_IRQ, | ||
130 | }, | ||
131 | }; | ||
132 | |||
133 | static struct s3c64xx_spi_info s3c64xx_spi1_pdata = { | ||
134 | .cfg_gpio = s3c64xx_spi_cfg_gpio, | ||
135 | .fifo_lvl_mask = 0x7f, | ||
136 | .rx_lvl_offset = 13, | ||
137 | .tx_st_done = 21, | ||
138 | }; | ||
139 | |||
140 | struct platform_device s3c64xx_device_spi1 = { | ||
141 | .name = "s3c64xx-spi", | ||
142 | .id = 1, | ||
143 | .num_resources = ARRAY_SIZE(s3c64xx_spi1_resource), | ||
144 | .resource = s3c64xx_spi1_resource, | ||
145 | .dev = { | ||
146 | .dma_mask = &spi_dmamask, | ||
147 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
148 | .platform_data = &s3c64xx_spi1_pdata, | ||
149 | }, | ||
150 | }; | ||
151 | EXPORT_SYMBOL(s3c64xx_device_spi1); | ||
152 | |||
153 | void __init s3c64xx_spi_set_info(int cntrlr, int src_clk_nr, int num_cs) | ||
154 | { | ||
155 | struct s3c64xx_spi_info *pd; | ||
156 | |||
157 | /* Reject invalid configuration */ | ||
158 | if (!num_cs || src_clk_nr < 0 | ||
159 | || src_clk_nr > S3C64XX_SPI_SRCCLK_48M) { | ||
160 | printk(KERN_ERR "%s: Invalid SPI configuration\n", __func__); | ||
161 | return; | ||
162 | } | ||
163 | |||
164 | switch (cntrlr) { | ||
165 | case 0: | ||
166 | pd = &s3c64xx_spi0_pdata; | ||
167 | break; | ||
168 | case 1: | ||
169 | pd = &s3c64xx_spi1_pdata; | ||
170 | break; | ||
171 | default: | ||
172 | printk(KERN_ERR "%s: Invalid SPI controller(%d)\n", | ||
173 | __func__, cntrlr); | ||
174 | return; | ||
175 | } | ||
176 | |||
177 | pd->num_cs = num_cs; | ||
178 | pd->src_clk_nr = src_clk_nr; | ||
179 | pd->src_clk_name = spi_src_clks[src_clk_nr]; | ||
180 | } | ||
diff --git a/arch/arm/mach-s3c64xx/include/mach/map.h b/arch/arm/mach-s3c64xx/include/mach/map.h index 23a1d71e4d53..8e2097bb208a 100644 --- a/arch/arm/mach-s3c64xx/include/mach/map.h +++ b/arch/arm/mach-s3c64xx/include/mach/map.h | |||
@@ -115,6 +115,8 @@ | |||
115 | #define S3C_PA_USB_HSOTG S3C64XX_PA_USB_HSOTG | 115 | #define S3C_PA_USB_HSOTG S3C64XX_PA_USB_HSOTG |
116 | #define S3C_PA_RTC S3C64XX_PA_RTC | 116 | #define S3C_PA_RTC S3C64XX_PA_RTC |
117 | #define S3C_PA_WDT S3C64XX_PA_WATCHDOG | 117 | #define S3C_PA_WDT S3C64XX_PA_WATCHDOG |
118 | #define S3C_PA_SPI0 S3C64XX_PA_SPI0 | ||
119 | #define S3C_PA_SPI1 S3C64XX_PA_SPI1 | ||
118 | 120 | ||
119 | #define SAMSUNG_PA_ADC S3C64XX_PA_ADC | 121 | #define SAMSUNG_PA_ADC S3C64XX_PA_ADC |
120 | #define SAMSUNG_PA_CFCON S3C64XX_PA_CFCON | 122 | #define SAMSUNG_PA_CFCON S3C64XX_PA_CFCON |
diff --git a/arch/arm/mach-s3c64xx/setup-sdhci.c b/arch/arm/mach-s3c64xx/setup-sdhci.c deleted file mode 100644 index c75a71b21165..000000000000 --- a/arch/arm/mach-s3c64xx/setup-sdhci.c +++ /dev/null | |||
@@ -1,24 +0,0 @@ | |||
1 | /* linux/arch/arm/mach-s3c64xx/setup-sdhci.c | ||
2 | * | ||
3 | * Copyright 2008 Simtec Electronics | ||
4 | * Copyright 2008 Simtec Electronics | ||
5 | * Ben Dooks <ben@simtec.co.uk> | ||
6 | * http://armlinux.simtec.co.uk/ | ||
7 | * | ||
8 | * S3C6400/S3C6410 - Helper functions for settign up SDHCI device(s) (HSMMC) | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License version 2 as | ||
12 | * published by the Free Software Foundation. | ||
13 | */ | ||
14 | |||
15 | #include <linux/types.h> | ||
16 | |||
17 | /* clock sources for the mmc bus clock, order as for the ctrl2[5..4] */ | ||
18 | |||
19 | char *s3c64xx_hsmmc_clksrcs[4] = { | ||
20 | [0] = "hsmmc", | ||
21 | [1] = "hsmmc", | ||
22 | [2] = "mmc_bus", | ||
23 | /* [3] = "48m", - note not successfully used yet */ | ||
24 | }; | ||
diff --git a/arch/arm/mach-s3c64xx/setup-spi.c b/arch/arm/mach-s3c64xx/setup-spi.c new file mode 100644 index 000000000000..d9592ad7a825 --- /dev/null +++ b/arch/arm/mach-s3c64xx/setup-spi.c | |||
@@ -0,0 +1,45 @@ | |||
1 | /* linux/arch/arm/mach-s3c64xx/setup-spi.c | ||
2 | * | ||
3 | * Copyright (C) 2011 Samsung Electronics Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | |||
11 | #include <linux/gpio.h> | ||
12 | #include <linux/platform_device.h> | ||
13 | |||
14 | #include <plat/gpio-cfg.h> | ||
15 | #include <plat/s3c64xx-spi.h> | ||
16 | |||
17 | #ifdef CONFIG_S3C64XX_DEV_SPI0 | ||
18 | struct s3c64xx_spi_info s3c64xx_spi0_pdata __initdata = { | ||
19 | .fifo_lvl_mask = 0x7f, | ||
20 | .rx_lvl_offset = 13, | ||
21 | .tx_st_done = 21, | ||
22 | }; | ||
23 | |||
24 | int s3c64xx_spi0_cfg_gpio(struct platform_device *dev) | ||
25 | { | ||
26 | s3c_gpio_cfgall_range(S3C64XX_GPC(0), 3, | ||
27 | S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP); | ||
28 | return 0; | ||
29 | } | ||
30 | #endif | ||
31 | |||
32 | #ifdef CONFIG_S3C64XX_DEV_SPI1 | ||
33 | struct s3c64xx_spi_info s3c64xx_spi1_pdata __initdata = { | ||
34 | .fifo_lvl_mask = 0x7f, | ||
35 | .rx_lvl_offset = 13, | ||
36 | .tx_st_done = 21, | ||
37 | }; | ||
38 | |||
39 | int s3c64xx_spi1_cfg_gpio(struct platform_device *dev) | ||
40 | { | ||
41 | s3c_gpio_cfgall_range(S3C64XX_GPC(4), 3, | ||
42 | S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP); | ||
43 | return 0; | ||
44 | } | ||
45 | #endif | ||