Great! That's the kind of guidance I was seeking for! Really much cleaner. Thanks! Let's see what comes from this... I took a look at how SDIO (MMC implementation on drivers/mmc/core/core.c) register itself and it uses bus_register function with predefined structure. Just after that, when a SDIO driver register itself, it enforces this specific sdio_bus to the driver in sdio_register_driver function. So it seems that sdio_bus actual implementation is tighten up with MMC stack in a way that I would have to change the way things works there to be able to support multiple sdio buses. Do you think that, in this case, implementing a MMC host, that is actually a SCSI client would be too ugly? Anyway I should probably move to linux-mmc list now. Thanks a lot! 2016-01-19 0:12 GMT-02:00 Matthew Dharm <mdharm-usb@xxxxxxxxxxxxxxxxxx>: > If you were going to do this as some sort of "glue", I would suggest > creating a new sdio_bus which is actually a SCSI client (the same way > sr, sd, and sg are "clients" of SCSI core -- I know that's not the > right terminology) and can translate the SDIO requests into the > relevant SCSI vendor-specific commands. > > Matt > > On Mon, Jan 18, 2016 at 5:34 PM, Raphael <raphaelpereira@xxxxxxxxx> wrote: >> First of all, thanks for the response. >> >> Actually the document is >> http://ww1.microchip.com/downloads/en/DeviceDoc/50002277A.pdf (sorry >> for not pointing it earlier). >> >> As I understood, the USB2642 accepts some pass-through commands to >> deliver SDIO commands to the MMC interface. The driver I need to work >> is unifi_sdio, which can be downloaded through registering at >> BlueGiga. Basically it controls the WiFi module using the linux >> sdio_bus.c interface (sdio_register_driver). It was made to be >> interfaced directly with a MMC hardware host (most often on embedded >> microcontroller native SPI/SD interface), but this "thing" I am trying >> to do seems to not have been done before (use a dual-role USB HCD with >> a MMC interface to act as a SDIO interface with another peripheral). >> >> To avoid having to port the whole driver to a direct SCSI interface >> and as the document mentions the possibility of delivering SDIO >> commands using Mass Storage Bulk-Only + Transparent I thought about >> doing the "glue" in usb-storage land. >> >> And regarding ci_hdrc, this is the driver that controls the chip, as >> it is a dual-role HCD based on chipidea. It seems SMSC (which was >> bought by Microchip) was the original acquire of ChipIdea technology >> and developed many USB dual-role chips (for instance LAN9512, LAN9514 >> and USB2640) which seems to all be controlled by this HCD driver. >> >> Probably the storage/mmc interface has nothing to do with the ci_hdrc. >> >> >> >> 2016-01-18 19:16 GMT-02:00 Matthew Dharm <mdharm-usb@xxxxxxxxxxxxxxxxxx>: >>> If usb-storage detects the device as a storage device, then it isn't >>> exposing the "raw" MMC device. Generally speaking, the usb-storage >>> driver doesn't know anything specific about MMC; for spec-compliant >>> devices, it frames the commands in terms of "give me xxxx bytes >>> starting at linear address yyyy". For devices with vendor-specific >>> protocols it's a little more complicated, but not that far off. >>> >>> It would be interesting to see the USB descriptors from the USB2642 >>> device. I wonder if it has multiple interfaces. Tho, if this >>> document is to be believed -- >>> http://ww1.microchip.com/downloads/en/DeviceDoc/50002283A.pdf -- it >>> does not. In fact, it implements the I2C interface via >>> vendor-specific SCSI pass-through commands, which usb-storage will >>> frame and send over the wire quite happily. >>> >>> Are you sure ci_hdrc applies here? Doing some quick googling, that >>> looks like an HCD rather than something for the USB2642.... >>> >>> Matt >>> >>> On Mon, Jan 18, 2016 at 11:39 AM, Raphael <raphaelpereira@xxxxxxxxx> wrote: >>>> Hi, >>>> >>>> I developed a hardware that has a Microchip USB2642 (USB Hub with MMC >>>> interface), which is kernel supported by chipidea IP (ci_hdrc) driver. >>>> >>>> I connected a Bluegiga WF111-A WiFi module to the MMC interface of the >>>> USB2642. So, in a hardware sense, everything is fine. >>>> >>>> The problem is that the only driver available from BlueGiga uses linux MMC >>>> stack. So although usb-storage detects the module as a SCSI disk interface >>>> (/dev/sda), the driver doesn't work, as it searches the MMC stack for the >>>> module, and finds nothing. >>>> >>>> I have been taking a look at usb-storage driver, SDIO specs and a specific >>>> document from Microchip that shows a "SDIO over USB bridge" reference, which >>>> actually is what usb-storage does (SCSI Bulk-Only with SCSI Transparent >>>> transport) and so I wonder if is it reasonable to write a "MMC host >>>> interface/bridge" in the usb-storage driver so that any SDIO driver can >>>> attach to the USB subsystem. >>>> >>>> At first it seems only that I need to make some kind of glue between both >>>> stacks (usb-storage and mmc). >>>> >>>> Or, maybe the right option is to ignore usb-storage and implement usb >>>> bindings on a custom MMC host. So I want some opinions before I begin to >>>> make crap. >>>> >>>> My question is: Is this the correct approach or am I being stupid? >>>> >>>> Thanks! >>>> -- >>>> Raphael Derosso Pereira >>>> >>> >>> >>> >>> -- >>> Matthew Dharm >>> Maintainer, USB Mass Storage driver for Linux >> >> >> >> -- >> Raphael Derosso Pereira >> Engenheiro de Computação >> msn: rderossopereira@xxxxxxxxxxx >> Skype: rderossopereira > > > > -- > Matthew Dharm > Maintainer, USB Mass Storage driver for Linux -- Raphael Derosso Pereira -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html