Skip to content

Commit e244fae

Browse files
committed
Only init gpio pins of selected i2c bus
1 parent d4fc1ef commit e244fae

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

‎drivers/i2c/busses/i2c-bcm2708.c‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,16 +97,18 @@ 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++) {
111+
printk("bcm2708_i2c_init_pinmode(%d,%d)\n", id, pin);
110112
INP_GPIO(pin); /* set mode to GPIO input first */
111113
SET_GPIO_ALT(pin, 0); /* set mode to ALT 0 */
112114
}
@@ -279,7 +281,7 @@ static int bcm2708_i2c_probe(struct platform_device *pdev)
279281
return PTR_ERR(clk);
280282
}
281283

282-
bcm2708_i2c_init_pinmode();
284+
bcm2708_i2c_init_pinmode(pdev->id);
283285

284286
bi = kzalloc(sizeof(*bi), GFP_KERNEL);
285287
if (!bi)

0 commit comments

Comments
 (0)