aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorFrancois Romieu <romieu@fr.zoreil.com>2005-09-02 18:56:16 -0400
committerJeff Garzik <jgarzik@pobox.com>2005-09-05 18:06:53 -0400
commit6614a6dc6ebba4d3ca0ba5ea023b61a7d22ab00b (patch)
tree167513c1c9fb84d3ff3bedca626a21a3ab018e8f /drivers
parent900eb9d69252cf91d42f6a87fc80b1c5518dbff1 (diff)
[PATCH] sis190: make 10Mbps the default when handling the StationControl register
This patch does three things: - widen the access to the StationControl register (note the SIS_W16 versus SIS_W32 change); - default to 10Mbps half duplex when the LPA can not be evaluated (reg31->ctl is identical for both). It can be argued that it makes sense as the lowest common denominator when everything else failed. Btw it works better than the current code. :o) - remove some enums: they do not document anymore. Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/sis190.c58
1 files changed, 21 insertions, 37 deletions
diff --git a/drivers/net/sis190.c b/drivers/net/sis190.c
index 95ec3af9ec74..2f69ba8ef887 100644
--- a/drivers/net/sis190.c
+++ b/drivers/net/sis190.c
@@ -179,14 +179,6 @@ enum sis190_register_content {
179 TxInterFrameGapShift = 24, 179 TxInterFrameGapShift = 24,
180 TxDMAShift = 8, /* DMA burst value (0-7) is shift this many bits */ 180 TxDMAShift = 8, /* DMA burst value (0-7) is shift this many bits */
181 181
182 /* StationControl */
183 _1000bpsF = 0x1c00,
184 _1000bpsH = 0x0c00,
185 _100bpsF = 0x1800,
186 _100bpsH = 0x0800,
187 _10bpsF = 0x1400,
188 _10bpsH = 0x0400,
189
190 LinkStatus = 0x02, // unused 182 LinkStatus = 0x02, // unused
191 FullDup = 0x01, // unused 183 FullDup = 0x01, // unused
192 184
@@ -886,11 +878,6 @@ static void sis190_hw_start(struct net_device *dev)
886 878
887 SIS_W32(IntrStatus, 0xffffffff); 879 SIS_W32(IntrStatus, 0xffffffff);
888 SIS_W32(IntrMask, 0x0); 880 SIS_W32(IntrMask, 0x0);
889 /*
890 * Default is 100Mbps.
891 * A bit strange: 100Mbps is 0x1801 elsewhere -- FR 2005/06/09
892 */
893 SIS_W16(StationControl, 0x1901);
894 SIS_W32(GMIIControl, 0x0); 881 SIS_W32(GMIIControl, 0x0);
895 SIS_W32(TxMacControl, 0x60); 882 SIS_W32(TxMacControl, 0x60);
896 SIS_W16(RxMacControl, 0x02); 883 SIS_W16(RxMacControl, 0x02);
@@ -937,29 +924,23 @@ static void sis190_phy_task(void * data)
937 /* Rejoice ! */ 924 /* Rejoice ! */
938 struct { 925 struct {
939 int val; 926 int val;
927 u32 ctl;
940 const char *msg; 928 const char *msg;
941 u16 ctl;
942 } reg31[] = { 929 } reg31[] = {
943 { LPA_1000XFULL | LPA_SLCT, 930 { LPA_1000XFULL | LPA_SLCT, 0x07000c00 | 0x00001000,
944 "1000 Mbps Full Duplex", 931 "1000 Mbps Full Duplex" },
945 0x01 | _1000bpsF }, 932 { LPA_1000XHALF | LPA_SLCT, 0x07000c00,
946 { LPA_1000XHALF | LPA_SLCT, 933 "1000 Mbps Half Duplex" },
947 "1000 Mbps Half Duplex", 934 { LPA_100FULL, 0x04000800 | 0x00001000,
948 0x01 | _1000bpsH }, 935 "100 Mbps Full Duplex" },
949 { LPA_100FULL, 936 { LPA_100HALF, 0x04000800,
950 "100 Mbps Full Duplex", 937 "100 Mbps Half Duplex" },
951 0x01 | _100bpsF }, 938 { LPA_10FULL, 0x04000400 | 0x00001000,
952 { LPA_100HALF, 939 "10 Mbps Full Duplex" },
953 "100 Mbps Half Duplex", 940 { LPA_10HALF, 0x04000400,
954 0x01 | _100bpsH }, 941 "10 Mbps Half Duplex" },
955 { LPA_10FULL, 942 { 0, 0x04000400, "unknown" }
956 "10 Mbps Full Duplex", 943 }, *p;
957 0x01 | _10bpsF },
958 { LPA_10HALF,
959 "10 Mbps Half Duplex",
960 0x01 | _10bpsH },
961 { 0, "unknown", 0x0000 }
962 }, *p;
963 u16 adv; 944 u16 adv;
964 945
965 val = mdio_read(ioaddr, phy_id, 0x1f); 946 val = mdio_read(ioaddr, phy_id, 0x1f);
@@ -972,12 +953,15 @@ static void sis190_phy_task(void * data)
972 953
973 val &= adv; 954 val &= adv;
974 955
975 for (p = reg31; p->ctl; p++) { 956 for (p = reg31; p->val; p++) {
976 if ((val & p->val) == p->val) 957 if ((val & p->val) == p->val)
977 break; 958 break;
978 } 959 }
979 if (p->ctl) 960
980 SIS_W16(StationControl, p->ctl); 961 p->ctl |= SIS_R32(StationControl) & ~0x0f001c00;
962
963 SIS_W32(StationControl, p->ctl);
964
981 net_link(tp, KERN_INFO "%s: link on %s mode.\n", dev->name, 965 net_link(tp, KERN_INFO "%s: link on %s mode.\n", dev->name,
982 p->msg); 966 p->msg);
983 netif_carrier_on(dev); 967 netif_carrier_on(dev);