From patchwork Wed Mar 31 08:46:58 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anders Darander X-Patchwork-Id: 49104 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 2838CB7C33 for ; Wed, 31 Mar 2010 19:47:47 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932897Ab0CaIrL (ORCPT ); Wed, 31 Mar 2010 04:47:11 -0400 Received: from mail-ew0-f220.google.com ([209.85.219.220]:42975 "EHLO mail-ew0-f220.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932843Ab0CaIrH (ORCPT ); Wed, 31 Mar 2010 04:47:07 -0400 Received: by ewy20 with SMTP id 20so1795177ewy.1 for ; Wed, 31 Mar 2010 01:47:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer; bh=SNAABMZ3yKki3sPFtXmfxwU6agn/UO4zCN338CeQSIs=; b=h8yaGj3nC9AiaDmVS3qnrTw70IX2CvCwpoU/UZqwAZFLbA4XKtyRG9paNegxkhtdhH a3jlZ9qVeUfgjMCN9XcUZEGrjn3IV/7U1a2uNrEcWXN5ZgwktNUxguQitO9g64EpijOC th67x2UX5DFNYdiETRT5Jj2sE1vOCeDv+or20= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=R2QYGi7nkpYOdeQQsqZtlp87I3/wGdjden6HpsZbmIYv1jhV3/2yxECaMAHmWEsvMQ wnJ2BZlBo0usRFuH//xUUbcoJ+xk7ua7r/PG9NK/BZRqtIsjBvBr52P9uKdX3QXJv7qG H5WMoCVG3KyZpn8wgIUsExuuBNXjjRHOoG8Nk= Received: by 10.213.42.73 with SMTP id r9mr1984975ebe.40.1270025226097; Wed, 31 Mar 2010 01:47:06 -0700 (PDT) Received: from localhost.localdomain (host-80-252-191-81-cust.phoneranetworks.se [80.252.191.81]) by mx.google.com with ESMTPS id 16sm3546887ewy.11.2010.03.31.01.47.05 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 31 Mar 2010 01:47:05 -0700 (PDT) From: Anders Darander To: Haavard Skinnemoen Cc: "David S. Miller" , Jiri Pirko , Erik Waling , Patrick McHardy , Anders Darander , Grant Likely , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH][V2] MACB: Set PHY address in kernel parameters Date: Wed, 31 Mar 2010 10:46:58 +0200 Message-Id: <1270025218-7245-1-git-send-email-anders.darander@gmail.com> X-Mailer: git-send-email 1.7.0.3 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Anders Darander 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 --- Changes from V1: * Made the variable type consistent with the module parameter declaration. (I.e. made it unsigned short). 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..af7b61b 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 unsigned short 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]; + if (!phydev) { printk (KERN_ERR "%s: no PHY found\n", dev->name); return -1;