]> git.sur5r.net Git - u-boot/blobdiff - drivers/net/fm/eth.c
Merge branch 'master' of http://git.denx.de/u-boot-samsung
[u-boot] / drivers / net / fm / eth.c
index 9b139eeb05102d29286ae8121ebf62068c2dc64b..218a5ed17509a6d2d50eb83cbebabd55fe110a53 100644 (file)
@@ -2,20 +2,7 @@
  * Copyright 2009-2012 Freescale Semiconductor, Inc.
  *     Dave Liu <daveliu@freescale.com>
  *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
+ * SPDX-License-Identifier:    GPL-2.0+
  */
 #include <common.h>
 #include <asm/io.h>
@@ -354,7 +341,9 @@ static int fm_eth_startup(struct fm_eth *fm_eth)
        mac->init_mac(mac);
 
        /* For some reason we need to set SPEED_100 */
-       if ((fm_eth->enet_if == PHY_INTERFACE_MODE_SGMII) && mac->set_if_mode)
+       if (((fm_eth->enet_if == PHY_INTERFACE_MODE_SGMII) ||
+            (fm_eth->enet_if == PHY_INTERFACE_MODE_QSGMII)) &&
+             mac->set_if_mode)
                mac->set_if_mode(mac, fm_eth->enet_if, SPEED_100);
 
        /* init bmi rx port, IM mode and disable */
@@ -568,8 +557,16 @@ static int fm_eth_init_mac(struct fm_eth *fm_eth, struct ccsr_fman *reg)
        num = fm_eth->num;
 
 #ifdef CONFIG_SYS_FMAN_V3
-       if (fm_eth->type == FM_ETH_10G_E)
-               num += 8;
+       if (fm_eth->type == FM_ETH_10G_E) {
+               /* 10GEC1/10GEC2 use mEMAC9/mEMAC10
+                * 10GEC3/10GEC4 use mEMAC1/mEMAC2
+                * so it needs to change the num.
+                */
+               if (fm_eth->num >= 2)
+                       num -= 2;
+               else
+                       num += 8;
+       }
        base = &reg->memac[num].fm_memac;
        phyregs = &reg->memac[num].fm_memac_mdio;
 #else