Commit 346e400c authored by Jan Glauber's avatar Jan Glauber Committed by Wolfram Sang

i2c: thunderx: ACPI support for clock settings

Add support for reading the system clock and the TWSI clock
frequency from ACPI DSDT.

TWSI clock was already covered by using device_property_read().
Signed-off-by: default avatarJan Glauber <jglauber@cavium.com>
Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
parent 4165bd4b
...@@ -85,17 +85,23 @@ static void thunder_i2c_clock_enable(struct device *dev, struct octeon_i2c *i2c) ...@@ -85,17 +85,23 @@ static void thunder_i2c_clock_enable(struct device *dev, struct octeon_i2c *i2c)
{ {
int ret; int ret;
i2c->clk = clk_get(dev, NULL); if (acpi_disabled) {
if (IS_ERR(i2c->clk)) { /* DT */
i2c->clk = NULL; i2c->clk = clk_get(dev, NULL);
goto skip; if (IS_ERR(i2c->clk)) {
i2c->clk = NULL;
goto skip;
}
ret = clk_prepare_enable(i2c->clk);
if (ret)
goto skip;
i2c->sys_freq = clk_get_rate(i2c->clk);
} else {
/* ACPI */
device_property_read_u32(dev, "sclk", &i2c->sys_freq);
} }
ret = clk_prepare_enable(i2c->clk);
if (ret)
goto skip;
i2c->sys_freq = clk_get_rate(i2c->clk);
skip: skip:
if (!i2c->sys_freq) if (!i2c->sys_freq)
i2c->sys_freq = SYS_FREQ_DEFAULT; i2c->sys_freq = SYS_FREQ_DEFAULT;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment