[PATCH 1/2] mmc: rtsx: fix card poweroff bug

2013-11-19 Thread micky_ching
From: Micky Ching 

If the host driver removed while card in the slot, the host will not
power off card power correctly. This bug is produced because host
eject flag set before the last mmc_set_ios callback, we should set the
eject flag after power off.

Signed-off-by: Micky Ching 
---
 drivers/mmc/host/rtsx_pci_sdmmc.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/host/rtsx_pci_sdmmc.c 
b/drivers/mmc/host/rtsx_pci_sdmmc.c
index 375a880e..c9a7328 100644
--- a/drivers/mmc/host/rtsx_pci_sdmmc.c
+++ b/drivers/mmc/host/rtsx_pci_sdmmc.c
@@ -1328,7 +1328,6 @@ static int rtsx_pci_sdmmc_drv_remove(struct 
platform_device *pdev)
pcr->slots[RTSX_SD_CARD].p_dev = NULL;
pcr->slots[RTSX_SD_CARD].card_event = NULL;
mmc = host->mmc;
-   host->eject = true;
 
mutex_lock(&host->host_mutex);
if (host->mrq) {
@@ -1346,6 +1345,8 @@ static int rtsx_pci_sdmmc_drv_remove(struct 
platform_device *pdev)
mutex_unlock(&host->host_mutex);
 
mmc_remove_host(mmc);
+   host->eject = true;
+
mmc_free_host(mmc);
 
dev_dbg(&(pdev->dev),
-- 
1.7.9.5

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 2/2] mmc: rtsx: modify phase searching method for tunning

2013-11-19 Thread micky_ching
From: Micky Ching 

The new phase searching method is more concise and easier to
understand.

Signed-off-by: Micky Ching 
---
 drivers/mmc/host/rtsx_pci_sdmmc.c |  108 +++--
 1 file changed, 30 insertions(+), 78 deletions(-)

diff --git a/drivers/mmc/host/rtsx_pci_sdmmc.c 
b/drivers/mmc/host/rtsx_pci_sdmmc.c
index c9a7328..fb2f159 100644
--- a/drivers/mmc/host/rtsx_pci_sdmmc.c
+++ b/drivers/mmc/host/rtsx_pci_sdmmc.c
@@ -31,16 +31,6 @@
 #include 
 #include 
 
-/* SD Tuning Data Structure
- * Record continuous timing phase path
- */
-struct timing_phase_path {
-   int start;
-   int end;
-   int mid;
-   int len;
-};
-
 struct realtek_pci_sdmmc {
struct platform_device  *pdev;
struct rtsx_pcr *pcr;
@@ -511,85 +501,47 @@ static int sd_change_phase(struct realtek_pci_sdmmc *host,
return 0;
 }
 
-static u8 sd_search_final_phase(struct realtek_pci_sdmmc *host, u32 phase_map)
+static inline u32 sd_get_phase_point(u32 phase_map, unsigned int idx)
 {
-   struct timing_phase_path path[MAX_PHASE + 1];
-   int i, j, cont_path_cnt;
-   int new_block, max_len, final_path_idx;
-   u8 final_phase = 0xFF;
+   idx &= MAX_PHASE;
+   return phase_map & (1 << idx);
+}
+
+static int sd_get_phase_len(u32 phase_map, unsigned int idx)
+{
+   int i;
 
-   /* Parse phase_map, take it as a bit-ring */
-   cont_path_cnt = 0;
-   new_block = 1;
-   j = 0;
for (i = 0; i < MAX_PHASE + 1; i++) {
-   if (phase_map & (1 << i)) {
-   if (new_block) {
-   new_block = 0;
-   j = cont_path_cnt++;
-   path[j].start = i;
-   path[j].end = i;
-   } else {
-   path[j].end = i;
-   }
-   } else {
-   new_block = 1;
-   if (cont_path_cnt) {
-   /* Calculate path length and middle point */
-   int idx = cont_path_cnt - 1;
-   path[idx].len =
-   path[idx].end - path[idx].start + 1;
-   path[idx].mid =
-   path[idx].start + path[idx].len / 2;
-   }
-   }
+   if (sd_get_phase_point(phase_map, idx + i) == 0)
+   return i;
}
+   return MAX_PHASE + 1;
+}
 
-   if (cont_path_cnt == 0) {
-   dev_dbg(sdmmc_dev(host), "No continuous phase path\n");
-   goto finish;
-   } else {
-   /* Calculate last continuous path length and middle point */
-   int idx = cont_path_cnt - 1;
-   path[idx].len = path[idx].end - path[idx].start + 1;
-   path[idx].mid = path[idx].start + path[idx].len / 2;
-   }
+static u8 sd_search_final_phase(struct realtek_pci_sdmmc *host, u32 phase_map)
+{
+   int start = 0, len = 0;
+   int start_final = 0, len_final = 0;
+   u8 final_phase = 0xFF;
 
-   /* Connect the first and last continuous paths if they are adjacent */
-   if (!path[0].start && (path[cont_path_cnt - 1].end == MAX_PHASE)) {
-   /* Using negative index */
-   path[0].start = path[cont_path_cnt - 1].start - MAX_PHASE - 1;
-   path[0].len += path[cont_path_cnt - 1].len;
-   path[0].mid = path[0].start + path[0].len / 2;
-   /* Convert negative middle point index to positive one */
-   if (path[0].mid < 0)
-   path[0].mid += MAX_PHASE + 1;
-   cont_path_cnt--;
+   if (phase_map == 0) {
+   dev_dbg(sdmmc_dev(host), "Phase: [map:%x]\n", phase_map);
+   return final_phase;
}
 
-   /* Choose the longest continuous phase path */
-   max_len = 0;
-   final_phase = 0;
-   final_path_idx = 0;
-   for (i = 0; i < cont_path_cnt; i++) {
-   if (path[i].len > max_len) {
-   max_len = path[i].len;
-   final_phase = (u8)path[i].mid;
-   final_path_idx = i;
+   while (start < MAX_PHASE + 1) {
+   len = sd_get_phase_len(phase_map, start);
+   if (len_final < len) {
+   start_final = start;
+   len_final = len;
}
-
-   dev_dbg(sdmmc_dev(host), "path[%d].start = %d\n",
-   i, path[i].start);
-   dev_dbg(sdmmc_dev(host), "path[%d].end = %d\n",
-   i, path[i].end);
-   dev_dbg(sdmmc_dev(host), "path[%d].len = %d\n",
-   i, path[i].len);
-   dev_dbg(sdmmc_dev(host), "path[%d].mid = %d\n",
-  

[PATCH 0/2] fix sd power bug and modify phase-searching method

2013-11-19 Thread micky_ching
From: Micky Ching 

If the driver removed while sd card still in the slot, the card power
will not power down correctly, if we insert the driver module again,
UHS card will not switch to UHS mode. This bug is fix in this patch.

We use another phase search method for tuning, which looks more
simple, and reduce some source code.

Micky Ching (2):
  mmc: rtsx: fix card poweroff bug
  mmc: rtsx: modify phase searching method for tunning

 drivers/mmc/host/rtsx_pci_sdmmc.c |  111 +++--
 1 file changed, 32 insertions(+), 79 deletions(-)

--
1.7.9.5
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 21/31] staging: nvec: use reset framework

2013-11-19 Thread Greg Kroah-Hartman
On Fri, Nov 15, 2013 at 01:54:16PM -0700, Stephen Warren wrote:
> From: Stephen Warren 
> 
> Tegra's clock driver now provides an implementation of the common
> reset API (include/linux/reset.h). Use this instead of the old Tegra-
> specific API; that will soon be removed.
> 
> Cc: tred...@nvidia.com
> Cc: pdeschrij...@nvidia.com
> Cc: linux-te...@vger.kernel.org
> Cc: linux-arm-ker...@lists.infradead.org
> Cc: Julian Andres Klode 
> Cc: Marc Dietrich 
> Cc: ac...@lists.launchpad.net
> Cc: Greg Kroah-Hartman 
> Cc: de...@driverdev.osuosl.org
> Signed-off-by: Stephen Warren 
> ---
> This patch is part of a series with strong internal depdendencies. I'm
> looking for an ack so that I can take the entire series through the Tegra
> and arm-soc trees. The series will be part of a stable branch that can be
> merged into other subsystems if needed to avoid/resolve dependencies.

Acked-by: Greg Kroah-Hartman 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: imx-drm: Fix modular build of DRM_IMX_IPUV3

2013-11-19 Thread Josh Boyer
On Mon, Nov 18, 2013 at 10:03:10AM +0100, Sascha Hauer wrote:
> On Tue, Nov 12, 2013 at 12:15:45PM -0500, Josh Boyer wrote:
> > commit b8d181e408af (staging: drm/imx: add drm plane support) added a file
> > to the make target for DRM_IMX_IPUV3 but didn't adjust the objs required
> > to actually build that as a module.  Kbuild got confused and this lead to
> > link errors like:
> > 
> > ERROR: "ipu_plane_disable" [drivers/staging/imx-drm/ipuv3-crtc.ko] 
> > undefined!
> > ERROR: "ipu_plane_enable" [drivers/staging/imx-drm/ipuv3-crtc.ko] undefined!
> > 
> > Additionally, it added a call to imx_drm_crtc_id which also fails with a
> > link error as above.  To fix this, we adjust the make target with the proper
> > objs, which will change the name of the resulting .ko.  We also add an
> > EXPORT_SYMBOL_GPL for imx_drm_crtc_id.
> > 
> > Signed-off-by: Josh Boyer 
> 
> 
> Acked-by: Sascha Hauer 
> 
> Sascha

Thanks.  So who picks this fix up?  Greg, is that you?

josh

> 
> > ---
> >  drivers/staging/imx-drm/Makefile   | 4 +++-
> >  drivers/staging/imx-drm/imx-drm-core.c | 1 +
> >  2 files changed, 4 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/staging/imx-drm/Makefile 
> > b/drivers/staging/imx-drm/Makefile
> > index 2c3a9e1..8742432 100644
> > --- a/drivers/staging/imx-drm/Makefile
> > +++ b/drivers/staging/imx-drm/Makefile
> > @@ -8,4 +8,6 @@ obj-$(CONFIG_DRM_IMX_TVE) += imx-tve.o
> >  obj-$(CONFIG_DRM_IMX_LDB) += imx-ldb.o
> >  obj-$(CONFIG_DRM_IMX_FB_HELPER) += imx-fbdev.o
> >  obj-$(CONFIG_DRM_IMX_IPUV3_CORE) += ipu-v3/
> > -obj-$(CONFIG_DRM_IMX_IPUV3)+= ipuv3-crtc.o ipuv3-plane.o
> > +
> > +imx-ipuv3-crtc-objs  := ipuv3-crtc.o ipuv3-plane.o
> > +obj-$(CONFIG_DRM_IMX_IPUV3)+= imx-ipuv3-crtc.o
> > diff --git a/drivers/staging/imx-drm/imx-drm-core.c 
> > b/drivers/staging/imx-drm/imx-drm-core.c
> > index 4483d47..2b366d8 100644
> > --- a/drivers/staging/imx-drm/imx-drm-core.c
> > +++ b/drivers/staging/imx-drm/imx-drm-core.c
> > @@ -72,6 +72,7 @@ int imx_drm_crtc_id(struct imx_drm_crtc *crtc)
> >  {
> > return crtc->pipe;
> >  }
> > +EXPORT_SYMBOL_GPL(imx_drm_crtc_id);
> >  
> >  static void imx_drm_driver_lastclose(struct drm_device *drm)
> >  {
> > -- 
> > 1.8.3.1
> > 
> > 
> 
> -- 
> Pengutronix e.K.   | |
> Industrial Linux Solutions | http://www.pengutronix.de/  |
> Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
> Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: imx-drm: Fix modular build of DRM_IMX_IPUV3

2013-11-19 Thread Greg KH
On Tue, Nov 19, 2013 at 08:56:59PM -0500, Josh Boyer wrote:
> On Mon, Nov 18, 2013 at 10:03:10AM +0100, Sascha Hauer wrote:
> > On Tue, Nov 12, 2013 at 12:15:45PM -0500, Josh Boyer wrote:
> > > commit b8d181e408af (staging: drm/imx: add drm plane support) added a file
> > > to the make target for DRM_IMX_IPUV3 but didn't adjust the objs required
> > > to actually build that as a module.  Kbuild got confused and this lead to
> > > link errors like:
> > > 
> > > ERROR: "ipu_plane_disable" [drivers/staging/imx-drm/ipuv3-crtc.ko] 
> > > undefined!
> > > ERROR: "ipu_plane_enable" [drivers/staging/imx-drm/ipuv3-crtc.ko] 
> > > undefined!
> > > 
> > > Additionally, it added a call to imx_drm_crtc_id which also fails with a
> > > link error as above.  To fix this, we adjust the make target with the 
> > > proper
> > > objs, which will change the name of the resulting .ko.  We also add an
> > > EXPORT_SYMBOL_GPL for imx_drm_crtc_id.
> > > 
> > > Signed-off-by: Josh Boyer 
> > 
> > 
> > Acked-by: Sascha Hauer 
> > 
> > Sascha
> 
> Thanks.  So who picks this fix up?  Greg, is that you?

Yes, I will once 3.13-rc1 is out.

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel