linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tudor Ambarus <tudor.ambarus@microchip.com>
To: wsa@the-dreams.de, ludovic.desroches@microchip.com,
	nicolas.ferre@microchip.com, alexandre.belloni@bootlin.com,
	linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Cc: Tudor Ambarus <tudor.ambarus@microchip.com>
Subject: [RFC PATCH 2/2] i2c: at91: provide bus_freq_hz
Date: Mon, 26 Mar 2018 14:19:27 +0300	[thread overview]
Message-ID: <20180326111927.16040-2-tudor.ambarus@microchip.com> (raw)
In-Reply-To: <20180326111927.16040-1-tudor.ambarus@microchip.com>

The clock-frequency property is not mandatory for the i2c buses. If it's
not present in device tree, the buses usually assume that is 100kHZ.
There are i2c clients that need to know the clock frequency in order to
compute their wake token. Spare the clients of making (wrong) assumptions
and provide the bus frequency in adapter.

Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.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 bfd1fdf..d3cd84e 100644
--- a/drivers/i2c/busses/i2c-at91.c
+++ b/drivers/i2c/busses/i2c-at91.c
@@ -1116,6 +1116,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

  reply	other threads:[~2018-03-26 11:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-26 11:19 [RFC PATCH 1/2] i2c: add bus_freq_hz in i2c_adapter Tudor Ambarus
2018-03-26 11:19 ` Tudor Ambarus [this message]
2018-04-04 15:34   ` [RFC PATCH 2/2] i2c: at91: provide bus_freq_hz Ludovic Desroches
2018-04-18  7:59 ` [RFC PATCH 1/2] i2c: add bus_freq_hz in i2c_adapter Tudor Ambarus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180326111927.16040-2-tudor.ambarus@microchip.com \
    --to=tudor.ambarus@microchip.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=ludovic.desroches@microchip.com \
    --cc=nicolas.ferre@microchip.com \
    --cc=wsa@the-dreams.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).