Re: [PATCH V3] net: emac: emac gigabit ethernet controller driver

From: Andrew Lunn
Date: Thu Apr 07 2016 - 20:53:26 EST


On Thu, Apr 07, 2016 at 04:43:47PM -0500, Timur Tabi wrote:
> On my platform, firmware (UEFI) configures all of the GPIOs. I need
> to get confirmation, but it appears that we don't actually make any
> GPIO calls at all. I see code that looks like this:
>
> for (i = 0; (!adpt->no_mdio_gpio) && i < EMAC_NUM_GPIO; i++) {
> gpio_info = &adpt->gpio_info[i];
> retval = of_get_named_gpio(node, gpio_info->name, 0);
> if (retval < 0)
> return retval;
>
> And on our ACPI system, adpt->no_mdio_gpio is always true:
>
> /* Assume GPIOs required for MDC/MDIO are enabled in firmware */
> adpt->no_mdio_gpio = true;

There are two different things here. One is configuring the pin to be
a GPIO. The second is using the GPIO as a GPIO. In this case,
bit-banging the MDIO bus.

The firmware could be doing the configuration, setting the pin as a
GPIO. However, the firmware cannot be doing the MDIO bit-banging to
make an MDIO bus available. Linux has to do that.

Or it could be we have all completely misunderstood the hardware, and
we are not doing bit-banging GPIO MDIO. There is a real MDIO
controller there, we don't use these pins as GPIOs, etc....

Andrew