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: GPIO read error

Part Number: AM5728

Tool/software: Linux

Hi all,we wrote the driver to operate the gpio output or get the input data. The main part of driver code as follow:

unsigned int  reg_vir,gp2_vir,gp3_vir,value2,value3;

reg_vir = (unsigned int)ioremap_nocache(0x4a002000, 8*1024);//8Kb  map the MODULE BASE
__raw_writel(0xE, reg_vir + 0x151c);//gpio3_14  config the pad to gpio
__raw_writel(0xE, reg_vir + 0x14e0);//gpio2_31   config the pad to gpio

gp2_vir = (unsigned int)ioremap_nocache(0x48055000, 408); //map the GPIO2
gp3_vir = (unsigned int)ioremap_nocache(0x48057000, 408); // map the GPIO3

//value2 = __raw_readl(gp2_vir + 0x134);//read  GPIO_OE 
value3 = __raw_readl(gp3_vir + 0x134);//read  GPIO_OE

all of the constant value above are exacted from the AM572x TRM . The GPIO3_14 can be operate correctly,but if we uncomment  "value2 = __raw_readl(gp2_vir + 0x134);//read  GPIO_OE " ,we  met some error:

[ 52.398893] Unhandled fault: asynchronous external abort (0x1211) at 0x000000
[ 52.398896] pgd = ec65aac0
[ 52.398898] ------------[ cut here ]------------
[ 52.398910] [00000000] *pgd=ac4bd003, *pmd=f9df5003
[ 52.398917] Internal error: : 1211 [#1] PREEMPT SMP ARM
[ 52.399036] Modules linked in: ti8168_gpio(O) bc_example(O) rpmsg_pru rpmsg_)
[ 52.399044] CPU: 0 PID: 1242 Comm: test_gpio Tainted: G O 4.4.44
[ 52.399046] Hardware name: Generic DRA74X (Flattened Device Tree)
[ 52.399050] task: ed71f400 ti: eccdc000 task.ti: eccdc000
[ 52.399062] PC is at __copy_to_user_std+0xa8/0x3c4
[ 52.399071] LR is at ti81xx_gpio_ioctl+0xac/0x13c [ti8168_gpio]
[ 52.399077] pc : [<c02b88a8>] lr : [<bf0200ac>] psr: 00070013
[ 52.399077] sp : eccddecc ip : 00000010 fp : eccddf14
[ 52.399080] r10: 00000000 r9 : eccdc000 r8 : beea0b40
[ 52.399084] r7 : 0000013c r6 : 00000002 r5 : ed76ef50 r4 : beea0b40
[ 52.399087] r3 : 00000000 r2 : fffffff0 r1 : eccddef8 r0 : beea0b40
[ 52.399092] Flags: nzcv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user

the above error seem to operate address wrong.we check the address many times,without finding some problem.we are so wondering why the same operate on GPIO bank 3 is ok,but failed on GPIO bank 2 .we try to same operate on GPIO bank 1,failed too.