From mboxrd@z Thu Jan 1 00:00:00 1970 From: Grygorii Strashko Subject: Re: [5/5] i2c: davinci: use ICPFUNC to toggle I2C as gpio for bus recovery Date: Mon, 24 Nov 2014 21:22:24 +0200 Message-ID: <54738570.8070601@ti.com> References: <1416477788-5544-6-git-send-email-grygorii.strashko@ti.com> <20141123170400.GC4431@pengutronix.de> <54732F8E.4080105@ti.com> <54737532.1050808@milosoftware.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: In-Reply-To: <54737532.1050808-KQxf8TFvCoAi8rCdYzckzA@public.gmane.org> Sender: linux-i2c-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Mike Looijmans , =?windows-1252?Q?Uwe_Kleine?= =?windows-1252?Q?-K=F6nig?= Cc: Wolfram Sang , linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Sekhar Nori , Kevin Hilman , Santosh Shilimkar , Murali Karicheri , Ben Gardiner , Mike Looijmans List-Id: linux-i2c@vger.kernel.org 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=F6nig wrote: >>> On Thu, Nov 20, 2014 at 12:03:08PM +0200, Grygorii Strashko wrote: >>>> @@ -664,6 +759,7 @@ static int davinci_i2c_probe(struct=20 >>>> platform_device *pdev) >>>> if (!of_property_read_u32(pdev->dev.of_node,=20 >>>> "clock-frequency", >>>> &prop)) >>>> dev->pdata->bus_freq =3D prop / 1000; >>>> + dev->pdata->has_pfunc =3D 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=20 >> with a has_pfunc >> platform data flag and enable this mode for platforms which suppor= ts=20 >> DT (da850 and >> Keystone 2 are two SoCs which support DT now and they also support= =20 >> ICPFUNC registers). >> >> I'll add proper comment here. >=20 > Just thinking: What happens if you try to use the ICPFUNC registers o= n=20 > platforms that don't support it? If the answer is "nothing bad", then= =20 > you might as well assume that if the platform doesn't specify its own= =20 > GPIOs, you can always try using the ICPFUNC registers to shake the I2= C=20 > bus. Better to try and fail than to never try at all... >=20 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 str= ings and use them to detect if ICPFUNC registers are supported or not. [...] regards, -grygorii