We have a custom OMAP L138 board. We recently added support for adjusting the CPU speed from user space in Linux using /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed. Our device is a USB peripheral that is connected to a PC. We are changing the ARM clock speed, and hence PLL0_SYSCLK2 as well which the USB peripheral runs from. The USB PHY clock is generated from AUXCLK.
The scenario is that after boot we will use cpufreq to lower the ARM clock speed. The device is connected to the PC while booting. Occasionally we will notice that the PC doesn't detect the device, and it won't detect the device until the device is disconnected and reconnected.
When this happens I was seeing: "musb_g_ep0_irq 724: SetupEnd came in a wrong ep0stage in/status" in the kernel log. So I started looking more closely at endpoint 0 processing. What I found is that before the CPU frequency change, endpoint 0 transfers were occuring normally. Then, shortly after we scale the CPU speed down, it looks like the endpoint 0 transfers are processed correctly except that after the driver sets DATAEND the controller never follows up with an interrupt in the status phase with csr = 0. This stands out because up until the CPU clock speed changes, the USB controller seems to send a status interrupt with csr = 0 after every transfer. After the CPU clock speed changes, this no longer happens. Then once we disconnect and reconnect the device, we start seeing the interrupts again. The time when the status interrupts are no longer occuring is also when we get the "SetupEnd" errors (mentioned above) as well.
I can't be sure that it's the CPU scaling that's causing the problem but the problem appears to be occuring at about the time that the CPU frequency changes, and we weren't seeing this problem before those changes, so I'm making that assumption. Does any of thise make any sense? Is it possible that the USB controller is getting into a bad state that isn't cleared until the device is disconnected? Is there any way that I can resolve this problem?
Thanks,
Brian