static void igb_pin_extts(struct igb_adapter *igb, int chan, int pin) { struct e1000_hw *hw = &igb->hw; u32 aux0_sel_sdp[IGB_N_SDP] = { AUX0_SEL_SDP0, AUX0_SEL_SDP1, AUX0_SEL_SDP2, AUX0_SEL_SDP3, }; u32 aux1_sel_sdp[IGB_N_SDP] = { AUX1_SEL_SDP0, AUX1_SEL_SDP1, AUX1_SEL_SDP2, AUX1_SEL_SDP3, }; u32 ts_sdp_en[IGB_N_SDP] = { TS_SDP0_EN, TS_SDP1_EN, TS_SDP2_EN, TS_SDP3_EN, }; u32 ctrl, ctrl_ext, tssdp = 0; ctrl = rd32(E1000_CTRL); ctrl_ext = rd32(E1000_CTRL_EXT); tssdp = rd32(E1000_TSSDP); igb_pin_direction(pin, 1, &ctrl, &ctrl_ext); /* Make sure this pin is not enabled as an output. */ tssdp &= ~ts_sdp_en[pin]; if (chan == 1) { tssdp &= ~AUX1_SEL_SDP3; tssdp |= aux1_sel_sdp[pin] | AUX1_TS_SDP_EN; } else { tssdp &= ~AUX0_SEL_SDP3; tssdp |= aux0_sel_sdp[pin] | AUX0_TS_SDP_EN; } wr32(E1000_TSSDP, tssdp); wr32(E1000_CTRL, ctrl); wr32(E1000_CTRL_EXT, ctrl_ext); }
static void igb_pin_perout(struct igb_adapter *igb, int chan, int pin, int freq) { static const u32 aux0_sel_sdp[IGB_N_SDP] = { AUX0_SEL_SDP0, AUX0_SEL_SDP1, AUX0_SEL_SDP2, AUX0_SEL_SDP3, }; static const u32 aux1_sel_sdp[IGB_N_SDP] = { AUX1_SEL_SDP0, AUX1_SEL_SDP1, AUX1_SEL_SDP2, AUX1_SEL_SDP3, }; static const u32 ts_sdp_en[IGB_N_SDP] = { TS_SDP0_EN, TS_SDP1_EN, TS_SDP2_EN, TS_SDP3_EN, }; static const u32 ts_sdp_sel_tt0[IGB_N_SDP] = { TS_SDP0_SEL_TT0, TS_SDP1_SEL_TT0, TS_SDP2_SEL_TT0, TS_SDP3_SEL_TT0, }; static const u32 ts_sdp_sel_tt1[IGB_N_SDP] = { TS_SDP0_SEL_TT1, TS_SDP1_SEL_TT1, TS_SDP2_SEL_TT1, TS_SDP3_SEL_TT1, }; static const u32 ts_sdp_sel_fc0[IGB_N_SDP] = { TS_SDP0_SEL_FC0, TS_SDP1_SEL_FC0, TS_SDP2_SEL_FC0, TS_SDP3_SEL_FC0, }; static const u32 ts_sdp_sel_fc1[IGB_N_SDP] = { TS_SDP0_SEL_FC1, TS_SDP1_SEL_FC1, TS_SDP2_SEL_FC1, TS_SDP3_SEL_FC1, }; static const u32 ts_sdp_sel_clr[IGB_N_SDP] = { TS_SDP0_SEL_FC1, TS_SDP1_SEL_FC1, TS_SDP2_SEL_FC1, TS_SDP3_SEL_FC1, }; struct e1000_hw *hw = &igb->hw; u32 ctrl, ctrl_ext, tssdp = 0; ctrl = E1000_READ_REG(hw, E1000_CTRL); ctrl_ext = E1000_READ_REG(hw, E1000_CTRL_EXT); tssdp = E1000_READ_REG(hw, E1000_TSSDP); igb_pin_direction(pin, 0, &ctrl, &ctrl_ext); /* Make sure this pin is not enabled as an input. */ if ((tssdp & AUX0_SEL_SDP3) == aux0_sel_sdp[pin]) tssdp &= ~AUX0_TS_SDP_EN; if ((tssdp & AUX1_SEL_SDP3) == aux1_sel_sdp[pin]) tssdp &= ~AUX1_TS_SDP_EN; tssdp &= ~ts_sdp_sel_clr[pin]; if (freq) tssdp |= (chan == 1) ? ts_sdp_sel_fc1[pin] : ts_sdp_sel_fc0[pin]; else tssdp |= (chan == 1) ? ts_sdp_sel_tt1[pin] : ts_sdp_sel_tt0[pin]; tssdp |= ts_sdp_en[pin]; E1000_WRITE_REG(hw, E1000_TSSDP, tssdp); E1000_WRITE_REG(hw, E1000_CTRL, ctrl); E1000_WRITE_REG(hw, E1000_CTRL_EXT, ctrl_ext); }