@@ -324,20 +324,22 @@ static struct platform_device at91sam9261_twi_device = {
void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
{
- /* IP version is not the same on 9261 and g10 */
+ /*
+ * IP version is not the same on 9261 and g10 and only 9261 one
+ * requires to configure PIO as open-drain.
+ */
if (cpu_is_at91sam9g10()) {
at91sam9261_twi_device.name = "i2c-at91sam9g10";
+ at91_set_A_periph(AT91_PIN_PA7, 0); /* TWD */
+ at91_set_A_periph(AT91_PIN_PA8, 0); /* TWCK */
} else {
at91sam9261_twi_device.name = "i2c-at91sam9261";
+ at91_set_A_periph(AT91_PIN_PA7, 0); /* TWD */
+ at91_set_multi_drive(AT91_PIN_PA7, 1);
+ at91_set_A_periph(AT91_PIN_PA8, 0); /* TWCK */
+ at91_set_multi_drive(AT91_PIN_PA8, 1);
}
- /* pins used for TWI interface */
- at91_set_A_periph(AT91_PIN_PA7, 0); /* TWD */
- at91_set_multi_drive(AT91_PIN_PA7, 1);
-
- at91_set_A_periph(AT91_PIN_PA8, 0); /* TWCK */
- at91_set_multi_drive(AT91_PIN_PA8, 1);
-
i2c_register_board_info(0, devices, nr_devices);
platform_device_register(&at91sam9261_twi_device);
}