On 09/03/2013 12:59 PM, Greg KH wrote:
Hm, I thought we used to have some of them, I guess people have been saying they would write a driver for this type of hardware for a long time now :(
Well, on the bright side, we have one now, albeit in a "this is my first driver that nobody has reviewed yet" state. :) It works (even on RPi -- well, mostly). As-is, it has a fair TODO & fix list, which I'm sure will grow rapidly with some review. I hope that as I learn the kernel better, I can generalize parts of this into some re-usable lib for other USB-to-SPI/I2C/GPIO drivers.
https://github.com/daniel-santos/mcp2210-linux/
Anyway, look at the spi core, I think you want to tie into the spi_new_device() call in your usb driver, and start sending/receiving data through the SPI interfaces the spi core provides.
I'm actually using the alternative to that call, which is the spi_alloc_device() / spi_add_device() pair as I'm not using struct spi_board_info at all since it doesn't (currently) have even half of the fields I need for each device. However, struct spi_device does have the two void * fields controller_data and controller_state -- I suppose I can use those to pass a pointer to a add_notify() type of function. I was just trying to seek a more generic, re-usable mechanism, but this should at least work for now.
The Linux SPI mailing list should be able to help you out a lot more here than I can. greg k-h
Thanks again for your help! -- 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