9 #define PCI_DEV_REG1 0x40
10 #define PCI_PHY_COMA 0x8000000
11 #define PCI_VIO 0x2000000
13 #define PCI_DEV_REG2 0x44
14 #define PCI_VPD_ROM_SZ 7L<<14
15 #define PCI_REV_DESC 1<<2
17 #define PCI_STATUS_ERROR_BITS (PCI_STATUS_DETECTED_PARITY | \
18 PCI_STATUS_SIG_SYSTEM_ERROR | \
19 PCI_STATUS_REC_MASTER_ABORT | \
20 PCI_STATUS_REC_TARGET_ABORT | \
363 #define RAM_ADR_RAN 0x0007ffffL
386 #define SK_MAC_TO_53 72
387 #define SK_PKT_TO_53 0x2000
388 #define SK_PKT_TO_MAX 0xffff
389 #define SK_RI_TO_53 36
410 #define PA_ENA_TO_ALL (PA_ENA_TO_RX1 | PA_ENA_TO_RX2 |\
411 PA_ENA_TO_TX1 | PA_ENA_TO_TX2)
420 #define TXA_MAX_VAL 0x00ffffffUL
481 #define Q_ADDR(reg, offs) (B8_Q_REGS + (reg) + (offs))
537 #define RB_ADDR(offs, queue) ((u16)B16_RAM_REGS + (u16)(queue) + (offs))
737 #define CSR_SET_RESET (CSR_DESC_SET | CSR_FIFO_SET | CSR_HPI_RST |\
738 CSR_SV_RST | CSR_DREAD_RST | CSR_DWRITE_RST |\
740 #define CSR_CLR_RESET (CSR_DESC_CLR | CSR_FIFO_CLR | CSR_HPI_RUN |\
741 CSR_SV_RUN | CSR_DREAD_RUN | CSR_DWRITE_RUN |\
767 #define RB_MSK 0x0007ffff
803 #define SK_XMIT_DUR 0x002faf08UL
804 #define SK_BLK_DUR 0x01dcd650UL
806 #define SK_DPOLL_DEF 0x00ee6b28UL
808 #define SK_DPOLL_MAX 0x00ffffffUL
811 #define SK_FACT_62 100
812 #define SK_FACT_53 85
813 #define SK_FACT_78 125
881 #define WOL_REGS(port, x) (x + (port)*0x80)
887 #define WOL_PATT_RAM_BASE(port) (WOL_PATT_RAM_1 + (port)*0x400)
1254 #define PHY_B_AS_PAUSE_MSK (PHY_B_AS_PRR | PHY_B_AS_PRT)
1275 #define PHY_B_DEF_MSK \
1276 (~(PHY_B_IS_PSE | PHY_B_IS_AN_PR | PHY_B_IS_DUP_CHANGE | \
1277 PHY_B_IS_LSP_CHANGE | PHY_B_IS_LST_CHANGE))
1398 #define PHY_M_PS_PAUSE_MSK (PHY_M_PS_TX_P_EN | PHY_M_PS_RX_P_EN)
1451 #define PHY_M_EC_M_DSC(x) ((u16)(x)<<10)
1452 #define PHY_M_EC_S_DSC(x) ((u16)(x)<<8)
1453 #define PHY_M_EC_MAC_S(x) ((u16)(x)<<4)
1455 #define PHY_M_EC_M_DSC_2(x) ((u16)(x)<<9)
1474 #define PHY_M_LED_PULS_DUR(x) (((u16)(x)<<12) & PHY_M_LEDC_PULS_MSK)
1475 #define PHY_M_LED_BLINK_RT(x) (((u16)(x)<<8) & PHY_M_LEDC_BL_R_MSK)
1508 #define PHY_M_LED_MO_SGMII(x) ((x)<<14)
1510 #define PHY_M_LED_MO_DUP(x) ((x)<<10)
1511 #define PHY_M_LED_MO_10(x) ((x)<<8)
1512 #define PHY_M_LED_MO_100(x) ((x)<<6)
1513 #define PHY_M_LED_MO_1000(x) ((x)<<4)
1514 #define PHY_M_LED_MO_RX(x) ((x)<<2)
1515 #define PHY_M_LED_MO_TX(x) ((x)<<0)
1577 #define PHY_M_FELP_LED2_CTRL(x) (((x)<<8) & PHY_M_FELP_LED2_MSK)
1578 #define PHY_M_FELP_LED1_CTRL(x) (((x)<<4) & PHY_M_FELP_LED1_MSK)
1579 #define PHY_M_FELP_LED0_CTRL(x) (((x)<<0) & PHY_M_FELP_LED0_MSK)
1616 #define PHY_M_LEDC_LOS_CTRL(x) (((x)<<12) & PHY_M_LEDC_LOS_MSK)
1617 #define PHY_M_LEDC_INIT_CTRL(x) (((x)<<8) & PHY_M_LEDC_INIT_MSK)
1618 #define PHY_M_LEDC_STA1_CTRL(x) (((x)<<4) & PHY_M_LEDC_STA1_MSK)
1619 #define PHY_M_LEDC_STA0_CTRL(x) (((x)<<0) & PHY_M_LEDC_STA0_MSK)
1662 #define GM_MIB_CNT_BASE 0x0100
1663 #define GM_MIB_CNT_SIZE 44
1754 #define GM_GPCR_SPEED_1000 (GM_GPCR_GIGS_ENA | GM_GPCR_SPEED_100)
1755 #define GM_GPCR_AU_ALL_DIS (GM_GPCR_AU_DUP_DIS | GM_GPCR_AU_FCT_DIS|GM_GPCR_AU_SPD_DIS)
1765 #define TX_COL_THR(x) (((x)<<10) & GM_TXCR_COL_THR_MSK)
1766 #define TX_COL_DEF 0x04
1787 #define TX_JAM_LEN_VAL(x) (((x)<<14) & GM_TXPA_JAMLEN_MSK)
1788 #define TX_JAM_IPG_VAL(x) (((x)<<9) & GM_TXPA_JAMIPG_MSK)
1789 #define TX_IPG_JAM_DATA(x) (((x)<<4) & GM_TXPA_JAMDAT_MSK)
1801 #define DATA_BLIND_VAL(x) (((x)<<11) & GM_SMOD_DATABL_MSK)
1802 #define DATA_BLIND_DEF 0x04
1804 #define IPG_DATA_VAL(x) (x & GM_SMOD_IPG_MSK)
1805 #define IPG_DATA_DEF 0x1e
1816 #define GM_SMI_CT_PHY_AD(x) (((x)<<11) & GM_SMI_CT_PHY_A_MSK)
1817 #define GM_SMI_CT_REG_AD(x) (((x)<<6) & GM_SMI_CT_REG_A_MSK)
1935 #define GPC_HWCFG_GMII_COP (GPC_HWCFG_M_3|GPC_HWCFG_M_2 | GPC_HWCFG_M_1 | GPC_HWCFG_M_0)
1936 #define GPC_HWCFG_GMII_FIB (GPC_HWCFG_M_2 | GPC_HWCFG_M_1 | GPC_HWCFG_M_0)
1937 #define GPC_ANEG_ADV_ALL_M (GPC_ANEG_3 | GPC_ANEG_2 | GPC_ANEG_1 | GPC_ANEG_0)
1940 #define GPC_FRC10MBIT_HALF 0
1941 #define GPC_FRC10MBIT_FULL GPC_ANEG_0
1942 #define GPC_FRC100MBIT_HALF GPC_ANEG_1
1943 #define GPC_FRC100MBIT_FULL (GPC_ANEG_0 | GPC_ANEG_1)
1947 #define GPC_ADV_1000_HALF GPC_ANEG_2
1948 #define GPC_ADV_1000_FULL GPC_ANEG_3
1949 #define GPC_ADV_ALL (GPC_ANEG_2 | GPC_ANEG_3)
1953 #define GPC_FORCE_MASTER 0
1954 #define GPC_FORCE_SLAVE GPC_ANEG_0
1955 #define GPC_PREF_MASTER GPC_ANEG_1
1956 #define GPC_PREF_SLAVE (GPC_ANEG_1 | GPC_ANEG_0)
1968 #define GMAC_DEF_MSK (GM_IS_RX_FF_OR | GM_IS_TX_FF_UR)
1995 #define WOL_CTL_DEFAULT \
1996 (WOL_CTL_DIS_PME_ON_LINK_CHG | \
1997 WOL_CTL_DIS_PME_ON_PATTERN | \
1998 WOL_CTL_DIS_PME_ON_MAGIC_PKT | \
1999 WOL_CTL_DIS_LINK_CHG_UNIT | \
2000 WOL_CTL_DIS_PATTERN_UNIT | \
2001 WOL_CTL_DIS_MAGIC_PKT_UNIT)
2004 #define WOL_CTL_PATT_ENA(x) (1 << (x))
2036 #define XM_EXM(reg) (XM_EXM_START + ((reg) << 3))
2142 #define XM_RT_LIM_MSK 0x1f
2146 #define XM_STIME_MSK 0x7f
2150 #define XM_IPG_MSK 0xff
2211 #define XM_TX_WM_MSK 0x01ff
2216 #define XM_THR_MSK 0x03ff
2240 #define XM_RX_WM_MSK 0x03ff
2244 #define XM_DEV_OUI (0x00ffffffUL<<8)
2245 #define XM_DEV_REV (0x07L << 5)
2283 #define XM_PAUSE_MODE (XM_MD_SPOE_E | XM_MD_SPOL_I | XM_MD_SPOH_I)
2284 #define XM_DEF_MODE (XM_MD_RX_RUNT | XM_MD_RX_IRLE | XM_MD_RX_LONG |\
2285 XM_MD_RX_CRCE | XM_MD_RX_ERR | XM_MD_CSA)
2333 #define XMR_DEF_MSK (XMR_OK_LO_OV | XMR_OK_HI_OV)
2366 #define XMT_DEF_MSK (XMT_OK_LO_OV | XMT_OK_HI_OV)
2474 #ifdef CONFIG_SKGE_DEBUG
2512 #define SK_REG(port,reg) (((port)<<7)+(u16)(reg))
2513 #define SK_XMAC_REG(port, reg) \
2514 ((BASE_XMAC_1 + (port) * (BASE_XMAC_2 - BASE_XMAC_1)) | (reg) << 1)
2529 static inline void xm_write32(
const struct skge_hw *hw,
int port,
int r,
u32 v)
2531 skge_write16(hw,
SK_XMAC_REG(port,r), v & 0xffff);
2535 static inline void xm_write16(
const struct skge_hw *hw,
int port,
int r,
u16 v)
2540 static inline void xm_outhash(
const struct skge_hw *hw,
int port,
int reg,
2543 xm_write16(hw, port, reg, (
u16)hash[0] | ((
u16)hash[1] << 8));
2544 xm_write16(hw, port, reg+2, (
u16)hash[2] | ((
u16)hash[3] << 8));
2545 xm_write16(hw, port, reg+4, (
u16)hash[4] | ((
u16)hash[5] << 8));
2546 xm_write16(hw, port, reg+6, (
u16)hash[6] | ((
u16)hash[7] << 8));
2549 static inline void xm_outaddr(
const struct skge_hw *hw,
int port,
int reg,
2552 xm_write16(hw, port, reg, (
u16)addr[0] | ((
u16)addr[1] << 8));
2553 xm_write16(hw, port, reg+2, (
u16)addr[2] | ((
u16)addr[3] << 8));
2554 xm_write16(hw, port, reg+4, (
u16)addr[4] | ((
u16)addr[5] << 8));
2557 #define SK_GMAC_REG(port,reg) \
2558 (BASE_GMAC_1 + (port) * (BASE_GMAC_2-BASE_GMAC_1) + (reg))
2560 static inline u16 gma_read16(
const struct skge_hw *hw,
int port,
int reg)
2565 static inline u32 gma_read32(
const struct skge_hw *hw,
int port,
int reg)
2571 static inline void gma_write16(
const struct skge_hw *hw,
int port,
int r,
u16 v)
2576 static inline void gma_set_addr(
struct skge_hw *hw,
int port,
int reg,
2579 gma_write16(hw, port, reg, (
u16) addr[0] | ((
u16) addr[1] << 8));
2580 gma_write16(hw, port, reg+4,(
u16) addr[2] | ((
u16) addr[3] << 8));
2581 gma_write16(hw, port, reg+8,(
u16) addr[4] | ((
u16) addr[5] << 8));