All of lore.kernel.org
 help / color / mirror / Atom feed
* [mcp251x] Using MCP2515 with half duplex driver fails on init
@ 2021-03-30  7:10 Gerhard Bertelsmann
  2021-03-30 10:04 ` Marc Kleine-Budde
  0 siblings, 1 reply; 3+ messages in thread
From: Gerhard Bertelsmann @ 2021-03-30  7:10 UTC (permalink / raw)
  To: linux-can

Hi,

I'm trying to get a MCP2515 working with an OpenWRT router connected to 
the
second SPI channel (CS1). The first one is used by the flash. Here the 
error
message while loading the mcp251x module (Kernel 5.10.26):

[  112.226164] mcp251x spi0.1: spi transfer failed: ret = -22
[  112.231810] mcp251x spi0.1: Probe failed, err=22
[  112.237021] mcp251x: probe of spi0.1 failed with error -22

The DTS part looks like:

/ {
         compatible = "onion,omega2", "mediatek,mt7628an-soc";
};
...
&spi0 {
         status = "okay";

         pinctrl-names = "default";
         pinctrl-0 = <&spi_pins>, <&spi_cs1_pins>;

         flash@0 {
                 compatible = "jedec,spi-nor";
                 reg = <0>;
                 spi-max-frequency = <40000000>;
                 ...
         };
         can0: can@1 {
                 compatible = "microchip,mcp2515";
                 reg = <1>;
                 clock-frequency = <8000000>;
                 interrupt-parent = <&gpio>;
                 interrupts = <16 8>;
                 spi-max-frequency = <10000000>;
         };
};

I don't see any activity on the SPI bus/CS1 line. A cross check with 
spidev
using following DTS sequence instead of can0:

         spidev@1 {
                 #address-cells = <1>;
                 #size-cells = <1>;
                 compatible = "rohm,dh2228fv";
                 reg = <1>;
                 spi-max-frequency = <100000>;
         };

shows, that the setup using SPI bus with CS1 is working.

Of course, sharing the SPI bus with the flash isn't the best performance
practice, but it should be ok because when the programms are loaded, 
it's
unlikely that the SPI bus is occupied by the routers flash system 
anymore.

Does anybody have a hint why the init fails ?

Regards

Gerd

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [mcp251x] Using MCP2515 with half duplex driver fails on init
  2021-03-30  7:10 [mcp251x] Using MCP2515 with half duplex driver fails on init Gerhard Bertelsmann
@ 2021-03-30 10:04 ` Marc Kleine-Budde
  2021-03-30 16:08   ` Gerhard Bertelsmann
  0 siblings, 1 reply; 3+ messages in thread
From: Marc Kleine-Budde @ 2021-03-30 10:04 UTC (permalink / raw)
  To: Gerhard Bertelsmann; +Cc: linux-can

[-- Attachment #1: Type: text/plain, Size: 693 bytes --]

On 30.03.2021 09:10:10, Gerhard Bertelsmann wrote:
> I'm trying to get a MCP2515 working with an OpenWRT router connected to the
> second SPI channel (CS1). The first one is used by the flash. Here the error
> message while loading the mcp251x module (Kernel 5.10.26):

Can you try the patch I just send to the mailing list?

https://lore.kernel.org/r/20210330100246.1074375-1-mkl@pengutronix.de

regards,
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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [mcp251x] Using MCP2515 with half duplex driver fails on init
  2021-03-30 10:04 ` Marc Kleine-Budde
@ 2021-03-30 16:08   ` Gerhard Bertelsmann
  0 siblings, 0 replies; 3+ messages in thread
From: Gerhard Bertelsmann @ 2021-03-30 16:08 UTC (permalink / raw)
  To: Marc Kleine-Budde; +Cc: linux-can

Hi Marc,

Am 2021-03-30 12:04, schrieb Marc Kleine-Budde:
> On 30.03.2021 09:10:10, Gerhard Bertelsmann wrote:
>> I'm trying to get a MCP2515 working with an OpenWRT router connected 
>> to the
>> second SPI channel (CS1). The first one is used by the flash. Here the 
>> error
>> message while loading the mcp251x module (Kernel 5.10.26):
> 
> Can you try the patch I just send to the mailing list?
> 
> https://lore.kernel.org/r/20210330100246.1074375-1-mkl@pengutronix.de

that looks much better now:
[  491.356961] mcp251x spi0.1 can0: MCP2515 successfully initialized.

I have to fix the GPIO irq before I can test the whole driver and giving
the Tested-by tag.

Thx for your fast help.

Regards

Gerd

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-03-30 16:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-30  7:10 [mcp251x] Using MCP2515 with half duplex driver fails on init Gerhard Bertelsmann
2021-03-30 10:04 ` Marc Kleine-Budde
2021-03-30 16:08   ` Gerhard Bertelsmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.