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/AM5728: Clearing WiLink8 GPIO interrupt event

Part Number: AM5728


Tool/software: Linux

In our last project we integrated a Wilink 8 with a Renesas ARM processor and had to modify the wlcore_irq() function in the wlcore Linux Kernel driver to clear the interrupt ( WLAN_IRQ ) in order for the radio to work properly. If we did not clear it, the scope showed that the line remained high and the radio did not function.

 To clear it we did this:

         // OUR CUSTOMIZATION

        void __iomem *irc1 = IOMEM(0xfcfef804);

        u16 value;

        value = __raw_readw(irc1);

        value = 0x0000;

        __raw_writew(value, irc1);

 

On the AM5728, I am seeing the same behavior with the GPIO IRQ remaining high and so I believe I need to clear it. I did not find anything in the forum as an example of how to do this.

When I searched the TRM, page 6875 ( and the previous few pages ) show the GPIO_IRQSTATUS_CLR_X registers. The description says “Writing 1 to a bit disables the corresponding interrupt event.”. Does that mean clearing it?

 My GPIO is muxed as GPIO 1_25:

        wlan_pins_default: wlan_pins_default {
                pinctrl-single,pins = <
-                       0x234 (PIN_OUTPUT_PULLDOWN | MUX_MODE14) /* mmc3_dat6.gpio1_24 */
-                       0x1c8 (PIN_INPUT_PULLDOWN | MUX_MODE14)  /* mmc3_dat7.gpio1_25 */
+                       0x39c (PIN_OUTPUT_PULLDOWN | MUX_MODE14) /* mmc3_dat6.gpio1_24 */
+                       0x3a0 (PIN_INPUT_PULLDOWN | MUX_MODE14)  /* mmc3_dat7.gpio1_25 */
                >;
        };

 How might I clear this IRQ Event? Thanks.

  • Hi,

    Please ask on the WiLink forum: e2e.ti.com/.../307
  • Hi Biser,

    I will do that, but the question is really how to clear an IRQ event by writing to a register on the AM5728.

    For instance, is GPIO_IRQSTATUS_CLR_X the correct register?

    Thanks,

    Phil
  • It should be the GPIO_IRQSTATUS_X register. Writing 1 to a bit will clear it to 0. Writing 0 has no effect.
  • I tried the following:

    int *clearInterrupt = 0x4ae10030;
    
    writel(0x1,clearInterrupt);

    That resulted in the kernel traceback:

    [   29.444940] Unable to handle kernel paging request at virtual address 4ae10030
    [   29.452219] pgd = eda336c0
    [   29.454937] [4ae10030] *pgd=00000000
    [   29.458556] Internal error: Oops: a05 [#1] PREEMPT SMP ARM
    [   29.464064] Modules linked in: arc4 wl18xx wlcore mac80211 snd_soc_omap_hdmi_audio snd_soc_omap snd_soc_core snd_pcm_dmaengine snd_pcm cfg80211 snd_timer rpmsg_rpc omapdrm snd soundcore virtio_rpmsg_bus drm_kms_helper syscopyarea bc_example(O) sysfillrect sysimgblt fb_sys_fops omapdss encoder_tpd12s015 panel_dpi connector_hdmi pru_rproc omapdss_base pruss_intc phy_omap_usb2 pruss phy_ti_pipe3 omap_wdt phy_omap_control ti_vpe ti_vip ti_sc ti_csc ti_vpdma videobuf2_dma_contig v4l2_mem2mem videobuf2_memops videobuf2_v4l2 dwc3_omap videobuf2_core extcon pvrsrvkm(O) rtc_omap drm flk_ti_mt9p031 aptina_pll v4l2_common pwm_tiehrpwm videodev wlcore_sdio rtc_palmas media spi_omap2_mcspi omap_remoteproc remoteproc virtio virtio_ring uio_pdrv_genirq uio cryptodev(O) autofs4
    [   29.533534] CPU: 1 PID: 664 Comm: ifconfig Tainted: G           O    4.4.41 #19
    [   29.540873] Hardware name: Generic DRA74X (Flattened Device Tree)
    [   29.546991] task: ee321200 ti: ed6a6000 task.ti: ed6a6000
    [   29.552457] PC is at wl1271_op_add_interface+0x860/0x974 [wlcore]
    [   29.558580] LR is at arm_heavy_mb+0x24/0x28
    [   29.562781] pc : [<bf5f3088>]    lr : [<c001bf80>]    psr: a00e0013
    [   29.562781] sp : ed6a7d38  ip : ed6a7d28  fp : ed6a7d94
    [   29.574307] r10: ee21cba8  r9 : 00000003  r8 : 00000000
    [   29.579551] r7 : ed6b8d3c  r6 : bf60d880  r5 : ed6b8d00  r4 : ee21caa8
    [   29.586105] r3 : fe600000  r2 : 4ae10000  r1 : 00000001  r0 : 00000028
    [   29.592659] Flags: NzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
    [   29.599823] Control: 30c5387d  Table: ada336c0  DAC: 55555555
    [   29.605592] Process ifconfig (pid: 664, stack limit = 0xed6a6210)
    [   29.611708] Stack: (0xed6a7d38 to 0xed6a8000)
    [   29.616084] 7d20:                                                       ed6a7dac ee21caa8
    [   29.624297] 7d40: ed6b8160 ed6b8d7c ee21cb88 ee21cbac 00000000 ee21caa8 00000000 00000000
    [   29.632510] 7d60: ee21caa8 00000000 00000000 ee21c4c0 ed6b83e0 ee21c000 ee21c030 ee21c4c0
    [   29.640723] 7d80: 00000001 ffffffff ed6a7dac ed6a7d98 bf581f10 bf5f2834 ee21c4c8 ed6b83e0
    [   29.648934] 7da0: ed6a7de4 ed6a7db0 bf592890 bf581ee4 ed6a7de4 00000000 bf5905cc ee21c4c0
    [   29.657146] 7dc0: 00001043 bf5be6a0 ee21c030 00000000 00000000 000000ca ed6a7dfc ed6a7de8
    [   29.665358] 7de0: bf592dd4 bf592480 ee21c000 00001043 ed6a7e24 ed6a7e00 c03e538c bf592d88
    [   29.673570] 7e00: ed6a7e24 ee21c000 ee21c000 00001043 00000001 00001002 ed6a7e4c ed6a7e28
    [   29.681782] 7e20: c03e5648 c03e52e8 ee21c000 ee21c138 00001002 edc6840c 00000000 00000000
    [   29.689993] 7e40: ed6a7e74 ed6a7e50 c03e5718 c03e55b8 00000000 ed6a7e98 00000000 edc6840c
    [   29.698204] 7e60: bef44c18 00000000 ed6a7ee4 ed6a7e78 c0443e58 c03e5704 ed6a7e9c ee21c000
    [   29.706416] 7e80: bef44c18 edc6840c edc68400 ee21c000 00000014 00008914 6e616c77 00000030
    [   29.714628] 7ea0: 00000000 00000000 000a1043 000000ca 000a0fb5 bef44f0a 000a1002 00008914
    [   29.722841] 7ec0: ee447520 bef44c18 c06c0140 bef44c18 ed6a6000 00000000 ed6a7ef4 ed6a7ee8
    [   29.731052] 7ee0: c0445804 c04437e0 ed6a7f14 ed6a7ef8 c03c7468 c0445674 bef44c18 ee447520
    [   29.739263] 7f00: ee2d3900 00000003 ed6a7f7c ed6a7f18 c0134e00 c03c7340 c06830c8 00000000
    [   29.747474] 7f20: ee447500 ee447500 ed6a7f6c ed6a7f38 c03c7240 c0125a20 00000000 00000003
    [   29.755685] 7f40: 00000000 ee447500 c000fbc4 ed6a6000 ed6a7f6c ee2d3900 00000003 ee2d3900
    [   29.763896] 7f60: 00008914 bef44c18 ed6a6000 00000000 ed6a7fa4 ed6a7f80 c0135060 c0134a1c
    [   29.772109] 7f80: 00095248 bef44e0c bef44f19 00000036 c000fbc4 ed6a6000 00000000 ed6a7fa8
    [   29.780320] 7fa0: c000fa20 c0135030 00095248 bef44e0c 00000003 00008914 bef44c18 00095248
    [   29.788531] 7fc0: 00095248 bef44e0c bef44f19 00000036 000951f8 bef44e0c bef44c18 00000003
    [   29.796743] 7fe0: 000b42dc bef44bac 0001b234 b6eb94d6 20070030 00000003 016c0100 0000028b
    [   29.804951] Backtrace:
    [   29.807532] [<bf5f2828>] (wl1271_op_add_interface [wlcore]) from [<bf581f10>] (drv_add_interface+0x38/0x84 [mac80211])
    [   29.818273]  r10:ffffffff r9:00000001 r8:ee21c4c0 r7:ee21c030 r6:ee21c000 r5:ed6b83e0
    [   29.826177]  r4:ee21c4c0
    [   29.828860] [<bf581ed8>] (drv_add_interface [mac80211]) from [<bf592890>] (ieee80211_do_open+0x41c/0x908 [mac80211])
    [   29.839425]  r5:ed6b83e0 r4:ee21c4c8
    [   29.843166] [<bf592474>] (ieee80211_do_open [mac80211]) from [<bf592dd4>] (ieee80211_open+0x58/0x5c [mac80211])
    [   29.853294]  r10:000000ca r9:00000000 r8:00000000 r7:ee21c030 r6:bf5be6a0 r5:00001043
    [   29.861195]  r4:ee21c4c0
    [   29.863820] [<bf592d7c>] (ieee80211_open [mac80211]) from [<c03e538c>] (__dev_open+0xb0/0x114)
    [   29.872466]  r5:00001043 r4:ee21c000
    [   29.876076] [<c03e52dc>] (__dev_open) from [<c03e5648>] (__dev_change_flags+0x9c/0x14c)
    [   29.884111]  r7:00001002 r6:00000001 r5:00001043 r4:ee21c000
    [   29.889832] [<c03e55ac>] (__dev_change_flags) from [<c03e5718>] (dev_change_flags+0x20/0x50)
    [   29.898304]  r9:00000000 r8:00000000 r7:edc6840c r6:00001002 r5:ee21c138 r4:ee21c000
    [   29.906131] [<c03e56f8>] (dev_change_flags) from [<c0443e58>] (devinet_ioctl+0x684/0x738)
    [   29.914340]  r9:00000000 r8:bef44c18 r7:edc6840c r6:00000000 r5:ed6a7e98 r4:00000000
    [   29.922162] [<c04437d4>] (devinet_ioctl) from [<c0445804>] (inet_ioctl+0x19c/0x1c8)
    [   29.929848]  r10:00000000 r9:ed6a6000 r8:bef44c18 r7:c06c0140 r6:bef44c18 r5:ee447520
    [   29.937752]  r4:00008914
    [   29.940307] [<c0445668>] (inet_ioctl) from [<c03c7468>] (sock_ioctl+0x134/0x290)
    [   29.947738] [<c03c7334>] (sock_ioctl) from [<c0134e00>] (do_vfs_ioctl+0x3f0/0x614)
    [   29.955337]  r7:00000003 r6:ee2d3900 r5:ee447520 r4:bef44c18
    [   29.961056] [<c0134a10>] (do_vfs_ioctl) from [<c0135060>] (SyS_ioctl+0x3c/0x64)
    [   29.968393]  r10:00000000 r9:ed6a6000 r8:bef44c18 r7:00008914 r6:ee2d3900 r5:00000003
    [   29.976296]  r4:ee2d3900
    [   29.978852] [<c0135024>] (SyS_ioctl) from [<c000fa20>] (ret_fast_syscall+0x0/0x34)
    [   29.986452]  r9:ed6a6000 r8:c000fbc4 r7:00000036 r6:bef44f19 r5:bef44e0c r4:00095248
    [   29.994271] Code: eb28a3b7 e3a02000 e3a01001 e3442ae1 (e5821030)
    [   30.011653] ---[ end trace 47619d1e5c3d0fbe ]---

    I also tried:

            void __iomem *irc1 = IOMEM(0x4ae10030);
            u32 value;
            value = __raw_readw(irc1);
            value = 0xFFFFFFF;
            __raw_writew(value, irc1);

    Which also resulted in a traceback.

    I've found some interfaces online like this:

    omap_clear_gpio_irqstatus()  // clear old interrupts from before
    
    omap_enable_irq() // enable the gpio interrupt

    Are there examples on how to use those?

  • Like I said, please ask on the WiLink forum. This probably needs to be patched inside the driver, and the WiLink team is the one that has knowledge on this.