Skip to content

Commit d8d7ceb

Browse files
committed
Only init gpio pins of selected i2c bus
1 parent a28383c commit d8d7ceb

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

drivers/i2c/busses/i2c-bcm2708.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,16 +97,17 @@ struct bcm2708_i2c {
9797
*
9898
* FIXME: This is a hack. Use pinmux / pinctrl.
9999
*/
100-
static void bcm2708_i2c_init_pinmode(void)
100+
static void bcm2708_i2c_init_pinmode(int id)
101101
{
102102
#define INP_GPIO(g) *(gpio+((g)/10)) &= ~(7<<(((g)%10)*3))
103103
#define SET_GPIO_ALT(g,a) *(gpio+(((g)/10))) |= (((a)<=3?(a)+4:(a)==4?3:2)<<(((g)%10)*3))
104104

105105
int pin;
106106
u32 *gpio = ioremap(0x20200000, SZ_16K);
107107

108+
BUG_ON(id != 0 && id != 1);
108109
/* BSC0 is on GPIO 0 & 1, BSC1 is on GPIO 2 & 3 */
109-
for (pin = 0; pin <= 3; pin++) {
110+
for (pin = id*2+0; pin <= id*2+1; pin++) {
110111
INP_GPIO(pin); /* set mode to GPIO input first */
111112
SET_GPIO_ALT(pin, 0); /* set mode to ALT 0 */
112113
}
@@ -279,7 +280,7 @@ static int __devinit bcm2708_i2c_probe(struct platform_device *pdev)
279280
return PTR_ERR(clk);
280281
}
281282

282-
bcm2708_i2c_init_pinmode();
283+
bcm2708_i2c_init_pinmode(pdev->id);
283284

284285
bi = kzalloc(sizeof(*bi), GFP_KERNEL);
285286
if (!bi)

0 commit comments

Comments
 (0)