Merge tag 'efi-2019-10-rc1-2' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi
[oweals/u-boot.git] / drivers / net / phy / ti.c
index 6ac890a7f5c33d082f006cca1734a6e51f5db189..75099364659374cff16a60e8961763b494e9151d 100644 (file)
@@ -103,7 +103,7 @@ struct dp83867_private {
        int io_impedance;
        bool rxctrl_strap_quirk;
        int port_mirroring;
-       int clk_output_sel;
+       unsigned int clk_output_sel;
 };
 
 static int dp83867_config_port_mirroring(struct phy_device *phydev)
@@ -136,21 +136,15 @@ static int dp83867_of_init(struct phy_device *phydev)
        ofnode node;
        u16 val;
 
-       /* Optional configuration */
-
-       /*
-        * Keep the default value if ti,clk-output-sel is not set
-        * or to high
-        */
+       node = phy_get_ofnode(phydev);
+       if (!ofnode_valid(node))
+               return -EINVAL;
 
+       /* Keep the default value if ti,clk-output-sel is not set */
        dp83867->clk_output_sel =
                ofnode_read_u32_default(node, "ti,clk-output-sel",
                                        DP83867_CLK_O_SEL_REF_CLK);
 
-       node = phy_get_ofnode(phydev);
-       if (!ofnode_valid(node))
-               return -EINVAL;
-
        if (ofnode_read_bool(node, "ti,max-output-impedance"))
                dp83867->io_impedance = DP83867_IO_MUX_CFG_IO_IMPEDANCE_MAX;
        else if (ofnode_read_bool(node, "ti,min-output-impedance"))
@@ -162,14 +156,14 @@ static int dp83867_of_init(struct phy_device *phydev)
                dp83867->rxctrl_strap_quirk = true;
        dp83867->rx_id_delay = ofnode_read_u32_default(node,
                                                       "ti,rx-internal-delay",
-                                                      -1);
+                                                      DEFAULT_RX_ID_DELAY);
 
        dp83867->tx_id_delay = ofnode_read_u32_default(node,
                                                       "ti,tx-internal-delay",
-                                                      -1);
+                                                      DEFAULT_TX_ID_DELAY);
 
        dp83867->fifo_depth = ofnode_read_u32_default(node, "ti,fifo-depth",
-                                                     -1);
+                                                     DEFAULT_FIFO_DEPTH);
        if (ofnode_read_bool(node, "enet-phy-lane-swap"))
                dp83867->port_mirroring = DP83867_PORT_MIRRORING_EN;