Hi,
I want to use MMIO to read SPI registers, but I have some problems.
Could you help me, or give me some suggestions. thank you.
the code as follows.
#define GPIO_ADDR 0x48051000
#define MCSPI2_ADDR 0x4809A100
static int sample_open(struct inode *inode, struct file *file)
{
....
u32 Get_Valuetemp = 0;
void __iomem *tempbase;
request_mem_region(MCSPI2_ADDR, 1000, "SPI_reg");
tempbase = ioremap_nocache(MCSPI2_ADDR, 1000);
printk("tempbase = [%.08X]\n",tempbase);
Get_Valuetemp = __raw_readl(tempbase);
...
}
the error message as follows,
========================================================================
tempbase = [FA09A100]
------------[ cut here ]------------
WARNING: CPU: 0 PID: 1340 at drivers/bus/omap_l3_noc.c:147 l3_interrupt_handler+0x21c/0x320()
44000000.ocp:L3 Custom Error: MASTER MPU TARGET L4_PER1_P3 (Read): Data Access in User mode during Functional
access
Modules linked in: dwc3_omap
CPU: 0 PID: 1340 Comm: SPI_Slave Tainted: G W O 3.14.63 #109
Backtrace:
[<c001169c>] (dump_backtrace) from [<c0011838>] (show_stack+0x18/0x1c)
r6:c0654fa0 r5:20000193 r4:00000000 r3:00400100
[<c0011820>] (show_stack) from [<c04e4fc8>] (dump_stack+0x78/0x98)
[<c04e4f50>] (dump_stack) from [<c00352fc>] (warn_slowpath_common+0x6c/0x90)
r5:00000009 r4:ea3ddb00
[<c0035290>] (warn_slowpath_common) from [<c00353c4>] (warn_slowpath_fmt+0x38/0x40)
r8:c0654eb2 r7:c0654f13 r6:80080003 r5:ea185e50 r4:f1002100
[<c0035390>] (warn_slowpath_fmt) from [<c028eac0>] (l3_interrupt_handler+0x21c/0x320)
r3:ea190240 r2:c0654fba
[<c028e8a4>] (l3_interrupt_handler) from [<c006eaf0>] (handle_irq_event_percpu+0x38/0x184)
r10:c0421d24 r9:c0757b7b r8:00000000 r7:00000000 r6:00000017 r5:ea11e680
r4:ea185ac0
[<c006eab8>] (handle_irq_event_percpu) from [<c006ec80>] (handle_irq_event+0x44/0x64)
r10:c0421d24 r9:ea2c2c80 r8:e9ac7cc0 r7:ea3ddcc4 r6:ea185ac0 r5:ea11e6dc
r4:ea11e680
[<c006ec3c>] (handle_irq_event) from [<c0071c30>] (handle_fasteoi_irq+0xc0/0x108)
r6:c070a978 r5:ea11e6dc r4:ea11e680 r3:00000000
[<c0071b70>] (handle_fasteoi_irq) from [<c006e478>] (generic_handle_irq+0x28/0x38)
r5:00000000 r4:00000017
[<c006e450>] (generic_handle_irq) from [<c000ec08>] (handle_IRQ+0x6c/0x94)
r4:00000017 r3:00000192
[<c000eb9c>] (handle_IRQ) from [<c0008504>] (gic_handle_irq+0x44/0x68)
r5:ea3ddc90 r4:fa212000
[<c00084c0>] (gic_handle_irq) from [<c04ea100>] (__irq_svc+0x40/0x70)
Exception stack(0xea3ddc90 to 0xea3ddcd8)
dc80: 00000000 ffffffff 00000000 00000000
dca0: fa09a100 00000000 e9ac7cc0 e9ea1b48 e9ac7cc0 ea2c2c80 c0421d24 ea3ddd2c
dcc0: ea3ddd30 ea3ddcd8 c04e31bc c006cb64 60000013 ffffffff
r6:ffffffff r5:60000013 r4:c006cb64 r3:c04e31bc
[<c006cb54>] (vprintk_emit) from [<c04e31bc>] (printk+0x38/0x40)
r10:c0421d24 r9:ea2c2c80 r8:e9ac7cc0 r7:e9ea1b48 r6:e9ac7cc0 r5:00000000
r4:fa09a100
[<c04e3188>] (printk) from [<c0421e58>] (sample_open+0x104/0x164)
r3:60000013 r2:00000000 r1:00000000 r0:c066b1ed
[<c0421d54>] (sample_open) from [<c0130038>] (proc_reg_open+0x88/0x128)
r6:c0421d54 r5:e98b1680 r4:ea2efa00
[<c012ffb0>] (proc_reg_open) from [<c00dc964>] (do_dentry_open+0x1e8/0x2b0)
r10:e9ac7cc8 r8:c012ffb0 r7:00000000 r6:e9ea1c18 r5:e9ea1b48 r4:e9ac7cc0
[<c00dc77c>] (do_dentry_open) from [<c00dcc7c>] (finish_open+0x40/0x54)
r10:e9eb5348 r9:ea3dde84 r8:e9ac7cc0 r7:ea3dde88 r6:e9da84b8 r5:00000000
r4:ea3dde84 r3:e98936c0
[<c00dcc3c>] (finish_open) from [<c00eb620>] (do_last+0x92c/0xb48)
r4:ea3dded0 r3:ea3dde84
[<c00eacf4>] (do_last) from [<c00eba4c>] (path_openat+0x210/0x580)
r10:00000000 r9:ea3dc000 r8:e9a83000 r7:ffffff9c r6:ea3ddf5c r5:e9ac7cc0
r4:ea3dded0
[<c00eb83c>] (path_openat) from [<c00ec0f8>] (do_filp_open+0x34/0x80)
r10:00000000 r9:ea3dc000 r8:c000e464 r7:ffffff9c r6:e9a83000 r5:00000001
r4:ea3ddf5c
[<c00ec0c4>] (do_filp_open) from [<c00ddd4c>] (do_sys_open+0x128/0x1c8)
r7:00000005 r6:e9a83000 r5:ffffff9c r4:00000003
[<c00ddc24>] (do_sys_open) from [<c00dde14>] (SyS_open+0x28/0x2c)
r10:00000000 r8:c000e464 r7:00000005 r6:00008791 r5:000a6563 r4:beae3b94
[<c00dddec>] (SyS_open) from [<c000e2e0>] (ret_fast_syscall+0x0/0x38)
---[ end trace 5b0ebaaebc18df28 ]---
Unhandled fault: imprecise external abort (0x1406) at 0x00000000
========================================================================
In addition,
when I use the same way to read GPIO register of GPIO (GPIO_ADDR), it's no errors.