This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

I2C设备驱动



大家好,正在使用BBB板进行i2c驱动程序编写,在设备树里设置如下:

reg = <0x34>;

pinctrl-names = "default";
pinctrl-0 = <&i2cinput_irq_pins>;
irq-gpios = <&gpio1 28 GPIO_ACTIVE_LOW>;
status = "okay";

//#address-cells = <1>;
//#size-cells = <1>;
interrupt-parent = <&gpio1>;
interrupts = <28 0>; //IRQ_TYPE_EDGE_BOTH

其中interrupts不能设置为<28 非0>,如果设置的话加载驱动的时候报错,错误如下;

irq: type mismatch, failed to map hwirq----

想请教下,问题出在哪里呢?另外如果i2c设备不采用gpio方式中断的话,那可以采用i2c软中断吗?可以的话怎么使用?设备树如何修改呢?谢谢!

  • 请问是使用的哪个版本的SDK?
    参考processor-sdk-linux-4.19.y\arch\arm\boot\dts\am33xx.dtsi 中的配置看一下。
    i2c0: i2c@44e0b000 {
    compatible = "ti,omap4-i2c";
    #address-cells = <1>;
    #size-cells = <0>;
    ti,hwmods = "i2c1";
    reg = <0x44e0b000 0x1000>;
    interrupts = <70>;
    status = "disabled";
    };