All of lore.kernel.org
 help / color / mirror / Atom feed
From: Carlo Caione <ccaione@baylibre.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v4 3/3] cmd: mdio: Add new parameter to access MMD PHY registers
Date: Fri, 25 Jan 2019 10:12:17 +0000	[thread overview]
Message-ID: <867bd6cc-7e78-d0d3-f399-e4ada8ff45c9@baylibre.com> (raw)
In-Reply-To: <DB7PR04MB5163B63C70B0F02A688F1CEDE09A0@DB7PR04MB5163.eurprd04.prod.outlook.com>

On 24/01/2019 20:48, Vladimir Oltean wrote:
> On 1/24/19 10:19 PM, Carlo Caione wrote:
>> On 24/01/2019 20:12, Vladimir Oltean wrote:
>>>
> 
> I can't completely answer that, TBH I don't even know who is supposed to
> make that distinction.

In the kernel that distinction is made by the driver itself, hence my 
question. See [0].

> For Freescale parts that is a call for the MDIO bus driver to make, for
> good or bad (see drivers/net/fm/memac_phy.c where dev_addr is compared
> to MDIO_DEVAD_NONE).

> And in your patch, phy_write_mmd is only a wrapper over bus->write in
> the end, with some more logic to handle C22 indirection.
> So my question of unifying "mdio rmmd" with "mdio read" translates into:

> Does it make sense to also handle the check with MDIO_DEVAD_NONE in
> phy_write_mmd, instead of jumping straight ahead to perform indirection?

Honestly I'm not quite sure of all the possible implications here IMO 
the safest bet here is just to follow what's done by the kernel. Maybe 
Joe can step in about this.

In general we have 3 possible cases:

1) your driver is doing something non-standard when accessing the MMDs 
and we deal with that using the PHY driver hooks
2) your PHY is C22 and you have to use the indirect method
3) your PHY is C45 and you can use the direct register reading (mangling 
a bit the address apparently)

The kernel is dealing with all the cases, U-Boot is only dealing with 
C22 PHYs (cases 1 and 2) because AFAICT there isn't yet a generic way to 
detect if the PHY is C22 or C45.

I'm not sure if the indirect method works also for C45 PHYs.

> The goal would then be to just call phy_write_mmd from cmd/mdio.c
> regardless of the target PHY's clause.

Again I wrote that patch only assuming that we were going to deal with 
C22 PHYs. At this point I wonder if the C22 indirect method works also 
for C45 PHYs. If that's the case than the phy_write_mmd should already 
work regardless of the target PHY clause.

Cheers.

[0] 
https://elixir.bootlin.com/linux/latest/source/drivers/net/phy/phy-core.c#L296

  reply	other threads:[~2019-01-25 10:12 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-24  8:55 [U-Boot] [PATCH v4 0/3] Add MMD PHY helpers Carlo Caione
2019-01-24  8:55 ` [U-Boot] [PATCH v4 1/3] net: phy: Add support for accessing MMD PHY registers Carlo Caione
2019-01-24  8:55 ` [U-Boot] [PATCH v4 2/3] net: phy: ti: use generic helpers to access MMD registers Carlo Caione
2019-01-24  8:56 ` [U-Boot] [PATCH v4 3/3] cmd: mdio: Add new parameter to access MMD PHY registers Carlo Caione
2019-01-24 19:56   ` Vladimir Oltean
2019-01-24 20:01     ` Carlo Caione
2019-01-24 20:04       ` Vladimir Oltean
2019-01-24 20:08         ` Carlo Caione
2019-01-24 20:12           ` Vladimir Oltean
2019-01-24 20:19             ` Carlo Caione
2019-01-24 20:48               ` Vladimir Oltean
2019-01-25 10:12                 ` Carlo Caione [this message]
2019-01-25 13:11                   ` Vladimir Oltean
2019-02-04 22:48                     ` Joe Hershberger
2019-02-04 23:38                       ` Vladimir Oltean
2019-02-05  0:20                         ` Joe Hershberger
2019-02-05 15:20                           ` Carlo Caione
2019-02-05 22:10                             ` Joe Hershberger
2019-02-06  1:36                               ` Vladimir Oltean
2019-02-06  3:38                                 ` Joe Hershberger
2019-02-06  9:35                                   ` Carlo Caione
2019-02-07  0:10                                     ` Vladimir Oltean

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=867bd6cc-7e78-d0d3-f399-e4ada8ff45c9@baylibre.com \
    --to=ccaione@baylibre.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.