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.

GPMC module driver is crashing when it is re-inserted. We are using ti8148 based board the Linux version 04.01.00.07.

Hi,

I am using the GPMC driver using chip select 0, It is working fine but when I am removing the module and then inserting the module once again it is failing at requesting GPMC memory for CS0.

Initially I have posted in ti8148 support forum .

http://e2e.ti.com/support/dsp/davinci_digital_media_processors/f/716/p/389663/1378959#1378959

Thank,

Sudheer.

  • Have you tried to add the following line in "exit" fn ?

    gpmc_cs_free(0);
    iounmap( uu_gpmc_cs0_base); //Added
    iounmap(uu_gpmc_base);
  • Hi,
    I have added the iounmap( uu_gpmc_cs0_base); but the response is same.

    root@(none):~# insmod uu_gpmc_drv_read_interrupt_mode.ko
    UURMI gpmc drver with IQ samples
    board_fpga_init ........................
    FPGA initialization
    GPMC_CS_CONFIG1: 28001010
    GPMC_CS_CONFIG2: 30380
    GPMC_CS_CONFIG3: 20201
    GPMC_CS_CONFIG4: f031003
    GPMC_CS_CONFIG5: 50607
    GPMC_CS_CONFIG6: 2000080
    GPMC_CS_CONFIG7: c48

    uu_cs0_mem_base:8000000
    uu_gpmc_cs0_base:
    root@(none):~# rmmod uu_gpmc_drv_read_interrupt_mode.ko
    FPGA De-initialization

    Module removed Successfully
    root@(none):~# insmod uu_gpmc_drv_read_interrupt_mode.ko
    UURMI gpmc drver with IQ samples
    board_fpga_init ........................
    FPGA initialization
    GPMC_CS_CONFIG1: 28001010
    GPMC_CS_CONFIG2: 30380
    GPMC_CS_CONFIG3: 20201
    GPMC_CS_CONFIG4: f031003
    GPMC_CS_CONFIG5: 50607
    GPMC_CS_CONFIG6: 2000080
    GPMC_CS_CONFIG7: c48

    Unable to handle kernel NULL pointer dereference at virtual address 00000000
    pgd = cf078000
    [00000000] *pgd=8f071031, *pte=00000000, *ppte=00000000
    Internal error: Oops: 17 [#1]
    last sysfs file:
    Modules linked in: uu_gpmc_drv_read_interrupt_mode(+) [last unloaded: uu_gpmc_drv_read_interrupt_mode]
    CPU: 0 Not tainted (2.6.37+ #5)
    PC is at adjust_resource+0x14/0xc4
    LR is at gpmc_cs_request+0x140/0x154
    pc : [<c007cbe8>] lr : [<c0059c3c>] psr: 00000013
    sp : cf01be94 ip : cf01bea8 fp : cf01bea4
    r10: 00000078 r9 : 00000001 r8 : c05e762c
    r7 : 00000000 r6 : 01000000 r5 : c05e7604 r4 : bf019938
    r3 : c05e762c r2 : 01000000 r1 : 08000000 r0 : 00000000
    Flags: nzcv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user
    Control: 10c5387d Table: 8f078019 DAC: 00000015
    Process insmod (pid: 132, stack limit = 0xcf01a2e8)
    Stack: (0xcf01be94 to 0xcf01c000)
    be80: bf019938 cf01beec cf01bea8
    bea0: c0059c3c c007cbe0 00000000 c004a288 cf01a000 00000000 cf01bedc c05e762c
    bec0: c046e834 bf011430 bf019410 00000000 00000000 c004a288 cf01a000 00000000
    bee0: cf01bf14 cf01bef0 bf0109f4 c0059b08 c0068048 c00533fc c05e7340 c05e7340
    bf00: bf011430 bf010c34 cf01bf3c cf01bf18 bf010c90 bf0108e4 00000000 0000001d
    bf20: 0000001e c05e7340 bf01130c bf010c34 cf01bf7c cf01bf40 c003d52c bf010c40
    bf40: 00000000 00012018 bf01130c 00000000 0001a433 00012018 bf01130c 00000000
    bf60: 0001a433 c004a288 cf01a000 00000000 cf01bfa4 cf01bf80 c00a8800 c003d3e0
    bf80: cf01bfa4 cf01bf90 00000000 00020000 00000003 00000080 00000000 cf01bfa8
    bfa0: c004a0c0 c00a8754 00000000 00020000 00012018 0001a433 00012008 00000001
    bfc0: 00000000 00020000 00000003 00000080 00012008 00000000 00012018 00000000
    bfe0: bef56ee4 bef56c7c 00008da0 401b47d4 60000010 00012018 aaaaaaaa aaaaaaaa
    Backtrace:
    [<c007cbd4>] (adjust_resource+0x0/0xc4) from [<c0059c3c>] (gpmc_cs_request+0x140/0x154)
    r4:bf019938
    [<c0059afc>] (gpmc_cs_request+0x0/0x154) from [<bf0109f4>] (uu_init_gpmc_fpga_hw_init+0x11c/0x35c [uu_gpmc_drv_read_interrupt_mode])
    [<bf0108d8>] (uu_init_gpmc_fpga_hw_init+0x0/0x35c [uu_gpmc_drv_read_interrupt_mode]) from [<bf010c90>] (init_module+0x5c/0x154 [uu_gpmc_drv_read_interrupt_mode])
    r6:bf010c34 r5:bf011430 r4:c05e7340
    [<bf010c34>] (init_module+0x0/0x154 [uu_gpmc_drv_read_interrupt_mode]) from [<c003d52c>] (do_one_initcall+0x158/0x1b0)
    r6:bf010c34 r5:bf01130c r4:c05e7340
    [<c003d3d4>] (do_one_initcall+0x0/0x1b0) from [<c00a8800>] (sys_init_module+0xb8/0x1c8)
    [<c00a8748>] (sys_init_module+0x0/0x1c8) from [<c004a0c0>] (ret_fast_syscall+0x0/0x30)
    r7:00000080 r6:00000003 r5:00020000 r4:00000000
    Code: e92dd810 e24cb004 e1a03000 e5900010 (e590c000)
    ---[ end trace 330f2b74deef3bde ]---
    Segmentation fault


    Thanks,
    Sudheer.
  • Hi,
    I am still having the crashing issue while re-inserting module. Do I need to provide any more data for analysis.
    Please help to resolve the crashing issue.
    Thanks,
    Sudheer.
  •  

    Sudheer,

    I have found that the problem is in the void gpmc_cs_free(int cs) function from the linux-kernel/arch/arm/mach-omap2/gpmc.c file. As you know, DM814x PSP linux kernel is 2.6.37. When I update this void gpmc_cs_free(int cs) to align its code with the mainline/upstream linux kernel (3.18 as of now), I do not have this issue any more. So please update your void gpmc_cs_free(int cs) function as below:

    void gpmc_cs_free(int cs)
    {
        struct resource *res = &gpmc_cs_mem[cs];    
        
        spin_lock(&gpmc_mem_lock);
        if (cs >= GPMC_CS_NUM || cs < 0 || !gpmc_cs_reserved(cs)) {
            printk(KERN_ERR "Trying to free non-reserved GPMC CS%d\n", cs);
            BUG();
            spin_unlock(&gpmc_mem_lock);
            return;
        }
        gpmc_cs_disable_mem(cs);
        if (res->flags)
            //release_resource(&gpmc_cs_mem[cs]);
            release_resource(res);
        gpmc_cs_set_reserved(cs, 0);
        spin_unlock(&gpmc_mem_lock);
    }


    BR
    Pavel