[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210412143913.qhlge7koggjswyjg@pali>
Date: Mon, 12 Apr 2021 16:39:13 +0200
From: Pali Rohár <pali@...nel.org>
To: Andrew Lunn <andrew@...n.ch>
Cc: Vivien Didelot <vivien.didelot@...il.com>,
Florian Fainelli <f.fainelli@...il.com>,
Vladimir Oltean <olteanv@...il.com>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Marek Behún <kabel@...nel.org>,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] net: phy: marvell: fix detection of PHY on Topaz switches
On Monday 12 April 2021 16:30:03 Andrew Lunn wrote:
> > > > +/* This table contains representative model for every family */
> > > > +static const enum mv88e6xxx_model family_model_table[] = {
> > > > + [MV88E6XXX_FAMILY_6095] = MV88E6095,
> > > > + [MV88E6XXX_FAMILY_6097] = MV88E6097,
> > > > + [MV88E6XXX_FAMILY_6185] = MV88E6185,
> > > > + [MV88E6XXX_FAMILY_6250] = MV88E6250,
> > > > + [MV88E6XXX_FAMILY_6320] = MV88E6320,
> > > > + [MV88E6XXX_FAMILY_6341] = MV88E6341,
> > > > + [MV88E6XXX_FAMILY_6351] = MV88E6351,
> > > > + [MV88E6XXX_FAMILY_6352] = MV88E6352,
> > > > + [MV88E6XXX_FAMILY_6390] = MV88E6390,
> > > > +};
> > >
> > > This table is wrong. MV88E6390 does not equal
> > > MV88E6XXX_PORT_SWITCH_ID_PROD_6390. MV88E6XXX_PORT_SWITCH_ID_PROD_6390
> > > was chosen because it is already an MDIO device ID, in register 2 and
> > > 3. It probably will never clash with a real Marvell PHY ID. MV88E6390
> > > is just a small integer, and there is a danger it will clash with a
> > > real PHY.
> >
> > So... how to solve this issue? What should be in the mapping table?
>
> You need to use MV88E6XXX_PORT_SWITCH_ID_PROD_6095,
> MV88E6XXX_PORT_SWITCH_ID_PROD_6097,
> ...
> MV88E6XXX_PORT_SWITCH_ID_PROD_6390,
But I'm using it.
First chip->info->family (enum mv88e6xxx_family; MV88E6XXX_FAMILY_6341)
is mapped to enum mv88e6xxx_model (MV88E6341) via family_model_table[]
and then enum mv88e6xxx_model (MV88E6341) is mapped to prod_num
(MV88E6XXX_PORT_SWITCH_ID_PROD_6341) via mv88e6xxx_table[].
All this is done in mv88e6xxx_physid_for_family() function.
So at the end, this function converts MV88E6XXX_FAMILY_6341 to
MV88E6XXX_PORT_SWITCH_ID_PROD_6341.
And therefore I do not see anything wrong in family_model_table[] table.
I defined family_model_table[] table to just maps enum mv88e6xxx_family
to enum mv88e6xxx_model as mv88e6xxx_table[] table already contains
mapping from enum mv88e6xxx_model to phys_id, to simplify
implementation.
Powered by blists - more mailing lists