Skip to contentSkip to conversation

S3C64xx: add HSMMC2 support

PATCH New Maurus Cuelenaere 2 participants 3 messages Nov 20, 2009 – Nov 23, 2009

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 4/8 S3C64xx: add HSMMC2 support

This adds support for the third SDHCI controller.

---
 arch/arm/mach-s3c6400/s3c6400.c          |    1 +
 arch/arm/mach-s3c6410/cpu.c              |    1 +
 arch/arm/plat-s3c/Kconfig                |    5 ++
 arch/arm/plat-s3c/Makefile               |    1 +
 arch/arm/plat-s3c/dev-hsmmc2.c           |   68 ++++++++++++++++++++++++++++++
 arch/arm/plat-s3c/include/plat/sdhci.h   |   25 +++++++++++
 arch/arm/plat-s3c64xx/setup-sdhci-gpio.c |   20 +++++++++
 7 files changed, 121 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/plat-s3c/dev-hsmmc2.c
arch/arm/mach-s3c6400/s3c6400.c +1 -0
index b42bdd0..d876ee5 100644
@@ -45,6 +45,7 @@ void __init s3c6400_map_io(void)
 
 	s3c6400_default_sdhci0();
 	s3c6400_default_sdhci1();
+	s3c6400_default_sdhci2();
 
 	/* the i2c devices are directly compatible with s3c2440 */
 	s3c_i2c0_setname("s3c2440-i2c");
arch/arm/mach-s3c6410/cpu.c +1 -0
index 9b67c66..522c086 100644
@@ -58,6 +58,7 @@ void __init s3c6410_map_io(void)
 	/* initialise device information early */
 	s3c6410_default_sdhci0();
 	s3c6410_default_sdhci1();
+	s3c6410_default_sdhci2();
 
 	/* the i2c devices are directly compatible with s3c2440 */
 	s3c_i2c0_setname("s3c2440-i2c");
arch/arm/plat-s3c/Kconfig +5 -0
index 8931c5f..57e685b 100644
@@ -178,6 +178,11 @@ config S3C_DEV_HSMMC1
 	help
 	  Compile in platform device definitions for HSMMC channel 1
 
+config S3C_DEV_HSMMC2
+	bool
+	help
+	  Compile in platform device definitions for HSMMC channel 2
+
 config S3C_DEV_I2C1
 	bool
 	help
arch/arm/plat-s3c/Makefile +1 -0
index 3c09109..50444da 100644
@@ -36,6 +36,7 @@ obj-$(CONFIG_HAVE_PWM)		+= pwm.o
 
 obj-$(CONFIG_S3C_DEV_HSMMC)	+= dev-hsmmc.o
 obj-$(CONFIG_S3C_DEV_HSMMC1)	+= dev-hsmmc1.o
+obj-$(CONFIG_S3C_DEV_HSMMC2)	+= dev-hsmmc2.o
 obj-y				+= dev-i2c0.o
 obj-$(CONFIG_S3C_DEV_I2C1)	+= dev-i2c1.o
 obj-$(CONFIG_S3C_DEV_FB)	+= dev-fb.o
arch/arm/plat-s3c/dev-hsmmc2.c new file +68 -0

68 lines not on this page · raw message

(quoted diff) +0 -0

b/arch/arm/plat-s3c/include/plat/sdhci.h
index f615308..d5a3b41 100644

arch/arm/plat-s3c/include/plat/sdhci.h +1 -0
@@ -57,6 +57,7 @@ struct s3c_sdhci_platdata {
  */
 extern void s3c_sdhci0_set_platdata(struct s3c_sdhci_platdata *pd);
 extern void s3c_sdhci1_set_platdata(struct s3c_sdhci_platdata *pd);
+extern void s3c_sdhci2_set_platdata(struct s3c_sdhci_platdata *pd);
 
 /* Default platform data, exported so that per-cpu initialisation can
  * set the correct one when there are more than one cpu type selected.
@@ -64,11 +65,13 @@ extern void s3c_sdhci1_set_platdata(struct

s3c_sdhci_platdata *pd);

extern struct s3c_sdhci_platdata s3c_hsmmc0_def_platdata; extern struct s3c_sdhci_platdata s3c_hsmmc1_def_platdata;
+extern struct s3c_sdhci_platdata s3c_hsmmc2_def_platdata;

/* Helper function availablity */

extern void s3c64xx_setup_sdhci0_cfg_gpio(struct platform_device *, int w); extern void s3c64xx_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
+extern void s3c64xx_setup_sdhci2_cfg_gpio(struct platform_device *, int w);

/* S3C6400 SDHCI setup */

@@ -103,6 +106,17 @@ static inline void s3c6400_default_sdhci1(void)
static inline void s3c6400_default_sdhci1(void) { } #endif /* CONFIG_S3C_DEV_HSMMC1 */

+#ifdef CONFIG_S3C_DEV_HSMMC2
+static inline void s3c6400_default_sdhci2(void)
+{
+ s3c_hsmmc2_def_platdata.clocks = s3c6400_hsmmc_clksrcs;
+ s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio;
+ s3c_hsmmc2_def_platdata.cfg_card = s3c6400_setup_sdhci_cfg_card;
+}
+#else
+static inline void s3c6400_default_sdhci2(void) { } +#endif /* CONFIG_S3C_DEV_HSMMC2 */
+
#else
static inline void s3c6400_default_sdhci0(void) { } static inline void s3c6400_default_sdhci1(void) { }
@@ -140,6 +154,17 @@ static inline void s3c6410_default_sdhci1(void)
static inline void s3c6410_default_sdhci1(void) { } #endif /* CONFIG_S3C_DEV_HSMMC1 */

+#ifdef CONFIG_S3C_DEV_HSMMC2
+static inline void s3c6410_default_sdhci2(void) +{
+ s3c_hsmmc2_def_platdata.clocks = s3c6410_hsmmc_clksrcs;
+ s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio;
+ s3c_hsmmc2_def_platdata.cfg_card = s3c6410_setup_sdhci0_cfg_card;
+}
+#else
+static inline void s3c6410_default_sdhci2(void) { } +#endif /* CONFIG_S3C_DEV_HSMMC2 */
+
#else
static inline void s3c6410_default_sdhci0(void) { } static inline void s3c6410_default_sdhci1(void) { }

(quoted diff) +0 -0

b/arch/arm/plat-s3c64xx/setup-sdhci-gpio.c
index 5417123..a58c0cc 100644

arch/arm/plat-s3c64xx/setup-sdhci-gpio.c +0 -0
@@ -53,3 +53,23 @@ void s3c64xx_setup_sdhci1_cfg_gpio(struct

platform_device *dev, int width)
s3c_gpio_setpull(S3C64XX_GPG(6), S3C_GPIO_PULL_UP); s3c_gpio_cfgpin(S3C64XX_GPG(6), S3C_GPIO_SFN(3));
}
+
+void s3c64xx_setup_sdhci2_cfg_gpio(struct platform_device *dev, int width) +{
+ unsigned int gpio;
+ unsigned int end;
+
+ end = S3C64XX_GPH(6 + width);
+
+ /* Set all the necessary GPH pins to special-function 1 */
+ for (gpio = S3C64XX_GPH(6); gpio < end; gpio++) {
+ s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(3));
+ s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
+ }
+
+ /* Set all the necessary GPC pins to special-function 1 */
+ for (gpio = S3C64XX_GPC(4); gpio < S3C64XX_GPC(6); gpio++) {
+ s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(3));
+ s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
+ }
+}

Signature · 1 line
1.6.5.3
#1 lore raw

PATCH 4/8 S3C64xx: add HSMMC2 support

Quoted 72 lines · Maurus Cuelenaere

This adds support for the third SDHCI controller.

---
 arch/arm/mach-s3c6400/s3c6400.c          |    1 +
 arch/arm/mach-s3c6410/cpu.c              |    1 +
 arch/arm/plat-s3c/Kconfig                |    5 ++
 arch/arm/plat-s3c/Makefile               |    1 +
 arch/arm/plat-s3c/dev-hsmmc2.c           |   68 ++++++++++++++++++++++++++++++
 arch/arm/plat-s3c/include/plat/sdhci.h   |   25 +++++++++++
 arch/arm/plat-s3c64xx/setup-sdhci-gpio.c |   20 +++++++++
 7 files changed, 121 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/plat-s3c/dev-hsmmc2.c
arch/arm/mach-s3c6400/s3c6400.c +1 -0
index b42bdd0..d876ee5 100644
@@ -45,6 +45,7 @@ void __init s3c6400_map_io(void)
 
 	s3c6400_default_sdhci0();
 	s3c6400_default_sdhci1();
+	s3c6400_default_sdhci2();
 
 	/* the i2c devices are directly compatible with s3c2440 */
 	s3c_i2c0_setname("s3c2440-i2c");
arch/arm/mach-s3c6410/cpu.c +1 -0
index 9b67c66..522c086 100644
@@ -58,6 +58,7 @@ void __init s3c6410_map_io(void)
 	/* initialise device information early */
 	s3c6410_default_sdhci0();
 	s3c6410_default_sdhci1();
+	s3c6410_default_sdhci2();
 
 	/* the i2c devices are directly compatible with s3c2440 */
 	s3c_i2c0_setname("s3c2440-i2c");
arch/arm/plat-s3c/Kconfig +5 -0
index 8931c5f..57e685b 100644
@@ -178,6 +178,11 @@ config S3C_DEV_HSMMC1
 	help
 	  Compile in platform device definitions for HSMMC channel 1
 
+config S3C_DEV_HSMMC2
+	bool
+	help
+	  Compile in platform device definitions for HSMMC channel 2
+
 config S3C_DEV_I2C1
 	bool
 	help
arch/arm/plat-s3c/Makefile +1 -0
index 3c09109..50444da 100644
@@ -36,6 +36,7 @@ obj-$(CONFIG_HAVE_PWM)		+= pwm.o
 
 obj-$(CONFIG_S3C_DEV_HSMMC)	+= dev-hsmmc.o
 obj-$(CONFIG_S3C_DEV_HSMMC1)	+= dev-hsmmc1.o
+obj-$(CONFIG_S3C_DEV_HSMMC2)	+= dev-hsmmc2.o
 obj-y				+= dev-i2c0.o
 obj-$(CONFIG_S3C_DEV_I2C1)	+= dev-i2c1.o
 obj-$(CONFIG_S3C_DEV_FB)	+= dev-fb.o
arch/arm/plat-s3c/dev-hsmmc2.c new file +0 -0
new file mode 100644
index 0000000..49b6b68

arch/arm/plat-s3c/dev-hsmmc2.c line 5

Quoted 5 lines
arch/arm/plat-s3c/dev-hsmmc2.c new file +5 -0
@@ -0,0 +1,68 @@
+/* linux/arch/arm/plat-s3c/dev-hsmmc2.c
+ *
+ * Copyright (c) 2008 Simtec Electronics
+ *	Ben Dooks <[email protected]>
+ *	http://armlinux.simtec.co.uk/

flattering as it is to see my copyright on other people's code, this isn't right.

Either:

arch/arm/plat-s3c/dev-hsmmc2.c line 6

Quoted 1 line
arch/arm/plat-s3c/dev-hsmmc2.c new file +1 -0
+ * Based on arch/arm/plat-s3c/dev-hsmmc1.c

or better

arch/arm/plat-s3c/dev-hsmmc2.c line 8

Quoted 2 lines
arch/arm/plat-s3c/dev-hsmmc2.c new file +2 -0
+ * Based on arch/arm/plat-s3c/dev-hsmmc1.c
+ * original file Copyright (c) 2008 Simtec Electronics

and add your own copyright.

Signature · 4 lines
Ben

Q:      What's a light-year?
A:      One-third less calories than a regular year.
#2 lore raw

PATCH v2 4/8 S3C64xx: add HSMMC2 support

This adds support for the third SDHCI controller.

---
 arch/arm/mach-s3c6400/s3c6400.c          |    1 +
 arch/arm/mach-s3c6410/cpu.c              |    1 +
 arch/arm/plat-s3c/Kconfig                |    5 ++
 arch/arm/plat-s3c/Makefile               |    1 +
 arch/arm/plat-s3c/dev-hsmmc2.c           |   69 ++++++++++++++++++++++++++++++
 arch/arm/plat-s3c/include/plat/sdhci.h   |   25 +++++++++++
 arch/arm/plat-s3c64xx/setup-sdhci-gpio.c |   20 +++++++++
 7 files changed, 122 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/plat-s3c/dev-hsmmc2.c
arch/arm/mach-s3c6400/s3c6400.c +1 -0
index b42bdd0..d876ee5 100644
@@ -45,6 +45,7 @@ void __init s3c6400_map_io(void)
 
 	s3c6400_default_sdhci0();
 	s3c6400_default_sdhci1();
+	s3c6400_default_sdhci2();
 
 	/* the i2c devices are directly compatible with s3c2440 */
 	s3c_i2c0_setname("s3c2440-i2c");
arch/arm/mach-s3c6410/cpu.c +1 -0
index 9b67c66..522c086 100644
@@ -58,6 +58,7 @@ void __init s3c6410_map_io(void)
 	/* initialise device information early */
 	s3c6410_default_sdhci0();
 	s3c6410_default_sdhci1();
+	s3c6410_default_sdhci2();
 
 	/* the i2c devices are directly compatible with s3c2440 */
 	s3c_i2c0_setname("s3c2440-i2c");
arch/arm/plat-s3c/Kconfig +5 -0
index 8931c5f..57e685b 100644
@@ -178,6 +178,11 @@ config S3C_DEV_HSMMC1
 	help
 	  Compile in platform device definitions for HSMMC channel 1
 
+config S3C_DEV_HSMMC2
+	bool
+	help
+	  Compile in platform device definitions for HSMMC channel 2
+
 config S3C_DEV_I2C1
 	bool
 	help
arch/arm/plat-s3c/Makefile +1 -0
index 3c09109..50444da 100644
@@ -36,6 +36,7 @@ obj-$(CONFIG_HAVE_PWM)		+= pwm.o
 
 obj-$(CONFIG_S3C_DEV_HSMMC)	+= dev-hsmmc.o
 obj-$(CONFIG_S3C_DEV_HSMMC1)	+= dev-hsmmc1.o
+obj-$(CONFIG_S3C_DEV_HSMMC2)	+= dev-hsmmc2.o
 obj-y				+= dev-i2c0.o
 obj-$(CONFIG_S3C_DEV_I2C1)	+= dev-i2c1.o
 obj-$(CONFIG_S3C_DEV_FB)	+= dev-fb.o
arch/arm/plat-s3c/dev-hsmmc2.c new file +69 -0

69 lines not on this page · raw message

(quoted diff) +0 -0

b/arch/arm/plat-s3c/include/plat/sdhci.h
index f615308..d5a3b41 100644

arch/arm/plat-s3c/include/plat/sdhci.h +1 -0
@@ -57,6 +57,7 @@ struct s3c_sdhci_platdata {
  */
 extern void s3c_sdhci0_set_platdata(struct s3c_sdhci_platdata *pd);
 extern void s3c_sdhci1_set_platdata(struct s3c_sdhci_platdata *pd);
+extern void s3c_sdhci2_set_platdata(struct s3c_sdhci_platdata *pd);
 
 /* Default platform data, exported so that per-cpu initialisation can
  * set the correct one when there are more than one cpu type selected.
@@ -64,11 +65,13 @@ extern void s3c_sdhci1_set_platdata(struct

s3c_sdhci_platdata *pd);

extern struct s3c_sdhci_platdata s3c_hsmmc0_def_platdata; extern struct s3c_sdhci_platdata s3c_hsmmc1_def_platdata;
+extern struct s3c_sdhci_platdata s3c_hsmmc2_def_platdata;

/* Helper function availablity */

extern void s3c64xx_setup_sdhci0_cfg_gpio(struct platform_device *, int w); extern void s3c64xx_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
+extern void s3c64xx_setup_sdhci2_cfg_gpio(struct platform_device *, int w);

/* S3C6400 SDHCI setup */

@@ -103,6 +106,17 @@ static inline void s3c6400_default_sdhci1(void)
static inline void s3c6400_default_sdhci1(void) { } #endif /* CONFIG_S3C_DEV_HSMMC1 */

+#ifdef CONFIG_S3C_DEV_HSMMC2
+static inline void s3c6400_default_sdhci2(void)
+{
+ s3c_hsmmc2_def_platdata.clocks = s3c6400_hsmmc_clksrcs;
+ s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio;
+ s3c_hsmmc2_def_platdata.cfg_card = s3c6400_setup_sdhci_cfg_card;
+}
+#else
+static inline void s3c6400_default_sdhci2(void) { } +#endif /* CONFIG_S3C_DEV_HSMMC2 */
+
#else
static inline void s3c6400_default_sdhci0(void) { } static inline void s3c6400_default_sdhci1(void) { }
@@ -140,6 +154,17 @@ static inline void s3c6410_default_sdhci1(void)
static inline void s3c6410_default_sdhci1(void) { } #endif /* CONFIG_S3C_DEV_HSMMC1 */

+#ifdef CONFIG_S3C_DEV_HSMMC2
+static inline void s3c6410_default_sdhci2(void) +{
+ s3c_hsmmc2_def_platdata.clocks = s3c6410_hsmmc_clksrcs;
+ s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio;
+ s3c_hsmmc2_def_platdata.cfg_card = s3c6410_setup_sdhci0_cfg_card;
+}
+#else
+static inline void s3c6410_default_sdhci2(void) { } +#endif /* CONFIG_S3C_DEV_HSMMC2 */
+
#else
static inline void s3c6410_default_sdhci0(void) { } static inline void s3c6410_default_sdhci1(void) { }

(quoted diff) +0 -0

b/arch/arm/plat-s3c64xx/setup-sdhci-gpio.c
index 5417123..a58c0cc 100644

arch/arm/plat-s3c64xx/setup-sdhci-gpio.c +0 -0
@@ -53,3 +53,23 @@ void s3c64xx_setup_sdhci1_cfg_gpio(struct

platform_device *dev, int width)
s3c_gpio_setpull(S3C64XX_GPG(6), S3C_GPIO_PULL_UP); s3c_gpio_cfgpin(S3C64XX_GPG(6), S3C_GPIO_SFN(3));
}
+
+void s3c64xx_setup_sdhci2_cfg_gpio(struct platform_device *dev, int width) +{
+ unsigned int gpio;
+ unsigned int end;
+
+ end = S3C64XX_GPH(6 + width);
+
+ /* Set all the necessary GPH pins to special-function 1 */
+ for (gpio = S3C64XX_GPH(6); gpio < end; gpio++) {
+ s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(3));
+ s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
+ }
+
+ /* Set all the necessary GPC pins to special-function 1 */
+ for (gpio = S3C64XX_GPC(4); gpio < S3C64XX_GPC(6); gpio++) {
+ s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(3));
+ s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
+ }
+}

Signature · 1 line
1.6.5.3