net: tsec: Add the compatible string "gianfar" support
authorHou Zhiqiang <Zhiqiang.Hou@nxp.com>
Thu, 16 Jul 2020 10:09:14 +0000 (18:09 +0800)
committerTom Rini <trini@konsulko.com>
Thu, 24 Sep 2020 12:27:44 +0000 (08:27 -0400)
Add compatible string "gianfar" support and update the
device-tree-bindings doc.

Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
doc/device-tree-bindings/net/fsl-tsec-phy.txt
drivers/net/tsec.c
include/tsec.h

index 8e8574b..a44c5fd 100644 (file)
@@ -2,7 +2,7 @@
 
 Properties:
 
-  - compatible : Should be "fsl,etsec2"
+  - compatible : Should be "fsl,etsec2" or "gianfar"
   - reg : Offset and length of the register set for the device
   - phy-handle : See ethernet.txt file in the same directory.
   - phy-connection-type : See ethernet.txt file in the same directory. This
index af0d27a..c436b83 100644 (file)
@@ -803,11 +803,14 @@ int tsec_probe(struct udevice *dev)
        struct tsec_private *priv = dev_get_priv(dev);
        struct ofnode_phandle_args phandle_args;
        u32 tbiaddr = CONFIG_SYS_TBIPA_VALUE;
+       struct tsec_data *data;
        const char *phy_mode;
        fdt_addr_t reg;
        ofnode parent;
        int ret;
 
+       data = (struct tsec_data *)dev_get_driver_data(dev);
+
        pdata->iobase = (phys_addr_t)dev_read_addr(dev);
        priv->regs = dev_remap_addr(dev);
 
@@ -828,7 +831,7 @@ int tsec_probe(struct udevice *dev)
                        return -ENOENT;
                }
 
-               priv->phyregs_sgmii = map_physmem(reg + TSEC_MDIO_REGS_OFFSET,
+               priv->phyregs_sgmii = map_physmem(reg + data->mdio_regs_off,
                                                  0, MAP_NOCACHE);
        }
 
@@ -880,8 +883,17 @@ static const struct eth_ops tsec_ops = {
        .mcast = tsec_mcast_addr,
 };
 
+static struct tsec_data etsec2_data = {
+       .mdio_regs_off = TSEC_MDIO_REGS_OFFSET,
+};
+
+static struct tsec_data gianfar_data = {
+       .mdio_regs_off = 0x0,
+};
+
 static const struct udevice_id tsec_ids[] = {
-       { .compatible = "fsl,etsec2" },
+       { .compatible = "fsl,etsec2", .data = (ulong)&etsec2_data },
+       { .compatible = "gianfar", .data = (ulong)&gianfar_data },
        { }
 };
 
index 43255e5..5433cfd 100644 (file)
@@ -394,6 +394,10 @@ struct tsec {
 
 #define TX_BUF_CNT     2
 
+struct tsec_data {
+       u32 mdio_regs_off;
+};
+
 struct tsec_private {
        struct txbd8 __iomem txbd[TX_BUF_CNT];
        struct rxbd8 __iomem rxbd[PKTBUFSRX];