Skip to content

Commit

Permalink
of: make of_get_phy_mode parse 'phy-connection-type'
Browse files Browse the repository at this point in the history
Per the ePAPR v1.1 specification, 'phy-connection-type' is the canonical
property name for describing an Ethernet to PHY connection type. Make
sure that of_get_phy_mode() also attempts to parse that property and
update the comments mentioning 'phy-mode' to also include
'phy-connection-type'.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Grant Likely <grant.likely@linaro.org>
  • Loading branch information
Florian Fainelli authored and Grant Likely committed Feb 3, 2014
1 parent f5fab57 commit cf4c9eb
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions drivers/of/of_net.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

/**
* It maps 'enum phy_interface_t' found in include/linux/phy.h
* into the device tree binding of 'phy-mode', so that Ethernet
* device driver can get phy interface from device tree.
* into the device tree binding of 'phy-mode' or 'phy-connection-type',
* so that Ethernet device driver can get phy interface from device tree.
*/
static const char *phy_modes[] = {
[PHY_INTERFACE_MODE_NA] = "",
Expand All @@ -37,15 +37,18 @@ static const char *phy_modes[] = {
* of_get_phy_mode - Get phy mode for given device_node
* @np: Pointer to the given device_node
*
* The function gets phy interface string from property 'phy-mode',
* and return its index in phy_modes table, or errno in error case.
* The function gets phy interface string from property 'phy-mode' or
* 'phy-connection-type', and return its index in phy_modes table, or errno in
* error case.
*/
int of_get_phy_mode(struct device_node *np)
{
const char *pm;
int err, i;

err = of_property_read_string(np, "phy-mode", &pm);
if (err < 0)
err = of_property_read_string(np, "phy-connection-type", &pm);
if (err < 0)
return err;

Expand Down

0 comments on commit cf4c9eb

Please sign in to comment.