From: Heiko Schocher Date: Thu, 16 Jan 2020 07:45:36 +0100 Subject: [PATCH v2 06/19] i2c: designware_i2c: Use an accurate bus clock instead of MHz In-Reply-To: <20200103222650.32592-5-sjg@chromium.org> References: <20200103222650.32592-1-sjg@chromium.org> <20200103222650.32592-5-sjg@chromium.org> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hello Simon, Am 03.01.2020 um 23:26 schrieb Simon Glass: > At present the driver uses an approximation for the bus clock, e.g. 166MHz > instead of 166 2/3 MHz. > > This can result in small errors in the resulting I2C speed, perhaps 0.5% > or so. > > Adjust the existing code to start from the accurate figure, even if later > rounding reduces this accuracy. > > Update the bus speed code to work in KHz instead of MHz, which removes > most of the error. > > Signed-off-by: Simon Glass > --- > > Changes in v2: None > > drivers/i2c/designware_i2c.c | 18 ++++++++---------- > drivers/i2c/designware_i2c.h | 4 ++-- > 2 files changed, 10 insertions(+), 12 deletions(-) Reviewed-by: Heiko Schocher bye, Heiko -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-52 Fax: +49-8142-66989-80 Email: hs at denx.de