[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20180801133512.12276-3-tudor.ambarus@microchip.com>
Date: Wed, 1 Aug 2018 16:35:12 +0300
From: Tudor Ambarus <tudor.ambarus@...rochip.com>
To: <wsa@...-dreams.de>, <linux-i2c@...r.kernel.org>,
<ludovic.desroches@...rochip.com>, <nicolas.ferre@...rochip.com>,
<alexandre.belloni@...tlin.com>
CC: <linux-kernel@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>, <linus.walleij@...aro.org>,
Tudor Ambarus <tudor.ambarus@...rochip.com>
Subject: [PATCH 2/2] i2c: at91: Save the bus clock frequency in adapter
The clock-frequency property is not mandatory for the i2c buses. If it's
not present in the device tree, the buses __usually__ assume it's 100kHZ
(see altera, at91, axxia, etc.). Broadcom uses a 375kHZ default
clock-frequency, so the default clock frequency varies from bus to bus.
There are i2c clients that need to know the bus clock frequency in order to
compute their wake token (see atecc508a i2c client).
The clock-frequency value has to be propagated to the i2c clients, otherwise,
if they will not find the i2c bus clock frequency in the device tree, they
will have to make their own assumption of the clock frequency.
Spare the i2c clients of making wrong assumptions of the i2c bus clock
frequency and provide the bus clock frequency in adapter.
Signed-off-by: Tudor Ambarus <tudor.ambarus@...rochip.com>
Acked-by: Ludovic Desroches <ludovic.desroches@...rochip.com>
---
drivers/i2c/busses/i2c-at91.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c
index 3f3e8b3..9aa0937 100644
--- a/drivers/i2c/busses/i2c-at91.c
+++ b/drivers/i2c/busses/i2c-at91.c
@@ -1124,6 +1124,7 @@ static int at91_twi_probe(struct platform_device *pdev)
dev->adapter.quirks = &at91_twi_quirks;
dev->adapter.dev.parent = dev->dev;
dev->adapter.nr = pdev->id;
+ dev->adapter.bus_freq_hz = bus_clk_rate;
dev->adapter.timeout = AT91_I2C_TIMEOUT;
dev->adapter.dev.of_node = pdev->dev.of_node;
--
2.9.4
Powered by blists - more mailing lists