Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a5597008 authored by Andrew Lunn's avatar Andrew Lunn Committed by David S. Miller
Browse files

phy: fixed_phy: Add gpio to determine link up/down.



An SFP module may have a link up/down status pin which can be
connection to a GPIO line of the host. Add support for reading such an
GPIO in the fixed_phy driver.

Signed-off-by: default avatarAndrew Lunn <andrew@lunn.ch>
Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 8b59d19e
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -17,6 +17,8 @@ properties:
  enabled.
* 'asym-pause' (boolean, optional), to indicate that asym_pause should
  be enabled.
* 'link-gpios' ('gpio-list', optional), to indicate if a gpio can be read
  to determine if the link is up.

Old, deprecated 'fixed-link' binding:

@@ -30,7 +32,7 @@ Old, deprecated 'fixed-link' binding:
  - e: asymmetric pause configuration: 0 for no asymmetric pause, 1 for
    asymmetric pause

Example:
Examples:

ethernet@0 {
	...
@@ -40,3 +42,13 @@ ethernet@0 {
	};
	...
};

ethernet@1 {
	...
	fixed-link {
	      speed = <1000>;
	      pause;
	      link-gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>;
	};
	...
};
+1 −1
Original line number Diff line number Diff line
@@ -254,7 +254,7 @@ static struct fixed_phy_status stmmac0_fixed_phy_status = {

During the board's device_init we can configure the first
MAC for fixed_link by calling:
  fixed_phy_add(PHY_POLL, 1, &stmmac0_fixed_phy_status));)
  fixed_phy_add(PHY_POLL, 1, &stmmac0_fixed_phy_status, -1);
and the second one, with a real PHY device attached to the bus,
by using the stmmac_mdio_bus_data structure (to provide the id, the
reset procedure etc).
+1 −1
Original line number Diff line number Diff line
@@ -126,7 +126,7 @@ static struct fixed_phy_status nettel_fixed_phy_status __initdata = {
static int __init init_BSP(void)
{
	m5272_uarts_init();
	fixed_phy_add(PHY_POLL, 0, &nettel_fixed_phy_status);
	fixed_phy_add(PHY_POLL, 0, &nettel_fixed_phy_status, -1);
	return 0;
}

+3 −2
Original line number Diff line number Diff line
@@ -679,7 +679,8 @@ static int __init ar7_register_devices(void)
	}

	if (ar7_has_high_cpmac()) {
		res = fixed_phy_add(PHY_POLL, cpmac_high.id, &fixed_phy_status);
		res = fixed_phy_add(PHY_POLL, cpmac_high.id,
				    &fixed_phy_status, -1);
		if (!res) {
			cpmac_get_mac(1, cpmac_high_data.dev_addr);

@@ -692,7 +693,7 @@ static int __init ar7_register_devices(void)
	} else
		cpmac_low_data.phy_mask = 0xffffffff;

	res = fixed_phy_add(PHY_POLL, cpmac_low.id, &fixed_phy_status);
	res = fixed_phy_add(PHY_POLL, cpmac_low.id, &fixed_phy_status, -1);
	if (!res) {
		cpmac_get_mac(0, cpmac_low_data.dev_addr);
		res = platform_device_register(&cpmac_low);
+1 −1
Original line number Diff line number Diff line
@@ -263,7 +263,7 @@ static int __init bcm47xx_register_bus_complete(void)
	bcm47xx_leds_register();
	bcm47xx_workarounds();

	fixed_phy_add(PHY_POLL, 0, &bcm47xx_fixed_phy_status);
	fixed_phy_add(PHY_POLL, 0, &bcm47xx_fixed_phy_status, -1);
	return 0;
}
device_initcall(bcm47xx_register_bus_complete);
Loading