How to Enable Gated Clock for GPT in Linux User Space Driver

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to Enable Gated Clock for GPT in Linux User Space Driver

1,402 Views
brianyokum
Contributor IV

I am trying to implement a Linux user space driver for the GPT on the i.MX6ULL using uio_pdrv_genirq.  I have the basic driver set up, but the system locks up when I try to access the GPT registers.  I saw this same problem when I originally implemented the driver as a kernel space driver.  It was caused by the gated clock for the GPT not being enabled.  Is there a way to enable the needed clocks in the user space driver?  Is there a way to enable the clock outside the driver, perhaps through a device tree setting?  Is there a change to clk-imx6ul.c or another file that can accomplish this?

Labels (2)
0 Kudos
Reply
2 Replies

1,201 Views
brianyokum
Contributor IV

Igor,

It appears that Linux uses GPT1 for the system timer.  GPT2 is normally disabled in the device tree, and it appears that it is available for use.

The U-Boot configuration enables all the clocks during boot, but the Linux kernel shuts down unused clocks once it starts.  I was looking for something similar to clk_prepare_enable() that can be called from user space.

0 Kudos
Reply

1,201 Views
igorpadykov
NXP Employee
NXP Employee

Hi Brian

gpt can be used by linux as system timer according to sect.3.3 Timer

attached Linux Manual. Module clocks can be enabled in uboot/board/freescale/mx6ullevk/imximage.cfg

uboot-imx.git - Freescale i.MX u-boot Tree 

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply