simon

simon

0个粉丝

1

问答

0

专栏

0

资料

simon  发布于  2024-11-06 09:53:12
采纳率 0%
1个问答
82

mcp251xfd内核驱动无法获取到spi->irq

   

内核版本5.10,芯片Hi3519DV500,系统spi3.1挂载一个mcp2518fd芯片(linux-5.10\drivers\net\can\spi\mcp251xfd)。
设备树修改如下:
open_source/linux/linux-5.10.y/arch/arm64/boot/dts/vendor/hi3519dv500-demb.dts

...
...
&spi_bus3{
    status = "okay";
    // #address-cells = <1>;
    // #size-cells = <0>;
    spidev@0 {
        compatible = "rohm,dh2228fv";
        reg = <0>;
        pl022,interface = <0>;
        pl022,com-mode = <0>;
        spi-max-frequency = <25000000>;
    };

    // spidev@1 {
    //  compatible = "rohm,dh2228fv";
    //  reg = <1>;
    //  pl022,interface = <0>;
    //  pl022,com-mode = <0>;
    //  spi-max-frequency = <25000000>;
    // };
    can1:can@1 {
        status = "okay";
        compatible = "microchip,mcp2518fd";
        // compatible = "rohm,dh2228fv";
        clocks = <&can1_clk>;
        reg = <1>;
        // pl022,interface = <0>;
        // pl022,com-mode = <0>;
        spi-cpol;    // CPOL = 1  
        spi-cpha;    // CPHA = 1 
        spi-max-frequency = <20000000>;
        rx-int-gpio = <&gpio_chip5 3 GPIO_ACTIVE_HIGH>;
        interrupt-parent = <&gpio_chip5>;
        interrupts= <3 IRQ_TYPE_LEVEL_LOW>;         
    };

};

&gpio_chip0 {
    status = "okay";
};
&gpio_chip1 {
    status = "okay";
};
&gpio_chip2 {
    status = "okay";
};
&gpio_chip3 {
    status = "okay";
};
&gpio_chip4 {
    status = "okay";
};
&gpio_chip5 {
    status = "okay";
    interrupt-controller;
};
...
...

open_source/linux/linux-5.10.y/arch/arm64/boot/dts/vendor/hi3519dv500.dtsi

    soc {
        #address-cells = <1>;
        #size-cells = <1>;
        compatible = "simple-bus";
        device_type = "soc";
        ranges = <0x0 0x00000000 0x0 0xffffffff>;

        clk_3m: clk_3m {
            compatible = "fixed-clock";
            #clock-cells = <0>;
            clock-frequency = <3000000>;
        };
        can0_clk: can0_clk {
            compatible = "fixed-clock";
            #clock-cells = <0>;
            clock-frequency = <40000000>;
        };
        can1_clk: can1_clk {
            compatible = "fixed-clock";
            #clock-cells = <0>;
            clock-frequency = <40000000>;
        };
        ...
        ...

内核配置:

CONFIG_CAN=y
CONFIG_CAN_RAW=y
CONFIG_CAN_BCM=y
CONFIG_CAN_GW=y
CONFIG_CAN_DEV=y
CONFIG_CAN_CALC_BITTIMING=y
CONFIG_CAN_MCP251XFD=m
CONFIG_CAN_MCP251XFD_SANITY=y

编译模块进行加载后,报错 : No IRQ specified (maybe node “interrupts-extended” in DT missing)!

static int mcp251xfd_probe(struct spi_device *spi)
{
    const void *match;
    struct net_device *ndev;
    struct mcp251xfd_priv *priv;
    struct gpio_desc *rx_int;
    struct regulator *reg_vdd, *reg_xceiver;
    struct clk *clk;
    u32 freq;
    int err;

    if (!spi->irq)
        return dev_err_probe(&spi->dev, -ENXIO,
                     "No IRQ specified (maybe node \"interrupts-extended\" in DT missing)!\n");

    rx_int = devm_gpiod_get_optional(&spi->dev, "rx-int-gpio",
                     GPIOD_IN);
    if (PTR_ERR(rx_int) == -EPROBE_DEFER)
        return -EPROBE_DEFER;
    else if (IS_ERR(rx_int))
        return PTR_ERR(rx_int);
...
...

内核spi.c文件中添加相关的调试信息:

of_irq_get print , of_irq_parse_one -75
spi_drv_probe test print  spi->irq -75
spi_drv_probe test print  spi->irq 0

根据手册《外围设备驱动操作指南》

关闭内核中gpio5,使用gpio_request驱动中无法获取gpio相关资源

所以目前设备树中gpio5配置状态是okay

请问如上问题是设备树写错了?还是哪里配置不对?

我来回答
回答0个
时间排序
认可量排序
易百纳技术社区暂无数据
或将文件直接拖到这里
悬赏:
E币
网盘
* 网盘链接:
* 提取码:
悬赏:
E币

Markdown 语法

  • 加粗**内容**
  • 斜体*内容*
  • 删除线~~内容~~
  • 引用> 引用内容
  • 代码`代码`
  • 代码块```编程语言↵代码```
  • 链接[链接标题](url)
  • 无序列表- 内容
  • 有序列表1. 内容
  • 缩进内容
  • 图片![alt](url)
+ 添加网盘链接/附件

Markdown 语法

  • 加粗**内容**
  • 斜体*内容*
  • 删除线~~内容~~
  • 引用> 引用内容
  • 代码`代码`
  • 代码块```编程语言↵代码```
  • 链接[链接标题](url)
  • 无序列表- 内容
  • 有序列表1. 内容
  • 缩进内容
  • 图片![alt](url)
举报反馈

举报类型

  • 内容涉黄/赌/毒
  • 内容侵权/抄袭
  • 政治相关
  • 涉嫌广告
  • 侮辱谩骂
  • 其他

详细说明

易百纳技术社区