|
@@ -21,6 +21,7 @@
|
|
#include <linux/of_mdio.h>
|
|
#include <linux/of_mdio.h>
|
|
#include <linux/of_platform.h>
|
|
#include <linux/of_platform.h>
|
|
#include <linux/of_net.h>
|
|
#include <linux/of_net.h>
|
|
|
|
+#include <linux/of_gpio.h>
|
|
#include <linux/sysfs.h>
|
|
#include <linux/sysfs.h>
|
|
#include <linux/phy_fixed.h>
|
|
#include <linux/phy_fixed.h>
|
|
#include "dsa_priv.h"
|
|
#include "dsa_priv.h"
|
|
@@ -688,6 +689,9 @@ static int dsa_of_probe(struct device *dev)
|
|
const char *port_name;
|
|
const char *port_name;
|
|
int chip_index, port_index;
|
|
int chip_index, port_index;
|
|
const unsigned int *sw_addr, *port_reg;
|
|
const unsigned int *sw_addr, *port_reg;
|
|
|
|
+ int gpio;
|
|
|
|
+ enum of_gpio_flags of_flags;
|
|
|
|
+ unsigned long flags;
|
|
u32 eeprom_len;
|
|
u32 eeprom_len;
|
|
int ret;
|
|
int ret;
|
|
|
|
|
|
@@ -766,6 +770,19 @@ static int dsa_of_probe(struct device *dev)
|
|
put_device(cd->host_dev);
|
|
put_device(cd->host_dev);
|
|
cd->host_dev = &mdio_bus_switch->dev;
|
|
cd->host_dev = &mdio_bus_switch->dev;
|
|
}
|
|
}
|
|
|
|
+ gpio = of_get_named_gpio_flags(child, "reset-gpios", 0,
|
|
|
|
+ &of_flags);
|
|
|
|
+ if (gpio_is_valid(gpio)) {
|
|
|
|
+ flags = (of_flags == OF_GPIO_ACTIVE_LOW ?
|
|
|
|
+ GPIOF_ACTIVE_LOW : 0);
|
|
|
|
+ ret = devm_gpio_request_one(dev, gpio, flags,
|
|
|
|
+ "switch_reset");
|
|
|
|
+ if (ret)
|
|
|
|
+ goto out_free_chip;
|
|
|
|
+
|
|
|
|
+ cd->reset = gpio_to_desc(gpio);
|
|
|
|
+ gpiod_direction_output(cd->reset, 0);
|
|
|
|
+ }
|
|
|
|
|
|
for_each_available_child_of_node(child, port) {
|
|
for_each_available_child_of_node(child, port) {
|
|
port_reg = of_get_property(port, "reg", NULL);
|
|
port_reg = of_get_property(port, "reg", NULL);
|