diff options
author | Dinh Nguyen <dinguyen@kernel.org> | 2018-04-04 17:18:24 -0500 |
---|---|---|
committer | Marek Vasut <marex@denx.de> | 2018-04-17 11:39:49 +0200 |
commit | 622597dee4f66d5bd7dd5135d770077af04b0349 (patch) | |
tree | a609029d98c0175b49a35f3aeb739d6330381424 /drivers/i2c/designware_i2c.c | |
parent | 449ff9c4315563791282a7dd62303e20a48a007e (diff) | |
download | u-boot-622597dee4f66d5bd7dd5135d770077af04b0349.zip u-boot-622597dee4f66d5bd7dd5135d770077af04b0349.tar.gz u-boot-622597dee4f66d5bd7dd5135d770077af04b0349.tar.bz2 |
i2c: designware: add reset ctrl to driver
Add code to look for a reset manager property. Specifically, look for the
reset-names of 'i2c'. A reset property is an optional feature, so only print
out a warning and do not fail if a reset property is not present.
If a reset property is discovered, then use it to deassert, thus bringing the
IP out of reset.
Signed-off-by: Dinh Nguyen <dinguyen@kernel.org>
Diffstat (limited to 'drivers/i2c/designware_i2c.c')
-rw-r--r-- | drivers/i2c/designware_i2c.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/i2c/designware_i2c.c b/drivers/i2c/designware_i2c.c index 8cfed21..419d021 100644 --- a/drivers/i2c/designware_i2c.c +++ b/drivers/i2c/designware_i2c.c @@ -9,6 +9,7 @@ #include <dm.h> #include <i2c.h> #include <pci.h> +#include <reset.h> #include <asm/io.h> #include "designware_i2c.h" @@ -34,6 +35,7 @@ static struct dw_scl_sda_cfg byt_config = { struct dw_i2c { struct i2c_regs *regs; struct dw_scl_sda_cfg *scl_sda_cfg; + struct reset_ctl reset_ctl; }; #ifdef CONFIG_SYS_I2C_DW_ENABLE_STATUS_UNSUPPORTED @@ -534,6 +536,7 @@ static int designware_i2c_probe_chip(struct udevice *bus, uint chip_addr, static int designware_i2c_probe(struct udevice *bus) { struct dw_i2c *priv = dev_get_priv(bus); + int ret; if (device_is_on_pci_bus(bus)) { #ifdef CONFIG_DM_PCI @@ -549,6 +552,13 @@ static int designware_i2c_probe(struct udevice *bus) priv->regs = (struct i2c_regs *)devfdt_get_addr_ptr(bus); } + ret = reset_get_by_name(bus, "i2c", &priv->reset_ctl); + if (ret) + pr_info("reset_get_by_name() failed: %d\n", ret); + + if (&priv->reset_ctl) + reset_deassert(&priv->reset_ctl); + __dw_i2c_init(priv->regs, 0, 0); return 0; |