Skip to contentSkip to conversation

Add modules to support realtek PCIE card reader

PATCH Superseded [email protected] 8 participants 18 messages Sep 11, 2012 – Oct 26, 2012

Subsystems (3)

v6 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

v6 cover Add modules to support realtek PCIE card reader

From: Wei WANG <[email protected]>

Support for Realtek PCI-Express driver-based card readers including rts5209 and rts5229.

v2:
1. Using platform device to replace realtek slot bus

v3:
1. Fix a bug that DMA out of SW-IOMMU space in Lenovo Thinkpad x121e
2. Tested by Borislav Petkov <[email protected]>

v4:
1. Fulfill power management callbacks

v5:
1. Support Memstick card

v6:
1. Fix some coding style

Wei WANG (3):
drivers/mfd: Add realtek pcie card reader driver drivers/mmc: Add realtek pcie sdmmc host driver drivers/memstick: Add realtek pcie memstick host driver

 drivers/memstick/host/Kconfig       |   10 +
 drivers/memstick/host/Makefile      |    1 +
 drivers/memstick/host/rtsx_pci_ms.c |  637 ++++++++++++++++
 drivers/mfd/Kconfig                 |    9 +
 drivers/mfd/Makefile                |    4 +
 drivers/mfd/rts5209.c               |  188 +++++
 drivers/mfd/rts5229.c               |  179 +++++
 drivers/mfd/rtsx_pcr.c              | 1345 ++++++++++++++++++++++++++++++++++
 drivers/mfd/rtsx_pcr.h              |   31 +
 drivers/mmc/host/Kconfig            |    7 +
 drivers/mmc/host/Makefile           |    2 +
 drivers/mmc/host/rtsx_pci_sdmmc.c   | 1372 +++++++++++++++++++++++++++++++++++
 include/linux/mfd/rtsx_common.h     |   47 ++
 include/linux/mfd/rtsx_pci.h        |  773 ++++++++++++++++++++
 14 files changed, 4605 insertions(+)
 create mode 100644 drivers/memstick/host/rtsx_pci_ms.c
 create mode 100644 drivers/mfd/rts5209.c
 create mode 100644 drivers/mfd/rts5229.c
 create mode 100644 drivers/mfd/rtsx_pcr.c
 create mode 100644 drivers/mfd/rtsx_pcr.h
 create mode 100644 drivers/mmc/host/rtsx_pci_sdmmc.c
 create mode 100644 include/linux/mfd/rtsx_common.h
 create mode 100644 include/linux/mfd/rtsx_pci.h
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH v6 1/3 drivers/mfd: Add realtek pcie card reader driver

From: Wei WANG <[email protected]>

Realtek PCI-E card reader driver adapts requests from upper-level sdmmc/memstick layer to the real physical card reader.

---
 drivers/mfd/Kconfig             |    9 +
 drivers/mfd/Makefile            |    4 +
 drivers/mfd/rts5209.c           |  188 ++++++
 drivers/mfd/rts5229.c           |  179 ++++++
 drivers/mfd/rtsx_pcr.c          | 1345 +++++++++++++++++++++++++++++++++++++++
 drivers/mfd/rtsx_pcr.h          |   31 +
 include/linux/mfd/rtsx_common.h |   47 ++
 include/linux/mfd/rtsx_pci.h    |  773 ++++++++++++++++++++++
 8 files changed, 2576 insertions(+)
 create mode 100644 drivers/mfd/rts5209.c
 create mode 100644 drivers/mfd/rts5229.c
 create mode 100644 drivers/mfd/rtsx_pcr.c
 create mode 100644 drivers/mfd/rtsx_pcr.h
 create mode 100644 include/linux/mfd/rtsx_common.h
 create mode 100644 include/linux/mfd/rtsx_pci.h
drivers/mfd/Kconfig +9 -0
index d1facef..4c07a34 100644
@@ -63,6 +63,15 @@ config MFD_SM501_GPIO
 	 lines on the SM501. The platform data is used to supply the
 	 base number for the first GPIO line to register.
 
+config MFD_RTSX_PCI
+	tristate "Support for Realtek PCI-E driver-based card reader"
+	depends on PCI
+	help
+	  This supports for Realtek PCI-Express driver-based card reader including
+	  rts5209, rts5229, etc. Realtek driver-based card reader supports access
+	  to many types of memory cards, such as Memory Stick, Memory Stick Pro,
+	  Secure Digital and MultiMediaCard.
+
 config MFD_ASIC3
 	bool "Support for Compaq ASIC3"
 	depends on GENERIC_HARDIRQS && GPIOLIB && ARM
drivers/mfd/Makefile +4 -0
index 79dd22d..e8cdc7b 100644
@@ -9,6 +9,9 @@ obj-$(CONFIG_MFD_88PM805)	+= 88pm805.o 88pm80x.o
 obj-$(CONFIG_MFD_SM501)		+= sm501.o
 obj-$(CONFIG_MFD_ASIC3)		+= asic3.o tmio_core.o
 
+rtsx_pci-objs			:= rtsx_pcr.o rts5209.o rts5229.o
+obj-$(CONFIG_MFD_RTSX_PCI)	+= rtsx_pci.o
+
 obj-$(CONFIG_HTC_EGPIO)		+= htc-egpio.o
 obj-$(CONFIG_HTC_PASIC3)	+= htc-pasic3.o
 obj-$(CONFIG_HTC_I2CPLD)	+= htc-i2cpld.o
@@ -132,3 +135,4 @@ obj-$(CONFIG_MFD_RC5T583)	+= rc5t583.o rc5t583-irq.o
 obj-$(CONFIG_MFD_SEC_CORE)	+= sec-core.o sec-irq.o
 obj-$(CONFIG_MFD_ANATOP)	+= anatop-mfd.o
 obj-$(CONFIG_MFD_LM3533)	+= lm3533-core.o lm3533-ctrlbank.o
+obj-$(CONFIG_MFD_RTSX_PCI)	+= rtsx_pci.o
drivers/mfd/rts5209.c new file +188 -0

188 lines not on this page · raw message

drivers/mfd/rts5229.c new file +179 -0

179 lines not on this page · raw message

drivers/mfd/rtsx_pcr.c new file +1345 -0

1,345 lines not on this page · raw message

drivers/mfd/rtsx_pcr.h new file +31 -0
new file mode 100644
index 0000000..0a56b39
@@ -0,0 +1,31 @@
+/* Driver for Realtek PCI-Express card reader
+ *
+ * Copyright(c) 2009 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 as published by the
+ * Free Software Foundation; either version 2, or (at your option) any
+ * later version.
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ *
+ * Author:
+ *   Wei WANG <[email protected]>
+ *   No. 450, Shenhu Road, Suzhou Industry Park, Suzhou, China
+ */
+
+#ifndef __RTSX_PCR_H
+#define __RTSX_PCR_H
+
+#include <linux/mfd/rtsx_pci.h>
+
+void rts5209_init_params(struct rtsx_pcr *pcr);
+void rts5229_init_params(struct rtsx_pcr *pcr);
+
+#endif
include/linux/mfd/rtsx_common.h new file +47 -0

47 lines not on this page · raw message

include/linux/mfd/rtsx_pci.h new file +773 -0

773 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#2 lore raw

Re: [PATCH v6 1/3] drivers/mfd: Add realtek pcie card reader driver

Hi Wei,

Quoted 8 lines · On Tue, Sep 11, 2012 at 12:54:22PM +0800, [email protected] wrote:

From: Wei WANG <[email protected]>

Realtek PCI-E card reader driver adapts requests from upper-level sdmmc/memstick layer to the real physical card reader.

Quoted 16 lines
---
 drivers/mfd/Kconfig             |    9 +
 drivers/mfd/Makefile            |    4 +
 drivers/mfd/rts5209.c           |  188 ++++++
 drivers/mfd/rts5229.c           |  179 ++++++
 drivers/mfd/rtsx_pcr.c          | 1345 +++++++++++++++++++++++++++++++++++++++
 drivers/mfd/rtsx_pcr.h          |   31 +
 include/linux/mfd/rtsx_common.h |   47 ++
 include/linux/mfd/rtsx_pci.h    |  773 ++++++++++++++++++++++
 8 files changed, 2576 insertions(+)
 create mode 100644 drivers/mfd/rts5209.c
 create mode 100644 drivers/mfd/rts5229.c
 create mode 100644 drivers/mfd/rtsx_pcr.c
 create mode 100644 drivers/mfd/rtsx_pcr.h
 create mode 100644 include/linux/mfd/rtsx_common.h
 create mode 100644 include/linux/mfd/rtsx_pci.h

Although pretty big, the patch looks mostly good to me. I only have a few comments:

Quoted 5 lines
drivers/mfd/Kconfig +0 -0
index d1facef..4c07a34 100644

drivers/mfd/Kconfig config MFD_SM501_GPIO · line 71

Quoted 9 lines
drivers/mfd/Kconfig +6 -0
@@ -63,6 +63,15 @@ config MFD_SM501_GPIO
 	 lines on the SM501. The platform data is used to supply the
 	 base number for the first GPIO line to register.
 
+config MFD_RTSX_PCI
+	tristate "Support for Realtek PCI-E driver-based card reader"
+	depends on PCI
+	help
+	  This supports for Realtek PCI-Express driver-based card reader including
+	  rts5209, rts5229, etc. Realtek driver-based card reader supports access

driver-based ?

Quoted 29 lines
drivers/mfd/rts5209.c new file +23 -0
new file mode 100644
index 0000000..6680d6d
@@ -0,0 +1,188 @@
+/* Driver for Realtek PCI-Express card reader
+ *
+ * Copyright(c) 2009 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 as published by the
+ * Free Software Foundation; either version 2, or (at your option) any
+ * later version.
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ *
+ * Author:
+ *   Wei WANG <[email protected]>
+ *   No. 450, Shenhu Road, Suzhou Industry Park, Suzhou, China
+ */
+
+#include <linux/module.h>

drivers/mfd/rts5209.c line 33

Quoted 10 lines
drivers/mfd/rts5209.c new file +10 -0
+#include <linux/mfd/rtsx_pci.h>
+
+#include "rtsx_pcr.h"
+
+static u8 rts5209_get_ic_version(struct rtsx_pcr *pcr)
+{
+	u8 val;
+
+	val = rtsx_pci_readb(pcr, 0x1C);
+	return val & 0x0F;

For your IO accesses, it would e worth looking at the regmap MMIO routines. It would also simplify your main probe routine.

drivers/mfd/rts5209.c line 58

Quoted 3 lines
drivers/mfd/rts5209.c new file +3 -0
+static int rts5209_turn_on_led(struct rtsx_pcr *pcr)
+{
+	return rtsx_pci_write_register(pcr, 0xFD58, 0x01, 0x00);

You have many hardcoded register adresses around this code. Defining them in your header file wouldn't hurt.

Quoted 16 lines
drivers/mfd/rts5209.c new file +16 -0
+static struct platform_device *rtsx_pci_create_subdev(struct rtsx_pcr *pcr,
+		const char *name, int slot_id)
+{
+	struct platform_device *p_dev;
+	int err;
+
+	p_dev = platform_device_alloc(name, pcr->id);
+	if (p_dev == NULL) {
+		dev_dbg(&(pcr->pci->dev), "alloc platform device fail!\n");
+		return NULL;
+	}
+
+	p_dev->dev.parent = &(pcr->pci->dev);
+	platform_set_drvdata(p_dev, pcr);
+	pcr->slots[slot_id].p_dev = p_dev;
+

drivers/mfd/rts5209.c line 62

Quoted 10 lines
drivers/mfd/rts5209.c new file +10 -0
+	err = platform_device_add(p_dev);
+	if (err) {
+		dev_dbg(&(pcr->pci->dev), "add platform device fail!\n");
+		pcr->slots[slot_id].p_dev = NULL;
+		platform_device_put(p_dev);
+		return NULL;
+	}
+
+	return p_dev;
+}

Please use the MFD device addition API for that.

Quoted 35 lines
drivers/mfd/rts5209.c new file +35 -0
+static irqreturn_t rtsx_pci_isr(int irq, void *dev_id)
+{
+	struct rtsx_pcr *pcr = dev_id;
+	u32 int_reg;
+
+	if (!pcr)
+		return IRQ_NONE;
+
+	spin_lock(&pcr->lock);
+
+	int_reg = rtsx_pci_readl(pcr, RTSX_BIPR);
+	/* Clear interrupt flag */
+	rtsx_pci_writel(pcr, RTSX_BIPR, int_reg);
+	if ((int_reg & pcr->bier) == 0) {
+		spin_unlock(&pcr->lock);
+		return IRQ_NONE;
+	}
+	if (int_reg == 0xFFFFFFFF) {
+		spin_unlock(&pcr->lock);
+		return IRQ_HANDLED;
+	}
+
+	int_reg &= (pcr->bier | 0x7FFFFF);
+
+	if (int_reg & SD_INT) {
+		if (int_reg & SD_EXIST) {
+			pcr->need_reset |= SD_EXIST;
+		} else {
+			pcr->need_release |= SD_EXIST;
+			pcr->need_reset &= ~SD_EXIST;
+		}
+	}
+
+	if (int_reg & MS_INT) {
+		if (int_reg & MS_EXIST) {

drivers/mfd/rts5209.c line 107

Quoted 10 lines
drivers/mfd/rts5209.c new file +10 -0
+			pcr->need_reset |= MS_EXIST;
+		} else {
+			pcr->need_release |= MS_EXIST;
+			pcr->need_reset &= ~MS_EXIST;
+		}
+	}
+
+	if (pcr->need_reset || pcr->need_release)
+		queue_delayed_work(workqueue, &pcr->carddet_work,
+				msecs_to_jiffies(200));

Why do we need a delayed work here ?

drivers/mfd/rts5209.c line 113

Quoted 6 lines
drivers/mfd/rts5209.c new file +6 -0
+static void rtsx_pci_enter_idle(unsigned long __data)
+{
+	struct rtsx_pcr *pcr = (struct rtsx_pcr *)__data;
+
+	queue_work(workqueue, &pcr->idle_work);
+}

OT: We need threaded timers...

drivers/mfd/rts5209.c line 118

Quoted 5 lines
drivers/mfd/rts5209.c new file +5 -0
+static int __init rtsx_pci_drv_init(void)
+{
+	workqueue = create_freezable_workqueue("rtsx_pci_wq");
+	if (!workqueue)
+		return -ENOMEM;

Are you sure you really need to create your won workqueue ? My guess is that you probably don't.

Cheers,
Samuel.

Signature · 2 lines
Intel Open Source Technology Centre
http://oss.intel.com/
author
#3 lore raw

Re: [PATCH v6 1/3] drivers/mfd: Add realtek pcie card reader driver

Quoted 14 lines · Samuel Ortiz

Hi Wei,

On Tue, Sep 11, 2012 at 12:54:22PM +0800, [email protected] wrote:
Although pretty big, the patch looks mostly good to me.
I only have a few comments:

Quoted 8 lines
drivers/mfd/Kconfig +0 -0
index d1facef..4c07a34 100644
@@ -63,6 +63,15 @@ config MFD_SM501_GPIO
 	 lines on the SM501. The platform data is used to supply the
 	 base number for the first GPIO line to register.
 
Quoted 7 lines

drivers/mfd/Kconfig config MFD_SM501_GPIO · line 71

Quoted 6 lines
drivers/mfd/Kconfig +6 -0
+config MFD_RTSX_PCI
+	tristate "Support for Realtek PCI-E driver-based card reader"
+	depends on PCI
+	help
+	  This supports for Realtek PCI-Express driver-based card reader including
+	  rts5209, rts5229, etc. Realtek driver-based card reader supports access

driver-based ?

Sorry, this is our internal naming convention. We have two groups of card reader, one group has embedded MCU and uses in-box driver, the other hasn't MCU and uses vendor driver. So we call the first group as "MCU-based reader", and the second group as "driver-based reader". This naming convention may confuse others, I will modify the description.

Quoted 10 lines

drivers/mfd/Kconfig config MFD_SM501_GPIO

Quoted 8 lines
drivers/mfd/Kconfig +7 -0
+
+static u8 rts5209_get_ic_version(struct rtsx_pcr *pcr)
+{
+	u8 val;
+
+	val = rtsx_pci_readb(pcr, 0x1C);
+	return val & 0x0F;

For your IO accesses, it would e worth looking at the regmap MMIO routines. It would also simplify your main probe routine.

regmap MMIO is great. But I haven't used it before, and it seems that we haven't enough time to test it in this short merge window. I will take your advice and use these routines in the near future.

Quoted 6 lines

drivers/mfd/Kconfig

Quoted 4 lines
drivers/mfd/Kconfig +3 -0
+static int rts5209_turn_on_led(struct rtsx_pcr *pcr)
+{
+	return rtsx_pci_write_register(pcr, 0xFD58, 0x01, 0x00);

You have many hardcoded register adresses around this code. Defining them in your header file wouldn't hurt.

I will modify it soon.

Quoted 20 lines
Quoted 20 lines
drivers/mfd/Kconfig +19 -0
+static struct platform_device *rtsx_pci_create_subdev(struct rtsx_pcr *pcr,
+		const char *name, int slot_id)
+{
+	struct platform_device *p_dev;
+	int err;
+
+	p_dev = platform_device_alloc(name, pcr->id);
+	if (p_dev == NULL) {
+		dev_dbg(&(pcr->pci->dev), "alloc platform device fail!\n");
+		return NULL;
+	}
+
+	p_dev->dev.parent = &(pcr->pci->dev);
+	platform_set_drvdata(p_dev, pcr);
+	pcr->slots[slot_id].p_dev = p_dev;
+
+	err = platform_device_add(p_dev);
+	if (err) {
+		dev_dbg(&(pcr->pci->dev), "add platform device fail!\n");
Quoted 9 lines

drivers/mfd/Kconfig

Quoted 7 lines
drivers/mfd/Kconfig +7 -0
+		pcr->slots[slot_id].p_dev = NULL;
+		platform_device_put(p_dev);
+		return NULL;
+	}
+
+	return p_dev;
+}

Please use the MFD device addition API for that.

You suggest using mfd_cell ? I have considered it, but it seems not very flexible in my situation. I will create two sub devices in the driver, one for SD/MMC card, the other for Memstick. I need to create the sub device when the card inserted, and destroy it when the card removed. The timing to create and destroy is totally up to the user.
But mfd_cell will create and destroy all of the sub devices at the same time, using API mfd_add_devices and mfd_remove_devices, which can not meet my desire.

Quoted 38 lines
Quoted 38 lines
drivers/mfd/Kconfig +38 -0
+static irqreturn_t rtsx_pci_isr(int irq, void *dev_id)
+{
+	struct rtsx_pcr *pcr = dev_id;
+	u32 int_reg;
+
+	if (!pcr)
+		return IRQ_NONE;
+
+	spin_lock(&pcr->lock);
+
+	int_reg = rtsx_pci_readl(pcr, RTSX_BIPR);
+	/* Clear interrupt flag */
+	rtsx_pci_writel(pcr, RTSX_BIPR, int_reg);
+	if ((int_reg & pcr->bier) == 0) {
+		spin_unlock(&pcr->lock);
+		return IRQ_NONE;
+	}
+	if (int_reg == 0xFFFFFFFF) {
+		spin_unlock(&pcr->lock);
+		return IRQ_HANDLED;
+	}
+
+	int_reg &= (pcr->bier | 0x7FFFFF);
+
+	if (int_reg & SD_INT) {
+		if (int_reg & SD_EXIST) {
+			pcr->need_reset |= SD_EXIST;
+		} else {
+			pcr->need_release |= SD_EXIST;
+			pcr->need_reset &= ~SD_EXIST;
+		}
+	}
+
+	if (int_reg & MS_INT) {
+		if (int_reg & MS_EXIST) {
+			pcr->need_reset |= MS_EXIST;
+		} else {
+			pcr->need_release |= MS_EXIST;
Quoted 8 lines

drivers/mfd/Kconfig

Quoted 7 lines
drivers/mfd/Kconfig +7 -0
+			pcr->need_reset &= ~MS_EXIST;
+		}
+	}
+
+	if (pcr->need_reset || pcr->need_release)
+		queue_delayed_work(workqueue, &pcr->carddet_work,
+				msecs_to_jiffies(200));

Why do we need a delayed work here ?

We need a period of time to debounce the CD glitch, so I use a delayed work here. After 200 milliseconds, I will check the CD signal again to make sure this is a valid signal.

Quoted 9 lines

drivers/mfd/Kconfig

Quoted 7 lines
drivers/mfd/Kconfig +6 -0
+static void rtsx_pci_enter_idle(unsigned long __data)
+{
+	struct rtsx_pcr *pcr = (struct rtsx_pcr *)__data;
+
+	queue_work(workqueue, &pcr->idle_work);
+}

OT: We need threaded timers...

Sorry, I can't understand this...

Quoted 7 lines

drivers/mfd/Kconfig

Quoted 5 lines
drivers/mfd/Kconfig +5 -0
+static int __init rtsx_pci_drv_init(void)
+{
+	workqueue = create_freezable_workqueue("rtsx_pci_wq");
+	if (!workqueue)
+		return -ENOMEM;

Are you sure you really need to create your won workqueue ? My guess is that you probably don't.

I will modify it and make a full test.

BR,
Wei WANG

#4 lore raw

PATCH v6 2/3 drivers/mmc: Add realtek pcie sdmmc host driver

In reply to [email protected]

From: Wei WANG <[email protected]>

Realtek PCI-E SD/MMC card host driver is used to access SD/MMC card, with the help of Realtek PCI-E card reader MFD driver.

---
 drivers/mmc/host/Kconfig          |    7 +
 drivers/mmc/host/Makefile         |    2 +
 drivers/mmc/host/rtsx_pci_sdmmc.c | 1372 +++++++++++++++++++++++++++++++++++++
 3 files changed, 1381 insertions(+)
 create mode 100644 drivers/mmc/host/rtsx_pci_sdmmc.c
drivers/mmc/host/Kconfig +7 -0
index aa131b3..d6f0c01 100644
@@ -612,3 +612,10 @@ config MMC_USHC
 
 	  Note: These controllers only support SDIO cards and do not
 	  support MMC or SD memory cards.
+
+config MMC_REALTEK_PCI
+	tristate "Realtek PCI-E SD/MMC Card Interface Driver"
+	depends on MFD_RTSX_PCI
+	help
+	  Say Y here to include driver code to support SD/MMC card interface
+	  of Realtek PCI-E driver-based card reader
drivers/mmc/host/Makefile +2 -0
index 8922b06..4679ba3 100644
@@ -45,6 +45,8 @@ obj-$(CONFIG_MMC_JZ4740)	+= jz4740_mmc.o
 obj-$(CONFIG_MMC_VUB300)	+= vub300.o
 obj-$(CONFIG_MMC_USHC)		+= ushc.o
 
+obj-$(CONFIG_MMC_REALTEK_PCI)	+= rtsx_pci_sdmmc.o
+
 obj-$(CONFIG_MMC_SDHCI_PLTFM)		+= sdhci-pltfm.o
 obj-$(CONFIG_MMC_SDHCI_CNS3XXX)		+= sdhci-cns3xxx.o
 obj-$(CONFIG_MMC_SDHCI_ESDHC_IMX)	+= sdhci-esdhc-imx.o
drivers/mmc/host/rtsx_pci_sdmmc.c new file +1372 -0

1,372 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#5 lore raw

PATCH v6 3/3 drivers/memstick: Add realtek pcie memstick host driver

In reply to [email protected]

From: Wei WANG <[email protected]>

Realtek PCI-E Memstick card host driver is used to access Memstick card, with the help of Realtek PCI-E card reader MFD driver.

---
 drivers/memstick/host/Kconfig       |   10 +
 drivers/memstick/host/Makefile      |    1 +
 drivers/memstick/host/rtsx_pci_ms.c |  637 +++++++++++++++++++++++++++++++++++
 3 files changed, 648 insertions(+)
 create mode 100644 drivers/memstick/host/rtsx_pci_ms.c
drivers/memstick/host/Kconfig +10 -0
index cc0997a..d539638 100644
@@ -42,3 +42,13 @@ config MEMSTICK_R592
 
 	  To compile this driver as a module, choose M here: the module will
 	  be called r592.
+
+config MEMSTICK_REALTEK_PCI
+	tristate "Realtek PCI-E Memstick Card Interface Driver"
+	depends on MFD_RTSX_PCI
+	help
+	  Say Y here to include driver code to support Memstick card interface
+	  of Realtek PCI-E driver-based card reader
+
+	  To compile this driver as a module, choose M here: the module will
+	  be called rtsx_pci_ms.
drivers/memstick/host/Makefile +1 -0
index 31ba8d3..af3459d 100644
@@ -5,3 +5,4 @@
 obj-$(CONFIG_MEMSTICK_TIFM_MS)		+= tifm_ms.o
 obj-$(CONFIG_MEMSTICK_JMICRON_38X)	+= jmb38x_ms.o
 obj-$(CONFIG_MEMSTICK_R592)		+= r592.o
+obj-$(CONFIG_MEMSTICK_REALTEK_PCI)	+= rtsx_pci_ms.o
drivers/memstick/host/rtsx_pci_ms.c new file +637 -0

637 lines not on this page · raw message

Signature · 1 line
1.7.9.5
Tested-by on the v6 series
#7 lore raw
In reply to [email protected]
Quoted 17 lines · On 09/11/2012 12:54 AM, [email protected] wrote:

From: Wei WANG <[email protected]>

Support for Realtek PCI-Express driver-based card readers including rts5209 and rts5229.

v2:
1. Using platform device to replace realtek slot bus

v3:
1. Fix a bug that DMA out of SW-IOMMU space in Lenovo Thinkpad x121e
2. Tested by Borislav Petkov <[email protected]>

v4:
1. Fulfill power management callbacks

v5:
1. Support Memstick card

Quoted 7 lines

v6:
1. Fix some coding style

Wei WANG (3):
drivers/mfd: Add realtek pcie card reader driver drivers/mmc: Add realtek pcie sdmmc host driver drivers/memstick: Add realtek pcie memstick host driver

I have a recent HP Pavilion dv6 with this card reader, 10ec:5209 (rev 01). I just applied these patches on top of 3.6-rc7. Appears to work properly with a SanDisk 8GB SDHC card. I don't have a memstick to test.

For patches 1 & 2, feel free to add my:

Regards,

Phil

#8 lore raw
Quoted 5 lines · Phil Turmel
Quoted 4 lines

Wei WANG (3):
drivers/mfd: Add realtek pcie card reader driver drivers/mmc: Add realtek pcie sdmmc host driver drivers/memstick: Add realtek pcie memstick host driver

Quoted 8 lines

I have a recent HP Pavilion dv6 with this card reader, 10ec:5209 (rev 01). I just applied these patches on top of 3.6-rc7. Appears to work properly with a SanDisk 8GB SDHC card. I don't have a memstick to test.

For patches 1 & 2, feel free to add my:

Ok, good. Thanks for doing that.

So, I think that this driver has seen a bunch of testing and reviewing and we might start considering upstreaming it. There are a bunch of laptops integrating those readers and maybe a single three-month-ish -rc period of testing wouldn't hurt before it appears upstream.

Now, AFAICT, there is another driver in staging which supports the same or a subset of the cardreaders this driver does so I don't know what Realsil want to do with that. Wei?

And since this driver touches multiple drivers/{mfd,mmc,memstick} subdirs, maybe akpm would like to merge it? At least I haven't seen any other maintainers complaining about its design or wanting to take it so
...

Thanks.

Signature · 2 lines
Regards/Gruss,
    Boris.
#9 lore raw

Hi,

Quoted 5 lines · Borislav Petkov

So, I think that this driver has seen a bunch of testing and reviewing and we might start considering upstreaming it. There are a bunch of laptops integrating those readers and maybe a single three-month-ish -rc period of testing wouldn't hurt before it appears upstream.

Quoted 7 lines

Now, AFAICT, there is another driver in staging which supports the same or a subset of the cardreaders this driver does so I don't know what Realsil want to do with that. Wei?

And since this driver touches multiple drivers/{mfd,mmc,memstick} subdirs, maybe akpm would like to merge it? At least I haven't seen any other maintainers complaining about its design or wanting to take it so

I think you've missed the mails -- Alex Dubov has acked the memstick portion, Samuel Ortiz has said he'll push the MFD driver for 3.7, and I've pushed the MMC driver into mmc-next for 3.7. So, I think we should merge it. I don't think we need akpm, since there are no build-time dependencies involved.

Thanks,

- Chris.

Signature · 2 lines
Chris Ball   <[email protected]>   <http://printf.net/>
One Laptop Per Child
#10 lore raw
Quoted 14 lines · Chris Ball
Quoted 5 lines · Borislav Petkov

So, I think that this driver has seen a bunch of testing and reviewing and we might start considering upstreaming it. There are a bunch of laptops integrating those readers and maybe a single three-month-ish -rc period of testing wouldn't hurt before it appears upstream.

Quoted 7 lines

Now, AFAICT, there is another driver in staging which supports the same or a subset of the cardreaders this driver does so I don't know what Realsil want to do with that. Wei?

And since this driver touches multiple drivers/{mfd,mmc,memstick} subdirs, maybe akpm would like to merge it? At least I haven't seen any other maintainers complaining about its design or wanting to take it so

Quoted 5 lines

I think you've missed the mails -- Alex Dubov has acked the memstick portion, Samuel Ortiz has said he'll push the MFD driver for 3.7, and I've pushed the MMC driver into mmc-next for 3.7. So, I think we should merge it. I don't think we need akpm, since there are no build-time dependencies involved.

Great, all is taken care of then.

Only the staging driver remains, I believe the CONFIG_RTS_PSTOR one. Wei?

Thanks.

Signature · 2 lines
Regards/Gruss,
    Boris.
author
#11 lore raw
Quoted 19 lines · Borislav Petkov
Quoted 10 lines · Chris Ball
Quoted 9 lines · Borislav Petkov

So, I think that this driver has seen a bunch of testing and reviewing and we might start considering upstreaming it. There are a bunch of laptops integrating those readers and maybe a single three-month-ish -rc period of testing wouldn't hurt before it appears upstream.

Now, AFAICT, there is another driver in staging which supports the same or a subset of the cardreaders this driver does so I don't know what Realsil want to do with that. Wei?

Quoted 8 lines
Quoted 3 lines

And since this driver touches multiple drivers/{mfd,mmc,memstick} subdirs, maybe akpm would like to merge it? At least I haven't seen any other maintainers complaining about its design or wanting to take it so

I think you've missed the mails -- Alex Dubov has acked the memstick portion, Samuel Ortiz has said he'll push the MFD driver for 3.7, and I've pushed the MMC driver into mmc-next for 3.7. So, I think we should merge it. I don't think we need akpm, since there are no build-time dependencies involved.

Quoted 6 lines

Great, all is taken care of then.

Only the staging driver remains, I believe the CONFIG_RTS_PSTOR one. Wei?

Thanks.

Hi all:

Sorry for my late reply. I'm on my vacation these days.

At first I want to explain the relationship between the staging driver "rts_pstor" with this one here.
Initially, we tried to build a SCSI driver for Realtek PCI-E card reader, which has the same architecture and code base with our Windows driver. And I pushed rts_pstor to staging tree last year. But Realtek PCI-E card reader is not a real SCSI device, which doesn't understand SCSI command at all. So SCSI subsystem won't accept rts_pstor, and I can't find a proper subsystem to push it to. That's why I create this series of drivers, which are more compatible with the whole Linux architecture. We are still maintaining the SCSI driver for Realtek card reader, and will release the latest source code in the Github in the future. But maybe we won't push it to the staging tree any more.

BR,
Wei WANG

#12 lore raw
Quoted 3 lines · wwang

We are still maintaining the SCSI driver for Realtek card reader, and will release the latest source code in the Github in the future. But maybe we won't push it to the staging tree any more.

Maybe we should just remove the staging code if it won't be fixed. That's sort of the point of staging.

regards,
dan carpenter

#13 lore raw
Quoted 7 lines · Dan Carpenter
Quoted 3 lines · wwang

We are still maintaining the SCSI driver for Realtek card reader, and will release the latest source code in the Github in the future. But maybe we won't push it to the staging tree any more.

Maybe we should just remove the staging code if it won't be fixed. That's sort of the point of staging.

I agree. wwang, want me to delet the staging driver now? I don't want "dead" code in the tree, especially as you don't want to maintain it anymore.

thanks,

greg k-h

author
#14 lore raw
Quoted 7 lines · Greg KH
Quoted 6 lines · Dan Carpenter
Quoted 3 lines · wwang

We are still maintaining the SCSI driver for Realtek card reader, and will release the latest source code in the Github in the future. But maybe we won't push it to the staging tree any more.

Maybe we should just remove the staging code if it won't be fixed. That's sort of the point of staging.

Quoted 7 lines

I agree. wwang, want me to delet the staging driver now? I don't want "dead" code in the tree, especially as you don't want to maintain it anymore.

thanks,

greg k-h

Hi Greg:

OK. You can delete it now, please.
And I will push my new driver to MFD and MMC subsystem.

Best Regards,
wwang

#15 lore raw
Quoted 12 lines · wwang
Quoted 11 lines · Greg KH
Quoted 6 lines · Dan Carpenter
Quoted 3 lines · wwang

We are still maintaining the SCSI driver for Realtek card reader, and will release the latest source code in the Github in the future. But maybe we won't push it to the staging tree any more.

Maybe we should just remove the staging code if it won't be fixed. That's sort of the point of staging.

I agree. wwang, want me to delet the staging driver now? I don't want "dead" code in the tree, especially as you don't want to maintain it anymore.

Quoted 7 lines
Quoted 3 lines

thanks,

greg k-h

Hi Greg:

OK. You can delete it now, please.
And I will push my new driver to MFD and MMC subsystem.

Ok, just to confirm, you want me to delete the
drivers/staging/rts_pstor/* code, right?

thanks,

greg k-h

author
#16 lore raw
Quoted 18 lines · Greg KH
Quoted 17 lines · wwang
Quoted 7 lines · Greg KH
Quoted 6 lines · Dan Carpenter
Quoted 3 lines · wwang

We are still maintaining the SCSI driver for Realtek card reader, and will release the latest source code in the Github in the future. But maybe we won't push it to the staging tree any more.

Maybe we should just remove the staging code if it won't be fixed. That's sort of the point of staging.

Quoted 7 lines

I agree. wwang, want me to delet the staging driver now? I don't want "dead" code in the tree, especially as you don't want to maintain it anymore.

thanks,

greg k-h

Hi Greg:

Quoted 8 lines
Quoted 2 lines

OK. You can delete it now, please.
And I will push my new driver to MFD and MMC subsystem.

Ok, just to confirm, you want me to delete the
drivers/staging/rts_pstor/* code, right?

thanks,

greg k-h

Hi Greg:

Yes, you can delete drivers/staging/rts_pstor

BR,
wwang

#17 lore raw
Quoted 24 lines · wwang
Quoted 23 lines · Greg KH
Quoted 12 lines · wwang
Quoted 11 lines · Greg KH
Quoted 6 lines · Dan Carpenter
Quoted 3 lines · wwang

We are still maintaining the SCSI driver for Realtek card reader, and will release the latest source code in the Github in the future. But maybe we won't push it to the staging tree any more.

Maybe we should just remove the staging code if it won't be fixed. That's sort of the point of staging.

I agree. wwang, want me to delet the staging driver now? I don't want "dead" code in the tree, especially as you don't want to maintain it anymore.

Quoted 7 lines
Quoted 3 lines

thanks,

greg k-h

Hi Greg:

OK. You can delete it now, please.
And I will push my new driver to MFD and MMC subsystem.

Ok, just to confirm, you want me to delete the
drivers/staging/rts_pstor/* code, right?

Quoted 6 lines
Quoted 3 lines

thanks,

greg k-h

Hi Greg:

Yes, you can delete drivers/staging/rts_pstor

Thanks, now done.

greg k-h