From: Patrick McHardy <kaber@trash.net>
To: Anders Darander <anders.darander@gmail.com>
Cc: Haavard Skinnemoen <hskinnemoen@atmel.com>,
"David S. Miller" <davem@davemloft.net>,
Jiri Pirko <jpirko@redhat.com>,
Erik Waling <erik.waling@konftel.com>,
Anders Darander <ad@datarespons.se>,
Grant Likely <grant.likely@secretlab.ca>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] MACB: Set PHY address in kernel parameters
Date: Wed, 31 Mar 2010 10:28:58 +0200 [thread overview]
Message-ID: <4BB307CA.9080305@trash.net> (raw)
In-Reply-To: <1270021902-6556-1-git-send-email-anders.darander@gmail.com>
Anders Darander wrote:
> From: Anders Darander <ad@datarespons.se>
>
> Add the possibility to set the phy address. This is needed if an integrated
> switch is connected to the MAC, as it is often the case that the highest port
> is the one connected to the MAC of the MCU.
>
> E.g. in the case of the Micrel KSZ8873, port 3 is the one to connect to the
> MCU, thus, the MAC needs to connect to phy address 0x03, instead of the first
> phy found.
>
> Signed-off-by: Anders Darander <ad@datarespons.se>
> ---
> drivers/net/macb.c | 14 +++++++++++++-
> 1 files changed, 13 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/net/macb.c b/drivers/net/macb.c
> index c8a18a6..9b4e301 100644
> --- a/drivers/net/macb.c
> +++ b/drivers/net/macb.c
> @@ -53,6 +53,14 @@
> #define MACB_RX_INT_FLAGS (MACB_BIT(RCOMP) | MACB_BIT(RXUBR) \
> | MACB_BIT(ISR_ROVR))
>
> +/*
> + * Setup PHY probeing
> + */
> +
> +static int phy_addr = PHY_MAX_ADDR;
> +module_param(phy_addr, ushort, 0);
> +MODULE_PARAM_DESC(phy_addr, "PHY address connected to the MACB");
> +
> static void __macb_set_hwaddr(struct macb *bp)
> {
> u32 bottom;
> @@ -193,7 +201,11 @@ static int macb_mii_probe(struct net_device *dev)
> struct eth_platform_data *pdata;
> int ret;
>
> - phydev = phy_find_first(bp->mii_bus);
> + if (phy_addr >= PHY_MAX_ADDRESS)
> + phydev = phy_find_first(bp->mii_bus);
> + else
> + phydev = bp->mii_bus->phy_map[phy_addr];
This looks like you need to use an unsigned to avoid negative
indices.
next prev parent reply other threads:[~2010-03-31 8:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-31 7:51 [PATCH] MACB: Set PHY address in kernel parameters Anders Darander
2010-03-31 8:28 ` Patrick McHardy [this message]
2010-03-31 8:50 ` Anders Darander
2010-03-31 10:03 ` Jiri Pirko
2010-03-31 10:11 ` Anders Darander
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=4BB307CA.9080305@trash.net \
--to=kaber@trash.net \
--cc=ad@datarespons.se \
--cc=anders.darander@gmail.com \
--cc=davem@davemloft.net \
--cc=erik.waling@konftel.com \
--cc=grant.likely@secretlab.ca \
--cc=hskinnemoen@atmel.com \
--cc=jpirko@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/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).