All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Florian Fainelli <f.fainelli@gmail.com>
Cc: netdev@vger.kernel.org, dave@davemloft.net,
	vivien.didelot@savoirfairelinux.com,
	jerome.oufella@savoirfairelinux.com, linux@roeck-us.net,
	cphealy@gmail.com, mathieu@codeaurora.org, jonasj76@gmail.com,
	andrey.volkov@nexvision.fr, Chris.Packham@alliedtelesis.co.nz
Subject: Re: [RFC PATCH net-next 7/8] net: dsa: mv88e6060: make it a proper PHY driver
Date: Thu, 30 Apr 2015 14:46:01 +0200	[thread overview]
Message-ID: <20150430124601.GA22831@lunn.ch> (raw)
In-Reply-To: <1430359064-23454-8-git-send-email-f.fainelli@gmail.com>

> +/* Read the switch identifier register using the special Port register, and if
> + * successful, override the PHY ID for this device
> + */
> +static int mv88e6060_phy_fixup(struct phy_device *phydev)
> +{
> +	int ret;
> +
> +	/* Marvell switches should be accessed using MDIO address 16 */
> +	if (phydev->addr != 16)
> +		return 0;
> +
> +	ret = mdiobus_read(phydev->bus, REG_PORT(0), 0x03) &
> +			   MV88E6060_MAGIC_MASK;
> +	if (ret != MV88E6060_MAGIC)
> +		return 0;
> +
> +	phydev->phy_id = MV88E6060_MAGIC;
> +
> +	return 0;
> +}

Hi Florian

The 6060 datasheet is the only public one. It talks a little bit about
this. The switch can either use addresses 0-15, or 16-31, depending on
EE_CLK/ADDR4 pin. So your first check needs expanding.

The other chips have two different addressing modes, depending on pins
at reset time. They can be similar to the 6060, using a large number
of registers over a number of MDIO addresses. Or they can use two
registers at a configurable MDIO address, with these two registers
being Operation and Data. You access all the real switch registers
indirectly. Probing such a setup could be destructive, you need to
perform writes to register address 0 and 1, which if it is a real phy,
not a switch, means writing to its control register and status
register. So i guess before doing this, we need to read phyid1 and
phyid2, and only do such a probe if we get 0xffff for both.

I guess we need to see how problematic this is, before we can modify
all the drivers to probe like this. I do have hardware using this
indirect mode, so i can do some testing.

    Andrew

  reply	other threads:[~2015-04-30 12:50 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-30  1:57 [RFC PATCH net-next 0/8] net: dsa: New registration API Florian Fainelli
2015-04-30  1:57 ` [RFC PATCH net-next 1/8] net: dsa: Move dsa_switch_tree final setup in separate function Florian Fainelli
2015-05-04  2:01   ` David Miller
2015-04-30  1:57 ` [RFC PATCH net-next 2/8] net: phy: Check fixup lists in get_phy_device() Florian Fainelli
2015-05-04  2:02   ` David Miller
2015-04-30  1:57 ` [RFC PATCH net-next 3/8] net: phy: Allow PHY devices to identify themselves as Ethernet switches Florian Fainelli
2015-04-30 12:56   ` Andrew Lunn
2015-04-30 16:39     ` Florian Fainelli
2015-04-30 17:16       ` Andrew Lunn
2015-04-30 17:37         ` Florian Fainelli
2015-04-30 17:48           ` Andrew Lunn
2015-04-30 18:04             ` Florian Fainelli
2015-04-30 18:19               ` Andrew Lunn
2015-04-30  1:57 ` [RFC PATCH net-next 4/8] net: mv643xx_eth: Handle Ethernet switches as PHY devices Florian Fainelli
2015-05-04  2:06   ` David Miller
2015-04-30  1:57 ` [RFC PATCH net-next 5/8] net: dsa: add new API to register switch devices Florian Fainelli
2015-05-04  2:09   ` David Miller
2015-04-30  1:57 ` [RFC PATCH net-next 6/8] net: dsa: bcm_sf2: make it a real platform driver Florian Fainelli
2015-04-30  1:57 ` [RFC PATCH net-next 7/8] net: dsa: mv88e6060: make it a proper PHY driver Florian Fainelli
2015-04-30 12:46   ` Andrew Lunn [this message]
2015-04-30 13:49   ` Guenter Roeck
2015-04-30 16:46     ` Florian Fainelli
2015-04-30 17:02       ` Andrew Lunn
2015-04-30 17:13         ` Florian Fainelli
2015-05-01  2:28       ` Guenter Roeck
2015-05-01  6:41         ` Florian Fainelli
2015-04-30  1:57 ` [RFC PATCH net-next 8/8] net: dsa: mv88e6xxx: Allow them to be proper PHY drivers Florian Fainelli
2015-04-30 13:12 ` [RFC PATCH net-next 0/8] net: dsa: New registration API Andrew Lunn
2015-04-30 16:50   ` Florian Fainelli
2015-04-30 17:27     ` Andrew Lunn
2015-04-30 17:50       ` Florian Fainelli
2015-04-30 18:14         ` Andrew Lunn

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=20150430124601.GA22831@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=Chris.Packham@alliedtelesis.co.nz \
    --cc=andrey.volkov@nexvision.fr \
    --cc=cphealy@gmail.com \
    --cc=dave@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=jerome.oufella@savoirfairelinux.com \
    --cc=jonasj76@gmail.com \
    --cc=linux@roeck-us.net \
    --cc=mathieu@codeaurora.org \
    --cc=netdev@vger.kernel.org \
    --cc=vivien.didelot@savoirfairelinux.com \
    /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.