[PATCH 03/16] Ensure that the old style MDIO interface is active

Andrew Jeffery andrew at aj.id.au
Fri Sep 16 10:50:13 AEST 2016


On Thu, 2016-09-15 at 15:33 -0500, Timothy Pearson wrote:
>  before registering the MDIO bus on Faraday style
>  MACs.  Without this patch the hardware may continue
>  to expect new style commands, yielding MDIO timeouts
>  and general lack of communication with the MII.
> 
> Signed-off-by: Timothy Pearson <tpearson at raptorengineering.com>
> ---
>  drivers/net/ethernet/faraday/ftgmac100.c |    6 ++++++
>  drivers/net/ethernet/faraday/ftgmac100.h |    2 ++
>  2 files changed, 8 insertions(+)
> 
> diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c
> index c20f767..778c625 100644
> --- a/drivers/net/ethernet/faraday/ftgmac100.c
> +++ b/drivers/net/ethernet/faraday/ftgmac100.c
> @@ -1250,6 +1250,7 @@ static int ftgmac100_setup_mdio(struct net_device *netdev)
>  {
>  	struct ftgmac100 *priv = netdev_priv(netdev);
>  	struct platform_device *pdev = to_platform_device(priv->dev);
> +	uint32_t revcr;
>  	int i, err = 0;
>  
>  	/* initialize mdio bus */
> @@ -1257,6 +1258,11 @@ static int ftgmac100_setup_mdio(struct net_device *netdev)
>  	if (!priv->mii_bus)
>  		return -EIO;
>  
> +	/* This driver only supports the old MDIO interface -- enable it */
> +	revcr = ioread32(priv->base + FTGMAC100_OFFSET_REVR);
> +	revcr &= ~FTGMAC100_OFFSET_REVR_NEW_INTERFACE;
> +	iowrite32(revcr, priv->base + FTGMAC100_OFFSET_REVR);
> +

My gut feeling is this should involve devicetree somehow, though maybe
it's reasonable to 'attach' the old MDIO interface to the existing
compatible string for the driver (and register a new compatible string
for the new MDIO interface whenever that is supported)?

At least for MAC1 we're flipping the bit via the board-file
(do_ast2500_common_setup()). I think either we continue to add hacks
there, or we drop those hacks and use this approach. Twiddling it in
the driver at least means that it will work for any number of MACs...

Thoughts?

Andrew

>  	priv->mii_bus->name = "ftgmac100_mdio";
>  	snprintf(priv->mii_bus->id, MII_BUS_ID_SIZE, "%s-%d",
>  		 pdev->name, pdev->id);
> diff --git a/drivers/net/ethernet/faraday/ftgmac100.h b/drivers/net/ethernet/faraday/ftgmac100.h
> index d07b6ea..ee5f758 100644
> --- a/drivers/net/ethernet/faraday/ftgmac100.h
> +++ b/drivers/net/ethernet/faraday/ftgmac100.h
> @@ -133,6 +133,8 @@
>  #define FTGMAC100_DMAFIFOS_RXDMA_REQ		(1 << 30)
>  #define FTGMAC100_DMAFIFOS_TXDMA_REQ		(1 << 31)
>  
> +#define FTGMAC100_OFFSET_REVR_NEW_INTERFACE	(1 << 31)
> +
>  /*
>   * Receive buffer size register
>   */
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://lists.ozlabs.org/pipermail/openbmc/attachments/20160916/93747ad9/attachment-0001.sig>


More information about the openbmc mailing list