From owner-freebsd-arm@freebsd.org Sat Sep 21 23:15:48 2019 Return-Path: Delivered-To: freebsd-arm@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CD84AE96FB for ; Sat, 21 Sep 2019 23:15:48 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46bRK057CKz44rh for ; Sat, 21 Sep 2019 23:15:48 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 94C221D82C for ; Sat, 21 Sep 2019 23:15:48 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id x8LNFmqP070589 for ; Sat, 21 Sep 2019 23:15:48 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id x8LNFmb5070585 for freebsd-arm@FreeBSD.org; Sat, 21 Sep 2019 23:15:48 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: freebsd-arm@FreeBSD.org Subject: [Bug 240740] aw_pwm - clk_rate may be never found Date: Sat, 21 Sep 2019 23:15:48 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: arm X-Bugzilla-Version: CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: k.lewandowski@me.com X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: freebsd-arm@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Sep 2019 23:15:48 -0000 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.=