[PATCH][3/4] b44: Add support for PHY-less cards

Florian Schirmer
2004-08-29T20:42:44Z

[-- 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 --]