Skip to contentSkip to conversation

Add Winbond WB528SD Secure Digital (SD) card reader driver

PATCH In review Németh Márton 2 participants 4 messages Jan 21, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add Winbond WB528SD Secure Digital (SD) card reader driver

From: Márton Németh <[email protected]>

This driver version of Winbond WB528SD can detect mechanical card presence only. The information is provided through sysfs.

---
 drivers/staging/Kconfig           |    2 +
 drivers/staging/Makefile          |    1 +
 drivers/staging/wb528sd/Kconfig   |   16 ++
 drivers/staging/wb528sd/Makefile  |    1 +
 drivers/staging/wb528sd/wb528sd.c |  274 +++++++++++++++++++++++++++++++++++++
 5 files changed, 294 insertions(+), 0 deletions(-)
 create mode 100644 drivers/staging/wb528sd/Kconfig
 create mode 100644 drivers/staging/wb528sd/Makefile
 create mode 100644 drivers/staging/wb528sd/wb528sd.c
drivers/staging/Kconfig +2 -0
index 21e2f4b..c1ce429 100644
@@ -132,4 +132,6 @@ source "drivers/staging/omapdrm/Kconfig"
 
 source "drivers/staging/android/Kconfig"
 
+source "drivers/staging/wb528sd/Kconfig"
+
 endif # STAGING
drivers/staging/Makefile +1 -0
index 7c5808d..7da8c3b 100644
@@ -57,3 +57,4 @@ obj-$(CONFIG_INTEL_MEI)		+= mei/
 obj-$(CONFIG_MFD_NVEC)		+= nvec/
 obj-$(CONFIG_DRM_OMAP)		+= omapdrm/
 obj-$(CONFIG_ANDROID)		+= android/
+obj-$(CONFIG_WB528SD)		+= wb528sd/
drivers/staging/wb528sd/Kconfig new file +16 -0
new file mode 100644
index 0000000..b7af426
@@ -0,0 +1,16 @@
+config WB528SD
+	tristate "Winbond 528SD Secure Digital (SD) card reader"
+	depends on PCI
+	help
+	  The Winbond 528SD Secure Digital (SD) card reader connects to
+	  the PCI bus and can be found in laptop Clevo model D4J, product
+	  code D410J. It can be identified by its PCI ID 1050:8481
+	  (for example by using "lspci" and "lspci -n" commands).
+	  The driver currently only detects whether an SD card is
+	  mechanically inserted in the reader (dummy SD card is also
+	  detected). The information can be fetched in Clevo D410J
+	  with the command
+	  "cat /sys/devices/pci0000:00/0000:00:0e.0/card_present".
+
+	  Currently (Jan 2012) there is a lack of register description
+	  of this device.
drivers/staging/wb528sd/Makefile new file +1 -0
new file mode 100644
index 0000000..758026d
@@ -0,0 +1 @@
+obj-$(CONFIG_WB528SD) += wb528sd.o
drivers/staging/wb528sd/wb528sd.c new file +274 -0

274 lines not on this page · raw message

Signature · 1 line
1.7.2.5
#1 lore raw
Quoted 4 lines · Németh Márton

From: Márton Németh <[email protected]>

This driver version of Winbond WB528SD can detect mechanical card presence only. The information is provided through sysfs.

How is it provided through sysfs? Is this done in a standard way? If not, why not?

Why is this driver submitted to the staging tree? What is keeping it from going into the "real" portion of the kernel for other card readers?

We need a TODO file for what is needed to get it moved out of staging.

Oh, and it needs to do a bit more than just detect a card to be useful, right? How about read/write to it?

thanks,

greg k-h

#2 lore raw

Hi Greg,

thanks for your response and your questions, I think it will help my work very much.

Quoted 8 lines · Greg KH
Quoted 4 lines · Németh Márton

From: Márton Németh <[email protected]>

This driver version of Winbond WB528SD can detect mechanical card presence only. The information is provided through sysfs.

How is it provided through sysfs? Is this done in a standard way? If not, why not?

I used device_create_file()/device_remove_file() and DEVICE_ATTR(), in that sense it is standard. I'm not sure, however, that you a referring to this, rather referring to the standard way how other SD card readers provide the card presence information to the user space, right? To tell you the truth, I could not find an other PCI card driver which I can take as an example, I would need some help on this.

Quoted 2 lines

Why is this driver submitted to the staging tree? What is keeping it from going into the "real" portion of the kernel for other card readers?

Interrupt handling, read, write and connecting the driver upwards to the block subsystem, I guess.

Quoted 1 line

We need a TODO file for what is needed to get it moved out of staging.

I can create one, no problem.

Quoted 2 lines

Oh, and it needs to do a bit more than just detect a card to be useful, right? How about read/write to it?

Sure. My intention was to get feedback for my work as early as possible. I reached a state where a minimal level of functionality is available:
the mechanical SD card presence is available for userspace programs.

The read/write access will be a bit more difficult, I guess because I currently don't have access to the register programming reference of this device, I can use the trial-and-error method, for example.

Márton Németh

#3 lore raw
Quoted 12 lines · Németh Márton

Hi Greg,

thanks for your response and your questions, I think it will help my work very much.

Quoted 6 lines · Greg KH
Quoted 4 lines · Németh Márton

From: Márton Németh <[email protected]>

This driver version of Winbond WB528SD can detect mechanical card presence only. The information is provided through sysfs.

Quoted 7 lines
Quoted 2 lines

How is it provided through sysfs? Is this done in a standard way? If not, why not?

I used device_create_file()/device_remove_file() and DEVICE_ATTR(), in that sense it is standard. I'm not sure, however, that you a referring to this, rather referring to the standard way how other SD card readers provide the card presence information to the user space, right?

Yes, the latter is what matters.

Quoted 2 lines

To tell you the truth, I could not find an other PCI card driver which I can take as an example, I would need some help on this.

I don't think that any other device does this, as it properly hooks up the block device for the card inserted, which generates the needed userspace notifications.

So please don't create a non-standard way of determining if a card is present or not, you are creating a kernel/user API here that needs to be preserved if it gets into the kernel tree.

Quoted 8 lines
Quoted 2 lines

Why is this driver submitted to the staging tree? What is keeping it from going into the "real" portion of the kernel for other card readers?

Interrupt handling, read, write and connecting the driver upwards to the block subsystem, I guess.

Quoted 1 line

We need a TODO file for what is needed to get it moved out of staging.

Quoted 8 lines

I can create one, no problem.

Quoted 2 lines

Oh, and it needs to do a bit more than just detect a card to be useful, right? How about read/write to it?

Sure. My intention was to get feedback for my work as early as possible. I reached a state where a minimal level of functionality is available:
the mechanical SD card presence is available for userspace programs.

What could a userspace program do with this information?

Quoted 3 lines

The read/write access will be a bit more difficult, I guess because I currently don't have access to the register programming reference of this device, I can use the trial-and-error method, for example.

Yeah, doing this type of work is hard, and I understand your want to get it into the tree at this early stage. However, we really need something that actually works, otherwise people are going to be very confused when they see their device bound to this driver, yet nothing works.

So I think we need to wait until it can handle the block device handling logic first, before we can add it to the kernel tree, even in the staging directory.

Good luck with this effort, it is not easy at all.

greg k-h