Skip to contentSkip to conversation

i2c: thunderx: ACPI support for clock settings

PATCH Applied Jan Glauber 2 participants 2 messages Mar 2, 2017 – Mar 23, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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().

---
 drivers/i2c/busses/i2c-thunderx-pcidrv.c | 24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)
drivers/i2c/busses/i2c-thunderx-pcidrv.c +15 -9
index bba5b42..031e59f 100644
@@ -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;
Signature · 1 line
2.9.0.rc0.21.g7777322
Applied
#1 lore raw
Quoted 6 lines · Jan Glauber

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().

Applied to for-next, thanks!