All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [RFC PATCH] net: phy: Force master mode for RTL8211C
Date: Tue, 22 Mar 2016 09:09:15 +0100	[thread overview]
Message-ID: <56F0FDAB.5060909@redhat.com> (raw)
In-Reply-To: <1458633079-8896-2-git-send-email-haas@computerlinguist.org>

Hi,

On 22-03-16 08:51, Michael Haas wrote:
> The RTL8211C found on the A20-OlinuXino-Lime2 does not word in slave
> mode. This patch disables master/slave mode autonegotiation and forces
> master mode.
>
> The RTL8211C identifies itself as RTL8211B via its UID. This patch uses
> the revision number taken from the PHYID2 register to distinguish the
> two. The NetBSD driver uses the same approach.
>
> CC: fradav at gmail.com
> CC: merker at debian.org
> CC: hdegoede at redhat.com
> CC: ijc at hellion.org.uk
> CC: joe.hershberger at ni.com
> Signed-off-by: Michael Haas <haas@computerlinguist.org>
> ---
>
>   drivers/net/phy/realtek.c | 13 +++++++++++++
>   1 file changed, 13 insertions(+)
>
> diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c
> index 259a87f..97d5712 100644
> --- a/drivers/net/phy/realtek.c
> +++ b/drivers/net/phy/realtek.c
> @@ -54,6 +54,19 @@ static int rtl8211x_config(struct phy_device *phydev)
>   	phy_write(phydev, MDIO_DEVAD_NONE, MIIM_RTL8211x_PHY_INER,
>   		  MIIM_RTL8211x_PHY_INTR_DIS);
>
> +	int reg = phy_read(phydev, MDIO_DEVAD_NONE, MII_PHYSID1);
> +	int rev = reg & 0xf;
> +	if (rev == 3 && phydev->phy_id == 0x1cc912) {
> +		/* RTL8211C and RTL8211C are distinguished only by
> +		   their revision number */

RTL8211C and RTL8211C -> RTL8211B and RTL8211C ?

Also I would put this comment above the:

	int reg = phy_read(phydev, MDIO_DEVAD_NONE, MII_PHYSID1);

Line, and put a comment like this above the if :

	/* The RTL8211C is unreliable in slave mode, force master mode */

Code wise everything looks good :)

> +		reg = phy_read(phydev, MDIO_DEVAD_NONE, MII_CTRL1000);
> +		/* force manual master/slave configuration */
> +		reg |= (1 << 12);
> +		/* force master mode */
> +		reg | = (1 << 11);
> +		phy_write(phydev, MDIO_DEVAD_NONE, MII_CTRL1000, reg);
> +	}
> +
>   	/* read interrupt status just to clear it */
>   	phy_read(phydev, MDIO_DEVAD_NONE, MIIM_RTL8211x_PHY_INER);
>
>

Regards,

Hans

  reply	other threads:[~2016-03-22  8:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-22  7:51 [U-Boot] [RFC PATCH 0/1] net: phy: Force master mode for RTL8211C Michael Haas
2016-03-22  7:51 ` [U-Boot] [RFC PATCH] " Michael Haas
2016-03-22  8:09   ` Hans de Goede [this message]
  -- strict thread matches above, loose matches on Subject: below --
2016-03-22  7:19 [U-Boot] [RFC PATCH 0/1] " Michael Haas
2016-03-22  7:19 ` [U-Boot] [RFC PATCH] " Michael Haas
2016-03-22  7:40   ` Michael Haas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56F0FDAB.5060909@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.