]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - drivers/net/fsl_mcdmafec.c
Merge branch 'master' of git://git.denx.de/u-boot-usb
[karo-tx-uboot.git] / drivers / net / fsl_mcdmafec.c
index d056010c74ee3852667bc94197474fefb5370f36..6391f9b32fb297de6ddc43cf7eb8fa041cf219db 100644 (file)
@@ -5,23 +5,7 @@
  * (C) Copyright 2007 Freescale Semiconductor, Inc.
  * TsiChung Liew (Tsi-Chung.Liew@freescale.com)
  *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * 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>
@@ -116,7 +100,7 @@ struct fec_info_dma fec_info[] = {
 #endif
 };
 
-static int fec_send(struct eth_device *dev, volatile void *packet, int length);
+static int fec_send(struct eth_device *dev, void *packet, int length);
 static int fec_recv(struct eth_device *dev);
 static int fec_init(struct eth_device *dev, bd_t * bd);
 static void fec_halt(struct eth_device *dev);
@@ -194,13 +178,13 @@ static void set_fec_duplex_speed(volatile fecdma_t * fecp, bd_t * bd,
        }
 }
 
-static int fec_send(struct eth_device *dev, volatile void *packet, int length)
+static int fec_send(struct eth_device *dev, void *packet, int length)
 {
        struct fec_info_dma *info = dev->priv;
        cbd_t *pTbd, *pUsedTbd;
        u16 phyStatus;
 
-       miiphy_read(dev->name, info->phy_addr, PHY_BMSR, &phyStatus);
+       miiphy_read(dev->name, info->phy_addr, MII_BMSR, &phyStatus);
 
        /* process all the consumed TBDs */
        while (info->cleanTbdNum < CONFIG_SYS_TX_ETH_BUFFER) {
@@ -301,8 +285,7 @@ static int fec_recv(struct eth_device *dev)
                        frame_length = pRbd->cbd_datlen - 4;
 
                        /* Fill the buffer and pass it to upper layers */
-                       NetReceive((volatile uchar *)pRbd->cbd_bufaddr,
-                                  frame_length);
+                       NetReceive((uchar *)pRbd->cbd_bufaddr, frame_length);
                        len = frame_length;
                }
 
@@ -369,6 +352,7 @@ static int fec_init(struct eth_device *dev, bd_t * bd)
        struct fec_info_dma *info = dev->priv;
        volatile fecdma_t *fecp = (fecdma_t *) (info->iobase);
        int i;
+       uchar enetaddr[6];
 
 #ifdef ET_DEBUG
        printf("fec_init: iobase 0x%08x ...\n", info->iobase);
@@ -397,11 +381,11 @@ static int fec_init(struct eth_device *dev, bd_t * bd)
        fecp->eir = 0xffffffff;
 
        /* Set station address   */
-       if ((u32) fecp == CONFIG_SYS_FEC0_IOBASE) {
-               fec_set_hwaddr(fecp, bd->bi_enetaddr);
-       } else {
-               fec_set_hwaddr(fecp, bd->bi_enet1addr);
-       }
+       if ((u32) fecp == CONFIG_SYS_FEC0_IOBASE)
+               eth_getenv_enetaddr("ethaddr", enetaddr);
+       else
+               eth_getenv_enetaddr("eth1addr", enetaddr);
+       fec_set_hwaddr(fecp, enetaddr);
 
        /* Set Opcode/Pause Duration Register */
        fecp->opd = 0x00010020;
@@ -520,7 +504,7 @@ int mcdmafec_initialize(bd_t * bis)
        u32 tmp = CONFIG_SYS_INTSRAM + 0x2000;
 #endif
 
-       for (i = 0; i < sizeof(fec_info) / sizeof(fec_info[0]); i++) {
+       for (i = 0; i < ARRAY_SIZE(fec_info); i++) {
 
                dev =
                    (struct eth_device *)memalign(CONFIG_SYS_CACHELINE_SIZE,