summaryrefslogtreecommitdiffstats
path: root/drivers/net/phy/mdio-gpio.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/phy/mdio-gpio.c')
-rw-r--r--drivers/net/phy/mdio-gpio.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/drivers/net/phy/mdio-gpio.c b/drivers/net/phy/mdio-gpio.c
index 80d2394f4b..a28fb961e4 100644
--- a/drivers/net/phy/mdio-gpio.c
+++ b/drivers/net/phy/mdio-gpio.c
@@ -42,7 +42,7 @@ struct mdio_gpio_info {
int mdc_active_low, mdio_active_low, mdo_active_low;
};
-static struct mdio_gpio_info *mdio_gpio_of_get_info(struct device_d *dev)
+static struct mdio_gpio_info *mdio_gpio_of_get_info(struct device *dev)
{
int ret;
enum of_gpio_flags flags;
@@ -50,7 +50,7 @@ static struct mdio_gpio_info *mdio_gpio_of_get_info(struct device_d *dev)
info = xzalloc(sizeof(*info));
- ret = of_get_gpio_flags(dev->device_node, 0, &flags);
+ ret = of_get_gpio_flags(dev->of_node, 0, &flags);
if (ret < 0) {
dev_dbg(dev, "failed to get MDC information from DT\n");
goto free_info;
@@ -59,7 +59,7 @@ static struct mdio_gpio_info *mdio_gpio_of_get_info(struct device_d *dev)
info->mdc = ret;
info->mdc_active_low = flags & OF_GPIO_ACTIVE_LOW;
- ret = of_get_gpio_flags(dev->device_node, 1, &flags);
+ ret = of_get_gpio_flags(dev->of_node, 1, &flags);
if (ret < 0) {
dev_dbg(dev, "failed to get MDIO information from DT\n");
goto free_info;
@@ -68,7 +68,7 @@ static struct mdio_gpio_info *mdio_gpio_of_get_info(struct device_d *dev)
info->mdio = ret;
info->mdio_active_low = flags & OF_GPIO_ACTIVE_LOW;
- ret = of_get_gpio_flags(dev->device_node, 2, &flags);
+ ret = of_get_gpio_flags(dev->of_node, 2, &flags);
if (ret > 0) {
dev_dbg(dev, "found MDO information in DT\n");
info->mdo = ret;
@@ -142,10 +142,10 @@ static struct mdiobb_ops mdio_gpio_ops = {
.get_mdio_data = mdio_get,
};
-static int mdio_gpio_probe(struct device_d *dev)
+static int mdio_gpio_probe(struct device *dev)
{
int ret;
- struct device_node *np = dev->device_node;
+ struct device_node *np = dev->of_node;
struct mdio_gpio_info *info;
struct mii_bus *bus;
@@ -193,9 +193,16 @@ static int mdio_gpio_probe(struct device_d *dev)
goto free_mdo;
}
+ if (np &&
+ of_device_is_compatible(np, "microchip,mdio-smi0")) {
+ info->ctrl.op_c22_read = 0;
+ info->ctrl.op_c22_write = 0;
+ info->ctrl.override_op_c22 = 1;
+ }
+
bus = alloc_mdio_bitbang(&info->ctrl);
bus->parent = dev;
- bus->dev.device_node = np;
+ bus->dev.of_node = np;
dev->priv = bus;
@@ -217,10 +224,12 @@ free_info:
static const struct of_device_id gpio_mdio_dt_ids[] = {
{ .compatible = "virtual,mdio-gpio", },
+ { .compatible = "microchip,mdio-smi0" },
{ /* sentinel */ }
};
+MODULE_DEVICE_TABLE(of, gpio_mdio_dt_ids);
-static struct driver_d mdio_gpio_driver = {
+static struct driver mdio_gpio_driver = {
.name = "mdio-gpio",
.probe = mdio_gpio_probe,
.of_compatible = DRV_OF_COMPAT(gpio_mdio_dt_ids),