diff options
Diffstat (limited to 'drivers/net/cxgb3/t3_hw.c')
-rw-r--r-- | drivers/net/cxgb3/t3_hw.c | 80 |
1 files changed, 57 insertions, 23 deletions
diff --git a/drivers/net/cxgb3/t3_hw.c b/drivers/net/cxgb3/t3_hw.c index ff262a04ded0..31ed31a3428b 100644 --- a/drivers/net/cxgb3/t3_hw.c +++ b/drivers/net/cxgb3/t3_hw.c | |||
@@ -493,20 +493,20 @@ int t3_phy_lasi_intr_handler(struct cphy *phy) | |||
493 | } | 493 | } |
494 | 494 | ||
495 | static const struct adapter_info t3_adap_info[] = { | 495 | static const struct adapter_info t3_adap_info[] = { |
496 | {2, 0, | 496 | {1, 1, 0, |
497 | F_GPIO2_OEN | F_GPIO4_OEN | | 497 | F_GPIO2_OEN | F_GPIO4_OEN | |
498 | F_GPIO2_OUT_VAL | F_GPIO4_OUT_VAL, { S_GPIO3, S_GPIO5 }, 0, | 498 | F_GPIO2_OUT_VAL | F_GPIO4_OUT_VAL, { S_GPIO3, S_GPIO5 }, 0, |
499 | &mi1_mdio_ops, "Chelsio PE9000"}, | 499 | &mi1_mdio_ops, "Chelsio PE9000"}, |
500 | {2, 0, | 500 | {1, 1, 0, |
501 | F_GPIO2_OEN | F_GPIO4_OEN | | 501 | F_GPIO2_OEN | F_GPIO4_OEN | |
502 | F_GPIO2_OUT_VAL | F_GPIO4_OUT_VAL, { S_GPIO3, S_GPIO5 }, 0, | 502 | F_GPIO2_OUT_VAL | F_GPIO4_OUT_VAL, { S_GPIO3, S_GPIO5 }, 0, |
503 | &mi1_mdio_ops, "Chelsio T302"}, | 503 | &mi1_mdio_ops, "Chelsio T302"}, |
504 | {1, 0, | 504 | {1, 0, 0, |
505 | F_GPIO1_OEN | F_GPIO6_OEN | F_GPIO7_OEN | F_GPIO10_OEN | | 505 | F_GPIO1_OEN | F_GPIO6_OEN | F_GPIO7_OEN | F_GPIO10_OEN | |
506 | F_GPIO11_OEN | F_GPIO1_OUT_VAL | F_GPIO6_OUT_VAL | F_GPIO10_OUT_VAL, | 506 | F_GPIO11_OEN | F_GPIO1_OUT_VAL | F_GPIO6_OUT_VAL | F_GPIO10_OUT_VAL, |
507 | { 0 }, SUPPORTED_10000baseT_Full | SUPPORTED_AUI, | 507 | { 0 }, SUPPORTED_10000baseT_Full | SUPPORTED_AUI, |
508 | &mi1_mdio_ext_ops, "Chelsio T310"}, | 508 | &mi1_mdio_ext_ops, "Chelsio T310"}, |
509 | {2, 0, | 509 | {1, 1, 0, |
510 | F_GPIO1_OEN | F_GPIO2_OEN | F_GPIO4_OEN | F_GPIO5_OEN | F_GPIO6_OEN | | 510 | F_GPIO1_OEN | F_GPIO2_OEN | F_GPIO4_OEN | F_GPIO5_OEN | F_GPIO6_OEN | |
511 | F_GPIO7_OEN | F_GPIO10_OEN | F_GPIO11_OEN | F_GPIO1_OUT_VAL | | 511 | F_GPIO7_OEN | F_GPIO10_OEN | F_GPIO11_OEN | F_GPIO1_OUT_VAL | |
512 | F_GPIO5_OUT_VAL | F_GPIO6_OUT_VAL | F_GPIO10_OUT_VAL, | 512 | F_GPIO5_OUT_VAL | F_GPIO6_OUT_VAL | F_GPIO10_OUT_VAL, |
@@ -514,7 +514,7 @@ static const struct adapter_info t3_adap_info[] = { | |||
514 | &mi1_mdio_ext_ops, "Chelsio T320"}, | 514 | &mi1_mdio_ext_ops, "Chelsio T320"}, |
515 | {}, | 515 | {}, |
516 | {}, | 516 | {}, |
517 | {1, 0, | 517 | {1, 0, 0, |
518 | F_GPIO1_OEN | F_GPIO2_OEN | F_GPIO4_OEN | F_GPIO6_OEN | F_GPIO7_OEN | | 518 | F_GPIO1_OEN | F_GPIO2_OEN | F_GPIO4_OEN | F_GPIO6_OEN | F_GPIO7_OEN | |
519 | F_GPIO10_OEN | F_GPIO1_OUT_VAL | F_GPIO6_OUT_VAL | F_GPIO10_OUT_VAL, | 519 | F_GPIO10_OEN | F_GPIO1_OUT_VAL | F_GPIO6_OUT_VAL | F_GPIO10_OUT_VAL, |
520 | { S_GPIO9 }, SUPPORTED_10000baseT_Full | SUPPORTED_AUI, | 520 | { S_GPIO9 }, SUPPORTED_10000baseT_Full | SUPPORTED_AUI, |
@@ -2128,16 +2128,40 @@ void t3_port_intr_clear(struct adapter *adapter, int idx) | |||
2128 | static int t3_sge_write_context(struct adapter *adapter, unsigned int id, | 2128 | static int t3_sge_write_context(struct adapter *adapter, unsigned int id, |
2129 | unsigned int type) | 2129 | unsigned int type) |
2130 | { | 2130 | { |
2131 | t3_write_reg(adapter, A_SG_CONTEXT_MASK0, 0xffffffff); | 2131 | if (type == F_RESPONSEQ) { |
2132 | t3_write_reg(adapter, A_SG_CONTEXT_MASK1, 0xffffffff); | 2132 | /* |
2133 | t3_write_reg(adapter, A_SG_CONTEXT_MASK2, 0xffffffff); | 2133 | * Can't write the Response Queue Context bits for |
2134 | t3_write_reg(adapter, A_SG_CONTEXT_MASK3, 0xffffffff); | 2134 | * Interrupt Armed or the Reserve bits after the chip |
2135 | * has been initialized out of reset. Writing to these | ||
2136 | * bits can confuse the hardware. | ||
2137 | */ | ||
2138 | t3_write_reg(adapter, A_SG_CONTEXT_MASK0, 0xffffffff); | ||
2139 | t3_write_reg(adapter, A_SG_CONTEXT_MASK1, 0xffffffff); | ||
2140 | t3_write_reg(adapter, A_SG_CONTEXT_MASK2, 0x17ffffff); | ||
2141 | t3_write_reg(adapter, A_SG_CONTEXT_MASK3, 0xffffffff); | ||
2142 | } else { | ||
2143 | t3_write_reg(adapter, A_SG_CONTEXT_MASK0, 0xffffffff); | ||
2144 | t3_write_reg(adapter, A_SG_CONTEXT_MASK1, 0xffffffff); | ||
2145 | t3_write_reg(adapter, A_SG_CONTEXT_MASK2, 0xffffffff); | ||
2146 | t3_write_reg(adapter, A_SG_CONTEXT_MASK3, 0xffffffff); | ||
2147 | } | ||
2135 | t3_write_reg(adapter, A_SG_CONTEXT_CMD, | 2148 | t3_write_reg(adapter, A_SG_CONTEXT_CMD, |
2136 | V_CONTEXT_CMD_OPCODE(1) | type | V_CONTEXT(id)); | 2149 | V_CONTEXT_CMD_OPCODE(1) | type | V_CONTEXT(id)); |
2137 | return t3_wait_op_done(adapter, A_SG_CONTEXT_CMD, F_CONTEXT_CMD_BUSY, | 2150 | return t3_wait_op_done(adapter, A_SG_CONTEXT_CMD, F_CONTEXT_CMD_BUSY, |
2138 | 0, SG_CONTEXT_CMD_ATTEMPTS, 1); | 2151 | 0, SG_CONTEXT_CMD_ATTEMPTS, 1); |
2139 | } | 2152 | } |
2140 | 2153 | ||
2154 | /** | ||
2155 | * clear_sge_ctxt - completely clear an SGE context | ||
2156 | * @adapter: the adapter | ||
2157 | * @id: the context id | ||
2158 | * @type: the context type | ||
2159 | * | ||
2160 | * Completely clear an SGE context. Used predominantly at post-reset | ||
2161 | * initialization. Note in particular that we don't skip writing to any | ||
2162 | * "sensitive bits" in the contexts the way that t3_sge_write_context() | ||
2163 | * does ... | ||
2164 | */ | ||
2141 | static int clear_sge_ctxt(struct adapter *adap, unsigned int id, | 2165 | static int clear_sge_ctxt(struct adapter *adap, unsigned int id, |
2142 | unsigned int type) | 2166 | unsigned int type) |
2143 | { | 2167 | { |
@@ -2145,7 +2169,14 @@ static int clear_sge_ctxt(struct adapter *adap, unsigned int id, | |||
2145 | t3_write_reg(adap, A_SG_CONTEXT_DATA1, 0); | 2169 | t3_write_reg(adap, A_SG_CONTEXT_DATA1, 0); |
2146 | t3_write_reg(adap, A_SG_CONTEXT_DATA2, 0); | 2170 | t3_write_reg(adap, A_SG_CONTEXT_DATA2, 0); |
2147 | t3_write_reg(adap, A_SG_CONTEXT_DATA3, 0); | 2171 | t3_write_reg(adap, A_SG_CONTEXT_DATA3, 0); |
2148 | return t3_sge_write_context(adap, id, type); | 2172 | t3_write_reg(adap, A_SG_CONTEXT_MASK0, 0xffffffff); |
2173 | t3_write_reg(adap, A_SG_CONTEXT_MASK1, 0xffffffff); | ||
2174 | t3_write_reg(adap, A_SG_CONTEXT_MASK2, 0xffffffff); | ||
2175 | t3_write_reg(adap, A_SG_CONTEXT_MASK3, 0xffffffff); | ||
2176 | t3_write_reg(adap, A_SG_CONTEXT_CMD, | ||
2177 | V_CONTEXT_CMD_OPCODE(1) | type | V_CONTEXT(id)); | ||
2178 | return t3_wait_op_done(adap, A_SG_CONTEXT_CMD, F_CONTEXT_CMD_BUSY, | ||
2179 | 0, SG_CONTEXT_CMD_ATTEMPTS, 1); | ||
2149 | } | 2180 | } |
2150 | 2181 | ||
2151 | /** | 2182 | /** |
@@ -2729,10 +2760,10 @@ static void tp_config(struct adapter *adap, const struct tp_params *p) | |||
2729 | F_TCPCHECKSUMOFFLOAD | V_IPTTL(64)); | 2760 | F_TCPCHECKSUMOFFLOAD | V_IPTTL(64)); |
2730 | t3_write_reg(adap, A_TP_TCP_OPTIONS, V_MTUDEFAULT(576) | | 2761 | t3_write_reg(adap, A_TP_TCP_OPTIONS, V_MTUDEFAULT(576) | |
2731 | F_MTUENABLE | V_WINDOWSCALEMODE(1) | | 2762 | F_MTUENABLE | V_WINDOWSCALEMODE(1) | |
2732 | V_TIMESTAMPSMODE(0) | V_SACKMODE(1) | V_SACKRX(1)); | 2763 | V_TIMESTAMPSMODE(1) | V_SACKMODE(1) | V_SACKRX(1)); |
2733 | t3_write_reg(adap, A_TP_DACK_CONFIG, V_AUTOSTATE3(1) | | 2764 | t3_write_reg(adap, A_TP_DACK_CONFIG, V_AUTOSTATE3(1) | |
2734 | V_AUTOSTATE2(1) | V_AUTOSTATE1(0) | | 2765 | V_AUTOSTATE2(1) | V_AUTOSTATE1(0) | |
2735 | V_BYTETHRESHOLD(16384) | V_MSSTHRESHOLD(2) | | 2766 | V_BYTETHRESHOLD(26880) | V_MSSTHRESHOLD(2) | |
2736 | F_AUTOCAREFUL | F_AUTOENABLE | V_DACK_MODE(1)); | 2767 | F_AUTOCAREFUL | F_AUTOENABLE | V_DACK_MODE(1)); |
2737 | t3_set_reg_field(adap, A_TP_IN_CONFIG, F_RXFBARBPRIO | F_TXFBARBPRIO, | 2768 | t3_set_reg_field(adap, A_TP_IN_CONFIG, F_RXFBARBPRIO | F_TXFBARBPRIO, |
2738 | F_IPV6ENABLE | F_NICMODE); | 2769 | F_IPV6ENABLE | F_NICMODE); |
@@ -3196,20 +3227,22 @@ int t3_mps_set_active_ports(struct adapter *adap, unsigned int port_mask) | |||
3196 | } | 3227 | } |
3197 | 3228 | ||
3198 | /* | 3229 | /* |
3199 | * Perform the bits of HW initialization that are dependent on the number | 3230 | * Perform the bits of HW initialization that are dependent on the Tx |
3200 | * of available ports. | 3231 | * channels being used. |
3201 | */ | 3232 | */ |
3202 | static void init_hw_for_avail_ports(struct adapter *adap, int nports) | 3233 | static void chan_init_hw(struct adapter *adap, unsigned int chan_map) |
3203 | { | 3234 | { |
3204 | int i; | 3235 | int i; |
3205 | 3236 | ||
3206 | if (nports == 1) { | 3237 | if (chan_map != 3) { /* one channel */ |
3207 | t3_set_reg_field(adap, A_ULPRX_CTL, F_ROUND_ROBIN, 0); | 3238 | t3_set_reg_field(adap, A_ULPRX_CTL, F_ROUND_ROBIN, 0); |
3208 | t3_set_reg_field(adap, A_ULPTX_CONFIG, F_CFG_RR_ARB, 0); | 3239 | t3_set_reg_field(adap, A_ULPTX_CONFIG, F_CFG_RR_ARB, 0); |
3209 | t3_write_reg(adap, A_MPS_CFG, F_TPRXPORTEN | F_TPTXPORT0EN | | 3240 | t3_write_reg(adap, A_MPS_CFG, F_TPRXPORTEN | F_ENFORCEPKT | |
3210 | F_PORT0ACTIVE | F_ENFORCEPKT); | 3241 | (chan_map == 1 ? F_TPTXPORT0EN | F_PORT0ACTIVE : |
3211 | t3_write_reg(adap, A_PM1_TX_CFG, 0xffffffff); | 3242 | F_TPTXPORT1EN | F_PORT1ACTIVE)); |
3212 | } else { | 3243 | t3_write_reg(adap, A_PM1_TX_CFG, |
3244 | chan_map == 1 ? 0xffffffff : 0); | ||
3245 | } else { /* two channels */ | ||
3213 | t3_set_reg_field(adap, A_ULPRX_CTL, 0, F_ROUND_ROBIN); | 3246 | t3_set_reg_field(adap, A_ULPRX_CTL, 0, F_ROUND_ROBIN); |
3214 | t3_set_reg_field(adap, A_ULPTX_CONFIG, 0, F_CFG_RR_ARB); | 3247 | t3_set_reg_field(adap, A_ULPTX_CONFIG, 0, F_CFG_RR_ARB); |
3215 | t3_write_reg(adap, A_ULPTX_DMA_WEIGHT, | 3248 | t3_write_reg(adap, A_ULPTX_DMA_WEIGHT, |
@@ -3517,7 +3550,7 @@ int t3_init_hw(struct adapter *adapter, u32 fw_params) | |||
3517 | t3_write_reg(adapter, A_PM1_RX_CFG, 0xffffffff); | 3550 | t3_write_reg(adapter, A_PM1_RX_CFG, 0xffffffff); |
3518 | t3_write_reg(adapter, A_PM1_RX_MODE, 0); | 3551 | t3_write_reg(adapter, A_PM1_RX_MODE, 0); |
3519 | t3_write_reg(adapter, A_PM1_TX_MODE, 0); | 3552 | t3_write_reg(adapter, A_PM1_TX_MODE, 0); |
3520 | init_hw_for_avail_ports(adapter, adapter->params.nports); | 3553 | chan_init_hw(adapter, adapter->params.chan_map); |
3521 | t3_sge_init(adapter, &adapter->params.sge); | 3554 | t3_sge_init(adapter, &adapter->params.sge); |
3522 | 3555 | ||
3523 | t3_write_reg(adapter, A_T3DBG_GPIO_ACT_LOW, calc_gpio_intr(adapter)); | 3556 | t3_write_reg(adapter, A_T3DBG_GPIO_ACT_LOW, calc_gpio_intr(adapter)); |
@@ -3754,7 +3787,8 @@ int t3_prep_adapter(struct adapter *adapter, const struct adapter_info *ai, | |||
3754 | get_pci_mode(adapter, &adapter->params.pci); | 3787 | get_pci_mode(adapter, &adapter->params.pci); |
3755 | 3788 | ||
3756 | adapter->params.info = ai; | 3789 | adapter->params.info = ai; |
3757 | adapter->params.nports = ai->nports; | 3790 | adapter->params.nports = ai->nports0 + ai->nports1; |
3791 | adapter->params.chan_map = !!ai->nports0 | (!!ai->nports1 << 1); | ||
3758 | adapter->params.rev = t3_read_reg(adapter, A_PL_REV); | 3792 | adapter->params.rev = t3_read_reg(adapter, A_PL_REV); |
3759 | /* | 3793 | /* |
3760 | * We used to only run the "adapter check task" once a second if | 3794 | * We used to only run the "adapter check task" once a second if |
@@ -3785,7 +3819,7 @@ int t3_prep_adapter(struct adapter *adapter, const struct adapter_info *ai, | |||
3785 | mc7_prep(adapter, &adapter->pmtx, MC7_PMTX_BASE_ADDR, "PMTX"); | 3819 | mc7_prep(adapter, &adapter->pmtx, MC7_PMTX_BASE_ADDR, "PMTX"); |
3786 | mc7_prep(adapter, &adapter->cm, MC7_CM_BASE_ADDR, "CM"); | 3820 | mc7_prep(adapter, &adapter->cm, MC7_CM_BASE_ADDR, "CM"); |
3787 | 3821 | ||
3788 | p->nchan = ai->nports; | 3822 | p->nchan = adapter->params.chan_map == 3 ? 2 : 1; |
3789 | p->pmrx_size = t3_mc7_size(&adapter->pmrx); | 3823 | p->pmrx_size = t3_mc7_size(&adapter->pmrx); |
3790 | p->pmtx_size = t3_mc7_size(&adapter->pmtx); | 3824 | p->pmtx_size = t3_mc7_size(&adapter->pmtx); |
3791 | p->cm_size = t3_mc7_size(&adapter->cm); | 3825 | p->cm_size = t3_mc7_size(&adapter->cm); |