* [PATCH v3 3/3] sdhci-s3c: Add SDHCI_QUIRK_NO_WP_BIT quirk for Samsung SoC
@ 2010-07-23 11:56 ` Kukjin Kim
0 siblings, 0 replies; 26+ messages in thread
From: Kukjin Kim @ 2010-07-23 11:56 UTC (permalink / raw)
To: linux-arm-kernel
From: Hyuk Lee <hyuk1.lee@samsung.com>
If host controller doesn't have WP pin which should be connnected with SDMMC
card WP pin, can implement get_ro function with using the allocated gpio.
In order to use this quirk wp_gpio in the platform data must be set.
Signed-off-by: Hyuk Lee <hyuk1.lee@samsung.com>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
---
drivers/mmc/host/sdhci-s3c.c | 43 ++++++++++++++++++++++++++++++++++++++++++
drivers/mmc/host/sdhci.c | 3 ++
drivers/mmc/host/sdhci.h | 3 ++
3 files changed, 49 insertions(+), 0 deletions(-)
diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c
index 0d25285..0b75e57 100644
--- a/drivers/mmc/host/sdhci-s3c.c
+++ b/drivers/mmc/host/sdhci-s3c.c
@@ -22,6 +22,7 @@
#include <linux/mmc/host.h>
+#include <plat/gpio-cfg.h>
#include <plat/sdhci.h>
#include <plat/regs-sdhci.h>
@@ -213,6 +214,36 @@ static void sdhci_s3c_set_clock(struct sdhci_host *host, unsigned int clock)
}
/**
+ * sdhci_s3c_get_ro - callback for get_ro
+ * @host: The SDHCI host being changed
+ *
+ * If the WP pin is connected with GPIO, can get the value which indicates
+ * the card is locked or not.
+*/
+static int sdhci_s3c_get_ro(struct mmc_host *mmc)
+{
+ struct sdhci_s3c *sc;
+ struct sdhci_host *host;
+
+ host = mmc_priv(mmc);
+ sc = sdhci_priv(host);
+
+ return gpio_get_value(sc->pdata->wp_gpio);
+}
+
+/**
+ * sdhci_s3c_cfg_wp - configure GPIO for WP pin
+ * @gpio_num: GPIO number which connected with WP line from SD/MMC slot
+ *
+ * Configure GPIO for using WP line
+*/
+static void sdhci_s3c_cfg_wp(unsigned int gpio_num)
+{
+ s3c_gpio_cfgpin(gpio_num, S3C_GPIO_INPUT);
+ s3c_gpio_setpull(gpio_num, S3C_GPIO_PULL_UP);
+}
+
+/**
* sdhci_s3c_get_min_clock - callback to get minimal supported clock value
* @host: The SDHCI host being queried
*
@@ -375,6 +406,9 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev)
if (pdata->cfg_gpio)
pdata->cfg_gpio(pdev, pdata->max_width);
+ if (gpio_is_valid(pdata->wp_gpio))
+ sdhci_s3c_ops.get_ro = sdhci_s3c_get_ro;
+
host->hw_name = "samsung-hsmmc";
host->ops = &sdhci_s3c_ops;
host->quirks = 0;
@@ -408,6 +442,15 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev)
host->quirks |= (SDHCI_QUIRK_32BIT_DMA_ADDR |
SDHCI_QUIRK_32BIT_DMA_SIZE);
+ /* Controller's WP pin donsn't connected with SD card and there is an
+ * allocated GPIO for getting WP data form SD card, use this quirk and
+ * send the GPIO number in pdata->wp_gpio. */
+ host->quirks |= SDHCI_QUIRK_NO_WP_BIT;
+
+ /* to configure gpio pin as a card write protection signal */
+ if (gpio_is_valid(pdata->wp_gpio))
+ sdhci_s3c_cfg_wp(pdata->wp_gpio);
+
ret = sdhci_add_host(host);
if (ret) {
dev_err(dev, "sdhci_add_host() failed\n");
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index f9ca4c6..7fba401 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1198,6 +1198,9 @@ static int sdhci_get_ro(struct mmc_host *mmc)
host = mmc_priv(mmc);
+ if ((host->quirks & SDHCI_QUIRK_NO_WP_BIT) && host->ops->get_ro)
+ return host->ops->get_ro(mmc);
+
spin_lock_irqsave(&host->lock, flags);
if (host->flags & SDHCI_DEVICE_DEAD)
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
index 0de8b38..dd9a233 100644
--- a/drivers/mmc/host/sdhci.h
+++ b/drivers/mmc/host/sdhci.h
@@ -247,6 +247,8 @@ struct sdhci_host {
#define SDHCI_QUIRK_MISSING_CAPS (1<<28)
/* Controller has nonstandard clock management */
#define SDHCI_QUIRK_NONSTANDARD_MINCLOCK (1<<29)
+/* Controller has no write-protect pin connected with SD card */
+#define SDHCI_QUIRK_NO_WP_BIT (1<<30)
int irq; /* Device IRQ */
void __iomem * ioaddr; /* Mapped address */
@@ -321,6 +323,7 @@ struct sdhci_ops {
unsigned int (*get_max_clock)(struct sdhci_host *host);
unsigned int (*get_min_clock)(struct sdhci_host *host);
unsigned int (*get_timeout_clock)(struct sdhci_host *host);
+ int (*get_ro)(struct mmc_host *mmc);
};
#ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS
--
1.6.2.5
^ permalink raw reply related [flat|nested] 26+ messages in thread* Re: [PATCH v3 3/3] sdhci-s3c: Add SDHCI_QUIRK_NO_WP_BIT quirk for Samsung SoC
2010-07-23 11:56 ` Kukjin Kim
@ 2010-07-23 12:12 ` Maurus Cuelenaere
-1 siblings, 0 replies; 26+ messages in thread
From: Maurus Cuelenaere @ 2010-07-23 12:12 UTC (permalink / raw)
To: Kukjin Kim
Cc: linux-arm-kernel, linux-samsung-soc, linux-mmc, ben-linux, akpm,
Hyuk Lee
Op 23-07-10 13:56, Kukjin Kim schreef:
> From: Hyuk Lee <hyuk1.lee@samsung.com>
>
> If host controller doesn't have WP pin which should be connnected with SDMMC
> card WP pin, can implement get_ro function with using the allocated gpio.
> In order to use this quirk wp_gpio in the platform data must be set.
>
> Signed-off-by: Hyuk Lee <hyuk1.lee@samsung.com>
> Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
> ---
> drivers/mmc/host/sdhci-s3c.c | 43 ++++++++++++++++++++++++++++++++++++++++++
> drivers/mmc/host/sdhci.c | 3 ++
> drivers/mmc/host/sdhci.h | 3 ++
> 3 files changed, 49 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c
> index 0d25285..0b75e57 100644
> --- a/drivers/mmc/host/sdhci-s3c.c
> +++ b/drivers/mmc/host/sdhci-s3c.c
> @@ -22,6 +22,7 @@
>
> #include <linux/mmc/host.h>
>
> +#include <plat/gpio-cfg.h>
> #include <plat/sdhci.h>
> #include <plat/regs-sdhci.h>
>
> @@ -213,6 +214,36 @@ static void sdhci_s3c_set_clock(struct sdhci_host *host, unsigned int clock)
> }
>
> /**
> + * sdhci_s3c_get_ro - callback for get_ro
> + * @host: The SDHCI host being changed
> + *
> + * If the WP pin is connected with GPIO, can get the value which indicates
> + * the card is locked or not.
> +*/
> +static int sdhci_s3c_get_ro(struct mmc_host *mmc)
> +{
> + struct sdhci_s3c *sc;
> + struct sdhci_host *host;
> +
> + host = mmc_priv(mmc);
> + sc = sdhci_priv(host);
This can be done as static initializer if you reverse the order above.
> +
> + return gpio_get_value(sc->pdata->wp_gpio);
> +}
--
Maurus Cuelenaere
^ permalink raw reply [flat|nested] 26+ messages in thread* [PATCH v3 3/3] sdhci-s3c: Add SDHCI_QUIRK_NO_WP_BIT quirk for Samsung SoC
@ 2010-07-23 12:12 ` Maurus Cuelenaere
0 siblings, 0 replies; 26+ messages in thread
From: Maurus Cuelenaere @ 2010-07-23 12:12 UTC (permalink / raw)
To: linux-arm-kernel
Op 23-07-10 13:56, Kukjin Kim schreef:
> From: Hyuk Lee <hyuk1.lee@samsung.com>
>
> If host controller doesn't have WP pin which should be connnected with SDMMC
> card WP pin, can implement get_ro function with using the allocated gpio.
> In order to use this quirk wp_gpio in the platform data must be set.
>
> Signed-off-by: Hyuk Lee <hyuk1.lee@samsung.com>
> Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
> ---
> drivers/mmc/host/sdhci-s3c.c | 43 ++++++++++++++++++++++++++++++++++++++++++
> drivers/mmc/host/sdhci.c | 3 ++
> drivers/mmc/host/sdhci.h | 3 ++
> 3 files changed, 49 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c
> index 0d25285..0b75e57 100644
> --- a/drivers/mmc/host/sdhci-s3c.c
> +++ b/drivers/mmc/host/sdhci-s3c.c
> @@ -22,6 +22,7 @@
>
> #include <linux/mmc/host.h>
>
> +#include <plat/gpio-cfg.h>
> #include <plat/sdhci.h>
> #include <plat/regs-sdhci.h>
>
> @@ -213,6 +214,36 @@ static void sdhci_s3c_set_clock(struct sdhci_host *host, unsigned int clock)
> }
>
> /**
> + * sdhci_s3c_get_ro - callback for get_ro
> + * @host: The SDHCI host being changed
> + *
> + * If the WP pin is connected with GPIO, can get the value which indicates
> + * the card is locked or not.
> +*/
> +static int sdhci_s3c_get_ro(struct mmc_host *mmc)
> +{
> + struct sdhci_s3c *sc;
> + struct sdhci_host *host;
> +
> + host = mmc_priv(mmc);
> + sc = sdhci_priv(host);
This can be done as static initializer if you reverse the order above.
> +
> + return gpio_get_value(sc->pdata->wp_gpio);
> +}
--
Maurus Cuelenaere
^ permalink raw reply [flat|nested] 26+ messages in thread* RE: [PATCH v3 3/3] sdhci-s3c: Add SDHCI_QUIRK_NO_WP_BIT quirk for Samsung SoC
2010-07-23 12:12 ` Maurus Cuelenaere
@ 2010-07-27 11:58 ` Kukjin Kim
-1 siblings, 0 replies; 26+ messages in thread
From: Kukjin Kim @ 2010-07-27 11:58 UTC (permalink / raw)
To: 'Maurus Cuelenaere'
Cc: linux-arm-kernel, linux-samsung-soc, linux-mmc, ben-linux, akpm,
'Hyuk Lee'
Maurus Cuelenaere wrote:
>
> Op 23-07-10 13:56, Kukjin Kim schreef:
> > From: Hyuk Lee <hyuk1.lee@samsung.com>
> >
> > If host controller doesn't have WP pin which should be connnected with SDMMC
> > card WP pin, can implement get_ro function with using the allocated gpio.
> > In order to use this quirk wp_gpio in the platform data must be set.
> >
> > Signed-off-by: Hyuk Lee <hyuk1.lee@samsung.com>
> > Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
> > ---
> > drivers/mmc/host/sdhci-s3c.c | 43
> ++++++++++++++++++++++++++++++++++++++++++
> > drivers/mmc/host/sdhci.c | 3 ++
> > drivers/mmc/host/sdhci.h | 3 ++
> > 3 files changed, 49 insertions(+), 0 deletions(-)
> >
> > diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c
> > index 0d25285..0b75e57 100644
> > --- a/drivers/mmc/host/sdhci-s3c.c
> > +++ b/drivers/mmc/host/sdhci-s3c.c
> > @@ -22,6 +22,7 @@
> >
> > #include <linux/mmc/host.h>
> >
> > +#include <plat/gpio-cfg.h>
> > #include <plat/sdhci.h>
> > #include <plat/regs-sdhci.h>
> >
> > @@ -213,6 +214,36 @@ static void sdhci_s3c_set_clock(struct sdhci_host *host,
> unsigned int clock)
> > }
> >
> > /**
> > + * sdhci_s3c_get_ro - callback for get_ro
> > + * @host: The SDHCI host being changed
> > + *
> > + * If the WP pin is connected with GPIO, can get the value which indicates
> > + * the card is locked or not.
> > +*/
> > +static int sdhci_s3c_get_ro(struct mmc_host *mmc)
> > +{
> > + struct sdhci_s3c *sc;
> > + struct sdhci_host *host;
> > +
> > + host = mmc_priv(mmc);
> > + sc = sdhci_priv(host);
>
> This can be done as static initializer if you reverse the order above.
>
Could you please kindly explain about this?
Sorry, I cannot get the exactly meaning...
> > +
> > + return gpio_get_value(sc->pdata->wp_gpio);
> > +}
>
> --
Thanks.
Best regards,
Kgene.
--
Kukjin Kim <kgene.kim@samsung.com>, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.
^ permalink raw reply [flat|nested] 26+ messages in thread* [PATCH v3 3/3] sdhci-s3c: Add SDHCI_QUIRK_NO_WP_BIT quirk for Samsung SoC
@ 2010-07-27 11:58 ` Kukjin Kim
0 siblings, 0 replies; 26+ messages in thread
From: Kukjin Kim @ 2010-07-27 11:58 UTC (permalink / raw)
To: linux-arm-kernel
Maurus Cuelenaere wrote:
>
> Op 23-07-10 13:56, Kukjin Kim schreef:
> > From: Hyuk Lee <hyuk1.lee@samsung.com>
> >
> > If host controller doesn't have WP pin which should be connnected with SDMMC
> > card WP pin, can implement get_ro function with using the allocated gpio.
> > In order to use this quirk wp_gpio in the platform data must be set.
> >
> > Signed-off-by: Hyuk Lee <hyuk1.lee@samsung.com>
> > Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
> > ---
> > drivers/mmc/host/sdhci-s3c.c | 43
> ++++++++++++++++++++++++++++++++++++++++++
> > drivers/mmc/host/sdhci.c | 3 ++
> > drivers/mmc/host/sdhci.h | 3 ++
> > 3 files changed, 49 insertions(+), 0 deletions(-)
> >
> > diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c
> > index 0d25285..0b75e57 100644
> > --- a/drivers/mmc/host/sdhci-s3c.c
> > +++ b/drivers/mmc/host/sdhci-s3c.c
> > @@ -22,6 +22,7 @@
> >
> > #include <linux/mmc/host.h>
> >
> > +#include <plat/gpio-cfg.h>
> > #include <plat/sdhci.h>
> > #include <plat/regs-sdhci.h>
> >
> > @@ -213,6 +214,36 @@ static void sdhci_s3c_set_clock(struct sdhci_host *host,
> unsigned int clock)
> > }
> >
> > /**
> > + * sdhci_s3c_get_ro - callback for get_ro
> > + * @host: The SDHCI host being changed
> > + *
> > + * If the WP pin is connected with GPIO, can get the value which indicates
> > + * the card is locked or not.
> > +*/
> > +static int sdhci_s3c_get_ro(struct mmc_host *mmc)
> > +{
> > + struct sdhci_s3c *sc;
> > + struct sdhci_host *host;
> > +
> > + host = mmc_priv(mmc);
> > + sc = sdhci_priv(host);
>
> This can be done as static initializer if you reverse the order above.
>
Could you please kindly explain about this?
Sorry, I cannot get the exactly meaning...
> > +
> > + return gpio_get_value(sc->pdata->wp_gpio);
> > +}
>
> --
Thanks.
Best regards,
Kgene.
--
Kukjin Kim <kgene.kim@samsung.com>, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.
^ permalink raw reply [flat|nested] 26+ messages in thread* Re: [PATCH v3 3/3] sdhci-s3c: Add SDHCI_QUIRK_NO_WP_BIT quirk for Samsung SoC
2010-07-27 11:58 ` Kukjin Kim
@ 2010-07-27 16:18 ` Maurus Cuelenaere
-1 siblings, 0 replies; 26+ messages in thread
From: Maurus Cuelenaere @ 2010-07-27 16:18 UTC (permalink / raw)
To: Kukjin Kim
Cc: linux-arm-kernel, linux-samsung-soc, linux-mmc, ben-linux, akpm,
'Hyuk Lee'
Op 27-07-10 13:58, Kukjin Kim schreef:
> Maurus Cuelenaere wrote:
>> Op 23-07-10 13:56, Kukjin Kim schreef:
>>> From: Hyuk Lee <hyuk1.lee@samsung.com>
>>>
>>> If host controller doesn't have WP pin which should be connnected with SDMMC
>>> card WP pin, can implement get_ro function with using the allocated gpio.
>>> In order to use this quirk wp_gpio in the platform data must be set.
>>>
>>> Signed-off-by: Hyuk Lee <hyuk1.lee@samsung.com>
>>> Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
>>> ---
>>> drivers/mmc/host/sdhci-s3c.c | 43
>> ++++++++++++++++++++++++++++++++++++++++++
>>> drivers/mmc/host/sdhci.c | 3 ++
>>> drivers/mmc/host/sdhci.h | 3 ++
>>> 3 files changed, 49 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c
>>> index 0d25285..0b75e57 100644
>>> --- a/drivers/mmc/host/sdhci-s3c.c
>>> +++ b/drivers/mmc/host/sdhci-s3c.c
>>> @@ -22,6 +22,7 @@
>>>
>>> #include <linux/mmc/host.h>
>>>
>>> +#include <plat/gpio-cfg.h>
>>> #include <plat/sdhci.h>
>>> #include <plat/regs-sdhci.h>
>>>
>>> @@ -213,6 +214,36 @@ static void sdhci_s3c_set_clock(struct sdhci_host *host,
>> unsigned int clock)
>>> }
>>>
>>> /**
>>> + * sdhci_s3c_get_ro - callback for get_ro
>>> + * @host: The SDHCI host being changed
>>> + *
>>> + * If the WP pin is connected with GPIO, can get the value which indicates
>>> + * the card is locked or not.
>>> +*/
>>> +static int sdhci_s3c_get_ro(struct mmc_host *mmc)
>>> +{
>>> + struct sdhci_s3c *sc;
>>> + struct sdhci_host *host;
>>> +
>>> + host = mmc_priv(mmc);
>>> + sc = sdhci_priv(host);
>> This can be done as static initializer if you reverse the order above.
> Could you please kindly explain about this?
> Sorry, I cannot get the exactly meaning...
+static int sdhci_s3c_get_ro(struct mmc_host *mmc)
+{
+ struct sdhci_host *host = mmc_priv(mmc);
+ struct sdhci_s3c *sc = sdhci_priv(host);
--
Maurus Cuelenaere
^ permalink raw reply [flat|nested] 26+ messages in thread* [PATCH v3 3/3] sdhci-s3c: Add SDHCI_QUIRK_NO_WP_BIT quirk for Samsung SoC
@ 2010-07-27 16:18 ` Maurus Cuelenaere
0 siblings, 0 replies; 26+ messages in thread
From: Maurus Cuelenaere @ 2010-07-27 16:18 UTC (permalink / raw)
To: linux-arm-kernel
Op 27-07-10 13:58, Kukjin Kim schreef:
> Maurus Cuelenaere wrote:
>> Op 23-07-10 13:56, Kukjin Kim schreef:
>>> From: Hyuk Lee <hyuk1.lee@samsung.com>
>>>
>>> If host controller doesn't have WP pin which should be connnected with SDMMC
>>> card WP pin, can implement get_ro function with using the allocated gpio.
>>> In order to use this quirk wp_gpio in the platform data must be set.
>>>
>>> Signed-off-by: Hyuk Lee <hyuk1.lee@samsung.com>
>>> Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
>>> ---
>>> drivers/mmc/host/sdhci-s3c.c | 43
>> ++++++++++++++++++++++++++++++++++++++++++
>>> drivers/mmc/host/sdhci.c | 3 ++
>>> drivers/mmc/host/sdhci.h | 3 ++
>>> 3 files changed, 49 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c
>>> index 0d25285..0b75e57 100644
>>> --- a/drivers/mmc/host/sdhci-s3c.c
>>> +++ b/drivers/mmc/host/sdhci-s3c.c
>>> @@ -22,6 +22,7 @@
>>>
>>> #include <linux/mmc/host.h>
>>>
>>> +#include <plat/gpio-cfg.h>
>>> #include <plat/sdhci.h>
>>> #include <plat/regs-sdhci.h>
>>>
>>> @@ -213,6 +214,36 @@ static void sdhci_s3c_set_clock(struct sdhci_host *host,
>> unsigned int clock)
>>> }
>>>
>>> /**
>>> + * sdhci_s3c_get_ro - callback for get_ro
>>> + * @host: The SDHCI host being changed
>>> + *
>>> + * If the WP pin is connected with GPIO, can get the value which indicates
>>> + * the card is locked or not.
>>> +*/
>>> +static int sdhci_s3c_get_ro(struct mmc_host *mmc)
>>> +{
>>> + struct sdhci_s3c *sc;
>>> + struct sdhci_host *host;
>>> +
>>> + host = mmc_priv(mmc);
>>> + sc = sdhci_priv(host);
>> This can be done as static initializer if you reverse the order above.
> Could you please kindly explain about this?
> Sorry, I cannot get the exactly meaning...
+static int sdhci_s3c_get_ro(struct mmc_host *mmc)
+{
+ struct sdhci_host *host = mmc_priv(mmc);
+ struct sdhci_s3c *sc = sdhci_priv(host);
--
Maurus Cuelenaere
^ permalink raw reply [flat|nested] 26+ messages in thread* RE: [PATCH v3 3/3] sdhci-s3c: Add SDHCI_QUIRK_NO_WP_BIT quirk for Samsung SoC
2010-07-27 16:18 ` Maurus Cuelenaere
@ 2010-07-28 4:42 ` Kukjin Kim
-1 siblings, 0 replies; 26+ messages in thread
From: Kukjin Kim @ 2010-07-28 4:42 UTC (permalink / raw)
To: 'Maurus Cuelenaere'
Cc: linux-arm-kernel, linux-samsung-soc, linux-mmc, ben-linux, akpm,
'Hyuk Lee'
Maurus Cuelenaere wrote:
>
> Op 27-07-10 13:58, Kukjin Kim schreef:
> > Maurus Cuelenaere wrote:
> >> Op 23-07-10 13:56, Kukjin Kim schreef:
> >>> From: Hyuk Lee <hyuk1.lee@samsung.com>
> >>>
> >>> If host controller doesn't have WP pin which should be connnected with
> SDMMC
> >>> card WP pin, can implement get_ro function with using the allocated gpio.
> >>> In order to use this quirk wp_gpio in the platform data must be set.
> >>>
> >>> Signed-off-by: Hyuk Lee <hyuk1.lee@samsung.com>
> >>> Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
> >>> ---
> >>> drivers/mmc/host/sdhci-s3c.c | 43
> >> ++++++++++++++++++++++++++++++++++++++++++
> >>> drivers/mmc/host/sdhci.c | 3 ++
> >>> drivers/mmc/host/sdhci.h | 3 ++
> >>> 3 files changed, 49 insertions(+), 0 deletions(-)
> >>>
> >>> diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c
> >>> index 0d25285..0b75e57 100644
> >>> --- a/drivers/mmc/host/sdhci-s3c.c
> >>> +++ b/drivers/mmc/host/sdhci-s3c.c
> >>> @@ -22,6 +22,7 @@
> >>>
> >>> #include <linux/mmc/host.h>
> >>>
> >>> +#include <plat/gpio-cfg.h>
> >>> #include <plat/sdhci.h>
> >>> #include <plat/regs-sdhci.h>
> >>>
> >>> @@ -213,6 +214,36 @@ static void sdhci_s3c_set_clock(struct sdhci_host
> *host,
> >> unsigned int clock)
> >>> }
> >>>
> >>> /**
> >>> + * sdhci_s3c_get_ro - callback for get_ro
> >>> + * @host: The SDHCI host being changed
> >>> + *
> >>> + * If the WP pin is connected with GPIO, can get the value which indicates
> >>> + * the card is locked or not.
> >>> +*/
> >>> +static int sdhci_s3c_get_ro(struct mmc_host *mmc)
> >>> +{
> >>> + struct sdhci_s3c *sc;
> >>> + struct sdhci_host *host;
> >>> +
> >>> + host = mmc_priv(mmc);
> >>> + sc = sdhci_priv(host);
> >> This can be done as static initializer if you reverse the order above.
> > Could you please kindly explain about this?
> > Sorry, I cannot get the exactly meaning...
>
> +static int sdhci_s3c_get_ro(struct mmc_host *mmc)
> +{
> + struct sdhci_host *host = mmc_priv(mmc);
> + struct sdhci_s3c *sc = sdhci_priv(host);
>
Hahaha, no need more words ;-)
Thanks for your kindly explanation.
I think, v4 patch seems to satisfy your suggestion...even though need v5 patch right now.
Thanks.
Best regards,
Kgene.
--
Kukjin Kim <kgene.kim@samsung.com>, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.
^ permalink raw reply [flat|nested] 26+ messages in thread* [PATCH v3 3/3] sdhci-s3c: Add SDHCI_QUIRK_NO_WP_BIT quirk for Samsung SoC
@ 2010-07-28 4:42 ` Kukjin Kim
0 siblings, 0 replies; 26+ messages in thread
From: Kukjin Kim @ 2010-07-28 4:42 UTC (permalink / raw)
To: linux-arm-kernel
Maurus Cuelenaere wrote:
>
> Op 27-07-10 13:58, Kukjin Kim schreef:
> > Maurus Cuelenaere wrote:
> >> Op 23-07-10 13:56, Kukjin Kim schreef:
> >>> From: Hyuk Lee <hyuk1.lee@samsung.com>
> >>>
> >>> If host controller doesn't have WP pin which should be connnected with
> SDMMC
> >>> card WP pin, can implement get_ro function with using the allocated gpio.
> >>> In order to use this quirk wp_gpio in the platform data must be set.
> >>>
> >>> Signed-off-by: Hyuk Lee <hyuk1.lee@samsung.com>
> >>> Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
> >>> ---
> >>> drivers/mmc/host/sdhci-s3c.c | 43
> >> ++++++++++++++++++++++++++++++++++++++++++
> >>> drivers/mmc/host/sdhci.c | 3 ++
> >>> drivers/mmc/host/sdhci.h | 3 ++
> >>> 3 files changed, 49 insertions(+), 0 deletions(-)
> >>>
> >>> diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c
> >>> index 0d25285..0b75e57 100644
> >>> --- a/drivers/mmc/host/sdhci-s3c.c
> >>> +++ b/drivers/mmc/host/sdhci-s3c.c
> >>> @@ -22,6 +22,7 @@
> >>>
> >>> #include <linux/mmc/host.h>
> >>>
> >>> +#include <plat/gpio-cfg.h>
> >>> #include <plat/sdhci.h>
> >>> #include <plat/regs-sdhci.h>
> >>>
> >>> @@ -213,6 +214,36 @@ static void sdhci_s3c_set_clock(struct sdhci_host
> *host,
> >> unsigned int clock)
> >>> }
> >>>
> >>> /**
> >>> + * sdhci_s3c_get_ro - callback for get_ro
> >>> + * @host: The SDHCI host being changed
> >>> + *
> >>> + * If the WP pin is connected with GPIO, can get the value which indicates
> >>> + * the card is locked or not.
> >>> +*/
> >>> +static int sdhci_s3c_get_ro(struct mmc_host *mmc)
> >>> +{
> >>> + struct sdhci_s3c *sc;
> >>> + struct sdhci_host *host;
> >>> +
> >>> + host = mmc_priv(mmc);
> >>> + sc = sdhci_priv(host);
> >> This can be done as static initializer if you reverse the order above.
> > Could you please kindly explain about this?
> > Sorry, I cannot get the exactly meaning...
>
> +static int sdhci_s3c_get_ro(struct mmc_host *mmc)
> +{
> + struct sdhci_host *host = mmc_priv(mmc);
> + struct sdhci_s3c *sc = sdhci_priv(host);
>
Hahaha, no need more words ;-)
Thanks for your kindly explanation.
I think, v4 patch seems to satisfy your suggestion...even though need v5 patch right now.
Thanks.
Best regards,
Kgene.
--
Kukjin Kim <kgene.kim@samsung.com>, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH v3 3/3] sdhci-s3c: Add SDHCI_QUIRK_NO_WP_BIT quirk for Samsung SoC
2010-07-23 11:56 ` Kukjin Kim
@ 2010-07-23 12:50 ` Kyungmin Park
-1 siblings, 0 replies; 26+ messages in thread
From: Kyungmin Park @ 2010-07-23 12:50 UTC (permalink / raw)
To: Kukjin Kim
Cc: linux-arm-kernel, linux-samsung-soc, linux-mmc, ben-linux, akpm,
Hyuk Lee
On Fri, Jul 23, 2010 at 8:56 PM, Kukjin Kim <kgene.kim@samsung.com> wrote:
> From: Hyuk Lee <hyuk1.lee@samsung.com>
>
> If host controller doesn't have WP pin which should be connnected with SDMMC
> card WP pin, can implement get_ro function with using the allocated gpio.
> In order to use this quirk wp_gpio in the platform data must be set.
>
> Signed-off-by: Hyuk Lee <hyuk1.lee@samsung.com>
> Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
> ---
> drivers/mmc/host/sdhci-s3c.c | 43 ++++++++++++++++++++++++++++++++++++++++++
> drivers/mmc/host/sdhci.c | 3 ++
> drivers/mmc/host/sdhci.h | 3 ++
> 3 files changed, 49 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c
> index 0d25285..0b75e57 100644
> --- a/drivers/mmc/host/sdhci-s3c.c
> +++ b/drivers/mmc/host/sdhci-s3c.c
> @@ -22,6 +22,7 @@
>
> #include <linux/mmc/host.h>
>
> +#include <plat/gpio-cfg.h>
> #include <plat/sdhci.h>
> #include <plat/regs-sdhci.h>
>
> @@ -213,6 +214,36 @@ static void sdhci_s3c_set_clock(struct sdhci_host *host, unsigned int clock)
> }
>
> /**
> + * sdhci_s3c_get_ro - callback for get_ro
> + * @host: The SDHCI host being changed
> + *
> + * If the WP pin is connected with GPIO, can get the value which indicates
> + * the card is locked or not.
> +*/
> +static int sdhci_s3c_get_ro(struct mmc_host *mmc)
> +{
> + struct sdhci_s3c *sc;
> + struct sdhci_host *host;
> +
> + host = mmc_priv(mmc);
> + sc = sdhci_priv(host);
> +
> + return gpio_get_value(sc->pdata->wp_gpio);
> +}
> +
> +/**
> + * sdhci_s3c_cfg_wp - configure GPIO for WP pin
> + * @gpio_num: GPIO number which connected with WP line from SD/MMC slot
> + *
> + * Configure GPIO for using WP line
> +*/
> +static void sdhci_s3c_cfg_wp(unsigned int gpio_num)
> +{
> + s3c_gpio_cfgpin(gpio_num, S3C_GPIO_INPUT);
> + s3c_gpio_setpull(gpio_num, S3C_GPIO_PULL_UP);
> +}
> +
> +/**
> * sdhci_s3c_get_min_clock - callback to get minimal supported clock value
> * @host: The SDHCI host being queried
> *
> @@ -375,6 +406,9 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev)
> if (pdata->cfg_gpio)
> pdata->cfg_gpio(pdev, pdata->max_width);
>
> + if (gpio_is_valid(pdata->wp_gpio))
> + sdhci_s3c_ops.get_ro = sdhci_s3c_get_ro;
> +
> host->hw_name = "samsung-hsmmc";
> host->ops = &sdhci_s3c_ops;
> host->quirks = 0;
> @@ -408,6 +442,15 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev)
> host->quirks |= (SDHCI_QUIRK_32BIT_DMA_ADDR |
> SDHCI_QUIRK_32BIT_DMA_SIZE);
>
> + /* Controller's WP pin donsn't connected with SD card and there is an
> + * allocated GPIO for getting WP data form SD card, use this quirk and
> + * send the GPIO number in pdata->wp_gpio. */
> + host->quirks |= SDHCI_QUIRK_NO_WP_BIT;
> +
> + /* to configure gpio pin as a card write protection signal */
> + if (gpio_is_valid(pdata->wp_gpio))
> + sdhci_s3c_cfg_wp(pdata->wp_gpio);
> +
Put it just one place like this.
if (gpio_is_valid(pdata->wp_gpio)) {
sdhci_s3c_cfg_wp(pdata->wp_gpio);
sdhci_s3c_ops.get_ro = sdhci_s3c_get_ro;
host->quirks |= SDHCI_QUIRK_NO_WP_BIT;
}
It reduce the below quirks check by one. If you add the quriks as your
patch, host->quirks are always true whether WP use or not.
Thank you,
Kyungmin Park
> ret = sdhci_add_host(host);
> if (ret) {
> dev_err(dev, "sdhci_add_host() failed\n");
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index f9ca4c6..7fba401 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -1198,6 +1198,9 @@ static int sdhci_get_ro(struct mmc_host *mmc)
>
> host = mmc_priv(mmc);
>
> + if ((host->quirks & SDHCI_QUIRK_NO_WP_BIT) && host->ops->get_ro)
> + return host->ops->get_ro(mmc);
> +
> spin_lock_irqsave(&host->lock, flags);
>
> if (host->flags & SDHCI_DEVICE_DEAD)
> diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
> index 0de8b38..dd9a233 100644
> --- a/drivers/mmc/host/sdhci.h
> +++ b/drivers/mmc/host/sdhci.h
> @@ -247,6 +247,8 @@ struct sdhci_host {
> #define SDHCI_QUIRK_MISSING_CAPS (1<<28)
> /* Controller has nonstandard clock management */
> #define SDHCI_QUIRK_NONSTANDARD_MINCLOCK (1<<29)
> +/* Controller has no write-protect pin connected with SD card */
> +#define SDHCI_QUIRK_NO_WP_BIT (1<<30)
>
> int irq; /* Device IRQ */
> void __iomem * ioaddr; /* Mapped address */
> @@ -321,6 +323,7 @@ struct sdhci_ops {
> unsigned int (*get_max_clock)(struct sdhci_host *host);
> unsigned int (*get_min_clock)(struct sdhci_host *host);
> unsigned int (*get_timeout_clock)(struct sdhci_host *host);
> + int (*get_ro)(struct mmc_host *mmc);
> };
>
> #ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS
> --
> 1.6.2.5
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 26+ messages in thread* [PATCH v3 3/3] sdhci-s3c: Add SDHCI_QUIRK_NO_WP_BIT quirk for Samsung SoC
@ 2010-07-23 12:50 ` Kyungmin Park
0 siblings, 0 replies; 26+ messages in thread
From: Kyungmin Park @ 2010-07-23 12:50 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, Jul 23, 2010 at 8:56 PM, Kukjin Kim <kgene.kim@samsung.com> wrote:
> From: Hyuk Lee <hyuk1.lee@samsung.com>
>
> If host controller doesn't have WP pin which should be connnected with SDMMC
> card WP pin, can implement get_ro function with using the allocated gpio.
> In order to use this quirk wp_gpio in the platform data must be set.
>
> Signed-off-by: Hyuk Lee <hyuk1.lee@samsung.com>
> Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
> ---
> ?drivers/mmc/host/sdhci-s3c.c | ? 43 ++++++++++++++++++++++++++++++++++++++++++
> ?drivers/mmc/host/sdhci.c ? ? | ? ?3 ++
> ?drivers/mmc/host/sdhci.h ? ? | ? ?3 ++
> ?3 files changed, 49 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c
> index 0d25285..0b75e57 100644
> --- a/drivers/mmc/host/sdhci-s3c.c
> +++ b/drivers/mmc/host/sdhci-s3c.c
> @@ -22,6 +22,7 @@
>
> ?#include <linux/mmc/host.h>
>
> +#include <plat/gpio-cfg.h>
> ?#include <plat/sdhci.h>
> ?#include <plat/regs-sdhci.h>
>
> @@ -213,6 +214,36 @@ static void sdhci_s3c_set_clock(struct sdhci_host *host, unsigned int clock)
> ?}
>
> ?/**
> + * sdhci_s3c_get_ro - callback for get_ro
> + * @host: The SDHCI host being changed
> + *
> + * If the WP pin is connected with GPIO, can get the value which indicates
> + * the card is locked or not.
> +*/
> +static int sdhci_s3c_get_ro(struct mmc_host *mmc)
> +{
> + ? ? ? struct sdhci_s3c *sc;
> + ? ? ? struct sdhci_host *host;
> +
> + ? ? ? host = mmc_priv(mmc);
> + ? ? ? sc = sdhci_priv(host);
> +
> + ? ? ? return gpio_get_value(sc->pdata->wp_gpio);
> +}
> +
> +/**
> + * sdhci_s3c_cfg_wp - configure GPIO for WP pin
> + * @gpio_num: GPIO number which connected with WP line from SD/MMC slot
> + *
> + * Configure GPIO for using WP line
> +*/
> +static void sdhci_s3c_cfg_wp(unsigned int gpio_num)
> +{
> + ? ? ? s3c_gpio_cfgpin(gpio_num, S3C_GPIO_INPUT);
> + ? ? ? s3c_gpio_setpull(gpio_num, S3C_GPIO_PULL_UP);
> +}
> +
> +/**
> ?* sdhci_s3c_get_min_clock - callback to get minimal supported clock value
> ?* @host: The SDHCI host being queried
> ?*
> @@ -375,6 +406,9 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev)
> ? ? ? ?if (pdata->cfg_gpio)
> ? ? ? ? ? ? ? ?pdata->cfg_gpio(pdev, pdata->max_width);
>
> + ? ? ? if (gpio_is_valid(pdata->wp_gpio))
> + ? ? ? ? ? ? ? sdhci_s3c_ops.get_ro = sdhci_s3c_get_ro;
> +
> ? ? ? ?host->hw_name = "samsung-hsmmc";
> ? ? ? ?host->ops = &sdhci_s3c_ops;
> ? ? ? ?host->quirks = 0;
> @@ -408,6 +442,15 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev)
> ? ? ? ?host->quirks |= (SDHCI_QUIRK_32BIT_DMA_ADDR |
> ? ? ? ? ? ? ? ? ? ? ? ? SDHCI_QUIRK_32BIT_DMA_SIZE);
>
> + ? ? ? /* Controller's WP pin donsn't connected with SD card and there is an
> + ? ? ? ?* allocated GPIO for getting WP data form SD card, use this quirk and
> + ? ? ? ?* send the GPIO number in pdata->wp_gpio. */
> + ? ? ? host->quirks |= SDHCI_QUIRK_NO_WP_BIT;
> +
> + ? ? ? /* to configure gpio pin as a card write protection signal */
> + ? ? ? if (gpio_is_valid(pdata->wp_gpio))
> + ? ? ? ? ? ? ? sdhci_s3c_cfg_wp(pdata->wp_gpio);
> +
Put it just one place like this.
if (gpio_is_valid(pdata->wp_gpio)) {
sdhci_s3c_cfg_wp(pdata->wp_gpio);
sdhci_s3c_ops.get_ro = sdhci_s3c_get_ro;
host->quirks |= SDHCI_QUIRK_NO_WP_BIT;
}
It reduce the below quirks check by one. If you add the quriks as your
patch, host->quirks are always true whether WP use or not.
Thank you,
Kyungmin Park
> ? ? ? ?ret = sdhci_add_host(host);
> ? ? ? ?if (ret) {
> ? ? ? ? ? ? ? ?dev_err(dev, "sdhci_add_host() failed\n");
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index f9ca4c6..7fba401 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -1198,6 +1198,9 @@ static int sdhci_get_ro(struct mmc_host *mmc)
>
> ? ? ? ?host = mmc_priv(mmc);
>
> + ? ? ? if ((host->quirks & SDHCI_QUIRK_NO_WP_BIT) && host->ops->get_ro)
> + ? ? ? ? ? ? ? return host->ops->get_ro(mmc);
> +
> ? ? ? ?spin_lock_irqsave(&host->lock, flags);
>
> ? ? ? ?if (host->flags & SDHCI_DEVICE_DEAD)
> diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
> index 0de8b38..dd9a233 100644
> --- a/drivers/mmc/host/sdhci.h
> +++ b/drivers/mmc/host/sdhci.h
> @@ -247,6 +247,8 @@ struct sdhci_host {
> ?#define SDHCI_QUIRK_MISSING_CAPS ? ? ? ? ? ? ? ? ? ? ? (1<<28)
> ?/* Controller has nonstandard clock management */
> ?#define SDHCI_QUIRK_NONSTANDARD_MINCLOCK ? ? ? ? ? ? ? (1<<29)
> +/* Controller has no write-protect pin connected with SD card */
> +#define SDHCI_QUIRK_NO_WP_BIT ? ? ? ? ? ? ? ? ? ? ? ? ?(1<<30)
>
> ? ? ? ?int ? ? ? ? ? ? ? ? ? ? irq; ? ? ? ? ? ?/* Device IRQ */
> ? ? ? ?void __iomem * ? ? ? ? ?ioaddr; ? ? ? ? /* Mapped address */
> @@ -321,6 +323,7 @@ struct sdhci_ops {
> ? ? ? ?unsigned int ? ?(*get_max_clock)(struct sdhci_host *host);
> ? ? ? ?unsigned int ? ?(*get_min_clock)(struct sdhci_host *host);
> ? ? ? ?unsigned int ? ?(*get_timeout_clock)(struct sdhci_host *host);
> + ? ? ? int ? ? ? ? ? ? (*get_ro)(struct mmc_host *mmc);
> ?};
>
> ?#ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS
> --
> 1.6.2.5
>
> --
> 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
>
^ permalink raw reply [flat|nested] 26+ messages in thread* RE: [PATCH v3 3/3] sdhci-s3c: Add SDHCI_QUIRK_NO_WP_BIT quirk for Samsung SoC
2010-07-23 12:50 ` Kyungmin Park
@ 2010-07-27 12:21 ` Kukjin Kim
-1 siblings, 0 replies; 26+ messages in thread
From: Kukjin Kim @ 2010-07-27 12:21 UTC (permalink / raw)
To: 'Kyungmin Park'
Cc: linux-arm-kernel, linux-samsung-soc, linux-mmc, ben-linux, akpm,
'Hyuk Lee'
Kyungmin Park wrote:
>
> On Fri, Jul 23, 2010 at 8:56 PM, Kukjin Kim <kgene.kim@samsung.com> wrote:
> > From: Hyuk Lee <hyuk1.lee@samsung.com>
> >
> > If host controller doesn't have WP pin which should be connnected with
SDMMC
> > card WP pin, can implement get_ro function with using the allocated
gpio.
> > In order to use this quirk wp_gpio in the platform data must be set.
> >
> > Signed-off-by: Hyuk Lee <hyuk1.lee@samsung.com>
> > Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
> > ---
> > drivers/mmc/host/sdhci-s3c.c | 43
> ++++++++++++++++++++++++++++++++++++++++++
> > drivers/mmc/host/sdhci.c | 3 ++
> > drivers/mmc/host/sdhci.h | 3 ++
> > 3 files changed, 49 insertions(+), 0 deletions(-)
> >
> > diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c
> > index 0d25285..0b75e57 100644
> > --- a/drivers/mmc/host/sdhci-s3c.c
> > +++ b/drivers/mmc/host/sdhci-s3c.c
> > @@ -22,6 +22,7 @@
> >
> > #include <linux/mmc/host.h>
> >
> > +#include <plat/gpio-cfg.h>
> > #include <plat/sdhci.h>
> > #include <plat/regs-sdhci.h>
> >
> > @@ -213,6 +214,36 @@ static void sdhci_s3c_set_clock(struct sdhci_host
*host,
> unsigned int clock)
> > }
> >
> > /**
> > + * sdhci_s3c_get_ro - callback for get_ro
> > + * @host: The SDHCI host being changed
> > + *
> > + * If the WP pin is connected with GPIO, can get the value which
indicates
> > + * the card is locked or not.
> > +*/
> > +static int sdhci_s3c_get_ro(struct mmc_host *mmc)
> > +{
> > + struct sdhci_s3c *sc;
> > + struct sdhci_host *host;
> > +
> > + host = mmc_priv(mmc);
> > + sc = sdhci_priv(host);
> > +
> > + return gpio_get_value(sc->pdata->wp_gpio);
> > +}
> > +
> > +/**
> > + * sdhci_s3c_cfg_wp - configure GPIO for WP pin
> > + * @gpio_num: GPIO number which connected with WP line from SD/MMC slot
> > + *
> > + * Configure GPIO for using WP line
> > +*/
> > +static void sdhci_s3c_cfg_wp(unsigned int gpio_num)
> > +{
> > + s3c_gpio_cfgpin(gpio_num, S3C_GPIO_INPUT);
> > + s3c_gpio_setpull(gpio_num, S3C_GPIO_PULL_UP);
> > +}
> > +
> > +/**
> > * sdhci_s3c_get_min_clock - callback to get minimal supported clock
value
> > * @host: The SDHCI host being queried
> > *
> > @@ -375,6 +406,9 @@ static int __devinit sdhci_s3c_probe(struct
> platform_device *pdev)
> > if (pdata->cfg_gpio)
> > pdata->cfg_gpio(pdev, pdata->max_width);
> >
> > + if (gpio_is_valid(pdata->wp_gpio))
> > + sdhci_s3c_ops.get_ro = sdhci_s3c_get_ro;
> > +
> > host->hw_name = "samsung-hsmmc";
> > host->ops = &sdhci_s3c_ops;
> > host->quirks = 0;
> > @@ -408,6 +442,15 @@ static int __devinit sdhci_s3c_probe(struct
> platform_device *pdev)
> > host->quirks |= (SDHCI_QUIRK_32BIT_DMA_ADDR |
> > SDHCI_QUIRK_32BIT_DMA_SIZE);
> >
> > + /* Controller's WP pin donsn't connected with SD card and there
is an
> > + * allocated GPIO for getting WP data form SD card, use this
quirk and
> > + * send the GPIO number in pdata->wp_gpio. */
> > + host->quirks |= SDHCI_QUIRK_NO_WP_BIT;
> > +
> > + /* to configure gpio pin as a card write protection signal */
> > + if (gpio_is_valid(pdata->wp_gpio))
> > + sdhci_s3c_cfg_wp(pdata->wp_gpio);
> > +
>
> Put it just one place like this.
>
> if (gpio_is_valid(pdata->wp_gpio)) {
> sdhci_s3c_cfg_wp(pdata->wp_gpio);
> sdhci_s3c_ops.get_ro = sdhci_s3c_get_ro;
> host->quirks |= SDHCI_QUIRK_NO_WP_BIT;
> }
>
> It reduce the below quirks check by one. If you add the quriks as your
> patch, host->quirks are always true whether WP use or not.
>
Ok..thanks for your suggestion.
Will re-submit as per your comments.
> Thank you,
> Kyungmin Park
> > ret = sdhci_add_host(host);
> > if (ret) {
> > dev_err(dev, "sdhci_add_host() failed\n");
> > diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> > index f9ca4c6..7fba401 100644
> > --- a/drivers/mmc/host/sdhci.c
> > +++ b/drivers/mmc/host/sdhci.c
> > @@ -1198,6 +1198,9 @@ static int sdhci_get_ro(struct mmc_host *mmc)
> >
> > host = mmc_priv(mmc);
> >
> > + if ((host->quirks & SDHCI_QUIRK_NO_WP_BIT) && host->ops->get_ro)
> > + return host->ops->get_ro(mmc);
> > +
> > spin_lock_irqsave(&host->lock, flags);
> >
> > if (host->flags & SDHCI_DEVICE_DEAD)
> > diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
> > index 0de8b38..dd9a233 100644
> > --- a/drivers/mmc/host/sdhci.h
> > +++ b/drivers/mmc/host/sdhci.h
> > @@ -247,6 +247,8 @@ struct sdhci_host {
> > #define SDHCI_QUIRK_MISSING_CAPS (1<<28)
> > /* Controller has nonstandard clock management */
> > #define SDHCI_QUIRK_NONSTANDARD_MINCLOCK (1<<29)
> > +/* Controller has no write-protect pin connected with SD card */
> > +#define SDHCI_QUIRK_NO_WP_BIT (1<<30)
> >
> > int irq; /* Device IRQ */
> > void __iomem * ioaddr; /* Mapped address */
> > @@ -321,6 +323,7 @@ struct sdhci_ops {
> > unsigned int (*get_max_clock)(struct sdhci_host *host);
> > unsigned int (*get_min_clock)(struct sdhci_host *host);
> > unsigned int (*get_timeout_clock)(struct sdhci_host *host);
> > + int (*get_ro)(struct mmc_host *mmc);
> > };
> >
> > #ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS
> > --
> > 1.6.2.5
> >
> > --
Thanks.
Best regards,
Kgene.
--
Kukjin Kim <kgene.kim@samsung.com>, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.
^ permalink raw reply [flat|nested] 26+ messages in thread* [PATCH v3 3/3] sdhci-s3c: Add SDHCI_QUIRK_NO_WP_BIT quirk for Samsung SoC
@ 2010-07-27 12:21 ` Kukjin Kim
0 siblings, 0 replies; 26+ messages in thread
From: Kukjin Kim @ 2010-07-27 12:21 UTC (permalink / raw)
To: linux-arm-kernel
Kyungmin Park wrote:
>
> On Fri, Jul 23, 2010 at 8:56 PM, Kukjin Kim <kgene.kim@samsung.com> wrote:
> > From: Hyuk Lee <hyuk1.lee@samsung.com>
> >
> > If host controller doesn't have WP pin which should be connnected with
SDMMC
> > card WP pin, can implement get_ro function with using the allocated
gpio.
> > In order to use this quirk wp_gpio in the platform data must be set.
> >
> > Signed-off-by: Hyuk Lee <hyuk1.lee@samsung.com>
> > Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
> > ---
> > ?drivers/mmc/host/sdhci-s3c.c | ? 43
> ++++++++++++++++++++++++++++++++++++++++++
> > ?drivers/mmc/host/sdhci.c ? ? | ? ?3 ++
> > ?drivers/mmc/host/sdhci.h ? ? | ? ?3 ++
> > ?3 files changed, 49 insertions(+), 0 deletions(-)
> >
> > diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c
> > index 0d25285..0b75e57 100644
> > --- a/drivers/mmc/host/sdhci-s3c.c
> > +++ b/drivers/mmc/host/sdhci-s3c.c
> > @@ -22,6 +22,7 @@
> >
> > ?#include <linux/mmc/host.h>
> >
> > +#include <plat/gpio-cfg.h>
> > ?#include <plat/sdhci.h>
> > ?#include <plat/regs-sdhci.h>
> >
> > @@ -213,6 +214,36 @@ static void sdhci_s3c_set_clock(struct sdhci_host
*host,
> unsigned int clock)
> > ?}
> >
> > ?/**
> > + * sdhci_s3c_get_ro - callback for get_ro
> > + * @host: The SDHCI host being changed
> > + *
> > + * If the WP pin is connected with GPIO, can get the value which
indicates
> > + * the card is locked or not.
> > +*/
> > +static int sdhci_s3c_get_ro(struct mmc_host *mmc)
> > +{
> > + ? ? ? struct sdhci_s3c *sc;
> > + ? ? ? struct sdhci_host *host;
> > +
> > + ? ? ? host = mmc_priv(mmc);
> > + ? ? ? sc = sdhci_priv(host);
> > +
> > + ? ? ? return gpio_get_value(sc->pdata->wp_gpio);
> > +}
> > +
> > +/**
> > + * sdhci_s3c_cfg_wp - configure GPIO for WP pin
> > + * @gpio_num: GPIO number which connected with WP line from SD/MMC slot
> > + *
> > + * Configure GPIO for using WP line
> > +*/
> > +static void sdhci_s3c_cfg_wp(unsigned int gpio_num)
> > +{
> > + ? ? ? s3c_gpio_cfgpin(gpio_num, S3C_GPIO_INPUT);
> > + ? ? ? s3c_gpio_setpull(gpio_num, S3C_GPIO_PULL_UP);
> > +}
> > +
> > +/**
> > ?* sdhci_s3c_get_min_clock - callback to get minimal supported clock
value
> > ?* @host: The SDHCI host being queried
> > ?*
> > @@ -375,6 +406,9 @@ static int __devinit sdhci_s3c_probe(struct
> platform_device *pdev)
> > ? ? ? ?if (pdata->cfg_gpio)
> > ? ? ? ? ? ? ? ?pdata->cfg_gpio(pdev, pdata->max_width);
> >
> > + ? ? ? if (gpio_is_valid(pdata->wp_gpio))
> > + ? ? ? ? ? ? ? sdhci_s3c_ops.get_ro = sdhci_s3c_get_ro;
> > +
> > ? ? ? ?host->hw_name = "samsung-hsmmc";
> > ? ? ? ?host->ops = &sdhci_s3c_ops;
> > ? ? ? ?host->quirks = 0;
> > @@ -408,6 +442,15 @@ static int __devinit sdhci_s3c_probe(struct
> platform_device *pdev)
> > ? ? ? ?host->quirks |= (SDHCI_QUIRK_32BIT_DMA_ADDR |
> > ? ? ? ? ? ? ? ? ? ? ? ? SDHCI_QUIRK_32BIT_DMA_SIZE);
> >
> > + ? ? ? /* Controller's WP pin donsn't connected with SD card and there
is an
> > + ? ? ? ?* allocated GPIO for getting WP data form SD card, use this
quirk and
> > + ? ? ? ?* send the GPIO number in pdata->wp_gpio. */
> > + ? ? ? host->quirks |= SDHCI_QUIRK_NO_WP_BIT;
> > +
> > + ? ? ? /* to configure gpio pin as a card write protection signal */
> > + ? ? ? if (gpio_is_valid(pdata->wp_gpio))
> > + ? ? ? ? ? ? ? sdhci_s3c_cfg_wp(pdata->wp_gpio);
> > +
>
> Put it just one place like this.
>
> if (gpio_is_valid(pdata->wp_gpio)) {
> sdhci_s3c_cfg_wp(pdata->wp_gpio);
> sdhci_s3c_ops.get_ro = sdhci_s3c_get_ro;
> host->quirks |= SDHCI_QUIRK_NO_WP_BIT;
> }
>
> It reduce the below quirks check by one. If you add the quriks as your
> patch, host->quirks are always true whether WP use or not.
>
Ok..thanks for your suggestion.
Will re-submit as per your comments.
> Thank you,
> Kyungmin Park
> > ? ? ? ?ret = sdhci_add_host(host);
> > ? ? ? ?if (ret) {
> > ? ? ? ? ? ? ? ?dev_err(dev, "sdhci_add_host() failed\n");
> > diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> > index f9ca4c6..7fba401 100644
> > --- a/drivers/mmc/host/sdhci.c
> > +++ b/drivers/mmc/host/sdhci.c
> > @@ -1198,6 +1198,9 @@ static int sdhci_get_ro(struct mmc_host *mmc)
> >
> > ? ? ? ?host = mmc_priv(mmc);
> >
> > + ? ? ? if ((host->quirks & SDHCI_QUIRK_NO_WP_BIT) && host->ops->get_ro)
> > + ? ? ? ? ? ? ? return host->ops->get_ro(mmc);
> > +
> > ? ? ? ?spin_lock_irqsave(&host->lock, flags);
> >
> > ? ? ? ?if (host->flags & SDHCI_DEVICE_DEAD)
> > diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
> > index 0de8b38..dd9a233 100644
> > --- a/drivers/mmc/host/sdhci.h
> > +++ b/drivers/mmc/host/sdhci.h
> > @@ -247,6 +247,8 @@ struct sdhci_host {
> > ?#define SDHCI_QUIRK_MISSING_CAPS ? ? ? ? ? ? ? ? ? ? ? (1<<28)
> > ?/* Controller has nonstandard clock management */
> > ?#define SDHCI_QUIRK_NONSTANDARD_MINCLOCK ? ? ? ? ? ? ? (1<<29)
> > +/* Controller has no write-protect pin connected with SD card */
> > +#define SDHCI_QUIRK_NO_WP_BIT ? ? ? ? ? ? ? ? ? ? ? ? ?(1<<30)
> >
> > ? ? ? ?int ? ? ? ? ? ? ? ? ? ? irq; ? ? ? ? ? ?/* Device IRQ */
> > ? ? ? ?void __iomem * ? ? ? ? ?ioaddr; ? ? ? ? /* Mapped address */
> > @@ -321,6 +323,7 @@ struct sdhci_ops {
> > ? ? ? ?unsigned int ? ?(*get_max_clock)(struct sdhci_host *host);
> > ? ? ? ?unsigned int ? ?(*get_min_clock)(struct sdhci_host *host);
> > ? ? ? ?unsigned int ? ?(*get_timeout_clock)(struct sdhci_host *host);
> > + ? ? ? int ? ? ? ? ? ? (*get_ro)(struct mmc_host *mmc);
> > ?};
> >
> > ?#ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS
> > --
> > 1.6.2.5
> >
> > --
Thanks.
Best regards,
Kgene.
--
Kukjin Kim <kgene.kim@samsung.com>, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.
^ permalink raw reply [flat|nested] 26+ messages in thread* Re: [PATCH v3 3/3] sdhci-s3c: Add SDHCI_QUIRK_NO_WP_BIT quirk for Samsung SoC
2010-07-27 12:21 ` Kukjin Kim
@ 2010-07-28 3:17 ` nitin vishnoi
-1 siblings, 0 replies; 26+ messages in thread
From: nitin vishnoi @ 2010-07-28 3:17 UTC (permalink / raw)
To: Kukjin Kim
Cc: linux-samsung-soc, Kyungmin Park, Hyuk Lee, linux-mmc, ben-linux,
akpm, linux-arm-kernel
[-- Attachment #1.1: Type: text/plain, Size: 4264 bytes --]
Hi
I am porting the 2.6.33.6 kernel,which i took from kernel.org.I am trying to
port it on samsung-s3c2451 board.
But i am not getting the shell prompt,due to getting the following error.Any
body can tell due to what this error i am getting?
Starting kernel ...
Uncompressing Linux... done, booting the kernel.
Linux version 2.6.33.6 (root@ubntu-desktop) (gcc version 4.2.2) #12 Mon Jul
26 18:39:19 IST 2010
CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177
CPU: VIVT data cache, VIVT instruction cache
Machine: SMDK2450
Ignoring unrecognised tag 0x00000000
Memory policy: ECC disabled, Data cache writeback
CPU S3C2450 EVT3 (id 0x32450003)
SPA epll 80200102 Mpll 80640061 clkdiv0 557
S3C24XX Clocks, (c) 2004 Simtec Electronics
S3C2450: mpll on 800.000 MHz, cpu 400.000 MHz, mem 133.333 MHz, pclk 66.666
MHz
S3C2450: epll on 96.000 MHz, usb-bus 48.000 MHz
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16256
Kernel command line: root=/dev/ram0 initrd=0x30800000,16M ramdisk=32768
init=/bin/sh console=ttySAC3,115200 mem=64M
PID hash table entries: 256 (order: -2, 1024 bytes)
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Memory: 64MB = 64MB total
Memory: 45432KB available (2588K code, 271K data, 116K init, 0K highmem)
Hierarchical RCU implementation.
NR_IRQS:109
irq: clearing subpending status 02000006
irq: clearing subpending status 02000002
timer tcon=00000000, tcnt 28af, tcfg 00000f00,00000000, usec 00007ae2
Console: colour dummy device 80x30
console [ttySAC3] enabled
Calibrating delay loop... 398.95 BogoMIPS (lpj=997376)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
NET: Registered protocol family 16
whats up blady
hello
entered machine init
S3C Power Management, Copyright 2004 Simtec Electronics
S3C2450: Initialising architecture
SPA s3c2450_init
S3C2450: IRQ Support
bio: create slab <bio-0> at 0
SCSI subsystem initialized
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 2048 (order: 2, 16384 bytes)
TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
TCP: Hash tables configured (established 2048 bind 2048)
TCP reno registered
UDP hash table entries: 256 (order: 0, 4096 bytes)
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
NET: Registered protocol family 1
Trying to unpack rootfs image as initramfs...
rootfs image is not initramfs (no cpio magic); looks like an initrd
Freeing initrd memory: 16384K
NetWinder Floating Point Emulator V0.97 (double precision)
JFFS2 version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
ROMFS MTD (C) 2007 Red Hat, Inc.
msgmni has been set to 120
alg: No test for stdrng (krng)
Block layer SCSI generic (bsg) driver version 0.4 loaded (major 254)
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
brd: module loaded
loop: module loaded
Uniform Multi-Platform E-IDE driver
ide-gd driver 1.18
ide-cd driver 5.00
PPP generic driver version 2.4.2
PPP Deflate Compression module registered
PPP BSD Compression module registered
PPP MPPE Compression module registered
NET: Registered protocol family 24
SLIP: version 0.8.4-NET3.019-NEWTTY (dynamic channels, max=256).
CSLIP: code copyright 1989 Regents of the University of California.
mice: PS/2 mouse device common for all mice
TCP cubic registered
RAMDISK: gzip image found at block 0
EXT2-fs (ram0): warning: maximal mount count reached, running e2fsck is
recommended
VFS: Mounted root (ext2 filesystem) on device 1:0.
Freeing init memory: 116K
Warning: unable to open an initial console.
Kernel panic - not syncing: Attempted to kill init!
[<c002b900>] (unwind_backtrace+0x0/0xe0) from [<c003fe9c>]
(panic+0x40/0x12c)
[<c003fe9c>] (panic+0x40/0x12c) from [<c0042cac>] (do_exit+0x58/0x57c)
[<c0042cac>] (do_exit+0x58/0x57c) from [<c0043254>]
(do_group_exit+0x84/0xb8)
[<c0043254>] (do_group_exit+0x84/0xb8) from [<c004329c>]
(sys_exit_group+0x14/0x20)
[<c004329c>] (sys_exit_group+0x14/0x20) from [<c0025e80>]
(ret_fast_syscall+0x0/0x28)
Regards
Nitin
[-- Attachment #1.2: Type: text/html, Size: 4635 bytes --]
[-- Attachment #2: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 26+ messages in thread
* [PATCH v3 3/3] sdhci-s3c: Add SDHCI_QUIRK_NO_WP_BIT quirk for Samsung SoC
@ 2010-07-28 3:17 ` nitin vishnoi
0 siblings, 0 replies; 26+ messages in thread
From: nitin vishnoi @ 2010-07-28 3:17 UTC (permalink / raw)
To: linux-arm-kernel
Hi
I am porting the 2.6.33.6 kernel,which i took from kernel.org.I am trying to
port it on samsung-s3c2451 board.
But i am not getting the shell prompt,due to getting the following error.Any
body can tell due to what this error i am getting?
Starting kernel ...
Uncompressing Linux... done, booting the kernel.
Linux version 2.6.33.6 (root at ubntu-desktop) (gcc version 4.2.2) #12 Mon Jul
26 18:39:19 IST 2010
CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177
CPU: VIVT data cache, VIVT instruction cache
Machine: SMDK2450
Ignoring unrecognised tag 0x00000000
Memory policy: ECC disabled, Data cache writeback
CPU S3C2450 EVT3 (id 0x32450003)
SPA epll 80200102 Mpll 80640061 clkdiv0 557
S3C24XX Clocks, (c) 2004 Simtec Electronics
S3C2450: mpll on 800.000 MHz, cpu 400.000 MHz, mem 133.333 MHz, pclk 66.666
MHz
S3C2450: epll on 96.000 MHz, usb-bus 48.000 MHz
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16256
Kernel command line: root=/dev/ram0 initrd=0x30800000,16M ramdisk=32768
init=/bin/sh console=ttySAC3,115200 mem=64M
PID hash table entries: 256 (order: -2, 1024 bytes)
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Memory: 64MB = 64MB total
Memory: 45432KB available (2588K code, 271K data, 116K init, 0K highmem)
Hierarchical RCU implementation.
NR_IRQS:109
irq: clearing subpending status 02000006
irq: clearing subpending status 02000002
timer tcon=00000000, tcnt 28af, tcfg 00000f00,00000000, usec 00007ae2
Console: colour dummy device 80x30
console [ttySAC3] enabled
Calibrating delay loop... 398.95 BogoMIPS (lpj=997376)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
NET: Registered protocol family 16
whats up blady
hello
entered machine init
S3C Power Management, Copyright 2004 Simtec Electronics
S3C2450: Initialising architecture
SPA s3c2450_init
S3C2450: IRQ Support
bio: create slab <bio-0> at 0
SCSI subsystem initialized
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 2048 (order: 2, 16384 bytes)
TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
TCP: Hash tables configured (established 2048 bind 2048)
TCP reno registered
UDP hash table entries: 256 (order: 0, 4096 bytes)
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
NET: Registered protocol family 1
Trying to unpack rootfs image as initramfs...
rootfs image is not initramfs (no cpio magic); looks like an initrd
Freeing initrd memory: 16384K
NetWinder Floating Point Emulator V0.97 (double precision)
JFFS2 version 2.2. (NAND) ?? 2001-2006 Red Hat, Inc.
ROMFS MTD (C) 2007 Red Hat, Inc.
msgmni has been set to 120
alg: No test for stdrng (krng)
Block layer SCSI generic (bsg) driver version 0.4 loaded (major 254)
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
brd: module loaded
loop: module loaded
Uniform Multi-Platform E-IDE driver
ide-gd driver 1.18
ide-cd driver 5.00
PPP generic driver version 2.4.2
PPP Deflate Compression module registered
PPP BSD Compression module registered
PPP MPPE Compression module registered
NET: Registered protocol family 24
SLIP: version 0.8.4-NET3.019-NEWTTY (dynamic channels, max=256).
CSLIP: code copyright 1989 Regents of the University of California.
mice: PS/2 mouse device common for all mice
TCP cubic registered
RAMDISK: gzip image found at block 0
EXT2-fs (ram0): warning: maximal mount count reached, running e2fsck is
recommended
VFS: Mounted root (ext2 filesystem) on device 1:0.
Freeing init memory: 116K
Warning: unable to open an initial console.
Kernel panic - not syncing: Attempted to kill init!
[<c002b900>] (unwind_backtrace+0x0/0xe0) from [<c003fe9c>]
(panic+0x40/0x12c)
[<c003fe9c>] (panic+0x40/0x12c) from [<c0042cac>] (do_exit+0x58/0x57c)
[<c0042cac>] (do_exit+0x58/0x57c) from [<c0043254>]
(do_group_exit+0x84/0xb8)
[<c0043254>] (do_group_exit+0x84/0xb8) from [<c004329c>]
(sys_exit_group+0x14/0x20)
[<c004329c>] (sys_exit_group+0x14/0x20) from [<c0025e80>]
(ret_fast_syscall+0x0/0x28)
Regards
Nitin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20100728/aaf0936f/attachment-0001.html>
^ permalink raw reply [flat|nested] 26+ messages in thread
* RE: [PATCH v3 3/3] sdhci-s3c: Add SDHCI_QUIRK_NO_WP_BIT quirk for Samsung SoC
2010-07-23 11:56 ` Kukjin Kim
@ 2010-07-23 13:17 ` Marek Szyprowski
-1 siblings, 0 replies; 26+ messages in thread
From: Marek Szyprowski @ 2010-07-23 13:17 UTC (permalink / raw)
To: 'Kukjin Kim', linux-arm-kernel, linux-samsung-soc,
linux-mmc
Cc: akpm, ben-linux, 'Hyuk Lee'
Hello,
On Friday, July 23, 2010 1:57 PM Kukjin Kim wrote:
> From: Hyuk Lee <hyuk1.lee@samsung.com>
>
> If host controller doesn't have WP pin which should be connnected with
> SDMMC
> card WP pin, can implement get_ro function with using the allocated gpio.
> In order to use this quirk wp_gpio in the platform data must be set.
>
> Signed-off-by: Hyuk Lee <hyuk1.lee@samsung.com>
> Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
> ---
> drivers/mmc/host/sdhci-s3c.c | 43
> ++++++++++++++++++++++++++++++++++++++++++
> drivers/mmc/host/sdhci.c | 3 ++
> drivers/mmc/host/sdhci.h | 3 ++
> 3 files changed, 49 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c
> index 0d25285..0b75e57 100644
> --- a/drivers/mmc/host/sdhci-s3c.c
> +++ b/drivers/mmc/host/sdhci-s3c.c
> @@ -22,6 +22,7 @@
>
> #include <linux/mmc/host.h>
>
> +#include <plat/gpio-cfg.h>
> #include <plat/sdhci.h>
> #include <plat/regs-sdhci.h>
>
> @@ -213,6 +214,36 @@ static void sdhci_s3c_set_clock(struct sdhci_host
> *host, unsigned int clock)
> }
>
> /**
> + * sdhci_s3c_get_ro - callback for get_ro
> + * @host: The SDHCI host being changed
> + *
> + * If the WP pin is connected with GPIO, can get the value which indicates
> + * the card is locked or not.
> +*/
> +static int sdhci_s3c_get_ro(struct mmc_host *mmc)
> +{
> + struct sdhci_s3c *sc;
> + struct sdhci_host *host;
> +
> + host = mmc_priv(mmc);
> + sc = sdhci_priv(host);
> +
> + return gpio_get_value(sc->pdata->wp_gpio);
> +}
> +
> +/**
> + * sdhci_s3c_cfg_wp - configure GPIO for WP pin
> + * @gpio_num: GPIO number which connected with WP line from SD/MMC slot
> + *
> + * Configure GPIO for using WP line
> +*/
> +static void sdhci_s3c_cfg_wp(unsigned int gpio_num)
> +{
> + s3c_gpio_cfgpin(gpio_num, S3C_GPIO_INPUT);
> + s3c_gpio_setpull(gpio_num, S3C_GPIO_PULL_UP);
> +}
> +
> +/**
> * sdhci_s3c_get_min_clock - callback to get minimal supported clock value
> * @host: The SDHCI host being queried
> *
> @@ -375,6 +406,9 @@ static int __devinit sdhci_s3c_probe(struct
> platform_device *pdev)
> if (pdata->cfg_gpio)
> pdata->cfg_gpio(pdev, pdata->max_width);
>
> + if (gpio_is_valid(pdata->wp_gpio))
> + sdhci_s3c_ops.get_ro = sdhci_s3c_get_ro;
> +
There is still a problem here, but the opposite to the issue from V1 of this
patch.
If one apply the current version, he would need to set pdata->wp_gpio to -1 on
all
existing platforms to get old behavior of the driver. Leaving it as zero means
that
the driver will try to use GPA(0) for write protection.
Adding one more field to pdata (like "bool has_gpio_wp") seems to be unavoidable
in this case imho.
> (snip)
Best regards
--
Marek Szyprowski
Samsung Poland R&D Center
^ permalink raw reply [flat|nested] 26+ messages in thread* [PATCH v3 3/3] sdhci-s3c: Add SDHCI_QUIRK_NO_WP_BIT quirk for Samsung SoC
@ 2010-07-23 13:17 ` Marek Szyprowski
0 siblings, 0 replies; 26+ messages in thread
From: Marek Szyprowski @ 2010-07-23 13:17 UTC (permalink / raw)
To: linux-arm-kernel
Hello,
On Friday, July 23, 2010 1:57 PM Kukjin Kim wrote:
> From: Hyuk Lee <hyuk1.lee@samsung.com>
>
> If host controller doesn't have WP pin which should be connnected with
> SDMMC
> card WP pin, can implement get_ro function with using the allocated gpio.
> In order to use this quirk wp_gpio in the platform data must be set.
>
> Signed-off-by: Hyuk Lee <hyuk1.lee@samsung.com>
> Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
> ---
> drivers/mmc/host/sdhci-s3c.c | 43
> ++++++++++++++++++++++++++++++++++++++++++
> drivers/mmc/host/sdhci.c | 3 ++
> drivers/mmc/host/sdhci.h | 3 ++
> 3 files changed, 49 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c
> index 0d25285..0b75e57 100644
> --- a/drivers/mmc/host/sdhci-s3c.c
> +++ b/drivers/mmc/host/sdhci-s3c.c
> @@ -22,6 +22,7 @@
>
> #include <linux/mmc/host.h>
>
> +#include <plat/gpio-cfg.h>
> #include <plat/sdhci.h>
> #include <plat/regs-sdhci.h>
>
> @@ -213,6 +214,36 @@ static void sdhci_s3c_set_clock(struct sdhci_host
> *host, unsigned int clock)
> }
>
> /**
> + * sdhci_s3c_get_ro - callback for get_ro
> + * @host: The SDHCI host being changed
> + *
> + * If the WP pin is connected with GPIO, can get the value which indicates
> + * the card is locked or not.
> +*/
> +static int sdhci_s3c_get_ro(struct mmc_host *mmc)
> +{
> + struct sdhci_s3c *sc;
> + struct sdhci_host *host;
> +
> + host = mmc_priv(mmc);
> + sc = sdhci_priv(host);
> +
> + return gpio_get_value(sc->pdata->wp_gpio);
> +}
> +
> +/**
> + * sdhci_s3c_cfg_wp - configure GPIO for WP pin
> + * @gpio_num: GPIO number which connected with WP line from SD/MMC slot
> + *
> + * Configure GPIO for using WP line
> +*/
> +static void sdhci_s3c_cfg_wp(unsigned int gpio_num)
> +{
> + s3c_gpio_cfgpin(gpio_num, S3C_GPIO_INPUT);
> + s3c_gpio_setpull(gpio_num, S3C_GPIO_PULL_UP);
> +}
> +
> +/**
> * sdhci_s3c_get_min_clock - callback to get minimal supported clock value
> * @host: The SDHCI host being queried
> *
> @@ -375,6 +406,9 @@ static int __devinit sdhci_s3c_probe(struct
> platform_device *pdev)
> if (pdata->cfg_gpio)
> pdata->cfg_gpio(pdev, pdata->max_width);
>
> + if (gpio_is_valid(pdata->wp_gpio))
> + sdhci_s3c_ops.get_ro = sdhci_s3c_get_ro;
> +
There is still a problem here, but the opposite to the issue from V1 of this
patch.
If one apply the current version, he would need to set pdata->wp_gpio to -1 on
all
existing platforms to get old behavior of the driver. Leaving it as zero means
that
the driver will try to use GPA(0) for write protection.
Adding one more field to pdata (like "bool has_gpio_wp") seems to be unavoidable
in this case imho.
> (snip)
Best regards
--
Marek Szyprowski
Samsung Poland R&D Center
^ permalink raw reply [flat|nested] 26+ messages in thread* RE: [PATCH v3 3/3] sdhci-s3c: Add SDHCI_QUIRK_NO_WP_BIT quirk for Samsung SoC
2010-07-23 13:17 ` Marek Szyprowski
@ 2010-07-27 12:21 ` Kukjin Kim
-1 siblings, 0 replies; 26+ messages in thread
From: Kukjin Kim @ 2010-07-27 12:21 UTC (permalink / raw)
To: 'Marek Szyprowski', linux-arm-kernel, linux-samsung-soc,
linux-mmc
Cc: akpm, 'Hyuk Lee', ben-linux
Marek Szyprowski wrote:
>
> Hello,
>
> On Friday, July 23, 2010 1:57 PM Kukjin Kim wrote:
>
> > From: Hyuk Lee <hyuk1.lee@samsung.com>
> >
> > If host controller doesn't have WP pin which should be connnected with
> > SDMMC
> > card WP pin, can implement get_ro function with using the allocated
gpio.
> > In order to use this quirk wp_gpio in the platform data must be set.
> >
> > Signed-off-by: Hyuk Lee <hyuk1.lee@samsung.com>
> > Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
> > ---
> > drivers/mmc/host/sdhci-s3c.c | 43
> > ++++++++++++++++++++++++++++++++++++++++++
> > drivers/mmc/host/sdhci.c | 3 ++
> > drivers/mmc/host/sdhci.h | 3 ++
> > 3 files changed, 49 insertions(+), 0 deletions(-)
> >
> > diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c
> > index 0d25285..0b75e57 100644
> > --- a/drivers/mmc/host/sdhci-s3c.c
> > +++ b/drivers/mmc/host/sdhci-s3c.c
> > @@ -22,6 +22,7 @@
> >
> > #include <linux/mmc/host.h>
> >
> > +#include <plat/gpio-cfg.h>
> > #include <plat/sdhci.h>
> > #include <plat/regs-sdhci.h>
> >
> > @@ -213,6 +214,36 @@ static void sdhci_s3c_set_clock(struct sdhci_host
> > *host, unsigned int clock)
> > }
> >
> > /**
> > + * sdhci_s3c_get_ro - callback for get_ro
> > + * @host: The SDHCI host being changed
> > + *
> > + * If the WP pin is connected with GPIO, can get the value which
indicates
> > + * the card is locked or not.
> > +*/
> > +static int sdhci_s3c_get_ro(struct mmc_host *mmc)
> > +{
> > + struct sdhci_s3c *sc;
> > + struct sdhci_host *host;
> > +
> > + host = mmc_priv(mmc);
> > + sc = sdhci_priv(host);
> > +
> > + return gpio_get_value(sc->pdata->wp_gpio);
> > +}
> > +
> > +/**
> > + * sdhci_s3c_cfg_wp - configure GPIO for WP pin
> > + * @gpio_num: GPIO number which connected with WP line from SD/MMC slot
> > + *
> > + * Configure GPIO for using WP line
> > +*/
> > +static void sdhci_s3c_cfg_wp(unsigned int gpio_num)
> > +{
> > + s3c_gpio_cfgpin(gpio_num, S3C_GPIO_INPUT);
> > + s3c_gpio_setpull(gpio_num, S3C_GPIO_PULL_UP);
> > +}
> > +
> > +/**
> > * sdhci_s3c_get_min_clock - callback to get minimal supported clock
value
> > * @host: The SDHCI host being queried
> > *
> > @@ -375,6 +406,9 @@ static int __devinit sdhci_s3c_probe(struct
> > platform_device *pdev)
> > if (pdata->cfg_gpio)
> > pdata->cfg_gpio(pdev, pdata->max_width);
> >
> > + if (gpio_is_valid(pdata->wp_gpio))
> > + sdhci_s3c_ops.get_ro = sdhci_s3c_get_ro;
> > +
>
> There is still a problem here, but the opposite to the issue from V1 of
this
> patch.
> If one apply the current version, he would need to set pdata->wp_gpio to
-1 on
> all
> existing platforms to get old behavior of the driver. Leaving it as zero
means
> that
> the driver will try to use GPA(0) for write protection.
>
> Adding one more field to pdata (like "bool has_gpio_wp") seems to be
> unavoidable
> in this case imho.
>
Ok..thanks for your review.
Will fix it like your card detection method soon.
Thanks.
Best regards,
Kgene.
--
Kukjin Kim <kgene.kim@samsung.com>, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.
^ permalink raw reply [flat|nested] 26+ messages in thread* [PATCH v3 3/3] sdhci-s3c: Add SDHCI_QUIRK_NO_WP_BIT quirk for Samsung SoC
@ 2010-07-27 12:21 ` Kukjin Kim
0 siblings, 0 replies; 26+ messages in thread
From: Kukjin Kim @ 2010-07-27 12:21 UTC (permalink / raw)
To: linux-arm-kernel
Marek Szyprowski wrote:
>
> Hello,
>
> On Friday, July 23, 2010 1:57 PM Kukjin Kim wrote:
>
> > From: Hyuk Lee <hyuk1.lee@samsung.com>
> >
> > If host controller doesn't have WP pin which should be connnected with
> > SDMMC
> > card WP pin, can implement get_ro function with using the allocated
gpio.
> > In order to use this quirk wp_gpio in the platform data must be set.
> >
> > Signed-off-by: Hyuk Lee <hyuk1.lee@samsung.com>
> > Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
> > ---
> > drivers/mmc/host/sdhci-s3c.c | 43
> > ++++++++++++++++++++++++++++++++++++++++++
> > drivers/mmc/host/sdhci.c | 3 ++
> > drivers/mmc/host/sdhci.h | 3 ++
> > 3 files changed, 49 insertions(+), 0 deletions(-)
> >
> > diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c
> > index 0d25285..0b75e57 100644
> > --- a/drivers/mmc/host/sdhci-s3c.c
> > +++ b/drivers/mmc/host/sdhci-s3c.c
> > @@ -22,6 +22,7 @@
> >
> > #include <linux/mmc/host.h>
> >
> > +#include <plat/gpio-cfg.h>
> > #include <plat/sdhci.h>
> > #include <plat/regs-sdhci.h>
> >
> > @@ -213,6 +214,36 @@ static void sdhci_s3c_set_clock(struct sdhci_host
> > *host, unsigned int clock)
> > }
> >
> > /**
> > + * sdhci_s3c_get_ro - callback for get_ro
> > + * @host: The SDHCI host being changed
> > + *
> > + * If the WP pin is connected with GPIO, can get the value which
indicates
> > + * the card is locked or not.
> > +*/
> > +static int sdhci_s3c_get_ro(struct mmc_host *mmc)
> > +{
> > + struct sdhci_s3c *sc;
> > + struct sdhci_host *host;
> > +
> > + host = mmc_priv(mmc);
> > + sc = sdhci_priv(host);
> > +
> > + return gpio_get_value(sc->pdata->wp_gpio);
> > +}
> > +
> > +/**
> > + * sdhci_s3c_cfg_wp - configure GPIO for WP pin
> > + * @gpio_num: GPIO number which connected with WP line from SD/MMC slot
> > + *
> > + * Configure GPIO for using WP line
> > +*/
> > +static void sdhci_s3c_cfg_wp(unsigned int gpio_num)
> > +{
> > + s3c_gpio_cfgpin(gpio_num, S3C_GPIO_INPUT);
> > + s3c_gpio_setpull(gpio_num, S3C_GPIO_PULL_UP);
> > +}
> > +
> > +/**
> > * sdhci_s3c_get_min_clock - callback to get minimal supported clock
value
> > * @host: The SDHCI host being queried
> > *
> > @@ -375,6 +406,9 @@ static int __devinit sdhci_s3c_probe(struct
> > platform_device *pdev)
> > if (pdata->cfg_gpio)
> > pdata->cfg_gpio(pdev, pdata->max_width);
> >
> > + if (gpio_is_valid(pdata->wp_gpio))
> > + sdhci_s3c_ops.get_ro = sdhci_s3c_get_ro;
> > +
>
> There is still a problem here, but the opposite to the issue from V1 of
this
> patch.
> If one apply the current version, he would need to set pdata->wp_gpio to
-1 on
> all
> existing platforms to get old behavior of the driver. Leaving it as zero
means
> that
> the driver will try to use GPA(0) for write protection.
>
> Adding one more field to pdata (like "bool has_gpio_wp") seems to be
> unavoidable
> in this case imho.
>
Ok..thanks for your review.
Will fix it like your card detection method soon.
Thanks.
Best regards,
Kgene.
--
Kukjin Kim <kgene.kim@samsung.com>, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.
^ permalink raw reply [flat|nested] 26+ messages in thread