From patchwork Wed Jul 29 02:42:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Chen X-Patchwork-Id: 6889061 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 0A33D9F380 for ; Wed, 29 Jul 2015 03:56:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0DC5A207B0 for ; Wed, 29 Jul 2015 03:56:56 +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 0FC81207AF for ; Wed, 29 Jul 2015 03:56:55 +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 1ZKISP-0008F4-9A; Wed, 29 Jul 2015 03:55:05 +0000 Received: from mail-bn1bon0141.outbound.protection.outlook.com ([157.56.111.141] helo=na01-bn1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZKIQQ-0006DC-3N for linux-arm-kernel@lists.infradead.org; Wed, 29 Jul 2015 03:53:03 +0000 Received: from CO2PR03CA0023.namprd03.prod.outlook.com (10.141.194.150) by CY1PR0301MB0860.namprd03.prod.outlook.com (10.160.163.155) with Microsoft SMTP Server (TLS) id 15.1.225.19; Wed, 29 Jul 2015 03:52:40 +0000 Received: from BN1AFFO11FD050.protection.gbl (2a01:111:f400:7c10::157) by CO2PR03CA0023.outlook.office365.com (2a01:111:e400:1414::22) with Microsoft SMTP Server (TLS) id 15.1.225.19 via Frontend Transport; Wed, 29 Jul 2015 03:52:39 +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 BN1AFFO11FD050.mail.protection.outlook.com (10.58.53.65) with Microsoft SMTP Server (TLS) id 15.1.231.11 via Frontend Transport; Wed, 29 Jul 2015 03:52:38 +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 t6T3q5pW011896; Tue, 28 Jul 2015 20:52:35 -0700 From: Peter Chen To: , Subject: [PATCH 10/10] usb: chipidea: add tx/rx burst size configuration interface Date: Wed, 29 Jul 2015 10:42:14 +0800 Message-ID: <1438137734-27311-11-git-send-email-peter.chen@freescale.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1438137734-27311-1-git-send-email-peter.chen@freescale.com> References: <1438137734-27311-1-git-send-email-peter.chen@freescale.com> X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD050; 1:pUpZ73haIjK/ph0lrU80TTJtcpl7XW1vtmN2AzlA2Fh8tfYXdZMwarWL352Yr6XrtDKH6dX6wkkw27nqMsYevbjUmzaYK7I1NP3qFW6PMHmj/9a5Bypuq3pdaOHB+l34aURKekHXXKy18gICanQzyrj0Ak+8henfd63I44J8a5l6i3oQf9U/hydl3kSEHaWblh7grg7Z61EdbyqJW3invuSwXPSQhXomERdapYmtfR7BrolfTRD8wxhVJdvZiX3pHhxyS7EVvGykEOEtIxjJCzZfDYCPkuM/FKTT19hvGM9muT90gX41DfteCYy+CCE4qVIaz8VF0QoDnDcm9FClmQ== X-Forefront-Antispam-Report: CIP:192.88.158.2; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(2980300002)(339900001)(199003)(189002)(87936001)(76176999)(104016003)(36756003)(229853001)(189998001)(47776003)(62966003)(105606002)(77096005)(2950100001)(33646002)(106466001)(77156002)(85426001)(5001920100001)(86362001)(6806004)(5001960100002)(46102003)(92566002)(50986999)(107886002)(50466002)(50226001)(19580405001)(19580395003)(48376002)(4001430100001); DIR:OUT; SFP:1102; SCL:1; SRVR:CY1PR0301MB0860; H:az84smr01.freescale.net; FPR:; SPF:Fail; MLV:sfv; A:1; MX:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB0860; 2:j4xfmZ46jQPJmfhmRGRReRnu1+NKS+a5IKKsXY36gPMd3sTgGlzhIgKwIdWUZA6cLm8H8FLkYAWFTfR5cWcoZqltYL7cyFowBsxjIjzRn5pGfQFpnkdaXcJjluLIqlmbbwTIVRevYoQTBchFWhfJfVRMq/CwHWrhmLzzRxB5tug=; 3:fl+EUhT76CwUuJK+lrYwKOcxjcawf5PTghgD9yJ3OmXjY5zI88owBOLfcYsmlVGR3z4MbBlwsY4iQuh6bQT4nnQ0ZW1lmxDoarbXv8kfSN+wy61S91pCiTgnbsMyxrbs8VA5PrD3h3zgUAzQszhLeSduEjjFQReJdKYYI+zjEkmwz75Y6aeNumM4GYPM2NPnb9GYj4OcBEeTc26/wZnhr25QdgARn2gBXhvuu3drp5A=; 25:aT1DRBrriQ1u2LT70IGV/h7UMZFOP8vIbU5IKDI6Z0f4N83oydKJbeHy0FlSzEY+2YWOZW2g/3AqDBlmwwLmPvlJI0qG/pvhQ1JGGukQSJ0RDBh77YIv5JaCsy36e/Kyr135ZgEbAndxYfROsatl0pFkN+0j25ZbOHgNyN89w4x+2qpqKV1AI8x0KPxqPahLrAn6QH4QxJFHmwT1UFfw6MKduKDGQs9Ts7L/n3Uij+RPrtJuJg1nJrS9PIIlkpBy X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY1PR0301MB0860; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB0860; 20:+SZXo2eaIH46knzo8Qn1UyLUXuMf+xD5XOSzDmbNr9yp/Q8Lt/uHqJ6jLmCYvEQ5EWcpyja1UO6+iJPfPMgAUfdwwYXAoyIVDkqMZx9X6ut+tP1qn9+rSep1F9igO3mmcC0vY1iIf0XbP36JzcQhXCz2hfWNApGP6IfpenNt9LDm/mF0TudJvqh+1pt+8FOWvKv5RRsgB46DeMz5H8WQZWks4Jxg73AI2qddEukDF97XP/NvITOomDyMA/9zUQOqPo2QZeelH6EDd8rLK32UioHOsFz6UR5aBRCqhR661QxVPxhCbP+++axqxO7AYtKv9UkPGtwawWHK6FnSL/1MbnaU/95AjZu/DtaZH4xuqtE=; 4:sa9emoCz9yQ7ySQlZCLoL/s/ZJAwVmOd33UwyWAqA9Uce5k0Z7lRjbMbovhy8nNdF7IwGW7qSThw6Hcu7tYtAGM4Emj5i+7JxqLFIDYtjqapTow8HGEsaHGYHFjjuLagT+l7HBq+GuovyyOmrcso4W2JscZhrEh2E1/I6hk9YTfmLRohh3i12xfNJEoAlOsyxL2gKR37w3y+dNpWReBIHqjURcjTL25j7vMgTuoo3fH7Da1Z3Q/kAuz2rfzD9TIAI3K1UbH4wqTRlq2gxdVaI0L57S9Mb+d0ICQZBCofkQE= CY1PR0301MB0860: X-MS-Exchange-Organization-RulesExecuted 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:CY1PR0301MB0860; BCL:0; PCL:0; RULEID:; SRVR:CY1PR0301MB0860; X-Forefront-PRVS: 0652EA5565 X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB0860; 23:fPbn1WpLtTKlYULtixeROZjnKU4A3nQa80VSokjpg3J7vlWUtS0bl61X1Hb700BFoVXYox2zqz1PWOQqGYSXj56ifsOYzYV/9bXEoagoS3QN9k5cosk9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bH7ae3yVpZCfF62R/G9yQwcF/T5Y5j189L91T0HHhbpbs/7aAM=; 20:rLbBsEYyAKrtFwio4iTuSRmW7eO0LMNwhUEdE73q7ytxOUI4ObMDJTVVSO4LF79JVqK4eZ0mWMNmKJhgj1suTw== X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jul 2015 03:52:38.8990 (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: CY1PR0301MB0860 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150728_205302_603305_6EE8C0AC X-CRM114-Status: GOOD ( 17.29 ) 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, pawel.moll@arm.com, robh+dt@kernel.org, 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=-5.6 required=5.0 tests=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 f60cbf6..0375412 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, @@ -442,6 +444,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); + } } /** @@ -661,6 +674,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 9848a4e..524ef3d 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_DISABLE_STREAMING (CI_HDRC_DISABLE_DEVICE_STREAMING | \ CI_HDRC_DISABLE_HOST_STREAMING) #define CI_HDRC_OVERRIDE_AHB_BURST BIT(11) +#define CI_HDRC_OVERRIDE_TX_BURST BIT(12) +#define CI_HDRC_OVERRIDE_RX_BURST BIT(13) 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 */