Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756532AbbDOU4c (ORCPT ); Wed, 15 Apr 2015 16:56:32 -0400 Received: from mail-by2on0096.outbound.protection.outlook.com ([207.46.100.96]:60919 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754958AbbDOU4Z (ORCPT ); Wed, 15 Apr 2015 16:56:25 -0400 X-Greylist: delayed 1136 seconds by postgrey-1.27 at vger.kernel.org; Wed, 15 Apr 2015 16:56:25 EDT Authentication-Results: spf=fail (sender IP is 66.35.236.236) smtp.mailfrom=opensource.altera.com; st.com; dkim=none (message not signed) header.d=none; From: Vince Bridgers To: , , CC: , Subject: [PATCH net 2/5] stmmac: Add defines and documentation for enabling flow control Date: Wed, 15 Apr 2015 11:17:39 -0500 Message-ID: <1429114662-1528-3-git-send-email-vbridger@opensource.altera.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1429114662-1528-1-git-send-email-vbridger@opensource.altera.com> References: <1429114662-1528-1-git-send-email-vbridger@opensource.altera.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [64.129.157.38] X-ClientProxiedBy: SN1PR07CA0030.namprd07.prod.outlook.com (25.162.170.168) To CY1PR0301MB0634.namprd03.prod.outlook.com (25.160.158.140) Authentication-Results: st.com; dkim=none (message not signed) header.d=none; X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY1PR0301MB0634;UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY2PR0301MB0598; X-Microsoft-Antispam-PRVS: X-Forefront-Antispam-Report-Untrusted: BMV:1;SFV:NSPM;SFS:(10009020)(6009001)(47776003)(48376002)(19580395003)(19580405001)(2201001)(33646002)(50466002)(50226001)(92566002)(66066001)(87976001)(62966003)(77156002)(2950100001)(86362001)(76176999)(50986999)(42186005)(40100003)(229853001)(122386002)(53416004)(4001410100001)(46102003)(4001430100001);DIR:OUT;SFP:1101;SCL:1;SRVR:CY1PR0301MB0634;H:vince-HP-Z620-Workstation2.altera.com;FPR:;SPF:None;MLV:sfv;LANG:en; X-Exchange-Antispam-Report-Test: UriScan:;UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(5005006)(5002010);SRVR:CY1PR0301MB0634;BCL:0;PCL:0;RULEID:;SRVR:CY1PR0301MB0634;BCL:0;PCL:0;RULEID:(601004)(5005006)(5002010);SRVR:BY2PR0301MB0598;BCL:0;PCL:0;RULEID:;SRVR:BY2PR0301MB0598; X-Forefront-PRVS: 0547116B72 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR0301MB0634 X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: BY2FFO11FD035.protection.gbl X-Forefront-Antispam-Report: CIP:66.35.236.236;CTRY:US;IPV:NLI;EFV:NLI;BMV:1;SFV:NSPM;SFS:(10009020)(6009001)(339900001)(199003)(189002)(50986999)(76176999)(50226001)(62966003)(77156002)(50466002)(46102003)(48376002)(87936001)(53416004)(2201001)(16796002)(4001410100001)(85426001)(229853001)(106466001)(86362001)(66066001)(122386002)(47776003)(2950100001)(105606002)(92566002)(19580395003)(33646002)(40100003)(19580405001)(6806004)(7099027)(4001430100001);DIR:OUT;SFP:1101;SCL:1;SRVR:BY2PR0301MB0598;H:sj-itexedge04.altera.priv.altera.com;FPR:;SPF:Fail;MLV:ovrnspm;A:0;MX:1;PTR:InfoDomainNonexistent;LANG:en; X-Forefront-PRVS: 0547116B72 X-OriginatorOrg: opensource.altera.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Apr 2015 20:22:11.8646 (UTC) X-MS-Exchange-CrossTenant-Id: fbd72e03-d4a5-4110-adce-614d51f2077a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=fbd72e03-d4a5-4110-adce-614d51f2077a;Ip=[66.35.236.236];Helo=[sj-itexedge04.altera.priv.altera.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR0301MB0598 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3553 Lines: 87 Add defines and documentation for enabling flow control on the stmmac. Flow control was not implemented correctly on the stmmac driver and is currently non-functional as a result. This is the first in a series of small patches to correctly implement this feature. Signed-off-by: Vince Bridgers --- drivers/net/ethernet/stmicro/stmmac/dwmac1000.h | 51 +++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac1000.h b/drivers/net/ethernet/stmicro/stmmac/dwmac1000.h index 64d8f56..b3fe057 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac1000.h +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac1000.h @@ -172,6 +172,7 @@ enum inter_frame_gap { /* GMAC FLOW CTRL defines */ #define GMAC_FLOW_CTRL_PT_MASK 0xffff0000 /* Pause Time Mask */ #define GMAC_FLOW_CTRL_PT_SHIFT 16 +#define GMAC_FLOW_CTRL_UP 0x00000008 /* Unicast pause frame enable */ #define GMAC_FLOW_CTRL_RFE 0x00000004 /* Rx Flow Control Enable */ #define GMAC_FLOW_CTRL_TFE 0x00000002 /* Tx Flow Control Enable */ #define GMAC_FLOW_CTRL_FCB_BPA 0x00000001 /* Flow Control Busy ... */ @@ -246,6 +247,56 @@ enum ttc_control { #define DMA_CONTROL_FEF 0x00000080 #define DMA_CONTROL_FUF 0x00000040 +/* Receive flow control activation field + * RFA field in DMA control register, bits 23,10:9 + */ +#define DMA_CONTROL_RFA_MASK 0x00800600 + +/* Receive flow control deactivation field + * RFD field in DMA control register, bits 22,12:11 + */ +#define DMA_CONTROL_RFD_MASK 0x00401800 + +/* RFD and RFA fields are encoded as follows + * + * Bit Field + * 0,00 - Full minus 1KB (only valid when rxfifo >= 4KB and EFC enabled) + * 0,01 - Full minus 2KB (only valid when rxfifo >= 4KB and EFC enabled) + * 0,10 - Full minus 3KB (only valid when rxfifo >= 4KB and EFC enabled) + * 0,11 - Full minus 4KB (only valid when rxfifo > 4KB and EFC enabled) + * 1,00 - Full minus 5KB (only valid when rxfifo > 8KB and EFC enabled) + * 1,01 - Full minus 6KB (only valid when rxfifo > 8KB and EFC enabled) + * 1,10 - Full minus 7KB (only valid when rxfifo > 8KB and EFC enabled) + * 1,11 - Reserved + * + * RFD should always be > RFA for a given FIFO size. RFD == RFA may work, + * but packet throughput performance may not be as expected. + * + * Be sure that bit 3 in GMAC Register 6 is set for Unicast Pause frame + * detection (IEEE Specification Requirement, Annex 31B, 31B.1, Pause + * Description). + * + * Be sure that DZPA (bit 7 in Flow Control Register, GMAC Register 6), + * is set to 0. This allows pause frames with a quanta of 0 to be sent + * as an XOFF message to the link peer. + */ + +#define RFA_FULL_MINUS_1K 0x00000000 +#define RFA_FULL_MINUS_2K 0x00000200 +#define RFA_FULL_MINUS_3K 0x00000400 +#define RFA_FULL_MINUS_4K 0x00000600 +#define RFA_FULL_MINUS_5K 0x00800000 +#define RFA_FULL_MINUS_6K 0x00800200 +#define RFA_FULL_MINUS_7K 0x00800400 + +#define RFD_FULL_MINUS_1K 0x00000000 +#define RFD_FULL_MINUS_2K 0x00000800 +#define RFD_FULL_MINUS_3K 0x00001000 +#define RFD_FULL_MINUS_4K 0x00001800 +#define RFD_FULL_MINUS_5K 0x00400000 +#define RFD_FULL_MINUS_6K 0x00400800 +#define RFD_FULL_MINUS_7K 0x00401000 + enum rtc_control { DMA_CONTROL_RTC_64 = 0x00000000, DMA_CONTROL_RTC_32 = 0x00000008, -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/