From patchwork Tue Aug 28 09:46: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: 10578125 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 B62395A4 for ; Tue, 28 Aug 2018 09:53:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A39DC28EC3 for ; Tue, 28 Aug 2018 09:53:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 91C8228F47; Tue, 28 Aug 2018 09:53:51 +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 B6E3728EC3 for ; Tue, 28 Aug 2018 09:53:50 +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=SmrPFfSvFBI1AE E77CqBa6YrEVRhexfut5SFPCLgZF+ou7WffFiSKXntCcBi43CpIDL7SNHzBFGQ9koi1YyvwhfAMkF nK1cU1Ap/pG+bUAMEpVpaamsaIQUT/j9xA2ytsD4Aa4zIcz5HvXWxJL7O7kSQVx588d6kIJ9aVDAC 3/w8XZS2UL4PMQrIGvYU8W0/uKWLCHp8aJufp4MhJfJQq2JTk+ETwp/lq1vyYinAsvD0kyxq4Zwrw 4hl+3oZVZNvaH+AsBps+3FHgXO9G0MFtUCEGpKQg4zCpvqL79sYudEzMSlI24SzFSbG0H8WqL4iw1 WajRDcGOnSp2edutE4yg==; 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 1fuagw-0004xu-AP; Tue, 28 Aug 2018 09:53:42 +0000 Received: from mail-sn1nam01on0618.outbound.protection.outlook.com ([2a01:111:f400:fe40::618] helo=NAM01-SN1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fuadD-0002Au-BG for linux-arm-kernel@lists.infradead.org; Tue, 28 Aug 2018 09:50:17 +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=ZM0Jrs/LxAza53Ha+CS/OWozCFwhrCFKzr8+9DcUxhA+Bajn/alSNXREzOOFXL6YPet49HZqdzNxeALgza1r33XAMrkI5HZll48E317EWA8Eyu2hdomgL/IYfbbkeos6nQgDUDqlTI/IMfk8/yjtaOw3N/4asvk2aIq7Z/s1obY= Received: from xhacker.debian (124.74.246.114) by SN1PR0301MB1582.namprd03.prod.outlook.com (2a01:111:e400:5232::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1101.13; Tue, 28 Aug 2018 09:49:36 +0000 Date: Tue, 28 Aug 2018 17:46:35 +0800 From: Jisheng Zhang To: Adrian Hunter , Ulf Hansson Subject: [PATCH v6 1/3] mmc: sdhci: add adma_table_cnt member to struct sdhci_host Message-ID: <20180828174635.4bba02ee@xhacker.debian> In-Reply-To: <20180828174534.00fb5e24@xhacker.debian> References: <20180828174534.00fb5e24@xhacker.debian> X-Mailer: Claws Mail 3.17.1 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-Originating-IP: [124.74.246.114] X-ClientProxiedBy: TY1PR01CA0198.jpnprd01.prod.outlook.com (2603:1096:403::28) To SN1PR0301MB1582.namprd03.prod.outlook.com (2a01:111:e400:5232::16) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ec7faa7c-b4d7-4e4b-5784-08d60ccb916a X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:SN1PR0301MB1582; X-Microsoft-Exchange-Diagnostics: 1; SN1PR0301MB1582; 3:KrZM2ycC0D+T8XfGsPMQ6fRaymIq4dN+6az3QC3F0RVmTTpTAbs0AbWiGW7RIrODtC+YZYUfTPHAk1ZqdXc7Vd9XI4AbWtLPBRl0QHmEAsV897/T/AJ1/CYzb27qs5CIHU5zExxeVu2mm91nUTnpLwlO0udhyQaLlfdN/nntuukask6s+Lsybv3sXimSAPJ2C8ihb+hnubz7bpdpY5mqAi217vHb6MSVQ+o4e6YPcCm7FBTheaiTXuVjA13eY97e; 25:vqbdGaBnlnN6s1XrsDzpoWeocZ8D17UgiPFQmfUL3g4Rq8oB7au036Xpk0EqDXVcwUop3T6oJhdy8RKpg0JOrh3ZPiy2D8EIethDAr8aLQcfFCTCGj6RiG+egj6zI7fw9s2Tswq67qsKbj4ugT8XURxUrMLzuwmZ5/BS2mkXxuTeFT+1A4hl0DUWg1r9Zx0Pq4dQk7TOzHIIGUdwtv7sxmO2W9JSAjF6+g6Ry3wnyW2AaUtfWlum1ls71SpN+4XIKYYN5LJg7aLnbUhWcRsQENpKmHCBdIWEAMHXi528W/be5gMQUpPFfr8IqdOLubSs9Ke6KXjydPN7/rZ5nXzDTg==; 31:AfojAZRVJU2bZkdoA7hDvNQHEwUiU4jYI1SL8Fi+bLhUfhF0molXskaNrCvQn9CWNvZXpOuf96xqEVGb36aarUCAowjK63yr8ueCV/cb7l77OebMfilF9UDAUeFJcAjW6kHMGTf2vgY3KFVbdbxHFU/lYkBPyTuuY25OHT6YyCA/plTyDK7Z42m8NSBIepBF0KF4A6sV/yAPAoT2CRI1jztENLos/vxgDP8J4I90Gvk= X-MS-TrafficTypeDiagnostic: SN1PR0301MB1582: Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jisheng.Zhang@synaptics.com; X-Microsoft-Exchange-Diagnostics: 1; SN1PR0301MB1582; 20:sNOiMhvDRwHB5SEwguS2Q8pLG3bz+8gHxBA2JykWi4RVd5rNNoctY711N2CIrsf/cnZeIdbz3u0ygBnqv5/huaKtUwZJE5R/oB2IxSLwxOE2+4+xz5UxwxhyXdhelJaRnlvKhui1pY+A+2HXmeOq+e+cYGY24Xqv6WtrGZa68u+jkFGRfO5nVqS3bCAvSu+CXysFZpSzEQmQI8fxWU8haw3dzwLRi7bq1ooxk4eSPEc7mINwFM2517J/FOsMVVOgukbPingryMee2yWA2H3qVNntVnIj5wg/i3/EzBg0/QTN/QYtfUZt/DXP4P9hgu5dhbwMnpkF2QdXxRcBNfpE0VunFcAsa39YIQf34XM552lnJzYscwdQ1iK4Qr8/djNGsLR+BnXpNbO40rciBtlN+GcobOPGxEkUp7zPFThfF8unksRFlfwzB752sn/qOXxfNNXFVpjU7lM8OGgiadx6hDexs9EIvKvlFXRDiMIFr/scklb8j3VICem7NHa+lIGD; 4:GsqhprybCCJCqXOesvVjAElgE6l2FC83l/eOkORceBycn+yKz4MkGhU0vyzmG3QgIMHifqZvMy3+LGZbUr2XR1bWfJo0o2BktTkWjfJALVCzp7g8rT+qZ1aGQWUgiFuTIOyLiJQfm3exkZQv7b2lkoEK7D52a8i3qiLv5nIU5ziZ3lVIyk9kZahdhJ41GUuxWA9k7PdYnE/CwZ22DW6lgksLCtqy/VdaF0QleU6q61w9XPRGpxAdcmIrQfUfgxnUXiAo2G4G+ET4uoNqhOdadmAoJneOuLzvus+dT33jqHwAGb3AG+WM1Ym+tldy3nlF 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)(8121501046)(5005006)(93006095)(93001095)(3231311)(944501410)(52105095)(3002001)(10201501046)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201708071742011)(7699016); SRVR:SN1PR0301MB1582; BCL:0; PCL:0; RULEID:; SRVR:SN1PR0301MB1582; X-Forefront-PRVS: 077884B8B5 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(39860400002)(396003)(376002)(346002)(136003)(189003)(199004)(50466002)(230700001)(68736007)(956004)(478600001)(446003)(72206003)(5660300001)(2906002)(11346002)(110136005)(1076002)(54906003)(23726003)(316002)(476003)(6116002)(3846002)(9686003)(55016002)(25786009)(7696005)(33896004)(52116002)(76176011)(105586002)(106356001)(50226002)(26005)(486006)(16526019)(186003)(7736002)(8676002)(8936002)(305945005)(97736004)(53936002)(6506007)(386003)(4326008)(81166006)(81156014)(47776003)(66066001)(86362001)(575784001)(39210200001); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR0301MB1582; H:xhacker.debian; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: synaptics.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN1PR0301MB1582; 23:ACgJkqnzwhWea39heknPzISFdgFhnO/6K4a+v0s?= mdDZ3IoJl49hhYzBeA6Vo40wUgpPbxzl0sPvF7R0477WZKUU2RGm8d5pNaiFQL3JS84lNohP4NO+2/ji5NBwy5T93JqoN/3hbsbAILdeKnQhuRKdOPDAz0sPWkxxKljfTomuHdAuUuDHz8FzEzjd3tuTR8lgeXUHtDM/8EW46a7LX1viAr5/ekoF4z60BT05KNWgC6wyCcNyaAc5aKZFyMF19Rpo8odgM5r7e1HWE6JdKK5TZ6XcSH1FBnsYAIcZJUVpV39ruGcuF6q8T8SJqNe4qkBpLBWq0BFyvk8UJwL5qGdAdMhbNVYXzyUB5TW/zY+CS73zUBBru8lPAqbmnG0u3+8KRWF1AIG3ZBXOs7kIAAUg6YjOtrh2KapMcsMGgDlk2KK9y1Y3GrLo9+9edve89p/HIm0QhXxoaBF2UCvNmi5HzPO1o98XfEl+Gru0TjkKkfzpNLaTHQTICOCiy9CuHoaIHnAOA7B2FvpdyoN35FNRM+wfeAEfr450eSIf03OmQC/F67HfNyhIue35DgEEuqRjbEgheKxLrB54CdpgirlWs0nsjfruEruEiAsSg3i9qFF7GcyinILiozm+tRQvvokR6P/EcPNDrYYbabKVHU3V9TVVGwA9YjuQzhRckAQZ3MhcMaeXdW+/q9I8nMNDob5cZsSD2mrbNSc+4BFB6G7zZPqfy1wPG93zGoNi+vamUuayZ+w6c/tvw4M9yp4Hup6CexfNoqG/hIchIdp/jiGmivAgQ/zC8+lMaTd9IM1Zr4rhxnd4JnmYNV0SysnSaa+qHYC94o+k2o1ozVdg97ZQbqE9JaFYnZckkaMkfLL0/M4/Slct3bD/Zc4uC1RngCq9CM8PSjwRb7t8KYztrpSRBHhFjv/JsIBKsr1Y4CJqcfbB45WRc7PIPqvCEZtwZyO4r3fcMMO+Mg9UQXmHvYTilxzXQdfNW/xN8dKXcZK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nKydgCOELJEVY0zoQIqSNVvgGIEGL3gCWba3BI/S/xx/AgwNopbX6czQtEEhncD2B+A==; 5:tS/hPn2M4dZoo504i/gX5KV21Zcn6nXhz6TbEG/mW8KWr79RmlAPa7eXKElvRwJdnC/VLzqgETxIrX5hfTB8gAQaKr6CT5PtTHNtumgWJHQGcJRgTRiuhaZr/kyorqSizdyzBt8T/PnmGu2bIn1+MBzAEDIsJmc7JZmeXS/oVQQ=; 7:fxu/mHlL7H+IWqT90w3KhSxNQbB3nIsPqpAFSV8C7mCo85Ko/KdGowOAiDiXdSDu3ZxQuR8fQFEt8M0/52BBzShGITRGfkttiswe5QruSSTss+JS8rWYQA3nhQAj4c4gySNEgKxuiHWF4hxufCda4ux9ZvVzmq/Ez5Fvp+5fdM/RgB+jk18tJPXt39ps7mCW/piq7E+BstG5CTHlYHPJoe/6usORTO/WOAEnzur/BCJRUccx9S39YyIbgg+ahBOM SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: synaptics.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Aug 2018 09:49:36.2531 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ec7faa7c-b4d7-4e4b-5784-08d60ccb916a X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 335d1fbc-2124-4173-9863-17e7051a2a0e X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR0301MB1582 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180828_024951_432080_C26D5D8B X-CRM114-Status: GOOD ( 10.25 ) 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;