[PATCH v2 0/5] powerpc, mpc83xx: add DM_ETH support

Heiko Schocher hs at denx.de
Wed Sep 23 07:02:53 CEST 2020


Hi Rasmus,

Am 22.09.2020 um 16:34 schrieb Rasmus Villemoes:
> Hi Heiko
> 
> I'm struggling somewhat with getting our mpc8309-derived board converted
> to DM_ETH. I just get
> 
> Net:   No ethernet found.
> 
> where I used to get
> 
> Net:   UEC0, UEC1, UEC2

:-(

Ok, I currently have no access to the hardware, I wait for the customer
to give me access, will take until next week ... so I can only review
currently code changes...

BTW: I hope to get daily access, so I can add at least one board to
my daily U-Boot tbot tests, see:

http://xeidos.ddns.net/ubtestresults/home

> and there's no errors or other diagnostics printed (I've also tried
> adding #define DEBUG 1 to the .c files under drivers/net/qe/, still
> nothing).
> 
> The board already used OF_CONTROL, so I've tried extending the
> device-tree based partly on you changes for the km boards, partly from
> our linux device tree - the two mostly agree:
> 
> @@ -25,6 +25,8 @@
>   		i2c0 = &i2c0;
>   		i2c1 = &i2c1;
>   		spi0 = &spi0;
> +		ethernet0 = &enet0;
> +		ethernet2 = &enet2;
>   	};
> 
>   	chosen {
> @@ -315,6 +317,95 @@
>   			clocks = <&clocks MPC83XX_CLK_SDHC>;
>   			clock-names = "per";
>   		};
> +
> +		ipic: pic at 700 {
> +			compatible = "fsl,ipic";
> +			interrupt-controller;
> +			#address-cells = <0>;
> +			#interrupt-cells = <2>;
> +			reg = <0x700 0x100>;
> +			device_type = "ipic";
> +		};
>   	};
> -};
> 
> +	qe: qe at e0100000 {
> +		#address-cells = <1>;
> +		#size-cells = <1>;
> +		device_type = "qe";
> +		compatible = "fsl,qe";
> +		ranges = <0x0 0xe0100000 0x00100000>;
> +		reg = <0xe0100000 0x480>;
> +		brg-frequency = <0>;
> +		bus-frequency = <396000000>;
> +
> +		muram at 10000 {
> +			#address-cells = <1>;
> +			#size-cells = <1>;
> +			compatible = "fsl,qe-muram", "fsl,cpm-muram";
> +			ranges = <0x0 0x00010000 0x00004000>;
> +
> +			data-only at 0 {
> +				compatible = "fsl,qe-muram-data",
> +					     "fsl,cpm-muram-data";
> +				reg = <0x0 0x4000>;
> +			};
> +		};
> +
> +		qeic: interrupt-controller at 80 {
> +			interrupt-controller;
> +			compatible = "fsl,qe-ic";
> +			#address-cells = <0>;
> +			#interrupt-cells = <1>;
> +			reg = <0x80 0x80>;
> +			big-endian;
> +			interrupts = <32 8 33 8>;
> +			interrupt-parent = <&ipic>;
> +		};
> +
> +		enet0: ethernet at 2000 {
> +			device_type = "network";
> +			compatible = "ucc_geth";
> +			cell-index = <1>;
> +			reg = <0x2000 0x200>;
> +			interrupts = <32>;
> +			interrupt-parent = <&qeic>;
> +			local-mac-address = [ 00 00 00 00 00 00 ];
> +			rx-clock-name = "clk9";
> +			tx-clock-name = "clk10";
> +			fixed-link = <1 1 100 0 0>;
> +		};
> +
> +		enet2: ethernet at 2200 {
> +			device_type = "network";
> +			compatible = "ucc_geth";
> +			cell-index = <3>;
> +			reg = <0x2200 0x200>;
> +			interrupts = <34>;
> +			interrupt-parent = <&qeic>;
> +			local-mac-address = [ 00 00 00 00 00 00 ];
> +			rx-clock-name = "clk11";
> +			tx-clock-name = "clk12";
> +			phy-handle = <&phy1>;
> +			phy-connection-type = "mii";
> +		};
> +
> +		mdio0: mdio at 2120 {
> +			#address-cells = <1>;
> +			#size-cells = <0>;
> +			reg = <0x2120 0x18>;
> +			compatible = "fsl,ucc-mdio";
> +
> +			phy0: ethernet-phy at 00 {
> +				reg = <0x01>;
> +				device_type = "ethernet-phy";
> +			};
> +			phy1: ethernet-phy at 01 {
> +				reg = <0x02>;
> +				device_type = "ethernet-phy";
> +			};
> +		};
> +
> +
> +	};
> +
> +};

Does this work with linux? If so, it should be OK....

I miss something like:

https://gitlab.denx.de/u-boot/u-boot/-/commit/7bdfe8592956439743cad3c2d3ff5f24c4dd5aa9#8fd63f1c0ee54bb5ed6e0446595997296ab56205

Important here:

&qe {
	compatible = "fsl,qe", "simple-bus";
};

> 
> The defconfig is updated with
> 
>   CONFIG_MTD_UBI_FASTMAP_AUTOCONVERT=1
>   CONFIG_PHYLIB=y
>   CONFIG_PHY_MARVELL=y
> +CONFIG_DM_ETH=y
> +CONFIG_DM_MDIO=y
> +CONFIG_DM_ETH_PHY=y
>   CONFIG_MII=y
> +CONFIG_QE_UEC=y

  Looks good...


> and finally I've removed the UEC_ETH definitions from the board config
> header:
> 
> -/*
> - * Ethernet setup
> - */
> -
> -/* enable uec ethernet */
> -#define CONFIG_UEC_ETH
> -
> -/* eth1 */
> -#define CONFIG_UEC_ETH1
> -#define CONFIG_SYS_UEC1_UCC_NUM		0
> -#define CONFIG_SYS_UEC1_RX_CLK		QE_CLK9
> -#define CONFIG_SYS_UEC1_TX_CLK		QE_CLK10
> -#define CONFIG_SYS_UEC1_ETH_TYPE	FAST_ETH
> -#define CONFIG_SYS_UEC1_PHY_ADDR	0x11
> -#define CONFIG_SYS_UEC1_INTERFACE_TYPE	PHY_INTERFACE_MODE_MII
> -#define CONFIG_SYS_UEC1_INTERFACE_SPEED	100
> -
> -/* eth2 */
> -#define CONFIG_UEC_ETH2
> -#define CONFIG_SYS_UEC2_UCC_NUM		1
> -#define CONFIG_SYS_UEC2_RX_CLK		QE_CLK7
> -#define CONFIG_SYS_UEC2_TX_CLK		QE_CLK8
> -#define CONFIG_SYS_UEC2_ETH_TYPE	FAST_ETH
> -#define CONFIG_SYS_UEC2_PHY_ADDR	0x13
> -#define CONFIG_SYS_UEC2_INTERFACE_TYPE	PHY_INTERFACE_MODE_MII
> -#define CONFIG_SYS_UEC2_INTERFACE_SPEED	100
> -
> -/* eth3 */
> -#define CONFIG_UEC_ETH3
> -#define CONFIG_SYS_UEC3_UCC_NUM		2
> -#define CONFIG_SYS_UEC3_RX_CLK		QE_CLK11
> -#define CONFIG_SYS_UEC3_TX_CLK		QE_CLK12
> -#define CONFIG_SYS_UEC3_ETH_TYPE	FAST_ETH
> -#define CONFIG_SYS_UEC3_PHY_ADDR	0x12
> -#define CONFIG_SYS_UEC3_INTERFACE_TYPE	PHY_INTERFACE_MODE_MII
> -#define CONFIG_SYS_UEC3_INTERFACE_SPEED	100
> -
> 
> I only define two ethernet devices in DT above - the third (middle one)
> is used for ethercat and irrelevant in U-Boot.
> 
> I have not set CONFIG_PINCTRL{,_QE} since our qe_iop_conf_tab is just
> 
> const qe_iop_conf_t qe_iop_conf_tab[] = {
>         {0,  0, 0, 0, QE_IOP_TAB_END}, /* END of table */
> };
> 
> so config_qe_ioports() should be a no-op.

Okay...

> Can you see something obviously wrong with the above, and/or do you have
> some hints as for what I can do to figure out why the drivers apparently
> do not pick up the devices from DT? 'dm drivers' does list
> 
> ucc_geth                  033 eth                  <none>
> qe_uec_mdio               051 mdio                 <none>
Here from an old log (mpc8360 based):

=> dm tree^M
  Class     Index  Probed  Driver                Name^M
-----------------------------------------------------------^M
  root          0  [ + ]   root_driver           root_driver^M
  simple_bus    0  [ + ]   generic_simple_bus    |-- soc8360 at e0000000^M
  serial        0  [ + ]   ns16550_serial        |   |-- serial at 4500^M
  pinctrl       0  [ + ]   par-io-pinctrl        |   |-- par_io at 1400^M
  simple_bus    1  [ + ]   generic_simple_bus    |   `-- qe at 100000^M
  eth           0  [   ]   ucc_geth              |       |-- ucc at 2000^M
  eth           1  [   ]   ucc_geth              |       |-- ucc at 3000^M
  eth           2  [ + ]   ucc_geth              |       |-- ucc at 3200^M
  eth           3  [   ]   ucc_geth              |       |-- ucc at 2400^M
  eth           4  [   ]   ucc_geth              |       |-- ucc at 3400^M
  eth           5  [   ]   ucc_geth              |       |-- ucc at 2600^M
  eth           6  [   ]   ucc_geth              |       `-- ucc at 3600^M
  simple_bus    2  [   ]   generic_simple_bus    `-- localbus at e0005000^M
=>

Hmm... hard to say, you may enable debug output in ./drivers/core/root.c

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