mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-23 07:22:33 +00:00
bb39b8d99a
Update our copies of the brcm2708 patches to the latest rpi-3.10-y rebased against linux-3.10.y stable (3.10.32). This should hopefully make it easier for us in the future to leverage the raspberry/rpi-* branches. Signed-off-by: Florian Fainelli <florian@openwrt.org> SVN-Revision: 39770
71 lines
2.2 KiB
Diff
71 lines
2.2 KiB
Diff
From 17bb1be5d09fe58cd14084c5eac0052f03d6d71f Mon Sep 17 00:00:00 2001
|
|
From: popcornmix <popcornmix@gmail.com>
|
|
Date: Wed, 3 Oct 2012 20:08:19 +0100
|
|
Subject: [PATCH 036/174] set i2c speed via module-parameter or menuconfig.
|
|
Thanks FrankBoesing
|
|
|
|
---
|
|
drivers/i2c/busses/Kconfig | 11 +++++++++++
|
|
drivers/i2c/busses/i2c-bcm2708.c | 12 ++++++++----
|
|
2 files changed, 19 insertions(+), 4 deletions(-)
|
|
|
|
--- a/drivers/i2c/busses/Kconfig
|
|
+++ b/drivers/i2c/busses/Kconfig
|
|
@@ -353,6 +353,17 @@ config I2C_BCM2708
|
|
support for the BCM2708. BSC is a Broadcom proprietary bus compatible
|
|
with I2C/TWI/SMBus.
|
|
|
|
+config I2C_BCM2708_BAUDRATE
|
|
+ prompt "BCM2708 I2C baudrate"
|
|
+ depends on I2C_BCM2708
|
|
+ int
|
|
+ default 100000
|
|
+ help
|
|
+ Set the I2C baudrate. This will alter the default value. A
|
|
+ different baudrate can be set by using a module parameter as well. If
|
|
+ no parameter is provided when loading, this is the value that will be
|
|
+ used.
|
|
+
|
|
config I2C_BLACKFIN_TWI
|
|
tristate "Blackfin TWI I2C support"
|
|
depends on BLACKFIN
|
|
--- a/drivers/i2c/busses/i2c-bcm2708.c
|
|
+++ b/drivers/i2c/busses/i2c-bcm2708.c
|
|
@@ -66,11 +66,15 @@
|
|
#define BSC_S_DONE 0x00000002
|
|
#define BSC_S_TA 0x00000001
|
|
|
|
-#define I2C_CLOCK_HZ 100000 /* FIXME: get from DT */
|
|
#define I2C_TIMEOUT_MS 150
|
|
|
|
#define DRV_NAME "bcm2708_i2c"
|
|
|
|
+static unsigned int baudrate = CONFIG_I2C_BCM2708_BAUDRATE;
|
|
+module_param(baudrate, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
|
|
+MODULE_PARM_DESC(baudrate, "The I2C baudrate");
|
|
+
|
|
+
|
|
struct bcm2708_i2c {
|
|
struct i2c_adapter adapter;
|
|
|
|
@@ -148,7 +152,7 @@ static inline void bcm2708_bsc_setup(str
|
|
u32 c = BSC_C_I2CEN | BSC_C_INTD | BSC_C_ST | BSC_C_CLEAR_1;
|
|
|
|
bus_hz = clk_get_rate(bi->clk);
|
|
- cdiv = bus_hz / I2C_CLOCK_HZ;
|
|
+ cdiv = bus_hz / baudrate;
|
|
|
|
if (bi->msg->flags & I2C_M_RD)
|
|
c |= BSC_C_INTR | BSC_C_READ;
|
|
@@ -331,8 +335,8 @@ static int bcm2708_i2c_probe(struct plat
|
|
goto out_free_irq;
|
|
}
|
|
|
|
- dev_info(&pdev->dev, "BSC%d Controller at 0x%08lx (irq %d)\n",
|
|
- pdev->id, (unsigned long)regs->start, irq);
|
|
+ dev_info(&pdev->dev, "BSC%d Controller at 0x%08lx (irq %d) (baudrate %dk)\n",
|
|
+ pdev->id, (unsigned long)regs->start, irq, baudrate/1000);
|
|
|
|
return 0;
|
|
|