[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190510072243.h6h3bgvr2ovsh5g5@pengutronix.de>
Date: Fri, 10 May 2019 09:22:43 +0200
From: Uwe Kleine-König
<u.kleine-koenig@...gutronix.de>
To: Andrew Lunn <andrew@...n.ch>
Cc: Heiner Kallweit <hkallweit1@...il.com>,
Florian Fainelli <f.fainelli@...il.com>,
Yuiko Oshino <yuiko.oshino@...rochip.com>,
netdev@...r.kernel.org, kernel@...gutronix.de
Subject: Re: net: micrel: confusion about phyids used in driver
On Thu, May 09, 2019 at 11:07:45PM +0200, 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:
> > > 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.
>From the vendor's POV it is even sensible to reuse the phy IDs iff the
chips are "compatible".
Assuming that the last nibble of the phy ID actually helps to
distinguish the different (not completely) compatible chips, we need
some more detailed information than available in the data sheets I have.
There is one person in the recipents of this mail with an @microchip.com
address (hint, hint!).
> > 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).
>
> 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.
>
> No idea how to actually implement that :-(
As this is not a detailed enough description to get a total order[1] we
either must tune the requirement or just rely on the order of
the drivers (as is). Then the more specific entries should be listed
first.
Alternatively if there is no way to distinguish different chips (where
the difference is important) the only possibility is to rely on
additional information that must be provided in a board-specific way.
(i2c is similar here. In the beginning they relied on the slave address,
but this wasn't good enough either.)
Best regards
Uwe
[1] Consider phyid = 0x12345678 and available mask/id pairs:
0xffffff0f/0x12345608
0xfffffff0/0x12345670
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Powered by blists - more mailing lists