#include <linux/phy.h>
#include <linux/lockdep.h>
#include <linux/ar8216_platform.h>
+#include <linux/gpio/consumer.h>
#include <linux/workqueue.h>
#include <linux/of_device.h>
#include <linux/leds.h>
}
#ifdef CONFIG_OF
+static void
+ar8327_gpio_reset(struct ar8xxx_priv *priv, struct device_node *np)
+{
+ int msec;
+ int reset_init;
+ bool active_high;
+ struct gpio_desc *reset;
+
+ active_high = of_property_read_bool(np, "reset-active-high");
+ reset_init = active_high ? GPIOD_OUT_HIGH : GPIOD_OUT_LOW;
+ reset = devm_gpiod_get_optional(priv->pdev, "reset", reset_init);
+ if (!reset)
+ return;
+
+ of_property_read_u32(np, "reset-duration", &msec);
+ if (msec > 20)
+ msleep(msec);
+ else
+ usleep_range(msec * 1000, msec * 1000 + 1000);
+
+ gpiod_set_value_cansleep(reset, !active_high);
+}
+
static int
ar8327_hw_config_of(struct ar8xxx_priv *priv, struct device_node *np)
{
int len;
int i;
+ ar8327_gpio_reset(priv, np);
+
paddr = of_get_property(np, "qca,ar8327-initvals", &len);
if (!paddr || len < (2 * sizeof(*paddr)))
return -EINVAL;