I've been trying to get an MCP2515 can controller working on a spi-gpio bus in my device tree, but the MCP251x driver's probe function never seems to actually be called. Oddly enough though, some probe function somewhere is being called because it returns -EPROBE_DEFER
.
I modified /drivers/base/dd.c
with a bunch of dev_dbg print calls to find out where I was actually returning from.
https://github.com/torvalds/linux/blob/v4.14/drivers/base/dd.c
On line 416 is where the driver probe is getting deferred
else if (drv->probe) {
ret = drv->probe(dev);
if (ret)
goto probe_failed;
}
If I add in a debug statement to this, I can see that the drv
variable's name is MCP251x, which matches the driver.
dev_dbg(dev, "%s line %d ret: %d\n", drv->name, __LINE__,ret);
So I add some debug statements to the MCP251x driver's mcp251x_can_probe
function
https://github.com/torvalds/linux/blob/v4.14/drivers/net/can/spi/mcp251x.c
I never see any of the debug prints from the MCP251x's probe function. Why? I can't figure out why this probe function isn't being called, but something is managing to return -EPROBE_DEFER
.
I don't know if there's some intermediary spi probe function being called that I'm not aware of or what, but it never makes it to the MCP251x's probe.
Here's the relevant snippet of my device tree just in case.
spi1{
compatible = "spi-gpio";
status="okay";
#address-cells = <0x1>;
ranges;
gpio-sck = <&gpio0 4 0>;
gpio-miso = <&gpio0 5 0>;
gpio-mosi = <&gpio0 19 0>;
cs-gpios = <&gpio0 18 1>;
num-chipselects = <1>;
can0: mcp2515@0 {
compatible = "microchip,mcp2515";
reg = <0>;
status = "okay";
clocks = <&mcp2515_clk>;
interrupt-parent = <&gpio0>;
interrupts = <11 0x2>; //falling edge
spi-max-frequency = <10000000>;
mcp2515_clk: oscillator {
#clock-cells = <0>;
compatible = "fixed-clock";
clock-frequency = <8000000>; //8MHz
};
};
};