christian pellegrin wrote: > On Tue, Oct 27, 2009 at 12:04 PM, Oliver Hartkopp > <[email protected]> wrote: >> Hello Christian, > > Hi, > >> Before connecting Kontron i just wanted to ask you, if there's already a >> working SPI driver that would be able to connect your mcp251x driver with the >> parallel port analogue to the MicroChip eval board??? > > > the SPI master driver and the mcp251x should be independent of each > other, but unfortunately on the x86 things tend to be a lot messier (I > dream of a world without x86 and windoze ;-) ). Personally I always > used this CAN chip on ARM platforms with native SPI (not big-banging). > I had a quick look at the driver you cited and it looks like it's > rather ad-hoc because it plays some strange tricks with the driver > subsystem: > > /* > * The modalias name MUST match the device_driver name > * for the bus glue code to match and subsequently bind them. > * We are binding to the generic drivers/hwmon/lm70.c device > * driver. > */ > strcpy(pp->info.modalias, "lm70"); > > I think that if you don't load "lm70" driver it will be ok anyway, it > looks like the spi master driver just grabs the first parport it's > offered. You can check /sys/bus/spi if you have a SPI bus after > loading parport.ko, parport_pc.ko and spi_lm70llp.ko. > > Next you should bind the mcp251x driver to the bus with > spi_register_board_info. > > static struct mcp251x_platform_data mcp251x_info = { > .oscillator_frequency = 8000000, > .board_specific_setup = NULL, > .model = CAN_MCP251X_MCP2515, > .power_enable = NULL, > .transceiver_enable = NULL, > }; > > static struct spi_board_info spi_board_info[] = { > { > .modalias = "mcp251x", > .platform_data = &mcp251x_info, > .irq = 7, /* or 5, grepping for FLOPPY_IRQ > gave me an idea how irqs work on x86 */ > .max_speed_hz = 2*1000*1000, > .chip_select = 0, /* is supports just the one CS */ > }, > }; > > I would put this in a module by itself with spi_register_board_info > for the testing. In this module I'll call parport_enable_irq to > enable IRQ register. When loading parport_pc pass -1 to the interrupt > number so there won't be problem with sharing that. Of course this > assumes that the mcp2515 interrupt line is connected to the parallel > port that generates interrupts. > > Hope this help, I'll never tried it out but this is the way I'll try > to approach the problem. Let me know if it works or I can help you in > some way. >
Thanks very much for this brief introduction! Indeed this acknowledges my assumption that there is a bit more to do than just configuring the spi_gpio driver or remap the lm70llp driver to use a different i/o pin mapping on the parallel port. I'll talk to the Kontron guys if they can imagine to contribute the missing piece of SPI software to add an appropriate Linux support for their hardware. Thanks & best regards, Oliver _______________________________________________ Socketcan-core mailing list [email protected] https://lists.berlios.de/mailman/listinfo/socketcan-core
