Samsung: sdhci-s3c: add support for new card detection methods
Subsystems (6)
PATCH v3 1/1 Samsung: sdhci-s3c: add support for new card detection methods
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. external gpio interrupt
4. no card detect line, controller will poll for the card
5. 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.
In case of external gpio interrupt, a gpio pin number must be provided in platdata (ext_cd_gpio parameter), as well as the information about the polarity of that gpio pin (ext_cd_gpio_invert). By default (ext_cd_gpio_invert == 0) gpio value 0 means 'card has been removed', but this can be changed to 'card has been removed' when ext_cd_gpio_invert == 1.
This patch adds all required changes to platform support code.
---
This a resend of the previous patch. Relevant patches for sdhci-s3c driver has been posted in a separate patch series for easier merging, please refer to the "[PATCH] SDHCI-S3C fixes and enhancements (driver specific code)" thread. They have been already taken by Andrew Morton into his patch tracking tree.
I hope these changes to platform specific code gets merged soon, so the changes to the driver can be merged as well.
The patch has been prepared for the following git tree:git://git.kernel.org/pub/scm/linux/kernel/git/kgene/linux-samsung.git for-next
Changes since V2:
- added support for HSMMC3 device
Changes since V1:
- added support for gpio external interrupt card based detect method directly to sdhci-s3c driver
- removed s3c64xx compilation fix patch from the series
Best regards
Signature · 14 lines
Marek Szyprowski Samsung Poland R&D Center --- 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 | 5 ++++ arch/arm/plat-samsung/dev-hsmmc1.c | 5 ++++ arch/arm/plat-samsung/dev-hsmmc2.c | 5 ++++ arch/arm/plat-samsung/dev-hsmmc3.c | 5 ++++ arch/arm/plat-samsung/include/plat/sdhci.h | 29 ++++++++++++++++++++++++++++ 8 files changed, 90 insertions(+), 16 deletions(-)
arch/arm/mach-s3c64xx/setup-sdhci-gpio.c +10 -4
@@ -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
@@ -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
@@ -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 +5 -0
@@ -60,6 +60,11 @@ 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; + set->ext_cd_gpio = pd->ext_cd_gpio; + set->ext_cd_gpio_invert = pd->ext_cd_gpio_invert;if (pd->cfg_gpio) set->cfg_gpio = pd->cfg_gpio;
arch/arm/plat-samsung/dev-hsmmc1.c +5 -0
@@ -60,6 +60,11 @@ 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; + set->ext_cd_gpio = pd->ext_cd_gpio; + set->ext_cd_gpio_invert = pd->ext_cd_gpio_invert;if (pd->cfg_gpio) set->cfg_gpio = pd->cfg_gpio;
arch/arm/plat-samsung/dev-hsmmc2.c +5 -0
@@ -61,6 +61,11 @@ 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; + set->ext_cd_gpio = pd->ext_cd_gpio; + set->ext_cd_gpio_invert = pd->ext_cd_gpio_invert;if (pd->cfg_gpio) set->cfg_gpio = pd->cfg_gpio;
arch/arm/plat-samsung/dev-hsmmc3.c +5 -0
@@ -64,6 +64,11 @@ void s3c_sdhci3_set_platdata(struct s3c_sdhci_platdata *pd)struct s3c_sdhci_platdata *set = &s3c_hsmmc3_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; + set->ext_cd_gpio = pd->ext_cd_gpio; + set->ext_cd_gpio_invert = pd->ext_cd_gpio_invert;if (pd->cfg_gpio) set->cfg_gpio = pd->cfg_gpio;
arch/arm/plat-samsung/include/plat/sdhci.h +29 -0
@@ -20,10 +20,31 @@ 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 callback */ +S3C_SDHCI_CD_GPIO ,/* use external gpio pin for CD line */ +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. +* @ext_cd_gpio: gpio pin used for external CD line, valid only if +* cd_type == S3C_SDHCI_CD_GPIO +* @ext_cd_gpio_invert: invert values for external CD gpio line * @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 +58,17 @@ 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_gpio; +bool ext_cd_gpio_invert; +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.569.g6f426
PATCH v3 1/1 Samsung: sdhci-s3c: add support for new card detection methods
Quoted 55 lines · On Thu, 15 Jul 2010 10:15:21 +0200 Marek Szyprowski <[email protected]>…
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. external gpio interrupt
4. no card detect line, controller will poll for the card
5. 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_initandext_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.In case of external gpio interrupt, a gpio pin number must be provided in platdata (
ext_cd_gpioparameter), as well as the information about the polarity of that gpio pin (ext_cd_gpio_invert). By default (ext_cd_gpio_invert== 0) gpio value 0 means 'card has been removed', but this can be changed to 'card has been removed' whenext_cd_gpio_invert== 1.This patch adds all required changes to platform support code.
Signed-off-by Marek Szyprowski <[email protected]>Signed-off-by Kyungmin Park <[email protected]>---
This a resend of the previous patch. Relevant patches for sdhci-s3c driver has been posted in a separate patch series for easier merging, please refer to the "[PATCH] SDHCI-S3C fixes and enhancements (driver specific code)" thread. They have been already taken by Andrew Morton into his patch tracking tree.
I hope these changes to platform specific code gets merged soon, so the changes to the driver can be merged as well.
The patch has been prepared for the following git tree:
git://git.kernel.org/pub/scm/linux/kernel/git/kgene/linux-samsung.gitfor-nextChanges since V2:
- added support for HSMMC3 device
Quoted 21 lines
Changes since V1:
- added support for gpio external interrupt card based detect method directly to sdhci-s3c driver
- removed s3c64xx compilation fix patch from the seriesBest regards
Signature · 14 lines
Marek Szyprowski Samsung Poland R&D Center --- 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 | 5 ++++ arch/arm/plat-samsung/dev-hsmmc1.c | 5 ++++ arch/arm/plat-samsung/dev-hsmmc2.c | 5 ++++ arch/arm/plat-samsung/dev-hsmmc3.c | 5 ++++ arch/arm/plat-samsung/include/plat/sdhci.h | 29 ++++++++++++++++++++++++++++ 8 files changed, 90 insertions(+), 16 deletions(-)
This is quite confusing. You've already sent a patch called "sdhci-s3c: add support for new card detection methods". It had the same changelog as this patch and the same title, but the two patches are utterly different!
I suggest that you resend this patch under an appropriate title and with a more specific changelog, please.
PATCH v3 1/1 Samsung: sdhci-s3c: add support for new card detection methods
Hello,
Quoted 79 lines · Andrew Morton
Quoted 46 lines · On Thu, 15 Jul 2010 10:15:21 +0200 Marek Szyprowski <[email protected]>…
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. external gpio interrupt
4. no card detect line, controller will poll for the card
5. 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_initandext_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.In case of external gpio interrupt, a gpio pin number must be provided in platdata (
ext_cd_gpioparameter), as well as the information about the polarity of that gpio pin (ext_cd_gpio_invert). By default (ext_cd_gpio_invert== 0) gpio value 0 means 'card has been removed', but this can be changed to 'card has been removed' whenext_cd_gpio_invert== 1.This patch adds all required changes to platform support code.
Signed-off-by Marek Szyprowski <[email protected]>Signed-off-by Kyungmin Park <[email protected]>---
This a resend of the previous patch. Relevant patches for sdhci-s3c driver has been posted in a separate patch series for easier merging, please refer to the "[PATCH] SDHCI-S3C fixes and enhancements (driver specific code)" thread. They have been already taken by Andrew Morton into his patch tracking tree.
Quoted 5 lines
I hope these changes to platform specific code gets merged soon, so the changes to the driver can be merged as well.
The patch has been prepared for the following git tree:
git://git.kernel.org/pub/scm/linux/kernel/git/kgene/linux-samsung.gitfor-next
Quoted 16 lines
Changes since V2:
- added support for HSMMC3 deviceChanges since V1:
- added support for gpio external interrupt card based detect method directly to sdhci-s3c driver
- removed s3c64xx compilation fix patch from the seriesBest regards
--
Marek Szyprowski
Samsung Poland R&D Center---
Quoted 8 lines
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 | 5 ++++ arch/arm/plat-samsung/dev-hsmmc1.c | 5 ++++ arch/arm/plat-samsung/dev-hsmmc2.c | 5 ++++ arch/arm/plat-samsung/dev-hsmmc3.c | 5 ++++ arch/arm/plat-samsung/include/plat/sdhci.h | 29
Quoted 7 lines
++++++++++++++++++++++++++++
Quoted 1 line
8 files changed, 90 insertions(+), 16 deletions(-)This is quite confusing. You've already sent a patch called "sdhci-s3c: add support for new card detection methods". It had the same changelog as this patch and the same title, but the two patches are utterly different!
The real patch has been split into two for easier merging: 1. the driver part and 2. samsung platform related part. The part which patch belongs to is indicated in the last line of the change log.
I'm really confused how to submit properly a patch that requires changes to both the driver (which is merged by the proper driver maintainer's sub-tree) and the platform (which should go through platform maintainer's tree).
Quoted 2 lines
I suggest that you resend this patch under an appropriate title and with a more specific changelog, please.
Ok, I will add something like "(platform changes)" to the patch title next time.
Best regards
--
Marek Szyprowski
Samsung Poland R&D Center
PATCH v3 1/1 Samsung: sdhci-s3c: add support for new card detection methods
Quoted 16 lines · On Fri, 16 Jul 2010 08:24:26 +0200 Marek Szyprowski <[email protected]>…
Quoted 8 lines
Quoted 8 lines
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 | 5 ++++ arch/arm/plat-samsung/dev-hsmmc1.c | 5 ++++ arch/arm/plat-samsung/dev-hsmmc2.c | 5 ++++ arch/arm/plat-samsung/dev-hsmmc3.c | 5 ++++ arch/arm/plat-samsung/include/plat/sdhci.h | 29Quoted 7 lines
++++++++++++++++++++++++++++
Quoted 1 line
8 files changed, 90 insertions(+), 16 deletions(-)This is quite confusing. You've already sent a patch called "sdhci-s3c: add support for new card detection methods". It had the same changelog as this patch and the same title, but the two patches are utterly different!
Quoted 8 lines
The real patch has been split into two for easier merging: 1. the driver part and 2. samsung platform related part. The part which patch belongs to is indicated in the last line of the change log.
I'm really confused how to submit properly a patch that requires changes to both the driver (which is merged by the proper driver maintainer's sub-tree) and the platform (which should go through platform maintainer's tree).
Make the relationship very very clear in the changelog. Send both patches to both maintainers. Ask that one of them merge both patches and that the other ack both patches.
Anyway, I've forgotten what's happening here. I appear to be sitting on
sdhci-s3c-add-support-for-the-non-standard-minimal-clock-value.patch and sdhci-s3c-add-support-for-new-card-detection-methods.patch
the latter of which is below.
Am I missing something? Is sdhci-s3c-add-support-for-new-card-detection-methods.patch up to date?
From: Marek Szyprowski <[email protected]>
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. external gpio interrupt
4. no card detect line, controller will poll for the card
5. 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.
In case of external gpio interrupt, a gpio pin number must be provided in platdata (ext_cd_gpio parameter), as well as the information about the polarity of that gpio pin (ext_cd_gpio_invert). By default (ext_cd_gpio_invert == 0) gpio value 0 means 'card has been removed', but this can be changed to 'card has been removed' when ext_cd_gpio_invert == 1.
This patch adds changes to sdhci-s3c driver.
---
drivers/mmc/host/sdhci-s3c.c | 75 +++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+)
drivers/mmc/host/sdhci-s3c.c renamed from drivers/mmc/host/sdhci-s3c.c~sdhci-s3c-add-support-for-new-card-detection-methods +75 -0
@@ -18,6 +18,7 @@#include <linux/slab.h> #include <linux/clk.h> #include <linux/io.h> +#include <linux/gpio.h> #include <linux/mmc/host.h>
@@ -44,6 +45,8 @@ struct sdhci_s3c {struct resource *ioarea;struct s3c_sdhci_platdata *pdata;unsigned int cur_clk; +int ext_cd_irq; +int ext_cd_gpio;struct clk *clk_io;struct clk *clk_bus[MAX_BUS_CLK ];
@@ -242,6 +245,39 @@ static struct sdhci_ops sdhci_s3c_ops = .get_min_clock = sdhci_s3c_get_min_clock, }; +static void sdhci_s3c_notify_change (struct platform_device *dev,int state) +{ +struct sdhci_host *host; +unsigned long flags; + + host =platform_get_drvdata (dev); +if (host) { +spin_lock_irqsave (&host->lock, flags); +if (state) { +dev_dbg (&dev->dev,"card inserted.\n" ); + host->flags &= ~SDHCI_DEVICE_DEAD ; + host->quirks |=SDHCI_QUIRK_BROKEN_CARD_DETECTION ; +tasklet_schedule (&host->card_tasklet); + }else { +dev_dbg (&dev->dev,"card removed.\n" ); + host->flags |=SDHCI_DEVICE_DEAD ; + host->quirks &= ~SDHCI_QUIRK_BROKEN_CARD_DETECTION ; +tasklet_schedule (&host->card_tasklet); + } +spin_unlock_irqrestore (&host->lock, flags); + } +} + +static irqreturn_t sdhci_s3c_gpio_card_detect_isr (int irq,void *dev_id) +{ +struct sdhci_s3c *sc = dev_id; +int status =gpio_get_value (sc->ext_cd_gpio); +if (sc->pdata->ext_cd_gpio_invert) + status = !status; +sdhci_s3c_notify_change (sc->pdev, status); +return IRQ_HANDLED ; +} +static int __devinit sdhci_s3c_probe (struct platform_device *pdev) {struct s3c_sdhci_platdata *pdata = pdev->dev.platform_data;
@@ -279,6 +315,7 @@ static int __devinit sdhci_s3c_probe(str sc->host = host; sc->pdev = pdev; sc->pdata = pdata; + sc->ext_cd_gpio =-1 ;platform_set_drvdata (pdev, host);
@@ -361,6 +398,13 @@ static int __devinit sdhci_s3c_probe(str* SDHCI block, or a missing configuration that needs to be set. */ host->quirks |=SDHCI_QUIRK_NO_BUSY_IRQ ; +if (pdata->cd_type ==S3C_SDHCI_CD_NONE || + pdata->cd_type ==S3C_SDHCI_CD_PERMANENT ) + host->quirks |=SDHCI_QUIRK_BROKEN_CARD_DETECTION ; + +if (pdata->cd_type ==S3C_SDHCI_CD_PERMANENT ) + host->mmc->caps =MMC_CAP_NONREMOVABLE ; + host->quirks |= (SDHCI_QUIRK_32BIT_DMA_ADDR |SDHCI_QUIRK_32BIT_DMA_SIZE );
@@ -370,6 +414,27 @@ static int __devinit sdhci_s3c_probe(str goto err_add_host; } +/* pdata->ext_cd_init might call sdhci_s3c_notify_change immediately, +so it can be called only after sdhci_add_host() */ +if (pdata->cd_type ==S3C_SDHCI_CD_EXTERNAL && pdata->ext_cd_init) + pdata->ext_cd_init (&sdhci_s3c_notify_change); + +if (pdata->cd_type ==S3C_SDHCI_CD_GPIO && +gpio_is_valid (pdata->ext_cd_gpio)) { + +gpio_request (pdata->ext_cd_gpio,"SDHCI EXT CD" ); + sc->ext_cd_gpio = pdata->ext_cd_gpio; + + sc->ext_cd_irq =gpio_to_irq (pdata->ext_cd_gpio); +if (sc->ext_cd_irq && +request_irq (sc->ext_cd_irq, sdhci_s3c_gpio_card_detect_isr, +IRQF_TRIGGER_RISING |IRQF_TRIGGER_FALLING , +dev_name (&pdev->dev), sc)) { +dev_err (&pdev->dev,"cannot request irq for card detect\n" ); + sc->ext_cd_irq =0 ; + } + } +return 0 ; err_add_host:
@@ -394,10 +459,20 @@ static int __devinit sdhci_s3c_probe(str static int __devexit sdhci_s3c_remove(struct platform_device *pdev) { +struct s3c_sdhci_platdata *pdata = pdev->dev.platform_data;struct sdhci_host *host =platform_get_drvdata (pdev);struct sdhci_s3c *sc =sdhci_priv (host);int ptr; +if (pdata->cd_type ==S3C_SDHCI_CD_EXTERNAL && pdata->ext_cd_cleanup) + pdata->ext_cd_cleanup (&sdhci_s3c_notify_change); + +if (sc->ext_cd_irq) +free_irq (sc->ext_cd_irq, sdhci_s3c_gpio_card_detect_isr); + +if (sc->ext_cd_gpio !=-1 ) +gpio_free (sc->ext_cd_gpio); +sdhci_remove_host (host,1 );for (ptr =0 ; ptr <3 ; ptr++) {
_
PATCH v3 1/1 Samsung: sdhci-s3c: add support for new card detection methods
Hello,
On Thursday, July 22, 2010 1:12 AM
Quoted 25 lines
Quoted 2 lines · On Fri, 16 Jul 2010 08:24:26 +0200 Marek Szyprowski <[email protected]>…
Quoted 2 lines
Quoted 2 lines
arch/arm/mach-s3c64xx/setup-sdhci-gpio.c | 14 +++++++++--- arch/arm/mach-s5pc100/setup-sdhci-gpio.c | 21 ++++++++++++++-----
Quoted 1 line
Quoted 1 line
Quoted 1 line
arch/arm/mach-s5pv210/setup-sdhci-gpio.c | 22 +++++++++++++++-----
Quoted 17 lines
Quoted 5 lines
Quoted 5 lines
arch/arm/plat-samsung/dev-hsmmc.c | 5 ++++ arch/arm/plat-samsung/dev-hsmmc1.c | 5 ++++ arch/arm/plat-samsung/dev-hsmmc2.c | 5 ++++ arch/arm/plat-samsung/dev-hsmmc3.c | 5 ++++ arch/arm/plat-samsung/include/plat/sdhci.h | 29Quoted 7 lines
++++++++++++++++++++++++++++
Quoted 1 line
8 files changed, 90 insertions(+), 16 deletions(-)This is quite confusing. You've already sent a patch called "sdhci-s3c: add support for new card detection methods". It had the same changelog as this patch and the same title, but the two patches are utterly different!
The real patch has been split into two for easier merging: 1. the driver part and 2. samsung platform related part. The part which patch belongs to is indicated in the last line of the change log.
Quoted 8 lines
Quoted 4 lines
I'm really confused how to submit properly a patch that requires changes to both the driver (which is merged by the proper driver maintainer's sub-tree) and the platform (which should go through platform maintainer's tree).
Make the relationship very very clear in the changelog. Send both patches to both maintainers. Ask that one of them merge both patches and that the other ack both patches.
Ok. Thanks for the hint.
Quoted 3 lines
Anyway, I've forgotten what's happening here. I appear to be sitting on
sdhci-s3c-add-support-for-the-non-standard-minimal-clock-value.patch
This one is independent from the card-detection patches and can be applied directly onto linux-next kernel tree.
Quoted 8 lines
and sdhci-s3c-add-support-for-new-card-detection-methods.patch
the latter of which is below.
Am I missing something? Is sdhci-s3c-add-support-for-new-card-detection-methods.patch up to date?
Ok, I will repost these 2 patches under new names to avoid further confusion. Currently there exists two "sdhci-s3c-add-support-for-new-card-detection-methods.patch", both of them are required.
Best regards
--
Marek Szyprowski
Samsung Poland R&D Center
PATCH v3 1/1 Samsung: sdhci-s3c: add support for new card detection methods
Quoted 52 lines · On Thu, 22 Jul 2010 10:25:44 +0200 Marek Szyprowski <[email protected]>…
Hello,
On Thursday, July 22, 2010 1:12 AM
Quoted 25 lines
Quoted 2 lines · On Fri, 16 Jul 2010 08:24:26 +0200 Marek Szyprowski <[email protected]>…
Quoted 2 lines
Quoted 2 lines
arch/arm/mach-s3c64xx/setup-sdhci-gpio.c | 14 +++++++++--- arch/arm/mach-s5pc100/setup-sdhci-gpio.c | 21 ++++++++++++++-----
Quoted 1 line
Quoted 1 line
Quoted 1 line
arch/arm/mach-s5pv210/setup-sdhci-gpio.c | 22 +++++++++++++++-----
Quoted 17 lines
Quoted 5 lines
Quoted 5 lines
arch/arm/plat-samsung/dev-hsmmc.c | 5 ++++ arch/arm/plat-samsung/dev-hsmmc1.c | 5 ++++ arch/arm/plat-samsung/dev-hsmmc2.c | 5 ++++ arch/arm/plat-samsung/dev-hsmmc3.c | 5 ++++ arch/arm/plat-samsung/include/plat/sdhci.h | 29Quoted 7 lines
++++++++++++++++++++++++++++
Quoted 1 line
8 files changed, 90 insertions(+), 16 deletions(-)This is quite confusing. You've already sent a patch called "sdhci-s3c: add support for new card detection methods". It had the same changelog as this patch and the same title, but the two patches are utterly different!
The real patch has been split into two for easier merging: 1. the driver part and 2. samsung platform related part. The part which patch belongs to is indicated in the last line of the change log.
Quoted 8 lines
Quoted 4 lines
I'm really confused how to submit properly a patch that requires changes to both the driver (which is merged by the proper driver maintainer's sub-tree) and the platform (which should go through platform maintainer's tree).
Make the relationship very very clear in the changelog. Send both patches to both maintainers. Ask that one of them merge both patches and that the other ack both patches.
Ok. Thanks for the hint.
Quoted 3 lines
Anyway, I've forgotten what's happening here. I appear to be sitting on
sdhci-s3c-add-support-for-the-non-standard-minimal-clock-value.patch
This one is independent from the card-detection patches and can be applied directly onto linux-next kernel tree.
Quoted 5 lines
and sdhci-s3c-add-support-for-new-card-detection-methods.patch
the latter of which is below.
Quoted 8 lines
Quoted 3 lines
Am I missing something? Is sdhci-s3c-add-support-for-new-card-detection-methods.patch up to date?
Ok, I will repost these 2 patches under new names to avoid further confusion. Currently there exists two "sdhci-s3c-add-support-for-new-card-detection-methods.patch", both of them are required.
So the second(?) patch "[PATCH v4] Samsung: add new card detection methods in s3c-sdhci driver (platform part)" has already been applied to linux-next by Kukjin Kim, along with modifications which we have not been shown.
But the first patch (sdhci-s3c-add-support-for-the-non-standard-minimal-clock-value.patch) has not been applied to linux-next by anoyne and the third patch "[PATCH v4] sdhci-s3c: add support for new card detection methods (driver part)" has not been applied either.
This is a complete mess. What happens if I apply and merge sdhci-s3c-add-support-for-the-non-standard-minimal-clock-value.patch and sdhci-s3c-add-support-for-new-card-detection-methods-driver-part.patch? I have no idea.
I think I'll just drop all of it. Please sort all of this out then let me know what you want me to do.
PATCH v3 1/1 Samsung: sdhci-s3c: add support for new card detection methods
Hello,
Quoted 82 lines · Andrew Morton
Quoted 6 lines · On Thu, 22 Jul 2010 10:25:44 +0200 Marek Szyprowski <[email protected]>…
On Thursday, July 22, 2010 1:12 AM
Quoted 5 lines
Quoted 2 lines · On Fri, 16 Jul 2010 08:24:26 +0200 Marek Szyprowski <[email protected]>…
Quoted 2 lines
Quoted 2 lines
arch/arm/mach-s3c64xx/setup-sdhci-gpio.c | 14 +++++++++--- arch/arm/mach-s5pc100/setup-sdhci-gpio.c | 21++++++++++++++----
Quoted 2 lines
Quoted 2 lines
-
Quoted 1 line
Quoted 1 line
Quoted 1 line
arch/arm/mach-s5pv210/setup-sdhci-gpio.c | 22+++++++++++++++---
Quoted 11 lines
Quoted 11 lines
--
Quoted 10 lines
Quoted 10 lines
Quoted 5 lines
arch/arm/plat-samsung/dev-hsmmc.c | 5 ++++ arch/arm/plat-samsung/dev-hsmmc1.c | 5 ++++ arch/arm/plat-samsung/dev-hsmmc2.c | 5 ++++ arch/arm/plat-samsung/dev-hsmmc3.c | 5 ++++ arch/arm/plat-samsung/include/plat/sdhci.h | 29++++++++++++++++++++++++++++
Quoted 1 line
8 files changed, 90 insertions(+), 16 deletions(-)This is quite confusing. You've already sent a patch called "sdhci-s3c: add support for new card detection methods". It had
the
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
same changelog as this patch and the same title, but the two
patches
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
are utterly different!
The real patch has been split into two for easier merging: 1. the
driver
Quoted 1 line
Quoted 1 line
Quoted 1 line
part and 2. samsung platform related part. The part which patch
belongs
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
to is indicated in the last line of the change log.
I'm really confused how to submit properly a patch that requires
changes
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
to both the driver (which is merged by the proper driver maintainer's sub-tree) and the platform (which should go through platform
maintainer's
Quoted 9 lines
Quoted 5 lines
Quoted 1 line
tree).
Make the relationship very very clear in the changelog. Send both patches to both maintainers. Ask that one of them merge both patches and that the other ack both patches.
Ok. Thanks for the hint.
Quoted 1 line
Anyway, I've forgotten what's happening here. I appear to be sitting
on
Quoted 4 lines
Quoted 2 lines
sdhci-s3c-add-support-for-the-non-standard-minimal-clock-value.patch
This one is independent from the card-detection patches and can be
applied
Quoted 7 lines
directly onto linux-next kernel tree.
Quoted 5 lines
and sdhci-s3c-add-support-for-new-card-detection-methods.patch
the latter of which is below.
Quoted 7 lines
Quoted 3 lines
Am I missing something? Is sdhci-s3c-add-support-for-new-card-detection-methods.patch up to date?
Ok, I will repost these 2 patches under new names to avoid further confusion. Currently there exists two "sdhci-s3c-add-support-for-new-card-detection-methods.patch", both of
them
Quoted 1 line
are required.
So the second(?) patch "[PATCH v4] Samsung: add new card detection methods in s3c-sdhci driver (platform part)" has already been applied to linux-next by Kukjin Kim, along with modifications which we have not been shown.
But the first patch (sdhci-s3c-add-support-for-the-non-standard-minimal-clock-value.patch) has not been applied to linux-next by anoyne and the third patch "[PATCH v4] sdhci-s3c: add support for new card detection methods (driver part)" has not been applied either.
Quoted 5 lines
This is a complete mess. What happens if I apply and merge sdhci-s3c-add-support-for-the-non-standard-minimal-clock-value.patch and sdhci-s3c-add-support-for-new-card-detection-methods-driver-part.patch? I have no idea.
"[PATCH v4] Samsung: add new card detection methods in s3c-sdhci driver (platform part)" perform some important changes in platform setup code. It does not influence the driver itself (the driver can be still compiled as before and works without changes).
The only changes added by Kukjin Kim were compilation fixes (looks I've forgot one include on the platform that has not been tested).
This patch is also a prerequisite for "[PATCH v4] sdhci-s3c: add support for new card detection methods (driver part)".
Quoted 2 lines
I think I'll just drop all of it. Please sort all of this out then let me know what you want me to do.
I would to ask not for dropping. As all required platform changes has been already merged by Kukjin, s dhci-s3c-add-support-for-the-non-standard-minimal-clock-value.patch and sdhci-s3c-add-support-for-new-card-detection-methods-driver-part.patch can be merged without causing compilation break in the 'next' kernel tree.
Best regards
--
Marek Szyprowski
Samsung Poland R&D Center
Kukjin Kim
AppliedPATCH v3 1/1 Samsung: sdhci-s3c: add support for new card detection methods
In reply to Andrew MortonQuoted 11 lines · Andrew Morton
Quoted 7 lines · On Thu, 22 Jul 2010 10:25:44 +0200 Marek Szyprowski <[email protected]>…
Hello,
On Thursday, July 22, 2010 1:12 AM
Quoted 3 lines
On Fri, 16 Jul 2010 08:24:26 +0200
Marek Szyprowski <[email protected]> wrote:
Quoted 17 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
arch/arm/mach-s3c64xx/setup-sdhci-gpio.c | 14 +++++++++--- arch/arm/mach-s5pc100/setup-sdhci-gpio.c | 21++++++++++++++----
Quoted 2 lines
Quoted 2 lines
-
Quoted 1 line
Quoted 1 line
Quoted 1 line
arch/arm/mach-s5pv210/setup-sdhci-gpio.c | 22+++++++++++++++---
Quoted 11 lines
Quoted 11 lines
--
Quoted 10 lines
Quoted 10 lines
Quoted 5 lines
arch/arm/plat-samsung/dev-hsmmc.c | 5 ++++ arch/arm/plat-samsung/dev-hsmmc1.c | 5 ++++ arch/arm/plat-samsung/dev-hsmmc2.c | 5 ++++ arch/arm/plat-samsung/dev-hsmmc3.c | 5 ++++ arch/arm/plat-samsung/include/plat/sdhci.h | 29++++++++++++++++++++++++++++
Quoted 1 line
8 files changed, 90 insertions(+), 16 deletions(-)This is quite confusing. You've already sent a patch called "sdhci-s3c: add support for new card detection methods". It had
the
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
same changelog as this patch and the same title, but the two
patches
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
are utterly different!
The real patch has been split into two for easier merging: 1. the
driver
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
part and 2. samsung platform related part. The part which patch
belongs
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
to is indicated in the last line of the change log.
I'm really confused how to submit properly a patch that requires
changes
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
to both the driver (which is merged by the proper driver
maintainer's
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
sub-tree) and the platform (which should go through platform
maintainer's
Quoted 9 lines
Quoted 9 lines
Quoted 5 lines
Quoted 1 line
tree).
Make the relationship very very clear in the changelog. Send both patches to both maintainers. Ask that one of them merge both patches and that the other ack both patches.
Ok. Thanks for the hint.
Quoted 1 line
Anyway, I've forgotten what's happening here. I appear to be sitting
on
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
sdhci-s3c-add-support-for-the-non-standard-minimal-clock-value.patch
This one is independent from the card-detection patches and can be
applied
Quoted 7 lines
Quoted 7 lines
directly onto linux-next kernel tree.
Quoted 5 lines
and sdhci-s3c-add-support-for-new-card-detection-methods.patch
the latter of which is below.
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
Am I missing something? Is sdhci-s3c-add-support-for-new-card-detection-methods.patch up to date?
Ok, I will repost these 2 patches under new names to avoid further confusion. Currently there exists two "sdhci-s3c-add-support-for-new-card-detection-methods.patch", both of
them
Quoted 6 lines
Quoted 1 line
are required.
So the second(?) patch "[PATCH v4] Samsung: add new card detection methods in s3c-sdhci driver (platform part)" has already been applied to linux-next by Kukjin Kim, along with modifications which we have not been shown.
Yeah, I applied it in my tree which can be merged linux-next.
Quoted 7 lines
But the first patch (sdhci-s3c-add-support-for-the-non-standard-minimal-clock-value.patch) has not been applied to linux-next by anoyne and the third patch "[PATCH v4] sdhci-s3c: add support for new card detection methods (driver part)" has not been applied either.
Quoted 5 lines
This is a complete mess. What happens if I apply and merge sdhci-s3c-add-support-for-the-non-standard-minimal-clock-value.patch and sdhci-s3c-add-support-for-new-card-detection-methods-driver-part.patch? I have no idea.
Hmm...
Quoted 3 lines
I think I'll just drop all of it. Please sort all of this out then let me know what you want me to do.
If any updates, please let me know.
Thanks.
Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.