我怎样才能使用mcp2515&设备树?

时间:2016-11-25 05:56:02

标签: linux-device-driver spi can-bus device-tree

My Kernel Source将平台数据写入设备树。(内核版本3.10.9)

使用的电路板是Exynos5422。

所以我将mcp2515平台数据参数写入.dts

DTS:

spi_1: spi@12d30000 {

            status = "okay";
            spi-src-clk = <0>;
            num-cs = <1>;
            gpios = <&gpa2 4 0>,
                    <&gpa2 6 0>,
                    <&gpa2 7 0>;

            can1: mcp251x@0{
                    compatible ="microchip,mcp2515";
                    reg = <0>;
                    spi-max-frequency = <2000000>;
                    pinctrl-names = "default";
                    pinctr-0=<&mcp_irq>;
                    interrupts = < 0 0 0 >;
                    interrupt-parent = <&gpx1>;
                    irq_gpio = <&gpx1 5 0>;
                    reset_gpio = <&gph0 1 0>;
                    controller-data {
                            cs-gpio = <&gpa2 5 0>;
                            samsung,spi-feedback-delay = <0>;
                     };
            };

 };

 mcp_irq: mcp_irq {
                    samsung,pins = "gpx1-5";
                    samsung,pin-function = <0xf>;
                    samsung,pin-pud = <3>;
                    samsung,pin-drv = <3>;

};

当以下分配失败时,pdata为空,导致下面出现致命错误。

struct mcp251x_platform_data * pdata = spi-&gt; dev.platform_data

mcp251x.c:

if (!pdata) {
    /* Platform data is required for osc freq */
    goto error_out;

}

设置:

enter image description here

enter image description here

我错过了什么?

0 个答案:

没有答案