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.

Linux/PROCESSOR-SDK-DRA7X: Ask to proof interrupt configuration

Part Number: PROCESSOR-SDK-DRA7X

Tool/software: Linux

Hallo,

I configured a device to use an interrupt and I ask you to proof my configuration, please. I'm a newbie in this.

In the schematic of the board I the GPIO a wanted to use is GP6[20]. So I think this GPIO is 6x32+20 = 212, right?

Devcie Tree: (Node of the device)

qca7000@0 {
				compatible = "qca,qca7000";
				reg = <0>;
				interrupt-parent = <&gpio6>;
				interrupts = <20 1>;           
				spi-cpha;                         
				spi-cpol;                         
				spi-max-frequency = <8000000>; 
				local-mac-address = [ FA DB 12 79 8C 9D ];
				/*qca,legacy-mode;*/
			};

This device is on CS0 of SPI1. SPI1 works. I tested this with spidev_test by connecting MISO and MOSI.

Is the the right interrupt configuration in the Device Tree?

cat /proc/interrupts: (eth2 is the device from above)

223:        876          0  4805d000.gpio  20 Edge      eth2

This is the GPIO-Bank:

gpio6: gpio@4805d000 {
			compatible = "ti,omap4-gpio";
			reg = <0x4805d000 0x200>;
			interrupts = <GIC_SPI 29 IRQ_TYPE_LEVEL_HIGH>;
			ti,hwmods = "gpio6";
			gpio-controller;
			#gpio-cells = <2>;
			interrupt-controller;
			#interrupt-cells = <2>;
		};

So. In my opinion the interrupt was correctly configured, right?

Thanks.

  • Hello,

    The configuration seems correct. You can also check by doing a cat on /sys/kernel/debug/gpio (cat /sys/kernel/debug/gpio) It should aswell show the gpio pin configured as IRQ.
    One more thing to verify would be to check the pinmux for GP6[20] is that configured correctly.

    Cheers,
    --Prabhakar Lad
  • Hallo,

    the GPIO-212 doesn't apper in /sys/kernel/debug/gpio. So I think I have to pinmux this pin. This document (http://www.ti.com/lit/ug/sprui50/sprui50.pdf

    says on page 28 in the last column: XREF_CLK3 - GPIO6_20 - (C23). So, I think I have to mux this pin. I haven't go the Pad Config Tool, yet. Could I mux this pin without that? And how? I am using the device tree dra7.dtsi.

    Greetings

    edit:

    Is it right, that I could config the pinmuxes in u-boot? So u-boot is responsible for pinmuxing?

    I think in board/ti/dra7xx/mux_data.h there is the right pin:

    {XREF_CLK3, (M14 | PIN_INPUT)},		/* xref_clk3.gpio6_20 */

    It is defined in arch/arm/include/asm/arch-omap4/mux_dra7xx.h.

    The interrupt will be triggered on a rising edge. So, I have to set PIN_INPUT_PULLDOWN?

    Which mode I have to set here to use gpio6_20? There are M0 - M15 modes.

  • Hello,

    For GPIO6_20 it needs to be M14, which is being set correct in uboot, try with PIN_INPUT if it doesnt work change it to PIN_INPUT_PULLDOWN.

    What is the output of cat /sys/kernel/debug/gpio ? Is the qca,qca7000 module loaded ? Do you get any errors ?

    Cheers,
    --Prabhakar Lad
  • Prabhakar Lad said:
    For GPIO6_20 it needs to be M14, which is being set correct in uboot, try with PIN_INPUT if it doesnt work change it to PIN_INPUT_PULLDOWN.

    Both don't work, Are you sure M14 is right? I thought M14 is for xref_clk3. Is there a documentation for the modes?

    Prabhakar Lad said:
    What is the output of cat /sys/kernel/debug/gpio ? Is the qca,qca7000 module loaded ? Do you get any errors ?

    /sys/kernel/debug/gpio

    GPIOs 0-31, platform/4ae10000.gpio, gpio:
    
    GPIOs 32-63, platform/48055000.gpio, gpio:
    
    GPIOs 64-95, platform/48057000.gpio, gpio:
    
    GPIOs 96-127, platform/48059000.gpio, gpio:
    
    GPIOs 128-159, platform/4805b000.gpio, gpio:
     gpio-136 (                    |vmmcwl_fixed        ) out lo    
    
    GPIOs 160-191, platform/4805d000.gpio, gpio:
     gpio-161 (                    |radio_rst           ) out hi    
     gpio-187 (                    |cd                  ) in  lo IRQ
    
    GPIOs 192-223, platform/48051000.gpio, gpio:
     gpio-203 (                    |vtt_fixed           ) out hi    
     gpio-204 (                    |hdmi_hpd            ) in  lo IRQ
    
    GPIOs 224-255, platform/48053000.gpio, gpio:
    
    GPIOs 462-477, i2c/1-0026, pcf8575, can sleep:
     gpio-463 (                    |vin6_sel_s0         ) out lo    
     gpio-466 (                    |hdmi_ct_cp_hpd      ) out hi    
     gpio-467 (                    |hdmi_ls_oe          ) out lo    
    
    GPIOs 478-493, i2c/0-0021, pcf8575, can sleep:
     gpio-479 (                    |id                  ) in  hi IRQ
     gpio-480 (                    |id                  ) in  hi IRQ
     gpio-483 (                    |evm_3v3_sd          ) out hi    
    
    GPIOs 494-509, i2c/0-0020, pcf8575, can sleep:
     gpio-496 (                    |btnUser1            ) in  hi IRQ
     gpio-497 (                    |btnUser2            ) in  hi IRQ
     gpio-498 (                    |?                   ) out hi    
     gpio-499 (                    |?                   ) out hi    
     gpio-500 (                    |?                   ) out hi    
     gpio-501 (                    |?                   ) out hi    
    
    GPIOs 510-511, platform/50000000.gpmc, omap-gpmc:
    

    I think there has to be gpio-212 to appear with in hi IRQ, right?

    The modul is loaded:

    dmesg | grep qca

    [    6.226432] qcaspi spi1.0: ver=0.2.7-i, clkspeed=8000000, burst_len=5000, pluggable=1

    lsmod | grep qca

    qcaspi                 14970  0

    There are errors in dmesg, but I think there are not in dependencie with the IRQ

    dmesg | grep err

    [    0.691112] omap4_sram_init:Unable to allocate sram needed to handle errata I688
    [    0.698806] omap4_sram_init:Unable to get sram pool needed to handle errata I688
    [    0.982615] pcf857x: probe of 3-0021 failed with error -121
    [    1.346168] pcieport 0000:00:00.0: Signaling PME through PCIe PME interrupt
    [    1.377071] fpd3_serdes: probe of 7-002c failed with error -5
    [    1.768762] ov1063x: probe of 1-0037 failed with error -121
    [    5.902328]  remoteproc0: Direct firmware load for dra7-ipu1-fw.xem4 failed with error -2
    [    6.052063]  remoteproc1: Direct firmware load for dra7-ipu2-fw.xem4 failed with error -2
    [    6.156329]  remoteproc2: Direct firmware load for dra7-dsp1-fw.xe66 failed with error -2
    [    6.295772]  remoteproc3: Direct firmware load for dra7-dsp2-fw.xe66 failed with error -2

    I also disabled CONFIG_OMAP_MUX in the Kernel to get the pinmux from u-boot.

    Thats what U-Boot says to my board:

    CPU  : DRA752-GP ES2.0
    Model: TI DRA742
    Board: DRA74x EVM REV H.0
    DRAM:  4 GiB
    MMC:   OMAP SD/MMC: 0, OMAP SD/MMC: 1
    SCSI:  SATA link 0 timeout.
    AHCI 0001.0300 32 slots 1 ports 3 Gbps 0x1 impl SATA mode
    flags: 64bit ncq stag pm led clo only pmp pio slum part ccc apst 

    So, I think I am in the right files.

  • Hello,

    1] Referring to [1] page 93, M14 is to select gpio6_20. I didnt try much to find the base address of pinmux, you can use devmem2
    and check the value at that address.

    2] No it needs to be gpio-180, because base of gpio6 is 160, gpio6_20 will be = 160 + 20 = 180

    Example:
    GPIOs 160-191, platform/4805d000.gpio, gpio:
    gpio-161 ( |radio_rst ) out hi
    gpio-180 ( |xx ) in lo IRQ
    gpio-187 ( |cd ) in lo IRQ

    3] Can you scope the pin gpio6_20 ? If yes comment the following DT node

    qca7000@0 {
    compatible = "qca,qca7000";
    reg = <0>;
    interrupt-parent = <&gpio6>;
    interrupts = <20 1>;
    spi-cpha;
    spi-cpol;
    spi-max-frequency = <8000000>;
    local-mac-address = [ FA DB 12 79 8C 9D ];
    /*qca,legacy-mode;*/
    };
    Then follow [2] to set it as output and change the values from 1/0 and see if desired result is
    obtained on the scope

    [1] www.ti.com/.../dra746.pdf
    [2] elinux.org/GPIO

    Cheers,
    --Prabhakar Lad
  • Hallo,

    Manual GPIO handling via sysfs with QCA-Node:

    root@dra7xx-evm:/sys/class/gpio# echo 180 >> export 
    root@dra7xx-evm:/sys/class/gpio# cat gpio180/direction 
    in
    root@dra7xx-evm:/sys/class/gpio# echo out >> gpio180/direction 
    [   45.843756] gpio-180 (sysfs): _gpiod_direction_output_raw: tried to set a GPIO tied to an IRQ as output
    -sh: echo: write error: Input/output error

    cat /sys/kernel/debug/gpio

    GPIOs 160-191, platform/4805d000.gpio, gpio:
     gpio-161 (                    |radio_rst           ) out hi    
     gpio-180 (                    |sysfs               ) in  hi IRQ
     gpio-187 (                    |cd                  ) in  lo IRQ

    The IRQ is there but it is hi and not lo and not set by the driver.

    Manual GPIO handling via sysfs without QCA-Node:

    I can set everyrthing without errors and I can scope the 3,3V on high and 0V on low.

    After that I tried to set the GPIO default direction to 'out' from 'in' in the U-Boot source in board/ti/dra7xx/mux_data.h from

    {XREF_CLK3, {M14 | PIN_OUTPUT}} to {XREF_CLK3, {M14 | PIN_INPUT}}

    to proof, that I am in the right file. In my opinion, if I activate the GPIO 180 (echo 180 >> /sys/class/gpio/export) the direction have to change to 'out' but it is still 'in'.

    Is it possible that I'm in the wrong file? The pinmuxing is done by U-Boot?

    Greetings

  • Hallo,

    is it possible that the interrupt were not exported to debugfs? Is a subsystem responsible for this? Or is the driver responsible?

    In /proc/interrupts the second row (I think it es the counter, now 390) increments by time.

    223:        390          0  4805d000.gpio  20 Edge      eth2
    

    So, with this and the post above, is it possible that the interrupt were correct recognized by the kernel, but I don't see this?

    Greetings