board: mscc: ocelot: Update MSCC Ocelot board.
authorHoratiu Vultur <horatiu.vultur@microchip.com>
Wed, 24 Apr 2019 09:27:58 +0000 (11:27 +0200)
committerDaniel Schwierzeck <daniel.schwierzeck@gmail.com>
Fri, 3 May 2019 14:42:23 +0000 (16:42 +0200)
Implement method board_phy_config to configure the phy for pcb120.

Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
board/mscc/ocelot/ocelot.c

index 532d06f00031fc15177d12db4305b3bb91f7639e..bcae8fa50ca2b5bce19621af0e6fc095230a38d0 100644 (file)
@@ -11,6 +11,7 @@
 #include <spi.h>
 #include <led.h>
 #include <wait_bit.h>
+#include <miiphy.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -42,6 +43,20 @@ void mscc_switch_reset(bool enter)
        mscc_gpio_set_alternate(19, 0);
 }
 
+int board_phy_config(struct phy_device *phydev)
+{
+       if (gd->board_type == BOARD_TYPE_PCB123)
+               return 0;
+
+       phy_write(phydev, 0, 31, 0x10);
+       phy_write(phydev, 0, 18, 0x80F0);
+       while (phy_read(phydev, 0, 18) & 0x8000)
+               ;
+       phy_write(phydev, 0, 31, 0);
+
+       return 0;
+}
+
 void board_debug_uart_init(void)
 {
        /* too early for the pinctrl driver, so configure the UART pins here */