376-net-bcm63xx_enet-use-named-gpio-for-ephy-reset-gpio.patch 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. From ec905f2ea78ec40602a685ede31c5e4f9893d196 Mon Sep 17 00:00:00 2001
  2. From: Jonas Gorski <jogo@openwrt.org>
  3. Date: Sat, 21 Feb 2015 16:35:07 +0100
  4. Subject: [PATCH 3/6] net: bcm63xx_enet: use named gpio for ephy reset gpio
  5. Allow using a named optional gpio for ephy reset gpio registration.
  6. ---
  7. drivers/net/ethernet/broadcom/bcm63xx_enet.c | 9 +++++++++
  8. 1 file changed, 9 insertions(+)
  9. --- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
  10. +++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
  11. @@ -30,6 +30,7 @@
  12. #include <linux/dma-mapping.h>
  13. #include <linux/platform_device.h>
  14. #include <linux/if_vlan.h>
  15. +#include <linux/gpio/consumer.h>
  16. #include <bcm63xx_dev_enet.h>
  17. #include "bcm63xx_enet.h"
  18. @@ -2867,10 +2868,15 @@ static int bcm_enet_shared_probe(struct
  19. {
  20. struct resource *res;
  21. void __iomem *p[3];
  22. + struct gpio_desc *ephy_reset;
  23. unsigned int i;
  24. memset(bcm_enet_shared_base, 0, sizeof(bcm_enet_shared_base));
  25. + ephy_reset = devm_gpiod_get_optional(&pdev->dev, "ephy-reset", GPIOD_ASIS);
  26. + if (IS_ERR(ephy_reset))
  27. + return PTR_ERR(ephy_reset);
  28. +
  29. for (i = 0; i < 3; i++) {
  30. res = platform_get_resource(pdev, IORESOURCE_MEM, i);
  31. p[i] = devm_ioremap_resource(&pdev->dev, res);
  32. @@ -2880,6 +2886,9 @@ static int bcm_enet_shared_probe(struct
  33. memcpy(bcm_enet_shared_base, p, sizeof(bcm_enet_shared_base));
  34. + if (ephy_reset)
  35. + gpiod_direction_output(ephy_reset, 0);
  36. +
  37. return 0;
  38. }