global: Migrate CONFIG_SYS_FSL* symbols to the CFG_SYS namespace
[platform/kernel/u-boot.git] / drivers / net / fm / eth.c
index 0e89e66..c23e0c0 100644 (file)
@@ -50,7 +50,7 @@ static void dtsec_configure_serdes(struct fm_eth *priv)
        u32 value;
        struct mii_dev bus;
        bool sgmii_2500 = (priv->enet_if ==
-                       PHY_INTERFACE_MODE_SGMII_2500) ? true : false;
+                       PHY_INTERFACE_MODE_2500BASEX) ? true : false;
        int i = 0, j;
 
 #ifndef CONFIG_DM_ETH
@@ -125,7 +125,7 @@ qsgmii_loop:
 static void dtsec_init_phy(struct fm_eth *fm_eth)
 {
 #ifndef CONFIG_SYS_FMAN_V3
-       struct dtsec *regs = (struct dtsec *)CONFIG_SYS_FSL_FM1_DTSEC1_ADDR;
+       struct dtsec *regs = (struct dtsec *)CFG_SYS_FSL_FM1_DTSEC1_ADDR;
 
        /* Assign a Physical address to the TBI */
        out_be32(&regs->tbipa, CONFIG_SYS_TBIPA_VALUE);
@@ -133,7 +133,7 @@ static void dtsec_init_phy(struct fm_eth *fm_eth)
 
        if (fm_eth->enet_if == PHY_INTERFACE_MODE_SGMII ||
            fm_eth->enet_if == PHY_INTERFACE_MODE_QSGMII ||
-           fm_eth->enet_if == PHY_INTERFACE_MODE_SGMII_2500)
+           fm_eth->enet_if == PHY_INTERFACE_MODE_2500BASEX)
                dtsec_configure_serdes(fm_eth);
 }
 
@@ -288,8 +288,10 @@ static int fm_eth_rx_port_parameter_init(struct fm_eth *fm_eth)
 
        /* alloc Rx buffer from main memory */
        rx_buf_pool = malloc(MAX_RXBUF_LEN * RX_BD_RING_SIZE);
-       if (!rx_buf_pool)
+       if (!rx_buf_pool) {
+               free(rx_bd_ring_base);
                return -ENOMEM;
+       }
 
        memset(rx_buf_pool, 0, MAX_RXBUF_LEN * RX_BD_RING_SIZE);
        debug("%s: rx_buf_pool = %p\n", __func__, rx_buf_pool);
@@ -430,7 +432,7 @@ static int fm_eth_startup(struct fm_eth *fm_eth)
 
        /* For some reason we need to set SPEED_100 */
        if (((fm_eth->enet_if == PHY_INTERFACE_MODE_SGMII) ||
-            (fm_eth->enet_if == PHY_INTERFACE_MODE_SGMII_2500) ||
+            (fm_eth->enet_if == PHY_INTERFACE_MODE_2500BASEX) ||
             (fm_eth->enet_if == PHY_INTERFACE_MODE_QSGMII)) &&
              mac->set_if_mode)
                mac->set_if_mode(mac, fm_eth->enet_if, SPEED_100);
@@ -827,7 +829,7 @@ static int init_phy(struct fm_eth *fm_eth)
 
        if (fm_eth->type == FM_ETH_10G_E)
                supported = PHY_10G_FEATURES;
-       if (fm_eth->enet_if == PHY_INTERFACE_MODE_SGMII_2500)
+       if (fm_eth->enet_if == PHY_INTERFACE_MODE_2500BASEX)
                supported |= SUPPORTED_2500baseX_Full;
 #endif
 
@@ -952,17 +954,6 @@ int fm_eth_initialize(struct ccsr_fman *reg, struct fm_eth_info *info)
        return 0;
 }
 #else /* CONFIG_DM_ETH */
-#ifdef CONFIG_PHYLIB
-phy_interface_t fman_read_sys_if(struct udevice *dev)
-{
-       const char *if_str;
-
-       if_str = ofnode_read_string(dev_ofnode(dev), "phy-connection-type");
-       debug("MAC system interface mode %s\n", if_str);
-
-       return phy_get_interface_by_name(if_str);
-}
-#endif
 
 static int fm_eth_bind(struct udevice *dev)
 {
@@ -1036,7 +1027,7 @@ static int fm_eth_probe(struct udevice *dev)
        reg = (void *)(uintptr_t)dev_read_addr(dev);
        fm_eth->mac_type = dev_get_driver_data(dev);
 #ifdef CONFIG_PHYLIB
-       fm_eth->enet_if = fman_read_sys_if(dev);
+       fm_eth->enet_if = dev_read_phy_mode(dev);
 #else
        fm_eth->enet_if = PHY_INTERFACE_MODE_SGMII;
        printf("%s: warning - unable to determine interface type\n", __func__);
@@ -1088,7 +1079,7 @@ static int fm_eth_probe(struct udevice *dev)
                if (fm_eth->num != 0)
                        break;
        case PHY_INTERFACE_MODE_SGMII:
-       case PHY_INTERFACE_MODE_SGMII_2500:
+       case PHY_INTERFACE_MODE_2500BASEX:
                fm_eth->pcs_mdio = fm_get_internal_mdio(dev);
                break;
        default: