All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 03/16] Ensure that the old style MDIO interface is active
@ 2016-09-15 20:33 Timothy Pearson
  2016-09-16  0:50 ` Andrew Jeffery
  0 siblings, 1 reply; 2+ messages in thread
From: Timothy Pearson @ 2016-09-15 20:33 UTC (permalink / raw)
  To: openbmc

 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@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);
+
 	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
  */
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 03/16] Ensure that the old style MDIO interface is active
  2016-09-15 20:33 [PATCH 03/16] Ensure that the old style MDIO interface is active Timothy Pearson
@ 2016-09-16  0:50 ` Andrew Jeffery
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Jeffery @ 2016-09-16  0:50 UTC (permalink / raw)
  To: Timothy Pearson, openbmc

[-- Attachment #1: Type: text/plain, Size: 2628 bytes --]

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@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
>   */

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-09-16  0:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-15 20:33 [PATCH 03/16] Ensure that the old style MDIO interface is active Timothy Pearson
2016-09-16  0:50 ` Andrew Jeffery

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.