* [PATCH 24/32] i2c: bcm2835: Don't complain on -EPROBE_DEFER from getting our clock
[not found] <1464817421-8519-1-git-send-email-kraxel@redhat.com>
@ 2016-06-01 21:43 ` Gerd Hoffmann
2016-07-22 7:26 ` Wolfram Sang
2016-06-01 21:43 ` [PATCH 28/32] i2c: bcm2835: Set up the rising/falling edge delays Gerd Hoffmann
1 sibling, 1 reply; 4+ messages in thread
From: Gerd Hoffmann @ 2016-06-01 21:43 UTC (permalink / raw)
To: linux-rpi-kernel
Cc: Eric Anholt, Wolfram Sang, Stephen Warren, Lee Jones,
open list:I2C SUBSYSTEM,
moderated list:BROADCOM BCM2835 ARM ARCHITECTURE, open list
From: Eric Anholt <eric@anholt.net>
Fixes dmesg spam when we just need to wait a moment for the clock
driver to probe.
Signed-off-by: Eric Anholt <eric@anholt.net>
---
drivers/i2c/busses/i2c-bcm2835.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/i2c/busses/i2c-bcm2835.c b/drivers/i2c/busses/i2c-bcm2835.c
index 818b051..d4f3239 100644
--- a/drivers/i2c/busses/i2c-bcm2835.c
+++ b/drivers/i2c/busses/i2c-bcm2835.c
@@ -253,7 +253,8 @@ static int bcm2835_i2c_probe(struct platform_device *pdev)
i2c_dev->clk = devm_clk_get(&pdev->dev, NULL);
if (IS_ERR(i2c_dev->clk)) {
- dev_err(&pdev->dev, "Could not get clock\n");
+ if (PTR_ERR(i2c_dev->clk) != -EPROBE_DEFER)
+ dev_err(&pdev->dev, "Could not get clock\n");
return PTR_ERR(i2c_dev->clk);
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 28/32] i2c: bcm2835: Set up the rising/falling edge delays.
[not found] <1464817421-8519-1-git-send-email-kraxel@redhat.com>
2016-06-01 21:43 ` [PATCH 24/32] i2c: bcm2835: Don't complain on -EPROBE_DEFER from getting our clock Gerd Hoffmann
@ 2016-06-01 21:43 ` Gerd Hoffmann
2016-07-22 7:26 ` Wolfram Sang
1 sibling, 1 reply; 4+ messages in thread
From: Gerd Hoffmann @ 2016-06-01 21:43 UTC (permalink / raw)
To: linux-rpi-kernel
Cc: Eric Anholt, Wolfram Sang, Stephen Warren, Lee Jones,
open list:I2C SUBSYSTEM,
moderated list:BROADCOM BCM2835 ARM ARCHITECTURE, open list
From: Eric Anholt <eric@anholt.net>
We were leaving them in the power on state (or the state the firmware
had set up for some client, if we were taking over from them). The
boot state was 30 core clocks, when we actually want to sample some
time after (to make sure that the new input bit has actually arrived).
Signed-off-by: Eric Anholt <eric@anholt.net>
---
drivers/i2c/busses/i2c-bcm2835.c | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/drivers/i2c/busses/i2c-bcm2835.c b/drivers/i2c/busses/i2c-bcm2835.c
index d4f3239..d1d17e4 100644
--- a/drivers/i2c/busses/i2c-bcm2835.c
+++ b/drivers/i2c/busses/i2c-bcm2835.c
@@ -50,6 +50,9 @@
#define BCM2835_I2C_S_CLKT BIT(9)
#define BCM2835_I2C_S_LEN BIT(10) /* Fake bit for SW error reporting */
+#define BCM2835_I2C_FEDL_SHIFT 16
+#define BCM2835_I2C_REDL_SHIFT 0
+
#define BCM2835_I2C_BITMSK_S 0x03FF
#define BCM2835_I2C_CDIV_MIN 0x0002
@@ -235,7 +238,7 @@ static int bcm2835_i2c_probe(struct platform_device *pdev)
{
struct bcm2835_i2c_dev *i2c_dev;
struct resource *mem, *irq;
- u32 bus_clk_rate, divider;
+ u32 bus_clk_rate, divider, redl, fedl;
int ret;
struct i2c_adapter *adap;
@@ -281,6 +284,20 @@ static int bcm2835_i2c_probe(struct platform_device *pdev)
}
bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_DIV, divider);
+ /* Number of core clocks to wait after falling edge before
+ * outputting the next data bit. Note that both FEDL and REDL
+ * can't be greater than CDIV/2.
+ */
+ fedl = max(divider / 16, 1u);
+ /* Number of core clocks to wait after rising edge before
+ * sampling the next incoming data bit.
+ */
+ redl = max(divider / 4, 1u);
+
+ bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_DEL,
+ (fedl << BCM2835_I2C_FEDL_SHIFT) |
+ (redl << BCM2835_I2C_REDL_SHIFT));
+
irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
if (!irq) {
dev_err(&pdev->dev, "No IRQ resource\n");
--
1.8.3.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 28/32] i2c: bcm2835: Set up the rising/falling edge delays.
2016-06-01 21:43 ` [PATCH 28/32] i2c: bcm2835: Set up the rising/falling edge delays Gerd Hoffmann
@ 2016-07-22 7:26 ` Wolfram Sang
0 siblings, 0 replies; 4+ messages in thread
From: Wolfram Sang @ 2016-07-22 7:26 UTC (permalink / raw)
To: Gerd Hoffmann
Cc: linux-rpi-kernel, Eric Anholt, Stephen Warren, Lee Jones,
open list:I2C SUBSYSTEM,
moderated list:BROADCOM BCM2835 ARM ARCHITECTURE, open list
[-- Attachment #1: Type: text/plain, Size: 492 bytes --]
On Wed, Jun 01, 2016 at 11:43:37PM +0200, Gerd Hoffmann wrote:
> From: Eric Anholt <eric@anholt.net>
>
> We were leaving them in the power on state (or the state the firmware
> had set up for some client, if we were taking over from them). The
> boot state was 30 core clocks, when we actually want to sample some
> time after (to make sure that the new input bit has actually arrived).
>
> Signed-off-by: Eric Anholt <eric@anholt.net>
Gerd, your Signed-off is missing here.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 24/32] i2c: bcm2835: Don't complain on -EPROBE_DEFER from getting our clock
2016-06-01 21:43 ` [PATCH 24/32] i2c: bcm2835: Don't complain on -EPROBE_DEFER from getting our clock Gerd Hoffmann
@ 2016-07-22 7:26 ` Wolfram Sang
0 siblings, 0 replies; 4+ messages in thread
From: Wolfram Sang @ 2016-07-22 7:26 UTC (permalink / raw)
To: Gerd Hoffmann
Cc: linux-rpi-kernel, Eric Anholt, Stephen Warren, Lee Jones,
open list:I2C SUBSYSTEM,
moderated list:BROADCOM BCM2835 ARM ARCHITECTURE, open list
[-- Attachment #1: Type: text/plain, Size: 290 bytes --]
On Wed, Jun 01, 2016 at 11:43:33PM +0200, Gerd Hoffmann wrote:
> From: Eric Anholt <eric@anholt.net>
>
> Fixes dmesg spam when we just need to wait a moment for the clock
> driver to probe.
>
> Signed-off-by: Eric Anholt <eric@anholt.net>
I applied Eric's original patch now.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-07-22 7:26 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1464817421-8519-1-git-send-email-kraxel@redhat.com>
2016-06-01 21:43 ` [PATCH 24/32] i2c: bcm2835: Don't complain on -EPROBE_DEFER from getting our clock Gerd Hoffmann
2016-07-22 7:26 ` Wolfram Sang
2016-06-01 21:43 ` [PATCH 28/32] i2c: bcm2835: Set up the rising/falling edge delays Gerd Hoffmann
2016-07-22 7:26 ` Wolfram Sang
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).