netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Heiner Kallweit <hkallweit1@gmail.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	"Florian Fainelli" <f.fainelli@gmail.com>,
	"Yuiko Oshino" <yuiko.oshino@microchip.com>,
	netdev@vger.kernel.org, kernel@pengutronix.de
Subject: Re: net: micrel: confusion about phyids used in driver
Date: Sat, 11 May 2019 16:00:15 +0200	[thread overview]
Message-ID: <966ad23c-33c2-fffb-6aad-f0e3e6a6ffb4@gmail.com> (raw)
In-Reply-To: <20190509210745.GD11588@lunn.ch>

On 09.05.2019 23:07, Andrew Lunn wrote:
> On Thu, May 09, 2019 at 10:55:29PM +0200, Heiner Kallweit wrote:
>> On 09.05.2019 22:29, Uwe Kleine-König wrote:
>>> Hello,
>>>
>>> I have a board here that has a KSZ8051MLL (datasheet:
>>> http://ww1.microchip.com/downloads/en/DeviceDoc/ksz8051mll.pdf, phyid:
>>> 0x0022155x) assembled. The actual phyid is 0x00221556.
>>>
>> I think the datasheets are the source of the confusion. If the
>> datasheets for different chips list 0x0022155x as PHYID each, and
>> authors of support for additional chips don't check the existing code,
>> then happens what happened.
>> However it's not a rare exception and not Microchip-specific that
>> sometimes vendors use the same PHYID for different chips.
>>
>> And it seems you even missed one: KSZ8795
>> It's a switch and the internal PHY's have id 0x00221550.
>>
>> If the drivers for the respective chips are actually different then we
>> may change the driver to match the exact model number only.
>> However, if there should be a PHY with e.g. id 0x00221554 out there,
>> it wouldn't be supported any longer and the generic PHY driver would
>> be used (what may work or not).
> 
> Hi Heiner
> 
> We might also want to take a look at the code which matches a driver
> to a PHY ID. Ideally we want the most specific match when looking at
> the mask. We can then have device specific matches, and then a more
> general fallback match using a wider mask.
> 
The matching code is the generic driver/device matching code.
As Uwe pointed out before, we can influence the probe order only
by ordering the drivers accordingly and hoping that the core
keeps to the order of registration when probing.

But this still wouldn't solve the issue as there are PHY's with the
same PHYID having registers that need to be treated differently.
When searching the internet a little bit one easily finds old questions
regarding how to tell between KSZ8031 and KSZ8051.

I'm not a fan of workarounds like having one driver and hoping that
writing to a reserved bit on one chip doesn't hurt. You never know
whether this register/bit has an undocumented function.

If these PHY's are primarily used on DT-configured boards, then we
may consider to add DT properties for the features that differ.

> No idea how to actually implement that :-(
> 
>    Andrew
> 
Heiner

      parent reply	other threads:[~2019-05-11 14:00 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-09 20:29 net: micrel: confusion about phyids used in driver Uwe Kleine-König
2019-05-09 20:55 ` Heiner Kallweit
2019-05-09 21:07   ` Andrew Lunn
2019-05-10  7:22     ` Uwe Kleine-König
2019-07-02 20:31       ` Uwe Kleine-König
2019-07-02 20:55         ` Yuiko.Oshino
2019-08-08  8:36           ` Uwe Kleine-König
2019-08-20 20:25             ` Uwe Kleine-König
2019-08-20 20:30               ` Heiner Kallweit
2019-08-21 17:24               ` Florian Fainelli
2019-08-21 18:49                 ` allan.nielsen
2019-08-21 19:53                   ` Woojung.Huh
2019-10-16  9:09                     ` Uwe Kleine-König
2019-10-16 11:45                       ` Yuiko.Oshino
2019-05-11 14:00     ` Heiner Kallweit [this message]

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=966ad23c-33c2-fffb-6aad-f0e3e6a6ffb4@gmail.com \
    --to=hkallweit1@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=f.fainelli@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=netdev@vger.kernel.org \
    --cc=u.kleine-koenig@pengutronix.de \
    --cc=yuiko.oshino@microchip.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).