net: ethernet: fec_main: Enable reset PHY GPIOs at startup.
authorJosep Orga <jorga@somdevices.com>
Sat, 18 Apr 2020 08:17:33 +0000 (10:17 +0200)
committerJosep Orga <jorga@somdevices.com>
Sat, 18 Apr 2020 08:17:33 +0000 (10:17 +0200)
Signed-off-by: Josep Orga <jorga@somdevices.com>
drivers/net/ethernet/freescale/fec_main.c

index 50c44cb..c2c23df 100644 (file)
@@ -3500,6 +3500,23 @@ static int fec_enet_init(struct net_device *ndev)
 }
 
 #ifdef CONFIG_OF
+#define GPIO_PHY_1 138
+#define GPIO_PHY_2 139
+static void fec_reset_phy_init(void)
+{
+       int ret = 0;
+       ret = gpio_request(GPIO_PHY_1, "RESET_PHY_1");
+       if (!ret) {
+               gpio_direction_output(GPIO_PHY_1, 1);
+               gpio_free(GPIO_PHY_1);
+       }
+       ret = gpio_request(GPIO_PHY_2, "RESET_PHY_2");
+       if (!ret) {
+               ret = gpio_direction_output(GPIO_PHY_2, 1);
+               gpio_free(GPIO_PHY_2);
+       }
+}
+
 static int fec_reset_phy(struct platform_device *pdev)
 {
        int err, phy_reset;
@@ -3660,6 +3677,7 @@ fec_probe(struct platform_device *pdev)
        char irq_name[8];
        int irq_cnt;
 
+       fec_reset_phy_init();
        fec_enet_get_queue_num(pdev, &num_tx_qs, &num_rx_qs);
 
        /* Init network device */