[OpenWrt-Devel] [PATCH] Support for Edimax EW-7476RPC / EW-7478AC

Birger Koblitz mail at birger-koblitz.de
Thu May 30 15:36:29 EDT 2019


Hi Daniel,

I have tried in vain to implement your suggestions. I am stuck and need
some help:

On 27.05.19 18:43, Daniel Golle wrote:
>>> +
>>> +&pinctrl {
>>> +       state_default: pinctrl0 {
>>> +               gpio {
>>> +            // might need pin 39: ;
>>> +                       ralink,group = "i2c", "uartf", "nd_sd",
>>> "rgmii2", "spi refclk";
>>> +                       ralink,function = "gpio";
>>> +               };
>>> +       };
>>> +};
>> A pinctrl group for the switch reset would be appropriate:
>> GPIO 39 is p4led_an, hence add:
>> 	phy_reset_pins: phy-reset {
>> 		gpio {
>> 			ralink,group = "p4led_an";
>> 			ralink,function = "gpio";
>> 		};
>> 	};

This does not work, I get the following error during boot:
[    1.227392] rt2880-pinmux pinctrl: invalid group "p4led_an" for
function "gpio"
[    1.242028] mtk_soc_eth: probe of 10100000.ethernet failed with error -22
gpio is part of the "spi refclk" group. Even if I remove that from the
pinctrl0 group, the error stays. I then tried:

&pinctrl {
    state_default: pinctrl0 {
        gpio {
            ralink,group = "i2c", "uartf", "nd_sd", "rgmii2";
            ralink,function = "gpio";
        };
    };
    /* the reset pin 39 is part of spi refclk */
    phy_reset_pins: phy-reset {
        gpio {
            ralink,group = "spi refclk";
                ralink,function = "gpio";
        };
    };
};



&ethernet {

    status = "okay";
    mtd-mac-address = <&factory 0x4>;
    pinctrl-names = "default";
    pinctrl-0 = <&rgmii1_pins &mdio_pins &phy_reset_pins>;
    mediatek,portmap = "l";
    mediatek,mdio-mode = <1>;
    phy-reset-gpios = <&gpio1 15 GPIO_ACTIVE_LOW>;

...

}

Which avoids the error. I am however not able to assign the gpio reset pin.

The code looks like this in mtk_eth_soc.c:

static int __init fe_init(struct net_device *dev)
{
    struct fe_priv *priv = netdev_priv(dev);
    struct device_node *port;
    const char *mac_addr;
    int err;
   
    struct gpio_desc *phy_reset;

    priv->soc->reset_fe();

    if (priv->soc->switch_init)
        if (priv->soc->switch_init(priv)) {
            netdev_err(dev, "failed to initialize switch core\n");
            return -ENODEV;
        }
 
    phy_reset = devm_gpiod_get_optional(priv->dev, "phy-reset", 0);
    if(phy_reset) {
        pr_info("ethernet: Got something else than NULL\n");
        if (IS_ERR(phy_reset)){
            pr_info("ethernet: Got error %d\n", PTR_ERR(phy_reset));
        } else {
            err = gpiod_direction_output(phy_reset, 1);
            if(!err) {
                pr_info("ethernet: direction is output\n");
                mdelay(30);
                gpiod_set_value(phy_reset, 0);
            } else {
                pr_info("Error: %d\n", err);
            }
        }
    } else {
        pr_info("ethernet: No phy-reset present\n");
    }   

However, this gives me the always the weird error code -517 as a result
from PTR_ERR(), which is not documented. Any help appreciated.


Birger


> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
>
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list