lkml.org 
[lkml]   [2017]   [Jul]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] net: axienet: add of_phy_connect call for XAE_PHY_TYPE_MII case
On Wed, Jul 05, 2017 at 04:34:36PM +0200, Andrew Lunn wrote:
> So the only property which is currently wrong is xlnx,phy-type. As you
> said, all the others are garbage. So i would suggest something like:
>
> diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
> index 33c595f4691d..34a514d3288a 100644
> --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
> +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
> @@ -1539,7 +1539,38 @@ static int axienet_probe(struct platform_device *pdev)
> * the device-tree and accordingly set flags.
> */
> of_property_read_u32(pdev->dev.of_node, "xlnx,rxmem", &lp->rxmem);
> - of_property_read_u32(pdev->dev.of_node, "xlnx,phy-type", &lp->phy_type);
> +
> + /* Start with the proprietary, and broken phy_type */
> + err = of_property_read_u32(pdev->dev.of_node, "xlnx,phy-type", &phy_type);
> + if (!err) {
> + netdev_warn(ndev, "Please upgrade your device tree binary blob to use phy-mode");
> + switch (phy_type) {
> + case XAE_PHY_TYPE_MII:
> + lp->phy_mode = PHY_INTERFACE_MODE_MII;
> + break;
> + case XAE_PHY_TYPE_GMII:
> + lp->phy_mode = PHY_INTERFACE_MODE_GMII;
> + break;
> + case XAE_PHY_TYPE_RGMII_2_0:
> + lp->phy_mode = PHY_INTERFACE_MODE_RGMII;
> + break;
> + case XAE_PHY_TYPE_SGMII:
> + lp->pht_mode = PHY_INTERFACE_MODE_SGMII;
> + break;
> + case XAE_PHY_TYPE_1000BASE_X:
> + lp->pht_mode = PHY_INTERFACE_MODE_1000BASEX;
> + break;
> + default:
> + ret = -EINVAL;
> + goto free_netdev;
> + }
> + } else {
> + lp->phy_mode = of_get_phy_mode(pdev->dev.of_node);
> + if (lp->phy_mode < 0) {
> + ret = -EINVAL;
> + goto free_netdev;
> + }
> + }
>
> /* Find the DMA node, map the DMA registers, and decode the DMA IRQs */
> np = of_parse_phandle(pdev->dev.of_node, "axistream-connected", 0);
>
> Andrew

That sounds really respectful with current users and sets the basis for a
future removal of that proprietary parameter without causing more harm than
needed, so I like that a lot.

--
Alvaro G. M.

\
 
 \ /
  Last update: 2017-07-05 16:44    [W:0.043 / U:0.464 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site