Received: by 10.223.164.202 with SMTP id h10csp270517wrb; Tue, 14 Nov 2017 22:36:35 -0800 (PST) X-Google-Smtp-Source: AGs4zMbgsVEEVHCjCCScOifHML2ObNBZvvnoaVGxRvMTy6OB+iyXRSQX9kxLFoLBh3H6oqMnTjCd X-Received: by 10.84.148.134 with SMTP id k6mr14529647pla.117.1510727795100; Tue, 14 Nov 2017 22:36:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510727795; cv=none; d=google.com; s=arc-20160816; b=FVxPONqsw6i5pja+5rHxWs2vZdBadGm9UqLrLIyeD46y5EEus90I/+9DGlM4Q8dk4r XTORtC4dO/zR6nNM7Roh2Nx2p2/tjVL24C44Pl5yOabAAI7oFJD+zzpXCv93Sk3ZL/4Y NYf1fiH+oaHjy4YS6B1OIBGai3/KgVfD+4jLIXSEqxYZRSWurxYBYuD5NtTAhjka6IH/ HhO3oDHMwtI9o9GQLLLZ/dZxXqdl9VApTukF2kOxQ0CQtf+Ary7xt6NtpoAMbrsPhI2P i4UL2tYBG9SsowATopqZZtyzrzOH2IY0lD6b8ISROQnzpaGPOLvcwbn1ZGpNxKoUL1/Y Oo9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:mime-version:message-id:date:subject:cc:to :from:arc-authentication-results; bh=gqgKqaGoxjNqXd/S9iGW+Wmb6ijlbPAPNGkNy34ks64=; b=j22xtfjoczuc6Ry11y0V0nIMeh7McIy46FvVVUSpwGXudthAT1D+lsrF5zJXw6gxOS 9M92ZAPv5eAZ5xg5tDMkNQczuyxU2Hw4vEoC5UCVD6Thxweslc+ufh5h30+CsVesrjei i8wU7Zv+DGzmmKpkmZ9cNelhNob/RcI6noxfqBbAfeu3+yRsyP98/6zOGezq4AcbqK4e PdzFfLFpTWU/jBhz5aFtV2fxr9JZpZp0IqHj3Fxzpm7uTnptafk9FEtkUCY1XURNa8HW aTJc1/PsuFdefPtQAuc5HuVj0Mt72W5BSvlJm2qf/G/zUFR4vI+5+R/O7lv5qMKhkkDs s/7g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j2si17629155plk.165.2017.11.14.22.36.21; Tue, 14 Nov 2017 22:36:35 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755759AbdKOGXu (ORCPT + 88 others); Wed, 15 Nov 2017 01:23:50 -0500 Received: from mail-bl2nam02on0058.outbound.protection.outlook.com ([104.47.38.58]:11694 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752686AbdKOGXr (ORCPT ); Wed, 15 Nov 2017 01:23:47 -0500 Received: from DM5PR03CA0059.namprd03.prod.outlook.com (10.174.189.176) by CO2PR03MB2358.namprd03.prod.outlook.com (10.166.93.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.197.13; Wed, 15 Nov 2017 06:23:45 +0000 Received: from BN1AFFO11FD048.protection.gbl (2a01:111:f400:7c10::128) by DM5PR03CA0059.outlook.office365.com (2603:10b6:4:3b::48) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.218.12 via Frontend Transport; Wed, 15 Nov 2017 06:23:45 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=fail action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1AFFO11FD048.mail.protection.outlook.com (10.58.53.63) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.197.9 via Frontend Transport; Wed, 15 Nov 2017 06:23:44 +0000 Received: from titan.ap.freescale.net ([10.192.208.233]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id vAF6NfKI012699; Tue, 14 Nov 2017 23:23:41 -0700 From: Ran Wang To: Felipe Balbi CC: Greg Kroah-Hartman , "open list:DESIGNWARE USB3 DRD IP DRIVER" , open list , Changming Huang , Rajesh Bhagat , Li Yang , Ran Wang Subject: [PATCH] usb: dwc3: Enable the USB snooping Date: Wed, 15 Nov 2017 14:04:59 +0800 Message-ID: <20171115060459.45375-1-ran.wang_1@nxp.com> X-Mailer: git-send-email 2.14.1 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131552006251870481;(91ab9b29-cfa4-454e-5278-08d120cd25b8);() X-Forefront-Antispam-Report: CIP:192.88.168.50;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(6009001)(336005)(7966004)(376002)(39380400002)(346002)(39860400002)(2980300002)(1110001)(1109001)(339900001)(189002)(199003)(8656006)(16586007)(4326008)(5003940100001)(53936002)(77096006)(8676002)(1076002)(85426001)(6666003)(86362001)(81156014)(5660300001)(316002)(81166006)(50226002)(97736004)(68736007)(8936002)(54906003)(36756003)(6916009)(189998001)(104016004)(48376002)(33646002)(50466002)(498600001)(2906002)(106466001)(105606002)(47776003)(356003)(305945005)(50986999);DIR:OUT;SFP:1101;SCL:1;SRVR:CO2PR03MB2358;H:tx30smr01.am.freescale.net;FPR:;SPF:Fail;PTR:InfoDomainNonexistent;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BN1AFFO11FD048;1:SaEXPnjoL/t9B/EA/1VsySJR2jiEwctOasqDPYyp45OggFEjBnTn8xTp54vv7zTvoBSYKwKB0WEu22fX3nxPgEFf300htj1NiyFq7qICDbTlabhVf+boXHgSOEExQC9J MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 87335072-f6a9-4c2a-97b2-08d52bf16c96 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(4534020)(4628075)(201703131517081)(2017052603199);SRVR:CO2PR03MB2358; X-Microsoft-Exchange-Diagnostics: 1;CO2PR03MB2358;3:WW3W7UcXw4eNRJvmonyg6r1Z9+Rf7z254Fj0e/UNRepfaPsI8Y8x/atjGEwjzlv4gfEXZvF/M8JGX1y5v2VRc370lonHtRiUIZ0gImsNQFcI6Ee9maS2hiG0FsvMHPD7RW0yfxydleZNXwUK+0aLMk60WawjEY/LQom1ip4yaOWmRcwyyOPo7Y5WyqfOLciRs72zEdR0k54w5jS9+ooZUQoFl4aqAcqJNfO++lvYmElbEXGl22IB6sweAu183OQsOFWfGoZrdXJHmD2rzNPp7ErJst80JSCfJXAhWanbckB8L+fT73Zox0Rbf5M1m0WfxhHjsgiV129IbKlUQe/SAGvhLH7pfKfBtx+QALwSv5o=;25:Ls8X7KG2qxD+Jq5Bjf5J8DTLJ0ZRTChmxxFDBY7Tzt0hg37rfEkqrNsBD00fv1xMQV8gDwdcA53a+SZ4FxiPQzRFqWRhqYY0piDe7B3S2te1olZMuOe8XISmiImyczpv5iyJF3YQx7fU0L1WJgIy6B4CH+CnnIGHWmYnC286Oqyy7Euds2FDO2VeiS6EUrK7MUQltYdbD8+79XSpRGECO2rnjqZOfOqWvW5JiKNybUOAHROWUQ86I1HzLgn92henRGKEBvnIgFbzdGithKB08lnhdokC5OLZ1o3u3848tE223Svu1Js0evN5lmyvVDVY7OlqcY+AUbyP+zflFG3T0A== X-MS-TrafficTypeDiagnostic: CO2PR03MB2358: X-Microsoft-Exchange-Diagnostics: 1;CO2PR03MB2358;31:/Wdh33UJtx6O/T+scGv8G4UsdqCyEQpO696qUEIWUllQfI0DGReGnKHSe2Cwuv/O4BHU664LcDBBLG/+VkaEFDgg6FR40AHLkH4h3lfPDcLpylksoaG//gXbxL9JxhPYKUHNYY9LnSDf9zFvUSurOz/WlHlMp4wARtGvjIuFz/8vLSdz+bCxLRuodc5X2YqO5OsHCAIipbVYGLsiYG6u25HTfYkvmpefSV2idlKgchg=;4:udh3kAasPgVz76l8Dcp8SX1asd3ig4c4vjLLwXlMigC22sEHR8LZ0XFiWfMo/WBn4Lnz8VdZLHZ1UXf2wGQAkmsmud0PZBdXNnPsPyGoXltceKOvnBvIDrkiNYp3waeCK5fXedlHIIqbIRBx/eq57pLzvt9/aa5tNyM1Fc96WzIQSWr+gPMHkdZ2RufrQ9lzV+PY/mkqRgBCUqdCWFRMhpf/FbQlSc+TDaaJGsa8MlXgugrX3B2KV8A61O9wQkLQqiifNcJc/Obz1kLuL7haKtmpnN3eOda6uyn9W3mnTAqjMtDW6II4deM0DOUEmMVp X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6095135)(2401047)(8121501046)(5005006)(10201501046)(93006095)(93001095)(100000703101)(100105400095)(3002001)(3231022)(6055026)(6096035)(20161123559100)(20161123561025)(201703131430075)(201703131433075)(201703131441075)(201703131448075)(201703161259150)(20161123563025)(20161123565025)(20161123556025)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:CO2PR03MB2358;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(400006)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:CO2PR03MB2358; X-Forefront-PRVS: 0492FD61DD X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;CO2PR03MB2358;23:LvgYRRow0nk5G9vcqQmnyBfOWREafnBXQlkx/324B?= =?us-ascii?Q?wY2q1MAxHmvVIo72frkgeaGrgxaJZHMKMvPXIPL0ADKbS8uQGrbMdH0Jp/nh?= =?us-ascii?Q?dFNN/IMzAIXbdm9X1VpFiKdWR80oZgm8i3JLz0J3JInBbwIt3deAMc0j9q4s?= =?us-ascii?Q?E3CwsbaMOzGOyUj+Xsul36yeaqU5CjwEfSeAzVzdf1hBD+LBsAZY9eCee+GO?= =?us-ascii?Q?7d7zyU3GAhW6bZjU4GgiIi0eODtSEj0fc863YWFp4npyEAAwodu9QCMwTOoX?= =?us-ascii?Q?5uPsKg/WyCbv65yq7KpPAgL8wcCZeYbROWA+ZfcwG9wU6yR2l7e7LW3sW28U?= =?us-ascii?Q?amDHvNajbuneLzO4BnhQhvtFUC2pbRJQHKOye6Oo34l5gweNIC5NhWTLW0ap?= =?us-ascii?Q?B9G/cELyGU03/SPwPzuFqut8VuPB4mnCGJ6QxKSGXxDMDKLCeoxEJE8J3dw/?= =?us-ascii?Q?dzCNgwM9jAKQALv9CwfuVNuJPdVDSo4gCXHKx4LczNexncPeDO9ChVypCisn?= =?us-ascii?Q?lMWMayGp1pY8M9tAc6seyqxoNuSXZ6DaOzjmcwg6BIK68KNGUHbhJvI9opi5?= =?us-ascii?Q?tjguZiL6E+LVKoSC0F4K8tlSTFz26nKpL/o7ldKnyOaeN7nYMoRQO01lMBz5?= =?us-ascii?Q?A/NUBLh9w7L+3mdpZ6GHkCePjE4DxmpZbYLAKbFmnK6iuWAqEuBozq46H2W4?= =?us-ascii?Q?fj6EfHEv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kNbluo5rNuUqNeV3xfhvHYzuonqB6vwzXbtmMb69crk=;24:bgiLFZMQfEZgtWNwh5EmSdXE4B8mR3GdKeyz2iSOynXCtAEhzBhMYToY9wCpxECtR6OHtV8rA4iismyYnwSNnVzyo8a3fmyDY3eOlcaRMNU=;7:ka0CNT6lDoyAR/6B1EFdF7LR9ypylIC/hs6llZrw4KIJFg5P3jOzDV77M7HoJjjnRlwq2vbEGgkybKUDbS3+GUVN1CXfxD/3RkrON/0OfYcCM3UzcCZ7/AXZL0Qgvqi6jo61gkUDQy9gUAckjVBXOtq6z+dq8W2+FZqgSGuFAYjk28mEmQHmfgSKOTIDTN9OK4zikgP1yVU8vftDRi2qYCDmVPv9LKj7a+xCiNLsGPALbIUTaebr397aVrb6Owul SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Nov 2017 06:23:44.9842 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 87335072-f6a9-4c2a-97b2-08d52bf16c96 X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;Ip=[192.88.168.50];Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO2PR03MB2358 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add support for USB3 snooping by asserting bits in register DWC3_GSBUSCFG0 for data and descriptor. Signed-off-by: Changming Huang Signed-off-by: Rajesh Bhagat Signed-off-by: Ran Wang --- drivers/usb/dwc3/core.c | 24 ++++++++++++++++++++++++ drivers/usb/dwc3/core.h | 10 ++++++++++ 2 files changed, 34 insertions(+) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 07832509584f..ffc078ab4a1c 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -236,6 +236,26 @@ static int dwc3_core_soft_reset(struct dwc3 *dwc) return -ETIMEDOUT; } +/* + * dwc3_enable_snooping - Enable snooping feature + * @dwc3: Pointer to our controller context structure + */ +static void dwc3_enable_snooping(struct dwc3 *dwc) +{ + u32 cfg; + + cfg = dwc3_readl(dwc->regs, DWC3_GSBUSCFG0); + if (dwc->dma_coherent) { + cfg &= ~DWC3_GSBUSCFG0_SNP_MASK; + cfg |= (AXI3_CACHE_TYPE_SNP << DWC3_GSBUSCFG0_DATARD_SHIFT) | + (AXI3_CACHE_TYPE_SNP << DWC3_GSBUSCFG0_DESCRD_SHIFT) | + (AXI3_CACHE_TYPE_SNP << DWC3_GSBUSCFG0_DATAWR_SHIFT) | + (AXI3_CACHE_TYPE_SNP << DWC3_GSBUSCFG0_DESCWR_SHIFT); + } + + dwc3_writel(dwc->regs, DWC3_GSBUSCFG0, cfg); +} + /* * dwc3_frame_length_adjustment - Adjusts frame length if required * @dwc3: Pointer to our controller context structure @@ -776,6 +796,8 @@ static int dwc3_core_init(struct dwc3 *dwc) /* Adjust Frame Length */ dwc3_frame_length_adjustment(dwc); + dwc3_enable_snooping(dwc); + usb_phy_set_suspend(dwc->usb2_phy, 0); usb_phy_set_suspend(dwc->usb3_phy, 0); ret = phy_power_on(dwc->usb2_generic_phy); @@ -1021,6 +1043,8 @@ static void dwc3_get_properties(struct dwc3 *dwc) &hird_threshold); dwc->usb3_lpm_capable = device_property_read_bool(dev, "snps,usb3_lpm_capable"); + dwc->dma_coherent = device_property_read_bool(dev, + "dma-coherent"); dwc->disable_scramble_quirk = device_property_read_bool(dev, "snps,disable_scramble_quirk"); diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index 4a4a4c98508c..6e6a66650e53 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -153,6 +153,14 @@ /* Bit fields */ +/* Global SoC Bus Configuration Register 0 */ +#define AXI3_CACHE_TYPE_SNP 0x2 /* cacheable */ +#define DWC3_GSBUSCFG0_DATARD_SHIFT 28 +#define DWC3_GSBUSCFG0_DESCRD_SHIFT 24 +#define DWC3_GSBUSCFG0_DATAWR_SHIFT 20 +#define DWC3_GSBUSCFG0_DESCWR_SHIFT 16 +#define DWC3_GSBUSCFG0_SNP_MASK 0xffff0000 + /* Global Debug Queue/FIFO Space Available Register */ #define DWC3_GDBGFIFOSPACE_NUM(n) ((n) & 0x1f) #define DWC3_GDBGFIFOSPACE_TYPE(n) (((n) << 5) & 0x1e0) @@ -859,6 +867,7 @@ struct dwc3_scratchpad_array { * 3 - Reserved * @imod_interval: set the interrupt moderation interval in 250ns * increments or 0 to disable. + * @dma_coherent: set if enable dma-coherent. */ struct dwc3 { struct work_struct drd_work; @@ -990,6 +999,7 @@ struct dwc3 { unsigned setup_packet_pending:1; unsigned three_stage_setup:1; unsigned usb3_lpm_capable:1; + unsigned dma_coherent:1; unsigned disable_scramble_quirk:1; unsigned u2exit_lfps_quirk:1; -- 2.14.1 From 1584380897651737690@xxx Sat Nov 18 05:36:09 +0000 2017 X-GM-THRID: 1584380897651737690 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread