mmc: USB SDIO/SD/MMC Host Controller (VUB300) driver
A message that is not in the archive (sent off-list or not yet received): 20B0EAA71DD7413A9A29D0493C6C1D87@AN00536
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): 27884BED0E3C489C8849EE12A803F536@AN00536
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/1 mmc: USB SDIO/SD/MMC Host Controller (VUB300) driver
Add a driver for Elan Digital System's VUB300 chip which is a USB connected SDIO/SDmem/MMC host controller. A VUB300 chip enables a USB 2.0 or USB 1.1 connected host computer to use SDIO/SD/MMC cards without the need for a directly connected, for example via PCI, SDIO host controller.
---
This is the first submission attempt.
There are 4 "do not initialise statics" errors reported by scripts/checkpatch.pl This driver has been tested on
a) 32bit x86
b) 64bit x86
c) dual processor
d) PowerPC
---
MAINTAINERS +7 -0
@@ -6369,6 +6369,13 @@ L: [email protected] S: Maintained F: drivers/hwmon/vt8231.c +VUB300 USB to SDIO/SD/MMC bridge chip +M: Tony Olech <[email protected]> +L: [email protected] +L: [email protected] +S: Supported +F: drivers/mmc/host/vub300.c + W1 DALLAS'S 1-WIRE BUS M: Evgeniy Polyakov <[email protected]> S: Maintained
drivers/mmc/host/Makefile +2 -0
@@ -36,6 +36,8 @@ obj-$(CONFIG_MMC_VIA_SDMMC) += via-sdmmc obj-$(CONFIG_SDH_BFIN) += bfin_sdh.o obj-$(CONFIG_MMC_SH_MMCIF) += sh_mmcif.o obj-$(CONFIG_MMC_JZ4740) += jz4740_mmc.o +obj-$(CONFIG_MMC_VUB300) += vub300.o + obj-$(CONFIG_MMC_SDHCI_PLTFM) += sdhci-platform.o sdhci-platform-y := sdhci-pltfm.o
drivers/mmc/host/Kconfig +32 -0
@@ -451,3 +451,35 @@ config MMC_JZ4740 SoCs. If you have a board based on such a SoC and with a SD/MMC slot, say Y or M here. + +config MMC_VUB300 + tristate "VUB300 USB to SDIO/SD/MMC Host Controller support" + depends on USB + help + This selects support for Elan Digital Systems' VUB300 chip. + + The VUB300 is a USB-SDIO Host Controller Interface chip + that enables the host computer to use SDIO/SD/MMC cards + via a USB 2.0 or USB 1.1 host. + + The VUB300 chip will be found in both physically separate + USB to SDIO/SD/MMC adapters and embedded on some motherboards. + + The VUB300 chip supports SD and MMC memory cards in addition + to single and multifunction SDIO cards. + + Some SDIO cards will need a firmware file to be loaded and + sent to VUB300 chip in order to achieve better data throughput. + Download these "Offload Pseudocode" from Elan Digital Systems' + web-site http://www.elandigitalsystems.com/support/downloads.php + and put them in /lib/firmware. Note that without these additional + firmware files the VUB300 chip will still function, but not at + the best obtainable data rate. + + To compile this mmc host controller driver as a module, + choose M here: the module will be called vub300. + + If you have a computer with an embedded VUB300 chip + or if you intend connecting a USB adapter based on a + VUB300 chip say Y or M here. +
drivers/mmc/host/vub300.c new file +2606 -0
2,606 lines not on this page · raw message
Hi David,
Any interest in reviewing this USB-SD driver? I'm especially curious about whether you think there are worthwhile possibilities to share code with USHC.
Thanks!
- Chris.
From: Tony Olech <[email protected]>
Subject: mmc: USB SDIO/SD/MMC Host Controller (VUB300) driver
Add a driver for Elan Digital System's VUB300 chip which is a USB connected SDIO/SDmem/MMC host controller. A VUB300 chip enables a USB 2.0 or USB 1.1 connected host computer to use SDIO/SD/MMC cards without the need for a directly connected, for example via PCI, SDIO host controller.
---
This is the first submission attempt.
There are 4 "do not initialise statics" errors reported by scripts/checkpatch.pl This driver has been tested on
a) 32bit x86
b) 64bit x86
c) dual processor
d) PowerPC
---
MAINTAINERS +7 -0
@@ -6369,6 +6369,13 @@ L: [email protected] S: Maintained F: drivers/hwmon/vt8231.c +VUB300 USB to SDIO/SD/MMC bridge chip +M: Tony Olech <[email protected]> +L: [email protected] +L: [email protected] +S: Supported +F: drivers/mmc/host/vub300.c + W1 DALLAS'S 1-WIRE BUS M: Evgeniy Polyakov <[email protected]> S: Maintained
drivers/mmc/host/Makefile +2 -0
@@ -36,6 +36,8 @@ obj-$(CONFIG_MMC_VIA_SDMMC) += via-sdmmc obj-$(CONFIG_SDH_BFIN) += bfin_sdh.o obj-$(CONFIG_MMC_SH_MMCIF) += sh_mmcif.o obj-$(CONFIG_MMC_JZ4740) += jz4740_mmc.o +obj-$(CONFIG_MMC_VUB300) += vub300.o + obj-$(CONFIG_MMC_SDHCI_PLTFM) += sdhci-platform.o sdhci-platform-y := sdhci-pltfm.o
drivers/mmc/host/Kconfig +32 -0
@@ -451,3 +451,35 @@ config MMC_JZ4740 SoCs. If you have a board based on such a SoC and with a SD/MMC slot, say Y or M here. + +config MMC_VUB300 + tristate "VUB300 USB to SDIO/SD/MMC Host Controller support" + depends on USB + help + This selects support for Elan Digital Systems' VUB300 chip. + + The VUB300 is a USB-SDIO Host Controller Interface chip + that enables the host computer to use SDIO/SD/MMC cards + via a USB 2.0 or USB 1.1 host. + + The VUB300 chip will be found in both physically separate + USB to SDIO/SD/MMC adapters and embedded on some motherboards. + + The VUB300 chip supports SD and MMC memory cards in addition + to single and multifunction SDIO cards. + + Some SDIO cards will need a firmware file to be loaded and + sent to VUB300 chip in order to achieve better data throughput. + Download these "Offload Pseudocode" from Elan Digital Systems' + web-site http://www.elandigitalsystems.com/support/downloads.php + and put them in /lib/firmware. Note that without these additional + firmware files the VUB300 chip will still function, but not at + the best obtainable data rate. + + To compile this mmc host controller driver as a module, + choose M here: the module will be called vub300. + + If you have a computer with an embedded VUB300 chip + or if you intend connecting a USB adapter based on a + VUB300 chip say Y or M here. +
drivers/mmc/host/vub300.c new file +2606 -0
2,606 lines not on this page · raw message
Signature · 2 lines
Chris Ball <[email protected]> <http://printf.net/> One Laptop Per Child
Quoted 5 lines · Chris Ball
Hi David,
Any interest in reviewing this USB-SD driver? I'm especially curious about whether you think there are worthwhile possibilities to share code with USHC.
A quick look suggests that there is unlikely to be any commonality between the two drivers.
Tony, where can I find the datasheet or developer's manual describing the protocol/operation of this chip?
David
Signature · 6 lines
David Vrabel, Senior Software Engineer, Drivers CSR, Churchill House, Cambridge Business Park, Tel: +44 (0)1223 692562 Cowley Road, Cambridge, CB4 0WZ http://www.csr.com/ Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
Hi Tony,
Quoted 9 lines · David Vrabel
Quoted 3 lines
Any interest in reviewing this USB-SD driver? I'm especially curious about whether you think there are worthwhile possibilities to share code with USHC.
A quick look suggests that there is unlikely to be any commonality between the two drivers.
Tony, where can I find the datasheet or developer's manual describing the protocol/operation of this chip?
Ping -- any answer for David here? Thanks,
Signature · 2 lines
Chris Ball <[email protected]> <http://printf.net/> One Laptop Per Child
Quoted 6 lines · David Vrabel
Quoted 5 lines · Chris Ball
Hi David,
Any interest in reviewing this USB-SD driver? I'm especially curious about whether you think there are worthwhile possibilities to share code with USHC.
Quoted 7 lines
A quick look suggests that there is unlikely to be any commonality between the two drivers.
Tony, where can I find the datasheet or developer's manual describing the protocol/operation of this chip?
David
Hi,
I finally persuaded my boss that our interface document should put released. It is the PDF in http://www.elandigitalsystems.com/eng/drivers/vub300/Linux-v2-10.zip
and it describes the protocol between the customized SMSC chip and the host PC. And I agree that there will be virtually nothing in common with the USHC driver. Tony Olech
Elan Digital Systems Limited
Hi David,
Quoted 9 lines · Tony Olech
Quoted 8 lines
Quoted 3 lines
Any interest in reviewing this USB-SD driver? I'm especially curious about whether you think there are worthwhile possibilities to share code with USHC.
A quick look suggests that there is unlikely to be any commonality between the two drivers.
Tony, where can I find the datasheet or developer's manual describing the protocol/operation of this chip?
Quoted 7 lines
I finally persuaded my boss that our interface document should put released. It is the PDF in
http://www.elandigitalsystems.com/eng/drivers/vub300/Linux-v2-10.zip
and it describes the protocol between the customized SMSC chip and the host PC.
And I agree that there will be virtually nothing in common with the USHC driver.
Might you be able to find time to review this soon?
Thanks very much,
Signature · 2 lines
Chris Ball <[email protected]> <http://printf.net/> One Laptop Per Child
Quoted 19 lines · Chris Ball
Hi David,
Quoted 8 lines · Tony Olech
Quoted 8 lines
Quoted 3 lines
Any interest in reviewing this USB-SD driver? I'm especially curious about whether you think there are worthwhile possibilities to share code with USHC.
A quick look suggests that there is unlikely to be any commonality between the two drivers.
Tony, where can I find the datasheet or developer's manual describing the protocol/operation of this chip?
Quoted 7 lines
I finally persuaded my boss that our interface document should put released. It is the PDF in
http://www.elandigitalsystems.com/eng/drivers/vub300/Linux-v2-10.zip
and it describes the protocol between the customized SMSC chip and the host PC.
And I agree that there will be virtually nothing in common with the USHC driver.
Quoted 1 line
Might you be able to find time to review this soon?
There is no useful commonality between this driver and the USHC driver.
I don't have time to do a detailed code review but I have gone through
and highlighted some potential issues (see other email).
David
Signature · 6 lines
David Vrabel, Senior Software Engineer, Drivers CSR, Churchill House, Cambridge Business Park, Tel: +44 (0)1223 692562 Cowley Road, Cambridge, CB4 0WZ http://www.csr.com/ Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
I've not given this driver a detailed review, just skimmed it and noticed a few things.
drivers/mmc/host/Kconfig config MMC_JZ4740 · line 477
Quoted 9 lines · Tony Olech
drivers/mmc/host/Kconfig +8
-0+ + Some SDIO cards will need a firmware file to be loaded and + sent to VUB300 chip in order to achieve better data throughput. + Download these "Offload Pseudocode" from Elan Digital Systems' + web-site http://www.elandigitalsystems.com/support/downloads.php + and put them in /lib/firmware. Note that without these additional + firmware files the VUB300 chip will still function, but not at + the best obtainable data rate.
It would be useful to document (in the driver) what this "offload pseudocode" does. Looking at the driver it looks like it's pre-fetching SDIO register values, yes?
Quoted 1 line
+#pragma pack(1)
You probably want __attribute__((packed)) on each structure here. (Not sure if GCC even supports this #pragma).
drivers/mmc/host/vub300.c line 392
Quoted 5 lines
drivers/mmc/host/vub300.c new file +5
-0+static DEVICE_ATTR(OperatingMode, S_IRUGO, show_OperatingMode, NULL); +static struct attribute *vub300_attrs[] = { + &dev_attr_OperatingMode.attr, +NULL , +};
Suggest removing this unless it's actually useful. If it is useful, it should use all lower case for the name and it should be documented in Documentation/ABI.
drivers/mmc/host/vub300.c line 924
Quoted 2 lines
drivers/mmc/host/vub300.c new file +2
-0+static void snoop_block_size_and_bus_width (struct vub300_mmc_host *vub300, +u32 cmd_arg)
This doesn't seem necessary. The block size is available in the data request and the bus width is supplied to the set_ios() call.
drivers/mmc/host/vub300.c line 972
Quoted 3 lines
drivers/mmc/host/vub300.c new file +3
-0+if (6 == cmd->opcode) { + ResponseType =SDRT_1 ; + vub300->resp_len =6 ;
You don't need to check the opcode to determine the response format. See cmd->flags.
drivers/mmc/host/vub300.c line 2151
Quoted 12 lines
drivers/mmc/host/vub300.c new file +12
-0+ +static void vub300_enable_sdio_irq (struct mmc_host *mmc,int enable) +{/* NOT irq */ +struct vub300_mmc_host *vub300 =mmc_priv (mmc); +if (!vub300->interface) +return ; +kref_get (&vub300->kref); +if (enable) { +mutex_lock (&vub300->irq_mutex); +if (vub300->irqs_queued) { + vub300->irqs_queued -=1 ; +mmc_signal_sdio_irq (vub300->mmc);
This might signal a spurious interrupt as it's not checking if the interrupt is still asserted. This should be avoided.
David
Signature · 6 lines
David Vrabel, Senior Software Engineer, Drivers CSR, Churchill House, Cambridge Business Park, Tel: +44 (0)1223 692562 Cowley Road, Cambridge, CB4 0WZ http://www.csr.com/ Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
Hi,
the answers to your questions and comments are embedded below. Because a few changes in the patch are required and also because the current kernel version is now 2.6.27 I am re-doing the patch and it will be included in a second e-mail by itself.
Tony Olech
Elan Digital Systems Limited
Quoted 13 lines · David Vrabel
I've not given this driver a detailed review, just skimmed it and noticed a few things.
drivers/mmc/host/Kconfig config MMC_JZ4740 · line 477
Quoted 7 lines · Tony Olech
drivers/mmc/host/Kconfig +7
-0+ Some SDIO cards will need a firmware file to be loaded and + sent to VUB300 chip in order to achieve better data throughput. + Download these "Offload Pseudocode" from Elan Digital Systems' + web-site http://www.elandigitalsystems.com/support/downloads.php + and put them in /lib/firmware. Note that without these additional + firmware files the VUB300 chip will still function, but not at + the best obtainable data rate.It would be useful to document (in the driver) what this "offload pseudocode" does. Looking at the driver it looks like it's pre-fetching SDIO register values, yes?
Yes it does does pre-fetch and pre-set some register values. At this point in time the only available documentation is the interface document referred to in a previous e-mail which can be downloaded from:
www.elandigitalsystems.com/eng/drivers/vub300/Linux-v2-10.zip
Quoted 3 lines
Quoted 1 line
+#pragma pack(1)
You probably want __attribute__((packed)) on each structure here. (Not sure if GCC even supports this #pragma).
Thank you for this comment. I have changed the patch accordingly.
Quoted 8 lines
drivers/mmc/host/vub300.c line 392
Quoted 5 lines
drivers/mmc/host/vub300.c new file +5
-0+static DEVICE_ATTR(OperatingMode, S_IRUGO, show_OperatingMode, NULL); +static struct attribute *vub300_attrs[] = { + &dev_attr_OperatingMode.attr, +NULL , +};Suggest removing this unless it's actually useful. If it is useful, it should use all lower case for the name and it should be documented in
Documentation/ABI.
This sysfs interface is a very useful read-only diagnostic and will enable us to support customers. In particular it identifies the SDIO bus speed actually being used as well as the identity of the offload pseudocode firmware file, if any, that has been downloaded into the VUB300 adapter. I have modified the patch to use lower case for the sysfs file name (even though other sysfs users use camel case) and have added documentation as requested.vub300->irqs_queued
Quoted 4 lines
drivers/mmc/host/vub300.c line 924
Quoted 2 lines
drivers/mmc/host/vub300.c new file +2
-0+static void snoop_block_size_and_bus_width (struct vub300_mmc_host *vub300, +u32 cmd_arg)This doesn't seem necessary. The block size is available in the
datavub300->irqs_queuedrequest and the bus width is supplied to theset_ios()call.
Unfortunately you are incorrect in your assertion. The "block size" given in the data request is NOT ALWAYS equal to the function block size. Therefore the snooping of the function block size must remain.
Quoted 5 lines
drivers/mmc/host/vub300.c line 972
Quoted 3 lines
drivers/mmc/host/vub300.c new file +3
-0+if (6 == cmd->opcode) { + ResponseType =SDRT_1 ; + vub300->resp_len =6 ;You don't need to check the opcode to determine the response format.
Seevub300->irqs_queuedcmd->flags.
Unfortunately you are incorrect in your assertion. It is impossible, for example, from a flag setting of 0x15 to determine whether a response type of R5, R6 or R7 is to be expected. Therefore the snooping of the opcode must remain.
Quoted 5 lines
Quoted 5 lines
drivers/mmc/host/vub300.c new file +5
-0+static void vub300_enable_sdio_irq (struct mmc_host *mmc,int enable) +{/* NOT irq */ + struct vub300_mmc_host *vub300 = mmc_priv(mmc);vub300->irqs_queued +if (!vub300->interface) +return ;
Quoted 8 lines
drivers/mmc/host/vub300.c line 2151
Quoted 6 lines
drivers/mmc/host/vub300.c new file +6
-0+kref_get (&vub300->kref); + if (enable) {vub300->irqs_queued +mutex_lock (&vub300->irq_mutex); +if (vub300->irqs_queued) { + vub300->irqs_queued -=1 ; +mmc_signal_sdio_irq (vub300->mmc);This might signal a spurious interrupt as it's not checking if the interrupt is still asserted. This should be avoided.
You are correct in your implied assertion that spurious interrupts cause havoc and ultimately failure in the operation of the device. However this code segment is absolutely required for the correct operation of our offload processing. The key thing to note is that the variable vub300->irqs_queued prevents spurious interrupts.
Quoted 1 line
David
Hi,
the answers to your questions and comments are embedded below. Because a few changes in the patch are required and also because the current kernel version is now 2.6.27 I am re-doing the patch and it will be included in a second e-mail by itself.
Tony Olech
Elan Digital Systems Limited
Quoted 13 lines · David Vrabel
I've not given this driver a detailed review, just skimmed it and noticed a few things.
drivers/mmc/host/Kconfig config MMC_JZ4740 · line 477
Quoted 7 lines · Tony Olech
drivers/mmc/host/Kconfig +7
-0+ Some SDIO cards will need a firmware file to be loaded and + sent to VUB300 chip in order to achieve better data throughput. + Download these "Offload Pseudocode" from Elan Digital Systems' + web-site http://www.elandigitalsystems.com/support/downloads.php + and put them in /lib/firmware. Note that without these additional + firmware files the VUB300 chip will still function, but not at + the best obtainable data rate.It would be useful to document (in the driver) what this "offload pseudocode" does. Looking at the driver it looks like it's pre-fetching SDIO register values, yes?
Yes it does does pre-fetch and pre-set some register values. At this point in time the only available documentation is the interface document referred to in a previous e-mail which can be downloaded from:
www.elandigitalsystems.com/eng/drivers/vub300/Linux-v2-10.zip
Quoted 3 lines
Quoted 1 line
+#pragma pack(1)
You probably want __attribute__((packed)) on each structure here. (Not sure if GCC even supports this #pragma).
Thank you for this comment. I have changed the patch accordingly.
Quoted 8 lines
drivers/mmc/host/vub300.c line 392
Quoted 5 lines
drivers/mmc/host/vub300.c new file +5
-0+static DEVICE_ATTR(OperatingMode, S_IRUGO, show_OperatingMode, NULL); +static struct attribute *vub300_attrs[] = { + &dev_attr_OperatingMode.attr, +NULL , +};Suggest removing this unless it's actually useful. If it is useful, it should use all lower case for the name and it should be documented in
Documentation/ABI.
This sysfs interface is a very useful read-only diagnostic and will enable us to support customers. In particular it identifies the SDIO bus speed actually being used as well as the identity of the offload pseudocode firmware file, if any, that has been downloaded into the VUB300 adapter. I have modified the patch to use lower case for the sysfs file name (even though other sysfs users use camel case) and have added documentation as requested.vub300->irqs_queued
Quoted 4 lines
drivers/mmc/host/vub300.c line 924
Quoted 2 lines
drivers/mmc/host/vub300.c new file +2
-0+static void snoop_block_size_and_bus_width (struct vub300_mmc_host *vub300, +u32 cmd_arg)This doesn't seem necessary. The block size is available in the
datavub300->irqs_queuedrequest and the bus width is supplied to theset_ios()call.
Unfortunately you are incorrect in your assertion. The "block size" given in the data request is NOT ALWAYS equal to the function block size. Therefore the snooping of the function block size must remain.
Quoted 5 lines
drivers/mmc/host/vub300.c line 972
Quoted 3 lines
drivers/mmc/host/vub300.c new file +3
-0+if (6 == cmd->opcode) { + ResponseType =SDRT_1 ; + vub300->resp_len =6 ;You don't need to check the opcode to determine the response format.
Seevub300->irqs_queuedcmd->flags.
Unfortunately you are incorrect in your assertion. It is impossible, for example, from a flag setting of 0x15 to determine whether a response type of R5, R6 or R7 is to be expected. Therefore the snooping of the opcode must remain.
Quoted 5 lines
Quoted 5 lines
drivers/mmc/host/vub300.c new file +5
-0+static void vub300_enable_sdio_irq (struct mmc_host *mmc,int enable) +{/* NOT irq */ + struct vub300_mmc_host *vub300 = mmc_priv(mmc);vub300->irqs_queued +if (!vub300->interface) +return ;
Quoted 8 lines
drivers/mmc/host/vub300.c line 2151
Quoted 6 lines
drivers/mmc/host/vub300.c new file +6
-0+kref_get (&vub300->kref); + if (enable) {vub300->irqs_queued +mutex_lock (&vub300->irq_mutex); +if (vub300->irqs_queued) { + vub300->irqs_queued -=1 ; +mmc_signal_sdio_irq (vub300->mmc);This might signal a spurious interrupt as it's not checking if the interrupt is still asserted. This should be avoided.
You are correct in your implied assertion that spurious interrupts cause havoc and ultimately failure in the operation of the device. However this code segment is absolutely required for the correct operation of our offload processing. The key thing to note is that the variable vub300->irqs_queued prevents spurious interrupts.
Quoted 1 line
David
PATCH 1/1 mmc: USB SDIO/SD/MMC Host Controller (VUB300) driver Resubmission
In reply to Tony OlechAdd a driver for Elan Digital System's VUB300 chip which is a USB connected SDIO/SDmem/MMC host controller. A VUB300 chip enables a USB 2.0 or USB 1.1 connected host computer to use SDIO/SD/MMC cards without the need for a directly connected, for example via PCI, SDIO host controller.
---
This is the second submission attempt.
There are 5 "do not initialise statics" errors reported by scripts/checkpatch.pl This driver has been tested on
a) 32bit x86
b) 64bit x86
c) dual processor
d) PowerPC
---
drivers/mmc/host/Makefile +1 -0
@@ -33,6 +33,7 @@ obj-$(CONFIG_MMC_VIA_SDMMC) += via-sdmmc obj-$(CONFIG_SDH_BFIN) += bfin_sdh.o obj-$(CONFIG_MMC_SH_MMCIF) += sh_mmcif.o obj-$(CONFIG_MMC_JZ4740) += jz4740_mmc.o +obj-$(CONFIG_MMC_VUB300) += vub300.o obj-$(CONFIG_MMC_USHC) += ushc.o obj-$(CONFIG_MMC_SDHCI_PLTFM) += sdhci-platform.o
drivers/mmc/host/Kconfig +31 -0
@@ -475,6 +475,37 @@ config MMC_JZ4740 If you have a board based on such a SoC and with a SD/MMC slot, say Y or M here. +config MMC_VUB300 + tristate "VUB300 USB to SDIO/SD/MMC Host Controller support" + depends on USB + help + This selects support for Elan Digital Systems' VUB300 chip. + + The VUB300 is a USB-SDIO Host Controller Interface chip + that enables the host computer to use SDIO/SD/MMC cards + via a USB 2.0 or USB 1.1 host. + + The VUB300 chip will be found in both physically separate + USB to SDIO/SD/MMC adapters and embedded on some motherboards. + + The VUB300 chip supports SD and MMC memory cards in addition + to single and multifunction SDIO cards. + + Some SDIO cards will need a firmware file to be loaded and + sent to VUB300 chip in order to achieve better data throughput. + Download these "Offload Pseudocode" from Elan Digital Systems' + web-site http://www.elandigitalsystems.com/support/downloads.php + and put them in /lib/firmware. Note that without these additional + firmware files the VUB300 chip will still function, but not at + the best obtainable data rate. + + To compile this mmc host controller driver as a module, + choose M here: the module will be called vub300. + + If you have a computer with an embedded VUB300 chip + or if you intend connecting a USB adapter based on a + VUB300 chip say Y or M here. + config MMC_USHC tristate "USB SD Host Controller (USHC) support" depends on USB
Documentation/ABI/stable/vub300 new file +11 -0
@@ -0,0 +1,11 @@ + +What: /sys/class/mmc_host/mmc<N>/operating_mode +Date: January 2011 +KernelVersion: 2.6.38 +Contact: Tony Olech <[email protected]> +Description: A read only diagnostic showing the state of the + vub300 sdio/mmc host controller driver, in particular + it shows which offload processing firmware file, + if any, is being used. +Users: - +
drivers/mmc/host/vub300.c new file +2616 -0
2,616 lines not on this page · raw message
Re: [PATCH] mmc: USB SDIO/SD/MMC Host Controller (VUB300) driver Resubmission
Quoted 11 lines · Tony Olech
Add a driver for Elan Digital System's VUB300 chip which is a USB connected SDIO/SDmem/MMC host controller. A VUB300 chip enables a USB 2.0 or USB 1.1 connected host computer to use SDIO/SD/MMC cards without the need for a directly connected, for example via PCI, SDIO host controller.
Signed-off-by Anthony F Olech <[email protected]>---
This is the second submission attempt.
There are 5 "do not initialise statics" errors reported byscripts/checkpatch.pl
you probably should fix those. They are due to lines such as:
static int pad_input_to_usb_pkt = 0;
static int disable_offload_processing = 0;
static int force_1_bit_data_xfers = 0;
static int force_polling_for_irqs = 0;
Since those are global variables, you may omit to initialize them to 0 which would then allocate them to the .bss section which is not included in the compiled binary, and automatically cleared to zero at run time.
Nicolas
Re: [PATCH] mmc: USB SDIO/SD/MMC Host Controller (VUB300) driver Resubmission
Quoted 14 lines · Nicolas Pitre
Quoted 11 lines · Tony Olech
Add a driver for Elan Digital System's VUB300 chip which is a USB connected SDIO/SDmem/MMC host controller. A VUB300 chip enables a USB 2.0 or USB 1.1 connected host computer to use SDIO/SD/MMC cards without the need for a directly connected, for example via PCI, SDIO host controller.
Signed-off-by Anthony F Olech <[email protected]>---
This is the second submission attempt.
There are 5 "do not initialise statics" errors reported byscripts/checkpatch.pl
Quoted 6 lines
you probably should fix those. They are due to lines such as:
static int
pad_input_to_usb_pkt= 0; static intdisable_offload_processing= 0; static intforce_1_bit_data_xfers= 0; static intforce_polling_for_irqs= 0;
Should those be static anyhow? Being USB, you could probably hook up two of those and want to operate one of them in this and the other one in another mode?
Signature · 2 lines
Pengutronix e.K. | Wolfram Sang | Industrial Linux Solutions | http://www.pengutronix.de/ |
Re: [PATCH] mmc: USB SDIO/SD/MMC Host Controller (VUB300) driver Resubmission
Quoted 17 lines · Wolfram Sang
Quoted 16 lines · Nicolas Pitre
Quoted 11 lines · Tony Olech
Add a driver for Elan Digital System's VUB300 chip which is a USB connected SDIO/SDmem/MMC host controller. A VUB300 chip enables a USB 2.0 or USB 1.1 connected host computer to use SDIO/SD/MMC cards without the need for a directly connected, for example via PCI, SDIO host controller.
Signed-off-by Anthony F Olech <[email protected]>---
This is the second submission attempt.
There are 5 "do not initialise statics" errors reported byscripts/checkpatch.plyou probably should fix those. They are due to lines such as:
Quoted 8 lines
Quoted 4 lines
static int
pad_input_to_usb_pkt= 0; static intdisable_offload_processing= 0; static intforce_1_bit_data_xfers= 0; static intforce_polling_for_irqs= 0;Should those be static anyhow? Being USB, you could probably hook up two of those and want to operate one of them in this and the other one in another mode?
You could. Whether or not you would is another question. Until then I don't think it is worth bothering with such corner cases for the initial merging of this driver.
Nicolas
Re: [PATCH] mmc: USB SDIO/SD/MMC Host Controller (VUB300) driver Resubmission
Quoted 24 lines · Nicolas Pitre
Quoted 22 lines · Wolfram Sang
Quoted 20 lines · Nicolas Pitre
Quoted 11 lines · Tony Olech
Add a driver for Elan Digital System's VUB300 chip which is a USB connected SDIO/SDmem/MMC host controller. A VUB300 chip enables a USB 2.0 or USB 1.1 connected host computer to use SDIO/SD/MMC cards without the need for a directly connected, for example via PCI, SDIO host controller.
Signed-off-by Anthony F Olech <[email protected]>---
This is the second submission attempt.
There are 5 "do not initialise statics" errors reported byscripts/checkpatch.plyou probably should fix those. They are due to lines such as:
static int
pad_input_to_usb_pkt= 0; static intdisable_offload_processing= 0; static intforce_1_bit_data_xfers= 0; static intforce_polling_for_irqs= 0;
Quoted 7 lines
Quoted 3 lines
Should those be static anyhow? Being USB, you could probably hook up two of those and want to operate one of them in this and the other one in another mode?
You could. Whether or not you would is another question. Until then I don't think it is worth bothering with such corner cases for the initial merging of this driver.
A static variable which should be per-device is a corner-case? Frankly, I'd think it is a flaw. Unless, of course, these module_params are only rarely used. Which would lead to the question if they are really needed. There are quite a lot.
Also, I am not convinced of the need of a custom sysfs-file. Seeing its use cases might help to identify a need which is probably better solved generically.
Kind regards,
Wolfram
Signature · 2 lines
Pengutronix e.K. | Wolfram Sang | Industrial Linux Solutions | http://www.pengutronix.de/ |
Re: [PATCH] mmc: USB SDIO/SD/MMC Host Controller (VUB300) driver Resubmission
Quoted 29 lines · Wolfram Sang
Quoted 28 lines · Nicolas Pitre
Quoted 25 lines · Wolfram Sang
Quoted 14 lines · Nicolas Pitre
Quoted 11 lines · Tony Olech
Add a driver for Elan Digital System's VUB300 chip which is a USB connected SDIO/SDmem/MMC host controller. A VUB300 chip enables a USB 2.0 or USB 1.1 connected host computer to use SDIO/SD/MMC cards without the need for a directly connected, for example via PCI, SDIO host controller.
Signed-off-by Anthony F Olech <[email protected]>---
This is the second submission attempt.
There are 5 "do not initialise statics" errors reported byscripts/checkpatch.plQuoted 6 lines
you probably should fix those. They are due to lines such as:
static int
pad_input_to_usb_pkt= 0; static intdisable_offload_processing= 0; static intforce_1_bit_data_xfers= 0; static intforce_polling_for_irqs= 0;Should those be static anyhow? Being USB, you could probably hook up two of those and want to operate one of them in this and the other one in another mode?
Quoted 8 lines
Quoted 3 lines
You could. Whether or not you would is another question. Until then I don't think it is worth bothering with such corner cases for the initial merging of this driver.
A static variable which should be per-device is a corner-case? Frankly, I'd think it is a flaw. Unless, of course, these
module_paramsare only rarely used. Which would lead to the question if they are really needed. There are quite a lot.
Given their name, I'd say they are there only for debugging purposes. So yes, they probably are rarely used, which doesn't mean they're useless. Same thing goes for maxfreq and nodma in mvsdio.c for example.
Quoted 3 lines
Also, I am not convinced of the need of a custom sysfs-file. Seeing its use cases might help to identify a need which is probably better solved generically.
I'm sure the author of this driver would be eager to hear from you with a concrete suggestion.
Nicolas
Re: [PATCH] mmc: USB SDIO/SD/MMC Host Controller (VUB300) driver Resubmission
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Quoted 4 lines
Should those be static anyhow? Being USB, you could probably hook up two of those and want to operate one of them in this and the other one in another mode?
You could. Whether or not you would is another question. Until then I don't think it is worth bothering with such corner cases for the initial merging of this driver.
Quoted 8 lines
Quoted 4 lines
A static variable which should be per-device is a corner-case? Frankly, I'd think it is a flaw. Unless, of course, these
module_paramsare only rarely used. Which would lead to the question if they are really needed. There are quite a lot.Given their name, I'd say they are there only for debugging purposes. So yes, they probably are rarely used, which doesn't mean they're useless. Same thing goes for maxfreq and nodma in
mvsdio.cfor example.
OK, I still wonder if all eight of these debugging-aids really need exposure to all users. There is no documentation how and when to use them. But well...
About the "static" thing: Yes, there are already drivers having one or more quirk parameters. That probably justifies it (personal taste aside).
Quoted 7 lines
Quoted 4 lines
Also, I am not convinced of the need of a custom sysfs-file. Seeing its use cases might help to identify a need which is probably better solved generically.
I'm sure the author of this driver would be eager to hear from you with a concrete suggestion.
? This is exactly why I asked for a use case? To see if something should be exposed from the core and not the driver?
Regards,
Wolfram
Signature · 2 lines
Pengutronix e.K. | Wolfram Sang | Industrial Linux Solutions | http://www.pengutronix.de/ |
Re: [PATCH] mmc: USB SDIO/SD/MMC Host Controller (VUB300) driver Resubmission
In reply to Nicolas PitreQuoted 23 lines · Nicolas Pitre
Quoted 22 lines · Wolfram Sang
Quoted 21 lines · Nicolas Pitre
Quoted 9 lines · Wolfram Sang
Quoted 8 lines · Nicolas Pitre
Quoted 7 lines · Tony Olech
Add a driver for Elan Digital System's VUB300 chip
which is a USB connected SDIO/SDmem/MMC host controller.
A VUB300 chip enables a USB 2.0 or USB 1.1 connected host
computer to use SDIO/SD/MMC cards without the need for
a directly connected, for example via PCI, SDIO host
controller.
There are 5 "do not initialise statics" errors reported byscripts/checkpatch.plQuoted 8 lines
Quoted 5 lines
you probably should fix those. They are due to lines such as:
static intpad_input_to_usb_pkt= 0;
static intdisable_offload_processing= 0;
static intforce_1_bit_data_xfers= 0;
static intforce_polling_for_irqs= 0;Should those be static anyhow? Being USB, you could probably hook up two of those and want to operate one of them in this and the other one in another mode?
You could. Whether or not you would is another question. Until then I don't think it is worth bothering with such corner cases for the initial merging of this driver.
Quoted 7 lines
Quoted 4 lines
A static variable which should be per-device is a corner-case? Frankly, I'd think it is a flaw. Unless, of course, these
module_paramsare only rarely used. Which would lead to the question if they are really needed. There are quite a lot.Given their name, I'd say they are there only for debugging purposes. So yes, they probably are rarely used, which doesn't mean they're useless. Same thing goes for maxfreq and nodma in
mvsdio.cfor example.
Basically the are diagnostic, but their use might enable a non-functioning device to actually work.
Quoted 3 lines
I'm sure the author of this driver would be eager to hear from you with a concrete suggestion.
Nicolas
YES
Tony olech
Re: [PATCH] mmc: USB SDIO/SD/MMC Host Controller (VUB300) driver Resubmission
In reply to Wolfram SangQuoted 16 lines · Wolfram Sang
Quoted 15 lines · Nicolas Pitre
Quoted 14 lines · Wolfram Sang
Quoted 13 lines · Nicolas Pitre
Quoted 7 lines · Tony Olech
Add a driver for Elan Digital System's VUB300 chip
which is a USB connected SDIO/SDmem/MMC host controller.
A VUB300 chip enables a USB 2.0 or USB 1.1 connected host
computer to use SDIO/SD/MMC cards without the need for
a directly connected, for example via PCI, SDIO host
controller.t.
There are 5 "do not initialise statics" errors reported byscripts/checkpatch.plyou probably should fix those. They are due to lines such as:
static intpad_input_to_usb_pkt= 0;
static intdisable_offload_processing= 0;
static intforce_1_bit_data_xfers= 0;
static intforce_polling_for_irqs= 0;
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Should those be static anyhow? Being USB, you could probably hook up two of those and want to operate one of them in this and the other one in another mode?
You could. Whether or not you would is another question. Until then I don't think it is worth bothering with such corner cases
Kind regards,
Wolfram
The intended use of the read-only sysfs file is to enable first-line support staff to determine quickly what actual firmware file is being used.
Tony Olech
Re: [PATCH] mmc: USB SDIO/SD/MMC Host Controller (VUB300) driver Resubmission
Quoted 4 lines
The intended use of the read-only sysfs file is to enable first-line support staff to determine quickly what actual firmware file is being used.
You have that in the driver (and similar ones):
+ dev_info(&vub300->udev->dev, "requesting offload firmware %s\n",
+ vub300->vub_name);
Won't checking the logs do?
Regards,
Wolfram
Signature · 2 lines
Pengutronix e.K. | Wolfram Sang | Industrial Linux Solutions | http://www.pengutronix.de/ |
Re: [PATCH] mmc: USB SDIO/SD/MMC Host Controller (VUB300) driver Resubmission
Quoted 8 lines · Wolfram Sang
Quoted 3 lines
The intended use of the read-only sysfs file is to enable first-line support staff to determine quickly what actual firmware file is being used.
You have that in the driver (and similar ones):
(quoted diff) +2
-0+ dev_info(&vub300->udev->dev, "requesting offload firmware %s\n", + vub300->vub_name);Won't checking the logs do?
Wolfram
Nearly, but there is one crucial difference, the logs are historic and the sysfs is current.
Tony Olech
Re: [PATCH] mmc: USB SDIO/SD/MMC Host Controller (VUB300) driver Resubmission
Quoted 4 lines · Tony Olech
Quoted 3 lines · Wolfram Sang
Quoted 3 lines
The intended use of the read-only sysfs file is to enable first-line support staff to determine quickly what actual firmware file is being used.
Quoted 8 lines
Quoted 5 lines
You have that in the driver (and similar ones):
(quoted diff) +2
-0+ dev_info(&vub300->udev->dev, "requesting offload firmware %s\n", + vub300->vub_name);Won't checking the logs do?
WolframNearly, but there is one crucial difference, the logs are historic and the sysfs is current.
I personally have no problem with your exporting the firmware name through sysfs for human consumption only and that no user space tools rely on this.
Nicolas
Re: [PATCH] mmc: USB SDIO/SD/MMC Host Controller (VUB300) driver Resubmission
In reply to Nicolas PitreQuoted 15 lines · Nicolas Pitre
Quoted 14 lines · Wolfram Sang
Quoted 13 lines · Nicolas Pitre
Quoted 7 lines · Tony Olech
Add a driver for Elan Digital System's VUB300 chip
which is a USB connected SDIO/SDmem/MMC host controller.
A VUB300 chip enables a USB 2.0 or USB 1.1 connected host
computer to use SDIO/SD/MMC cards without the need for
a directly connected, for example via PCI, SDIO host
controller.
There are 5 "do not initialise statics" errors reported byscripts/checkpatch.plyou probably should fix those. They are due to lines such as:
static intpad_input_to_usb_pkt= 0;
static intdisable_offload_processing= 0;
static intforce_1_bit_data_xfers= 0;
static intforce_polling_for_irqs= 0;
Quoted 7 lines
Quoted 3 lines
Should those be static anyhow? Being USB, you could probably hook up two of those and want to operate one of them in this and the other one in another mode?
You could. Whether or not you would is another question. Until then I don't think it is worth bothering with such corner cases for the initial merging of this driver.
Nicolas
Some of the module parameters are indeed per device, but how could that be implemented?
Tony Olech
Re: [PATCH] mmc: USB SDIO/SD/MMC Host Controller (VUB300) driver Resubmission
In reply to Nicolas PitreQuoted 10 lines · Nicolas Pitre
Quoted 1 line · Tony Olech
There are 5 "do not initialise statics" errors reported by
scripts/checkpatch.plyou probably should fix those. They are due to lines such as:
static int
pad_input_to_usb_pkt= 0;
static intdisable_offload_processing= 0;
static intforce_1_bit_data_xfers= 0;
static intforce_polling_for_irqs= 0;
Quoted 4 lines
Since those are global variables, you may omit to initialize them to 0 which would then allocate them to the .bss section which is not included in the compiled binary, and automatically cleared to zero at run time Nicolas
Yes they are due to exactly that, BUT I have a great aversion to using uninitialized variables. How can initializing all one's variables be considered a bug????
Tony Olech
Quoted 4 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] mmc: USB SDIO/SD/MMC Host Controller (VUB300) driver Resubmission
Quoted 11 lines · Tony Olech
Quoted 10 lines · Nicolas Pitre
Quoted 1 line · Tony Olech
There are 5 "do not initialise statics" errors reported by
scripts/checkpatch.plyou probably should fix those. They are due to lines such as:
static int
pad_input_to_usb_pkt= 0;
static intdisable_offload_processing= 0;
static intforce_1_bit_data_xfers= 0;
static intforce_polling_for_irqs= 0;
Quoted 7 lines
Quoted 4 lines
Since those are global variables, you may omit to initialize them to 0 which would then allocate them to the .bss section which is not included in the compiled binary, and automatically cleared to zero at run time Nicolas
Yes they are due to exactly that, BUT I have a great aversion to using uninitialized variables. How can initializing all one's variables be considered a bug????
Let me repeat myself.
Uninitialized global scope variables are by definition assigned to the .bss section. The .bss section is dynamically allocated at run time rather than being stored in the compiled binary, and also cleared to zero at run time. So the preference is for zero-initialized global variables not to be initialized at all because 1) they are implicitly initialized to zero anyway, and 2) that makes the resulting binaries smaller.
So this is not about fixing a bug, but rather to conform to the adopted policy for kernel code.
Nicolas
Re: [PATCH] mmc: USB SDIO/SD/MMC Host Controller (VUB300) driver Resubmission
Quoted 22 lines · Nicolas Pitre
Quoted 11 lines · Tony Olech
Quoted 10 lines · Nicolas Pitre
Quoted 1 line · Tony Olech
There are 5 "do not initialise statics" errors reported by
scripts/checkpatch.plyou probably should fix those. They are due to lines such as:
static int
pad_input_to_usb_pkt= 0;
static intdisable_offload_processing= 0;
static intforce_1_bit_data_xfers= 0;
static intforce_polling_for_irqs= 0;Quoted 7 lines
Quoted 4 lines
Since those are global variables, you may omit to initialize them to 0 which would then allocate them to the .bss section which is not included in the compiled binary, and automatically cleared to zero at run time Nicolas
Yes they are due to exactly that, BUT I have a great aversion to using uninitialized variables. How can initializing all one's variables be considered a bug????
Let me repeat myself.
Quoted 10 lines
Uninitialized global scope variables are by definition assigned to the .bss section. The .bss section is dynamically allocated at run time rather than being stored in the compiled binary, and also cleared to zero at run time. So the preference is for zero-initialized global variables not to be initialized at all because 1) they are implicitly initialized to zero anyway, and 2) that makes the resulting binaries smaller.
So this is not about fixing a bug, but rather to conform to the adopted policy for kernel code.
Nicolas
Thanks for the reply. I had not realized that saving 20 bytes on the binary size was so important. How then can one do static code analysis to determine which uninitialized variables are uninitialized as a result of a bug?
Tony Olech
Re: [PATCH] mmc: USB SDIO/SD/MMC Host Controller (VUB300) driver Resubmission
Quoted 11 lines · Tony Olech
Quoted 10 lines · Nicolas Pitre
Uninitialized global scope variables are by definition assigned to the .bss section. The .bss section is dynamically allocated at run time rather than being stored in the compiled binary, and also cleared to zero at run time. So the preference is for zero-initialized global variables not to be initialized at all because 1) they are implicitly initialized to zero anyway, and 2) that makes the resulting binaries smaller.
So this is not about fixing a bug, but rather to conform to the adopted policy for kernel code.
Nicolas
Quoted 2 lines
Thanks for the reply. I had not realized that saving 20 bytes on the binary size was so important.
With the size of the kernel they add up.
Quoted 3 lines
How then can one do static code analysis
to determine which uninitialized variables are uninitialized as a result of a bug?
A good static code analysis tool should know already that uninitialized global variables are implicitly initialized to zero. This is not the case for local variables of course.
Nicolas
Re: [PATCH] mmc: USB SDIO/SD/MMC Host Controller (VUB300) driver Resubmission
Quoted 15 lines · Nicolas Pitre
Quoted 11 lines · Tony Olech
Quoted 10 lines · Nicolas Pitre
Uninitialized global scope variables are by definition assigned to the .bss section. The .bss section is dynamically allocated at run time rather than being stored in the compiled binary, and also cleared to zero at run time. So the preference is for zero-initialized global variables not to be initialized at all because 1) they are implicitly initialized to zero anyway, and 2) that makes the resulting binaries smaller.
So this is not about fixing a bug, but rather to conform to the adopted policy for kernel code.
NicolasQuoted 2 lines
Thanks for the reply. I had not realized that saving 20 bytes on the binary size was so important.
Quoted 8 lines
With the size of the kernel they add up.
Quoted 3 lines
How then can one do static code analysis
to determine which uninitialized variables are uninitialized as a result of a bug?A good static code analysis tool should know already that uninitialized global variables are implicitly initialized to zero. This is not the case for local variables of course
Nicolas
Thanks for the reply.
I had assumed that for a module the global initialized variables were loaded at module load. That then is a problem given that new devices (and drivers) are appearing quite rapidly. I therefore do not understand how the global initialized variables from an externally compiled kernel module get added into the kernel image - does "depmod" do that? A good static code analysis tool surely can only show a list of uninitialized static global variables leaving it for the user to trawl through and decide which are OK and which are not - so much easier if one has no uninitialized static global variables to start with.
Tony Olech
Re: [PATCH] mmc: USB SDIO/SD/MMC Host Controller (VUB300) driver Resubmission
Quoted 24 lines · Tony Olech
Quoted 15 lines · Nicolas Pitre
Quoted 11 lines · Tony Olech
Quoted 10 lines · Nicolas Pitre
Uninitialized global scope variables are by definition assigned to the .bss section. The .bss section is dynamically allocated at run time rather than being stored in the compiled binary, and also cleared to zero at run time. So the preference is for zero-initialized global variables not to be initialized at all because 1) they are implicitly initialized to zero anyway, and 2) that makes the resulting binaries smaller.
So this is not about fixing a bug, but rather to conform to the adopted policy for kernel code.
NicolasQuoted 2 lines
Thanks for the reply. I had not realized that saving 20 bytes on the binary size was so important.
Quoted 8 lines
With the size of the kernel they add up.
Quoted 3 lines
How then can one do static code analysis
to determine which uninitialized variables are uninitialized as a result of a bug?A good static code analysis tool should know already that uninitialized global variables are implicitly initialized to zero. This is not the case for local variables of course
Nicolas
Quoted 6 lines
Thanks for the reply.
I had assumed that for a module the global initialized variables were loaded at module load. That then is a problem given that new devices (and drivers) are appearing quite rapidly. I therefore do not understand how the global initialized variables from an externally compiled kernel module get added into the kernel image - does "depmod" do that?
Sorry... I don't follow you here.
Quoted 3 lines
A good static code analysis tool surely can only show a list of uninitialized static global variables leaving it for the user to trawl through and decide which are OK and which are not
Why? Uninitialized static global variables should be assumed to be initialized to zero. This is part of the C standard. Nothing wrong here. And the kernel coding style simply pushes it further by requesting it.
Nicolas
Re: [PATCH] mmc: USB SDIO/SD/MMC Host Controller (VUB300) driver Resubmission
Quoted 8 lines · Nicolas Pitre
Quoted 5 lines
I had assumed that for a module the global initialized variables were loaded at module load. That then is a problem given that new devices (and drivers) are appearing quite rapidly. I therefore do not understand how the global initialized variables from an externally compiled kernel module get added into the kernel image - does "depmod" do that?
Sorry... I don't follow you here.
Nicolas
I obviously do not understand how the kernel build tools deal with the global initialized variables, and at the present time I have too many other priorities. But thanks for your explanation which I partially understood (I think)
Tony Olech
PATCH 1/1 mmc: USB SDIO/SD/MMC Host Controller (VUB300) driver Re-Resubmission
In reply to Tony OlechAdd a driver for Elan Digital System's VUB300 chip which is a USB connected SDIO/SDmem/MMC host controller. A VUB300 chip enables a USB 2.0 or USB 1.1 connected host computer to use SDIO/SD/MMC cards without the need for a directly connected, for example via PCI, SDIO host controller.
---
This is the third submission attempt.
There are no errors reported by scripts/checkpatch.pl This driver has been tested on
a) 32bit x86
b) 64bit x86
c) dual processor
d) PowerPC
---
MAINTAINERS +7 -0
@@ -6735,6 +6735,13 @@ L: [email protected] S: Maintained F: drivers/hwmon/vt8231.c +VUB300 USB to SDIO/SD/MMC bridge chip +M: Tony Olech <[email protected]> +L: [email protected] +L: [email protected] +S: Supported +F: drivers/mmc/host/vub300.c + W1 DALLAS'S 1-WIRE BUS M: Evgeniy Polyakov <[email protected]> S: Maintained
drivers/mmc/host/Makefile +1 -0
@@ -34,6 +34,7 @@ obj-$(CONFIG_SDH_BFIN) += bfin_sdh.o obj-$(CONFIG_MMC_DW) += dw_mmc.o obj-$(CONFIG_MMC_SH_MMCIF) += sh_mmcif.o obj-$(CONFIG_MMC_JZ4740) += jz4740_mmc.o +obj-$(CONFIG_MMC_VUB300) += vub300.o obj-$(CONFIG_MMC_USHC) += ushc.o obj-$(CONFIG_MMC_SDHCI_PLTFM) += sdhci-platform.o
drivers/mmc/host/Kconfig +31 -0
@@ -514,6 +514,37 @@ config MMC_JZ4740 If you have a board based on such a SoC and with a SD/MMC slot, say Y or M here. +config MMC_VUB300 + tristate "VUB300 USB to SDIO/SD/MMC Host Controller support" + depends on USB + help + This selects support for Elan Digital Systems' VUB300 chip. + + The VUB300 is a USB-SDIO Host Controller Interface chip + that enables the host computer to use SDIO/SD/MMC cards + via a USB 2.0 or USB 1.1 host. + + The VUB300 chip will be found in both physically separate + USB to SDIO/SD/MMC adapters and embedded on some motherboards. + + The VUB300 chip supports SD and MMC memory cards in addition + to single and multifunction SDIO cards. + + Some SDIO cards will need a firmware file to be loaded and + sent to VUB300 chip in order to achieve better data throughput. + Download these "Offload Pseudocode" from Elan Digital Systems' + web-site http://www.elandigitalsystems.com/support/downloads.php + and put them in /lib/firmware. Note that without these additional + firmware files the VUB300 chip will still function, but not at + the best obtainable data rate. + + To compile this mmc host controller driver as a module, + choose M here: the module will be called vub300. + + If you have a computer with an embedded VUB300 chip + or if you intend connecting a USB adapter based on a + VUB300 chip say Y or M here. + config MMC_USHC tristate "USB SD Host Controller (USHC) support" depends on USB
Documentation/ABI/stable/vub300 new file +11 -0
@@ -0,0 +1,11 @@ + +What: /sys/class/mmc_host/mmc<N>/operating_mode +Date: January 2011 +KernelVersion: 2.6.39 +Contact: Tony Olech <[email protected]> +Description: A read only diagnostic showing the state of the + vub300 sdio/mmc host controller driver, in particular + it shows which offload processing firmware file, + if any, is being used. +Users: - +
drivers/mmc/host/vub300.c new file +2605 -0
2,605 lines not on this page · raw message
Re: [PATCH] mmc: USB SDIO/SD/MMC Host Controller (VUB300) driver Re-Resubmission
Hi,
Quoted 8 lines · Tony Olech
Add a driver for Elan Digital System's VUB300 chip which is a USB connected SDIO/SDmem/MMC host controller. A VUB300 chip enables a USB 2.0 or USB 1.1 connected host computer to use SDIO/SD/MMC cards without the need for a directly connected, for example via PCI, SDIO host controller.
Signed-off-by Anthony F Olech <[email protected]>
linux-mmc@ folks, any strong opinions on this driver? My impression is that it looks reasonable, but has some areas of being pretty far from standard CodingStyle. I'm leaning towards merging it as-is and then working on incremental fixes; please yell if that sounds like a bad idea.
Thanks,
- Chris.
Signature · 2 lines
Chris Ball <[email protected]> <http://printf.net/> One Laptop Per Child
Re: [PATCH] mmc: USB SDIO/SD/MMC Host Controller (VUB300) driver Re-Resubmission
Hi,
Quoted 3 lines
linux-mmc@ folks, any strong opinions on this driver? My impression is that it looks reasonable, but has some areas of being pretty far from standard CodingStyle.
I totally agree (sadly it is hard to review because of its size) and I am still not convinced of the sysfs-entry. Then again, it is a working driver.
Quoted 2 lines
I'm leaning towards merging it as-is and then
working on incremental fixes; please yell if that sounds like a bad idea.
What about staging? From my all overall impression, the driver would fit there. Also, there are more people lurking around fixing coding-style than here.
Regards,
Wolfram
Signature · 2 lines
Pengutronix e.K. | Wolfram Sang | Industrial Linux Solutions | http://www.pengutronix.de/ |
Re: [PATCH] mmc: USB SDIO/SD/MMC Host Controller (VUB300) driver Re-Resubmission
Hi Wolfram,
Quoted 5 lines · Wolfram Sang
Quoted 2 lines
I'm leaning towards merging it as-is and then
working on incremental fixes; please yell if that sounds like a bad idea.What about staging? From my all overall impression, the driver would fit there. Also, there are more people lurking around fixing coding-style than here.
I thought about it, but I think staging drivers generally have a much larger TODO list than this one would.
Perhaps a good plan is: I'll push it to mmc-next after the 2.6.39 merge, then I'll try to work on style changes a bit (I'll send each patch to the list and Tony can ACK/NACK them), and then we can include it in 2.6.40 either as a normal driver if we're comfortable with how it's ended up, or as a staging driver if we'd still like to get some more eyes on it.
Does that sound okay to everyone?
Thanks,
- Chris.
Signature · 2 lines
Chris Ball <[email protected]> <http://printf.net/> One Laptop Per Child
Re: [PATCH] mmc: USB SDIO/SD/MMC Host Controller (VUB300) driver Re-Resubmission
Quoted 10 lines · Chris Ball
I thought about it, but I think staging drivers generally have a much larger TODO list than this one would.
Perhaps a good plan is: I'll push it to mmc-next after the 2.6.39 merge, then I'll try to work on style changes a bit (I'll send each patch to the list and Tony can ACK/NACK them), and then we can include it in 2.6.40 either as a normal driver if we're comfortable with how it's ended up, or as a staging driver if we'd still like to get some more eyes on it.
Does that sound okay to everyone?
Sounds good to me. I certainly wouldn't rush it now after the merge window is open. I'll also do a quick review for a TODO list.
Arnd
Re: [PATCH] mmc: USB SDIO/SD/MMC Host Controller (VUB300) driver Re-Resubmission
In reply to Tony OlechQuoted 6 lines · Tony Olech
Add a driver for Elan Digital System's VUB300 chip
which is a USB connected SDIO/SDmem/MMC host controller. A VUB300 chip enables a USB 2.0 or USB 1.1 connected host computer to use SDIO/SD/MMC cards without the need for a directly connected, for example via PCI, SDIO host controller.
First a small question: I've read that USB mmc controllers only work for SDIO but not for storage cards. Is that true for this driver?
If not, I'd probably get one for card testing, since the spring loading mechanism in my laptop is starting to wear out.
What are typical products using this?
My comments are mostly for coding style, I didn't see any major problems with the operation of the driver.
drivers/mmc/host/vub300.c line 62
Quoted 12 lines
drivers/mmc/host/vub300.c new file +12
-0+#include <linux/workqueue.h> +#include <linux/ctype.h> +#include <linux/firmware.h> +#include <linux/scatterlist.h> +struct HostController_Info { +u8 Size; +u16 FirmwareVer; +u8 NumberOfPorts; +} __packed; +struct SD_Command_Header { +u8 HeaderSize; +u8 HeaderType;
Please insert empty lines between the definitions, and use proper identifiers. In particular, don't use CamelCase but lowercase with underscores like
struct host_controller_info;
drivers/mmc/host/vub300.c line 73
Quoted 11 lines
drivers/mmc/host/vub300.c new file +11
-0+u8 PortNumber; +u8 Command_Type;/* Bit7 - Rd/Wr */ +u8 CommandIndex; +u8 TransferSize[4 ];/* ReadSize + ReadSize */ +u8 ResponseType; +u8 Arguments[4 ]; +u8 BlockCount[2 ]; +u8 BlockSize[2 ]; +u8 BlockBoundary[2 ]; +u8 Reserved[44 ];/* to pad out to 64 bytes */ +} __packed;
Don't use __packed for structures that are implicitly packed already, or for structures that are not defined in hardware. In this case, all members are u8, so __packed has no significance.
In other cases, it's better to mark only those members as packed that are unaligned in hardware, instead of marking all of them.
Access to structures marked as __packed can be signficantly slower on some architectures because gcc has to replace them with bytewise access, even when they are in fact aligned.
drivers/mmc/host/vub300.c line 173
Quoted 6 lines
drivers/mmc/host/vub300.c new file +6
-0+#define RESPONSE_INTERRUPT 0x01 +#define RESPONSE_ERROR 0x02 +#define RESPONSE_STATUS 0x03 +#define RESPONSE_IRQ_DISABLED 0x05 +#define RESPONSE_IRQ_ENABLED 0x06 +#define RESPONSE_PIGGYBACKED 0x07
It would be more readable if you insert some tabs to align the values, like
#define RESPONSE_INTERRUPT 0x01
#define RESPONSE_ERROR 0x02
#define RESPONSE_STATUS 0x03
Quoted 21 lines
drivers/mmc/host/vub300.c new file +21
-0+static int limit_speed_to_24_MHz =INITIALIZE_VALUE_TO_ZERO ; +module_param (limit_speed_to_24_MHz, bool,0644 ); +MODULE_PARM_DESC (limit_speed_to_24_MHz,"Limit Max SDIO Clock Speed to 24 MHz" ); +static int pad_input_to_usb_pkt =INITIALIZE_VALUE_TO_ZERO ; +module_param (pad_input_to_usb_pkt, bool,0644 ); +MODULE_PARM_DESC (pad_input_to_usb_pkt, +"Pad USB data input transfers to whole USB Packet" ); +static int disable_offload_processing =INITIALIZE_VALUE_TO_ZERO ; +module_param (disable_offload_processing, bool,0644 ); +MODULE_PARM_DESC (disable_offload_processing,"Disable Offload Processing" ); +static int force_1_bit_data_xfers =INITIALIZE_VALUE_TO_ZERO ; +module_param (force_1_bit_data_xfers, bool,0644 ); +MODULE_PARM_DESC (force_1_bit_data_xfers, +"Force SDIO Data Transfers to 1-bit Mode" ); +static int force_polling_for_irqs =INITIALIZE_VALUE_TO_ZERO ; +module_param (force_polling_for_irqs, bool,0644 ); +MODULE_PARM_DESC (force_polling_for_irqs,"Force Polling for SDIO interrupts" ); +static int firmware_irqpoll_timeout =1024 ; +module_param (firmware_irqpoll_timeout, int,0644 ); +MODULE_PARM_DESC (firmware_irqpoll_timeout,"VUB300 firmware irqpoll timeout" ); +static int force_max_req_size =128 ;
drivers/mmc/host/vub300.c line 241
Quoted 10 lines
drivers/mmc/host/vub300.c new file +10
-0+module_param (force_max_req_size, int,0644 ); +MODULE_PARM_DESC (force_max_req_size,"set max request size in kBytes" ); +#ifdef SMSC_DEVELOPMENT_BOARD +static int firmware_rom_wait_states =0x04 ; +#else +static int firmware_rom_wait_states =0x1C ; +#endif +module_param (firmware_rom_wait_states, bool,0644 ); +MODULE_PARM_DESC (firmware_rom_wait_states, +"ROM wait states byte=RRRIIEEE (Reserved Internal External)" );
A lot of module parameters for a simple driver. I assume that some of these were useful in debugging but could be removed now.
drivers/mmc/host/vub300.c line 257
Quoted 3 lines
drivers/mmc/host/vub300.c new file +3
-0+static struct workqueue_struct *cmndworkqueue; +static struct workqueue_struct *pollworkqueue; +static struct workqueue_struct *deadworkqueue;
Do you really need three separate workqueues? Note that you can have different work_struct in the same queue.
drivers/mmc/host/vub300.c line 294
Quoted 8 lines
drivers/mmc/host/vub300.c new file +8
-0+ unsigned card_powered:1; + unsigned card_present:1; + unsigned read_only:1; + unsigned large_usb_packets:1; + unsigned app_spec:1; /* ApplicationSpecific */ + unsigned irq_enabled:1; /* by the MMC CORE */ + unsigned irq_disabled:1; /* in the firmware */ + unsigned bus_width:4;
Bit fields are normally discouraged, just use bool values for flags, or a u8 for the bus_width.
Quoted 23 lines
drivers/mmc/host/vub300.c new file +23
-0+static ssize_t __show_operating_mode (struct vub300_mmc_host *vub300, +struct mmc_host *mmc,char *buf) +{ +int usb_packet_size = vub300->large_usb_packets ?512 :64 ; +if (vub300->vub_name[0 ]) +return sprintf (buf,"VUB %s %s %d MHz %s %d byte USB packets" +" using %s\n" , + (mmc->caps &MMC_CAP_SDIO_IRQ ) ?"IRQs" :"POLL" , + (mmc->caps &MMC_CAP_4_BIT_DATA ) ?"4-bit" :"1-bit" , + mmc->f_max /1000000 , + pad_input_to_usb_pkt ?"padding input data to" :"with" , + usb_packet_size, vub300->vub_name); +else +return sprintf (buf,"VUB %s %s %d MHz %s %d byte USB packets" +" and no offload processing\n" , + (mmc->caps &MMC_CAP_SDIO_IRQ ) ?"IRQs" :"POLL" , + (mmc->caps &MMC_CAP_4_BIT_DATA ) ?"4-bit" :"1-bit" , + mmc->f_max /1000000 , + pad_input_to_usb_pkt ?"padding input data to" :"with" , + usb_packet_size); +} + +static ssize_t show_operating_mode(struct device *dev,
drivers/mmc/host/vub300.c line 395
Quoted 10 lines
drivers/mmc/host/vub300.c new file +10
-0+ struct device_attribute *attr, char *buf) +{ + struct mmc_host *mmc = container_of(dev, struct mmc_host, class_dev); +if (mmc) { +struct vub300_mmc_host *vub300 =mmc_priv (mmc); +return __show_operating_mode (vub300, mmc, buf); + }else { +return sprintf (buf,"VUB driver has no attached device" ); + } +}
This sysfs attribute is rather hard to parse from user space, it looks like it's designed only to be read by humans. I think it would be better to use multiple attributes, each of which has only a single piece of information in it.
Some of these attributes however don't really belong into this driver but into the core, like the 1-bit / 4-bit mode. Please leave this out of your driver, and submit a separate patch to the mmc core if you think it's reasonable.
Quoted 9 lines
drivers/mmc/host/vub300.c new file +9
-0+static void vub300_queue_cmnd_work (struct vub300_mmc_host *vub300) +{ +kref_get (&vub300->kref); +if (queue_work (cmndworkqueue, &vub300->cmndwork)) { +/* +* then the cmndworkqueue was not previously +* running and the above get ref is obvious +* required and will be put when the thread +* terminates by a specific call
drivers/mmc/host/vub300.c line 425
Quoted 10 lines
drivers/mmc/host/vub300.c new file +10
-0+*/ + }else { +/* +* the cmndworkqueue was already running from +* a previous invocation and thus to keep the +* kref counts correct we must undo the get +*/ +kref_put (&vub300->kref, vub300_delete); + } +}
You use the same kref_get/kref_put statement in a lot of places, better encapsulate it in an inline function and make the callers do
vub300_get(vub300); ... vub300_put(vub300);
drivers/mmc/host/vub300.c line 559
Quoted 9 lines
drivers/mmc/host/vub300.c new file +9
-0+ }else if (!new_card_present && old_card_present) { +dev_info (&vub300->udev->dev,"card just ejected\n" ); + vub300->card_present =0 ; +mmc_detect_change (vub300->mmc,0 ); +return ; + }else { +return ; + } +}
The last else branch is redundant here.
drivers/mmc/host/vub300.c line 572
Quoted 12 lines
drivers/mmc/host/vub300.c new file +12
-0+static void __add_offloaded_reg_to_fifo (struct vub300_mmc_host *vub300, +struct Offload_Registers_Access + *register_access,u8 Function) +{ +u8 r = + vub300->fn[Function].offload_point + + vub300->fn[Function].offload_count; +memcpy (&vub300->fn[Function].reg[MAXREGMASK & r] + , register_access,sizeof (struct Offload_Registers_Access )); + vub300->fn[Function].offload_count +=1 ; + vub300->total_offload_count +=1 ; +}
Just use a temporary variable:
struct offload_interrupt_function_register *fn = &vub300->fn[Function]; u8 r = fn->offload_point + fn.offload_count; ...
drivers/mmc/host/vub300.c line 624
Quoted 6 lines
drivers/mmc/host/vub300.c new file +6
-0+static void __vub300_irqpoll_response (struct vub300_mmc_host *vub300) +{ +/* +* cmd_mutex is held by vub300_pollwork_thread +*/ +if (0 == vub300->command_res_urb->actual_length) {
The common coding style is to write the variable name first and then the value you are comparing with:
if (vub300->command_res_urb->actual_length == 0)
Quoted 16 lines
drivers/mmc/host/vub300.c new file +16
-0+ }else if (RESPONSE_INTERRUPT == vub300->resp.common.HeaderType) { +mutex_lock (&vub300->irq_mutex); +if (vub300->irq_enabled) +mmc_signal_sdio_irq (vub300->mmc); +else + vub300->irqs_queued +=1 ; + vub300->irq_disabled =1 ; +mutex_unlock (&vub300->irq_mutex); +mutex_unlock (&vub300->cmd_mutex); +kref_put (&vub300->kref, vub300_delete); +return ; + }else if (RESPONSE_ERROR == vub300->resp.common.HeaderType) { +if (SD_ERROR_NO_DEVICE == vub300->resp.error.ErrorCode) +check_vub300_port_status (vub300); +mutex_unlock (&vub300->cmd_mutex); +vub300_queue_poll_work (vub300,HZ );
drivers/mmc/host/vub300.c line 653
Quoted 10 lines
drivers/mmc/host/vub300.c new file +10
-0+kref_put (&vub300->kref, vub300_delete); +return ; + }else if (RESPONSE_STATUS == vub300->resp.common.HeaderType) { + vub300->system_port_status = vub300->resp.status; +new_system_port_status (vub300); +mutex_unlock (&vub300->cmd_mutex); +if (!vub300->card_present) +vub300_queue_poll_work (vub300,HZ /5 ); +kref_put (&vub300->kref, vub300_delete); +return ;
Better use a switch/case statement instead of lots of if/else. Also, don't duplicate the cleanup path, instead do:
switch (vub300->resp.common.HeaderType) {
case RESPONSE_INTERRUPT:
...
break;
case RESPONSE_ERROR:
...
break;
case ...
break;
}
mutex_unlock(&vub300->cmd_mutex);
kref_put(&vub300->kref, vub300_delete);
return;Also, make sure that all functions have a matching number of mutex_lock/mutex_unlock etc calls, to avoid confusing the readers.
drivers/mmc/host/vub300.c line 940
Quoted 12 lines
drivers/mmc/host/vub300.c new file +12
-0+/* +* the STUFF bits are masked out for the comparisons +*/ +static void snoop_block_size_and_bus_width (struct vub300_mmc_host *vub300, +u32 cmd_arg) +{ +if (0x80022200 == (0xFBFFFE00 & cmd_arg)) + vub300->fbs[1 ] = (cmd_arg <<8 ) | (0x00FF & vub300->fbs[1 ]); +else if (0x80022000 == (0xFBFFFE00 & cmd_arg)) + vub300->fbs[1 ] = (0xFF & cmd_arg) | (0xFF00 & vub300->fbs[1 ]); +else if (0x80042200 == (0xFBFFFE00 & cmd_arg)) + vub300->fbs[2 ] = (cmd_arg <<8 ) | (0x00FF & vub300->fbs[2 ]);
switch/case again.
Quoted 20 lines
drivers/mmc/host/vub300.c new file +20
-0+static void send_command (struct vub300_mmc_host *vub300) +{ +/* +* cmd_mutex is held by vub300_cmndwork_thread +*/ +struct mmc_command *cmd = vub300->cmd; +struct mmc_data *data = vub300->data; +int retval; +u8 ResponseType; +if (vub300->app_spec) { +if (6 == cmd->opcode) { + ResponseType =SDRT_1 ; + vub300->resp_len =6 ; +if (0x00000000 == (0x00000003 & cmd->arg)) + vub300->bus_width =1 ; +else if (0x00000002 == (0x00000003 & cmd->arg)) + vub300->bus_width =4 ; +else + dev_err(&vub300->udev->dev, + "unexpected ACMD6 bus_width=%d\n",
drivers/mmc/host/vub300.c line 998
Quoted 10 lines
drivers/mmc/host/vub300.c new file +10
-0+ 0x00000003 & cmd->arg); + }else if (13 == cmd->opcode) { + ResponseType =SDRT_1 ; + vub300->resp_len =6 ; + }else if (22 == cmd->opcode) { + ResponseType =SDRT_1 ; + vub300->resp_len =6 ; + }else if (23 == cmd->opcode) { + ResponseType =SDRT_1 ; + vub300->resp_len =6 ;
and here. Also, this function is too long to be readable.
Arnd
Re: [PATCH] mmc: USB SDIO/SD/MMC Host Controller (VUB300) driver Re-Resubmission
see embedded answers:-
Quoted 10 lines · Arnd Bergmann
Quoted 6 lines · Tony Olech
Add a driver for Elan Digital System's VUB300 chip
which is a USB connected SDIO/SDmem/MMC host controller. A VUB300 chip enables a USB 2.0 or USB 1.1 connected host computer to use SDIO/SD/MMC cards without the need for a directly connected, for example via PCI, SDIO host controller.First a small question: I've read that USB mmc controllers only work for SDIO but not for storage cards. Is that true for this driver?
The chip has been designed to handle memory cards as well as SDIO, and we have test all we could get our hands on, and tested for and thus 64M to 8G SD cards. It has also been tested on a 64M MMC (1 bit) data card.
Quoted 4 lines
If not, I'd probably get one for card testing, since the spring loading mechanism in my laptop is starting to wear out.
What are typical products using this?
At the moment the dev kit, which is really just a bare board USB to SD/SDIO/MMC converter, is available for evaluation. the chips themselves are available for for purchase - see our web site for details.
Quoted 2 lines
My comments are mostly for coding style, I didn't see any major problems with the operation of the driver.
I am going to have to go through your coding style comments separately.
Thanks for reading through the code,
Tony Olech
Re: [PATCH] mmc: USB SDIO/SD/MMC Host Controller (VUB300) driver Re-Resubmission
In reply to Arnd BergmannQuoted 1 line · Arnd Bergmann
On Thursday 10 March 2011, Tony Olech wrote:
...
Quoted 39 lines
Quoted 23 lines
drivers/mmc/host/vub300.c new file +23
-0+static ssize_t __show_operating_mode (struct vub300_mmc_host *vub300, +struct mmc_host *mmc,char *buf) +{ +int usb_packet_size = vub300->large_usb_packets ?512 :64 ; +if (vub300->vub_name[0 ]) +return sprintf (buf,"VUB %s %s %d MHz %s %d byte USB packets" +" using %s\n" , + (mmc->caps &MMC_CAP_SDIO_IRQ ) ?"IRQs" :"POLL" , + (mmc->caps &MMC_CAP_4_BIT_DATA ) ?"4-bit" :"1-bit" , + mmc->f_max /1000000 , + pad_input_to_usb_pkt ?"padding input data to" :"with" , + usb_packet_size, vub300->vub_name); +else +return sprintf (buf,"VUB %s %s %d MHz %s %d byte USB packets" +" and no offload processing\n" , + (mmc->caps &MMC_CAP_SDIO_IRQ ) ?"IRQs" :"POLL" , + (mmc->caps &MMC_CAP_4_BIT_DATA ) ?"4-bit" :"1-bit" , + mmc->f_max /1000000 , + pad_input_to_usb_pkt ?"padding input data to" :"with" , + usb_packet_size); +} + +static ssize_t show_operating_mode(struct device *dev,drivers/mmc/host/vub300.c line 395
Quoted 10 lines
drivers/mmc/host/vub300.c new file +10
-0+ struct device_attribute *attr, char *buf) +{ + struct mmc_host *mmc = container_of(dev, struct mmc_host, class_dev); +if (mmc) { +struct vub300_mmc_host *vub300 =mmc_priv (mmc); +return __show_operating_mode (vub300, mmc, buf); + }else { +return sprintf (buf,"VUB driver has no attached device" ); + } +}This sysfs attribute is rather hard to parse from user space, it looks like it's designed only to be read by humans. I think it would be better to use multiple attributes, each of which has only a single piece of information in it.
Quoted 4 lines
Some of these attributes however don't really belong into this driver but into the core, like the 1-bit / 4-bit mode. Please leave this out of your driver, and submit a separate patch to the mmc core if you think it's reasonable.
The purpose of this read-only interface is for VUB300 support staff to obtain information from our customers. Our customers are not like the people on this list. If you have ever tried to do telephone support you would appreciate the difficulty of getting a non-technical person to first of all find the log files and then to extract the correct lines. It therefore follows that if the 1 or 4 bit mode is useful info for the VUB300 support staff, then this read-only interface is the appropriate single place for it to be provided. The overhead of providing such an interface is negligible and the existance of such an interface demonstrates that linux is no longer designed only for geeks.
Tony Olech
Re: [PATCH] mmc: USB SDIO/SD/MMC Host Controller (VUB300) driver Re-Resubmission
Quoted 4 lines · Tony Olech
The purpose of this read-only interface is for VUB300 support staff to obtain information from our customers. Our customers are not like the people on this list. If you have ever tried to do telephone support you would appreciate the difficulty
Quoted 8 lines
of getting a non-technical person to first of all find the log files and then to extract the correct lines. It therefore follows that if the 1 or 4 bit mode is useful info for the VUB300 support staff, then this read-only interface is the appropriate single place for it to be provided. The overhead of providing such an interface is negligible and the existance of such an interface demonstrates that linux is no longer designed only for geeks.
Wrong answer.
You are missing the point. Sysfs is not the place where you can put random interfaces you want for you own needs. By adding files there, you create a support burden for everyone who now has to maintain backwards-compatibility.
You cannot seriously ask for inclusion of a kernel interface just to fit the use of your support team at the expense of everyone else.
Please remove the sysfs attributes from the driver before resubmitting. We can have a separate discussion about core interfaces that will help everyone and that are consistent with how Linux kernels are supported.
Arnd
Re: [PATCH] mmc: USB SDIO/SD/MMC Host Controller (VUB300) driver Re-Resubmission
Quoted 25 lines · Arnd Bergmann
Quoted 4 lines · Tony Olech
The purpose of this read-only interface is for VUB300 support staff to obtain information from our customers. Our customers are not like the people on this list. If you have ever tried to do telephone support you would appreciate the difficulty
Quoted 8 lines
of getting a non-technical person to first of all find the log files and then to extract the correct lines. It therefore follows that if the 1 or 4 bit mode is useful info for the VUB300 support staff, then this read-only interface is the appropriate single place for it to be provided. The overhead of providing such an interface is negligible and the existance of such an interface demonstrates that linux is no longer designed only for geeks.
Wrong answer.
You are missing the point. Sysfs is not the place where you can put random interfaces you want for you own needs. By adding files there, you create a support burden for everyone who now has to maintain backwards-compatibility.
You cannot seriously ask for inclusion of a kernel interface just to fit the use of your support team at the expense of everyone else.
Quoted 6 lines
Please remove the sysfs attributes from the driver before resubmitting. We can have a separate discussion about core interfaces that will help everyone and that are consistent with how Linux kernels are supported.
Arnd
You have not answered my points. If linux is to move from the preserve of geeks, then support is an issue.
What is wrong in wanting to support non-technical users? Especially since there are no backward compatible issues involved at all.
Tony
Re: [PATCH] mmc: USB SDIO/SD/MMC Host Controller (VUB300) driver Re-Resubmission
Quoted 3 lines · Tony Olech
What is wrong in wanting to support non-technical users? Especially since there are no backward compatible issues involved at all.
It's good to support non-technical users. Things that are bad about your patch are:
* Have interfaces that work only for your customers. If a specific interface is a good thing to have, it certainly is good to have it for everyone.
* Fragmentation between drivers. In addition, if someone else needs a similar interface and introduces it in another driver, we can end up with incompatible ways of getting the same information, which is an absolute support nightmare for people that want to support all users.
* Not following the interface standards. You don't get to make the decision which interfaces are helpful and which ones are not, they have to be agreed upon. The files you were suggesting violate the rules about how they should look like, in particular having one value per file. Doing something else is very confusing to users that have reasonable expectations about the contents.
So even though you had the intentions to make support easier for some people, you end up with a situation that makes it harder to support for everyone.
Arnd