diff mbox series

net: zynq: Add support for mdio bus address decoding

Message ID 18d08c5410d34f2d7d3bb63b1dc7874b71f639af.1637237178.git.michal.simek@xilinx.com
State Superseded
Delegated to: Michal Simek
Headers show
Series net: zynq: Add support for mdio bus address decoding | expand

Commit Message

Michal Simek Nov. 18, 2021, 12:06 p.m. UTC
There are flying two configurations around.
The first (already supported) has phy as subnode of gem node.
The second has mdio subnode (with mdio name) which has phy subnode.

This patch adds support for the second case where mdio subnode
is found driver will look at its parent to find out which gem is handling
MDIO bus.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---

 drivers/net/zynq_gem.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Ramon Fried Nov. 21, 2021, 7:11 p.m. UTC | #1
On Thu, Nov 18, 2021 at 2:06 PM Michal Simek <michal.simek@xilinx.com> wrote:
>
> There are flying two configurations around.
Can you rephrase ? I don't understand.
> The first (already supported) has phy as subnode of gem node.
> The second has mdio subnode (with mdio name) which has phy subnode.
>
> This patch adds support for the second case where mdio subnode
> is found driver will look at its parent to find out which gem is handling
> MDIO bus.
>
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> ---
>
>  drivers/net/zynq_gem.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/net/zynq_gem.c b/drivers/net/zynq_gem.c
> index 033021f1cbfc..91957757727d 100644
> --- a/drivers/net/zynq_gem.c
> +++ b/drivers/net/zynq_gem.c
> @@ -804,6 +804,9 @@ static int zynq_gem_of_to_plat(struct udevice *dev)
>                                                           SPEED_1000);
>
>                 parent = ofnode_get_parent(phandle_args.node);
> +               if (ofnode_name_eq(parent, "mdio"))
> +                       parent = ofnode_get_parent(parent);
> +
>                 addr = ofnode_get_addr(parent);
>                 if (addr != FDT_ADDR_T_NONE) {
>                         debug("MDIO bus not found %s\n", dev->name);
> --
> 2.33.1
>
Michal Simek Nov. 22, 2021, 7:40 a.m. UTC | #2
On 11/21/21 20:11, Ramon Fried wrote:
> On Thu, Nov 18, 2021 at 2:06 PM Michal Simek <michal.simek@xilinx.com> wrote:
>>
>> There are flying two configurations around.
> Can you rephrase ? I don't understand.

The first configuration is
eth {
	phy-handle = <&phy0>;
         phy0: ethernet-phy@21 {
		...
	};
};

The second is (based on mdio.yaml)
eth {
	phy-handle = <&phy0>;
	mdio {
	        phy0: ethernet-phy@21 {
			...
		};
	};
};

Xilinx dts files are using both ways. But the second case is not fully 
when you have one mdio bus shared with at least 2 phys where one phy is 
connected to another gem controller.
This code is updating logic which finds which gen controller is mdio bus 
owner.

Please let me know if you want me to update commit message.

Thanks,
Michal


>> The first (already supported) has phy as subnode of gem node.
>> The second has mdio subnode (with mdio name) which has phy subnode.
>>
>> This patch adds support for the second case where mdio subnode
>> is found driver will look at its parent to find out which gem is handling
>> MDIO bus.
>>
>> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
>> ---
>>
>>   drivers/net/zynq_gem.c | 3 +++
>>   1 file changed, 3 insertions(+)
>>
>> diff --git a/drivers/net/zynq_gem.c b/drivers/net/zynq_gem.c
>> index 033021f1cbfc..91957757727d 100644
>> --- a/drivers/net/zynq_gem.c
>> +++ b/drivers/net/zynq_gem.c
>> @@ -804,6 +804,9 @@ static int zynq_gem_of_to_plat(struct udevice *dev)
>>                                                            SPEED_1000);
>>
>>                  parent = ofnode_get_parent(phandle_args.node);
>> +               if (ofnode_name_eq(parent, "mdio"))
>> +                       parent = ofnode_get_parent(parent);
>> +
>>                  addr = ofnode_get_addr(parent);
>>                  if (addr != FDT_ADDR_T_NONE) {
>>                          debug("MDIO bus not found %s\n", dev->name);
>> --
>> 2.33.1
>>
Ramon Fried Nov. 22, 2021, 10:36 a.m. UTC | #3
On Mon, Nov 22, 2021 at 9:40 AM Michal Simek <michal.simek@xilinx.com> wrote:
>
>
>
> On 11/21/21 20:11, Ramon Fried wrote:
> > On Thu, Nov 18, 2021 at 2:06 PM Michal Simek <michal.simek@xilinx.com> wrote:
> >>
> >> There are flying two configurations around.
> > Can you rephrase ? I don't understand.
>
> The first configuration is
> eth {
>         phy-handle = <&phy0>;
>          phy0: ethernet-phy@21 {
>                 ...
>         };
> };
>
> The second is (based on mdio.yaml)
> eth {
>         phy-handle = <&phy0>;
>         mdio {
>                 phy0: ethernet-phy@21 {
>                         ...
>                 };
>         };
> };
>
> Xilinx dts files are using both ways. But the second case is not fully
> when you have one mdio bus shared with at least 2 phys where one phy is
> connected to another gem controller.
> This code is updating logic which finds which gen controller is mdio bus
> owner.
>
> Please let me know if you want me to update commit message.
>
> Thanks,
> Michal
>
>
> >> The first (already supported) has phy as subnode of gem node.
> >> The second has mdio subnode (with mdio name) which has phy subnode.
> >>
> >> This patch adds support for the second case where mdio subnode
> >> is found driver will look at its parent to find out which gem is handling
> >> MDIO bus.
> >>
> >> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> >> ---
> >>
> >>   drivers/net/zynq_gem.c | 3 +++
> >>   1 file changed, 3 insertions(+)
> >>
> >> diff --git a/drivers/net/zynq_gem.c b/drivers/net/zynq_gem.c
> >> index 033021f1cbfc..91957757727d 100644
> >> --- a/drivers/net/zynq_gem.c
> >> +++ b/drivers/net/zynq_gem.c
> >> @@ -804,6 +804,9 @@ static int zynq_gem_of_to_plat(struct udevice *dev)
> >>                                                            SPEED_1000);
> >>
> >>                  parent = ofnode_get_parent(phandle_args.node);
> >> +               if (ofnode_name_eq(parent, "mdio"))
> >> +                       parent = ofnode_get_parent(parent);
> >> +
> >>                  addr = ofnode_get_addr(parent);
> >>                  if (addr != FDT_ADDR_T_NONE) {
> >>                          debug("MDIO bus not found %s\n", dev->name);
> >> --
> >> 2.33.1
> >>
"There are flying two configurations around."
The above sentence is semantically incorrect, just fix that.
Michal Simek Dec. 6, 2021, 1:53 p.m. UTC | #4
On 11/22/21 11:36, Ramon Fried wrote:
> On Mon, Nov 22, 2021 at 9:40 AM Michal Simek <michal.simek@xilinx.com> wrote:
>>
>>
>>
>> On 11/21/21 20:11, Ramon Fried wrote:
>>> On Thu, Nov 18, 2021 at 2:06 PM Michal Simek <michal.simek@xilinx.com> wrote:
>>>>
>>>> There are flying two configurations around.
>>> Can you rephrase ? I don't understand.
>>
>> The first configuration is
>> eth {
>>          phy-handle = <&phy0>;
>>           phy0: ethernet-phy@21 {
>>                  ...
>>          };
>> };
>>
>> The second is (based on mdio.yaml)
>> eth {
>>          phy-handle = <&phy0>;
>>          mdio {
>>                  phy0: ethernet-phy@21 {
>>                          ...
>>                  };
>>          };
>> };
>>
>> Xilinx dts files are using both ways. But the second case is not fully
>> when you have one mdio bus shared with at least 2 phys where one phy is
>> connected to another gem controller.
>> This code is updating logic which finds which gen controller is mdio bus
>> owner.
>>
>> Please let me know if you want me to update commit message.
>>
>> Thanks,
>> Michal
>>
>>
>>>> The first (already supported) has phy as subnode of gem node.
>>>> The second has mdio subnode (with mdio name) which has phy subnode.
>>>>
>>>> This patch adds support for the second case where mdio subnode
>>>> is found driver will look at its parent to find out which gem is handling
>>>> MDIO bus.
>>>>
>>>> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
>>>> ---
>>>>
>>>>    drivers/net/zynq_gem.c | 3 +++
>>>>    1 file changed, 3 insertions(+)
>>>>
>>>> diff --git a/drivers/net/zynq_gem.c b/drivers/net/zynq_gem.c
>>>> index 033021f1cbfc..91957757727d 100644
>>>> --- a/drivers/net/zynq_gem.c
>>>> +++ b/drivers/net/zynq_gem.c
>>>> @@ -804,6 +804,9 @@ static int zynq_gem_of_to_plat(struct udevice *dev)
>>>>                                                             SPEED_1000);
>>>>
>>>>                   parent = ofnode_get_parent(phandle_args.node);
>>>> +               if (ofnode_name_eq(parent, "mdio"))
>>>> +                       parent = ofnode_get_parent(parent);
>>>> +
>>>>                   addr = ofnode_get_addr(parent);
>>>>                   if (addr != FDT_ADDR_T_NONE) {
>>>>                           debug("MDIO bus not found %s\n", dev->name);
>>>> --
>>>> 2.33.1
>>>>
> "There are flying two configurations around."
> The above sentence is semantically incorrect, just fix that.
> 

v2 sent.

Thanks,
Michal
diff mbox series

Patch

diff --git a/drivers/net/zynq_gem.c b/drivers/net/zynq_gem.c
index 033021f1cbfc..91957757727d 100644
--- a/drivers/net/zynq_gem.c
+++ b/drivers/net/zynq_gem.c
@@ -804,6 +804,9 @@  static int zynq_gem_of_to_plat(struct udevice *dev)
 							  SPEED_1000);
 
 		parent = ofnode_get_parent(phandle_args.node);
+		if (ofnode_name_eq(parent, "mdio"))
+			parent = ofnode_get_parent(parent);
+
 		addr = ofnode_get_addr(parent);
 		if (addr != FDT_ADDR_T_NONE) {
 			debug("MDIO bus not found %s\n", dev->name);