diff options
Diffstat (limited to 'drivers/i2c/busses/i2c-thunderx-pcidrv.c')
-rw-r--r-- | drivers/i2c/busses/i2c-thunderx-pcidrv.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/drivers/i2c/busses/i2c-thunderx-pcidrv.c b/drivers/i2c/busses/i2c-thunderx-pcidrv.c index 1d4c2beacf2e..ea35a895b568 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; @@ -205,6 +211,7 @@ static int thunder_i2c_probe_pci(struct pci_dev *pdev, i2c->adap = thunderx_i2c_ops; i2c->adap.retries = 5; + i2c->adap.class = I2C_CLASS_HWMON; i2c->adap.bus_recovery_info = &octeon_i2c_recovery_info; i2c->adap.dev.parent = dev; i2c->adap.dev.of_node = pdev->dev.of_node; |