Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 21 Sep 2019 23:15:48 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-arm@FreeBSD.org
Subject:   [Bug 240740] aw_pwm - clk_rate may be never found
Message-ID:  <bug-240740-7@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D240740

            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@FreeBSD.org
          Reporter: k.lewandowski@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#L=
276

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

then traversing prescalers and multiplying freq:
...
div =3D (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,

--=20
Krystian

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-240740-7>