Re: [PATCH v6 8/9] mmc: dw_mmc: add support for implementation specific callbacks

2012-10-16 Thread Thomas Abraham
On 4 October 2012 18:11, Seungwon Jeon tgih@samsung.com wrote:
 Monday, September 24, Chris Ball c...@laptop.org
 Hi,

 On Thu, Sep 20 2012, Thomas Abraham wrote:
  In non-Exynos platform, host-drv_data has NULL.
 
  Yes, sorry, I missed that.
 
  Chris, should I fix this and send the updated patch or shall I send a
  separate fix patch.

 A separate fix patch would be good, please.

 (I'd normally take an updated patch but Stephen Rothwell's asked for
 people to hold off rebasing now that -rc7 is out, which is reasonable.)
 Thomas,

 Is there any work for fix?

 Thanks,
 Seungwon Jeon


Hi Seungwon,

I apologize for not being prompt in fixing this issue reported by you.
James Hogan has now submitted a patch to fix this. ([PATCH] dw_mmc:
fix multiple drv_data NULL dereferences)

Thanks,
Thomas.



 Thanks,

 - Chris.
 --
 Chris Ball   c...@laptop.org   http://printf.net/
 One Laptop Per Child
 --
 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-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH v6 8/9] mmc: dw_mmc: add support for implementation specific callbacks

2012-10-04 Thread Seungwon Jeon
Monday, September 24, Chris Ball c...@laptop.org
 Hi,
 
 On Thu, Sep 20 2012, Thomas Abraham wrote:
  In non-Exynos platform, host-drv_data has NULL.
 
  Yes, sorry, I missed that.
 
  Chris, should I fix this and send the updated patch or shall I send a
  separate fix patch.
 
 A separate fix patch would be good, please.
 
 (I'd normally take an updated patch but Stephen Rothwell's asked for
 people to hold off rebasing now that -rc7 is out, which is reasonable.)
Thomas,

Is there any work for fix?

Thanks,
Seungwon Jeon

 
 Thanks,
 
 - Chris.
 --
 Chris Ball   c...@laptop.org   http://printf.net/
 One Laptop Per Child
 --
 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-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v6 8/9] mmc: dw_mmc: add support for implementation specific callbacks

2012-09-23 Thread Chris Ball
Hi,

On Thu, Sep 20 2012, Thomas Abraham wrote:
 In non-Exynos platform, host-drv_data has NULL.

 Yes, sorry, I missed that.

 Chris, should I fix this and send the updated patch or shall I send a
 separate fix patch.

A separate fix patch would be good, please.

(I'd normally take an updated patch but Stephen Rothwell's asked for
people to hold off rebasing now that -rc7 is out, which is reasonable.)

Thanks,

- Chris.
-- 
Chris Ball   c...@laptop.org   http://printf.net/
One Laptop Per Child
--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v6 8/9] mmc: dw_mmc: add support for implementation specific callbacks

2012-09-19 Thread Thomas Abraham
On 19 September 2012 19:10, Seungwon Jeon tgih@samsung.com wrote:
 On Tuesday, September 18, 2012, Thomas Abraham thomas.abra...@linaro.org 
 wrote:
 -int dw_mci_pltfm_register(struct platform_device *pdev)
 +int dw_mci_pltfm_register(struct platform_device *pdev,
 + struct dw_mci_drv_data *drv_data)
  {
   struct dw_mci *host;
   struct resource *regs;
 @@ -41,6 +42,7 @@ int dw_mci_pltfm_register(struct platform_device *pdev)
   if (host-irq  0)
   return host-irq;

 + host-drv_data = drv_data;
   host-dev = pdev-dev;
   host-irq_flags = 0;
   host-pdata = pdev-dev.platform_data;
 @@ -48,6 +50,12 @@ int dw_mci_pltfm_register(struct platform_device *pdev)
   if (!host-regs)
   return -ENOMEM;

 + if (host-drv_data-init) {
 In non-Exynos platform, host-drv_data has NULL.

Yes, sorry, I missed that.

Chris, should I fix this and send the updated patch or shall I send a
separate fix patch.

Thanks,
Thomas.

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


[PATCH v6 8/9] mmc: dw_mmc: add support for implementation specific callbacks

2012-09-17 Thread Thomas Abraham
The core dw-mshc controller driver can let platform specific implementations
of the dw-mshc controller to control the hardware as required by such
implementations. This is acheived by invoking implementation specific (optional)
callbacks. Define the list of callbacks supported the add invocation points
for the same.

Signed-off-by: Thomas Abraham thomas.abra...@linaro.org
Acked-by: Will Newton will.new...@imgtec.com
---
 drivers/mmc/host/dw_mmc-pltfm.c |   12 -
 drivers/mmc/host/dw_mmc-pltfm.h |3 +-
 drivers/mmc/host/dw_mmc.c   |   47 ++-
 drivers/mmc/host/dw_mmc.h   |   24 
 include/linux/mmc/dw_mmc.h  |4 +++
 5 files changed, 86 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/host/dw_mmc-pltfm.c b/drivers/mmc/host/dw_mmc-pltfm.c
index e17da91..c960ca7 100644
--- a/drivers/mmc/host/dw_mmc-pltfm.c
+++ b/drivers/mmc/host/dw_mmc-pltfm.c
@@ -23,7 +23,8 @@
 
 #include dw_mmc.h
 
-int dw_mci_pltfm_register(struct platform_device *pdev)
+int dw_mci_pltfm_register(struct platform_device *pdev,
+   struct dw_mci_drv_data *drv_data)
 {
struct dw_mci *host;
struct resource *regs;
@@ -41,6 +42,7 @@ int dw_mci_pltfm_register(struct platform_device *pdev)
if (host-irq  0)
return host-irq;
 
+   host-drv_data = drv_data;
host-dev = pdev-dev;
host-irq_flags = 0;
host-pdata = pdev-dev.platform_data;
@@ -48,6 +50,12 @@ int dw_mci_pltfm_register(struct platform_device *pdev)
if (!host-regs)
return -ENOMEM;
 
+   if (host-drv_data-init) {
+   ret = host-drv_data-init(host);
+   if (ret)
+   return ret;
+   }
+
platform_set_drvdata(pdev, host);
ret = dw_mci_probe(host);
return ret;
@@ -56,7 +64,7 @@ EXPORT_SYMBOL_GPL(dw_mci_pltfm_register);
 
 static int __devinit dw_mci_pltfm_probe(struct platform_device *pdev)
 {
-   return dw_mci_pltfm_register(pdev);
+   return dw_mci_pltfm_register(pdev, NULL);
 }
 
 static int __devexit dw_mci_pltfm_remove(struct platform_device *pdev)
diff --git a/drivers/mmc/host/dw_mmc-pltfm.h b/drivers/mmc/host/dw_mmc-pltfm.h
index 6c065d9..301f245 100644
--- a/drivers/mmc/host/dw_mmc-pltfm.h
+++ b/drivers/mmc/host/dw_mmc-pltfm.h
@@ -12,7 +12,8 @@
 #ifndef _DW_MMC_PLTFM_H_
 #define _DW_MMC_PLTFM_H_
 
-extern int dw_mci_pltfm_register(struct platform_device *pdev);
+extern int dw_mci_pltfm_register(struct platform_device *pdev,
+   struct dw_mci_drv_data *drv_data);
 extern int __devexit dw_mci_pltfm_remove(struct platform_device *pdev);
 extern const struct dev_pm_ops dw_mci_pltfm_pmops;
 
diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index c792466..9f8e487 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -231,6 +231,7 @@ static void dw_mci_set_timeout(struct dw_mci *host)
 static u32 dw_mci_prepare_command(struct mmc_host *mmc, struct mmc_command 
*cmd)
 {
struct mmc_data *data;
+   struct dw_mci_slot *slot = mmc_priv(mmc);
u32 cmdr;
cmd-error = -EINPROGRESS;
 
@@ -260,6 +261,9 @@ static u32 dw_mci_prepare_command(struct mmc_host *mmc, 
struct mmc_command *cmd)
cmdr |= SDMMC_CMD_DAT_WR;
}
 
+   if (slot-host-drv_data-prepare_command)
+   slot-host-drv_data-prepare_command(slot-host, cmdr);
+
return cmdr;
 }
 
@@ -815,6 +819,9 @@ static void dw_mci_set_ios(struct mmc_host *mmc, struct 
mmc_ios *ios)
slot-clock = ios-clock;
}
 
+   if (slot-host-drv_data-set_ios)
+   slot-host-drv_data-set_ios(slot-host, ios);
+
switch (ios-power_mode) {
case MMC_POWER_UP:
set_bit(DW_MMC_CARD_NEED_INIT, slot-flags);
@@ -1820,6 +1827,7 @@ static int dw_mci_init_slot(struct dw_mci *host, unsigned 
int id)
 {
struct mmc_host *mmc;
struct dw_mci_slot *slot;
+   int ctrl_id, ret;
u8 bus_width;
 
mmc = mmc_alloc_host(sizeof(struct dw_mci_slot), host-dev);
@@ -1851,6 +1859,16 @@ static int dw_mci_init_slot(struct dw_mci *host, 
unsigned int id)
if (host-pdata-caps)
mmc-caps = host-pdata-caps;
 
+   if (host-dev-of_node) {
+   ctrl_id = of_alias_get_id(host-dev-of_node, mshc);
+   if (ctrl_id  0)
+   ctrl_id = 0;
+   } else {
+   ctrl_id = to_platform_device(host-dev)-id;
+   }
+   if (host-drv_data  host-drv_data-caps)
+   mmc-caps |= host-drv_data-caps[ctrl_id];
+
if (host-pdata-caps2)
mmc-caps2 = host-pdata-caps2;
 
@@ -1861,6 +1879,14 @@ static int dw_mci_init_slot(struct dw_mci *host, 
unsigned int id)
else
bus_width = 1;
 
+   if (host-drv_data-setup_bus) {
+   struct device_node *slot_np;
+