forked from Minki/linux
net: phy: smsc: disable energy detect mode
On some boards the energy enable detect mode leads in trouble with some switches, so make the enabling of this mode configurable through DT. Signed-off-by: Heiko Schocher <hs@denx.de> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
9e42f71526
commit
d88ecb373b
24
Documentation/devicetree/bindings/net/smsc-lan87xx.txt
Normal file
24
Documentation/devicetree/bindings/net/smsc-lan87xx.txt
Normal file
@ -0,0 +1,24 @@
|
||||
SMSC LAN87xx Ethernet PHY
|
||||
|
||||
Some boards require special tuning values. Configure them
|
||||
through an Ethernet OF device node.
|
||||
|
||||
Optional properties:
|
||||
|
||||
- smsc,disable-energy-detect:
|
||||
If set, do not enable energy detect mode for the SMSC phy.
|
||||
default: enable energy detect mode
|
||||
|
||||
Examples:
|
||||
smsc phy with disabled energy detect mode on an am335x based board.
|
||||
&davinci_mdio {
|
||||
pinctrl-names = "default", "sleep";
|
||||
pinctrl-0 = <&davinci_mdio_default>;
|
||||
pinctrl-1 = <&davinci_mdio_sleep>;
|
||||
status = "okay";
|
||||
|
||||
ethernetphy0: ethernet-phy@0 {
|
||||
reg = <0>;
|
||||
smsc,disable-energy-detect;
|
||||
};
|
||||
};
|
@ -43,16 +43,25 @@ static int smsc_phy_ack_interrupt(struct phy_device *phydev)
|
||||
|
||||
static int smsc_phy_config_init(struct phy_device *phydev)
|
||||
{
|
||||
int __maybe_unused len;
|
||||
struct device *dev __maybe_unused = &phydev->dev;
|
||||
struct device_node *of_node __maybe_unused = dev->of_node;
|
||||
int rc = phy_read(phydev, MII_LAN83C185_CTRL_STATUS);
|
||||
int enable_energy = 1;
|
||||
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
|
||||
/* Enable energy detect mode for this SMSC Transceivers */
|
||||
rc = phy_write(phydev, MII_LAN83C185_CTRL_STATUS,
|
||||
rc | MII_LAN83C185_EDPWRDOWN);
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
if (of_find_property(of_node, "smsc,disable-energy-detect", &len))
|
||||
enable_energy = 0;
|
||||
|
||||
if (enable_energy) {
|
||||
/* Enable energy detect mode for this SMSC Transceivers */
|
||||
rc = phy_write(phydev, MII_LAN83C185_CTRL_STATUS,
|
||||
rc | MII_LAN83C185_EDPWRDOWN);
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
}
|
||||
|
||||
return smsc_phy_ack_interrupt(phydev);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user