diff options
author | Tom Rini <trini@konsulko.com> | 2019-01-15 22:05:28 -0500 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2019-01-15 22:05:28 -0500 |
commit | f4cfd73943032729c9ad6ddd054bcf2ff8205b6d (patch) | |
tree | 6b27ecf56538f56bbdbb95d84747a1f819326caa /drivers/i2c/i2c-cdns.c | |
parent | 0cd35f392000fb0783149d9b5f66c5f2e01bcbf1 (diff) | |
parent | 1d7b6a5c4f879dd36ac07ad76ec31eb4fcd2b65b (diff) |
Merge branch 'master' of git://git.denx.de/u-boot-i2c
Diffstat (limited to 'drivers/i2c/i2c-cdns.c')
-rw-r--r-- | drivers/i2c/i2c-cdns.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/i2c/i2c-cdns.c b/drivers/i2c/i2c-cdns.c index 30be173343..f2c4b2073c 100644 --- a/drivers/i2c/i2c-cdns.c +++ b/drivers/i2c/i2c-cdns.c @@ -17,6 +17,7 @@ #include <fdtdec.h> #include <mapmem.h> #include <wait_bit.h> +#include <clk.h> /* i2c register set */ struct cdns_i2c_regs { @@ -415,6 +416,8 @@ static int cdns_i2c_ofdata_to_platdata(struct udevice *dev) struct i2c_cdns_bus *i2c_bus = dev_get_priv(dev); struct cdns_i2c_platform_data *pdata = (struct cdns_i2c_platform_data *)dev_get_driver_data(dev); + struct clk clk; + int ret; i2c_bus->regs = (struct cdns_i2c_regs *)devfdt_get_addr(dev); if (!i2c_bus->regs) @@ -423,7 +426,11 @@ static int cdns_i2c_ofdata_to_platdata(struct udevice *dev) if (pdata) i2c_bus->quirks = pdata->quirks; - i2c_bus->input_freq = 100000000; /* TODO hardcode input freq for now */ + ret = clk_get_by_index(dev, 0, &clk); + if (ret) + return ret; + + i2c_bus->input_freq = clk_get_rate(&clk); return 0; } |