]> git.baikalelectronics.ru Git - uboot.git/commit
usb: dwc3: Program GFLADJ
authorSean Anderson <sean.anderson@seco.com>
Sun, 27 Nov 2022 14:31:55 +0000 (15:31 +0100)
committerMarek Vasut <marex@denx.de>
Sun, 27 Nov 2022 14:34:56 +0000 (15:34 +0100)
commitb1e92e81eccf236e65eae4d576502c2df71f2ba2
tree8706946987793b17b8cd92f73d08461be184dae9
parentf99c21cfe5485f4d33948a3215cbc4caae7f45dd
usb: dwc3: Program GFLADJ

GUCTL.REFCLKPER can only account for clock frequencies with integer
periods. To address this, program REFCLK_FLADJ with the relative error
caused by period truncation. The formula given in the register reference
has been rearranged to allow calculation based on rate (instead of
period), and to allow for fixed-point arithmetic.

Additionally, calculate a value for 240MHZDECR. This configures a
simulated 240Mhz clock using a counter with one fractional bit (PLS1).

This register is programmed only for versions >= 2.50a, since this is
the check also used by commit db2be4e9e30c ("usb: dwc3: Add frame length
adjustment quirk").

[ marek: Ported from Linux kernel commit
         596c87856e08d ("usb: dwc3: Program GFLADJ") ]

Reviewed-by: Sean Anderson <seanga2@gmail.com>
Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Signed-off-by: Marek Vasut <marex@denx.de> # Port from Linux
drivers/usb/dwc3/core.c
drivers/usb/dwc3/core.h