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.

Changing lirc_serial driver to use ttyO0.

Hello, I've successfully used the guide located at DM81xx_AM38xx_CIR_Driver_User_Guide to install the LIRC package. I've also applied the LIRC/IR patches found in this verified answer. I'm a new developer and after going through the LIRC support for TI81XX patch I've been unable to get lirc_serial to use UART0. Based on the research I've done I believe I need to ioremap the address for UART0 found in /proc/iomem (48020000-48021fff: omap_uart.0). We can also see the following:

dmesg | grep tty

omap_uart.0: ttyO0 at MMIO 0x48020000 (irq = 72) is a OMAP UART0

So this led me to:

vbase = ioremap(uart0_base, uart0_max - uart0_base);

and replace the inb/outb calls in sinp/soutp with:

iowrite8(value, vbase + (offset * 4))

ioread8(vbase + (offset * 4))

Doing the above allows the driver to go through all the UART initialization, however when I attempt to read from the /dev/lirc0 node the driver crashes with "Precise External Abort on non-linefetch (0x1028) at 0xfa020000. I could be mistaken, but this leads me to believe that I'm on the right track in terms of communication but now there may be some other problem? The line that causes the crash is inside the irq_handle loop on the 32nd iteration:

arr = sinp(UART_RX);


I'm not really sure where to go from here, I've tried quite a few other solutions but so far this made the most sense to me. If any clarification is needed, I can provide it. Thanks for taking a look.

  • Another thing I noticed.... Within the LIRC support for TI81XX patch, I see a UART_OMAP_MDR3 defined with a value of 0x20. This value is then multiplied by 4 when being written resulting in 0x80 being sent. Within the TI documentation for TMS320DM816x DaVinci Digital Media Processors (sprs614b.pdf) there is no reference to Mode Definition Register 3 (MDR3) and that offset is undefined. All the other defines added in the patch match up to their offset in the documentation accordingly.

  • Taking a look at the code for LIRC support for TI81XX inside static irqreturn_t irq_handler:

                    if (num == 15  && data == 1) {
                        /* Start of NEC
                        *  9ms pulse and
                        *  4.5 ms space*/
                        arr = sinp(UART_RX);
                        if (arr == 0) {
                            frbwrite(399727);
                            /* Space to differentiate
                            *  between different key
                            *  presses*/
                        } else {
                            frbwrite(99727);
                            /*Space to differentiate
                             * between code and
                             * repeat code*/
                        }
                        num = 0;
                        loop1 = -1;
                        val = 0;
                        wake_up_interruptible(&rbuf.wait_poll);
                        frbwrite(PULSE_BIT|8960);
                        wake_up_interruptible(&rbuf.wait_poll);
                        continue;
                    }

    When the line arr = sinp(UART_RX) is executed, arr is always 255. I'm not sure if it's significant but it seems odd, I will continue debugging this issue ;)

  • Whilst debugging this issue I completely forgot to post the panic:

    Unhandled fault: Precise External Abort on non-linefetch (0x1028) at 0xfa020000
    Internal error: : 1028 [#1]
    last sysfs file: /sys/kernel/uevent_helper
    Modules linked in:
    CPU: 0    Not tainted  (2.6.37-ridgerun #89)
    PC is at sinp+0x28/0x38
    LR is at irq_handler+0x1f8/0x310
    pc : [<c029a900>]    lr : [<c029b7ac>]    psr: 20000193
    sp : ccbe3f18  ip : ccbe3f28  fp : ccbe3f24
    r10: ffffffff  r9 : 00000200  r8 : 00000001
    r7 : 00000001  r6 : 00000001  r5 : 00000001  r4 : 0000000f
    r3 : fa020000  r2 : c0502b7c  r1 : 0000a175  r0 : 00000000
    Flags: nzCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment user
    Control: 10c5387d  Table: 8cbd8019  DAC: 00000015
    Process display (pid: 154, stack limit = 0xccbe22e8)
    Stack: (0xccbe3f18 to 0xccbe4000)
    3f00:                                                       ccbe3f5c ccbe3f28
    3f20: c029b7ac c029a8e4 00000020 00000020 cc85a2c0 ccbe9b40 00000001 00000080
    3f40: 00000048 003d0f00 ccbe2000 00000000 ccbe3f7c ccbe3f60 c009a320 c029b5c0
    3f60: c04a7664 00000048 40169550 00000152 ccbe3f94 ccbe3f80 c009c504 c009a300
    3f80: 00000048 00000000 ccbe3fac ccbe3f98 c003a07c c009c464 ffffffff fa200000
    3fa0: 00000000 ccbe3fb0 c035fcbc c003a00c 0000001c 00000000 404b0018 00028b30
    3fc0: 40db24d8 40db2490 40169550 00000152 003d0f00 401753d8 00000000 40db1e0c
    3fe0: 00000002 40db1db8 403e39e4 0000c24c 60000010 ffffffff 8cdfe021 8cdfe421
    Backtrace:
    [<c029a8d8>] (sinp+0x0/0x38) from [<c029b7ac>] (irq_handler+0x1f8/0x310)
    [<c029b5b4>] (irq_handler+0x0/0x310) from [<c009a320>] (handle_IRQ_event+0x2c/0x
    ec)
    [<c009a2f4>] (handle_IRQ_event+0x0/0xec) from [<c009c504>] (handle_level_irq+0xa
    c/0x11c)
     r7:00000152 r6:40169550 r5:00000048 r4:c04a7664
    [<c009c458>] (handle_level_irq+0x0/0x11c) from [<c003a07c>] (asm_do_IRQ+0x7c/0xa
    0)
     r5:00000000 r4:00000048
    [<c003a000>] (asm_do_IRQ+0x0/0xa0) from [<c035fcbc>] (__irq_usr+0x3c/0xa0)
    Exception stack(0xccbe3fb0 to 0xccbe3ff8)
    3fa0:                                     0000001c 00000000 404b0018 00028b30
    3fc0: 40db24d8 40db2490 40169550 00000152 003d0f00 401753d8 00000000 40db1e0c
    3fe0: 00000002 40db1db8 403e39e4 0000c24c 60000010 ffffffff
     r5:fa200000 r4:ffffffff
    Code: 15923004 11a00310 e59f300c e5933008 (e7d30100)
    ---[ end trace 380fe6d346e95e9d ]---
    Kernel panic - not syncing: Fatal exception in interrupt
    Backtrace:
    [<c0048bc8>] (dump_backtrace+0x0/0x110) from [<c035da38>] (dump_stack+0x18/0x1c)
     r7:c029a904 r6:ccbe3dc7 r5:c029a902 r4:c04cf458
    [<c035da20>] (dump_stack+0x0/0x1c) from [<c035daa4>] (panic+0x68/0x184)
    [<c035da3c>] (panic+0x0/0x184) from [<c0048f5c>] (die+0x284/0x2d8)
     r3:00010000 r2:c042641c r1:00000000 r0:c0415064
    [<c0048cd8>] (die+0x0/0x2d8) from [<c0049070>] (arm_notify_die+0x5c/0x60)
    [<c0049014>] (arm_notify_die+0x0/0x60) from [<c003a2f0>] (do_DataAbort+0x88/0x9c
    )
     r5:c048e7b8 r4:00000007
    [<c003a268>] (do_DataAbort+0x0/0x9c) from [<c035fa6c>] (__dabt_svc+0x4c/0x60)
    Exception stack(0xccbe3ed0 to 0xccbe3f18)
    3ec0:                                     00000000 0000a175 c0502b7c fa020000
    3ee0: 0000000f 00000001 00000001 00000001 00000001 00000200 ffffffff ccbe3f24
    3f00: ccbe3f28 ccbe3f18 c029b7ac c029a900 20000193 ffffffff
     r8:00000001 r7:00000001 r6:00000001 r5:ccbe3f04 r4:ffffffff
    [<c029a8d8>] (sinp+0x0/0x38) from [<c029b7ac>] (irq_handler+0x1f8/0x310)
    [<c029b5b4>] (irq_handler+0x0/0x310) from [<c009a320>] (handle_IRQ_event+0x2c/0x
    ec)
    [<c009a2f4>] (handle_IRQ_event+0x0/0xec) from [<c009c504>] (handle_level_irq+0xa
    c/0x11c)
     r7:00000152 r6:40169550 r5:00000048 r4:c04a7664
    [<c009c458>] (handle_level_irq+0x0/0x11c) from [<c003a07c>] (asm_do_IRQ+0x7c/0xa
    0)
     r5:00000000 r4:00000048
    [<c003a000>] (asm_do_IRQ+0x0/0xa0) from [<c035fcbc>] (__irq_usr+0x3c/0xa0)
    Exception stack(0xccbe3fb0 to 0xccbe3ff8)
    3fa0:                                     0000001c 00000000 404b0018 00028b30
    3fc0: 40db24d8 40db2490 40169550 00000152 003d0f00 401753d8 00000000 40db1e0c
    3fe0: 00000002 40db1db8 403e39e4 0000c24c 60000010 ffffffff
     r5:fa200000 r4:ffffffff