netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Schirmer <jolt@tuxbox.org>
To: Pekka Pietikainen <pp@ee.oulu.fi>
Cc: jgarzik@pobox.com, linux-kernel@vger.kernel.org, netdev@oss.sgi.com
Subject: [PATCH][3/4] b44: Add support for PHY-less cards
Date: Sun, 29 Aug 2004 22:36:47 +0200	[thread overview]
Message-ID: <200408292236.49864.jolt@tuxbox.org> (raw)
In-Reply-To: <200408292218.00756.jolt@tuxbox.org>

[-- Attachment #1: Type: text/plain, Size: 2434 bytes --]

Hi,

add support for PHY-less cards by using a special magic PHY address. This is compatible with the way Broadcom drivers handle that. We don't have to waste a flags bit for that.

Regards,
   Florian

Signed-off-by: Florian Schirmer <jolt@tuxbox.org>

--- linux/drivers/net/b44.c-old3 2004-08-29 16:59:24.000000000 +0200
+++ linux/drivers/net/b44.c 2004-08-29 17:24:23.000000000 +0200
@@ -273,6 +273,9 @@ static int b44_readphy(struct b44 *bp, i
 {
  int err;
 
+ if (bp->phy_addr == B44_PHY_ADDR_NO_PHY)
+  return 0;
+
  bw32(B44_EMAC_ISTAT, EMAC_INT_MII);
  bw32(B44_MDIO_DATA, (MDIO_DATA_SB_START |
         (MDIO_OP_READ << MDIO_DATA_OP_SHIFT) |
@@ -287,6 +290,9 @@ static int b44_readphy(struct b44 *bp, i
 
 static int b44_writephy(struct b44 *bp, int reg, u32 val)
 {
+ if (bp->phy_addr == B44_PHY_ADDR_NO_PHY)
+  return 0;
+
  bw32(B44_EMAC_ISTAT, EMAC_INT_MII);
  bw32(B44_MDIO_DATA, (MDIO_DATA_SB_START |
         (MDIO_OP_WRITE << MDIO_DATA_OP_SHIFT) |
@@ -325,6 +331,9 @@ static int b44_phy_reset(struct b44 *bp)
  u32 val;
  int err;
 
+ if (bp->phy_addr == B44_PHY_ADDR_NO_PHY)
+  return 0;
+
  err = b44_writephy(bp, MII_BMCR, BMCR_RESET);
  if (err)
   return err;
@@ -395,6 +404,9 @@ static int b44_setup_phy(struct b44 *bp)
  u32 val;
  int err;
 
+ if (bp->phy_addr == B44_PHY_ADDR_NO_PHY)
+  return 0;
+
  if ((err = b44_readphy(bp, B44_MII_ALEDCTRL, &val)) != 0)
   goto out;
  if ((err = b44_writephy(bp, B44_MII_ALEDCTRL,
@@ -487,6 +499,19 @@ static void b44_check_phy(struct b44 *bp
 {
  u32 bmsr, aux;
 
+ if (bp->phy_addr == B44_PHY_ADDR_NO_PHY) {
+  bp->flags |= B44_FLAG_100_BASE_T;
+  bp->flags |= B44_FLAG_FULL_DUPLEX;
+  if (!netif_carrier_ok(bp->dev)) {
+   u32 val = br32(B44_TX_CTRL);
+   val |= TX_CTRL_DUPLEX;
+   bw32(B44_TX_CTRL, val);
+   netif_carrier_on(bp->dev);
+   b44_link_report(bp);
+  }
+  return;
+ }
+
  if (!b44_readphy(bp, MII_BMSR, &bmsr) &&
      !b44_readphy(bp, B44_MII_AUXCTRL, &aux) &&
      (bmsr != 0xffff)) {
--- linux/drivers/net/b44.h-old3 2004-08-29 17:06:44.000000000 +0200
+++ linux/drivers/net/b44.h 2004-08-29 17:24:53.000000000 +0200
@@ -362,6 +362,7 @@ struct ring_info {
 };
 
 #define B44_MCAST_TABLE_SIZE 32
+#define B44_PHY_ADDR_NO_PHY 30
 
 /* SW copy of device statistics, kept up to date by periodic timer
  * which probes HW values.  Must have same relative layout as HW


[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

  parent reply	other threads:[~2004-08-29 20:36 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-29 20:17 [PATCH][0/4] b44: Cleanup and bcm47xx support Florian Schirmer
2004-08-29 20:33 ` [PATCH][1/4] b44: Ignore carrier lost errors Florian Schirmer
2004-08-29 20:49   ` Jeff Garzik
2004-08-29 21:04     ` Florian Schirmer
2004-08-29 23:45       ` David S. Miller
2004-08-29 23:49         ` Jeff Garzik
2004-08-30  6:10           ` Pekka Pietikainen
2004-08-30  7:04             ` Florian Schirmer
2004-09-17 16:00             ` Jeff Garzik
2004-09-17 16:00         ` Jeff Garzik
2004-09-17 16:02       ` Jeff Garzik
2004-09-17 15:54   ` Jeff Garzik
2004-08-29 20:34 ` [PATCH][2/4] b44: Cleanup SiliconBackplane definitions/functions Florian Schirmer
2004-09-17 15:55   ` Jeff Garzik
2004-08-29 20:36 ` Florian Schirmer [this message]
2004-08-29 20:39 ` [PATCH][4/4] b44: Add bcm47xx support Florian Schirmer
2004-09-13 23:30 ` [PATCH] Fix for b44 warnings Stephen Hemminger
2004-09-13 23:33   ` David S. Miller

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=200408292236.49864.jolt@tuxbox.org \
    --to=jolt@tuxbox.org \
    --cc=jgarzik@pobox.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@oss.sgi.com \
    --cc=pp@ee.oulu.fi \
    /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).