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/DRA710: PWM dmTimer 2 and 3 Data Access in Supervisor mode during Functional access

Part Number: DRA710

Tool/software: Linux

Hi

I have a custom board Running linux 4.4.45 PSDK 003

I backported a PWM driver from kernel 4.8

elixir.free-electrons.com/.../pwm-omap-dmtimer.c

Added two pwm devices in the deviceTree and both appears under /sys/class/pwm

	ctrl_trigger_pwm: dmtimer_pmw@2 {
		compatible = "ti,omap-dmtimer-pwm";
		ti,timers = <&timer2>;
		#pwm-cells = <3>;
		pinctrl-names = "default";
		pinctrl-0 = <&dmtimer2_pins>;
		};

	ctrl_led_pwm: dmtimer_pmw@3 {
		compatible = "ti,omap-dmtimer-pwm";
		ti,timers = <&timer3>;
		#pwm-cells = <3>;
		pinctrl-names = "default";
		pinctrl-0 = <&dmtimer3_pins>;
		};

/* Trigger PWM */
&timer2 {
status = "okay";
ti,timer-pwm;
};

/* Led Control PWM */
&timer3 {
status = "okay";
ti,timer-pwm;
};

I can successfully configure and activate one of them using 

echo 0 > /sys/class/pwm/pwmchip1/export
echo 16000000 > /sys/class/pwm/pwmchip1/pwm0/period
echo 8000000 > /sys/class/pwm/pwmchip1/pwm0/duty_cycle
echo 1 > /sys/class/pwm/pwmchip1/pwm0/enable

but once enabled, the other cannot be configured the kernel error is:

[ 110.890842] ------------[ cut here ]------------
[ 110.895495] WARNING: CPU: 0 PID: 571 at /mnt/yocto/yocto_repo/build/arago-tmp-external-linaro-toolchain/work-shared/delphi-jlr-isp-proto/kernel-source/drivers/bus/omap_l3_noc.c:147 l3_interrupt_handler+0x24c/0x350()
[ 110.914696] 44000000.ocp:L3 Custom Error: MASTER MPU TARGET L4_PER1_P3 (Idle): Data Access in Supervisor mode during Functional access
[ 110.926829] Modules linked in: xhci_plat_hcd xhci_hcd usbcore dwc3 udc_core ecb sha512_generic sha512_arm sha256_generic hmac md5 sha1_generic pwm_omap_dmtimer sha1_arm_neon sha1_arm omap_aes_driver omap_sham omap_wdt ti_vip ti_vpe ti_sc ti_csc ti_vpdma ar0144at dwc3_omap extcon omap_des omap_rng rng_core omap_remoteproc remoteproc virtio virtio_ring sch_fq_codel cmemk(O)
[ 110.960160] CPU: 0 PID: 571 Comm: sh Tainted: G O 4.4.45-g89944627d5 #4
[ 110.967933] Hardware name: Generic DRA72X (Flattened Device Tree)
[ 110.974061] [<c001686c>] (unwind_backtrace) from [<c001389c>] (show_stack+0x10/0x14)
[ 110.981844] [<c001389c>] (show_stack) from [<c0033b44>] (warn_slowpath_common+0x80/0xac)
[ 110.989972] [<c0033b44>] (warn_slowpath_common) from [<c0033ba0>] (warn_slowpath_fmt+0x30/0x40)
[ 110.998713] [<c0033ba0>] (warn_slowpath_fmt) from [<c02fbf70>] (l3_interrupt_handler+0x24c/0x350)
[ 111.007626] [<c02fbf70>] (l3_interrupt_handler) from [<c00782e8>] (handle_irq_event_percpu+0x9c/0x15c)
[ 111.016972] [<c00782e8>] (handle_irq_event_percpu) from [<c00783e0>] (handle_irq_event+0x38/0x5c)
[ 111.025884] [<c00783e0>] (handle_irq_event) from [<c007af7c>] (handle_fasteoi_irq+0xe0/0x1a8)
[ 111.034446] [<c007af7c>] (handle_fasteoi_irq) from [<c0077a14>] (generic_handle_irq+0x24/0x34)
[ 111.043095] [<c0077a14>] (generic_handle_irq) from [<c0077ca0>] (__handle_domain_irq+0x70/0xdc)
[ 111.051830] [<c0077ca0>] (__handle_domain_irq) from [<c000952c>] (gic_handle_irq+0x38/0x64)
[ 111.060216] [<c000952c>] (gic_handle_irq) from [<c00142c4>] (__irq_svc+0x44/0x7c)
[ 111.067727] Exception stack(0xce51de20 to 0xce51de68)
[ 111.072799] de20: 00000000 c0857050 00000000 d20abe80 600e0013 d3f3d0a0 d3f3d0a0 600e0013
[ 111.081010] de40: ce626680 cefb430c ce51df88 00000000 00000005 ce51de70 c006a7b8 c06a48f0
[ 111.089219] de60: 200e0013 ffffffff
[ 111.092727] [<c00142c4>] (__irq_svc) from [<c06a48f0>] (_raw_spin_unlock_irqrestore+0x70/0x74)
[ 111.101382] [<c06a48f0>] (_raw_spin_unlock_irqrestore) from [<c04017fc>] (__pm_runtime_idle+0x78/0x9c)
[ 111.110736] [<c04017fc>] (__pm_runtime_idle) from [<bf118130>] (pwm_omap_dmtimer_start+0x54/0x74 [pwm_omap_dmtimer])
[ 111.121335] [<bf118130>] (pwm_omap_dmtimer_start [pwm_omap_dmtimer]) from [<bf118170>] (pwm_omap_dmtimer_enable+0x20/0x30 [pwm_omap_dmtimer])
[ 111.134091] [<bf118170>] (pwm_omap_dmtimer_enable [pwm_omap_dmtimer]) from [<c030eefc>] (pwm_enable+0x68/0x94)
[ 111.144138] [<c030eefc>] (pwm_enable) from [<c031002c>] (enable_store+0x48/0x78)
[ 111.151569] [<c031002c>] (enable_store) from [<c018c0e8>] (kernfs_fop_write+0xbc/0x19c)
[ 111.159608] [<c018c0e8>] (kernfs_fop_write) from [<c0121f5c>] (__vfs_write+0x1c/0xd8)
[ 111.167473] [<c0121f5c>] (__vfs_write) from [<c01227b0>] (vfs_write+0x90/0x16c)
[ 111.174815] [<c01227b0>] (vfs_write) from [<c0122fd4>] (SyS_write+0x44/0x9c)
[ 111.181897] [<c0122fd4>] (SyS_write) from [<c0010260>] (ret_fast_syscall+0x0/0x1c)
[ 111.189495] ---[ end trace 97a20d96d8043ec3 ]---

The problem seems when calling pm_runtime_disable() from dmtimer.c

Do you have any suggestion?

regards