On 8/28/20 11:53 AM, Kirby Nankivell wrote: > Thankyou for your contribution of a MCP25xxFD driver to the linux kernel. I am > only a hobbyist in this area (I am a mechanical engineer for work), but it has > certainly allowed me to pursue a project I could not have previously. Please use the linux-can mailinglist (Cc'ed) for community support. > I have been able to successfully integrate your patchset into my buildroot > environment, after several attempts -- In the end I was missing the rx offload > patch which solved my compile errors. > > I used the -47 release submitted to linux-can mailing list that was published on > the kernel.org <http://kernel.org> git / same as your github branch: > https://www.spinics.net/lists/linux-can/msg03712.html > https://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next.git/log/?h=mcp25xxfd-47 > > *Here is my boot dmesg:* > /[ 1.235223] CAN device driver interface/ > /[ 1.239239] OF: /soc/spi@1c68000/mcp2518fd@1: #interrupt-cells = 3 found -1/ This looks like an error message! See comments about mcp2518 interrupts below. > /[ 1.246482] spi_master spi0: will run message pump with realtime priority/ > /[ 1.291590] mcp25xxfd spi0.1 can0: MCP2518FD rev0.0 (-RX_INT -MAB_NO_WARN > +CRC_REG +CRC_RX +CRC_TX +ECC -HD m:9.09MHz r:9.09MHz e:0.00MHz) successfully > initialized./ > > *However when I go to try and test:* > /# ip link set can0 up type can bitrate 500000 restart-ms 100 fd off/ > /[ 77.424381] A link change request failed with some changes committed > already. Interface can0 may have been left with an inconsistent configuration, > please check./ > /RTNETLINK answers: Invalid argument/ any output in the dmesg after this? > *Problem resolution:* > I found some issues with my interrupt wiring, which has since been fixed. But > this did not resolve the problem. After doing some research this error seems > related to my choice of using a GPIO for my second chip-select (the hardware CS > is being used for a display). This exact configuration was used for MCP2515 > bench testing so I am unsure if it is a driver issue or something else. > > Of course I appreciate your time is valuable, however as the main author of this > driver I wondered if you had any insight as to if this is a driver issue or a > hardware issue, or some suggestions for testing. > > Looking forward to your response, > > Regards, > Kirby > > > Below is some information about my setup and the relevant excerpt from my device > tree. > > *Hardware:* > LicheePi Zero - Allwinner V3s > Buildroot - 5.7 Kernel I'm succeddfully running the mcp25xxfd driver on an allwinner h3: https://github.com/marckleinebudde/linux/blob/v4.19-sunxi/mcp25xxfd-20200429-46/arch/arm/boot/dts/sun8i-h3-nanopi-easysolar-base-a10.dtsi#L102 > Device Tree Excerpts: > DTS Clocks: > can0_osc_fixed: can0_osc_fixed { > #clock-cells = <0>; > compatible = "fixed-clock"; > clock-frequency = <20000000>; > }; > > PIO: > spi0_pins: spi0 { > pins = "PC0", "PC1", "PC2", "PC3"; > function = "spi0"; > }; > > spi0_cs1: spi0_cs1 { > pins = "PE21"; > function = "gpio_out"; > output-high; > }; > > can0_pin_irq: can0_pin_irq { > pins = "PB0"; > function = "irq"; > bias-pull-up; > }; > > > SPI: > spi0: spi@1c68000 { > #address-cells = <2>; > #size-cells = <0>; > compatible = "allwinner,sun8i-h3-spi"; > reg = <0x01c68000 0x1000>; > interrupts = <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>; > clocks = <&ccu CLK_BUS_SPI0>, <&ccu CLK_SPI0>; > clock-names = "ahb", "mod"; > dmas = <&dma 23>, <&dma 23>; > dma-names = "rx", "tx"; > pinctrl-names = "default", "default"; > pinctrl-0 = <&spi0_pins>; > pinctrl-1 = <&spi0_cs1>; I'm not sure if this pinctrl works correctly this way, try: pinctrl-names = "default"; pinctrl-0 = <&spi0_pins &spi0_cs1>; > cs-gpios = <0>, <&pio 4 21 0>; /* PE21 */ > resets = <&ccu RST_BUS_SPI0>; > status = "disabled"; > }; > > SPI devices: > &spi0 { > status = "okay"; > > display@0 { > reg = <0>; > compatible = "sitronix,st7796s"; > spi-max-frequency = <50000000>; > rotation = <0>; > reset-gpios = <&pio 4 0 GPIO_ACTIVE_LOW>; //PE0 > dc-gpios = <&pio 4 1 GPIO_ACTIVE_HIGH>; //PE1 > debug = <0>; > status = "okay"; > }; > > mcp2518fd@1 { > reg = <1>; > compatible = "microchip,mcp25xxfd"; > pinctrl-names = "default"; > pinctrl-0 = <&can0_pin_irq>; > spi-max-frequency = <9090909>; Why that frequency? > interrupt-parent = <&pio>; > interrupts-extended = <1 0 8>; //PB2 is IRQ - IRQ_TYPE_LOW = 8 Using both interrupt-parent and interrupts-extended is wrong. For the allwinner H3 this works. Note: it uses a different interrupt pin. interrupt-parent = <&pio>; interrupts = <0 21 IRQ_TYPE_LEVEL_LOW>; /* PA21 */ > clocks = <&can0_osc_fixed>; > status = "okay"; > }; > > }; Marc -- Pengutronix e.K. | Marc Kleine-Budde | Embedded Linux | https://www.pengutronix.de | Vertretung West/Dortmund | Phone: +49-231-2826-924 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Attachment:
signature.asc
Description: OpenPGP digital signature