From: linux@armlinux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 7/9] net: mvmdio: add xmdio xsmi support
Date: Mon, 12 Jun 2017 11:07:56 +0100 [thread overview]
Message-ID: <20170612100756.GZ4902@n2100.armlinux.org.uk> (raw)
In-Reply-To: <20170612095745.11300-8-antoine.tenart@free-electrons.com>
On Mon, Jun 12, 2017 at 11:57:43AM +0200, Antoine Tenart wrote:
> +static void orion_mdio_xsmi_start_read_op(struct orion_mdio_dev *dev,
> + int mii_id, int regnum)
> +{
> + u16 dev_addr = (regnum >> 16) & GENMASK(4, 0);
> +
> + writel(regnum & GENMASK(15, 0), dev->regs + MVMDIO_XSMI_ADDR_REG);
> + writel((mii_id << MVMDIO_XSMI_PHYADDR_SHIFT) |
> + (dev_addr << MVMDIO_XSMI_DEVADDR_SHIFT) |
> + MVMDIO_XSMI_READ_OPERATION,
> + dev->regs + MVMDIO_XSMI_MGNT_REG);
So what happens if this function gets passed a Clause 22 formatted
request? Both regnum and mii_id are in the range 0-31. MII_ADDR_C45
in regnum is clear.
The answer is we produce two Clause 45 frames on the bus, which is
certainly not correct. You need to trap and error out if MII_ADDR_C45
is not set (as I've already said previously.)
The SMI operations need to do the reverse - they need to fail if they
receive a regnum with MII_ADDR_C45 set, as they are unable to produce
Clause 45 frames.
> +static void orion_mdio_xsmi_write_op(struct orion_mdio_dev *dev, int mii_id,
> + int regnum, u16 value)
> +{
> + u16 dev_addr = (regnum >> 16) & GENMASK(4, 0);
> +
> + writel(regnum & GENMASK(15, 0), dev->regs + MVMDIO_XSMI_ADDR_REG);
> + writel((mii_id << MVMDIO_XSMI_PHYADDR_SHIFT) |
> + (dev_addr << MVMDIO_XSMI_DEVADDR_SHIFT) |
> + MVMDIO_XSMI_WRITE_OPERATION | value,
> + dev->regs + MVMDIO_XSMI_MGNT_REG);
It's even more important here, as a Clause 22 write will produce a
valid Clause 45 pair of frames with dev_addr = 0.
Again, the corresponding SMI code needs to reject Clause 45 requests
as the SMI interface is unable to produce Clause 45 frames.
--
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.
next prev parent reply other threads:[~2017-06-12 10:07 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-12 9:57 [PATCH v3 0/9] net: mvmdio: add xMDIO xSMI support Antoine Tenart
2017-06-12 9:57 ` [PATCH v3 1/9] net: mvmdio: reorder headers alphabetically Antoine Tenart
2017-06-12 9:57 ` [PATCH v3 2/9] net: mvmdio: use tabs for defines Antoine Tenart
2017-06-12 9:57 ` [PATCH v3 3/9] net: mvmdio: use GENMASK for masks Antoine Tenart
2017-06-12 9:57 ` [PATCH v3 4/9] net: mvmdio: move the read valid check into its own function Antoine Tenart
2017-06-12 9:57 ` [PATCH v3 5/9] net: mvmdio: introduce an ops structure Antoine Tenart
2017-06-12 9:57 ` [PATCH v3 6/9] net: mvmdio: put the poll intervals in the " Antoine Tenart
2017-06-12 9:57 ` [PATCH v3 7/9] net: mvmdio: add xmdio xsmi support Antoine Tenart
2017-06-12 10:07 ` Russell King - ARM Linux [this message]
2017-06-12 10:17 ` Russell King - ARM Linux
2017-06-12 10:41 ` Russell King - ARM Linux
2017-06-12 10:42 ` Russell King - ARM Linux
2017-06-12 10:42 ` Russell King - ARM Linux
2017-06-12 11:54 ` Antoine Tenart
2017-06-12 9:57 ` [PATCH v3 8/9] dt-bindings: orion-mdio: document the new xmdio compatible Antoine Tenart
2017-06-12 9:57 ` [PATCH v3 9/9] arm64: marvell: dts: add xmdio nodes for 7k/8k Antoine Tenart
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=20170612100756.GZ4902@n2100.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--cc=linux-arm-kernel@lists.infradead.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox