A árvore de dispositivos BeagleBoneBlack é alterada para adicionar o driver de dispositivo i2c ()

1

Estou tentando executar um driver de dispositivo i2c no BeagleBoneBlack usando pinos i2c2 [P9]: (19) I2C2_SCL, (20) I2C2_SDA.

Eu posso usar i2c2 com sucesso a partir do espaço do usuário para controlar o mesmo dispositivo touchscreen atmel, mas quando se trata de usá-lo a partir do driver do dispositivo, no momento da análise, recebo erro -16 (ocupado).

O driver de dispositivo é link que estou criando estaticamente no kernel (drivers / entrada / touchscreen / atmel_mxt_ts.c).

Adicionei o seguinte ao arquivo de origem da árvore de dispositivos arch / arm / boot / dts / am335x-boneblack.dts :

&i2c2 {
    atmel_mxt_ts@4b {
        compatible = "atmel,atmel_mxt_ts";
        #address-cells = <1>;
        #size-cells = <0>;
        reg = <0x4b>;
        atmel,reset-gpio = <&gpio1 28 0x00>;
        atmel,irq-gpio = <&gpio1 16 0x00>;
        atmel,suspend-mode = <0x01>;
        atmel,input_name = "SSLUK";
    };
};

Que está expandindo arch / arm / boot / dts / am33xx.dtsi e arch / arm / boot / dts / am335x-bone-common.dtsi :

    i2c2: i2c@4819c000 {
        compatible = "ti,omap4-i2c";
        #address-cells = <1>;
        #size-cells = <0>;
        ti,hwmods = "i2c3";
        reg = <0x4819c000 0x1000>;
        interrupts = <30>;
        status = "disabled";
    };

&i2c2 {
    pinctrl-names = "default";
    pinctrl-0 = <>;

    status = "okay";
    clock-frequency = <100000>;

E o driver de dispositivo parece ser adicionado com sucesso no barramento, mas cada i2c_transfer falha com o valor de retorno -16, então a sonda falha.

Do log do kernel:

[    0.879536] atmel_mxt_ts 2-004b: mxt_probe i2c-2-004b/input0
[    0.879546] atmel_mxt_ts 2-004b: mxt_probe mxtdata->fw_name: (null), mxtdata->cfg_name: (null)
[    0.879581] atmel_mxt_ts 2-004b: mxt_initialize
[    1.887051] omap_i2c 4819c000.i2c: timeout waiting for bus ready
[    1.887069] atmel_mxt_ts 2-004b: __mxt_read_reg: i2c_transfer ret_val -16
[    2.935039] omap_i2c 4819c000.i2c: timeout waiting for bus ready
[    2.935049] atmel_mxt_ts 2-004b: __mxt_read_reg: i2c_transfer ret_val -16
[    3.947044] omap_i2c 4819c000.i2c: timeout waiting for bus ready
[    3.947059] atmel_mxt_ts 2-004b: mxt_bootloader_read: i2c_transfer ret_val -16
[    3.954340] atmel_mxt_ts 2-004b: mxt_bootloader_read: retry 1
[    5.007040] omap_i2c 4819c000.i2c: timeout waiting for bus ready
[    5.007050] atmel_mxt_ts 2-004b: mxt_bootloader_read: i2c_transfer ret_val -16
[    5.014329] atmel_mxt_ts 2-004b: mxt_probe_bootloader, 907, buf[0] = 68, buf[1] = 2e, buf[2] = c0, error = -16
[    5.014337] atmel_mxt_ts 2-004b: Trying alternate bootloader address
[    6.019042] omap_i2c 4819c000.i2c: timeout waiting for bus ready
[    6.019059] i2c i2c-2: SCL is stuck low, exit recovery
[    6.024248] atmel_mxt_ts 2-004b: mxt_bootloader_read: i2c_transfer ret_val -16
[    6.031521] atmel_mxt_ts 2-004b: mxt_bootloader_read: retry 1
[    7.083040] omap_i2c 4819c000.i2c: timeout waiting for bus ready
[    7.083050] atmel_mxt_ts 2-004b: mxt_bootloader_read: i2c_transfer ret_val -16
[    7.090329] atmel_mxt_ts 2-004b: mxt_probe_bootloader, 907, buf[0] = dc, buf[1] = 13, buf[2] = dc, error = -16
[    7.090630] atmel_mxt_ts 2-004b: mxt_probe error
[    7.090657] atmel_mxt_ts: probe of 2-004b failed with error -16

O kernel é 4.14.25 do link

UPDATE Construindo o driver de dispositivo como um módulo e executando o insmod do espaço do usuário, funcionou:

sudo insmod atmel_mxt_ts.ko

Com o log do kernel:

[  150.125216] atmel_mxt_ts 2-004b: mxt_probe i2c-2-004b/input0
[  150.125235] atmel_mxt_ts 2-004b: mxt_probe mxtdata->fw_name: (null), mxtdata->cfg_name: (null)
[  150.125295] atmel_mxt_ts 2-004b: mxt_initialize
[  150.167071] atmel_mxt_ts 2-004b: Family: 164 Variant: 11 Firmware V1.6.01 Objects: 34
[  150.167092] atmel_mxt_ts 2-004b: mxt_parse_object_table, object_num = 34
...
[  150.168174] atmel_mxt_ts 2-004b: Enabling RETRIGEN workaround
[  150.168617] atmel_mxt_ts 2-004b: mxt_acquire_irq mxtdata->irq = 86
[  150.224908] atmel_mxt_ts 2-004b: mxt_acquire_irq OK
[  150.224993] atmel_mxt_ts 2-004b: mxt_configure_objects
[  150.228762] atmel_mxt_ts 2-004b: Touchscreen size X1023Y1023
[  150.229141] input: SSLUK as /devices/platform/ocp/4819c000.i2c/i2c-2/2-004b/input/input1
[  150.229170] atmel_mxt_ts 2-004b: mxt_initialize OK
[  150.229178] atmel_mxt_ts 2-004b: mxt_probe OK
    
por giuspen 04.04.2018 / 18:11

0 respostas