[PATCH 01/13] net: fsl_pq_mdio: Add the compatible "fsl, gianfar-mdio" support

Zhiqiang Hou Zhiqiang.Hou at nxp.com
Tue May 5 13:38:02 CEST 2020


From: Hou Zhiqiang <Zhiqiang.Hou at nxp.com>

Add compatible string "fsl,gianfar-mdio" support and update the
device-tree-bindings doc.

Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou at nxp.com>
---
 doc/device-tree-bindings/net/fsl-tsec-phy.txt |  3 ++-
 drivers/net/fsl_mdio.c                        | 15 +++++++++++++--
 include/fsl_mdio.h                            |  4 ++++
 3 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/doc/device-tree-bindings/net/fsl-tsec-phy.txt b/doc/device-tree-bindings/net/fsl-tsec-phy.txt
index 8e8574bc97..a709b89a5c 100644
--- a/doc/device-tree-bindings/net/fsl-tsec-phy.txt
+++ b/doc/device-tree-bindings/net/fsl-tsec-phy.txt
@@ -28,7 +28,8 @@ device that exists on this bus, a PHY node should be created.
 
 Required properties:
   - compatible : Should define the compatible device type for the
-    mdio. Currently supported string/device is "fsl,etsec2-mdio".
+    mdio. Currently supported string/device is "fsl,etsec2-mdio" and
+    "fsl,gianfar-mdio".
   - reg : Offset and length of the register set for the device
 
 Example:
diff --git a/drivers/net/fsl_mdio.c b/drivers/net/fsl_mdio.c
index 284508062c..ea9c37ad19 100644
--- a/drivers/net/fsl_mdio.c
+++ b/drivers/net/fsl_mdio.c
@@ -138,10 +138,12 @@ static int dm_fsl_pq_mdio_write(struct udevice *dev, int addr, int devad,
 static int fsl_pq_mdio_probe(struct udevice *dev)
 {
 	struct fsl_pq_mdio_info *info = dev_get_priv(dev);
+	struct fsl_pq_mdio_data *data;
 	fdt_addr_t reg;
 
+	data = (struct fsl_pq_mdio_data *)dev_get_driver_data(dev);
 	reg = devfdt_get_addr(dev);
-	info->regs = map_physmem(reg + TSEC_MDIO_REGS_OFFSET, 0, MAP_NOCACHE);
+	info->regs = map_physmem(reg + data->mdio_regs_off, 0, MAP_NOCACHE);
 
 	return fsl_pq_mdio_reset(info->regs);
 }
@@ -151,8 +153,17 @@ static const struct mdio_ops fsl_pq_mdio_ops = {
 	.write			= dm_fsl_pq_mdio_write,
 };
 
+static struct fsl_pq_mdio_data etsec2_data = {
+	.mdio_regs_off = TSEC_MDIO_REGS_OFFSET,
+};
+
+static struct fsl_pq_mdio_data gianfar_data = {
+	.mdio_regs_off = 0x0,
+};
+
 static const struct udevice_id fsl_pq_mdio_ids[] = {
-	{ .compatible = "fsl,etsec2-mdio" },
+	{ .compatible = "fsl,etsec2-mdio", .data = (ulong)&etsec2_data },
+	{ .compatible = "fsl,gianfar-mdio", .data = (ulong)&gianfar_data },
 	{ }
 };
 
diff --git a/include/fsl_mdio.h b/include/fsl_mdio.h
index 386c477a8b..80e3100cda 100644
--- a/include/fsl_mdio.h
+++ b/include/fsl_mdio.h
@@ -53,6 +53,10 @@ int memac_mdio_read(struct mii_dev *bus, int port_addr, int dev_addr,
 		int regnum);
 int memac_mdio_reset(struct mii_dev *bus);
 
+struct fsl_pq_mdio_data {
+	u32 mdio_regs_off;
+};
+
 struct fsl_pq_mdio_info {
 	struct tsec_mii_mng __iomem *regs;
 	char *name;
-- 
2.17.1



More information about the U-Boot mailing list