Re: [5/5] i2c: davinci: use ICPFUNC to toggle I2C as gpio for bus recovery

From: Grygorii Strashko
Date: Mon Nov 24 2014 - 14:22:56 EST


On 11/24/2014 08:13 PM, Mike Looijmans wrote:
> On 24-11-2014 14:15, Grygorii Strashko wrote:
>> Hi Uwe,
>> On 11/23/2014 07:04 PM, Uwe Kleine-König wrote:
>>> On Thu, Nov 20, 2014 at 12:03:08PM +0200, Grygorii Strashko wrote:
>>>> @@ -664,6 +759,7 @@ static int davinci_i2c_probe(struct
>>>> platform_device *pdev)
>>>> if (!of_property_read_u32(pdev->dev.of_node,
>>>> "clock-frequency",
>>>> &prop))
>>>> dev->pdata->bus_freq = prop / 1000;
>>>> + dev->pdata->has_pfunc = true;
>>> I don't understand this. Why does this ICPFUNC recovery work if the bus
>>> is probed by oftree, but doesn't if not?
>> I've mentioned this in commit message:
>> Allow platforms to indicate the presence of the ICPFUNC registers
>> with a has_pfunc
>> platform data flag and enable this mode for platforms which supports
>> DT (da850 and
>> Keystone 2 are two SoCs which support DT now and they also support
>> ICPFUNC registers).
>>
>> I'll add proper comment here.
>
> Just thinking: What happens if you try to use the ICPFUNC registers on
> platforms that don't support it? If the answer is "nothing bad", then
> you might as well assume that if the platform doesn't specify its own
> GPIOs, you can always try using the ICPFUNC registers to shake the I2C
> bus. Better to try and fail than to never try at all...
>

I think the right answer is !"nothing bad".

My intention was to enable this feature by default, because current DT-compatible
SoCs support it and the possibility that older SoCs will migrate to DT is low.
But now I think that the right way will be to add proper compatible strings
and use them to detect if ICPFUNC registers are supported or not.

[...]

regards,
-grygorii
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/