* Re: [PATCH] net: phy: dp83867: Fall-back to default values of clock delay and FIFO depth
@ 2017-02-08 18:20 ` Florian Fainelli
0 siblings, 0 replies; 11+ messages in thread
From: Florian Fainelli @ 2017-02-08 18:20 UTC (permalink / raw)
To: David Miller, Alexey.Brodkin
Cc: mugunthanvnm, grygorii.strashko, andrew, netdev, nsekhar,
linux-kernel, m-karicheri2, linux-snps-arc
On 02/08/2017 10:15 AM, David Miller wrote:
> From: Alexey Brodkin <Alexey.Brodkin@synopsys.com>
> Date: Mon, 6 Feb 2017 22:24:45 +0300
>
>> Given there're default values mentioned in the PHY datasheet
>> fall-back gracefully to them instead of silently return an error
>> through the whole call-chain.
>>
>> This allows to use minimalistic description in DT if no special
>> features are required.
>>
>> Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
>
> If these defaults are legitimate to use, then you should probably also
> set them in the non-CONFIG_OF_MDIO case implementation of
> dp83867_of_init().
IIRC this is what Alexey is doing already, in case of errors, instead of
returning the error code, he changes the default values and does not
propagate the error code.
Alexey, you are essentially making dp83867_of_init() impossible to fail
(or nearly) now, even with invalid properties, so I agree with David
here, you should probably have a function that runs after
dp83867_of_init() whose job is to set default values, if none have been
previously set through Device Tree.
>
> But I'd like to see feedback and reviews from other PHY area experts
> before I even consider that updated version of this change.
>
> Thanks.
>
--
Florian
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] net: phy: dp83867: Fall-back to default values of clock delay and FIFO depth
@ 2017-02-08 18:20 ` Florian Fainelli
0 siblings, 0 replies; 11+ messages in thread
From: Florian Fainelli @ 2017-02-08 18:20 UTC (permalink / raw)
To: David Miller, Alexey.Brodkin
Cc: netdev, linux-snps-arc, linux-kernel, m-karicheri2, nsekhar,
grygorii.strashko, mugunthanvnm, andrew
On 02/08/2017 10:15 AM, David Miller wrote:
> From: Alexey Brodkin <Alexey.Brodkin@synopsys.com>
> Date: Mon, 6 Feb 2017 22:24:45 +0300
>
>> Given there're default values mentioned in the PHY datasheet
>> fall-back gracefully to them instead of silently return an error
>> through the whole call-chain.
>>
>> This allows to use minimalistic description in DT if no special
>> features are required.
>>
>> Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
>
> If these defaults are legitimate to use, then you should probably also
> set them in the non-CONFIG_OF_MDIO case implementation of
> dp83867_of_init().
IIRC this is what Alexey is doing already, in case of errors, instead of
returning the error code, he changes the default values and does not
propagate the error code.
Alexey, you are essentially making dp83867_of_init() impossible to fail
(or nearly) now, even with invalid properties, so I agree with David
here, you should probably have a function that runs after
dp83867_of_init() whose job is to set default values, if none have been
previously set through Device Tree.
>
> But I'd like to see feedback and reviews from other PHY area experts
> before I even consider that updated version of this change.
>
> Thanks.
>
--
Florian
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH] net: phy: dp83867: Fall-back to default values of clock delay and FIFO depth
2017-02-08 18:20 ` Florian Fainelli
(?)
@ 2017-02-09 19:02 ` Alexey Brodkin
-1 siblings, 0 replies; 11+ messages in thread
From: Alexey Brodkin @ 2017-02-09 19:02 UTC (permalink / raw)
To: linux-snps-arc
Hi Florian,
On Wed, 2017-02-08@10:20 -0800, Florian Fainelli wrote:
> On 02/08/2017 10:15 AM, David Miller wrote:
> >
> > From: Alexey Brodkin <Alexey.Brodkin at synopsys.com>
> > Date: Mon,??6 Feb 2017 22:24:45 +0300
> >
> > >
> > > Given there're default values mentioned in the PHY datasheet
> > > fall-back gracefully to them instead of silently return an error
> > > through the whole call-chain.
> > >
> > > This allows to use minimalistic description in DT if no special
> > > features are required.
> > >
> > > Signed-off-by: Alexey Brodkin <abrodkin at synopsys.com>
> >
> > If these defaults are legitimate to use, then you should probably also
> > set them in the non-CONFIG_OF_MDIO case implementation of
> > dp83867_of_init().
>
> IIRC this is what Alexey is doing already, in case of errors, instead of
> returning the error code, he changes the default values and does not
> propagate the error code.
>
> Alexey, you are essentially making dp83867_of_init() impossible to fail
> (or nearly) now, even with invalid properties, so I agree with David
> here, you should probably have a function that runs after
> dp83867_of_init() whose job is to set default values, if none have been
> previously set through Device Tree.
But why do we need to return error code from?dp83867_of_init()?
The point is this function doesn't do any hardware setup as well,
in fact it doesn't even reads anything from real hardware.
So we may indeed report an error to above callers (which is not super convenient
because the error comes many levels above without any error message making
understanding of the failure pretty complicated - go trace where it came from)
but what would it mean to a user? What do we want our user to do?
Set at least something in required properties? Then why don't we do that ourselves
right in the driver? Moreover since we're talking about defaults mentioned by
the PHY manufacturer we will just use "factory settings". Still allowing others to
override defaults with their .dts.
I agree with David that it really worth to do the same settings for non_CONFIG_OF_MDIO
case.
-Alexey
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] net: phy: dp83867: Fall-back to default values of clock delay and FIFO depth
@ 2017-02-09 19:02 ` Alexey Brodkin
0 siblings, 0 replies; 11+ messages in thread
From: Alexey Brodkin @ 2017-02-09 19:02 UTC (permalink / raw)
To: f.fainelli@gmail.com
Cc: andrew@lunn.ch, grygorii.strashko@ti.com, mugunthanvnm@ti.com,
netdev@vger.kernel.org, nsekhar@ti.com,
linux-kernel@vger.kernel.org, m-karicheri2@ti.com,
linux-snps-arc@lists.infradead.org, davem@davemloft.net
Hi Florian,
On Wed, 2017-02-08 at 10:20 -0800, Florian Fainelli wrote:
> On 02/08/2017 10:15 AM, David Miller wrote:
> >
> > From: Alexey Brodkin <Alexey.Brodkin@synopsys.com>
> > Date: Mon, 6 Feb 2017 22:24:45 +0300
> >
> > >
> > > Given there're default values mentioned in the PHY datasheet
> > > fall-back gracefully to them instead of silently return an error
> > > through the whole call-chain.
> > >
> > > This allows to use minimalistic description in DT if no special
> > > features are required.
> > >
> > > Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
> >
> > If these defaults are legitimate to use, then you should probably also
> > set them in the non-CONFIG_OF_MDIO case implementation of
> > dp83867_of_init().
>
> IIRC this is what Alexey is doing already, in case of errors, instead of
> returning the error code, he changes the default values and does not
> propagate the error code.
>
> Alexey, you are essentially making dp83867_of_init() impossible to fail
> (or nearly) now, even with invalid properties, so I agree with David
> here, you should probably have a function that runs after
> dp83867_of_init() whose job is to set default values, if none have been
> previously set through Device Tree.
But why do we need to return error code from dp83867_of_init()?
The point is this function doesn't do any hardware setup as well,
in fact it doesn't even reads anything from real hardware.
So we may indeed report an error to above callers (which is not super convenient
because the error comes many levels above without any error message making
understanding of the failure pretty complicated - go trace where it came from)
but what would it mean to a user? What do we want our user to do?
Set at least something in required properties? Then why don't we do that ourselves
right in the driver? Moreover since we're talking about defaults mentioned by
the PHY manufacturer we will just use "factory settings". Still allowing others to
override defaults with their .dts.
I agree with David that it really worth to do the same settings for non_CONFIG_OF_MDIO
case.
-Alexey
_______________________________________________
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] net: phy: dp83867: Fall-back to default values of clock delay and FIFO depth
@ 2017-02-09 19:02 ` Alexey Brodkin
0 siblings, 0 replies; 11+ messages in thread
From: Alexey Brodkin @ 2017-02-09 19:02 UTC (permalink / raw)
To: f.fainelli@gmail.com
Cc: andrew@lunn.ch, linux-kernel@vger.kernel.org, nsekhar@ti.com,
m-karicheri2@ti.com, mugunthanvnm@ti.com,
linux-snps-arc@lists.infradead.org, grygorii.strashko@ti.com,
netdev@vger.kernel.org, davem@davemloft.net
Hi Florian,
On Wed, 2017-02-08 at 10:20 -0800, Florian Fainelli wrote:
> On 02/08/2017 10:15 AM, David Miller wrote:
> >
> > From: Alexey Brodkin <Alexey.Brodkin@synopsys.com>
> > Date: Mon, 6 Feb 2017 22:24:45 +0300
> >
> > >
> > > Given there're default values mentioned in the PHY datasheet
> > > fall-back gracefully to them instead of silently return an error
> > > through the whole call-chain.
> > >
> > > This allows to use minimalistic description in DT if no special
> > > features are required.
> > >
> > > Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
> >
> > If these defaults are legitimate to use, then you should probably also
> > set them in the non-CONFIG_OF_MDIO case implementation of
> > dp83867_of_init().
>
> IIRC this is what Alexey is doing already, in case of errors, instead of
> returning the error code, he changes the default values and does not
> propagate the error code.
>
> Alexey, you are essentially making dp83867_of_init() impossible to fail
> (or nearly) now, even with invalid properties, so I agree with David
> here, you should probably have a function that runs after
> dp83867_of_init() whose job is to set default values, if none have been
> previously set through Device Tree.
But why do we need to return error code from dp83867_of_init()?
The point is this function doesn't do any hardware setup as well,
in fact it doesn't even reads anything from real hardware.
So we may indeed report an error to above callers (which is not super convenient
because the error comes many levels above without any error message making
understanding of the failure pretty complicated - go trace where it came from)
but what would it mean to a user? What do we want our user to do?
Set at least something in required properties? Then why don't we do that ourselves
right in the driver? Moreover since we're talking about defaults mentioned by
the PHY manufacturer we will just use "factory settings". Still allowing others to
override defaults with their .dts.
I agree with David that it really worth to do the same settings for non_CONFIG_OF_MDIO
case.
-Alexey
^ permalink raw reply [flat|nested] 11+ messages in thread