-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
omap_timer omap_timer.8: omap2_dm_timer_set_src: clk_set_parent() to sys_ck FAILED #3
Comments
Hi Alex, I think 2.6.39 was the last version I tested that driver. I'll take a look at 3.2. Thanks for the report. Scott On 12/10/11, Alexander Krause
|
Hi Scott, it's not that important but i thought it makes sense to let you know. Kind regards and a happy new one! On 17:34:10 11/12/11 Scott Ellis [email protected] wrote:
|
Hi Alex, I've been pretty busy. Starting a new company, using another processor for our boards, so not When 3.2 gets official for the Gumstix or Beagleboard I'll take a Scott On 12/29/11, Alexander Krause
|
I've been banging my head at the same problem for weeks, any news? |
I did just setup a 3.2 kernel Gumstix system for a customer yesterday. In the next day or so I'll try to take a look. On 5/22/12, Mike Looijmans
|
There is a new [3.2] branch that appears to fix the issue of not working at all. It was a PM related change that caused the problem. Timers must now be enabled before you can set any of the timer registers. New behavior. Easy fix. There is another new problem though. You can no longer unload and then reload the pwm driver. It won't load the second time. The error is related to changing the clock source, but it is internal to the omap dmtimer.c code. It is not the pwm driver trying to change the clock source. That is attempted later. The error happens in arch/arm/plat-omap/dmtimer.c - omap_dm_timer_request_specific() -> omap_dm_timer_prepare(). I will try to find a solution. As long as you are only loading the driver once, I think it will work okay. |
If I understand you correctly, this only fixes the driver not working at all, but it does NOT fix the problem with the clock source? The "enable" thing is something I tried, but i figured the syntax would be something like calling omap_dm_timer_enable(..) when we're going to use it, and omap_dm_timer_disable(..) when we're done with it, so basically in the open and close of the driver. Your patch suggests something entirely different, is it so that one has to surround every access to the timer functions with enable..disable calls? I really don't understand why your fix would work, it only puts that around one function that isn't even critical. Is there any place where I could find some information on the dmtimer interface? How did you find it? Or is the only way to discover this just looking at the source? From where i'm standing now, the easiest to do would be to just eliminate the timers I want to use from the kernel, and just bitbang the registers myself. At least that's properly documented... |
Not exactly. Direct calls to omap_dm_timer_write() require the timer to be enabled Wrapper calls like omap_dm_timer_set_match() or So that fixes the problem of loading and using the driver. If you only The second problem still needs to be worked out. Take a look at dmtimer.c - omap_dm_timer_request_specific() It calls omap_dm_timer_set_source() then arch/arm/mach-omap2/timer.c - omap2_dm_timer_set_src() arch/arm/plat-omap/clock.c - clk_set_parent() It looks like the call to clk_set_parent() is failing even if the same The error number gets swallowed so I need to put some tracing in there I removed all calls to omap_dm_timer_set_source() in pwm.c for testing The only other data point I have right now is that there is no problem If you load the pwm driver and start timer 8, stop it and unload the Or if you loaded the pwm driver, started timer 9, unloaded the driver. I didn't know about the dmtimer interface when I wrote the first Later kernels started taking more control of the timers and I kind of There was still not enough in dmtimer.c to use the timers for capture. I don't know of any documentation for that dmtimer code. Anyway, that's where I'm at. I have some other things I have to work If you find something I'd be happy to hear about it. On 5/23/12, Mike Looijmans
|
I don't know if this is a different side of the same coin, a new problem or my problem. Once I insmod pwm.ko and I rmmod it, I get: insmod: error inserting 'pwm.ko': -1 Operation not permitted An additional factor is persistence, which may be my problem. The system does not recognize 'pwm.ko' on reboot. upon reboot, I get this: desktop:/root# insmod pwm.ko timers=9,10,11 I can readily compile it, only if I remove the artifacts from the last make: desktop:/root/Documents/pwm# make When I remove the module and try to re-install it, I get this: desktop:/root/Documents/pwm# rmmod pwm I am native compiling and the make file is: obj-m := pwm.o
all: uname -r tells me that I am using 3.2.0-29-omap The only pwm.ko produced today is in the same directory that I make it. If I read the makefile correctly, it is supposed to put it in /lib/modules/3.2.0-29-omap/build and it does not. It also is supposed to clean up after compiling. I believe that is the persistence problem and I will work on that separately, but if you see an obvious error, I'd appreciate it. The system is Ubuntu 12.04 with Unity disabled and XFCE4 installed. Unity requires a minimum 1GHz proc and 1GB of memory and neither is particularly compatible with a BeagleBoardXM. The XFCE4 only requires 300 MHz and 200MB. For actual operations, I will run it headless from the shell (it boots to shell and I run the desktop). |
By the way, I don't initialize PWM8 because it kills the USB. |
Sounds like you are seeing exactly the symptoms described in those earlier posts. You cannot reload the pwm module if you used a timer when it was loaded. I suspect you are not trying your insmod commands from a console otherwise you would also see the reason the insmod failed instead of only the generic failure message. insmod: error inserting 'pwm.ko': -1 Operation not permitted Check your syslog for the real failure reason. I'm pretty sure it will be an error about not being able to reparent the timer src clock. Either that or try loading from a console session. Your insmod error on boot comes from the fact that insmod requires a full-path to the driver. desktop:/root# insmod pwm.ko timers=9,10,11 Provide the full-path to pwm.ko. The first insmod of the driver should always work. The warning to BeagleBoard users about timer 8 messing with USB has been in the README for a long time. |
Thanks for your prompt answer. I was afraid it was the same problem. They appear to not have fixed the 3.2 kernel. I tried installing a newer kernel but none of them want to boot. The latter distros mess with the boot.scr and uEnv.txt doesn't work for me. I don't feel like messing with the uEnv.txt/boot.scr right now. So, I'm installing a Ubuntu 11.10 distro that has the 3.0 kernel. I looked at Linaro and they stopped updating the BeagleBoard distro because they couldn't get it to boot. I will figure out how to fix it later. I haven't worked on UNIX since I was using microbus and a 6800. So, the functions are little foggy. Thanks for the heads up on the full path. I had read some place else that I should do a make modules-install. I had tried that with another LKM, but it said that make didn't have that command. I'll work on that. |
Why do you need to reload the pwm driver? I haven't had any problems using it when I load it once at boot. The The pwm module is built out-of-tree unless you've modified it. You should modify your startup script to use the full path to the At least that's what I do. On 8/1/12, KaliberImaging
|
Thanks Scott. I can send you the whole syslog for this, if you wish. There seems to be a series hub 1-2:1.0: port 2 events associated with the initial insmod and hub 1.0:1-0: port 2 with the ones resulting in a freeze. I'm going to attempt a recompile by removing all references to pwm8. Thanks |
I commented out the references to timer 8 and pwm8 and changed the 4 timers to 3. It inserted and removed the pwm module fine. I rmmod pwm and it shut down OK. I insmod ed it again and it still had the random tripping. I decided to reboot and forgot to rmmod. After reboot, it came back with the message I tried rmmod and it told me that pwm was not inserted. A clean install got the same results. My guess is that the bug extended to 3.1.1-21. I will be looking to a 3.0 that I can use. There were some changes from 2.6 that creates problems for me if I go back that far. |
On 8/3/12, KaliberImaging
insmod pwm.ko timers=9,10,11 This way the driver will not touch timer 8. Instructions are in the README.
"echo 50 > pwm9" shouldn't hurt anything. If you ran this from the
Nothing that I know of. Rebooting always works for me. |
I'm using your latest code and I still get: My kernel version is as follows: 3.2.28 |
I removed the following lines of code and now it works. So for some reason the omap_dm_timer_set_source does not work. Although the PWM seems to work fine with out that call. |
I'm not sure what to suggest. I'm using the pwm driver on several projects with a 3.2 kernel on a Gumstix Overo without any problems. The kernel comes from the gumstix/meta-gumstix repo on Github. Without that omap_dm_timer_set_source() call, the timer is likely using a 32K source timer and not the 13MHz sys timer. That might not be a problem for you. It just means a coarser resolution and less range for the frequency. It's still an outstanding problem that you cannot reload the driver on a running system if you activated any of the pwm timers. Then you will get the error that you are seeing. That's usually only a problem (for me mostly) during development. I have looked at the problem, but the solution isn't obvious. My dev systems reboot under 10 seconds so it's not been inconvenient enough to force me to fix. My production systems only load the driver once at boot so it's never a problem there. |
Scott, I've traced it down to the following code inside of clk_set_parent(): Where clk->usercount is NOT equal to zero so clk_set_parent() returns -EBUSY. I will keep digging into usercount, any insight on it that you might have would also be helpful. |
So I'm clear, you get an error the first time you load the driver? |
Yes, the first time I load the driver. |
Scott, The problem is to set the timer (clk) source there must not be anyone using the clk (as per my post above). Your PWM code actually registers the timer (clk) somewhere early on (not sure where) so it is actually using it in my kernel therefore when the code goes to set the src it punts out because usecount is equal to 1. I fixed this part of the problem by just issuing a clock disable/enable around the code were the src is being set as clk_disable() decrements usecount and disables the clk if no one is using it and clk_enable() increments usecount and enables the clk. //ADDED CODE Next, the module removing reinserting problem seems to be the same issue. The clk is never being disabled (usecount decremented) when the module is removed so the next time it can't set the source and the disable/enable I have in place does not work since the usecount is now 2 instead of 1 and since clk_disable only decrements by 1 usecount is not 0. I just added a clk_disable to the pwm_timer_cleanup() function: static void pwm_timer_cleanup(void)
//ADDED CODE
} |
The use part of your explanation makes sense and I'll experiment with adding I don't understand why you can't use the driver on first load though and In your kernel config, what's the value of CONFIG_OMAP_RESET_CLOCKS ? There are no other functions that touch the timers before the drivers pwm_timer_init() If you look at omap_dm_timer_request_specific() it does the following omap_dm_timer_request_specific() which is the source clock we are trying to override. We can't do the set_source() call before the request() call because You could try putting the set_source() call before the set_pwm() call On 07/18/2013 10:43 AM, Shane Volpe wrote:
|
CONFIG_OMAP_RESET_CLOCKS is set to no on mine. I will try to set it to yes as it does make sense that it could be the difference between our systems. |
Hi,
I compiled the module against a git tree of www.sakoman.com (
http://www.sakoman.com/cgi-bin/gitweb.cgi?p=linux-omap-2.6.git;a=shortlog;h=refs/heads/omap-3.2 ) and tried to use it on my gumstix overo board.
When i try to load the module this error occurs in my dmesg:
omap_timer omap_timer.8: omap2_dm_timer_set_src: clk_set_parent() to sys_ck FAILED
CONFIG_OMAP_RESET_CLOCKS is not set in my kernel-config.
Does the module work with the 3er series of the kernel? Do you have any hints for me whats exactly the problem is?
Thanks so far.
Kind regards,
Alex
The text was updated successfully, but these errors were encountered: