]> git.sur5r.net Git - u-boot/blobdiff - drivers/net/fsl_mdio.c
SPDX: Convert all of our single license tags to Linux Kernel style
[u-boot] / drivers / net / fsl_mdio.c
index 8d09f5d1fe9b204757404afddfe38ed9076da9ba..894b52ee66f412b09548a25e5dfa28e8272f8fcc 100644 (file)
@@ -1,16 +1,16 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright 2009-2010, 2013 Freescale Semiconductor, Inc.
  *     Jun-jie Zhang <b18070@freescale.com>
  *     Mingkai Hu <Mingkai.hu@freescale.com>
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
+
 #include <common.h>
 #include <miiphy.h>
 #include <phy.h>
 #include <fsl_mdio.h>
 #include <asm/io.h>
-#include <asm/errno.h>
+#include <linux/errno.h>
 
 void tsec_local_mdio_write(struct tsec_mii_mng __iomem *phyregs, int port_addr,
                int dev_addr, int regnum, int value)
@@ -19,7 +19,8 @@ void tsec_local_mdio_write(struct tsec_mii_mng __iomem *phyregs, int port_addr,
 
        out_be32(&phyregs->miimadd, (port_addr << 8) | (regnum & 0x1f));
        out_be32(&phyregs->miimcon, value);
-       asm("sync");
+       /* Memory barrier */
+       mb();
 
        while ((in_be32(&phyregs->miimind) & MIIMIND_BUSY) && timeout--)
                ;
@@ -31,17 +32,18 @@ int tsec_local_mdio_read(struct tsec_mii_mng __iomem *phyregs, int port_addr,
        int value;
        int timeout = 1000000;
 
-       /* Put the address of the phy, and the register
-        * number into MIIMADD */
+       /* Put the address of the phy, and the register number into MIIMADD */
        out_be32(&phyregs->miimadd, (port_addr << 8) | (regnum & 0x1f));
 
        /* Clear the command register, and wait */
        out_be32(&phyregs->miimcom, 0);
-       asm("sync");
+       /* Memory barrier */
+       mb();
 
        /* Initiate a read command, and wait */
        out_be32(&phyregs->miimcom, MIIMCOM_READ_CYCLE);
-       asm("sync");
+       /* Memory barrier */
+       mb();
 
        /* Wait for the the indication that the read is done */
        while ((in_be32(&phyregs->miimind) & (MIIMIND_NOTVALID | MIIMIND_BUSY))
@@ -101,7 +103,7 @@ int fsl_pq_mdio_init(bd_t *bis, struct fsl_pq_mdio_info *info)
        bus->read = tsec_phy_read;
        bus->write = tsec_phy_write;
        bus->reset = fsl_pq_mdio_reset;
-       sprintf(bus->name, info->name);
+       strcpy(bus->name, info->name);
 
        bus->priv = (void *)info->regs;