[PATCH] mmc: sdio: optimization for process_sdio_pending_irq

2011-12-09 Thread Sangwook Lee
Skip fillng in mmc_command struct for CCCR_INTx
everytime sdio_irq_thread (process_sdio_pending_irqs)
calls mmc_io_rw_direct.

Signed-off-by: Sangwook Lee 
---
 drivers/mmc/core/sdio_irq.c |2 +-
 drivers/mmc/core/sdio_ops.c |   40 
 drivers/mmc/core/sdio_ops.h |1 +
 3 files changed, 42 insertions(+), 1 deletions(-)

diff --git a/drivers/mmc/core/sdio_irq.c b/drivers/mmc/core/sdio_irq.c
index 68f81b9..67f782a 100644
--- a/drivers/mmc/core/sdio_irq.c
+++ b/drivers/mmc/core/sdio_irq.c
@@ -44,7 +44,7 @@ static int process_sdio_pending_irqs(struct mmc_card *card)
return 1;
}
 
-   ret = mmc_io_rw_direct(card, 0, 0, SDIO_CCCR_INTx, 0, &pending);
+   ret = mmc_io_rw_direct_irq(card, &pending);
if (ret) {
pr_debug("%s: error %d reading SDIO_CCCR_INTx\n",
   mmc_card_id(card), ret);
diff --git a/drivers/mmc/core/sdio_ops.c b/drivers/mmc/core/sdio_ops.c
index b0517cc..c80fc32 100644
--- a/drivers/mmc/core/sdio_ops.c
+++ b/drivers/mmc/core/sdio_ops.c
@@ -111,6 +111,46 @@ static int mmc_io_rw_direct_host(struct mmc_host *host, 
int write, unsigned fn,
return 0;
 }
 
+static struct mmc_command sdio_intx_cmd = {
+   .opcode = SD_IO_RW_DIRECT,
+   .arg = SDIO_CCCR_INTx << 9,
+   .flags = MMC_RSP_SPI_R5 | MMC_RSP_R5 | MMC_CMD_AC,
+};
+
+int mmc_io_rw_direct_irq(struct mmc_card *card, u8 *out)
+{
+   int err;
+   struct mmc_host *host ;
+
+   BUG_ON(!card);
+   host = card->host;
+   BUG_ON(!host);
+
+   err = mmc_wait_for_cmd(host, &sdio_intx_cmd, 0);
+   if (err)
+   return err;
+
+   if (mmc_host_is_spi(host)) {
+   /* host driver already reported errors */
+   } else {
+   if (sdio_intx_cmd.resp[0] & R5_ERROR)
+   return -EIO;
+   if (sdio_intx_cmd.resp[0] & R5_FUNCTION_NUMBER)
+   return -EINVAL;
+   if (sdio_intx_cmd.resp[0] & R5_OUT_OF_RANGE)
+   return -ERANGE;
+   }
+
+   if (out) {
+   if (mmc_host_is_spi(host))
+   *out = (sdio_intx_cmd.resp[0] >> 8) & 0xFF;
+   else
+   *out = sdio_intx_cmd.resp[0] & 0xFF;
+   }
+
+   return 0;
+}
+
 int mmc_io_rw_direct(struct mmc_card *card, int write, unsigned fn,
unsigned addr, u8 in, u8 *out)
 {
diff --git a/drivers/mmc/core/sdio_ops.h b/drivers/mmc/core/sdio_ops.h
index 12a4d3a..5fe8ad6 100644
--- a/drivers/mmc/core/sdio_ops.h
+++ b/drivers/mmc/core/sdio_ops.h
@@ -15,6 +15,7 @@
 int mmc_send_io_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr);
 int mmc_io_rw_direct(struct mmc_card *card, int write, unsigned fn,
unsigned addr, u8 in, u8* out);
+int mmc_io_rw_direct_irq(struct mmc_card *card, u8 *out);
 int mmc_io_rw_extended(struct mmc_card *card, int write, unsigned fn,
unsigned addr, int incr_addr, u8 *buf, unsigned blocks, unsigned blksz);
 int sdio_reset(struct mmc_host *host);
-- 
1.7.4.1

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


Re: Build breakage in sdhci-s3c

2011-12-02 Thread Sangwook Lee
+Thomas


On 2 December 2011 13:04, Mark Brown
 wrote:
> On Fri, Dec 02, 2011 at 12:59:42PM +0000, Sangwook Lee wrote:
>
>> and I found out that the following patch wasn't applied This  patch
>> was acked by you and Thomas.
>
>> http://comments.gmane.org/gmane.linux.kernel.samsung-soc/7832
>> This patch has the title : [PATCH v2 1/2] ARM: SAMSUNG: Add pm_caps
>> into platform data
>
>> Could you help me to solve the below problem ?
>
> Probably the simplest/best solution here is for Chris to apply this
> patch with Kukjin and Thomas' acks to the mmc tree.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Build breakage in sdhci-s3c

2011-12-02 Thread Sangwook Lee
Hi Kukjin

I checked out your git to look into Mark's email.

git://git.kernel.org/pub/scm/linux/kernel/git/kgene/linux-samsung.git for-next

and I found out that the following patch wasn't applied This  patch
was acked by you and Thomas.

http://comments.gmane.org/gmane.linux.kernel.samsung-soc/7832
This patch has the title : [PATCH v2 1/2] ARM: SAMSUNG: Add pm_caps
into platform data

Could you help me to solve the below problem ?

Thanks
Sangwook


On 2 December 2011 11:58, Mark Brown
 wrote:
> The mmc and therefore -next currently fail to build on Samsung platforms
> due to commit 666b6a (mmc: sdhci-s3c: Add pm_caps into SD/MMC host)
> which added use of a new field pm_caps in the platform data without
> actually adding that field to the struct.  I guess there's a separate
> patch floating about somewhere which adds the field but it's not in
> -next and both commits should be going in via the same tree to avoid
> bisection breakage - ideally both the field and its use should be added
> as part of a single commit.
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/2] mmc: sdhci-s3c: Add pm_caps into SD/MMC host

2011-11-07 Thread Sangwook Lee
sdhci-s3c updates pm_caps from platform data for SDIO PM.

Signed-off-by: Sangwook Lee 
---
 drivers/mmc/host/sdhci-s3c.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c
index fe886d6..f10dd52 100644
--- a/drivers/mmc/host/sdhci-s3c.c
+++ b/drivers/mmc/host/sdhci-s3c.c
@@ -518,6 +518,9 @@ static int __devinit sdhci_s3c_probe(struct platform_device 
*pdev)
if (pdata->host_caps)
host->mmc->caps |= pdata->host_caps;
 
+   if (pdata->pm_caps)
+   host->mmc->pm_caps |= pdata->pm_caps;
+
host->quirks |= (SDHCI_QUIRK_32BIT_DMA_ADDR |
 SDHCI_QUIRK_32BIT_DMA_SIZE);
 
-- 
1.7.4.1

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


[PATCH 1/2] ARM: SAMSUNG: Add pm_caps into platform data

2011-11-07 Thread Sangwook Lee
Add pm_caps into platform_data. This is power management, usually
for SDIO device such as SDIO WLAN.

Signed-off-by: Sangwook Lee 
---
 arch/arm/plat-samsung/dev-hsmmc3.c |2 ++
 arch/arm/plat-samsung/include/plat/sdhci.h |2 ++
 2 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/arch/arm/plat-samsung/dev-hsmmc3.c 
b/arch/arm/plat-samsung/dev-hsmmc3.c
index ede776f..8f467f2 100644
--- a/arch/arm/plat-samsung/dev-hsmmc3.c
+++ b/arch/arm/plat-samsung/dev-hsmmc3.c
@@ -78,6 +78,8 @@ void s3c_sdhci3_set_platdata(struct s3c_sdhci_platdata *pd)
set->cfg_card = pd->cfg_card;
if (pd->host_caps)
set->host_caps |= pd->host_caps;
+   if (pd->pm_caps)
+   set->pm_caps |= pd->pm_caps;
if (pd->clk_type)
set->clk_type = pd->clk_type;
 }
diff --git a/arch/arm/plat-samsung/include/plat/sdhci.h 
b/arch/arm/plat-samsung/include/plat/sdhci.h
index 058e096..35646de 100644
--- a/arch/arm/plat-samsung/include/plat/sdhci.h
+++ b/arch/arm/plat-samsung/include/plat/sdhci.h
@@ -40,6 +40,7 @@ enum clk_types {
  * 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.
+ * @pm_caps: SDIO host PM capabilities bit field.
  * @cd_type: Type of Card Detection method (see cd_types enum above)
  * @clk_type: Type of clock divider method (see clk_types enum above)
  * @ext_cd_init: Initialize external card detect subsystem. Called on
@@ -67,6 +68,7 @@ enum clk_types {
 struct s3c_sdhci_platdata {
unsigned intmax_width;
unsigned inthost_caps;
+   unsigned intpm_caps;
enum cd_types   cd_type;
enum clk_types  clk_type;
 
-- 
1.7.4.1

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


[PATCH 0/2] ARM: SAMSUNG: Add pm_caps

2011-11-07 Thread Sangwook Lee
Add pm_caps into platform data and update it in SD/MMC driver
This field can be used with SDIO device such as SDIO WLAN.

Sangwook Lee (2):
  ARM: SAMSUNG: Add pm_caps into platform data
  mmc: sdhci-s3c: Add pm_caps into SD/MMC host

 arch/arm/plat-samsung/dev-hsmmc3.c |2 ++
 arch/arm/plat-samsung/include/plat/sdhci.h |2 ++
 drivers/mmc/host/sdhci-s3c.c   |3 +++
 3 files changed, 7 insertions(+), 0 deletions(-)

-- 
1.7.4.1

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