All of lore.kernel.org
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: Quentin Schulz <quentin.schulz@bootlin.com>,
	alexandre.belloni@bootlin.com, ralf@linux-mips.org,
	paul.burton@mips.com, jhogan@kernel.org, robh+dt@kernel.org,
	mark.rutland@arm.com, davem@davemloft.net, andrew@lunn.ch
Cc: allan.nielsen@microchip.com, linux-mips@linux-mips.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	netdev@vger.kernel.org, thomas.petazzoni@bootlin.com,
	antoine.tenart@bootlin.com
Subject: Re: [PATCH net-next 4/7] net: phy: mscc: add support for VSC8574 PHY
Date: Fri, 14 Sep 2018 13:26:06 -0700	[thread overview]
Message-ID: <bc95fae7-cf2f-5cf1-4e24-59fcc231fd64@gmail.com> (raw)
In-Reply-To: <236ef7815c0bec6048e79ef06868719b65c63892.1536916714.git-series.quentin.schulz@bootlin.com>

On 09/14/2018 02:44 AM, Quentin Schulz wrote:
> The VSC8574 PHY is a 4-ports PHY that is 10/100/1000BASE-T, 100BASE-FX,
> 1000BASE-X and triple-speed copper SFP capable, can communicate with
> the MAC via SGMII, QSGMII or 1000BASE-X, supports WOL, downshifting and
> can set the blinking pattern of each of its 4 LEDs, supports SyncE as
> well as HP Auto-MDIX detection.
> 
> This adds support for 10/100/1000BASE-T, SGMII/QSGMII link with the MAC,
> WOL, downshifting, HP Auto-MDIX detection and blinking pattern for its 4
> LEDs.
> 
> The VSC8574 has also an internal Intel 8051 microcontroller whose
> firmware needs to be patched when the PHY is reset. If the 8051's
> firmware has the expected CRC, its patching can be skipped. The
> microcontroller can be accessed from any port of the PHY, though the CRC
> function can only be done through the PHY that is the base PHY of the
> package (internal address 0) due to a limitation of the firmware.
> 
> The GPIO register bank is a set of registers that are common to all PHYs
> in the package. So any modification in any register of this bank affects
> all PHYs of the package.
> 
> If the PHYs haven't been reset before booting the Linux kernel and were
> configured to use interrupts for e.g. link status updates, it is
> required to clear the interrupts mask register of all PHYs before being
> able to use interrupts with any PHY. The first PHY of the package that
> will be init will take care of clearing all PHYs interrupts mask
> registers. Thus, we need to keep track of the init sequence in the
> package, if it's already been done or if it's to be done.
> 
> Most of the init sequence of a PHY of the package is common to all PHYs
> in the package, thus we use the SMI broadcast feature which enables us
> to propagate a write in one register of one PHY to all PHYs in the
> package.
> 
> Signed-off-by: Quentin Schulz <quentin.schulz@bootlin.com>
> ---

[snip]

> +	reg = __mdiobus_read(bus, phy, MSCC_PHY_TEST_PAGE_8);
> +	reg |= 0x8000;

Having a define would be nice here? This looks like a write enable?

> +	__mdiobus_write(bus, phy, MSCC_PHY_TEST_PAGE_8, reg);
> +
> +	__mdiobus_write(bus, phy, MSCC_EXT_PAGE_ACCESS, MSCC_PHY_PAGE_TR);
> +
> +	vsc8584_csr_write(bus, phy, 0x8fae, 0x000401bd);

Just make this an array of address + value pairs and blast it to the
PHY, having them be inlined here is both error prone and does not scale
well at all.
[snip]
> +	vsc8584_csr_write(bus, phy, 0x84a8, 0x00000000);
> +	vsc8584_csr_write(bus, phy, 0x84aa, 0x00000000);
> +	vsc8584_csr_write(bus, phy, 0x84ae, 0x007df7dd);
> +	vsc8584_csr_write(bus, phy, 0x84b0, 0x006d95d4);
> +	vsc8584_csr_write(bus, phy, 0x84b2, 0x00492410);

Likewise

[snip]
-- 
Florian

  reply	other threads:[~2018-09-14 20:26 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-14  9:44 [PATCH net-next 0/7] add support for VSC8584 and VSC8574 Microsemi quad-port PHYs Quentin Schulz
2018-09-14  9:44 ` [PATCH net-next 1/7] dt-bindings: net: vsc8531: add two additional LED modes for VSC8584 Quentin Schulz
2018-09-14 13:11   ` Andrew Lunn
2018-09-15 21:34   ` Florian Fainelli
2018-09-17  5:45   ` Rob Herring
2018-09-17  5:45     ` Rob Herring
2018-09-14  9:44 ` [PATCH net-next 2/7] net: phy: mscc: add support for VSC8584 PHY Quentin Schulz
2018-09-14 13:18   ` Andrew Lunn
2018-09-14 13:29     ` Quentin Schulz
2018-09-14 16:28       ` Quentin Schulz
2018-09-14 16:58         ` Andrew Lunn
2018-10-01  9:16           ` Quentin Schulz
2018-09-14 17:27   ` Andrew Lunn
2018-10-01  9:15     ` Quentin Schulz
2018-09-14  9:44 ` [PATCH net-next 3/7] net: phy: mscc: split config_init in two functions for VSC8584 Quentin Schulz
2018-09-14 17:57   ` Florian Fainelli
2018-10-01  9:07     ` Quentin Schulz
2018-09-14  9:44 ` [PATCH net-next 4/7] net: phy: mscc: add support for VSC8574 PHY Quentin Schulz
2018-09-14 20:26   ` Florian Fainelli [this message]
2018-10-04  9:45     ` Quentin Schulz
2018-10-04 12:53     ` Quentin Schulz
2018-09-14  9:44 ` [PATCH 5/7] MIPS: mscc: ocelot: add GPIO4 pinmuxing DT node Quentin Schulz
2018-09-14 14:54   ` Alexandre Belloni
2018-09-14 16:26     ` Quentin Schulz
2018-09-14 17:02       ` Andrew Lunn
2018-10-01  9:01         ` Quentin Schulz
2018-09-14 18:02       ` Alexandre Belloni
2018-10-01  9:02         ` Quentin Schulz
2018-09-14  9:44 ` [PATCH 6/7] MIPS: mscc: add DT for Ocelot PCB120 Quentin Schulz
2018-09-14 14:58   ` Alexandre Belloni
2018-09-14  9:44 ` [PATCH 7/7] MIPS: mscc: add PCB120 to the ocelot fitImage Quentin Schulz
2018-09-14 15:00   ` Alexandre Belloni
2018-09-20 21:38 ` [PATCH net-next 0/7] add support for VSC8584 and VSC8574 Microsemi quad-port PHYs Linus Walleij
2018-10-11  6:18   ` Allan W. Nielsen
2018-10-11  7:55     ` Linus Walleij

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=bc95fae7-cf2f-5cf1-4e24-59fcc231fd64@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=allan.nielsen@microchip.com \
    --cc=andrew@lunn.ch \
    --cc=antoine.tenart@bootlin.com \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=jhogan@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=mark.rutland@arm.com \
    --cc=netdev@vger.kernel.org \
    --cc=paul.burton@mips.com \
    --cc=quentin.schulz@bootlin.com \
    --cc=ralf@linux-mips.org \
    --cc=robh+dt@kernel.org \
    --cc=thomas.petazzoni@bootlin.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.