[Bug 240740] aw_pwm - clk_rate may be never found

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Sat Sep 21 23:15:48 UTC 2019


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=240740

            Bug ID: 240740
           Summary: aw_pwm - clk_rate may be never found
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: arm
          Assignee: freebsd-arm at FreeBSD.org
          Reporter: k.lewandowski at me.com

I found this when I was looking at aw_pwm.c code, I tried to contact manu@ but
never got any feedback.

Suspected line is:
https://github.com/freebsd/freebsd/blob/master/sys/arm/allwinner/aw_pwm.c#L276

If 'div' does not fit '0xffff' (prescaler == 1) at the beginning:
...
div = AW_PWM_MAX_FREQ / period_freq;
if ((div - 1) > AW_PWM_PERIOD_TOTAL_MASK) {
...

then traversing prescalers and multiplying freq:
...
div = (AW_PWM_MAX_FREQ * aw_pwm_clk_prescaler[i]) / period_freq;
...
will make the 'div' even bigger and this condition:
...
if ((div - 1) < AW_PWM_PERIOD_TOTAL_MASK )
...
will never be met.

Shouldn't prescaler be used to divide the AW_PWM_MAX_FREQ instead? And with
prescalers
visited in increasing order eventually best match would be found?

I may be wrong though, just wanted to check,

-- 
Krystian

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-arm mailing list