Re: Implementing bus recovery

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Prepare_recovery and unprepare_recovery are to configure the pad
multiplexer since thats platform specific. You don't care about the
adapter reference as you just need the scl_gpio and sda_gpio values to
know what pins to reconfigure.

In fact Atmel's pad mux functions look like this:

at91_set_A_periph(unsigned pin, int use_pullup)
at91_set_B_periph(unsigned pin, int use_pullup)
at91_set_C_periph(unsigned pin, int use_pullup)
.....


Here's the latest(or close) driver specific patch that slipped through
the cracks it seems?
http://www.spinics.net/lists/linux-i2c/msg11357.html


Bus_recovery itself you have to call in the at91 driver on a
controller timeout just like the patch does.
 if (ret == 0) {
                 dev_err(dev->dev, "controller timed out\n");
-                at91_init_twi_bus(dev);
 +                if (i2c_recover_bus(dev->adapter->bus_recovery_info) < 0)
 +                      at91_init_twi_bus(dev);

                 ret = -ETIMEDOUT;
                 goto error;
}

the call stack looks something like this

--at91_twi_xfer
----- i2c_recover_bus
--------- i2c_generic_gpio_recovery
-------------i2c_get_gpios_for_recovery  (requests gpios)
-------------i2c_generic_recovery
----------------prepare_recovery         (configure padmux to put gpio
on the pin)
----------------get_sda, get_scl          (get gpio value, generic
function by default is fine for atmel)
----------------set_scl                       (set scl value, generic
function by default is fine for atmel)
----------------unrepare_recovery       (configure padmux to put twi
back on the pin)
-------------i2c_put_gpios_for_recovery (frees gpios)


Somewhere in at91_twi_probe before the adapter is registered you also
have to setup the bus_recovery_info struct and set recover_bus to the
i2c_generic_gpio_recovery function similar to the patch linked.
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux