Skip to contentSkip to conversation

SDHCI-S3C fixes and enhancements (platform specific code)

PATCH New Marek Szyprowski 5 participants 14 messages Jun 9, 2010 – Jun 22, 2010

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

PATCH 1/1 SDHCI-S3C fixes and enhancements (platform specific code)

Hello,

This series includes various fixes to sdhci-s3c driver as well as a major feature enhancement. This patch series is prepared to get complete sdhci support on Samsung Aquila board.

A quick overview on the patches:

#1 - trivial compilation break fix
#2 - add support for various methods of notifying the host driver about
the card insertion/removal (should be compatible with existing code)
#3 - add sdhci driver platform data for all hsmmc controllers on Samsung
Aquila board

Changes to the sdhci-s3c driver itself will be posted in a separate patch series for easier merging, please refer to the "[PATCH] SDHCI-S3C fixes and enhancements (driver specific code)" thread.

A complete list of patches:

[PATCH 1/3] s3c64xx: Fix build without SDHCI controllers [PATCH 2/3] Samsung: sdhci-s3c: add support for new card detection methods [PATCH 3/3] s5pv210: Aquila: add definitions for sdhci devices

Best regards

Signature · 2 lines
Marek Szyprowski
Samsung Poland R&D Center
#1 lore raw

PATCH 1/3 s3c64xx: Fix build without SDHCI controllers

This patch fixes the following compilation problem if only NCP machine is selected:

arch/arm/mach-s3c64xx/s3c6410.c: In function ?s3c6410_map_io?:
arch/arm/mach-s3c64xx/s3c6410.c:51: error: implicit declaration of function ?s3c6410_default_sdhci2?

---
 arch/arm/plat-samsung/include/plat/sdhci.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
arch/arm/plat-samsung/include/plat/sdhci.h +1 -0
index 13f9fb2..c2044e5 100644
@@ -166,6 +166,7 @@ static inline void s3c6410_default_sdhci2(void) { }
 #else
 static inline void s3c6410_default_sdhci0(void) { }
 static inline void s3c6410_default_sdhci1(void) { }
+static inline void s3c6410_default_sdhci2(void) { }
 static inline void s3c6400_default_sdhci0(void) { }
 static inline void s3c6400_default_sdhci1(void) { }
 
Signature · 1 line
1.7.1.240.g225c
#2 lore raw

PATCH 1/3 s3c64xx: Fix build without SDHCI controllers

Quoted 20 lines · Marek Szyprowski

This patch fixes the following compilation problem if only NCP machine is selected:

arch/arm/mach-s3c64xx/s3c6410.c: In function ?s3c6410_map_io?:
arch/arm/mach-s3c64xx/s3c6410.c:51: error: implicit declaration of function ?s3c6410_default_sdhci2?

---
 arch/arm/plat-samsung/include/plat/sdhci.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
arch/arm/plat- renamed from arch/arm/plat-samsung/include/plat/sdhci.h +0 -0

samsung/include/plat/sdhci.h
index 13f9fb2..c2044e5 100644

arch/arm/plat-samsung/include/plat/sdhci.h static inline void s3c6410_default_sdhci2(void) { }

Quoted 8 lines
arch/arm/plat-samsung/include/plat/sdhci.h +1 -1
@@ -166,6 +166,7 @@ static inline void s3c6410_default_sdhci2(void) { }
 #else
 static inline void s3c6410_default_sdhci0(void) { }
 static inline void s3c6410_default_sdhci1(void) { }
+static inline void s3c6410_default_sdhci2(void) { }
 static inline void s3c6400_default_sdhci0(void) { }
 static inline void s3c6400_default_sdhci1(void) { }
 
--

Maybe missed in Maurus' patch 'S3C64XX: add HSMMC2 support' commit 92b118f6968ae0788ac659af47b464acd9a754a1

Also need 'static inline s3c6400_default_sdhci2(void) { }' Could you re-submit updated patch including s3c6400_default_sdhci2()?

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.

#3 lore raw

PATCH 1/3 s3c64xx: Fix build without SDHCI controllers

Quoted 28 lines · Kukjin Kim
Quoted 27 lines · Marek Szyprowski

This patch fixes the following compilation problem if only NCP machine is selected:

arch/arm/mach-s3c64xx/s3c6410.c: In function ?s3c6410_map_io?:
arch/arm/mach-s3c64xx/s3c6410.c:51: error: implicit declaration of function ?s3c6410_default_sdhci2?

---
?arch/arm/plat-samsung/include/plat/sdhci.h | ? ?1 + ?1 files changed, 1 insertions(+), 0 deletions(-)

arch/arm/plat- renamed from arch/arm/plat-samsung/include/plat/sdhci.h +0 -0

samsung/include/plat/sdhci.h
index 13f9fb2..c2044e5 100644

arch/arm/plat-samsung/include/plat/sdhci.h +0 -0
@@ -166,6 +166,7 @@ static inline void s3c6410_default_sdhci2(void) { }

?#else
?static inline void s3c6410_default_sdhci0(void) { } ?static inline void s3c6410_default_sdhci1(void) { } +static inline void s3c6410_default_sdhci2(void) { } ?static inline void s3c6400_default_sdhci0(void) { } ?static inline void s3c6400_default_sdhci1(void) { }

Quoted 4 lines
Quoted 1 line

--

Maybe missed in Maurus' patch 'S3C64XX: add HSMMC2 support' commit 92b118f6968ae0788ac659af47b464acd9a754a1

Which kernel tree do you use?
it's against the latest kernel.

Thank you,
Kyungmin Park

Quoted 17 lines

Also need 'static inline s3c6400_default_sdhci2(void) { }' Could you re-submit updated patch including s3c6400_default_sdhci2()?

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo at vger.kernel.org
More majordomo info at ?http://vger.kernel.org/majordomo-info.html

#4 lore raw

PATCH 1/3 s3c64xx: Fix build without SDHCI controllers

Quoted 30 lines · Kyungmin Park
Quoted 28 lines · Kukjin Kim
Quoted 27 lines · Marek Szyprowski

This patch fixes the following compilation problem if only NCP machine is selected:

arch/arm/mach-s3c64xx/s3c6410.c: In function ?s3c6410_map_io?:
arch/arm/mach-s3c64xx/s3c6410.c:51: error: implicit declaration of function ?s3c6410_default_sdhci2?

---
 arch/arm/plat-samsung/include/plat/sdhci.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
arch/arm/plat- renamed from arch/arm/plat-samsung/include/plat/sdhci.h +0 -0

samsung/include/plat/sdhci.h
index 13f9fb2..c2044e5 100644

arch/arm/plat-samsung/include/plat/sdhci.h +1 -0
@@ -166,6 +166,7 @@ static inline void s3c6410_default_sdhci2(void) { }
 #else
 static inline void s3c6410_default_sdhci0(void) { }
 static inline void s3c6410_default_sdhci1(void) { }
+static inline void s3c6410_default_sdhci2(void) { }
 static inline void s3c6400_default_sdhci0(void) { }
 static inline void s3c6400_default_sdhci1(void) { }
 
Quoted 8 lines
Quoted 4 lines
Quoted 1 line

--

Maybe missed in Maurus' patch 'S3C64XX: add HSMMC2 support' commit 92b118f6968ae0788ac659af47b464acd9a754a1

Which kernel tree do you use?
it's against the latest kernel.

Of course, Linus' 35-rc2.
Any problem?

Quoted 4 lines
Quoted 4 lines

Also need 'static inline s3c6400_default_sdhci2(void) { }' Could you re-submit updated patch including s3c6400_default_sdhci2()?

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.

#5 lore raw

PATCH 1/3 s3c64xx: Fix build without SDHCI controllers

Quoted 49 lines

-----Original Message-----
From: Kukjin Kim [mailto:kgene.kim at samsung.com]
Sent: Friday, June 11, 2010 12:59 PM
To: 'Kyungmin Park'
Cc: 'Marek Szyprowski'; linux-arm-kernel at lists.infradead.org; linux- samsung-soc at vger.kernel.org; linux-mmc at vger.kernel.org; ben- linux at fluff.org
Subject: RE: [PATCH 1/3] s3c64xx: Fix build without SDHCI controllers

Quoted 2 lines · Kyungmin Park

On Fri, Jun 11, 2010 at 9:56 AM, Kukjin Kim <[email protected]>

Quoted 3 lines · wrote:
Quoted 3 lines
Quoted 2 lines · Marek Szyprowski

This patch fixes the following compilation problem if only NCP

machine

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

is selected:

arch/arm/mach-s3c64xx/s3c6410.c: In function ?s3c6410_map_io?:
arch/arm/mach-s3c64xx/s3c6410.c:51: error: implicit declaration of

function

Quoted 9 lines
Quoted 9 lines

Review

Quoted 9 lines

?s3c6410_default_sdhci2?

---
 arch/arm/plat-samsung/include/plat/sdhci.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
(quoted diff) +0 -0

b/arch/arm/plat-

Quoted 5 lines
Quoted 5 lines

arch/arm/plat-samsung/include/plat/sdhci.h static inline void s3c6410_default_sdhci2(void)

Quoted 5 lines

samsung/include/plat/sdhci.h
index 13f9fb2..c2044e5 100644

arch/arm/plat-samsung/include/plat/sdhci.h +0 -0
@@ -166,6 +166,7 @@ static inline void s3c6410_default_sdhci2(void)

{ }

Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
arch/arm/plat-samsung/include/plat/sdhci.h +1 -1
 #else
 static inline void s3c6410_default_sdhci0(void) { }
 static inline void s3c6410_default_sdhci1(void) { }
+static inline void s3c6410_default_sdhci2(void) { }
 static inline void s3c6400_default_sdhci0(void) { }
 static inline void s3c6400_default_sdhci1(void) { }
 
--
Quoted 7 lines
Quoted 6 lines
Quoted 2 lines

Maybe missed in Maurus' patch 'S3C64XX: add HSMMC2 support' commit 92b118f6968ae0788ac659af47b464acd9a754a1

Which kernel tree do you use?
it's against the latest kernel.

Of course, Linus' 35-rc2.

We used 63a07cb64ccc3ceae619d3298545d602ab5ecd38
And there's no s3c6410_default_sdhci2(void) .

Thank you,
Kyungmin Park

Quoted 15 lines

Any problem?

Quoted 4 lines
Quoted 4 lines

Also need 'static inline s3c6400_default_sdhci2(void) { }' Could you re-submit updated patch including s3c6400_default_sdhci2()?

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.

#6 lore raw

PATCH 1/3 s3c64xx: Fix build without SDHCI controllers

Quoted 61 lines

-----Original Message-----
From: Kyungmin Park [mailto:kyungmin.park at samsung.com]
Sent: Friday, June 11, 2010 1:35 PM
To: 'Kukjin Kim'
Cc: 'Marek Szyprowski'; linux-arm-kernel at lists.infradead.org; linux-samsung- soc at vger.kernel.org; linux-mmc at vger.kernel.org; ben-linux at fluff.org
Subject: RE: [PATCH 1/3] s3c64xx: Fix build without SDHCI controllers

Quoted 50 lines

-----Original Message-----
From: Kukjin Kim [mailto:kgene.kim at samsung.com]
Sent: Friday, June 11, 2010 12:59 PM
To: 'Kyungmin Park'
Cc: 'Marek Szyprowski'; linux-arm-kernel at lists.infradead.org; linux- samsung-soc at vger.kernel.org; linux-mmc at vger.kernel.org; ben- linux at fluff.org
Subject: RE: [PATCH 1/3] s3c64xx: Fix build without SDHCI controllers

Quoted 2 lines · Kyungmin Park

On Fri, Jun 11, 2010 at 9:56 AM, Kukjin Kim <[email protected]>

Quoted 3 lines · wrote:
Quoted 3 lines
Quoted 2 lines · Marek Szyprowski

This patch fixes the following compilation problem if only NCP

machine

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

is selected:

arch/arm/mach-s3c64xx/s3c6410.c: In function ?s3c6410_map_io?:
arch/arm/mach-s3c64xx/s3c6410.c:51: error: implicit declaration of

function

Quoted 9 lines
Quoted 9 lines

Review

Quoted 9 lines

?s3c6410_default_sdhci2?

---
 arch/arm/plat-samsung/include/plat/sdhci.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
(quoted diff) +0 -0

b/arch/arm/plat-

Quoted 5 lines
Quoted 5 lines

arch/arm/plat-samsung/include/plat/sdhci.h static inline void s3c6410_default_sdhci2(void)

Quoted 5 lines

samsung/include/plat/sdhci.h
index 13f9fb2..c2044e5 100644

arch/arm/plat-samsung/include/plat/sdhci.h +0 -0
@@ -166,6 +166,7 @@ static inline void s3c6410_default_sdhci2(void)

{ }

Quoted 12 lines
Quoted 11 lines

arch/arm/plat-samsung/include/plat/sdhci.h static inline void s3c6410_default_sdhci2(void) { }

Quoted 8 lines
arch/arm/plat-samsung/include/plat/sdhci.h +1 -1
 #else
 static inline void s3c6410_default_sdhci0(void) { }
 static inline void s3c6410_default_sdhci1(void) { }
+static inline void s3c6410_default_sdhci2(void) { }
 static inline void s3c6400_default_sdhci0(void) { }
 static inline void s3c6400_default_sdhci1(void) { }
 
--

Maybe missed in Maurus' patch 'S3C64XX: add HSMMC2 support' commit 92b118f6968ae0788ac659af47b464acd9a754a1

Quoted 8 lines
Quoted 4 lines
Quoted 3 lines

Which kernel tree do you use?
it's against the latest kernel.

Of course, Linus' 35-rc2.

We used 63a07cb64ccc3ceae619d3298545d602ab5ecd38
And there's no s3c6410_default_sdhci2(void) .

Hmm. Maybe some misunderstanding.

I meant maybe Maurus missed when he submitted HSMMC2 support patch.
(it means Marek's patch is correct)
And need 's3c6400_default_sdhci2()' as well as 's36410_default_sdhci2()' in Marek's patch. So requested to re-submit updated patch.

Quoted 9 lines
Quoted 9 lines

Any problem?

Quoted 4 lines
Quoted 4 lines

Also need 'static inline s3c6400_default_sdhci2(void) { }' Could you re-submit updated patch including s3c6400_default_sdhci2()?

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.

#7 lore raw

PATCH v2 1/1 s3c64xx: Fix build without SDHCI controllers

In reply to Kukjin Kim

This patch fixes the following compilation problem if only NCP machine is selected:

arch/arm/mach-s3c64xx/s3c6410.c: In function ?s3c6410_map_io?:
arch/arm/mach-s3c64xx/s3c6410.c:51: error: implicit declaration of function ?s3c6410_default_sdhci2?

---
 arch/arm/plat-samsung/include/plat/sdhci.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
arch/arm/plat-samsung/include/plat/sdhci.h +2 -0
index 13f9fb2..2e263a8 100644
@@ -166,8 +166,10 @@ static inline void s3c6410_default_sdhci2(void) { }
 #else
 static inline void s3c6410_default_sdhci0(void) { }
 static inline void s3c6410_default_sdhci1(void) { }
+static inline void s3c6410_default_sdhci2(void) { }
 static inline void s3c6400_default_sdhci0(void) { }
 static inline void s3c6400_default_sdhci1(void) { }
+static inline void s3c6400_default_sdhci2(void) { }
 
 #endif /* CONFIG_S3C64XX_SETUP_SDHCI */
 
Signature · 1 line
1.7.1.240.g225c
#8 lore raw

PATCH v2 1/1 s3c64xx: Fix build without SDHCI controllers

Quoted 10 lines · Marek Szyprowski

This patch fixes the following compilation problem if only NCP machine is selected:

arch/arm/mach-s3c64xx/s3c6410.c: In function ?s3c6410_map_io?:
arch/arm/mach-s3c64xx/s3c6410.c:51: error: implicit declaration of function ?s3c6410_default_sdhci2?

Applied :-)

Quoted 11 lines
---
 arch/arm/plat-samsung/include/plat/sdhci.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
arch/arm/plat- renamed from arch/arm/plat-samsung/include/plat/sdhci.h +0 -0

samsung/include/plat/sdhci.h
index 13f9fb2..2e263a8 100644

arch/arm/plat-samsung/include/plat/sdhci.h +0 -0
@@ -166,8 +166,10 @@ static inline void s3c6410_default_sdhci2(void) { }
 #else

arch/arm/plat-samsung/include/plat/sdhci.h static inline void s3c6410_default_sdhci2(void) { }

Quoted 10 lines
arch/arm/plat-samsung/include/plat/sdhci.h +2 -1
 static inline void s3c6410_default_sdhci0(void) { }
 static inline void s3c6410_default_sdhci1(void) { }
+static inline void s3c6410_default_sdhci2(void) { }
 static inline void s3c6400_default_sdhci0(void) { }
 static inline void s3c6400_default_sdhci1(void) { }
+static inline void s3c6400_default_sdhci2(void) { }
 
 #endif /* CONFIG_S3C64XX_SETUP_SDHCI */
 
--

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.

#9 lore raw

PATCH 2/3 Samsung: sdhci-s3c: add support for new card detection methods

In reply to Marek Szyprowski

On some Samsung SoCs not all SDHCI controllers have card detect (CD) line. For some embedded designs it is not even needed, because ususally the device (like SDIO flash memory or wifi controller) is permanently wired to the controller. There are also systems which have a card detect line connected to some of the external interrupt lines or the presence of the card depends on some other actions (like enabling a power regulator).

This patch adds support for all these cases. The following card detection methods are possible:

1. internal sdhci host card detect line
2. external event
3. no card detect line, controller will poll for the card
4. no card detect line, card is permanently wired to the controller (once detected host won't poll it any more)

By default, all existing code would use method #1, what is compatible with the previous version of the driver.

In case of external event, two callbacks must be provided in platdata:
ext_cd_init and ext_cd_cleanup. Both of them get a callback to a function that notifies the s3c-sdhci host contoller as their argument. That callback function should be called from the even dispatcher to let host notice the card insertion/removal.

This patch adds all required changes to platform support code.

---
 arch/arm/mach-s3c64xx/setup-sdhci-gpio.c   |   14 ++++++++++----
 arch/arm/mach-s5pc100/setup-sdhci-gpio.c   |   21 +++++++++++++++------
 arch/arm/mach-s5pv210/setup-sdhci-gpio.c   |   22 ++++++++++++++++------
 arch/arm/plat-samsung/dev-hsmmc.c          |    3 +++
 arch/arm/plat-samsung/dev-hsmmc1.c         |    3 +++
 arch/arm/plat-samsung/dev-hsmmc2.c         |    3 +++
 arch/arm/plat-samsung/include/plat/sdhci.h |   23 +++++++++++++++++++++++
 7 files changed, 73 insertions(+), 16 deletions(-)
arch/arm/mach-s3c64xx/setup-sdhci-gpio.c +10 -4
index a58c0cc..54c311c 100644
@@ -22,6 +22,7 @@
 
 void s3c64xx_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width)
 {
+	struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
 	unsigned int gpio;
 	unsigned int end;
 
@@ -33,12 +34,15 @@ void s3c64xx_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width)
 		s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
 	}
 
-	s3c_gpio_setpull(S3C64XX_GPG(6), S3C_GPIO_PULL_UP);
-	s3c_gpio_cfgpin(S3C64XX_GPG(6), S3C_GPIO_SFN(2));
+	if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) {
+		s3c_gpio_setpull(S3C64XX_GPG(6), S3C_GPIO_PULL_UP);
+		s3c_gpio_cfgpin(S3C64XX_GPG(6), S3C_GPIO_SFN(2));
+	}
 }
 
 void s3c64xx_setup_sdhci1_cfg_gpio(struct platform_device *dev, int width)
 {
+	struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
 	unsigned int gpio;
 	unsigned int end;
 
@@ -50,8 +54,10 @@ void s3c64xx_setup_sdhci1_cfg_gpio(struct platform_device *dev, int width)
 		s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
 	}
 
-	s3c_gpio_setpull(S3C64XX_GPG(6), S3C_GPIO_PULL_UP);
-	s3c_gpio_cfgpin(S3C64XX_GPG(6), S3C_GPIO_SFN(3));
+	if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) {
+		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)
arch/arm/mach-s5pc100/setup-sdhci-gpio.c +15 -6
index 7769c76..e4b6739 100644
@@ -23,6 +23,7 @@
 
 void s5pc100_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width)
 {
+	struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
 	unsigned int gpio;
 	unsigned int end;
 	unsigned int num;
@@ -47,12 +48,15 @@ void s5pc100_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width)
 		}
 	}
 
-	s3c_gpio_setpull(S5PC100_GPG1(2), S3C_GPIO_PULL_UP);
-	s3c_gpio_cfgpin(S5PC100_GPG1(2), S3C_GPIO_SFN(2));
+	if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) {
+		s3c_gpio_setpull(S5PC100_GPG1(2), S3C_GPIO_PULL_UP);
+		s3c_gpio_cfgpin(S5PC100_GPG1(2), S3C_GPIO_SFN(2));
+	}
 }
 
 void s5pc100_setup_sdhci1_cfg_gpio(struct platform_device *dev, int width)
 {
+	struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
 	unsigned int gpio;
 	unsigned int end;
 
@@ -64,12 +68,15 @@ void s5pc100_setup_sdhci1_cfg_gpio(struct platform_device *dev, int width)
 		s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
 	}
 
-	s3c_gpio_setpull(S5PC100_GPG2(6), S3C_GPIO_PULL_UP);
-	s3c_gpio_cfgpin(S5PC100_GPG2(6), S3C_GPIO_SFN(2));
+	if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) {
+		s3c_gpio_setpull(S5PC100_GPG2(6), S3C_GPIO_PULL_UP);
+		s3c_gpio_cfgpin(S5PC100_GPG2(6), S3C_GPIO_SFN(2));
+	}
 }
 
 void s5pc100_setup_sdhci2_cfg_gpio(struct platform_device *dev, int width)
 {
+	struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
 	unsigned int gpio;
 	unsigned int end;
 
@@ -81,6 +88,8 @@ void s5pc100_setup_sdhci2_cfg_gpio(struct platform_device *dev, int width)
 		s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
 	}
 
-	s3c_gpio_setpull(S5PC100_GPG3(6), S3C_GPIO_PULL_UP);
-	s3c_gpio_cfgpin(S5PC100_GPG3(6), S3C_GPIO_SFN(2));
+	if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) {
+		s3c_gpio_setpull(S5PC100_GPG3(6), S3C_GPIO_PULL_UP);
+		s3c_gpio_cfgpin(S5PC100_GPG3(6), S3C_GPIO_SFN(2));
+	}
 }
arch/arm/mach-s5pv210/setup-sdhci-gpio.c +16 -6
index fe7d86d..b3ad243 100644
@@ -21,9 +21,11 @@
 #include <mach/gpio.h>
 #include <plat/gpio-cfg.h>
 #include <plat/regs-sdhci.h>
+#include <plat/sdhci.h>
 
 void s5pv210_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width)
 {
+	struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
 	unsigned int gpio;
 
 	/* Set all the necessary GPG0/GPG1 pins to special-function 2 */
@@ -48,12 +50,15 @@ void s5pv210_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width)
 		break;
 	}
 
-	s3c_gpio_setpull(S5PV210_GPG0(2), S3C_GPIO_PULL_UP);
-	s3c_gpio_cfgpin(S5PV210_GPG0(2), S3C_GPIO_SFN(2));
+	if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) {
+		s3c_gpio_setpull(S5PV210_GPG0(2), S3C_GPIO_PULL_UP);
+		s3c_gpio_cfgpin(S5PV210_GPG0(2), S3C_GPIO_SFN(2));
+	}
 }
 
 void s5pv210_setup_sdhci1_cfg_gpio(struct platform_device *dev, int width)
 {
+	struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
 	unsigned int gpio;
 
 	/* Set all the necessary GPG1[0:1] pins to special-function 2 */
@@ -68,12 +73,15 @@ void s5pv210_setup_sdhci1_cfg_gpio(struct platform_device *dev, int width)
 		s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
 	}
 
-	s3c_gpio_setpull(S5PV210_GPG1(2), S3C_GPIO_PULL_UP);
-	s3c_gpio_cfgpin(S5PV210_GPG1(2), S3C_GPIO_SFN(2));
+	if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) {
+		s3c_gpio_setpull(S5PV210_GPG1(2), S3C_GPIO_PULL_UP);
+		s3c_gpio_cfgpin(S5PV210_GPG1(2), S3C_GPIO_SFN(2));
+	}
 }
 
 void s5pv210_setup_sdhci2_cfg_gpio(struct platform_device *dev, int width)
 {
+	struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
 	unsigned int gpio;
 
 	/* Set all the necessary GPG2[0:1] pins to special-function 2 */
@@ -99,6 +107,8 @@ void s5pv210_setup_sdhci2_cfg_gpio(struct platform_device *dev, int width)
 		break;
 	}
 
-	s3c_gpio_setpull(S5PV210_GPG2(2), S3C_GPIO_PULL_UP);
-	s3c_gpio_cfgpin(S5PV210_GPG2(2), S3C_GPIO_SFN(2));
+	if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) {
+		s3c_gpio_setpull(S5PV210_GPG2(2), S3C_GPIO_PULL_UP);
+		s3c_gpio_cfgpin(S5PV210_GPG2(2), S3C_GPIO_SFN(2));
+	}
 }
arch/arm/plat-samsung/dev-hsmmc.c +3 -0
index 4c05b39..238c6a1 100644
@@ -60,6 +60,9 @@ void s3c_sdhci0_set_platdata(struct s3c_sdhci_platdata *pd)
 	struct s3c_sdhci_platdata *set = &s3c_hsmmc0_def_platdata;
 
 	set->max_width = pd->max_width;
+	set->cd_type = pd->cd_type;
+	set->ext_cd_init = pd->ext_cd_init;
+	set->ext_cd_cleanup = pd->ext_cd_cleanup;
 
 	if (pd->cfg_gpio)
 		set->cfg_gpio = pd->cfg_gpio;
arch/arm/plat-samsung/dev-hsmmc1.c +3 -0
index e49bc4c..1da8481 100644
@@ -60,6 +60,9 @@ void s3c_sdhci1_set_platdata(struct s3c_sdhci_platdata *pd)
 	struct s3c_sdhci_platdata *set = &s3c_hsmmc1_def_platdata;
 
 	set->max_width = pd->max_width;
+	set->cd_type = pd->cd_type;
+	set->ext_cd_init = pd->ext_cd_init;
+	set->ext_cd_cleanup = pd->ext_cd_cleanup;
 
 	if (pd->cfg_gpio)
 		set->cfg_gpio = pd->cfg_gpio;
arch/arm/plat-samsung/dev-hsmmc2.c +3 -0
index 824580b..f11b1ca 100644
@@ -61,6 +61,9 @@ void s3c_sdhci2_set_platdata(struct s3c_sdhci_platdata *pd)
 	struct s3c_sdhci_platdata *set = &s3c_hsmmc2_def_platdata;
 
 	set->max_width = pd->max_width;
+	set->cd_type = pd->cd_type;
+	set->ext_cd_init = pd->ext_cd_init;
+	set->ext_cd_cleanup = pd->ext_cd_cleanup;
 
 	if (pd->cfg_gpio)
 		set->cfg_gpio = pd->cfg_gpio;
arch/arm/plat-samsung/include/plat/sdhci.h +23 -0
index c2044e5..6f00a76 100644
@@ -20,10 +20,27 @@ struct mmc_host;
 struct mmc_card;
 struct mmc_ios;
 
+enum cd_types {
+	S3C_SDHCI_CD_INTERNAL,	/* use mmc internal CD line */
+	S3C_SDHCI_CD_EXTERNAL,	/* use external method (like GPIO interrupt) */
+	S3C_SDHCI_CD_NONE,	/* no CD line, use polling to detect card */
+	S3C_SDHCI_CD_PERMANENT,	/* no CD line, card permanently wired to host */
+};
+
 /**
  * struct s3c_sdhci_platdata() - Platform device data for Samsung SDHCI
  * @max_width: The maximum number of data bits supported.
  * @host_caps: Standard MMC host capabilities bit field.
+ * @cd_type: Type of Card Detection method (see cd_types enum above)
+ * @ext_cd_init: Initialize external card detect subsystem. Called on
+ *		 sdhci-s3c driver probe when cd_type == S3C_SDHCI_CD_EXTERNAL.
+ *		 notify_func argument is a callback to the sdhci-s3c driver
+ *		 that triggers the card detection event. Callback arguments:
+ *		 dev is pointer to platform device of the host controller,
+ *		 state is new state of the card (0 - removed, 1 - inserted).
+ * @ext_cd_cleanup: Cleanup external card detect subsystem. Called on
+ *		 sdhci-s3c driver remove when cd_type == S3C_SDHCI_CD_EXTERNAL.
+ *		 notify_func argument is the same callback as for ext_cd_init.
  * @cfg_gpio: Configure the GPIO for a specific card bit-width
  * @cfg_card: Configure the interface for a specific card and speed. This
  *            is necessary the controllers and/or GPIO blocks require the
@@ -37,9 +54,15 @@ struct mmc_ios;
 struct s3c_sdhci_platdata {
 	unsigned int	max_width;
 	unsigned int	host_caps;
+	enum cd_types	cd_type;
 
 	char		**clocks;	/* set of clock sources */
 
+	int 	(*ext_cd_init)(void (*notify_func)(struct platform_device *,
+						   int state));
+	int 	(*ext_cd_cleanup)(void (*notify_func)(struct platform_device *,
+						      int state));
+
 	void	(*cfg_gpio)(struct platform_device *dev, int width);
 	void	(*cfg_card)(struct platform_device *dev,
 			    void __iomem *regbase,
Signature · 1 line
1.7.1.240.g225c
#10 lore raw

PATCH 3/3 s5pv210: Aquila: add definitions for sdhci devices

In reply to Marek Szyprowski

This patch add support for SDHCI blocks on Samsung Aquila board. The following host controllers are defined:
1. Internal MoviNAND device (permanently wired to the controller)
2. Internal WiFI SDIO device (card is activated by power regualor)
3. External MMC/SD socket (card detection is provided by external gpio interrupt)

---
 arch/arm/mach-s5pv210/Kconfig       |    4 ++
 arch/arm/mach-s5pv210/mach-aquila.c |   66 +++++++++++++++++++++++++++++++++++
 2 files changed, 70 insertions(+), 0 deletions(-)
arch/arm/mach-s5pv210/Kconfig +4 -0
index b7a2f38..dcc9d74 100644
@@ -57,7 +57,11 @@ config MACH_AQUILA
 	select CPU_S5PV210
 	select ARCH_SPARSEMEM_ENABLE
 	select S5PV210_SETUP_FB_24BPP
+	select S5PV210_SETUP_SDHCI
 	select S3C_DEV_FB
+	select S3C_DEV_HSMMC
+	select S3C_DEV_HSMMC1
+	select S3C_DEV_HSMMC2
 	select S5PC110_DEV_ONENAND
 	help
 	  Machine support for the Samsung Aquila target based on S5PC110 SoC
arch/arm/mach-s5pv210/mach-aquila.c +66 -0

99 lines not on this page · raw message

Signature · 1 line
1.7.1.240.g225c
#11 lore raw

PATCH 3/3 s5pv210: Aquila: add definitions for sdhci devices

Quoted 76 lines · Marek Szyprowski

This patch add support for SDHCI blocks on Samsung Aquila board. The following host controllers are defined:
1. Internal MoviNAND device (permanently wired to the controller)
2. Internal WiFI SDIO device (card is activated by power regualor)
3. External MMC/SD socket (card detection is provided by external gpio interrupt)

---
 arch/arm/mach-s5pv210/Kconfig       |    4 ++
 arch/arm/mach-s5pv210/mach-aquila.c |   66 +++++++++++++++++++++++++++++++++++
 2 files changed, 70 insertions(+), 0 deletions(-)
arch/arm/mach-s5pv210/Kconfig +4 -0
index b7a2f38..dcc9d74 100644
@@ -57,7 +57,11 @@ config MACH_AQUILA
 	select CPU_S5PV210
 	select ARCH_SPARSEMEM_ENABLE
 	select S5PV210_SETUP_FB_24BPP
+	select S5PV210_SETUP_SDHCI
 	select S3C_DEV_FB
+	select S3C_DEV_HSMMC
+	select S3C_DEV_HSMMC1
+	select S3C_DEV_HSMMC2
 	select S5PC110_DEV_ONENAND
 	help
 	  Machine support for the Samsung Aquila target based on S5PC110 SoC
arch/arm/mach-s5pv210/mach-aquila.c +18 -0
index fb9dbb2..1b7fe79 100644
@@ -13,6 +13,7 @@
 #include <linux/init.h>
 #include <linux/serial_core.h>
 #include <linux/fb.h>
+#include <linux/gpio.h>
 
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
@@ -22,12 +23,15 @@
 #include <mach/map.h>
 #include <mach/regs-clock.h>
 #include <mach/regs-fb.h>
+#include <mach/regs-gpio.h>
 
 #include <plat/regs-serial.h>
 #include <plat/s5pv210.h>
 #include <plat/devs.h>
 #include <plat/cpu.h>
 #include <plat/fb.h>
+#include <plat/gpio-cfg.h>
+#include <plat/sdhci.h>
 
 /* Following are default values for UCON, ULCON and UFCON UART registers */
 #define S5PV210_UCON_DEFAULT	(S3C2410_UCON_TXILEVEL |	\
@@ -116,9 +120,66 @@ static struct s3c_fb_platdata aquila_lcd_pdata __initdata = {
 	.setup_gpio	= s5pv210_fb_gpio_setup_24bpp,
 };
 
+/* MoviNAND */
+static struct s3c_sdhci_platdata aquila_hsmmc0_data __initdata = {
+	.max_width		= 4,
+	.cd_type		= S3C_SDHCI_CD_PERMANENT,
+};
+
+/* Wireless LAN */
+static struct s3c_sdhci_platdata aquila_hsmmc1_data __initdata = {
+	.max_width		= 4,
+	.cd_type		= S3C_SDHCI_CD_EXTERNAL,
+	/* ext_cd_{init,cleanup} callbacks will be added later */
+};
+
+/* External Flash */

arch/arm/mach-s5pv210/mach-aquila.c static struct s3c_fb_platdata aquila_lcd_pdata __initdata = { · line 146

Quoted 10 lines
arch/arm/mach-s5pv210/mach-aquila.c +10 -0
+#define AQUILA_EXT_FLASH_IRQ	IRQ_EINT(28)	/* S5PV210_GPH3(4) */
+#define AQUILA_EXT_FLASH_EN	S5PV210_MP05(4)
+#define AQUILA_EXT_FLASH_CD	S5PV210_GPH3(4)
+
+static irqreturn_t aquila_ext_flash_card_detect_isr(int irq, void *dev_id)
+{
+	void (*notify_func)(struct platform_device *, int state) = dev_id;
+	notify_func(&s3c_device_hsmmc2, !gpio_get_value(AQUILA_EXT_FLASH_CD));
+	return IRQ_HANDLED;
+}

hmm, not very nice this.

I'd much prefer to see a gpio-based handler in either the sdhci core or at-least in the driver's directory since I'm sure that his is (a) something Thomas Abrahama has already published patches for (which do need work) and
(b) probably going to be needed by other boards and/or other architectures.

Quoted 58 lines
arch/arm/mach-s5pv210/mach-aquila.c +37 -0
+static int aquila_ext_flash_card_detect_init(
+		void (*notify_func)(struct platform_device *, int state))
+{
+	gpio_request(AQUILA_EXT_FLASH_EN, "FLASH_EN");
+	gpio_direction_output(AQUILA_EXT_FLASH_EN, 1);
+
+	if (request_irq(AQUILA_EXT_FLASH_IRQ, aquila_ext_flash_card_detect_isr,
+				IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
+				"SDHCI card detect", notify_func))
+		printk(KERN_ERR "Error: cannot request irq for External Flash\n");
+	return 0;
+}
+
+static int aquila_ext_flash_card_detect_cleanup(
+		void (*notify_func)(struct platform_device *, int state))
+{
+	free_irq(AQUILA_EXT_FLASH_IRQ, notify_func);
+	gpio_direction_output(AQUILA_EXT_FLASH_EN, 0);
+	gpio_free(AQUILA_EXT_FLASH_EN);
+	return 0;
+}
+
+static struct s3c_sdhci_platdata aquila_hsmmc2_data __initdata = {
+	.max_width		= 4,
+	.cd_type		= S3C_SDHCI_CD_EXTERNAL,
+	.ext_cd_init		= aquila_ext_flash_card_detect_init,
+	.ext_cd_cleanup		= aquila_ext_flash_card_detect_cleanup,
+};
+
 static struct platform_device *aquila_devices[] __initdata = {
 	&s3c_device_fb,
 	&s5pc110_device_onenand,
+	&s3c_device_hsmmc0,
+	&s3c_device_hsmmc1,
+	&s3c_device_hsmmc2,
 };
 
 static void __init aquila_map_io(void)
@@ -130,6 +191,11 @@ static void __init aquila_map_io(void)
 
 static void __init aquila_machine_init(void)
 {
+	/* SDHCI */
+	s3c_sdhci0_set_platdata(&aquila_hsmmc0_data);
+	s3c_sdhci1_set_platdata(&aquila_hsmmc1_data);
+	s3c_sdhci2_set_platdata(&aquila_hsmmc2_data);
+
 	/* FB */
 	s3c_fb_set_platdata(&aquila_lcd_pdata);
 
Signature · 7 lines
1.7.1.240.g225c


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Signature · 5 lines
-- 
Ben

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

PATCH 3/3 s5pv210: Aquila: add definitions for sdhci devices

Hello,

Quoted 96 lines · Ben Dooks
Quoted 7 lines · Marek Szyprowski

This patch add support for SDHCI blocks on Samsung Aquila board. The following host controllers are defined:
1. Internal MoviNAND device (permanently wired to the controller)
2. Internal WiFI SDIO device (card is activated by power regualor)
3. External MMC/SD socket (card detection is provided by external gpio interrupt)

Quoted 5 lines
---
 arch/arm/mach-s5pv210/Kconfig       |    4 ++
 arch/arm/mach-s5pv210/mach-aquila.c |   66

+++++++++++++++++++++++++++++++++++

arch/arm/mach-

Quoted 3 lines
 2 files changed, 70 insertions(+), 0 deletions(-)
arch/arm/mach- renamed from arch/arm/mach-s5pv210/Kconfig +0 -0

s5pv210/Kconfig

arch/arm/mach-

Quoted 16 lines

index b7a2f38..dcc9d74 100644

arch/arm/mach-s5pv210/Kconfig +4 -0
@@ -57,7 +57,11 @@ config MACH_AQUILA
 	select CPU_S5PV210
 	select ARCH_SPARSEMEM_ENABLE
 	select S5PV210_SETUP_FB_24BPP
+	select S5PV210_SETUP_SDHCI
 	select S3C_DEV_FB
+	select S3C_DEV_HSMMC
+	select S3C_DEV_HSMMC1
+	select S3C_DEV_HSMMC2
 	select S5PC110_DEV_ONENAND
 	help
 	  Machine support for the Samsung Aquila target based on S5PC110 SoC
arch/arm/mach- renamed from arch/arm/mach-s5pv210/mach-aquila.c +0 -0

s5pv210/mach-aquila.c

Quoted 16 lines

index fb9dbb2..1b7fe79 100644

arch/arm/mach-s5pv210/mach-aquila.c +2 -0
@@ -13,6 +13,7 @@
 #include <linux/init.h>
 #include <linux/serial_core.h>
 #include <linux/fb.h>
+#include <linux/gpio.h>
 
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
@@ -22,12 +23,15 @@
 #include <mach/map.h>
 #include <mach/regs-clock.h>
 #include <mach/regs-fb.h>
+#include <mach/regs-gpio.h>

arch/arm/mach-s5pv210/mach-aquila.c line 36

Quoted 10 lines
arch/arm/mach-s5pv210/mach-aquila.c +2 -0
 
 #include <plat/regs-serial.h>
 #include <plat/s5pv210.h>
 #include <plat/devs.h>
 #include <plat/cpu.h>
 #include <plat/fb.h>
+#include <plat/gpio-cfg.h>
+#include <plat/sdhci.h>
 
 /* Following are default values for UCON, ULCON and UFCON UART registers

*/

arch/arm/mach-s5pv210/mach-aquila.c static struct s3c_fb_platdata aquila_lcd_pdata

Quoted 2 lines
arch/arm/mach-s5pv210/mach-aquila.c +0 -0
 #define S5PV210_UCON_DEFAULT	(S3C2410_UCON_TXILEVEL |	\
@@ -116,9 +120,66 @@ static struct s3c_fb_platdata aquila_lcd_pdata

__initdata = {

Quoted 12 lines
arch/arm/mach-s5pv210/mach-aquila.c +9 -0
 	.setup_gpio	= s5pv210_fb_gpio_setup_24bpp,
 };
 
+/* MoviNAND */
+static struct s3c_sdhci_platdata aquila_hsmmc0_data __initdata = {
+	.max_width		= 4,
+	.cd_type		= S3C_SDHCI_CD_PERMANENT,
+};
+
+/* Wireless LAN */
+static struct s3c_sdhci_platdata aquila_hsmmc1_data __initdata = {
+	.max_width		= 4,

arch/arm/mach-s5pv210/mach-aquila.c static struct s3c_fb_platdata aquila_lcd_pdata __initdata = {

Quoted 10 lines
arch/arm/mach-s5pv210/mach-aquila.c +10 -0
+	.cd_type		= S3C_SDHCI_CD_EXTERNAL,
+	/* ext_cd_{init,cleanup} callbacks will be added later */
+};
+
+/* External Flash */
+#define AQUILA_EXT_FLASH_IRQ	IRQ_EINT(28)	/* S5PV210_GPH3(4) */
+#define AQUILA_EXT_FLASH_EN	S5PV210_MP05(4)
+#define AQUILA_EXT_FLASH_CD	S5PV210_GPH3(4)
+
+static irqreturn_t aquila_ext_flash_card_detect_isr(int irq, void

*dev_id)

arch/arm/mach-s5pv210/mach-aquila.c static struct s3c_fb_platdata aquila_lcd_pdata __initdata = { · line 146

Quoted 5 lines
arch/arm/mach-s5pv210/mach-aquila.c +5 -0
+{
+	void (*notify_func)(struct platform_device *, int state) = dev_id;
+	notify_func(&s3c_device_hsmmc2, !gpio_get_value(AQUILA_EXT_FLASH_CD));
+	return IRQ_HANDLED;
+}

hmm, not very nice this.

Quoted 4 lines

I'd much prefer to see a gpio-based handler in either the sdhci core or at-least in the driver's directory since I'm sure that his is (a) something Thomas Abrahama has already published patches for (which do need work) and
(b) probably going to be needed by other boards and/or other architectures.

I thought about adding the external gpio logic directly to sdhci-s3c driver, but then I realized that it would not cover all our cases. For wifi sdio card we need different solution - the card will be 'inserted' and 'removed' by a power regulator glue code (called by rfkill framework). I'm really convinced that adding support for such special case to sdhci-s3c driver is not a good idea, that's why I came with the idea of 'external event' support for card detect. I can move support for the gpio case to the sdhci-s3c driver (it will be just a new CD type - SDHCI_S3C_GPIO).

I'm really open for the discussion how this can be handled in other ways.

Best regards
--
Marek Szyprowski
Samsung Poland R&D Center

#13 lore raw

PATCH 3/3 s5pv210: Aquila: add definitions for sdhci devices

In reply to Ben Dooks
Quoted 90 lines · Ben Dooks
Quoted 76 lines · Marek Szyprowski

This patch add support for SDHCI blocks on Samsung Aquila board. The following host controllers are defined:
1. Internal MoviNAND device (permanently wired to the controller)
2. Internal WiFI SDIO device (card is activated by power regualor)
3. External MMC/SD socket (card detection is provided by external gpio interrupt)

---
?arch/arm/mach-s5pv210/Kconfig ? ? ? | ? ?4 ++ ?arch/arm/mach-s5pv210/mach-aquila.c | ? 66 +++++++++++++++++++++++++++++++++++ ?2 files changed, 70 insertions(+), 0 deletions(-)

arch/arm/mach-s5pv210/Kconfig +0 -0
index b7a2f38..dcc9d74 100644
@@ -57,7 +57,11 @@ config MACH_AQUILA

? ? ? select CPU_S5PV210
? ? ? select ARCH_SPARSEMEM_ENABLE
? ? ? select S5PV210_SETUP_FB_24BPP
+ ? ? select S5PV210_SETUP_SDHCI
? ? ? select S3C_DEV_FB
+ ? ? select S3C_DEV_HSMMC
+ ? ? select S3C_DEV_HSMMC1
+ ? ? select S3C_DEV_HSMMC2
? ? ? select S5PC110_DEV_ONENAND
? ? ? help
? ? ? ? Machine support for the Samsung Aquila target based on S5PC110 SoC

arch/arm/mach-s5pv210/mach-aquila.c +0 -0
index fb9dbb2..1b7fe79 100644
@@ -13,6 +13,7 @@

?#include <linux/init.h>
?#include <linux/serial_core.h>
?#include <linux/fb.h>
+#include <linux/gpio.h>

?#include <asm/mach/arch.h>
?#include <asm/mach/map.h>

arch/arm/mach-s5pv210/mach-aquila.c +0 -0
@@ -22,12 +23,15 @@

?#include <mach/map.h>
?#include <mach/regs-clock.h>
?#include <mach/regs-fb.h>
+#include <mach/regs-gpio.h>

?#include <plat/regs-serial.h>
?#include <plat/s5pv210.h>
?#include <plat/devs.h>
?#include <plat/cpu.h>
?#include <plat/fb.h>

arch/arm/mach-s5pv210/mach-aquila.c +2 -0
+#include <plat/gpio-cfg.h>
+#include <plat/sdhci.h>

?/* Following are default values for UCON, ULCON and UFCON UART registers */ ?#define S5PV210_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | ? ? ? ?\

arch/arm/mach-s5pv210/mach-aquila.c +14 -0
@@ -116,9 +120,66 @@ static struct s3c_fb_platdata aquila_lcd_pdata __initdata = {
 ? ? ? .setup_gpio ? ? = s5pv210_fb_gpio_setup_24bpp,
 ?};
 
+/* MoviNAND */
+static struct s3c_sdhci_platdata aquila_hsmmc0_data __initdata = {
+ ? ? .max_width ? ? ? ? ? ? ?= 4,
+ ? ? .cd_type ? ? ? ? ? ? ? ?= S3C_SDHCI_CD_PERMANENT,
+};
+
+/* Wireless LAN */
+static struct s3c_sdhci_platdata aquila_hsmmc1_data __initdata = {
+ ? ? .max_width ? ? ? ? ? ? ?= 4,
+ ? ? .cd_type ? ? ? ? ? ? ? ?= S3C_SDHCI_CD_EXTERNAL,
+ ? ? /* ext_cd_{init,cleanup} callbacks will be added later */
+};
+
+/* External Flash */

arch/arm/mach-s5pv210/mach-aquila.c static struct s3c_fb_platdata aquila_lcd_pdata __initdata = { · line 146

Quoted 10 lines
arch/arm/mach-s5pv210/mach-aquila.c +10 -0
+#define AQUILA_EXT_FLASH_IRQ IRQ_EINT(28) ? ?/* S5PV210_GPH3(4) */
+#define AQUILA_EXT_FLASH_EN ?S5PV210_MP05(4)
+#define AQUILA_EXT_FLASH_CD ?S5PV210_GPH3(4)
+
+static irqreturn_t aquila_ext_flash_card_detect_isr(int irq, void *dev_id)
+{
+ ? ? void (*notify_func)(struct platform_device *, int state) = dev_id;
+ ? ? notify_func(&s3c_device_hsmmc2, !gpio_get_value(AQUILA_EXT_FLASH_CD));
+ ? ? return IRQ_HANDLED;
+}

hmm, not very nice this.

Quoted 3 lines

I'd much prefer to see a gpio-based handler in either the sdhci core or at-least in the driver's directory since I'm sure that his is (a) something Thomas Abrahama has already published patches for (which do need work) and

Maybe you see the samsung internal codes. but I think the baseline is mailing list, others are implement the same functionality with different place. can you tell me which mail has these one?

Thank you,
Kyungmin Park

Quoted 75 lines

(b) probably going to be needed by other boards and/or other architectures.

Quoted 50 lines
arch/arm/mach-s5pv210/mach-aquila.c +37 -0
+static int aquila_ext_flash_card_detect_init(
+ ? ? ? ? ? ? void (*notify_func)(struct platform_device *, int state))
+{
+ ? ? gpio_request(AQUILA_EXT_FLASH_EN, "FLASH_EN");
+ ? ? gpio_direction_output(AQUILA_EXT_FLASH_EN, 1);
+
+ ? ? if (request_irq(AQUILA_EXT_FLASH_IRQ, aquila_ext_flash_card_detect_isr,
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? "SDHCI card detect", notify_func))
+ ? ? ? ? ? ? printk(KERN_ERR "Error: cannot request irq for External Flash\n");
+ ? ? return 0;
+}
+
+static int aquila_ext_flash_card_detect_cleanup(
+ ? ? ? ? ? ? void (*notify_func)(struct platform_device *, int state))
+{
+ ? ? free_irq(AQUILA_EXT_FLASH_IRQ, notify_func);
+ ? ? gpio_direction_output(AQUILA_EXT_FLASH_EN, 0);
+ ? ? gpio_free(AQUILA_EXT_FLASH_EN);
+ ? ? return 0;
+}
+
+static struct s3c_sdhci_platdata aquila_hsmmc2_data __initdata = {
+ ? ? .max_width ? ? ? ? ? ? ?= 4,
+ ? ? .cd_type ? ? ? ? ? ? ? ?= S3C_SDHCI_CD_EXTERNAL,
+ ? ? .ext_cd_init ? ? ? ? ? ?= aquila_ext_flash_card_detect_init,
+ ? ? .ext_cd_cleanup ? ? ? ? = aquila_ext_flash_card_detect_cleanup,
+};
+
 ?static struct platform_device *aquila_devices[] __initdata = {
 ? ? ? &s3c_device_fb,
 ? ? ? &s5pc110_device_onenand,
+ ? ? &s3c_device_hsmmc0,
+ ? ? &s3c_device_hsmmc1,
+ ? ? &s3c_device_hsmmc2,
 ?};
 
 ?static void __init aquila_map_io(void)
@@ -130,6 +191,11 @@ static void __init aquila_map_io(void)
 
 ?static void __init aquila_machine_init(void)
 ?{
+ ? ? /* SDHCI */
+ ? ? s3c_sdhci0_set_platdata(&aquila_hsmmc0_data);
+ ? ? s3c_sdhci1_set_platdata(&aquila_hsmmc1_data);
+ ? ? s3c_sdhci2_set_platdata(&aquila_hsmmc2_data);
+

? ? ? /* FB */
? ? ? s3c_fb_set_platdata(&aquila_lcd_pdata);

Quoted 8 lines

--
1.7.1.240.g225c

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

--
--
Ben

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

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo at vger.kernel.org
More majordomo info at ?http://vger.kernel.org/majordomo-info.html