Re: [PATCH v4 1/3] mfd: Add realtek USB card reader driver

2014-03-10 Thread Roger

On 03/03/2014 04:48 PM, Roger wrote:

On 02/24/2014 11:00 AM, Chris Ball wrote:

Hi,

On Mon, Feb 24 2014, Roger wrote:

Would you please help comment PATCH 2/3 and 3/3 (for mmc and memstick,
respectively) or give Acks? Thus we can proceed with applying or
revision if necessary.


For 2/3:

Acked-by: Chris Ball 

Thanks,

- Chris.


Hi Andrew,

Could you please give some comment to the 3/3(memstick) patch?



Lee has introduced and CC'ed AKPM for acking the memstick patch (3/3)
several weeks ago but so far we haven't get any response. Thus the merge 
of all 3 patches is blocked. Is there anyone else can help this or 
anything else I could do?


Best regards,
Roger Tseng
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v4 1/3] mfd: Add realtek USB card reader driver

2014-03-03 Thread Roger

On 02/24/2014 11:00 AM, Chris Ball wrote:

Hi,

On Mon, Feb 24 2014, Roger wrote:

Would you please help comment PATCH 2/3 and 3/3 (for mmc and memstick,
respectively) or give Acks? Thus we can proceed with applying or
revision if necessary.


For 2/3:

Acked-by: Chris Ball 

Thanks,

- Chris.


Hi Andrew,

Could you please give some comment to the 3/3(memstick) patch?


Best regards,
Roger Tseng
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v4 1/3] mfd: Add realtek USB card reader driver

2014-02-23 Thread Chris Ball
Hi,

On Mon, Feb 24 2014, Roger wrote:
> Would you please help comment PATCH 2/3 and 3/3 (for mmc and memstick,
> respectively) or give Acks? Thus we can proceed with applying or
> revision if necessary.

For 2/3:

Acked-by: Chris Ball 

Thanks,

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


Re: [PATCH v4 1/3] mfd: Add realtek USB card reader driver

2014-02-23 Thread Roger

On 02/17/2014 08:03 PM, Lee Jones wrote:

From: Roger Tseng 

Realtek USB card reader provides a channel to transfer command or data to flash
memory cards. This driver exports host instances for mmc and memstick subsystems
and handles basic works.

Signed-off-by: Roger Tseng 
---
  drivers/mfd/Kconfig  |  10 +
  drivers/mfd/Makefile |   1 +
  drivers/mfd/rtsx_usb.c   | 760 +++
  include/linux/mfd/rtsx_usb.h | 628 +++
  4 files changed, 1399 insertions(+)
  create mode 100644 drivers/mfd/rtsx_usb.c
  create mode 100644 include/linux/mfd/rtsx_usb.h


Applied again, thanks.


Would you also apply patch 2/3 and 3/3 that to make the device fully
operational for users? Or should they be applied by maintainers of
mmc/memstick subsystems?

Chris, would you give some comment?


I can apply them, but I need the other Maintainer Acks.

If they are build orthogonal i.e. there are no build dependencies
between them, it's probably better that they go into their associated
trees separately.


I think it would be better to apply them together since the later
patches really depend on the 1st one,so now we are waiting for Acks

>from mmc/memstick subsystems.

When you say "depend on", do you mean as a build depenency, or won't
run without the first patch applied?


The later 2 patches actually invoke symbols defined in the first
patch and won't compile if it is not applied first. The Kconfig
changes for the later oness also specified this by "depends on".

I'm not sure if this means "build dependency". Sorry for my unclear words.


Yes, that sounds like a build dependency i.e. will not build without
errors or warnings without the previous patch applied.


But there is no one specified for "memstick/host/" in MAINTAINERS.
Could anyone else Ack this?


Andrew (CC'ed) has been Acking these thus far.


Hi Chris and Andrew,

Would you please help comment PATCH 2/3 and 3/3 (for mmc and memstick, 
respectively) or give Acks? Thus we can proceed with applying or 
revision if necessary.

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


Re: [PATCH v4 1/3] mfd: Add realtek USB card reader driver

2014-02-17 Thread Lee Jones
> >>From: Roger Tseng 
> >>
> >>Realtek USB card reader provides a channel to transfer command or data 
> >>to flash
> >>memory cards. This driver exports host instances for mmc and memstick 
> >>subsystems
> >>and handles basic works.
> >>
> >>Signed-off-by: Roger Tseng 
> >>---
> >>  drivers/mfd/Kconfig  |  10 +
> >>  drivers/mfd/Makefile |   1 +
> >>  drivers/mfd/rtsx_usb.c   | 760 
> >> +++
> >>  include/linux/mfd/rtsx_usb.h | 628 +++
> >>  4 files changed, 1399 insertions(+)
> >>  create mode 100644 drivers/mfd/rtsx_usb.c
> >>  create mode 100644 include/linux/mfd/rtsx_usb.h
> >
> >Applied again, thanks.
> >
> Would you also apply patch 2/3 and 3/3 that to make the device fully
> operational for users? Or should they be applied by maintainers of
> mmc/memstick subsystems?
> 
> Chris, would you give some comment?
> >>>
> >>>I can apply them, but I need the other Maintainer Acks.
> >>>
> >>>If they are build orthogonal i.e. there are no build dependencies
> >>>between them, it's probably better that they go into their associated
> >>>trees separately.
> >>>
> >>I think it would be better to apply them together since the later
> >>patches really depend on the 1st one,so now we are waiting for Acks
> >>from mmc/memstick subsystems.
> >
> >When you say "depend on", do you mean as a build depenency, or won't
> >run without the first patch applied?
> 
> The later 2 patches actually invoke symbols defined in the first
> patch and won't compile if it is not applied first. The Kconfig
> changes for the later oness also specified this by "depends on".
> 
> I'm not sure if this means "build dependency". Sorry for my unclear words.

Yes, that sounds like a build dependency i.e. will not build without
errors or warnings without the previous patch applied.

> >>But there is no one specified for "memstick/host/" in MAINTAINERS.
> >>Could anyone else Ack this?

Andrew (CC'ed) has been Acking these thus far.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v4 1/3] mfd: Add realtek USB card reader driver

2014-02-17 Thread Roger

On 02/17/2014 06:02 PM, Lee Jones wrote:

From: Roger Tseng 

Realtek USB card reader provides a channel to transfer command or data to flash
memory cards. This driver exports host instances for mmc and memstick subsystems
and handles basic works.

Signed-off-by: Roger Tseng 
---
  drivers/mfd/Kconfig  |  10 +
  drivers/mfd/Makefile |   1 +
  drivers/mfd/rtsx_usb.c   | 760 +++
  include/linux/mfd/rtsx_usb.h | 628 +++
  4 files changed, 1399 insertions(+)
  create mode 100644 drivers/mfd/rtsx_usb.c
  create mode 100644 include/linux/mfd/rtsx_usb.h


Applied again, thanks.


Would you also apply patch 2/3 and 3/3 that to make the device fully
operational for users? Or should they be applied by maintainers of
mmc/memstick subsystems?

Chris, would you give some comment?


I can apply them, but I need the other Maintainer Acks.

If they are build orthogonal i.e. there are no build dependencies
between them, it's probably better that they go into their associated
trees separately.


I think it would be better to apply them together since the later
patches really depend on the 1st one,so now we are waiting for Acks
from mmc/memstick subsystems.


When you say "depend on", do you mean as a build depenency, or won't
run without the first patch applied?


The later 2 patches actually invoke symbols defined in the first patch 
and won't compile if it is not applied first. The Kconfig changes for 
the later oness also specified this by "depends on".


I'm not sure if this means "build dependency". Sorry for my unclear words.


But there is no one specified for "memstick/host/" in MAINTAINERS.
Could anyone else Ack this?



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


Re: [PATCH v4 1/3] mfd: Add realtek USB card reader driver

2014-02-17 Thread Lee Jones
> From: Roger Tseng 
> 
> Realtek USB card reader provides a channel to transfer command or data to 
> flash
> memory cards. This driver exports host instances for mmc and memstick 
> subsystems
> and handles basic works.
> 
> Signed-off-by: Roger Tseng 
> ---
>   drivers/mfd/Kconfig  |  10 +
>   drivers/mfd/Makefile |   1 +
>   drivers/mfd/rtsx_usb.c   | 760 
>  +++
>   include/linux/mfd/rtsx_usb.h | 628 +++
>   4 files changed, 1399 insertions(+)
>   create mode 100644 drivers/mfd/rtsx_usb.c
>   create mode 100644 include/linux/mfd/rtsx_usb.h
> >>>
> >>>Applied again, thanks.
> >>>
> >>Would you also apply patch 2/3 and 3/3 that to make the device fully
> >>operational for users? Or should they be applied by maintainers of
> >>mmc/memstick subsystems?
> >>
> >>Chris, would you give some comment?
> >
> >I can apply them, but I need the other Maintainer Acks.
> >
> >If they are build orthogonal i.e. there are no build dependencies
> >between them, it's probably better that they go into their associated
> >trees separately.
> >
> I think it would be better to apply them together since the later
> patches really depend on the 1st one,so now we are waiting for Acks
> from mmc/memstick subsystems.

When you say "depend on", do you mean as a build depenency, or won't
run without the first patch applied?

> But there is no one specified for "memstick/host/" in MAINTAINERS.
> Could anyone else Ack this?

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v4 1/3] mfd: Add realtek USB card reader driver

2014-02-17 Thread Roger

On 02/17/2014 04:22 PM, Lee Jones wrote:

From: Roger Tseng 

Realtek USB card reader provides a channel to transfer command or data to flash
memory cards. This driver exports host instances for mmc and memstick subsystems
and handles basic works.

Signed-off-by: Roger Tseng 
---
  drivers/mfd/Kconfig  |  10 +
  drivers/mfd/Makefile |   1 +
  drivers/mfd/rtsx_usb.c   | 760 +++
  include/linux/mfd/rtsx_usb.h | 628 +++
  4 files changed, 1399 insertions(+)
  create mode 100644 drivers/mfd/rtsx_usb.c
  create mode 100644 include/linux/mfd/rtsx_usb.h


Applied again, thanks.


Would you also apply patch 2/3 and 3/3 that to make the device fully
operational for users? Or should they be applied by maintainers of
mmc/memstick subsystems?

Chris, would you give some comment?


I can apply them, but I need the other Maintainer Acks.

If they are build orthogonal i.e. there are no build dependencies
between them, it's probably better that they go into their associated
trees separately.

I think it would be better to apply them together since the later 
patches really depend on the 1st one,so now we are waiting for Acks from 
mmc/memstick subsystems.


But there is no one specified for "memstick/host/" in MAINTAINERS. Could 
anyone else Ack this?

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


Re: [PATCH v4 1/3] mfd: Add realtek USB card reader driver

2014-02-17 Thread Lee Jones
> >>From: Roger Tseng 
> >>
> >>Realtek USB card reader provides a channel to transfer command or data to 
> >>flash
> >>memory cards. This driver exports host instances for mmc and memstick 
> >>subsystems
> >>and handles basic works.
> >>
> >>Signed-off-by: Roger Tseng 
> >>---
> >>  drivers/mfd/Kconfig  |  10 +
> >>  drivers/mfd/Makefile |   1 +
> >>  drivers/mfd/rtsx_usb.c   | 760 
> >> +++
> >>  include/linux/mfd/rtsx_usb.h | 628 +++
> >>  4 files changed, 1399 insertions(+)
> >>  create mode 100644 drivers/mfd/rtsx_usb.c
> >>  create mode 100644 include/linux/mfd/rtsx_usb.h
> >
> >Applied again, thanks.
> >
> Would you also apply patch 2/3 and 3/3 that to make the device fully
> operational for users? Or should they be applied by maintainers of
> mmc/memstick subsystems?
> 
> Chris, would you give some comment?

I can apply them, but I need the other Maintainer Acks.

If they are build orthogonal i.e. there are no build dependencies
between them, it's probably better that they go into their associated
trees separately.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v4 1/3] mfd: Add realtek USB card reader driver

2014-02-16 Thread Roger

On 02/14/2014 05:44 PM, Lee Jones wrote:

On Wed, 12 Feb 2014, rogera...@realtek.com wrote:


From: Roger Tseng 

Realtek USB card reader provides a channel to transfer command or data to flash
memory cards. This driver exports host instances for mmc and memstick subsystems
and handles basic works.

Signed-off-by: Roger Tseng 
---
  drivers/mfd/Kconfig  |  10 +
  drivers/mfd/Makefile |   1 +
  drivers/mfd/rtsx_usb.c   | 760 +++
  include/linux/mfd/rtsx_usb.h | 628 +++
  4 files changed, 1399 insertions(+)
  create mode 100644 drivers/mfd/rtsx_usb.c
  create mode 100644 include/linux/mfd/rtsx_usb.h


Applied again, thanks.

Would you also apply patch 2/3 and 3/3 that to make the device fully 
operational for users? Or should they be applied by maintainers of 
mmc/memstick subsystems?


Chris, would you give some comment?
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v4 1/3] mfd: Add realtek USB card reader driver

2014-02-14 Thread Lee Jones
On Wed, 12 Feb 2014, rogera...@realtek.com wrote:

> From: Roger Tseng 
> 
> Realtek USB card reader provides a channel to transfer command or data to 
> flash
> memory cards. This driver exports host instances for mmc and memstick 
> subsystems
> and handles basic works.
> 
> Signed-off-by: Roger Tseng 
> ---
>  drivers/mfd/Kconfig  |  10 +
>  drivers/mfd/Makefile |   1 +
>  drivers/mfd/rtsx_usb.c   | 760 
> +++
>  include/linux/mfd/rtsx_usb.h | 628 +++
>  4 files changed, 1399 insertions(+)
>  create mode 100644 drivers/mfd/rtsx_usb.c
>  create mode 100644 include/linux/mfd/rtsx_usb.h

Applied again, thanks.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v4 1/3] mfd: Add realtek USB card reader driver

2014-02-12 Thread rogerable
From: Roger Tseng 

Realtek USB card reader provides a channel to transfer command or data to flash
memory cards. This driver exports host instances for mmc and memstick subsystems
and handles basic works.

Signed-off-by: Roger Tseng 
---
 drivers/mfd/Kconfig  |  10 +
 drivers/mfd/Makefile |   1 +
 drivers/mfd/rtsx_usb.c   | 760 +++
 include/linux/mfd/rtsx_usb.h | 628 +++
 4 files changed, 1399 insertions(+)
 create mode 100644 drivers/mfd/rtsx_usb.c
 create mode 100644 include/linux/mfd/rtsx_usb.h

diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index b7c74a7..fabad24 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -507,6 +507,16 @@ config MFD_RTSX_PCI
  types of memory cards, such as Memory Stick, Memory Stick Pro,
  Secure Digital and MultiMediaCard.
 
+config MFD_RTSX_USB
+   tristate "Realtek USB card reader"
+   depends on USB
+   select MFD_CORE
+   help
+ Select this option to get support for Realtek USB 2.0 card readers
+ including RTS5129, RTS5139, RTS5179 and RTS5170.
+ Realtek card reader supports access to many types of memory cards,
+ such as Memory Stick Pro, Secure Digital and MultiMediaCard.
+
 config MFD_RC5T583
bool "Ricoh RC5T583 Power Management system device"
depends on I2C=y
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index 8a28dc9..33b8de6 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -14,6 +14,7 @@ obj-$(CONFIG_MFD_CROS_EC_SPI) += cros_ec_spi.o
 
 rtsx_pci-objs  := rtsx_pcr.o rts5209.o rts5229.o rtl8411.o 
rts5227.o rts5249.o
 obj-$(CONFIG_MFD_RTSX_PCI) += rtsx_pci.o
+obj-$(CONFIG_MFD_RTSX_USB) += rtsx_usb.o
 
 obj-$(CONFIG_HTC_EGPIO)+= htc-egpio.o
 obj-$(CONFIG_HTC_PASIC3)   += htc-pasic3.o
diff --git a/drivers/mfd/rtsx_usb.c b/drivers/mfd/rtsx_usb.c
new file mode 100644
index 000..b53b9d4
--- /dev/null
+++ b/drivers/mfd/rtsx_usb.c
@@ -0,0 +1,760 @@
+/* Driver for Realtek USB card reader
+ *
+ * Copyright(c) 2009-2013 Realtek Semiconductor Corp. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, see .
+ *
+ * Author:
+ *   Roger Tseng 
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+static int polling_pipe = 1;
+module_param(polling_pipe, int, S_IRUGO | S_IWUSR);
+MODULE_PARM_DESC(polling_pipe, "polling pipe (0: ctl, 1: bulk)");
+
+static struct mfd_cell rtsx_usb_cells[] = {
+   [RTSX_USB_SD_CARD] = {
+   .name = "rtsx_usb_sdmmc",
+   .pdata_size = 0,
+   },
+   [RTSX_USB_MS_CARD] = {
+   .name = "rtsx_usb_ms",
+   .pdata_size = 0,
+   },
+};
+
+static void rtsx_usb_sg_timed_out(unsigned long data)
+{
+   struct rtsx_ucr *ucr = (struct rtsx_ucr *)data;
+
+   dev_dbg(&ucr->pusb_intf->dev, "%s: sg transfer timed out", __func__);
+   usb_sg_cancel(&ucr->current_sg);
+
+   /* we know the cancellation is caused by time-out */
+   ucr->current_sg.status = -ETIMEDOUT;
+}
+
+static int rtsx_usb_bulk_transfer_sglist(struct rtsx_ucr *ucr,
+   unsigned int pipe, struct scatterlist *sg, int num_sg,
+   unsigned int length, unsigned int *act_len, int timeout)
+{
+   int ret;
+
+   dev_dbg(&ucr->pusb_intf->dev, "%s: xfer %u bytes, %d entries\n",
+   __func__, length, num_sg);
+   ret = usb_sg_init(&ucr->current_sg, ucr->pusb_dev, pipe, 0,
+   sg, num_sg, length, GFP_NOIO);
+   if (ret)
+   return ret;
+
+   ucr->sg_timer.expires = jiffies + msecs_to_jiffies(timeout);
+   add_timer(&ucr->sg_timer);
+   usb_sg_wait(&ucr->current_sg);
+   del_timer(&ucr->sg_timer);
+
+   if (act_len)
+   *act_len = ucr->current_sg.bytes;
+
+   return ucr->current_sg.status;
+}
+
+int rtsx_usb_transfer_data(struct rtsx_ucr *ucr, unsigned int pipe,
+ void *buf, unsigned int len, int num_sg,
+ unsigned int *act_len, int timeout)
+{
+   if (timeout < 600)
+   timeout = 600;
+
+   if (num_sg)
+   return rtsx_usb_bulk_transfer_sglist(ucr, pipe,
+   (struct scatterlist *)buf, num_sg, len, act_len,
+   timeout);
+   e