Re: [PATCH] Allow MACB to connect to a higher addresses PHY.

From: Anders Darander
Date: Wed Mar 31 2010 - 02:03:57 EST


Hi Grant,

Thanks for the feedback!

* Grant Likely <grant.likely@xxxxxxxxxxxx> [100330 16:42]:
> On Tue, Mar 30, 2010 at 3:58 AM, Anders Darander
> <anders.darander@xxxxxxxxx> wrote:
> > Using the Atmel MACB together with an integrated switch, can make only port 1
> > work. This is caused by macb_mii_probe trying to attach the MAC to the first
> > PHY, which often is on one of the external ports.
> >
> > E.g. the Micrel KSZ8873 connects to the MAC on port 3, thus phy_addr should be
> > set to 3.

> I understand what you are trying to do, but this is the wrong way to
> go about it. Hard coding it into Kconfig breaks multiplatform
> kernels. Besides, systems may have more than one physical MDIO bus.
> This patch would make CONFIG_SWITCHING_PHY_ADDR the only address
> accessible on all MDIO busses.

True, it would at least make all addresses < CONFIG_SWITCHING_PHY_ADDR
non-accessible.

We developed the patch to solve this problem on a 2.6.29-kernel, in
which the loop in question is directly in the macb_mii_probe() in the
macb.c, thus, the original patch is at least a _little_ bit less ugly...

> Nak.

I fully agree on the nak; I completely forgot that the functions in
phy_devices should be used from more interfaces than only the macb.

> The right thing to do is to add a runtime configuration option (ie.
> kernel parameter or platform data) to the mac driver to specify
> exactly which PHY address it is supposed to use.

I'll see if I can get some time to do such a thing. Unfortunately, it'll
probably have to be dealt with on my sparetime (the customer is quite
unlikely to let me work on that).

One question, if I add such an kernel parameter, would it be OK to
implement something like this in the macb-driver:

if parameter == SOME_DEFAULT
phydev = phy_find_first(bp->mii_bus);
else
phydev = bp->mii_bus->phy_map[parameter];

I.e. if the parameter is set to some default value, the old behaviour is
retained, otherwise the specified parameter is used for the phy_addr?

I'd appreciate your input on such a design.

Best regards,
Anders Darander

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/