Tool/software: Linux
I'm using AM3358 SoC on Beagle Bone Black compatible board. I want to use DM timers (timer 6 and 7). But I can't read from timer 6's control register. I do it the following way:
.....
#define TIMER6_BASE_REG 0x48048000
.....
....
printk(KERN_INFO"!!!Trying to read Timer6 register manualy with readl...\n");
printk(KERN_INFO"!!!Timer6 control register address:%x...\n",TIMER6_BASE_REG + (OMAP_TIMER_CTRL_REG & 0xff));
void __iomem *io = ioremap(TIMER6_BASE_REG + (OMAP_TIMER_CTRL_REG & 0xff), SZ_4K);
printk(KERN_INFO"!!!Remapped address:%x...\n",(unsigned long*) io);
printk(KERN_INFO"!!!Trying to read...\n");
....
//omap_dm_timer_enable(cpts->odt);
//omap_dm_timer_enable(cpts->odt2);
unsigned int address = 0;
address = readl(io);
printk(KERN_INFO"!!!Value:%x...\n",address);
printk(KERN_INFO"!!!Reading done succesfully...\n");
This causes page fault as far as I understood. Here is dmesg output:
.... [ 116.075307] !!!Trying to read Timer6 register manualy with readl... [ 116.081849] !!!Timer6 control register address:48048024... [ 116.087630] !!!Remapped address:fa048024... [ 116.091998] !!!Trying to read... [ 116.095419] Unhandled fault: external abort on non-linefetch (0x1028) at 0xfa048024 [ 116.103413] pgd = db0b8000 [ 116.106244] [fa048024] *pgd=48011452(bad) [ 116.110450] Internal error: : 1028 [#1] SMP ARM [ 116.115181] Modules linked in: rpmsg_rpc rpmsg_char virtio_rpmsg_bus pruss_soc_bus pru_rproc pruss_intc rpmsg_pru rpmsg_core pruss omap_mailbox [ 116.128689] CPU: 0 PID: 141 Comm: sh Not tainted 4.14.40 #126 [ 116.134687] Hardware name: Generic AM33XX (Flattened Device Tree) [ 116.141050] task: dbc48380 task.stack: dbf5e000 [ 116.145797] PC is at cpts_ptp_enable+0x290/0x4c4 [ 116.150613] LR is at cpts_ptp_enable+0x290/0x4c4 [ 116.155432] pc : [<c065c00c>] lr : [<c065c00c>] psr: 60000013 [ 116.161982] sp : dbf5fe50 ip : 00000003 fp : 00000000 [ 116.167427] r10: 00000000 r9 : dbf5ff80 r8 : c1ef9350 [ 116.172882] r7 : dbf42810 r6 : c170aa44 r5 : fa048024 r4 : dbf42820 [ 116.179696] r3 : c1748028 r2 : c1748028 r1 : ffffff30 r0 : 00000014 [ 116.186508] Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none [ 116.193954] Control: 10c5387d Table: 9b0b8019 DAC: 00000051 [ 116.199946] Process sh (pid: 141, stack limit = 0xdbf5e218) [ 116.205764] Stack: (0xdbf5fe50 to 0xdbf60000) [ 116.210317] fe40: 00000002 dbf42820 db09c040 db09c040 [ 116.218860] fe60: 000cd2f0 dbf5ff80 00000000 c0674258 00000000 00000001 00000002 00000000 [ 116.227399] fe80: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 [ 116.235949] fea0: 00000000 00000000 00000000 00000000 00000000 00000000 00000002 db006e50 [ 116.244484] fec0: db006e40 c034603c 00000000 00000000 00000000 c0345f40 00000002 000cd2f0 [ 116.253020] fee0: dbf5ff80 00000000 00000002 00000000 000cb2e0 c02c1708 c02c1a2c c0194c78 [ 116.261565] ff00: c1789e54 c17c8b0b 00000000 c01b2f60 dbf731fc c01b34bc 00000000 dbf731fc [ 116.270102] ff20: 00000000 c02c35a8 00000001 00000000 c02c1a2c 000cb008 dbf86c80 00000002 [ 116.278638] ff40: 000cd2f0 dbf86c80 00000002 000cd2f0 dbf5ff80 c02c197c dbf86c80 de03b200 [ 116.287170] ff60: de03b180 dbf86c80 dbf86c80 00000000 00000000 000cd2f0 00000002 c02c1b44 [ 116.295708] ff80: 00000000 00000000 00000000 00000000 00000001 000cd2f0 00000004 c0108064 [ 116.304255] ffa0: dbf5e000 c0107ea0 00000000 00000001 00000001 000cd2f0 00000002 00000000 [ 116.312788] ffc0: 00000000 00000001 000cd2f0 00000004 000cab64 00000020 00096bc4 000cb2e0 [ 116.321323] ffe0: 000ca244 bef9c910 0001a358 b6ebaab8 60000010 00000001 9fdf6861 9fdf6c61 [ 116.329888] [<c065c00c>] (cpts_ptp_enable) from [<c0674258>] (pps_enable_store+0x74/0x98) [ 116.338430] [<c0674258>] (pps_enable_store) from [<c034603c>] (kernfs_fop_write+0xfc/0x1dc) [ 116.347162] [<c034603c>] (kernfs_fop_write) from [<c02c1708>] (__vfs_write+0x1c/0x120) [ 116.355428] [<c02c1708>] (__vfs_write) from [<c02c197c>] (vfs_write+0xa0/0x168) [ 116.363067] [<c02c197c>] (vfs_write) from [<c02c1b44>] (SyS_write+0x3c/0x90) [ 116.370438] [<c02c1b44>] (SyS_write) from [<c0107ea0>] (ret_fast_syscall+0x0/0x28) [ 116.378344] Code: e59f0214 ebed2656 e59f0210 ebed2654 (e5951000) [ 116.384714] ---[ end trace 2960ceeb42aafca8 ]--- ....
I tried to read from ethernet registers the same way (from 4a100000 physical address) and it's working fine... My guess was that I couldn't access the DM Timer control register because the timer itself (or the clock of the timer) were not enabled and I tried the following before accessing register:
omap_dm_timer_enable(cpts->odt); omap_dm_timer_enable(cpts->odt2);
Also I tried to comment the following string in /drivers/clocksource/time-ti-dm.c in omap_dm_timer_prepare function:
//omap_dm_timer_disable(timer);
Nothing seemed to help...
I am using buildroot to build zImage. The kernel is 4.14.40 linux kernel from git://git.ti.com/processor-sdk/processor-sdk-linux.git (SDK 5.0, commit 47961). My device tree andre attached to the post. What can be the problem, why I can't access DM Timer control register?
https://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/791/config_5F00_and_5F00_device_5F00_tree.7z