lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 7 Oct 2014 16:09:45 +0200
From:	Linus Walleij <linus.walleij@...aro.org>
To:	Michael Welling <mwelling@...cinc.com>
Cc:	Florian Fainelli <f.fainelli@...il.com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Grant Likely <grant.likely@...aro.org>,
	"Rafael J. Wysocki" <rjw@...ysocki.net>,
	Greg KH <gregkh@...uxfoundation.org>,
	Nicolas Ferre <nicolas.ferre@...el.com>
Subject: Re: GPIO registration for external Ethernet PHY oscillator enable/disable

On Fri, Sep 26, 2014 at 10:04 PM, Michael Welling <mwelling@...cinc.com> wrote:
> On Fri, Sep 26, 2014 at 10:16:51AM -0700, Florian Fainelli wrote:
>>
>> Yes and no, this might feel like the wrong place, but ultimately, the
>> Ethernet MAC is a consumer of the PHY device, and is in control, through
>> the PHY library of how and when the PHY gets to be powered off.
>>
>
> So here is the patch that I made that hooks into the macb driver.
>
> Please look it over and tell me if we are on the same page.
>
> The thing that bothers me about this solution is that it will only work with the macb driver.
> So everytime I use the same PHY/OSC combo with a different SoC I will have to do another patch.
>
> diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c
> index e4e34b6..8cd363f 100644
> --- a/drivers/net/ethernet/cadence/macb.c
> +++ b/drivers/net/ethernet/cadence/macb.c
> @@ -28,6 +28,7 @@
>  #include <linux/of.h>
>  #include <linux/of_device.h>
>  #include <linux/of_net.h>
> +#include <linux/of_gpio.h>

No please,
#include <linux/gpio/consumer.h>

> @@ -1833,6 +1834,16 @@ static int __init macb_probe(struct platform_device *pdev)
>                 bp->phy_interface = err;
>         }
>
> +       bp->phy_osc_gpio = of_get_named_gpio(pdev->dev.of_node, "osc-gpio", 0);
> +
> +       if (gpio_is_valid(bp->phy_osc_gpio))
> +       {
> +               if (gpio_request(bp->phy_osc_gpio, "osc-gpio") != 0) {
> +                       pr_info("Oscillator GPIO not available.\n");
> +                       bp->phy_osc_gpio = 0;
> +               }
> +       }


No,
bp->phy_osc_gpiod = devm_gpiod_get(&pdev->dev, "osc-gpio", 0);

And error handling.

> +       if (gpio_is_valid(bp->phy_osc_gpio))
> +               gpio_set_value_cansleep(bp->phy_osc_gpio, 0);
> +

if (bp->phy_osc_gpiod)
  gpiod_set_...

> +       if (gpio_is_valid(bp->phy_osc_gpio))
> +               gpio_set_value_cansleep(bp->phy_osc_gpio, 1);

Dito.

>         phy_interface_t         phy_interface;
> +       int                     phy_osc_gpio;

struct gpio_desc *phy_osc_gpiod;

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ