Re: [PATCH v2 1/3] dt-bindings: net: fsl-fec add mdc/mdio bitbang option

From: Florian Fainelli
Date: Mon Nov 30 2020 - 17:09:24 EST




On 11/29/2020 3:04 PM, Andrew Lunn wrote:
> On Sun, Nov 29, 2020 at 11:51:43PM +0100, Adrien Grassein wrote:
>> Hi Andrew,
>>
>> Please find my answers below.
>>
>> Le dim. 29 nov. 2020 à 23:41, Andrew Lunn <andrew@xxxxxxx> a écrit :
>>
>> On Sun, Nov 29, 2020 at 10:59:58PM +0100, Adrien Grassein wrote:
>> > Add dt-bindings explanation for the two new gpios
>> > (mdio and mdc) used for bitbanging.
>>
>> Hi Adrien
>>
>> What is missing is an explanation of why!
>>
>> I'm sorry, it's my first upstreaming attempt.
>
> Hi Adrien
>
> Please take a look at
>
> https://www.kernel.org/doc/html/latest/networking/netdev-FAQ.html
>
> It is normal to have a patch 0/X which explains the big picture.
>
> Then the commit message for each patch should explain why you are
> doing something. That is much more important than what you are doing,
> i can see that from the patch itself.
>
>> I am currently upstreaming the "Nitrogen 8m Mini board" that seems to not use a
>> "normal" mdio bus but a "bitbanged" one with the fsl fec driver.
>
> Any idea why?
>
> Anyway, you should not replicate code, don't copy bitbanging code into
> the FEC. Just use the existing bit-banger MDIO bus master driver.

Right there should be no need for you to modify the FEC driver at all,
there is an existing generic bitbanged MDIO bus driver here:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/net/mdio/mdio-gpio.c

with its binding here:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/net/mdio-gpio.txt

so all you should need to do is make sure that you place a
"virtual,mdio-gpio" node, declare the PHY devices that are present on
that bus, and have your FEC nodes point to those PHY devices with an
appropriate 'phy-handle' property.
--
Florian