S3C: SDHCI: Add platform data parameters for GPIO external interrupts.
Subsystems (6)
PATCH 1/1 S3C: SDHCI: Add platform data parameters for GPIO external interrupts.
This patch adds platform parameters for external GPIO support for card insertion/removal events. This is used for S3C SDHCI controllers that does not use the SDCD pin for card detection.
Signed-off-by Thomas Abraham <[email protected]>
--- arch/arm/plat-samsung/include/plat/sdhci.h | 7 ++++++ drivers/mmc/host/sdhci-s3c.c | 30 ++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 0 deletions(-)
arch/arm/plat-samsung/include/plat/sdhci.h +7 -0
@@ -29,6 +29,9 @@ struct mmc_ios;* is necessary the controllers and/or GPIO blocks require the * changing of driver-strength and other controls dependant on * the card and speed of operation. +* @cfg_ext_cd: Configure external interrupt line. +* @is_card_present: Returns status of card availability. +* @ext_cd: The external GPIO interrupt number to be used. * * Initialisation data specific to either the machine or the platform * for the device driver to use or call-back when configuring gpio or
@@ -45,6 +48,10 @@ struct s3c_sdhci_platdata {void __iomem *regbase, struct mmc_ios *ios, struct mmc_card *card); + +void (*cfg_ext_cd)(void ); +unsigned int (*is_card_present)(void ); +unsigned int ext_cd; };/**
drivers/mmc/host/sdhci-s3c.c +30 -0
@@ -212,6 +212,20 @@ static void sdhci_s3c_set_clock(struct sdhci_host *host, unsigned int clock) } } +static irqreturn_t s3c_sdhci_irq_extcd (int irq,void *dev_id) +{ +struct sdhci_s3c *sc = dev_id; +u32 present = sc->pdata->is_card_present (); + +if (present) + sc->host->flags &= ~SDHCI_DEVICE_DEAD ; +else + sc->host->flags |=SDHCI_DEVICE_DEAD ; + +tasklet_schedule (&sc->host->card_tasklet); +return IRQ_HANDLED ; +} +static struct sdhci_ops sdhci_s3c_ops = { .get_max_clock = sdhci_s3c_get_max_clk, .get_timeout_clock = sdhci_s3c_get_timeout_clk,
@@ -346,14 +360,30 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev) host->quirks |= (SDHCI_QUIRK_32BIT_DMA_ADDR |SDHCI_QUIRK_32BIT_DMA_SIZE ); +if (pdata->cfg_ext_cd) { + pdata->cfg_ext_cd (); +if (!pdata->is_card_present ()) + host->flags |=SDHCI_DEVICE_DEAD ; + } + ret =sdhci_add_host (host);if (ret) {dev_err (dev,"sdhci_add_host() failed\n" ); goto err_add_host; } +if (pdata->cfg_ext_cd) { + ret =request_irq (pdata->ext_cd, s3c_sdhci_irq_extcd, +IRQF_SHARED ,mmc_hostname (host->mmc), sc); +if (ret) + goto err_req_cdirq; + } +return 0 ; + err_req_cdirq: +sdhci_remove_host (host,0 ); + err_add_host:release_resource (sc->ioarea);kfree (sc->ioarea);
Signature · 1 line
1.6.6.rc2
Ben Dooks
maintainerQuoted 15 lines · Thomas Abraham
This patch adds platform parameters for external GPIO support for card insertion/removal events. This is used for S3C SDHCI controllers that does not use the SDCD pin for card detection.
Signed-off-by Thomas Abraham <[email protected]>--- arch/arm/plat-samsung/include/plat/sdhci.h | 7 ++++++ drivers/mmc/host/sdhci-s3c.c | 30 ++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 0 deletions(-)arch/arm/plat-samsung/include/plat/sdhci.h +0
-0
arch/arm/plat-samsung/include/plat/sdhci.h struct mmc_ios; · line 34
Quoted 6 lines
arch/arm/plat-samsung/include/plat/sdhci.h +3
-0@@ -29,6 +29,9 @@ struct mmc_ios;* is necessary the controllers and/or GPIO blocks require the * changing of driver-strength and other controls dependant on * the card and speed of operation. +* @cfg_ext_cd: Configure external interrupt line. +* @is_card_present: Returns status of card availability. +* @ext_cd: The external GPIO interrupt number to be used.
Do you really need cfg_ext_cd?
Quoted 76 lines
arch/arm/plat-samsung/include/plat/sdhci.h +4
-0* Initialisation data specific to either the machine or the platform * for the device driver to use or call-back when configuring gpio or @@ -45,6 +48,10 @@ struct s3c_sdhci_platdata {void __iomem *regbase, struct mmc_ios *ios, struct mmc_card *card); + +void (*cfg_ext_cd)(void ); +unsigned int (*is_card_present)(void ); +unsigned int ext_cd; };/** drivers/mmc/host/sdhci-s3c.c +30
-0@@ -212,6 +212,20 @@ static void sdhci_s3c_set_clock(struct sdhci_host *host, unsigned int clock) } } +static irqreturn_t s3c_sdhci_irq_extcd (int irq,void *dev_id) +{ +struct sdhci_s3c *sc = dev_id; +u32 present = sc->pdata->is_card_present (); + +if (present) + sc->host->flags &= ~SDHCI_DEVICE_DEAD ; +else + sc->host->flags |=SDHCI_DEVICE_DEAD ; + +tasklet_schedule (&sc->host->card_tasklet); +return IRQ_HANDLED ; +} +static struct sdhci_ops sdhci_s3c_ops = { .get_max_clock = sdhci_s3c_get_max_clk, .get_timeout_clock = sdhci_s3c_get_timeout_clk,@@ -346,14 +360,30 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev) host->quirks |= (SDHCI_QUIRK_32BIT_DMA_ADDR |SDHCI_QUIRK_32BIT_DMA_SIZE ); +if (pdata->cfg_ext_cd) { + pdata->cfg_ext_cd (); +if (!pdata->is_card_present ()) + host->flags |=SDHCI_DEVICE_DEAD ; + } + ret =sdhci_add_host (host);if (ret) {dev_err (dev,"sdhci_add_host() failed\n" ); goto err_add_host; } +if (pdata->cfg_ext_cd) { + ret =request_irq (pdata->ext_cd, s3c_sdhci_irq_extcd, +IRQF_SHARED ,mmc_hostname (host->mmc), sc); +if (ret) + goto err_req_cdirq; + } +return 0 ; + err_req_cdirq: +sdhci_remove_host (host,0 ); + err_add_host:release_resource (sc->ioarea);kfree (sc->ioarea);Signature · 6 lines
1.6.6.rc2 -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 5 lines
-- Ben Q: What's a light-year? A: One-third less calories than a regular year.