From: "Guo-Fu Tseng" <cooldavid@cooldavid.org>
To: Jeff Garzik <jgarzik@pobox.com>, David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org, Ethan <ethanhsiao@jmicron.com>,
akeemting <akeem@jmicron.com>
Subject: [PATCH net-2.6 1/2] jme: GHC register control fix for new hardware
Date: Wed, 3 Dec 2008 18:41:39 +0800 [thread overview]
Message-ID: <20081203103825.M4442@cooldavid.org> (raw)
In-Reply-To: <20081008215853.M53590@cooldavid.org>
Dear Jeff, David:
Due to the hardware design, except the first chip on the market,
other chips needs to setup the clock source for MAC processor
implicitly through Global Host Control Register(GHC).
(Strange design huh?)
10/100M uses the PCI-E as clock source, and 1G uses GPHY.
And I reordered the code a little, to make it easier to read.
Found-by: "Ethan" <ethanhsiao@jmicron.com>
Fixed-by: "akeemting" <akeem@jmicron.com>
Signed-off-by: "Guo-Fu Tseng" <cooldavid@cooldavid.org>
diff --git a/drivers/net/jme.c b/drivers/net/jme.c
index 665e70d..49090ba 100644
--- a/drivers/net/jme.c
+++ b/drivers/net/jme.c
@@ -435,15 +435,18 @@ jme_check_link(struct net_device *netdev, int testonly)
GHC_DPX);
switch (phylink & PHY_LINK_SPEED_MASK) {
case PHY_LINK_SPEED_10M:
- ghc |= GHC_SPEED_10M;
+ ghc |= GHC_SPEED_10M |
+ GHC_TO_CLK_PCIE | GHC_TXMAC_CLK_PCIE;
strcat(linkmsg, "10 Mbps, ");
break;
case PHY_LINK_SPEED_100M:
- ghc |= GHC_SPEED_100M;
+ ghc |= GHC_SPEED_100M |
+ GHC_TO_CLK_PCIE | GHC_TXMAC_CLK_PCIE;
strcat(linkmsg, "100 Mbps, ");
break;
case PHY_LINK_SPEED_1000M:
- ghc |= GHC_SPEED_1000M;
+ ghc |= GHC_SPEED_1000M |
+ GHC_TO_CLK_GPHY | GHC_TXMAC_CLK_GPHY;
strcat(linkmsg, "1000 Mbps, ");
break;
default:
@@ -463,14 +466,6 @@ jme_check_link(struct net_device *netdev, int testonly)
TXTRHD_TXREN |
((8 << TXTRHD_TXRL_SHIFT) & TXTRHD_TXRL));
}
- strcat(linkmsg, (phylink & PHY_LINK_DUPLEX) ?
- "Full-Duplex, " :
- "Half-Duplex, ");
-
- if (phylink & PHY_LINK_MDI_STAT)
- strcat(linkmsg, "MDI-X");
- else
- strcat(linkmsg, "MDI");
gpreg1 = GPREG1_DEFAULT;
if (is_buggy250(jme->pdev->device, jme->chiprev)) {
@@ -492,11 +487,17 @@ jme_check_link(struct net_device *netdev, int testonly)
break;
}
}
- jwrite32(jme, JME_GPREG1, gpreg1);
- jme->reg_ghc = ghc;
+ jwrite32(jme, JME_GPREG1, gpreg1);
jwrite32(jme, JME_GHC, ghc);
+ jme->reg_ghc = ghc;
+ strcat(linkmsg, (phylink & PHY_LINK_DUPLEX) ?
+ "Full-Duplex, " :
+ "Half-Duplex, ");
+ strcat(linkmsg, (phylink & PHY_LINK_MDI_STAT) ?
+ "MDI-X" :
+ "MDI");
msg_link(jme, "Link is up at %s.\n", linkmsg);
netif_carrier_on(netdev);
} else {
diff --git a/drivers/net/jme.h b/drivers/net/jme.h
index f863aee..adaf3dd 100644
--- a/drivers/net/jme.h
+++ b/drivers/net/jme.h
@@ -815,16 +815,30 @@ static inline u32 smi_phy_addr(int x)
* Global Host Control
*/
enum jme_ghc_bit_mask {
- GHC_SWRST = 0x40000000,
- GHC_DPX = 0x00000040,
- GHC_SPEED = 0x00000030,
- GHC_LINK_POLL = 0x00000001,
+ GHC_SWRST = 0x40000000,
+ GHC_DPX = 0x00000040,
+ GHC_SPEED = 0x00000030,
+ GHC_LINK_POLL = 0x00000001,
};
enum jme_ghc_speed_val {
- GHC_SPEED_10M = 0x00000010,
- GHC_SPEED_100M = 0x00000020,
- GHC_SPEED_1000M = 0x00000030,
+ GHC_SPEED_10M = 0x00000010,
+ GHC_SPEED_100M = 0x00000020,
+ GHC_SPEED_1000M = 0x00000030,
+};
+
+enum jme_ghc_to_clk {
+ GHC_TO_CLK_OFF = 0x00000000,
+ GHC_TO_CLK_GPHY = 0x00400000,
+ GHC_TO_CLK_PCIE = 0x00800000,
+ GHC_TO_CLK_INVALID = 0x00C00000,
+};
+
+enum jme_ghc_txmac_clk {
+ GHC_TXMAC_CLK_OFF = 0x00000000,
+ GHC_TXMAC_CLK_GPHY = 0x00100000,
+ GHC_TXMAC_CLK_PCIE = 0x00200000,
+ GHC_TXMAC_CLK_INVALID = 0x00300000,
};
/*
next prev parent reply other threads:[~2008-12-03 10:41 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-15 17:00 [PATCH netdev-2.6] jme: JMicron Gigabit Ethernet Driver Guo-Fu Tseng
2008-09-16 2:47 ` Ethan
2008-09-18 16:07 ` Jeff Garzik
2008-10-08 21:56 ` [PATCH net-next-2.6 1/3] jme: Added half-duplex mode and IPv6 RSS fix Guo-Fu Tseng
2008-10-09 2:51 ` David Miller
2008-10-08 21:57 ` [PATCH net-next-2.6 2/3] jme: Faulty IRQ handle bug fix Guo-Fu Tseng
2008-10-09 2:51 ` David Miller
2008-10-08 21:58 ` [PATCH net-next-2.6 3/3] jme: Advances version number Guo-Fu Tseng
2008-10-09 2:51 ` David Miller
2008-12-03 10:41 ` Guo-Fu Tseng [this message]
2008-12-03 15:00 ` [PATCH net-2.6 1/2] jme: GHC register control fix for new hardware Jeff Garzik
2008-12-04 5:20 ` David Miller
2008-12-03 10:44 ` [PATCH net-2.6 2/2] jme: Remove 64 and 40 bit dma_mask Guo-Fu Tseng
2009-02-28 3:54 ` [PATCH net-next-2.6 1/4] jme: Modifies messages to display correct hardware version Guo-Fu Tseng
2009-02-28 3:57 ` [PATCH net-next-2.6 2/4] jme: Fix pci sync Guo-Fu Tseng
2009-02-28 3:58 ` [PATCH net-next-2.6 3/4] jme: Clear all modified GHC register flags Guo-Fu Tseng
2009-02-28 3:59 ` [PATCH net-next-2.6 4/4] jme: Adding {64,40}bits DMA mask back Guo-Fu Tseng
2009-03-02 8:39 ` [PATCH net-next] jme: Advance version number after previous changes Guo-Fu Tseng
2009-03-02 9:55 ` David Miller
2008-11-21 5:20 ` [PATCH netdev-2.6] jme: JMicron Gigabit Ethernet Driver Stephen Hemminger
2008-11-21 5:36 ` David Miller
2008-11-21 6:45 ` Stephen Hemminger
2008-11-21 8:46 ` David Miller
2008-11-21 16:22 ` Guo-Fu Tseng
2008-11-21 16:18 ` Guo-Fu Tseng
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=20081203103825.M4442@cooldavid.org \
--to=cooldavid@cooldavid.org \
--cc=akeem@jmicron.com \
--cc=davem@davemloft.net \
--cc=ethanhsiao@jmicron.com \
--cc=jgarzik@pobox.com \
--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).