From patchwork Mon Aug 27 08:21:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 10576621 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E5D011390 for ; Mon, 27 Aug 2018 08:25:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CF15329798 for ; Mon, 27 Aug 2018 08:25:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C270B29807; Mon, 27 Aug 2018 08:25:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6014D29798 for ; Mon, 27 Aug 2018 08:25:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=vCp2rg0rn1cKW2pLYGnI0dhOFo9NchA7h5RJ/s9Ut0g=; b=fN0LiRmAXkZ2Fz ZphlGEveVSXXLcgMTaD908SakdNhjI+54mFwPlvQ6xx7/o/1sgfrFjiuZFjoFT+AbAYVoXhtYB+nW /hDrd4H9kLOwmiGG2muTQDD5RYfpII3yqK2Pg7b7UQo901L+x+LoBvwwJgOoSr7sm3lYLTufdpWHh qAXNThDCmUX78QJ29VjJFOzrI1s2MlUN4skDbOLuHTM+X8Zdcv2SJge7v13jfw4pilB8TtyxMPIi8 6vBr/RJS+R11i4x3Nmc67zQiyq96kU3obKpKTbg8VFIraXNKxGmKhM1gU3Wct/p0xWQZ7eBG2eWLj BqFHub/UAnmmGjFHyi+Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fuCpW-0000HG-TV; Mon, 27 Aug 2018 08:24:58 +0000 Received: from mail-sn1nam02on0042.outbound.protection.outlook.com ([104.47.36.42] helo=NAM02-SN1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fuCpT-0000FO-E5 for linux-arm-kernel@lists.infradead.org; Mon, 27 Aug 2018 08:24:57 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Synaptics.onmicrosoft.com; s=selector1-synaptics-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Yvprez3azRSi1qUZTkuWZTzIjc29OUayx4JB5SrF0mI=; b=qsSTXArLzFiEQMs8TXi6Be+X3lm6XVc+9b49vWK7o91k9JXjg94w1qbDOYRFx2fW+14havvtz0t+zWj6E5dLhJKg0DCw3/Ywcp7AgyItVXaOeefLHpTHBa6dKYYYUtJbTvShXCm1rAKenvnHhuwzvvfkTtbwuXt70eSPNtP1CSA= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jisheng.Zhang@synaptics.com; Received: from xhacker.debian (124.74.246.114) by BY2PR0301MB1576.namprd03.prod.outlook.com (2a01:111:e400:526e::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1080.17; Mon, 27 Aug 2018 08:24:38 +0000 Date: Mon, 27 Aug 2018 16:21:35 +0800 From: Jisheng Zhang To: Adrian Hunter , Ulf Hansson Subject: [PATCH v5 1/3] mmc: sdhci: add adma_table_cnt member to struct sdhci_host Message-ID: <20180827162135.46285a72@xhacker.debian> In-Reply-To: <20180827162026.3901de27@xhacker.debian> References: <20180827162026.3901de27@xhacker.debian> X-Mailer: Claws Mail 3.17.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-Originating-IP: [124.74.246.114] X-ClientProxiedBy: TY2PR0101CA0012.apcprd01.prod.exchangelabs.com (2603:1096:404:92::24) To BY2PR0301MB1576.namprd03.prod.outlook.com (2a01:111:e400:526e::18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7e0d59fb-6936-4f9b-7aa3-08d60bf6886d X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:BY2PR0301MB1576; X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB1576; 3:vbQn9cG/t1Ibfkup3B+bLEK7XvWPA0uHATLw7BlYtfs8JUnx66g2aGkg4SkLANG6zaIjU26/NR2GOSwUt2iN0ALNUm6gojP8tCE+Ti6cYpImRggfQcZJp/PDnC72AnFDg6tG+D3heHkw6nO7qZ3CbD79yf/wN7TRZ0yn9StnfH3BRUNQsq1Ll+pAaK3p2NuqDcSWo72xpJ3dcWBBtFxYM4BfSXrwTE/f27qvkaQvbvnoBLepbW9Lul+u1X/hN3nk; 25:eRihxTRPRoF/F4/x+e53O1j+EuO+BroIFZgfddD+auTz1s8A6uG+wGMzVpkRd4XzMdN0c6VTZVRJqJzMirHLtYW/n9tfnTt2h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PJIxkS; 4:HCQl7JCpaVYYG28pppDrtrrm/1Vz4SbFP+FbaYU3ZfpQU3GU22Zw3a6J2aiExM9x2sVX0+ppCgEWpZlTH6kqQK+0LsDLhQ5xb/8kToj2c10G1ObMb6SA5/MOnhaEvPYow8HSy/E8epZ0PfcK0sd3sbKjlQLajI58HcJG3TBsBNGEVhd6v1GTK04uxjuMb5IxQ4Ee/TM+WqghTVNvrZ0YNGr7FPZAEdr0R66vk5Iai5RxB6x9O847XAjjvWxjJF5DYn/ppBsbuDUbTCESUPFLSnRlJ+khBG0+lHR84FA3itzCNs1EkksQDs5zP5kom9fx X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(228905959029699); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(3231311)(944501410)(52105095)(10201501046)(3002001)(149027)(150027)(6041310)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699016); SRVR:BY2PR0301MB1576; BCL:0; PCL:0; RULEID:; SRVR:BY2PR0301MB1576; X-Forefront-PRVS: 07778E4001 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(346002)(39860400002)(376002)(396003)(366004)(136003)(199004)(189003)(956004)(50226002)(8936002)(66066001)(476003)(11346002)(446003)(76176011)(5660300001)(6506007)(386003)(33896004)(7736002)(305945005)(81166006)(81156014)(8676002)(575784001)(26005)(7696005)(52116002)(2906002)(68736007)(16526019)(186003)(86362001)(23726003)(1076002)(230700001)(3846002)(6116002)(4326008)(25786009)(6666003)(110136005)(72206003)(54906003)(55016002)(50466002)(53936002)(486006)(47776003)(9686003)(478600001)(97736004)(105586002)(106356001)(316002)(39210200001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR0301MB1576; H:xhacker.debian; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: synaptics.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR0301MB1576; 23:6bZFRffa1HNdiz+Bt6VXBtmM11MaE+7HvJfnMAk?= 3H6jlfDMxUIRsSRmXCITz1jHEg9YubRY4wuzwR6QzAcCuKLjfZixgXVBa1wMYFJ6CLKBMv6IHWrz8Eyn7laV6QYAhgifUMEha6xroTEH/UJx2zB+x6mIa8uQTif/nsV5zWXHnxq+/JXxvP7ydHEqWELb/Px53BmMdktQ+0g3iYCRZxwFM4pA/z9Ghg8uWHx5ae8NUv5PBh1Oo9RnAEoSMebN2OQjwpLyilGdctMC/yFEiwleHZPRtgfLMRbVBCVLSj2/AvjGBmKAswWNkjbPod4SgfbYokwWNdL+0Ah1lOIndG2hQBelynfLTg0Z25xLpInCBb8uVqVdXYJbW26Ro3Kft2Ks01xNDJIbW+e2k5W+rYNmMaNX72ReSXpByHnjSoYBgw3EJA0gBFBxmvax5RXEzp9XqRuo71jdpiMUMtFUaR/W24hEhnoETZ8/T7VrsHjcwPKeeXd629SJZ/6e/ZtDN6IsBNceiFZqFCyqh3iQ0+86JUzqW7VaYYJ2g3fQPX582KLXtIteWs6S/Xs4KoYz+77ggN57G4+qHxgEW/hJq62CxXUgLn1eY4DvmWexoFgJR3ol1c7D/jvlohT64baU03f30X5colNla0OFGgqw2cqXFjZqu2wgo8NPvrIAUUjIvD5fafdcox6zewpkaEJOhiTPj7RfNg8nM+grvKx0k2PL6V3SM6DnD9inx/rJvJCsQjqIIudzDG3gim7bba1EQNmEdhgpYzNoFma0umdxh5lID3uAu12ITA6ltjhMudOLhJb4WRVetut+HYznWTHv57Pvhn1C8XQqqYVXAYF9h7dWbSHVTykWbCS/eZ5EOAeZkIhqgfS+asrVAIdqUU+aqEOUMtThMvODVc2rrnxSk0fFdYHx4idh0nd3HZ5XB5IONweLzat3qrwkUxVOE7/GbOBfjGX0tWILXMXe/1pCew/qyya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8PziL60b3gdxdWdTQzRuJFZyxgpmlo7SUu6SnJEEvGygSznQYd+pDBP3LNyRW9yhWv4uX0KNqe+YOQPCDV1nMJtxm9rhQ2WYJhR8qmKveKCy/ZAIYx8Ew==; 5:wRfAOp9Hj88L+Ixi+sqf2HGkHfih/gKoSmfLg1eNgFIqG2yr/XS2QMVdw+mdKjB+yZ537++zVivIZz//ZEjoUSoQj1MF5ZfWy34DHuRvzQkS8hngIWuLXgcuydmij2hvyON3CqIauZctmmGM5GnOsmeF+jTuytHgjM3Uti/dalc=; 7:QvkPqZecM4koT3ouTbPjgngJdVdhOWsMPJIJ9++y+Kn2v8XycRX/WUCMdPxSx7SVMeWJvl2rbXy77P2otQx55kynFY5DjyGpwZXqxVPeg8+9yzM1ygluRO1Eg3UP5fw8Y7Ax11fOMnz6k4wWeaiF4ztmYQM5rcG+KopBFIpi7E8LcSKYFqbvxcrDr64R96mKlODk/LRDjB/1Tkc0wpeQUracYutxZfz+YVaJzh0AUEgn47CsB7cEWglkaCqmiVeU SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: synaptics.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Aug 2018 08:24:38.1347 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7e0d59fb-6936-4f9b-7aa3-08d60bf6886d X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 335d1fbc-2124-4173-9863-17e7051a2a0e X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR0301MB1576 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180827_012455_543558_3196CEF8 X-CRM114-Status: GOOD ( 10.69 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, 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-Virus-Scanned: ClamAV using ClamSMTP This patch adds adma_table_cnt member to struct sdhci_host to give more flexibility to drivers to control the ADMA table count. Default value of adma_table_cnt is set to (SDHCI_MAX_SEGS * 2 + 1). Signed-off-by: Jisheng Zhang Acked-by: Adrian Hunter --- drivers/mmc/host/sdhci.c | 17 +++++++++-------- drivers/mmc/host/sdhci.h | 3 +++ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 1b3fbd9bd5c5..52ccf4644384 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -3322,6 +3322,13 @@ struct sdhci_host *sdhci_alloc_host(struct device *dev, host->sdma_boundary = SDHCI_DEFAULT_BOUNDARY_ARG; + /* + * The DMA table descriptor count is calculated as the maximum + * number of segments times 2, to allow for an alignment + * descriptor for each segment, plus 1 for a nop end descriptor. + */ + host->adma_table_cnt = SDHCI_MAX_SEGS * 2 + 1; + return host; } @@ -3567,18 +3574,12 @@ int sdhci_setup_host(struct sdhci_host *host) dma_addr_t dma; void *buf; - /* - * The DMA descriptor table size is calculated as the maximum - * number of segments times 2, to allow for an alignment - * descriptor for each segment, plus 1 for a nop end descriptor, - * all multipled by the descriptor size. - */ if (host->flags & SDHCI_USE_64_BIT_DMA) { - host->adma_table_sz = (SDHCI_MAX_SEGS * 2 + 1) * + host->adma_table_sz = host->adma_table_cnt * SDHCI_ADMA2_64_DESC_SZ; host->desc_sz = SDHCI_ADMA2_64_DESC_SZ; } else { - host->adma_table_sz = (SDHCI_MAX_SEGS * 2 + 1) * + host->adma_table_sz = host->adma_table_cnt * SDHCI_ADMA2_32_DESC_SZ; host->desc_sz = SDHCI_ADMA2_32_DESC_SZ; } diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index f0bd36ce3817..25bddd21de31 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h @@ -563,6 +563,9 @@ struct sdhci_host { /* Host SDMA buffer boundary. */ u32 sdma_boundary; + /* Host ADMA table count */ + u32 adma_table_cnt; + u64 data_timeout; unsigned long private[0] ____cacheline_aligned;