These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / drivers / net / ethernet / xilinx / xilinx_axienet_mdio.c
index 3b67d60..507bbb0 100644 (file)
@@ -37,7 +37,7 @@ int axienet_mdio_wait_until_ready(struct axienet_local *lp)
  * @phy_id:    Address of the PHY device
  * @reg:       PHY register to read
  *
- * returns:    The register contents on success, -ETIMEDOUT on a timeout
+ * Return:     The register contents on success, -ETIMEDOUT on a timeout
  *
  * Reads the contents of the requested register from the requested PHY
  * address by first writing the details into MCR register. After a while
@@ -80,7 +80,7 @@ static int axienet_mdio_read(struct mii_bus *bus, int phy_id, int reg)
  * @reg:       PHY register to write to
  * @val:       Value to be written into the register
  *
- * returns:    0 on success, -ETIMEDOUT on a timeout
+ * Return:     0 on success, -ETIMEDOUT on a timeout
  *
  * Writes the value to the requested register by first writing the value
  * into MWD register. The the MCR register is then appropriately setup
@@ -119,7 +119,7 @@ static int axienet_mdio_write(struct mii_bus *bus, int phy_id, int reg,
  * @lp:                Pointer to axienet local data structure.
  * @np:                Pointer to device node
  *
- * returns:    0 on success, -ETIMEDOUT on a timeout, -ENOMEM when
+ * Return:     0 on success, -ETIMEDOUT on a timeout, -ENOMEM when
  *             mdiobus_alloc (to allocate memory for mii bus structure) fails.
  *
  * Sets up the MDIO interface by initializing the MDIO clock and enabling the
@@ -129,7 +129,6 @@ int axienet_mdio_setup(struct axienet_local *lp, struct device_node *np)
 {
        int ret;
        u32 clk_div, host_clock;
-       u32 *property_p;
        struct mii_bus *bus;
        struct resource res;
        struct device_node *np1;
@@ -161,34 +160,34 @@ int axienet_mdio_setup(struct axienet_local *lp, struct device_node *np)
 
        np1 = of_find_node_by_name(NULL, "cpu");
        if (!np1) {
-               printk(KERN_WARNING "%s(): Could not find CPU device node.",
-                      __func__);
-               printk(KERN_WARNING "Setting MDIO clock divisor to "
-                      "default %d\n", DEFAULT_CLOCK_DIVISOR);
+               netdev_warn(lp->ndev, "Could not find CPU device node.\n");
+               netdev_warn(lp->ndev,
+                           "Setting MDIO clock divisor to default %d\n",
+                           DEFAULT_CLOCK_DIVISOR);
                clk_div = DEFAULT_CLOCK_DIVISOR;
                goto issue;
        }
-       property_p = (u32 *) of_get_property(np1, "clock-frequency", NULL);
-       if (!property_p) {
-               printk(KERN_WARNING "%s(): Could not find CPU property: "
-                      "clock-frequency.", __func__);
-               printk(KERN_WARNING "Setting MDIO clock divisor to "
-                      "default %d\n", DEFAULT_CLOCK_DIVISOR);
+       if (of_property_read_u32(np1, "clock-frequency", &host_clock)) {
+               netdev_warn(lp->ndev, "clock-frequency property not found.\n");
+               netdev_warn(lp->ndev,
+                           "Setting MDIO clock divisor to default %d\n",
+                           DEFAULT_CLOCK_DIVISOR);
                clk_div = DEFAULT_CLOCK_DIVISOR;
                of_node_put(np1);
                goto issue;
        }
 
-       host_clock = be32_to_cpup(property_p);
        clk_div = (host_clock / (MAX_MDIO_FREQ * 2)) - 1;
        /* If there is any remainder from the division of
         * fHOST / (MAX_MDIO_FREQ * 2), then we need to add
-        * 1 to the clock divisor or we will surely be above 2.5 MHz */
+        * 1 to the clock divisor or we will surely be above 2.5 MHz
+        */
        if (host_clock % (MAX_MDIO_FREQ * 2))
                clk_div++;
 
-       printk(KERN_DEBUG "%s(): Setting MDIO clock divisor to %u based "
-              "on %u Hz host clock.\n", __func__, clk_div, host_clock);
+       netdev_dbg(lp->ndev,
+                  "Setting MDIO clock divisor to %u/%u Hz host clock.\n",
+                  clk_div, host_clock);
 
        of_node_put(np1);
 issue: