From: "Andrew Isaacson" <adi@broadcom.com>
To: linux-mips@linux-mips.org
Subject: [PATCH 9/12] sbmac-fixes
Date: Wed, 19 Oct 2005 23:58:26 -0700 [thread overview]
Message-ID: <20051020065826.GI23899@broadcom.com> (raw)
In-Reply-To: <20051020065320.GA23857@broadcom.com>
Improve sb1250-mac driver to probe for PHYs at addresses other
than 1, such as the PHYs on BigSur.
Signed-Off-By: Andy Isaacson <adi@broadcom.com>
drivers/net/sb1250-mac.c | 36 ++++++++++++++++++++++++++++++++++++
1 files changed, 36 insertions(+)
Index: lmo/drivers/net/sb1250-mac.c
===================================================================
--- lmo.orig/drivers/net/sb1250-mac.c 2005-10-19 22:34:12.000000000 -0700
+++ lmo/drivers/net/sb1250-mac.c 2005-10-19 22:34:12.000000000 -0700
@@ -314,6 +314,7 @@
static int sbmac_mii_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
static int sbmac_close(struct net_device *dev);
static int sbmac_mii_poll(struct sbmac_softc *s,int noisy);
+static int sbmac_mii_probe(struct net_device *dev);
static void sbmac_mii_sync(struct sbmac_softc *s);
static void sbmac_mii_senddata(struct sbmac_softc *s,unsigned int data, int bitcnt);
@@ -451,6 +452,9 @@
#define MII_BMCR 0x00 /* Basic mode control register (rw) */
#define MII_BMSR 0x01 /* Basic mode status register (ro) */
+#define MII_PHYIDR1 0x02
+#define MII_PHYIDR2 0x03
+
#define MII_K1STSR 0x0A /* 1K Status Register (ro) */
#define MII_ANLPAR 0x05 /* Autonegotiation lnk partner abilities (rw) */
@@ -2460,6 +2464,15 @@
return -EBUSY;
/*
+ * Probe phy address
+ */
+
+ if(sbmac_mii_probe(dev) == -1) {
+ printk("%s: failed to probe PHY.\n", dev->name);
+ return -EINVAL;
+ }
+
+ /*
* Configure default speed
*/
@@ -2492,6 +2505,29 @@
return 0;
}
+static int sbmac_mii_probe(struct net_device *dev)
+{
+ int i;
+ struct sbmac_softc *s = netdev_priv(dev);
+ u16 bmsr, id1, id2;
+ u32 vendor, device;
+
+ for (i=1; i<31; i++) {
+ bmsr = sbmac_mii_read(s, i, MII_BMSR);
+ if (bmsr != 0) {
+ s->sbm_phys[0] = i;
+ id1 = sbmac_mii_read(s, i, MII_PHYIDR1);
+ id2 = sbmac_mii_read(s, i, MII_PHYIDR2);
+ vendor = ((u32)id1 << 6) | ((id2 >> 10) & 0x3f);
+ device = (id2 >> 4) & 0x3f;
+
+ printk(KERN_INFO "%s: found phy %d, vendor %06x part %02x\n",
+ dev->name, i, vendor, device);
+ return i;
+ }
+ }
+ return -1;
+}
static int sbmac_mii_poll(struct sbmac_softc *s,int noisy)
next prev parent reply other threads:[~2005-10-20 7:03 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-10-20 6:53 [PATCH 0/12] bcm1480 support Andrew Isaacson
2005-10-20 6:54 ` [PATCH 1/12] sibyte-fixes Andrew Isaacson
2005-10-20 6:55 ` [PATCH 2/12] 1480-headers Andrew Isaacson
2005-10-20 6:55 ` [PATCH 3/12] sibyte-header-cleanup Andrew Isaacson
2005-10-20 6:56 ` [PATCH 4/12] sb1a-support Andrew Isaacson
2005-10-20 6:56 ` [PATCH 5/12] 1480-support Andrew Isaacson
2005-10-20 6:57 ` [PATCH 6/12] bigsur-support Andrew Isaacson
2005-10-20 6:57 ` [PATCH 7/12] sb1-cache-exc-handling Andrew Isaacson
2005-10-20 6:57 ` [PATCH 8/12] cerr-printk-not-prom-printf Andrew Isaacson
2005-10-20 10:49 ` Ralf Baechle
2005-10-20 11:02 ` Dominic Sweetman
2005-10-20 11:17 ` Ralf Baechle
2005-10-20 6:58 ` Andrew Isaacson [this message]
2005-10-20 6:58 ` [PATCH 10/12] 1480-pci-support Andrew Isaacson
2005-10-20 6:59 ` [PATCH 11/12] 1480-ht-support Andrew Isaacson
2005-10-20 6:59 ` [PATCH 12/12] pci-expmem-hack Andrew Isaacson
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=20051020065826.GI23899@broadcom.com \
--to=adi@broadcom.com \
--cc=linux-mips@linux-mips.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