Skip to content

Commit

Permalink
net: stmmac: use device_property_read_u32_array to read the reset delays
Browse files Browse the repository at this point in the history
Change stmmac_mdio_reset() to use device_property_read_u32_array()
instead of of_property_read_u32_array().

This is meant as a cleanup because we can drop the struct device_node
variable. Also it will make it easier to get rid of struct
stmmac_mdio_bus_data (or at least make it private) in the future because
non-OF platforms can now pass the reset delays as device properties.

No functional changes (neither for OF platforms nor for ones that are
not using OF, because the modified code is still contained in an "if
(priv->device->of_node)").

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Martin Blumenstingl authored and David S. Miller committed Jun 16, 2019
1 parent 626c5fe commit 42a9076
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
#include <linux/io.h>
#include <linux/iopoll.h>
#include <linux/mii.h>
#include <linux/of.h>
#include <linux/of_mdio.h>
#include <linux/phy.h>
#include <linux/property.h>
#include <linux/slab.h>

#include "dwxgmac2.h"
Expand Down Expand Up @@ -254,16 +254,15 @@ int stmmac_mdio_reset(struct mii_bus *bus)
struct gpio_desc *reset_gpio;

if (data->reset_gpio < 0) {
struct device_node *np = priv->device->of_node;

reset_gpio = devm_gpiod_get_optional(priv->device,
"snps,reset",
GPIOD_OUT_LOW);
if (IS_ERR(reset_gpio))
return PTR_ERR(reset_gpio);

of_property_read_u32_array(np,
"snps,reset-delays-us", data->delays, 3);
device_property_read_u32_array(priv->device,
"snps,reset-delays-us",
data->delays, 3);
} else {
reset_gpio = gpio_to_desc(data->reset_gpio);

Expand Down

0 comments on commit 42a9076

Please sign in to comment.