Re: [PATCH V3 1/2] i2c/adapter: Add bus recovery infrastructure

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

 



On Mon, Apr 23, 2012 at 3:55 PM, viresh kumar <viresh.linux@xxxxxxxxx> wrote:
> On Mon, Apr 23, 2012 at 6:26 PM, Wolfram Sang <w.sang@xxxxxxxxxxxxxx> wrote:

>>> + * @set_scl: controller specific scl configuration routine. Only required if
>>> + *   is_gpio_recovery == false
>>> + * @get_sda: controller specific sda read routine. Only required if
>>> + *   is_gpio_recovery == false and skip_sda_polling == false.
>>> + * @get_gpio: called before recover_bus() to get padmux configured for scl line.
>>> + *   as gpio. Only required if is_gpio_recovery == true.
>>> + * @put_gpio: called after recover_bus() to get padmux configured for scl line
>>> + *   as scl. Only required if is_gpio_recovery == true.
>>
>> Can't we use the pinmux/pinctrl subsystem here? Not knowing too much
>> about it, CCing Linus.
>
> Can be. But probably true only for architectures where pinctrl is
> defined. Linus?

We *could* do it by defining a standard state for the pinctrl handle
in <linux/pinctrl/pinctrl-state.h> (pending in linux-next) like:

#define PINCTRL_STATE_GPIO "gpio"

Or so, then have the core grab that using the struct device * of this
pin controller, returing it to PINCTRL_STATE_DEFAULT afterwards.

It seems a bit scary to do that in core code though, because we
don't know which state we should return to, should it really
be default state?

And what if we're using GPIO bit-banging, then we grab the pins
into some state they're already in.

So to me it seems better to do this at driver level using these
hooks so the driver is in full control of the pinctrl states.

Stephen, do you agree?

But:

Many platforms I've seen actually have the ability to mux their
I2C pins into GPIO and bitbang them, sometimes this seems
to be used to work around broken silicon for example. And
it seems what is done here is simply some instance of
bitbanging (am I right?).

I wonder if it would make sense to model this in the core,
so any I2C driver can specify that it also supports bit-banging
using GPIO pins A,B and then this can be used for anything,
not just for this recovery.

So the above hooks should be possible to use to switch the
entire driver over to bitbang mode.

Yours,
Linus Walleij
--
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