Kernel freeze on mmap TIMER module enable

Hello,

could someone explain me why running this code freezes the kernel?

https://gist.github.com/lromor/e303c88cfb8a065d411f2ba0bc52324b

It should turn on the beaglebone TIMER4.
I have tested this code on 3.8 kernel and it works.

thank you,

Leo

Hello,

could someone explain me why running this code freezes the kernel?

https://gist.github.com/lromor/e303c88cfb8a065d411f2ba0bc52324b

Thanks Leonardo to measure and put together this report of this issue
when using 4.4.91-ti-r137.

It should turn on the beaglebone TIMER4.
I have tested this code on 3.8 kernel and it works.

This currently prevents PWM to work in BeagleG in newer kernels; so it
would be good to know from some of the people familiar with the
kernel/GPIO interaction could chime in and explain what is going on
and if there is a way to work-around it or if the initialization
should be different altogether.

Thanks
  Henner.

Let's see, your mmap'ing a clock that "was" being handled by the
kernel's pwm subsystem, and now the system freezes...

Well, stop mmap'ing or disable the pwm driver..

Regards,

Hello,
thank you for the answer and sorry for the late reply,
is it possible to disable the driver without recompiling the kernel?

I see there are 4 drivers present for the am335x:

kernel/drivers/pwm/pwm-tiecap.ko
kernel/drivers/pwm/pwm-tiehrpwm.ko
kernel/drivers/regulator/pwm-regulator.ko
kernel/drivers/video/backlight/pwm_bl.ko

What’s the difference between the first two?

The folder I assumed to be filled (/sys/class/pwm) when the drivers are enabled is empty.

Also:
Does the kernel manages the timer and pwm with same driver?

Thank you,

-l

Ping - it would be really interesting to know if disabling the kernel
driver is simple thing that can be configured from user-space, or
maybe if there are alternatives.

So far I enjoyed that it is possible to relatively simply just read
the datasheet and set the registers, but that seems to increasingly
getting complicated with the kernel doing its own thing. Which is fine
I suppose, but is there a documentation how to use the PWM subsystem
in that case ?

-h