1

I have a Holt HI-3110 chip that implements a CAN bus interface that is run over an SPI host interface. A driver for the chip is in the Linux mainline (in /drivers/net/can/spi). I'm targeting a host platform with no SPI host interface, so I've installed a Microchip MCP2210 USB-to-SPI bridge that is also supported in the Linux mainline (in /drivers/hid). Banging on the /dev/hidraw0 device from user code seems to work fine.

I assume I need to convert the SPI driver to a platform driver that looks for the correct hid driver and uses it to get to the CAN chip. Can someone point me to a driver that does something similar (using another driver to get to a device)?

2
  • You mean you want to connect USB to SPI to CAN, when there are USB to CAN adapters?
    – sawdust
    Jan 10, 2019 at 8:16
  • E.g.: Bluetooth has several transport drivers, as does HID itself (e.g. HID over I2C as opposed over USB). I am not sure if there's a "standard" way in the kernel to do this.
    – dirkt
    Jan 12, 2019 at 13:04

1 Answer 1

0

To be able to use the kernel CAN driver through the MCP2210 USB-to-SPI bridge, you would need a kernel driver that exposes the SPI bus of the MCP2210.

The mainline kernel does not include such a driver, meaning you're stuck with userland control of the SPI device (and cannot use kernel drivers). A userland library for controlling the MCP2210 is available from https://github.com/kerrydwong/MCP2210-Library

An out-of-tree mcp2210 kernel driver, which would allow you to use a kernel CAN driver, is available from https://github.com/daniel-santos/mcp2210-linux (FOSDEM talk: https://archive.fosdem.org/2018/schedule/event/rapid_spi_over_usb/attachments/audio/2461/export/events/attachments/rapid_spi_over_usb/audio/2461/USB_SPI_FOSDEM_2018.pdf)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .