X-Git-Url: https://nv-tegra.nvidia.com/r/gitweb?p=linux-3.10.git;a=blobdiff_plain;f=drivers%2Fnet%2Fcxgb3%2Ft3_hw.c;h=365a7f5b1f94441c670c9c8c599d9199edb23eb7;hp=4545acb3a2d5e27b2a8d686bf621f02b96957aef;hb=1d68e93d65d63814388d1a0b3de028de6dc27ae0;hpb=4aac38990843b4f165ccf467b772e18827bff84c diff --git a/drivers/net/cxgb3/t3_hw.c b/drivers/net/cxgb3/t3_hw.c index 4545acb3a2d..365a7f5b1f9 100644 --- a/drivers/net/cxgb3/t3_hw.c +++ b/drivers/net/cxgb3/t3_hw.c @@ -1,34 +1,54 @@ /* - * This file is part of the Chelsio T3 Ethernet driver. - * - * Copyright (C) 2003-2006 Chelsio Communications. All rights reserved. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the LICENSE file included in this - * release for licensing terms and conditions. + * Copyright (c) 2003-2007 Chelsio, Inc. All rights reserved. + * + * This software is available to you under a choice of one of two + * licenses. You may choose to be licensed under the terms of the GNU + * General Public License (GPL) Version 2, available from the file + * COPYING in the main directory of this source tree, or the + * OpenIB.org BSD license below: + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * - Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. */ - #include "common.h" #include "regs.h" #include "sge_defs.h" #include "firmware_exports.h" - /** - * t3_wait_op_done_val - wait until an operation is completed - * @adapter: the adapter performing the operation - * @reg: the register to check for completion - * @mask: a single-bit field within @reg that indicates completion - * @polarity: the value of the field when the operation is completed - * @attempts: number of check iterations - * @delay: delay in usecs between iterations - * @valp: where to store the value of the register at completion time - * - * Wait until an operation is completed by checking a bit in a register - * up to @attempts times. If @valp is not NULL the value of the register - * at the time it indicated completion is stored there. Returns 0 if the - * operation completes and -EAGAIN otherwise. - */ +/** + * t3_wait_op_done_val - wait until an operation is completed + * @adapter: the adapter performing the operation + * @reg: the register to check for completion + * @mask: a single-bit field within @reg that indicates completion + * @polarity: the value of the field when the operation is completed + * @attempts: number of check iterations + * @delay: delay in usecs between iterations + * @valp: where to store the value of the register at completion time + * + * Wait until an operation is completed by checking a bit in a register + * up to @attempts times. If @valp is not NULL the value of the register + * at the time it indicated completion is stored there. Returns 0 if the + * operation completes and -EAGAIN otherwise. + */ int t3_wait_op_done_val(struct adapter *adapter, int reg, u32 mask, int polarity, int attempts, int delay, u32 *valp) @@ -1181,7 +1201,6 @@ static int t3_handle_intr_status(struct adapter *adapter, unsigned int reg, static void pci_intr_handler(struct adapter *adapter) { static const struct intr_info pcix1_intr_info[] = { - { F_PEXERR, "PCI PEX error", -1, 1 }, {F_MSTDETPARERR, "PCI master detected parity error", -1, 1}, {F_SIGTARABT, "PCI signaled target abort", -1, 1}, {F_RCVTARABT, "PCI received target abort", -1, 1}, @@ -1218,6 +1237,7 @@ static void pci_intr_handler(struct adapter *adapter) static void pcie_intr_handler(struct adapter *adapter) { static const struct intr_info pcie_intr_info[] = { + {F_PEXERR, "PCI PEX error", -1, 1}, {F_UNXSPLCPLERRR, "PCI unexpected split completion DMA read error", -1, 1}, {F_UNXSPLCPLERRC, @@ -2328,8 +2348,6 @@ static inline void tp_wr_indirect(struct adapter *adap, unsigned int addr, static void tp_config(struct adapter *adap, const struct tp_params *p) { - unsigned int v; - t3_write_reg(adap, A_TP_GLOBAL_CONFIG, F_TXPACINGENABLE | F_PATHMTU | F_IPCHECKSUMOFFLOAD | F_UDPCHECKSUMOFFLOAD | F_TCPCHECKSUMOFFLOAD | V_IPTTL(64)); @@ -2348,15 +2366,11 @@ static void tp_config(struct adapter *adap, const struct tp_params *p) adap->params.rev > 0 ? F_ENABLEESND : F_T3A_ENABLEESND, 0); - v = t3_read_reg(adap, A_TP_PC_CONFIG); - v &= ~(F_ENABLEEPCMDAFULL | F_ENABLEOCSPIFULL); - t3_write_reg(adap, A_TP_PC_CONFIG, v | F_TXDEFERENABLE | - F_MODULATEUNIONMODE | F_HEARBEATDACK | - F_TXCONGESTIONMODE | F_RXCONGESTIONMODE); - - v = t3_read_reg(adap, A_TP_PC_CONFIG2); - v &= ~F_CHDRAFULL; - t3_write_reg(adap, A_TP_PC_CONFIG2, v); + t3_set_reg_field(adap, A_TP_PC_CONFIG, + F_ENABLEEPCMDAFULL | F_ENABLEOCSPIFULL, + F_TXDEFERENABLE | F_HEARBEATDACK | F_TXCONGESTIONMODE | + F_RXCONGESTIONMODE); + t3_set_reg_field(adap, A_TP_PC_CONFIG2, F_CHDRAFULL, 0); if (adap->params.rev > 0) { tp_wr_indirect(adap, A_TP_EGRESS_CONFIG, F_REWRITEFORCETOSIZE);