2014-09-27 19:10:51 +00:00
|
|
|
From f038d0681b072b929bb026bbb539cc8575d30c4f Mon Sep 17 00:00:00 2001
|
2014-02-28 20:30:08 +00:00
|
|
|
From: popcornmix <popcornmix@gmail.com>
|
|
|
|
Date: Sat, 8 Jun 2013 22:14:13 +0100
|
2014-09-27 19:10:51 +00:00
|
|
|
Subject: [PATCH 066/196] Only init gpio pins of selected i2c bus
|
2014-02-28 20:30:08 +00:00
|
|
|
|
|
|
|
---
|
|
|
|
drivers/i2c/busses/i2c-bcm2708.c | 8 +++++---
|
|
|
|
1 file changed, 5 insertions(+), 3 deletions(-)
|
|
|
|
|
2014-09-27 19:10:51 +00:00
|
|
|
diff --git a/drivers/i2c/busses/i2c-bcm2708.c b/drivers/i2c/busses/i2c-bcm2708.c
|
|
|
|
index 3391889..edc90c0 100644
|
2014-02-28 20:30:08 +00:00
|
|
|
--- a/drivers/i2c/busses/i2c-bcm2708.c
|
|
|
|
+++ b/drivers/i2c/busses/i2c-bcm2708.c
|
|
|
|
@@ -97,7 +97,7 @@ struct bcm2708_i2c {
|
|
|
|
*
|
|
|
|
* FIXME: This is a hack. Use pinmux / pinctrl.
|
|
|
|
*/
|
|
|
|
-static void bcm2708_i2c_init_pinmode(void)
|
|
|
|
+static void bcm2708_i2c_init_pinmode(int id)
|
|
|
|
{
|
|
|
|
#define INP_GPIO(g) *(gpio+((g)/10)) &= ~(7<<(((g)%10)*3))
|
|
|
|
#define SET_GPIO_ALT(g,a) *(gpio+(((g)/10))) |= (((a)<=3?(a)+4:(a)==4?3:2)<<(((g)%10)*3))
|
2014-09-27 19:10:51 +00:00
|
|
|
@@ -105,8 +105,10 @@ static void bcm2708_i2c_init_pinmode(void)
|
2014-02-28 20:30:08 +00:00
|
|
|
int pin;
|
|
|
|
u32 *gpio = ioremap(0x20200000, SZ_16K);
|
|
|
|
|
|
|
|
+ BUG_ON(id != 0 && id != 1);
|
|
|
|
/* BSC0 is on GPIO 0 & 1, BSC1 is on GPIO 2 & 3 */
|
|
|
|
- for (pin = 0; pin <= 3; pin++) {
|
|
|
|
+ for (pin = id*2+0; pin <= id*2+1; pin++) {
|
|
|
|
+printk("bcm2708_i2c_init_pinmode(%d,%d)\n", id, pin);
|
|
|
|
INP_GPIO(pin); /* set mode to GPIO input first */
|
|
|
|
SET_GPIO_ALT(pin, 0); /* set mode to ALT 0 */
|
|
|
|
}
|
2014-09-27 19:10:51 +00:00
|
|
|
@@ -279,7 +281,7 @@ static int bcm2708_i2c_probe(struct platform_device *pdev)
|
2014-02-28 20:30:08 +00:00
|
|
|
return PTR_ERR(clk);
|
|
|
|
}
|
|
|
|
|
|
|
|
- bcm2708_i2c_init_pinmode();
|
|
|
|
+ bcm2708_i2c_init_pinmode(pdev->id);
|
|
|
|
|
|
|
|
bi = kzalloc(sizeof(*bi), GFP_KERNEL);
|
|
|
|
if (!bi)
|
2014-09-27 19:10:51 +00:00
|
|
|
--
|
|
|
|
1.9.1
|
|
|
|
|