From patchwork Fri Aug 7 07:15:47 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Chen X-Patchwork-Id: 6966571 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id AC8B2C05AC for ; Fri, 7 Aug 2015 08:32:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C2BCA2065E for ; Fri, 7 Aug 2015 08:32:38 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D29C120658 for ; Fri, 7 Aug 2015 08:32:37 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZNd1y-0005gD-Dx; Fri, 07 Aug 2015 08:29:34 +0000 Received: from mail-bl2on0114.outbound.protection.outlook.com ([65.55.169.114] helo=na01-bl2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZNczh-0003e5-GZ for linux-arm-kernel@lists.infradead.org; Fri, 07 Aug 2015 08:27:17 +0000 Received: from BLUPR0301CA0001.namprd03.prod.outlook.com (10.162.113.139) by BN3PR0301MB1217.namprd03.prod.outlook.com (10.161.207.17) with Microsoft SMTP Server (TLS) id 15.1.225.19; Fri, 7 Aug 2015 08:26:50 +0000 Received: from BN1BFFO11FD035.protection.gbl (2a01:111:f400:7c10::1:136) by BLUPR0301CA0001.outlook.office365.com (2a01:111:e400:5259::11) with Microsoft SMTP Server (TLS) id 15.1.225.19 via Frontend Transport; Fri, 7 Aug 2015 08:26:49 +0000 Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=freescale.com; freescale.mail.onmicrosoft.com; dkim=none (message not signed) header.d=none; Received-SPF: Fail (protection.outlook.com: domain of freescale.com does not designate 192.88.158.2 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.158.2; helo=az84smr01.freescale.net; Received: from az84smr01.freescale.net (192.88.158.2) by BN1BFFO11FD035.mail.protection.outlook.com (10.58.144.98) with Microsoft SMTP Server (TLS) id 15.1.243.9 via Frontend Transport; Fri, 7 Aug 2015 08:26:49 +0000 Received: from shlinux2.ap.freescale.net (shlinux2.ap.freescale.net [10.192.224.44]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id t778Q8lB019852; Fri, 7 Aug 2015 01:26:45 -0700 From: Peter Chen To: , Subject: [PATCH v3 10/10] usb: chipidea: add tx/rx burst size configuration interface Date: Fri, 7 Aug 2015 15:15:47 +0800 Message-ID: <1438931747-25209-11-git-send-email-peter.chen@freescale.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1438931747-25209-1-git-send-email-peter.chen@freescale.com> References: <1438931747-25209-1-git-send-email-peter.chen@freescale.com> X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD035; 1:sQ49b9HVvYF/7gCVCd+t6JCVH799bWncvQFQk3+wHF9KcNXJXsbKezIsxmmq0PquOqQM1mne5rRqsAD8qA3Blv9g7JwOwBfstCdlCvHbRHm4JTWoWRJjhKLMux6T8qLdcXQXaQeEHRF0iQcFpfAex29nIVYLBAfHqCNTru/wBLlKGm3/HDL5uxDWQigvsW2JIijCEOkWpeQww63ErT0y7FMSmt5uPhS+ZB3xpq6jXJq/bhrtImsoN14xg7z2Y036jbyMLHa8gzYQHAGtEh5RDDKzMuozGT9jukBS8y/Vwg29L6vW1cSo/OfjRdVaSAAdsWbwK6031/5R2xSyW6lyIQ== X-Forefront-Antispam-Report: CIP:192.88.158.2; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(2980300002)(339900001)(189002)(199003)(86362001)(50226001)(19580395003)(6806004)(19580405001)(69596002)(85426001)(5003940100001)(87936001)(46102003)(77096005)(5001860100001)(2950100001)(92566002)(68736005)(106466001)(62966003)(105606002)(104016003)(229853001)(77156002)(33646002)(50986999)(76176999)(36756003)(189998001)(47776003)(5001960100002)(4001540100001)(107886002)(64706001)(97736004)(81156007)(5001830100001)(48376002)(5001770100001)(50466002)(4001430100001); DIR:OUT; SFP:1102; SCL:1; SRVR:BN3PR0301MB1217; H:az84smr01.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Exchange-Diagnostics: 1; BN3PR0301MB1217; 2:/1F69Td0MbNWHokPf/Qqz3kfte1uKs2KfVbA9Q4MzKHX7NZTMkqnfKpu5/X/oVreMf4eqThHRM3wrSTg8wTgj/PjG67Ih0gAJQenvk0TB8CUeSEB461E+k16sB9Fj2DlBcoWdAArJmW4/HoTQKaVlJStPwV0nihwuxOoBX1kSTE=; 3:gRzRDRp0J3MTG/C7nDAdAT/d8GJxaWLJ6ASv8gXVgZgJpsCTeBNC0V/3NcNPiERfXCHoRkv+4dl7Xbds2TDrzJZR8IhvFuglnBn2f4sAdJHEie/NcTW6Kx1gqrZV4k0SgoSgreIOBC0Oh682h0tRuA1jhHdxT+d1Y4FbnifLBqNRhgEoQMJwFgpNZmokvdjV/6HMcAc13yCvCMAv6yRHDWFv3clgGDhdPBCm/UWldOE=; 25:m/oU3hMlLlBXVhfRWpWBfChzmsbuE35EO70iwGhia/2mjIqa+KEVhWdAF6Zq7bf4belgzcCfdoaUSnmdgflGpFN4h+6YhO+E9/L51StGbUO/pjfcNeXEZHqey60QUsq0eIkgDvCgT7U0DDHJfcue4aN5L0o7CH6phJ+JutGCniKJ0hCVrvgA8erBj9Us3XijosM9kULHZUUdedn0ACvKJjVF3MPzHAoGrvmBtfw+Qslpe/n72I5zVukFSpTRWS1b X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BN3PR0301MB1217; X-Microsoft-Exchange-Diagnostics: 1; BN3PR0301MB1217; 20:gWIxU+8uWaZbP8AOEfdkOt+vJNOXglcJyS5ANELCxv1+C+Hjm0AQfc5TBVJ2If0FnrUPcDK1AACzZWo6f2druU5NrWRxUX+c0idz5+do4uQtDKeRsaWw6V740ma+J5Q2/H091lz3LJyFI8fDhbOV8XaAnJS9WpNQhbkzqW4SEA1uGjJLXisJdUcA7qW1XpKfm+WOO2zmkYHtuzmGsFBfcj1xeZFuccN13yztqYXoEJqM/rkLI9YNZx/vP+T/CbrSfcopABw/lq7gPX8UA/aBYANyPZ7inCQFIK1x4w+Au68ObbkVjWQTaCgT+nV4wOlWBxP1YeYmxcUKnHWTNIxlyEjJNVRkIvxF//iDVymWgsk=; 4:xY+oQkmeIlRP+sC6XPKMJWdn+5yXVrKt/mKZ/FMasZHOd3Jb90NZxQWWIr1HdO3S6sYp9SnfU++sd2dryCY7jIjeiSp5yV9SYjN41R4lTkJDS8idpoKEWmMh+vszoomAoCssJsCW18smVMAWnaA49/+TfisS4cj5RdDXQ2+jltWPe2zq/mdOBwhD13GKbJI34pdXhNpziNa1ZzbxPQDvWNyw940bL3gywXrCQsDv9k/MOOVpS70wVTC2JhxZYpsFrXYCvFmUx/ak3mBCxm+9Q0nhsPmXpadsQyXeFs5K9sI= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(5005006)(3002001); SRVR:BN3PR0301MB1217; BCL:0; PCL:0; RULEID:; SRVR:BN3PR0301MB1217; X-Forefront-PRVS: 066153096A X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN3PR0301MB1217; 23:EQfDHmnygtk/ZuJ/Hi6H+FV+idwyxoJbKFt4LPy?= =?us-ascii?Q?1ldGDu2Sqkmh8gCb/Ws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q?9vRNO4ZghBQMj7BM9jclFi7bd9PxWYGK1LTttd4gkaNNfN4wAUdvLMGiTAvA?= =?us-ascii?Q?OHGr+qOlLl9kDOw9RyjivYulpiWNe7ybs54XNh5HcCp6ez1QtqwahxFfsT9F?= =?us-ascii?Q?5qNKQjpLGbI6jwus+ZDTeyJyO7kaHczDHmJsMmlMDJIqprMaoWRuAY5rcgs/?= =?us-ascii?Q?eAQjelArBFE/ImXwPiQhqCI/kNxGM4Q6tTiQDqbTstF4y2TZPR8I0xg=3D?= =?us-ascii?Q?=3D?= X-Microsoft-Exchange-Diagnostics: 1; BN3PR0301MB1217; 5:tqWx8/6lXHJiR5i7YJo8UWjeJAp16yStuvPUx4DCv9T9frp9SXdb68BDQ6ZDSCYC2JulNeZ6TW5qI9ILo4Bhk8EqA4gaGOEuo1fb40GMA9X7klWUnX/RjyQIqXMOmVYKkywqrlVw4KW8BDZa0WEAlg==; 24:sy6BQ908zkQrzk15Erxi5FPUe/qqJS/B1iC6oVMOysGXgbJh79RIdAA5fYs4VAurhzG47otOT7blFZ2f0zQKzuIFCwm4Uss+olA1NRaN1Uw=; 20:mpX04EiSIjoYZ28J3FGouu1kM++11JWM1A44DT5xw0CLXPgavq86jX+Z/5xiCSBDu79soZiZttKswYlgo37E7w== X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2015 08:26:49.4963 (UTC) X-MS-Exchange-CrossTenant-Id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=710a03f5-10f6-4d38-9ff4-a80b81da590d; Ip=[192.88.158.2]; Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR0301MB1217 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150807_012713_994797_3252827E X-CRM114-Status: GOOD ( 17.53 ) X-Spam-Score: -1.9 (-) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, devicetree@vger.kernel.org, linux-usb@vger.kernel.org, pawel.moll@arm.com, gregkh@linuxfoundation.org, s.hauer@pengutronix.de, jun.li@freescale.com, Peter Chen , kernel@pengutronix.de, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.3 required=5.0 tests=BAD_ENC_HEADER,BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The user can adjust it through dts or platform data Signed-off-by: Peter Chen --- drivers/usb/chipidea/bits.h | 4 ++++ drivers/usb/chipidea/ci.h | 1 + drivers/usb/chipidea/core.c | 35 +++++++++++++++++++++++++++++++++++ include/linux/usb/chipidea.h | 4 ++++ 4 files changed, 44 insertions(+) diff --git a/drivers/usb/chipidea/bits.h b/drivers/usb/chipidea/bits.h index 462ad02..e462f55 100644 --- a/drivers/usb/chipidea/bits.h +++ b/drivers/usb/chipidea/bits.h @@ -61,6 +61,10 @@ /* Set non-zero value for internal TT Hub address representation */ #define TTCTRL_TTHA (0x7fUL << 24) +/* BURSTSIZE */ +#define RX_BURST_MASK 0xff +#define TX_BURST_MASK 0xff00 + /* PORTSC */ #define PORTSC_CCS BIT(0) #define PORTSC_CSC BIT(1) diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h index b562544..41d7cf6 100644 --- a/drivers/usb/chipidea/ci.h +++ b/drivers/usb/chipidea/ci.h @@ -51,6 +51,7 @@ enum ci_hw_regs { OP_DEVICEADDR, OP_ENDPTLISTADDR, OP_TTCTRL, + OP_BURSTSIZE, OP_PORTSC, OP_DEVLC, OP_OTGSC, diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index bde49f3..3feebf7 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -86,6 +86,7 @@ static const u8 ci_regs_nolpm[] = { [OP_DEVICEADDR] = 0x14U, [OP_ENDPTLISTADDR] = 0x18U, [OP_TTCTRL] = 0x1CU, + [OP_BURSTSIZE] = 0x20U, [OP_PORTSC] = 0x44U, [OP_DEVLC] = 0x84U, [OP_OTGSC] = 0x64U, @@ -109,6 +110,7 @@ static const u8 ci_regs_lpm[] = { [OP_DEVICEADDR] = 0x14U, [OP_ENDPTLISTADDR] = 0x18U, [OP_TTCTRL] = 0x1CU, + [OP_BURSTSIZE] = 0x20U, [OP_PORTSC] = 0x44U, [OP_DEVLC] = 0x84U, [OP_OTGSC] = 0xC4U, @@ -441,6 +443,17 @@ void ci_platform_configure(struct ci_hdrc *ci) if (ci->platdata->flags & CI_HDRC_OVERRIDE_AHB_BURST) hw_write_id_reg(ci, ID_SBUSCFG, AHBBRST_MASK, ci->platdata->ahb_burst_config); + + /* override burst size, take effect only when ahb_burst_config is 0 */ + if (!hw_read_id_reg(ci, ID_SBUSCFG, AHBBRST_MASK)) { + if (ci->platdata->flags & CI_HDRC_OVERRIDE_TX_BURST) + hw_write(ci, OP_BURSTSIZE, TX_BURST_MASK, + ci->platdata->tx_burst_size << __ffs(TX_BURST_MASK)); + + if (ci->platdata->flags & CI_HDRC_OVERRIDE_RX_BURST) + hw_write(ci, OP_BURSTSIZE, RX_BURST_MASK, + ci->platdata->rx_burst_size); + } } /** @@ -660,6 +673,28 @@ static int ci_get_platdata(struct device *dev, platdata->flags |= CI_HDRC_OVERRIDE_AHB_BURST; } + if (of_find_property(dev->of_node, "tx-burst-size-dword", NULL)) { + ret = of_property_read_u32(dev->of_node, "tx-burst-size-dword", + &platdata->tx_burst_size); + if (ret) { + dev_err(dev, + "failed to get tx-burst-size-dword\n"); + return ret; + } + platdata->flags |= CI_HDRC_OVERRIDE_TX_BURST; + } + + if (of_find_property(dev->of_node, "rx-burst-size-dword", NULL)) { + ret = of_property_read_u32(dev->of_node, "rx-burst-size-dword", + &platdata->rx_burst_size); + if (ret) { + dev_err(dev, + "failed to get rx-burst-size-dword\n"); + return ret; + } + platdata->flags |= CI_HDRC_OVERRIDE_RX_BURST; + } + return 0; } diff --git a/include/linux/usb/chipidea.h b/include/linux/usb/chipidea.h index fe3c8eb..a41833c 100644 --- a/include/linux/usb/chipidea.h +++ b/include/linux/usb/chipidea.h @@ -34,6 +34,8 @@ struct ci_hdrc_platform_data { #define CI_HDRC_TURN_VBUS_EARLY_ON BIT(7) #define CI_HDRC_SET_NON_ZERO_TTHA BIT(8) #define CI_HDRC_OVERRIDE_AHB_BURST BIT(9) +#define CI_HDRC_OVERRIDE_TX_BURST BIT(10) +#define CI_HDRC_OVERRIDE_RX_BURST BIT(11) enum usb_dr_mode dr_mode; #define CI_HDRC_CONTROLLER_RESET_EVENT 0 #define CI_HDRC_CONTROLLER_STOPPED_EVENT 1 @@ -44,6 +46,8 @@ struct ci_hdrc_platform_data { /* interrupt threshold setting */ u32 itc_setting; u32 ahb_burst_config; + u32 tx_burst_size; + u32 rx_burst_size; }; /* Default offset of capability registers */