/* TODO: if power is software controlled, set up any regulators here */
priv->leds_disabled = of_property_read_bool(np, "realtek,disable-leds");
+ priv->reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
+ if (IS_ERR(priv->reset)) {
+ dev_err(dev, "failed to get RESET GPIO\n");
+ return PTR_ERR(priv->reset);
+ }
+
+ if (priv->reset) {
+ gpiod_set_value(priv->reset, 1);
+ dev_dbg(dev, "asserted RESET\n");
+ msleep(REALTEK_HW_STOP_DELAY);
+ gpiod_set_value(priv->reset, 0);
+ msleep(REALTEK_HW_START_DELAY);
+ dev_dbg(dev, "deasserted RESET\n");
+ }
+
ret = priv->ops->detect(priv);
if (ret) {
dev_err(dev, "unable to detect switch\n");
dsa_unregister_switch(priv->ds);
+ /* leave the device reset asserted */
+ if (priv->reset)
+ gpiod_set_value(priv->reset, 1);
+
dev_set_drvdata(&mdiodev->dev, NULL);
}
#include "realtek.h"
#define REALTEK_SMI_ACK_RETRY_COUNT 5
-#define REALTEK_SMI_HW_STOP_DELAY 25 /* msecs */
-#define REALTEK_SMI_HW_START_DELAY 100 /* msecs */
static inline void realtek_smi_clk_delay(struct realtek_priv *priv)
{
if (priv->reset) {
gpiod_set_value(priv->reset, 1);
dev_dbg(dev, "asserted RESET\n");
- msleep(REALTEK_SMI_HW_STOP_DELAY);
+ msleep(REALTEK_HW_STOP_DELAY);
gpiod_set_value(priv->reset, 0);
- msleep(REALTEK_SMI_HW_START_DELAY);
+ msleep(REALTEK_HW_START_DELAY);
dev_dbg(dev, "deasserted RESET\n");
}