i2c: designware_i2c: Add dw_i2c_enable() helper function
authorStefan Roese <sr@denx.de>
Thu, 21 Apr 2016 06:19:38 +0000 (08:19 +0200)
committerHeiko Schocher <hs@denx.de>
Mon, 25 Apr 2016 05:31:16 +0000 (07:31 +0200)
commit1c8b089b45cddeef6fb76d9abb8d48601ec5e0a1
tree76a5ed1433cbe409d20b49f72e508c0caa552c69
parente209828cbd4b8d896380c710bac82c5f7bd1ad72
i2c: designware_i2c: Add dw_i2c_enable() helper function

dw_i2c_enable() is used to dis-/en-able the I2C controller. It makes
sense to add such a function, as the controller is dis-/en-abled
multiple times in the code. Additionally, this function now checks,
if the controller is really dis-/en-abled. This code is copied
from the Linux I2C driver version.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
drivers/i2c/designware_i2c.c