summaryrefslogtreecommitdiffstats
path: root/drivers/i2c
diff options
context:
space:
mode:
authorJan Glauber <jglauber@cavium.com>2017-03-02 11:34:07 +0100
committerWolfram Sang <wsa@the-dreams.de>2017-03-23 21:49:27 +0100
commit346e400cfcebeb2a3dc3ede80cbd8b6fb95165ce (patch)
tree4678ca8437ec5069a7d4079d4a5f6f3657dd8c9d /drivers/i2c
parent4165bd4b91b9328fda07da8b2d1f49707f54abe1 (diff)
downloadlinux-346e400cfcebeb2a3dc3ede80cbd8b6fb95165ce.tar.bz2
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: Jan Glauber <jglauber@cavium.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/busses/i2c-thunderx-pcidrv.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/drivers/i2c/busses/i2c-thunderx-pcidrv.c b/drivers/i2c/busses/i2c-thunderx-pcidrv.c
index 1d4c2beacf2e..b4bc884cef93 100644
--- a/drivers/i2c/busses/i2c-thunderx-pcidrv.c
+++ b/drivers/i2c/busses/i2c-thunderx-pcidrv.c
@@ -85,17 +85,23 @@ static void thunder_i2c_clock_enable(struct device *dev, struct octeon_i2c *i2c)
{
int ret;
- i2c->clk = clk_get(dev, NULL);
- if (IS_ERR(i2c->clk)) {
- i2c->clk = NULL;
- goto skip;
+ if (acpi_disabled) {
+ /* DT */
+ i2c->clk = clk_get(dev, NULL);
+ 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:
if (!i2c->sys_freq)
i2c->sys_freq = SYS_FREQ_DEFAULT;