aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/jme.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/jme.h')
-rw-r--r--drivers/net/jme.h93
1 files changed, 77 insertions, 16 deletions
diff --git a/drivers/net/jme.h b/drivers/net/jme.h
index 07ad3a457185..e9aaeca96abc 100644
--- a/drivers/net/jme.h
+++ b/drivers/net/jme.h
@@ -3,6 +3,7 @@
3 * 3 *
4 * Copyright 2008 JMicron Technology Corporation 4 * Copyright 2008 JMicron Technology Corporation
5 * http://www.jmicron.com/ 5 * http://www.jmicron.com/
6 * Copyright (c) 2009 - 2010 Guo-Fu Tseng <cooldavid@cooldavid.org>
6 * 7 *
7 * Author: Guo-Fu Tseng <cooldavid@cooldavid.org> 8 * Author: Guo-Fu Tseng <cooldavid@cooldavid.org>
8 * 9 *
@@ -25,7 +26,7 @@
25#define __JME_H_INCLUDED__ 26#define __JME_H_INCLUDED__
26 27
27#define DRV_NAME "jme" 28#define DRV_NAME "jme"
28#define DRV_VERSION "1.0.6" 29#define DRV_VERSION "1.0.8"
29#define PFX DRV_NAME ": " 30#define PFX DRV_NAME ": "
30 31
31#define PCI_DEVICE_ID_JMICRON_JMC250 0x0250 32#define PCI_DEVICE_ID_JMICRON_JMC250 0x0250
@@ -41,9 +42,6 @@
41 NETIF_MSG_TX_ERR | \ 42 NETIF_MSG_TX_ERR | \
42 NETIF_MSG_HW) 43 NETIF_MSG_HW)
43 44
44#define jeprintk(pdev, fmt, args...) \
45 printk(KERN_ERR PFX fmt, ## args)
46
47#ifdef TX_DEBUG 45#ifdef TX_DEBUG
48#define tx_dbg(priv, fmt, args...) \ 46#define tx_dbg(priv, fmt, args...) \
49 printk(KERN_DEBUG "%s: " fmt, (priv)->dev->name, ##args) 47 printk(KERN_DEBUG "%s: " fmt, (priv)->dev->name, ##args)
@@ -105,6 +103,37 @@ enum jme_spi_op_bits {
105#define HALF_US 500 /* 500 ns */ 103#define HALF_US 500 /* 500 ns */
106#define JMESPIIOCTL SIOCDEVPRIVATE 104#define JMESPIIOCTL SIOCDEVPRIVATE
107 105
106#define PCI_PRIV_PE1 0xE4
107
108enum pci_priv_pe1_bit_masks {
109 PE1_ASPMSUPRT = 0x00000003, /*
110 * RW:
111 * Aspm_support[1:0]
112 * (R/W Port of 5C[11:10])
113 */
114 PE1_MULTIFUN = 0x00000004, /* RW: Multi_fun_bit */
115 PE1_RDYDMA = 0x00000008, /* RO: ~link.rdy_for_dma */
116 PE1_ASPMOPTL = 0x00000030, /* RW: link.rx10s_option[1:0] */
117 PE1_ASPMOPTH = 0x000000C0, /* RW: 10_req=[3]?HW:[2] */
118 PE1_GPREG0 = 0x0000FF00, /*
119 * SRW:
120 * Cfg_gp_reg0
121 * [7:6] phy_giga BG control
122 * [5] CREQ_N as CREQ_N1 (CPPE# as CREQ#)
123 * [4:0] Reserved
124 */
125 PE1_GPREG0_PBG = 0x0000C000, /* phy_giga BG control */
126 PE1_GPREG1 = 0x00FF0000, /* RW: Cfg_gp_reg1 */
127 PE1_REVID = 0xFF000000, /* RO: Rev ID */
128};
129
130enum pci_priv_pe1_values {
131 PE1_GPREG0_ENBG = 0x00000000, /* en BG */
132 PE1_GPREG0_PDD3COLD = 0x00004000, /* giga_PD + d3cold */
133 PE1_GPREG0_PDPCIESD = 0x00008000, /* giga_PD + pcie_shutdown */
134 PE1_GPREG0_PDPCIEIDDQ = 0x0000C000, /* giga_PD + pcie_iddq */
135};
136
108/* 137/*
109 * Dynamic(adaptive)/Static PCC values 138 * Dynamic(adaptive)/Static PCC values
110 */ 139 */
@@ -405,6 +434,7 @@ struct jme_adapter {
405 u32 reg_rxmcs; 434 u32 reg_rxmcs;
406 u32 reg_ghc; 435 u32 reg_ghc;
407 u32 reg_pmcs; 436 u32 reg_pmcs;
437 u32 reg_gpreg1;
408 u32 phylink; 438 u32 phylink;
409 u32 tx_ring_size; 439 u32 tx_ring_size;
410 u32 tx_ring_mask; 440 u32 tx_ring_mask;
@@ -413,8 +443,10 @@ struct jme_adapter {
413 u32 rx_ring_mask; 443 u32 rx_ring_mask;
414 u8 mrrs; 444 u8 mrrs;
415 unsigned int fpgaver; 445 unsigned int fpgaver;
416 unsigned int chiprev; 446 u8 chiprev;
417 u8 rev; 447 u8 chip_main_rev;
448 u8 chip_sub_rev;
449 u8 pcirev;
418 u32 msg_enable; 450 u32 msg_enable;
419 struct ethtool_cmd old_ecmd; 451 struct ethtool_cmd old_ecmd;
420 unsigned int old_mtu; 452 unsigned int old_mtu;
@@ -436,8 +468,6 @@ struct jme_adapter {
436enum jme_flags_bits { 468enum jme_flags_bits {
437 JME_FLAG_MSI = 1, 469 JME_FLAG_MSI = 1,
438 JME_FLAG_SSET = 2, 470 JME_FLAG_SSET = 2,
439 JME_FLAG_TXCSUM = 3,
440 JME_FLAG_TSO = 4,
441 JME_FLAG_POLL = 5, 471 JME_FLAG_POLL = 5,
442 JME_FLAG_SHUTDOWN = 6, 472 JME_FLAG_SHUTDOWN = 6,
443}; 473};
@@ -499,6 +529,7 @@ enum jme_iomap_regs {
499 JME_PMCS = JME_MAC | 0x60, /* Power Management Control/Stat */ 529 JME_PMCS = JME_MAC | 0x60, /* Power Management Control/Stat */
500 530
501 531
532 JME_PHY_PWR = JME_PHY | 0x24, /* New PHY Power Ctrl Register */
502 JME_PHY_CS = JME_PHY | 0x28, /* PHY Ctrl and Status Register */ 533 JME_PHY_CS = JME_PHY | 0x28, /* PHY Ctrl and Status Register */
503 JME_PHY_LINK = JME_PHY | 0x30, /* PHY Link Status Register */ 534 JME_PHY_LINK = JME_PHY | 0x30, /* PHY Link Status Register */
504 JME_SMBCSR = JME_PHY | 0x40, /* SMB Control and Status */ 535 JME_SMBCSR = JME_PHY | 0x40, /* SMB Control and Status */
@@ -626,6 +657,14 @@ enum jme_txtrhd_shifts {
626 TXTRHD_TXRL_SHIFT = 0, 657 TXTRHD_TXRL_SHIFT = 0,
627}; 658};
628 659
660enum jme_txtrhd_values {
661 TXTRHD_FULLDUPLEX = 0x00000000,
662 TXTRHD_HALFDUPLEX = TXTRHD_TXPEN |
663 ((0x2000 << TXTRHD_TXP_SHIFT) & TXTRHD_TXP) |
664 TXTRHD_TXREN |
665 ((8 << TXTRHD_TXRL_SHIFT) & TXTRHD_TXRL),
666};
667
629/* 668/*
630 * RX Control/Status Bits 669 * RX Control/Status Bits
631 */ 670 */
@@ -781,6 +820,8 @@ static inline u32 smi_phy_addr(int x)
781 */ 820 */
782enum jme_ghc_bit_mask { 821enum jme_ghc_bit_mask {
783 GHC_SWRST = 0x40000000, 822 GHC_SWRST = 0x40000000,
823 GHC_TO_CLK_SRC = 0x00C00000,
824 GHC_TXMAC_CLK_SRC = 0x00300000,
784 GHC_DPX = 0x00000040, 825 GHC_DPX = 0x00000040,
785 GHC_SPEED = 0x00000030, 826 GHC_SPEED = 0x00000030,
786 GHC_LINK_POLL = 0x00000001, 827 GHC_LINK_POLL = 0x00000001,
@@ -835,6 +876,21 @@ enum jme_pmcs_bit_masks {
835}; 876};
836 877
837/* 878/*
879 * New PHY Power Control Register
880 */
881enum jme_phy_pwr_bit_masks {
882 PHY_PWR_DWN1SEL = 0x01000000, /* Phy_giga.p_PWR_DOWN1_SEL */
883 PHY_PWR_DWN1SW = 0x02000000, /* Phy_giga.p_PWR_DOWN1_SW */
884 PHY_PWR_DWN2 = 0x04000000, /* Phy_giga.p_PWR_DOWN2 */
885 PHY_PWR_CLKSEL = 0x08000000, /*
886 * XTL_OUT Clock select
887 * (an internal free-running clock)
888 * 0: xtl_out = phy_giga.A_XTL25_O
889 * 1: xtl_out = phy_giga.PD_OSC
890 */
891};
892
893/*
838 * Giga PHY Status Registers 894 * Giga PHY Status Registers
839 */ 895 */
840enum jme_phy_link_bit_mask { 896enum jme_phy_link_bit_mask {
@@ -944,18 +1000,17 @@ enum jme_gpreg0_vals {
944 1000
945/* 1001/*
946 * General Purpose REG-1 1002 * General Purpose REG-1
947 * Note: All theses bits defined here are for
948 * Chip mode revision 0x11 only
949 */ 1003 */
950enum jme_gpreg1_masks { 1004enum jme_gpreg1_bit_masks {
1005 GPREG1_RXCLKOFF = 0x04000000,
1006 GPREG1_PCREQN = 0x00020000,
1007 GPREG1_HALFMODEPATCH = 0x00000040, /* For Chip revision 0x11 only */
1008 GPREG1_RSSPATCH = 0x00000020, /* For Chip revision 0x11 only */
951 GPREG1_INTRDELAYUNIT = 0x00000018, 1009 GPREG1_INTRDELAYUNIT = 0x00000018,
952 GPREG1_INTRDELAYENABLE = 0x00000007, 1010 GPREG1_INTRDELAYENABLE = 0x00000007,
953}; 1011};
954 1012
955enum jme_gpreg1_vals { 1013enum jme_gpreg1_vals {
956 GPREG1_RSSPATCH = 0x00000040,
957 GPREG1_HALFMODEPATCH = 0x00000020,
958
959 GPREG1_INTDLYUNIT_16NS = 0x00000000, 1014 GPREG1_INTDLYUNIT_16NS = 0x00000000,
960 GPREG1_INTDLYUNIT_256NS = 0x00000008, 1015 GPREG1_INTDLYUNIT_256NS = 0x00000008,
961 GPREG1_INTDLYUNIT_1US = 0x00000010, 1016 GPREG1_INTDLYUNIT_1US = 0x00000010,
@@ -969,7 +1024,7 @@ enum jme_gpreg1_vals {
969 GPREG1_INTDLYEN_6U = 0x00000006, 1024 GPREG1_INTDLYEN_6U = 0x00000006,
970 GPREG1_INTDLYEN_7U = 0x00000007, 1025 GPREG1_INTDLYEN_7U = 0x00000007,
971 1026
972 GPREG1_DEFAULT = 0x00000000, 1027 GPREG1_DEFAULT = GPREG1_PCREQN,
973}; 1028};
974 1029
975/* 1030/*
@@ -1186,16 +1241,22 @@ enum jme_phy_reg17_vals {
1186/* 1241/*
1187 * Workaround 1242 * Workaround
1188 */ 1243 */
1189static inline int is_buggy250(unsigned short device, unsigned int chiprev) 1244static inline int is_buggy250(unsigned short device, u8 chiprev)
1190{ 1245{
1191 return device == PCI_DEVICE_ID_JMICRON_JMC250 && chiprev == 0x11; 1246 return device == PCI_DEVICE_ID_JMICRON_JMC250 && chiprev == 0x11;
1192} 1247}
1193 1248
1249static inline int new_phy_power_ctrl(u8 chip_main_rev)
1250{
1251 return chip_main_rev >= 5;
1252}
1253
1194/* 1254/*
1195 * Function prototypes 1255 * Function prototypes
1196 */ 1256 */
1197static int jme_set_settings(struct net_device *netdev, 1257static int jme_set_settings(struct net_device *netdev,
1198 struct ethtool_cmd *ecmd); 1258 struct ethtool_cmd *ecmd);
1259static void jme_set_unicastaddr(struct net_device *netdev);
1199static void jme_set_multi(struct net_device *netdev); 1260static void jme_set_multi(struct net_device *netdev);
1200 1261
1201#endif 1262#endif