Re: [U-Boot] [PATCH v3 1/2] dm: mdio: add a uclass for MDIO

2018-06-19 Thread Joe Hershberger
On Tue, Jun 12, 2018 at 11:33 PM,   wrote:
> From: Ken Ma 
>
> Add a uclass which provides access to MDIO busses and includes
> operations required by MDIO.
> The implementation is based on the existing mii/phy/mdio data
> structures and APIs.
> This patch also adds evice tree binding for MDIO bus.
>
> Signed-off-by: Ken Ma 
> Reviewed-by: s...@chromium.org, joe.hershber...@ni.com

A "Reviewed-by" indicates review + acceptance where the person listed
is not a maintainer of said code. [1] It is not simply that it was
commented on by the person. You should only include it in new versions
of patches after someone has replied to a patch and included their
"Reviewed-by" tag. It should be reproduced exactly as it was sent.
There is no need to send a new version solely to include the tag,
though. Patchwork will already take care of that for the current
version.

Also, the "Reviewed-by" should each be on their own line.

[1] http://www.denx.de/wiki/U-Boot/Patches
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v3 1/2] dm: mdio: add a uclass for MDIO

2018-06-19 Thread Joe Hershberger
On Tue, Jun 12, 2018 at 11:33 PM,   wrote:
> From: Ken Ma 
>
> Add a uclass which provides access to MDIO busses and includes
> operations required by MDIO.
> The implementation is based on the existing mii/phy/mdio data
> structures and APIs.
> This patch also adds evice tree binding for MDIO bus.
>
> Signed-off-by: Ken Ma 
> Reviewed-by: s...@chromium.org, joe.hershber...@ni.com
> ---
>
> Changes in v3:
> - Move mdio uclass implementation to driver/net folder;
> - Replace flat-tree functions with livetree functions and update codes
>   and comments to be consistent with driver-model codes style;
> - Put struct mii_dev to uclass platdata to avoid the mdio alloc and
>   let driver model framework to alloc the memroy automatically,
>   meanwhile the mii bus link initialization is added,
>
> Changes in v2: None
>
>  MAINTAINERS   |   1 +
>  doc/device-tree-bindings/net/mdio-bus.txt |  54 ++
>  drivers/Kconfig   |   2 +
>  drivers/net/Makefile  |   1 +
>  drivers/net/mdio/Kconfig  |  18 +
>  drivers/net/mdio/Makefile |   6 ++
>  drivers/net/mdio/mdio-uclass.c| 112 
> ++
>  include/dm/uclass-id.h|   1 +
>  include/net/mdio.h|  62 +
>  9 files changed, 257 insertions(+)
>  create mode 100644 doc/device-tree-bindings/net/mdio-bus.txt
>  create mode 100644 drivers/net/mdio/Kconfig
>  create mode 100644 drivers/net/mdio/Makefile
>  create mode 100644 drivers/net/mdio/mdio-uclass.c
>  create mode 100644 include/net/mdio.h
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 642c448..9e1fc83 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -335,6 +335,7 @@ M:  Simon Glass 

I think it makes sense for me to maintain this, unless Simon really
wants it. He's not even Cc'ed, so maybe he doesn't know you are
assigning it to him? Adding him.

>  S: Maintained
>  T: git git://git.denx.de/u-boot-dm.git
>  F: drivers/core/
> +F: drivers/net/mdio/
>  F: include/dm/
>  F: test/dm/
>
> diff --git a/doc/device-tree-bindings/net/mdio-bus.txt 
> b/doc/device-tree-bindings/net/mdio-bus.txt
> new file mode 100644
> index 000..68d8b25
> --- /dev/null
> +++ b/doc/device-tree-bindings/net/mdio-bus.txt

Is it reasonable to use Documentation/devicetree/bindings/net/mdio.txt
from Linux?

> @@ -0,0 +1,54 @@
> +MDIO (Management Data Input/Output) busses
> +
> +MDIO busses can be described with a node for the MDIO master device
> +and a set of child nodes for each phy on the bus.
> +
> +The MDIO node requires the following properties:
> +- #address-cells  - number of cells required to define phy address on
> +the MDIO bus.
> +- #size-cells - should be zero.
> +- compatible  - name of MDIO bus controller following generic names
> +recommended practice.
> +- reg- address and length of the MDIO register.
> +
> +Optional property:
> +- mdio-name   - MDIO bus name
> +
> +The child nodes of the MDIO driver are the individual PHY devices
> +connected to this MDIO bus. They must have a "reg" property given the
> +PHY address on the MDIO bus.
> +- reg - (required) phy address in MDIO bus.
> +
> +Example for cp110 MDIO node at the SoC level:
> +   cp0_mdio: mdio@12a200 {
> +   #address-cells = <1>;
> +   #size-cells = <0>;
> +   compatible = "marvell,orion-mdio";
> +   reg = <0x12a200 0x10>;
> +   mdio-name = "cp0-mdio";
> +   };
> +
> +   cp0_xmdio: mdio@12a600 {
> +   #address-cells = <1>;
> +   #size-cells = <0>;
> +   compatible = "marvell,xmdio";
> +   reg = <0x12a600 0x200>;
> +   mdio-name = "cp0-xmdio";
> +   };
> +
> +And at the board level, example for armada-8040-mcbin board:
> +   &cp0_mdio {
> +   ge_phy: ethernet-phy@0 {
> +   reg = <0>;
> +   };
> +   };
> +
> +   &cp0_xmdio {
> +   phy0: ethernet-phy@0 {
> +   reg = <0>;
> +   };
> +
> +   phy8: ethernet-phy@8 {
> +   reg = <8>;
> +   };
> +   };
> diff --git a/drivers/Kconfig b/drivers/Kconfig
> index 9e21b28..0e0982c 100644
> --- a/drivers/Kconfig
> +++ b/drivers/Kconfig
> @@ -54,6 +54,8 @@ source "drivers/mtd/Kconfig"
>
>  source "drivers/net/Kconfig"
>
> +source "drivers/net/mdio/Kconfig"

Seems like this should be in drivers/net/Kconfig.

> +
>  source "drivers/nvme/Kconfig"
>
>  source "drivers/pci/Kconfig"
> diff --git a/drivers/net/Makefile b/drivers/net/Makefile
> index 584bfdf..1cda03f 100644
> --- a/drivers/net/Makefile
> +++ b/drivers/net/Makefile
> @@ -70,3 +70,4 @@ obj-$(CONFIG_VSC9953) += vsc9953.o
>  obj-$(CONFIG_PIC32_ETH) += pic32_mdio.o pic32_eth.o
>  obj-$(CONFIG_DWC_E

Re: [U-Boot] [PATCH v3 1/2] dm: mdio: add a uclass for MDIO

2018-06-14 Thread Simon Glass
Hi Ken,

On 12 June 2018 at 22:33,   wrote:
> From: Ken Ma 
>
> Add a uclass which provides access to MDIO busses and includes
> operations required by MDIO.
> The implementation is based on the existing mii/phy/mdio data
> structures and APIs.
> This patch also adds evice tree binding for MDIO bus.
>
> Signed-off-by: Ken Ma 
> Reviewed-by: s...@chromium.org, joe.hershber...@ni.com
> ---
>
> Changes in v3:
> - Move mdio uclass implementation to driver/net folder;
> - Replace flat-tree functions with livetree functions and update codes
>   and comments to be consistent with driver-model codes style;
> - Put struct mii_dev to uclass platdata to avoid the mdio alloc and
>   let driver model framework to alloc the memroy automatically,
>   meanwhile the mii bus link initialization is added,
>

I this this looks right from a DM perspective but it is missing a
sandbox driver and a simple test of the functions that you define
(presumably put this in test/dm/mdio.c)

Regards,
Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v3 1/2] dm: mdio: add a uclass for MDIO

2018-06-12 Thread make
From: Ken Ma 

Add a uclass which provides access to MDIO busses and includes
operations required by MDIO.
The implementation is based on the existing mii/phy/mdio data
structures and APIs.
This patch also adds device tree binding for MDIO bus.

Signed-off-by: Ken Ma 
Reviewed-by: s...@chromium.org, joe.hershber...@ni.com
---

Changes in v3:
- Move mdio uclass implementation to driver/net folder;
- Replace flat-tree functions with livetree functions and update codes
  and comments to be consistent with driver-model codes style;
- Put struct mii_dev to uclass platdata to avoid the mdio alloc and
  let driver model framework to alloc the memroy automatically,
  meanwhile the mii bus link initialization is added,

Changes in v2: None

 MAINTAINERS   |   1 +
 doc/device-tree-bindings/net/mdio-bus.txt |  54 ++
 drivers/Kconfig   |   2 +
 drivers/net/Makefile  |   1 +
 drivers/net/mdio/Kconfig  |  18 +
 drivers/net/mdio/Makefile |   6 ++
 drivers/net/mdio/mdio-uclass.c| 112 ++
 include/dm/uclass-id.h|   1 +
 include/net/mdio.h|  62 +
 9 files changed, 257 insertions(+)
 create mode 100644 doc/device-tree-bindings/net/mdio-bus.txt
 create mode 100644 drivers/net/mdio/Kconfig
 create mode 100644 drivers/net/mdio/Makefile
 create mode 100644 drivers/net/mdio/mdio-uclass.c
 create mode 100644 include/net/mdio.h

diff --git a/MAINTAINERS b/MAINTAINERS
index 642c448..9e1fc83 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -335,6 +335,7 @@ M:  Simon Glass 
 S: Maintained
 T: git git://git.denx.de/u-boot-dm.git
 F: drivers/core/
+F: drivers/net/mdio/
 F: include/dm/
 F: test/dm/
 
diff --git a/doc/device-tree-bindings/net/mdio-bus.txt 
b/doc/device-tree-bindings/net/mdio-bus.txt
new file mode 100644
index 000..68d8b25
--- /dev/null
+++ b/doc/device-tree-bindings/net/mdio-bus.txt
@@ -0,0 +1,54 @@
+MDIO (Management Data Input/Output) busses
+
+MDIO busses can be described with a node for the MDIO master device
+and a set of child nodes for each phy on the bus.
+
+The MDIO node requires the following properties:
+- #address-cells  - number of cells required to define phy address on
+the MDIO bus.
+- #size-cells - should be zero.
+- compatible  - name of MDIO bus controller following generic names
+recommended practice.
+- reg- address and length of the MDIO register.
+
+Optional property:
+- mdio-name   - MDIO bus name
+
+The child nodes of the MDIO driver are the individual PHY devices
+connected to this MDIO bus. They must have a "reg" property given the
+PHY address on the MDIO bus.
+- reg - (required) phy address in MDIO bus.
+
+Example for cp110 MDIO node at the SoC level:
+   cp0_mdio: mdio@12a200 {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   compatible = "marvell,orion-mdio";
+   reg = <0x12a200 0x10>;
+   mdio-name = "cp0-mdio";
+   };
+
+   cp0_xmdio: mdio@12a600 {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   compatible = "marvell,xmdio";
+   reg = <0x12a600 0x200>;
+   mdio-name = "cp0-xmdio";
+   };
+
+And at the board level, example for armada-8040-mcbin board:
+   &cp0_mdio {
+   ge_phy: ethernet-phy@0 {
+   reg = <0>;
+   };
+   };
+
+   &cp0_xmdio {
+   phy0: ethernet-phy@0 {
+   reg = <0>;
+   };
+
+   phy8: ethernet-phy@8 {
+   reg = <8>;
+   };
+   };
diff --git a/drivers/Kconfig b/drivers/Kconfig
index 9e21b28..0e0982c 100644
--- a/drivers/Kconfig
+++ b/drivers/Kconfig
@@ -54,6 +54,8 @@ source "drivers/mtd/Kconfig"
 
 source "drivers/net/Kconfig"
 
+source "drivers/net/mdio/Kconfig"
+
 source "drivers/nvme/Kconfig"
 
 source "drivers/pci/Kconfig"
diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index 584bfdf..1cda03f 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -70,3 +70,4 @@ obj-$(CONFIG_VSC9953) += vsc9953.o
 obj-$(CONFIG_PIC32_ETH) += pic32_mdio.o pic32_eth.o
 obj-$(CONFIG_DWC_ETH_QOS) += dwc_eth_qos.o
 obj-$(CONFIG_FSL_PFE) += pfe_eth/
+obj-$(CONFIG_MDIO) += mdio/
diff --git a/drivers/net/mdio/Kconfig b/drivers/net/mdio/Kconfig
new file mode 100644
index 000..533cc4a
--- /dev/null
+++ b/drivers/net/mdio/Kconfig
@@ -0,0 +1,18 @@
+#
+# MDIO infrastructure and drivers
+#
+
+menu "MDIO Support"
+
+config MDIO
+   bool "Enable MDIO(Management Data Input/Output) drivers"
+   depends on DM
+   help
+ Enable driver model for MDIO access.
+ Drivers provide methods to management data
+ Input/Output.
+ MDIO uclass provides int

[U-Boot] [PATCH v3 1/2] dm: mdio: add a uclass for MDIO

2018-06-12 Thread make
From: Ken Ma 

Add a uclass which provides access to MDIO busses and includes
operations required by MDIO.
The implementation is based on the existing mii/phy/mdio data
structures and APIs.
This patch also adds evice tree binding for MDIO bus.

Signed-off-by: Ken Ma 
Reviewed-by: s...@chromium.org, joe.hershber...@ni.com
---

Changes in v3:
- Move mdio uclass implementation to driver/net folder;
- Replace flat-tree functions with livetree functions and update codes
  and comments to be consistent with driver-model codes style;
- Put struct mii_dev to uclass platdata to avoid the mdio alloc and
  let driver model framework to alloc the memroy automatically,
  meanwhile the mii bus link initialization is added,

Changes in v2: None

 MAINTAINERS   |   1 +
 doc/device-tree-bindings/net/mdio-bus.txt |  54 ++
 drivers/Kconfig   |   2 +
 drivers/net/Makefile  |   1 +
 drivers/net/mdio/Kconfig  |  18 +
 drivers/net/mdio/Makefile |   6 ++
 drivers/net/mdio/mdio-uclass.c| 112 ++
 include/dm/uclass-id.h|   1 +
 include/net/mdio.h|  62 +
 9 files changed, 257 insertions(+)
 create mode 100644 doc/device-tree-bindings/net/mdio-bus.txt
 create mode 100644 drivers/net/mdio/Kconfig
 create mode 100644 drivers/net/mdio/Makefile
 create mode 100644 drivers/net/mdio/mdio-uclass.c
 create mode 100644 include/net/mdio.h

diff --git a/MAINTAINERS b/MAINTAINERS
index 642c448..9e1fc83 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -335,6 +335,7 @@ M:  Simon Glass 
 S: Maintained
 T: git git://git.denx.de/u-boot-dm.git
 F: drivers/core/
+F: drivers/net/mdio/
 F: include/dm/
 F: test/dm/
 
diff --git a/doc/device-tree-bindings/net/mdio-bus.txt 
b/doc/device-tree-bindings/net/mdio-bus.txt
new file mode 100644
index 000..68d8b25
--- /dev/null
+++ b/doc/device-tree-bindings/net/mdio-bus.txt
@@ -0,0 +1,54 @@
+MDIO (Management Data Input/Output) busses
+
+MDIO busses can be described with a node for the MDIO master device
+and a set of child nodes for each phy on the bus.
+
+The MDIO node requires the following properties:
+- #address-cells  - number of cells required to define phy address on
+the MDIO bus.
+- #size-cells - should be zero.
+- compatible  - name of MDIO bus controller following generic names
+recommended practice.
+- reg- address and length of the MDIO register.
+
+Optional property:
+- mdio-name   - MDIO bus name
+
+The child nodes of the MDIO driver are the individual PHY devices
+connected to this MDIO bus. They must have a "reg" property given the
+PHY address on the MDIO bus.
+- reg - (required) phy address in MDIO bus.
+
+Example for cp110 MDIO node at the SoC level:
+   cp0_mdio: mdio@12a200 {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   compatible = "marvell,orion-mdio";
+   reg = <0x12a200 0x10>;
+   mdio-name = "cp0-mdio";
+   };
+
+   cp0_xmdio: mdio@12a600 {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   compatible = "marvell,xmdio";
+   reg = <0x12a600 0x200>;
+   mdio-name = "cp0-xmdio";
+   };
+
+And at the board level, example for armada-8040-mcbin board:
+   &cp0_mdio {
+   ge_phy: ethernet-phy@0 {
+   reg = <0>;
+   };
+   };
+
+   &cp0_xmdio {
+   phy0: ethernet-phy@0 {
+   reg = <0>;
+   };
+
+   phy8: ethernet-phy@8 {
+   reg = <8>;
+   };
+   };
diff --git a/drivers/Kconfig b/drivers/Kconfig
index 9e21b28..0e0982c 100644
--- a/drivers/Kconfig
+++ b/drivers/Kconfig
@@ -54,6 +54,8 @@ source "drivers/mtd/Kconfig"
 
 source "drivers/net/Kconfig"
 
+source "drivers/net/mdio/Kconfig"
+
 source "drivers/nvme/Kconfig"
 
 source "drivers/pci/Kconfig"
diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index 584bfdf..1cda03f 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -70,3 +70,4 @@ obj-$(CONFIG_VSC9953) += vsc9953.o
 obj-$(CONFIG_PIC32_ETH) += pic32_mdio.o pic32_eth.o
 obj-$(CONFIG_DWC_ETH_QOS) += dwc_eth_qos.o
 obj-$(CONFIG_FSL_PFE) += pfe_eth/
+obj-$(CONFIG_MDIO) += mdio/
diff --git a/drivers/net/mdio/Kconfig b/drivers/net/mdio/Kconfig
new file mode 100644
index 000..533cc4a
--- /dev/null
+++ b/drivers/net/mdio/Kconfig
@@ -0,0 +1,18 @@
+#
+# MDIO infrastructure and drivers
+#
+
+menu "MDIO Support"
+
+config MDIO
+   bool "Enable MDIO(Management Data Input/Output) drivers"
+   depends on DM
+   help
+ Enable driver model for MDIO access.
+ Drivers provide methods to management data
+ Input/Output.
+ MDIO uclass provides inte