S3C2416 fixes (gpiolib, SDHCI, compilation without FB device)
Subsystems (3)
v2 cover S3C2416 fixes (gpiolib, SDHCI, compilation without FB device)
This patch series fixes SDHCI on S3C2416. I got SD card working with this patches and with patches for GPIO card detection support by Marek Szyprowski.
Resent due error in previous post.
PATCH v2 1/4 ARM: S3C24XX: Fix gpiolib support for ports K..M
S3C2443 and S3C2416 has 12 GPIO banks (from A to M), increase ARCH_NR_GPIOS for this architectures.
Also typo from previous commit has been fixed: CONFIG_CPU_S3C24XX instead CONFIG_CPU_244X.
--- arch/arm/mach-s3c2410/include/mach/gpio.h | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-)
arch/arm/mach-s3c2410/include/mach/gpio.h +7 -3
@@ -22,6 +22,8 @@#ifdef CONFIG_CPU_S3C244X #define ARCH_NR_GPIOS (32 * 9 + CONFIG_S3C24XX_GPIO_EXTRA) +#elif defined(CONFIG_CPU_S3C2443 ) || defined(CONFIG_CPU_S3C2416 ) +#define ARCH_NR_GPIOS (32 * 12 + CONFIG_S3C24XX_GPIO_EXTRA)#else #define ARCH_NR_GPIOS (256 + CONFIG_S3C24XX_GPIO_EXTRA)#endif
@@ -30,8 +32,10 @@#include <mach/gpio-nrs.h> #include <mach/gpio-fns.h> -#ifdef CONFIG_CPU_S3C24XX -#define S3C_GPIO_END (S3C2410_GPIO_BANKJ + 32) +#ifdef CONFIG_CPU_S3C244X +#define S3C_GPIO_END (S3C2410_GPJ(0) + 32) +#elif defined(CONFIG_CPU_S3C2443 ) || defined(CONFIG_CPU_S3C2416 ) +#define S3C_GPIO_END (S3C2410_GPM(0) + 32)#else -#define S3C_GPIO_END (S3C2410_GPIO_BANKH + 32) +#define S3C_GPIO_END (S3C2410_GPH(0) + 32)#endif
Signature · 1 line
1.7.1
PATCH v2 1/4 ARM: S3C24XX: Fix gpiolib support for ports K..M
Quoted 33 lines · Yauhen Kharuzhy
S3C2443 and S3C2416 has 12 GPIO banks (from A to M), increase
ARCH_NR_GPIOSfor this architectures.Also typo from previous commit has been fixed:
CONFIG_CPU_S3C24XXinsteadCONFIG_CPU_244X.Signed-off-by Yauhen Kharuzhy <[email protected]>Tested-by Vasily Khoruzhick <[email protected]>--- arch/arm/mach-s3c2410/include/mach/gpio.h | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-)arch/arm/mach- renamed from arch/arm/mach-s3c2410/include/mach/gpio.h +0
-0
s3c2410/include/mach/gpio.h
index b649bf2..f7f6b07 100644arch/arm/mach-s3c2410/include/mach/gpio.h +2
-1@@ -22,6 +22,8 @@#ifdef CONFIG_CPU_S3C244X #define ARCH_NR_GPIOS (32 * 9 + CONFIG_S3C24XX_GPIO_EXTRA) +#elif defined(CONFIG_CPU_S3C2443 ) || defined(CONFIG_CPU_S3C2416 ) +#define ARCH_NR_GPIOS (32 * 12 + CONFIG_S3C24XX_GPIO_EXTRA)#else #define ARCH_NR_GPIOS (256 + CONFIG_S3C24XX_GPIO_EXTRA)#endif @@ -30,8 +32,10 @@#include <mach/gpio-nrs.h> #include <mach/gpio-fns.h> -#ifdef CONFIG_CPU_S3C24XX
arch/arm/mach-s3c2410/include/mach/gpio.h
Quoted 10 lines
arch/arm/mach-s3c2410/include/mach/gpio.h +5
-3-#define S3C_GPIO_END (S3C2410_GPIO_BANKJ + 32) +#ifdef CONFIG_CPU_S3C244X +#define S3C_GPIO_END (S3C2410_GPJ(0) + 32) +#elif defined(CONFIG_CPU_S3C2443 ) || defined(CONFIG_CPU_S3C2416 ) +#define S3C_GPIO_END (S3C2410_GPM(0) + 32)#else -#define S3C_GPIO_END (S3C2410_GPIO_BANKH + 32) +#define S3C_GPIO_END (S3C2410_GPH(0) + 32)#endif --
Looks ok to me...will apply.
Thanks.
Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.
PATCH v2 2/4 ARM: S3C2416: Set name of the framebuffer device only if it present
In reply to Yauhen KharuzhyFix case when board doesn't have LCD connected and doesn't have corresponding platform device compiled.
--- arch/arm/mach-s3c2416/s3c2416.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
arch/arm/mach-s3c2416/s3c2416.c +2 -0
@@ -90,7 +90,9 @@ int __init s3c2416_init(void)s3c_i2c0_setname ("s3c2440-i2c" );s3c_i2c1_setname ("s3c2440-i2c" ); +#ifdef CONFIG_S3C_DEV_FB s3c_device_fb.name ="s3c2443-fb" ; +#endif return sysdev_register (&s3c2416_sysdev); }
Signature · 1 line
1.7.1
PATCH v2 2/4 ARM: S3C2416: Set name of the framebuffer device only if it present
Hello,
Quoted 14 lines · Yauhen Kharuzhy
Fix case when board doesn't have LCD connected and doesn't have corresponding platform device compiled.
Signed-off-by Yauhen Kharuzhy <[email protected]>--- arch/arm/mach-s3c2416/s3c2416.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)arch/arm/mach- renamed from arch/arm/mach-s3c2416/s3c2416.c +0
-0
s3c2416/s3c2416.c
index 35dabcc..355ab62 100644
arch/arm/mach-s3c2416/s3c2416.c int __init s3c2416_init(void) · line 95
Quoted 6 lines
arch/arm/mach-s3c2416/s3c2416.c +2
-0@@ -90,7 +90,9 @@ int __init s3c2416_init(void)s3c_i2c0_setname ("s3c2440-i2c" );s3c_i2c1_setname ("s3c2440-i2c" ); +#ifdef CONFIG_S3C_DEV_FB s3c_device_fb.name ="s3c2443-fb" ; +#endif
The above line should be rather removed completely in favor of a solution proposed by Pawel Osciak in his s3c-fb patches:
http://www.spinics.net/lists/arm-kernel/msg90906.html
Best regards
--
Marek Szyprowski
Samsung Poland R&D Center
PATCH v2 2/4 ARM: S3C2416: Set name of the framebuffer device only if it present
In reply to Yauhen KharuzhyQuoted 15 lines · Yauhen Kharuzhy
Fix case when board doesn't have LCD connected and doesn't have corresponding platform device compiled.
Signed-off-by Yauhen Kharuzhy <[email protected]>--- arch/arm/mach-s3c2416/s3c2416.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)arch/arm/mach- renamed from arch/arm/mach-s3c2416/s3c2416.c +0
-0
s3c2416/s3c2416.c
index 35dabcc..355ab62 100644
arch/arm/mach-s3c2416/s3c2416.c int __init s3c2416_init(void) · line 95
Quoted 6 lines
arch/arm/mach-s3c2416/s3c2416.c +2
-0@@ -90,7 +90,9 @@ int __init s3c2416_init(void)s3c_i2c0_setname ("s3c2440-i2c" );s3c_i2c1_setname ("s3c2440-i2c" ); +#ifdef CONFIG_S3C_DEV_FB s3c_device_fb.name ="s3c2443-fb" ; +#endif
Could you please use s3c_fb_setname() instead? There is in plat-samsung/include/plat/fb-core.h...
arch/arm/mach-s3c2416/s3c2416.c int __init s3c2416_init(void)
Quoted 4 lines
arch/arm/mach-s3c2416/s3c2416.c +0
-1return sysdev_register (&s3c2416_sysdev); } --
Thanks.
Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.
PATCH v2 3/4 ARM: S3C2416: Add clock definition for HSMMC1
In reply to Yauhen KharuzhyDefine clock for hsmmc1 device and register it.
--- .../mach-s3c2410/include/mach/regs-s3c2443-clock.h | 1 + arch/arm/mach-s3c2416/clock.c | 9 +++++++++ 2 files changed, 10 insertions(+), 0 deletions(-)
arch/arm/mach-s3c2410/include/mach/regs-s3c2443-clock.h +1 -0
@@ -86,6 +86,7 @@#define S3C2443_HCLKCON_LCDC (1<<9)#define S3C2443_HCLKCON_USBH (1<<11)#define S3C2443_HCLKCON_USBD (1<<12) +#define S3C2416_HCLKCON_HSMMC0 (1<<15)#define S3C2443_HCLKCON_HSMMC (1<<16)#define S3C2443_HCLKCON_CFC (1<<17)#define S3C2443_HCLKCON_SSMC (1<<18)
arch/arm/mach-s3c2416/clock.c +9 -0
@@ -93,6 +93,13 @@ static struct clksrc_clk hsmmc_mux[] = { }, }; +static struct clk hsmmc1_clk = { + .name ="hsmmc" , + .id =1 , + .parent = &clk_h, + .enable = s3c2443_clkcon_enable_h, + .ctrlbit =S3C2416_HCLKCON_HSMMC0 , +};static inline unsigned int s3c2416_fclk_div (unsigned long clkcon0) {
@@ -130,6 +137,8 @@ void __init s3c2416_init_clocks(int xtal)for (ptr =0 ; ptr <ARRAY_SIZE (clksrcs); ptr++)s3c_register_clksrc (clksrcs[ptr],1 ); +s3c24xx_register_clock (&hsmmc1_clk); +s3c_pwmclk_init (); }
Signature · 1 line
1.7.1
PATCH v2 4/4 ARM: S3C2416: Add platform helpers for setup SDHCI
In reply to Yauhen KharuzhySamsung S3C2416 has two SDHCI controllers compatible with other Samsung's SoCs (S3C64XX, S5PC100 etc...).
Add required platform setup code that the devices can be used with sdhci-s3c driver.
--- arch/arm/mach-s3c2416/Kconfig | 12 +++++ arch/arm/mach-s3c2416/Makefile | 4 ++ arch/arm/mach-s3c2416/s3c2416.c | 5 ++ arch/arm/mach-s3c2416/setup-sdhci-gpio.c | 60 +++++++++++++++++++++++++++ arch/arm/mach-s3c2416/setup-sdhci.c | 62 ++++++++++++++++++++++++++++ arch/arm/plat-samsung/include/plat/sdhci.h | 34 +++++++++++++++ 6 files changed, 177 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-s3c2416/setup-sdhci-gpio.c create mode 100644 arch/arm/mach-s3c2416/setup-sdhci.c
arch/arm/mach-s3c2416/Kconfig +12 -0
@@ -25,6 +25,17 @@ config S3C2416_DMA help Internal config node for S3C2416 DMA support +config S3C2416_SETUP_SDHCI + bool + select S3C2416_SETUP_SDHCI_GPIO + help + Internal helper functions for S3C2416 based SDHCI systems + +config S3C2416_SETUP_SDHCI_GPIO + bool + help + Common setup code for SDHCI gpio. + menu "S3C2416 Machines" config MACH_SMDK2416
@@ -36,6 +47,7 @@ config MACH_SMDK2416 select S3C_DEV_HSMMC1 select S3C_DEV_NAND select S3C_DEV_USB_HOST + select S3C2416_SETUP_SDHCI help Say Y here if you are using an SMDK2416
arch/arm/mach-s3c2416/Makefile +4 -0
@@ -14,6 +14,10 @@ obj-$(CONFIG_CPU_S3C2416) += irq.o #obj-$(CONFIG_S3C2416_DMA) += dma.o +# Device setup +obj-$(CONFIG_S3C2416_SETUP_SDHCI) += setup-sdhci.o +obj-$(CONFIG_S3C2416_SETUP_SDHCI_GPIO) += setup-sdhci-gpio.o + # Machine support obj-$(CONFIG_MACH_SMDK2416) += mach-smdk2416.o
arch/arm/mach-s3c2416/s3c2416.c +5 -0
@@ -53,6 +53,7 @@#include <plat/s3c2416.h> #include <plat/devs.h> #include <plat/cpu.h> +#include <plat/sdhci.h> #include <plat/iic-core.h>
@@ -115,6 +116,10 @@ void __init s3c2416_map_io(void) s3c24xx_gpiocfg_default.set_pull = s3c_gpio_setpull_updown; s3c24xx_gpiocfg_default.get_pull = s3c_gpio_getpull_updown; +/* initialize device information early */ +s3c2416_default_sdhci0 (); +s3c2416_default_sdhci1 (); +iotable_init (s3c2416_iodesc,ARRAY_SIZE (s3c2416_iodesc)); }
arch/arm/mach-s3c2416/setup-sdhci-gpio.c new file +60 -0
60 lines not on this page · raw message
arch/arm/mach-s3c2416/setup-sdhci.c new file +62 -0
62 lines not on this page · raw message
arch/arm/plat-samsung/include/plat/sdhci.h +34 -0
@@ -78,6 +78,8 @@ extern void s3c64xx_setup_sdhci2_cfg_gpio(struct platform_device *, int w);extern void s5pv210_setup_sdhci0_cfg_gpio (struct platform_device *,int w);extern void s5pv210_setup_sdhci1_cfg_gpio (struct platform_device *,int w);extern void s5pv210_setup_sdhci2_cfg_gpio (struct platform_device *,int w); +extern void s3c2416_setup_sdhci0_cfg_gpio (struct platform_device *,int w); +extern void s3c2416_setup_sdhci1_cfg_gpio (struct platform_device *,int w);/* S3C6400 SDHCI setup */
@@ -270,6 +272,38 @@ static inline void s5pv210_default_sdhci1(void) { }static inline void s5pv210_default_sdhci2 (void ) { }#endif /* CONFIG_S5PC100_SETUP_SDHCI */ +/* S3C2416 SDHCI setup */ +#ifdef CONFIG_S3C2416_SETUP_SDHCI +extern char *s3c2416_hsmmc_clksrcs[4 ]; + +extern void s3c2416_setup_sdhci_cfg_card (struct platform_device *dev, +void __iomem *r, +struct mmc_ios *ios, +struct mmc_card *card); + +#ifdef CONFIG_S3C_DEV_HSMMC +static inline void s3c2416_default_sdhci0 (void ) +{ + s3c_hsmmc0_def_platdata.clocks = s3c2416_hsmmc_clksrcs; + s3c_hsmmc0_def_platdata.cfg_gpio = s3c2416_setup_sdhci0_cfg_gpio; + s3c_hsmmc0_def_platdata.cfg_card = s3c2416_setup_sdhci_cfg_card; +} +#else +static inline void s3c2416_default_sdhci0 (void ) { } +#endif /* CONFIG_S3C_DEV_HSMMC */ + +#ifdef CONFIG_S3C_DEV_HSMMC1 +static inline void s3c2416_default_sdhci1 (void ) +{ + s3c_hsmmc1_def_platdata.clocks = s3c2416_hsmmc_clksrcs; + s3c_hsmmc1_def_platdata.cfg_gpio = s3c2416_setup_sdhci1_cfg_gpio; + s3c_hsmmc1_def_platdata.cfg_card = s3c2416_setup_sdhci_cfg_card; +} +#else +static inline void s3c2416_default_sdhci1 (void ) { } +#endif /* CONFIG_S3C_DEV_HSMMC1 */ + +#endif /* CONFIG_S3C2416_SETUP_SDHCI */
Signature · 1 line
1.7.1
PATCH v2 4/4 ARM: S3C2416: Add platform helpers for setup SDHCI
Review
Quoted 52 lines · Yauhen Kharuzhy
Samsung S3C2416 has two SDHCI controllers compatible with other Samsung's SoCs (S3C64XX, S5PC100 etc...).
Add required platform setup code that the devices can be used with sdhci-s3c driver.
Signed-off-by Yauhen Kharuzhy <[email protected]>--- arch/arm/mach-s3c2416/Kconfig | 12 +++++ arch/arm/mach-s3c2416/Makefile | 4 ++ arch/arm/mach-s3c2416/s3c2416.c | 5 ++ arch/arm/mach-s3c2416/setup-sdhci-gpio.c | 60 +++++++++++++++++++++++++++ arch/arm/mach-s3c2416/setup-sdhci.c | 62 ++++++++++++++++++++++++++++ arch/arm/plat-samsung/include/plat/sdhci.h | 34 +++++++++++++++ 6 files changed, 177 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-s3c2416/setup-sdhci-gpio.c create mode 100644 arch/arm/mach-s3c2416/setup-sdhci.carch/arm/mach-s3c2416/Kconfig +12
-0@@ -25,6 +25,17 @@ config S3C2416_DMA help Internal config node for S3C2416 DMA support +config S3C2416_SETUP_SDHCI + bool + select S3C2416_SETUP_SDHCI_GPIO + help + Internal helper functions for S3C2416 based SDHCI systems + +config S3C2416_SETUP_SDHCI_GPIO + bool + help + Common setup code for SDHCI gpio. + menu "S3C2416 Machines" config MACH_SMDK2416@@ -36,6 +47,7 @@ config MACH_SMDK2416 select S3C_DEV_HSMMC1 select S3C_DEV_NAND select S3C_DEV_USB_HOST + select S3C2416_SETUP_SDHCI help Say Y here if you are using an SMDK2416(quoted diff) +0
-0
b/arch/arm/mach-s3c2416/Makefile
Quoted 56 lines
index 6c12c7b..4f83f94 100644
arch/arm/mach-s3c2416/Makefile +4
-0@@ -14,6 +14,10 @@ obj-$(CONFIG_CPU_S3C2416) += irq.o #obj-$(CONFIG_S3C2416_DMA) += dma.o +# Device setup +obj-$(CONFIG_S3C2416_SETUP_SDHCI) += setup-sdhci.o +obj-$(CONFIG_S3C2416_SETUP_SDHCI_GPIO) += setup-sdhci-gpio.o + # Machine support obj-$(CONFIG_MACH_SMDK2416) += mach-smdk2416.oarch/arm/mach- renamed from arch/arm/mach-s3c2416/s3c2416.c +0
-0
s3c2416/s3c2416.c
index 355ab62..06eacf8 100644arch/arm/mach-s3c2416/s3c2416.c +5
-0@@ -53,6 +53,7 @@#include <plat/s3c2416.h> #include <plat/devs.h> #include <plat/cpu.h> +#include <plat/sdhci.h> #include <plat/iic-core.h> @@ -115,6 +116,10 @@ void __init s3c2416_map_io(void) s3c24xx_gpiocfg_default.set_pull = s3c_gpio_setpull_updown; s3c24xx_gpiocfg_default.get_pull = s3c_gpio_getpull_updown; +/* initialize device information early */ +s3c2416_default_sdhci0 (); +s3c2416_default_sdhci1 (); +iotable_init (s3c2416_iodesc,ARRAY_SIZE (s3c2416_iodesc)); }arch/arm/mach- renamed from arch/arm/mach-s3c2416/setup-sdhci-gpio.c +0
-0
s3c2416/setup-sdhci-gpio.c
new file mode 100644
index 0000000..ebdab15arch/arm/mach-s3c2416/setup-sdhci-gpio.c new file +11
-0@@ -0,0 +1,60 @@ +/* linux/arch/arm/plat-s3c2416/setup-sdhci-gpio.c +* +* Copyright 2010 Promwad Innovation Company +* Yauhen Kharuzhy <[email protected]> +* +* S3C2416 - Helper functions for setting up SDHCI device(s) GPIO (HSMMC) +* +* Based on mach-s3c64xx/setup-sdhci-gpio.c +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as
arch/arm/mach-s3c2416/setup-sdhci-gpio.c line 21
Quoted 10 lines
arch/arm/mach-s3c2416/setup-sdhci-gpio.c new file +10
-0+* published by the Free Software Foundation. +*/ + +#include <linux/kernel.h> +#include <linux/types.h> +#include <linux/interrupt.h> +#include <linux/platform_device.h> +#include <linux/io.h> + +#include <mach/gpio.h>
should be <linux/gpio.h>
arch/arm/mach-s3c2416/setup-sdhci-gpio.c
Quoted 6 lines
arch/arm/mach-s3c2416/setup-sdhci-gpio.c new file +6
-0+#include <mach/regs-gpio.h> +#include <plat/gpio-cfg.h> + +/* Note: hsmmc1 and hsmmc0 are swapped versus datasheet */ + +void s3c2416_setup_sdhci1_cfg_gpio(struct platform_device *dev, int
width)
arch/arm/mach-s3c2416/setup-sdhci-gpio.c line 38
Quoted 11 lines
arch/arm/mach-s3c2416/setup-sdhci-gpio.c new file +11
-0+{ +unsigned int gpio; +unsigned int end; + + end =S3C2410_GPE (7 + width); + +/* Set all the necessary GPE pins to special-function 0 */ +for (gpio =S3C2410_GPE (5 ); gpio < end; gpio++) { +s3c_gpio_cfgpin (gpio,S3C_GPIO_SFN (2 )); +s3c_gpio_setpull (gpio,S3C_GPIO_PULL_NONE ); + }
could you please update above gpio setup functions like following?
s3c_gpio_cfgrange_nopull(S3C2410_GPE(5), 2 + width, S3C_GPIO_SFN(2));
arch/arm/mach-s3c2416/setup-sdhci-gpio.c
Quoted 3 lines
arch/arm/mach-s3c2416/setup-sdhci-gpio.c new file +3
-0+} + +void s3c2416_setup_sdhci0_cfg_gpio(struct platform_device *dev, int
width)
arch/arm/mach-s3c2416/setup-sdhci-gpio.c line 52
Quoted 11 lines
arch/arm/mach-s3c2416/setup-sdhci-gpio.c new file +11
-0+{ +unsigned int gpio; +unsigned int end; + + end =S3C2410_GPL (0 + width); + +/* Set all the necessary GPG pins to special-function 0 */ +for (gpio =S3C2410_GPL (0 ); gpio < end; gpio++) { +s3c_gpio_cfgpin (gpio,S3C_GPIO_SFN (2 )); +s3c_gpio_setpull (gpio,S3C_GPIO_PULL_NONE ); + }
s3c_gpio_cfgrange_nopull(S3C2410_GPL(0), width, S3C_GPIO_SFN(2));
arch/arm/mach-s3c2416/setup-sdhci-gpio.c line 57
Quoted 5 lines
arch/arm/mach-s3c2416/setup-sdhci-gpio.c new file +5
-0+ +s3c_gpio_cfgpin (S3C2410_GPL (8 ),S3C_GPIO_SFN (2 )); +s3c_gpio_setpull (S3C2410_GPL (8 ),S3C_GPIO_PULL_NONE ); +s3c_gpio_cfgpin (S3C2410_GPL (9 ),S3C_GPIO_SFN (2 )); +s3c_gpio_setpull (S3C2410_GPL (9 ),S3C_GPIO_PULL_NONE );
s3c_gpio_cfgranbe_nopull(S3C2410_GPL(8), 2, S3C_GPIO_SFN(2));
arch/arm/mach-s3c2416/setup-sdhci-gpio.c line 45
Quoted 3 lines
arch/arm/mach-s3c2416/setup-sdhci-gpio.c new file +3
-0+} + +
no need above empty lines...
Quoted 59 lines
arch/arm/mach- renamed from arch/arm/mach-s3c2416/setup-sdhci.c +0
-0
s3c2416/setup-sdhci.c
new file mode 100644
index 0000000..345ddd1arch/arm/mach-s3c2416/setup-sdhci.c new file +52
-0@@ -0,0 +1,62 @@ +/* linux/arch/arm/mach-s3c2416/setup-sdhci.c +* +* Copyright 2010 Promwad Innovation Company +* Yauhen Kharuzhy <[email protected]> +* +* S3C2416 - Helper functions for settign up SDHCI device(s) (HSMMC) +* +* Based on mach-s3c64xx/setup-sdhci.c +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ + +#include <linux/kernel.h> +#include <linux/types.h> +#include <linux/interrupt.h> +#include <linux/platform_device.h> +#include <linux/io.h> + +#include <linux/mmc/card.h> +#include <linux/mmc/host.h> + +#include <plat/regs-sdhci.h> +#include <plat/sdhci.h> + +/* clock sources for the mmc bus clock, order as for the ctrl2[5..4] */ + +char *s3c2416_hsmmc_clksrcs[4 ] = { + [0 ] ="hsmmc" , + [1 ] ="hsmmc" , + [2 ] ="hsmmc-if" , +/* [3] = "48m", - note not successfully used yet */ +}; + +void s3c2416_setup_sdhci_cfg_card (struct platform_device *dev, +void __iomem *r, +struct mmc_ios *ios, +struct mmc_card *card) +{ +u32 ctrl2, ctrl3; + + ctrl2 =readl (r +S3C_SDHCI_CONTROL2 ); + ctrl2 &=S3C_SDHCI_CTRL2_SELBASECLK_MASK ; + ctrl2 |= (S3C64XX_SDHCI_CTRL2_ENSTAASYNCCLR | +S3C64XX_SDHCI_CTRL2_ENCMDCNFMSK | +S3C_SDHCI_CTRL2_ENFBCLKRX | +S3C_SDHCI_CTRL2_DFCNT_NONE | +S3C_SDHCI_CTRL2_ENCLKOUTHOLD ); + +if (ios->clock <25 *1000000 ) + ctrl3 = (S3C_SDHCI_CTRL3_FCSEL3 |
arch/arm/mach-s3c2416/setup-sdhci.c line 62
Quoted 10 lines
arch/arm/mach-s3c2416/setup-sdhci.c new file +10
-0+S3C_SDHCI_CTRL3_FCSEL2 | +S3C_SDHCI_CTRL3_FCSEL1 | + S3C_SDHCI_CTRL3_FCSEL0); + else + ctrl3 = (S3C_SDHCI_CTRL3_FCSEL1 |S3C_SDHCI_CTRL3_FCSEL0 ); + +writel (ctrl2, r +S3C_SDHCI_CONTROL2 ); +writel (ctrl3, r +S3C_SDHCI_CONTROL3 ); +} +
no need above empty line.
arch/arm/plat-samsung/include/plat/sdhci.h extern void s3c64xx_setup_sdhci2_cfg_gpio(struct · line 79
Quoted 8 lines
arch/arm/plat- renamed from arch/arm/plat-samsung/include/plat/sdhci.h +0
-0
samsung/include/plat/sdhci.h
index 13f9fb2..d408140 100644arch/arm/plat-samsung/include/plat/sdhci.h +0
-0@@ -78,6 +78,8 @@ extern void s3c64xx_setup_sdhci2_cfg_gpio(struct platform_device *, int w); extern void s5pv210_setup_sdhci0_cfg_gpio(struct platform_device *, int
w);
arch/arm/plat-samsung/include/plat/sdhci.h extern void s3c64xx_setup_sdhci2_cfg_gpio(struct · line 80
Quoted 1 line
arch/arm/plat-samsung/include/plat/sdhci.h +0
-0extern void s5pv210_setup_sdhci1_cfg_gpio(struct platform_device *, int
w);
arch/arm/plat-samsung/include/plat/sdhci.h extern void s3c64xx_setup_sdhci2_cfg_gpio(struct · line 81
Quoted 1 line
arch/arm/plat-samsung/include/plat/sdhci.h +0
-0extern void s5pv210_setup_sdhci2_cfg_gpio(struct platform_device *, int
w);
arch/arm/plat-samsung/include/plat/sdhci.h extern void s3c64xx_setup_sdhci2_cfg_gpio(struct · line 82
Quoted 1 line
arch/arm/plat-samsung/include/plat/sdhci.h +1
-0+extern void s3c2416_setup_sdhci0_cfg_gpio(struct platform_device *, int
w);
arch/arm/plat-samsung/include/plat/sdhci.h extern void s3c64xx_setup_sdhci2_cfg_gpio(struct · line 83
Quoted 1 line
arch/arm/plat-samsung/include/plat/sdhci.h +1
-0+extern void s3c2416_setup_sdhci1_cfg_gpio(struct platform_device *, int
w);
Quoted 16 lines
arch/arm/plat-samsung/include/plat/sdhci.h +9
-0/* S3C6400 SDHCI setup */ @@ -270,6 +272,38 @@ static inline void s5pv210_default_sdhci1(void) { }static inline void s5pv210_default_sdhci2 (void ) { }#endif /* CONFIG_S5PC100_SETUP_SDHCI */ +/* S3C2416 SDHCI setup */ +#ifdef CONFIG_S3C2416_SETUP_SDHCI +extern char *s3c2416_hsmmc_clksrcs[4 ]; + +extern void s3c2416_setup_sdhci_cfg_card (struct platform_device *dev, +void __iomem *r, +struct mmc_ios *ios, +struct mmc_card *card); +
arch/arm/plat-samsung/include/plat/sdhci.h static inline void s5pv210_default_sdhci1(void) { } · line 293
Quoted 10 lines
arch/arm/plat-samsung/include/plat/sdhci.h +10
-0+#ifdef CONFIG_S3C_DEV_HSMMC +static inline void s3c2416_default_sdhci0 (void ) +{ + s3c_hsmmc0_def_platdata.clocks = s3c2416_hsmmc_clksrcs; + s3c_hsmmc0_def_platdata.cfg_gpio = s3c2416_setup_sdhci0_cfg_gpio; + s3c_hsmmc0_def_platdata.cfg_card = s3c2416_setup_sdhci_cfg_card; +} +#else +static inline void s3c2416_default_sdhci0 (void ) { } +#endif /* CONFIG_S3C_DEV_HSMMC */
could you please update above like current plat-samung/include/plat/sdhci.h?
Quoted 6 lines
arch/arm/plat-samsung/include/plat/sdhci.h +6
-0+ +#ifdef CONFIG_S3C_DEV_HSMMC1 +static inline void s3c2416_default_sdhci1 (void ) +{ + s3c_hsmmc1_def_platdata.clocks = s3c2416_hsmmc_clksrcs; + s3c_hsmmc1_def_platdata.cfg_gpio = s3c2416_setup_sdhci1_cfg_gpio;
arch/arm/plat-samsung/include/plat/sdhci.h static inline void s5pv210_default_sdhci1(void) { } · line 309
Quoted 10 lines
arch/arm/plat-samsung/include/plat/sdhci.h +7
-0+ s3c_hsmmc1_def_platdata.cfg_card = s3c2416_setup_sdhci_cfg_card; +} +#else +static inline void s3c2416_default_sdhci1 (void ) { } +#endif /* CONFIG_S3C_DEV_HSMMC1 */ + +#endif /* CONFIG_S3C2416_SETUP_SDHCI */
No need above empty lines...
Quoted 1 line
--
Thanks.
Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.