[RFC PATCH] net, qe: add DM support for QE UEC ethernet

Heiko Schocher hs at denx.de
Wed Apr 15 08:24:30 CEST 2020


Hello Qiang Zhao,

Am 15.04.2020 um 06:57 schrieb Heiko Schocher:
> Hello Qiang Zhao,
> 
> Am 09.04.2020 um 10:00 schrieb Qiang Zhao:
>> On 2020/4/9 13:20, Heiko Schocher <hs at denx.de> wrote:
>>
>>
>>> -----Original Message-----
>>> From: Heiko Schocher <hs at denx.de>
>>> Sent: 2020年4月9日 13:19
>>> To: Priyanka Jain <priyanka.jain at nxp.com>
>>> Cc: U-Boot Mailing List <u-boot at lists.denx.de>; Holger Brunck
>>> <holger.brunck at ch.abb.com>; Joe Hershberger <joe.hershberger at ni.com>;
>>> Mario Six <mario.six at gdsys.cc>; Qiang Zhao <qiang.zhao at nxp.com>
>>> Subject: Re: [RFC PATCH] net, qe: add DM support for QE UEC ethernet
>>>
>>> Hello Priyanka,
>>>
>>> Am 18.02.2020 um 10:05 schrieb Heiko Schocher:
>>>> add DM/DTS suppor for the UEC ethernet on QUICC Engine Block.
>>>>
>>>> Signed-off-by: Heiko Schocher <hs at denx.de>
>>>> ---
>>>> Travis build:
>>>>
>>>> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Ftrav
>>>>
>>> is-ci.org%2Fhsdenx%2Fu-boot-test%2Fbuilds%2F651400509&data=02%7C
>>> 01
>>>> %7Cqiang.zhao%40nxp.com%7C51477945d03e4b72383708d7dc458e7e%7C
>>> 686ea1d3b
>>>>
>>> c2b4c6fa92cd99c5c301635%7C0%7C0%7C637220063612830833&sdata
>>> =MALxWjN
>>>> kO0lgq1b0gmk646eEI8HWZUXRqTHt6zaOQPk%3D&reserved=0
>>>>
>>>> - I let the old none DM based implementation in code
>>>>     so boards should work with old implementation.
>>>>     This Code should be removed if all boards are converted
>>>>     to DM/DTS.
>>>>
>>>> - add the DM based qe uec driver under drivers/net/qe
>>>>
>>>> - Therefore copied the files uccf.c uccf.h uec.h from
>>>>     drivers/qe. So there are a lot of Codingstyle problems
>>>>     currently. I fix them in next version if this RFC
>>>>     patch is OK or it needs some changes.
>>>>
>>>> - The dm based driver code is now under drivers/net/qe/dm_qe_uec.c
>>>>     Used a lot of functions from drivers/qe/uec.c
>>>>
>>>> - seperated the PHY specific code into seperate file
>>>>     drivers/net/qe/dm_qe_uec_phy.c
>>
>> There are so much duplicated codes.
> 
> Yes, as I do not want to break other boards, as I said in comment.
> 
> If all boards are moved to this new driver, we can remove the old code.
> 
>> And what the dts node looks like?
>> Could you please give an example?
> 
> Uh, indeed, I did not add an entry in "doc/device-tree-bindings/"
> 
> I add this in next version.
> 
> Same as in linux:
> 
> MDIO:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/powerpc/boot/dts/kmeter1.dts#n426 
> 
> 
> 
>              mdio at 3320 {
>                  #address-cells = <1>;
>                  #size-cells = <0>;
>                  reg = <0x3320 0x18>;
>                  compatible = "fsl,ucc-mdio";
> 
>                  /* Piggy2 (UCC4, MDIO 0x00, RMII) */
>                  phy_piggy2: ethernet-phy at 0 {
>                      reg = <0x0>;
>                  };
>              [...]

Thanks for this question!

There is already a phy driver drivers/net/fsl_mdio.c which I can use
also for UEC. I reworked this patch and dropped
./drivers/net/qe/dm_qe_uec_phy.c

Just have to test it, when I get access to the hardware.

bye,
Heiko
> 
> Ethernet:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/powerpc/boot/dts/kmeter1.dts#n395 
> 
> 
>              /* Eth-3 (UCC7, MDIO 0x0a, RMII) */
>              enet_eth3: ucc at 2600 {
>                  device_type = "network";
>                  compatible = "ucc_geth";
>                  cell-index = <7>;
>                  reg = <0x2600 0x200>;
>                  interrupts = <42>;
>                  interrupt-parent = <&qeic>;
>                  local-mac-address = [ 00 00 00 00 00 00 ];
>                  rx-clock-name = "none";
>                  tx-clock-name = "clk16";
>                  phy-handle = <&phy_eth3>;
>                  phy-connection-type = "rmii";
>                  pio-handle = <&pio_ucc7>;
>              };
> 
> (And yes, compatible entry is ancient...)
>>
>>>>
>>>>
>>>>    drivers/net/Kconfig            |    2 +
>>>>    drivers/net/Makefile           |    1 +
>>>>    drivers/net/qe/Kconfig         |    9 +
>>>>    drivers/net/qe/Makefile        |    5 +
>>>>    drivers/net/qe/dm_qe_uec.c     | 1161
>>> ++++++++++++++++++++++++++++++++
>>>>    drivers/net/qe/dm_qe_uec.h     |   22 +
>>>>    drivers/net/qe/dm_qe_uec_phy.c |  161 +++++
>>>>    drivers/net/qe/uccf.c          |  388 +++++++++++
>>>>    drivers/net/qe/uccf.h          |  117 ++++
>>>>    drivers/net/qe/uec.h           |  742 ++++++++++++++++++++
>>>>    drivers/qe/uccf.c              |    2 +
>>>>    drivers/qe/uec.c               |    2 +
>>>>    drivers/qe/uec_phy.c           |    3 +
>>>>    13 files changed, 2615 insertions(+)
>>>>    create mode 100644 drivers/net/qe/Kconfig
>>>>    create mode 100644 drivers/net/qe/Makefile
>>>>    create mode 100644 drivers/net/qe/dm_qe_uec.c
>>>>    create mode 100644 drivers/net/qe/dm_qe_uec.h
>>>>    create mode 100644 drivers/net/qe/dm_qe_uec_phy.c
>>>>    create mode 100644 drivers/net/qe/uccf.c
>>>>    create mode 100644 drivers/net/qe/uccf.h
>>>>    create mode 100644 drivers/net/qe/uec.h
>>>
>>> Any comments?
>>>
>>> Thanks!
>>>
>>> bye,
>>> Heiko
>>> -- 
>>> DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
>>> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
>>> Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: hs at denx.de
>> Best Regards
>> Qiang Zhao
>>
> 
> bye,
> Heiko

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: hs at denx.de


More information about the U-Boot mailing list