Skip to content
Commit bcf08503 authored by Simon Glass's avatar Simon Glass Committed by Heiko Schocher
Browse files

i2c: designware_i2c: Tidy up use of NULL priv



At present we still have pre-driver-model code in this driver and it makes
things a bit confusing. In particular calc_bus_speed() is called with priv
as NULL if not using driver model.

This results in spk_cnt and comp_param1 being read from an invalid address
if not using driver model. For comp_param1 this may not cause problems if
reading from addresses close to 0 happens to be allowed, as high speed is
only supported by DM code. But spk_cnt is subsequently used to calculate
the bus periods and so this may cause problems (e.g. on spear600 board
which has not been migrated yet).

Add a new parameter regs parameter to calc_bus_speed() and add more
comments to this function and to _dw_i2c_set_bus_speed(), which calls it.

Signed-off-by: default avatarSimon Glass <sjg@chromium.org>
Reported-by: default avatarHeinrich Schuchardt <xypron.glpk@gmx.de>
parent ab80137c
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment