]> rtime.felk.cvut.cz Git - zynq/linux.git/commitdiff
xilinx_emacps: Add support for EMIO
authorAnirudha Sarangi <anirudh@xilinx.com>
Wed, 3 Apr 2013 17:36:56 +0000 (23:06 +0530)
committerMichal Simek <michal.simek@xilinx.com>
Fri, 5 Apr 2013 08:32:17 +0000 (10:32 +0200)
The existing implementation was hardcoding the PHY interface as
RGMII (MIO case). This patch makes the implementation flexible by
assuming that the information regarding the PHY interface will come
from the device tree. This will ensure that the driver takes care of
both MIO (RGMII) and EMIO (GMII) cases.

Signed-off-by: Anirudha Sarangi <anirudh@xilinx.com>
drivers/net/ethernet/xilinx/xilinx_emacps.c

index 70e351124e362970f7595747db41bad894d84019..e6da82debdd6352c105f81faed6bc6836689ba4a 100644 (file)
@@ -538,6 +538,7 @@ struct net_local {
 
        struct mii_bus *mii_bus;
        struct phy_device *phy_dev;
+       phy_interface_t phy_interface;
        unsigned int link;
        unsigned int speed;
        unsigned int duplex;
@@ -809,11 +810,12 @@ static int xemacps_mii_probe(struct net_device *ndev)
                                        lp->phy_node,
                                        &xemacps_adjust_link,
                                        0,
-                                       PHY_INTERFACE_MODE_RGMII_ID);
-       }
-       if (!phydev) {
-               dev_err(&lp->pdev->dev, "%s: no PHY found\n", ndev->name);
-               return -1;
+                                       lp->phy_interface);
+               if (!phydev) {
+                       dev_err(&lp->pdev->dev, "%s: no PHY found\n",
+                       ndev->name);
+                       return -1;
+               }
        }
 
        dev_dbg(&lp->pdev->dev,
@@ -2680,6 +2682,13 @@ static int __devinit xemacps_probe(struct platform_device *pdev)
 
        lp->phy_node = of_parse_phandle(lp->pdev->dev.of_node,
                                                "phy-handle", 0);
+       rc = of_get_phy_mode(lp->pdev->dev.of_node);
+       if (rc < 0) {
+               dev_err(&lp->pdev->dev, "error in getting phy i/f\n");
+               goto err_out_unregister_clk_notifier;
+       }
+
+       lp->phy_interface = rc;
 
        if (lp->board_type == BOARD_TYPE_ZYNQ) {
                /* Set MDIO clock divider */