Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: mv643xx_eth: Fetch the phy connection type from DT

The MAC is capable of RGMII mode and that is probably a more typical
connection type than GMII today (eg it is used by Marvell Reference
designs for several SOCs). Let DT users specify the standard

phy-connection-type = "rgmii-id";

On a phy node.

Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Jason Gunthorpe and committed by
David S. Miller
fd33b244 ad601339

+20 -4
+1
Documentation/devicetree/bindings/net/marvell-orion-net.txt
··· 49 49 and 50 50 51 51 - phy-handle: See ethernet.txt file in the same directory. 52 + - phy-mode: See ethernet.txt file in the same directory. 52 53 53 54 or 54 55
+19 -4
drivers/net/ethernet/marvell/mv643xx_eth.c
··· 2968 2968 mp->txq_count = pd->tx_queue_count ? : 1; 2969 2969 } 2970 2970 2971 + static int get_phy_mode(struct mv643xx_eth_private *mp) 2972 + { 2973 + struct device *dev = mp->dev->dev.parent; 2974 + int iface = -1; 2975 + 2976 + if (dev->of_node) 2977 + iface = of_get_phy_mode(dev->of_node); 2978 + 2979 + /* Historical default if unspecified. We could also read/write 2980 + * the interface state in the PSC1 2981 + */ 2982 + if (iface < 0) 2983 + iface = PHY_INTERFACE_MODE_GMII; 2984 + return iface; 2985 + } 2986 + 2971 2987 static struct phy_device *phy_scan(struct mv643xx_eth_private *mp, 2972 2988 int phy_addr) 2973 2989 { ··· 3010 2994 "orion-mdio-mii", addr); 3011 2995 3012 2996 phydev = phy_connect(mp->dev, phy_id, mv643xx_eth_adjust_link, 3013 - PHY_INTERFACE_MODE_GMII); 2997 + get_phy_mode(mp)); 3014 2998 if (!IS_ERR(phydev)) { 3015 2999 phy_addr_set(mp, addr); 3016 3000 break; ··· 3106 3090 if (!dev) 3107 3091 return -ENOMEM; 3108 3092 3093 + SET_NETDEV_DEV(dev, &pdev->dev); 3109 3094 mp = netdev_priv(dev); 3110 3095 platform_set_drvdata(pdev, mp); 3111 3096 ··· 3146 3129 if (pd->phy_node) { 3147 3130 mp->phy = of_phy_connect(mp->dev, pd->phy_node, 3148 3131 mv643xx_eth_adjust_link, 0, 3149 - PHY_INTERFACE_MODE_GMII); 3132 + get_phy_mode(mp)); 3150 3133 if (!mp->phy) 3151 3134 err = -ENODEV; 3152 3135 else ··· 3203 3186 3204 3187 dev->priv_flags |= IFF_UNICAST_FLT; 3205 3188 dev->gso_max_segs = MV643XX_MAX_TSO_SEGS; 3206 - 3207 - SET_NETDEV_DEV(dev, &pdev->dev); 3208 3189 3209 3190 if (mp->shared->win_protect) 3210 3191 wrl(mp, WINDOW_PROTECT(mp->port_num), mp->shared->win_protect);