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; From patchwork Tue Aug 28 09:47:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 10578141 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 C0F6F174C for ; Tue, 28 Aug 2018 10:06:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AAEB2289E0 for ; Tue, 28 Aug 2018 10:06:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9E6CA29529; Tue, 28 Aug 2018 10:06:40 +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 06404289E0 for ; Tue, 28 Aug 2018 10:06:40 +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=RuCoym4FVi+RE5Tbz9XAEvmji4k9RYpgad8fyZEfDEc=; b=r3YY9uG3DcUGKl RdZSNkarQOxYwDUkyeDgzX/2uZzHAOq/xmx7X24enmybGXPGZtrFDeeLLOKT+67nc6IBxnUjxn4Ad rjHmOztBjBI1XMORrswdAut1YMxLK4ejoZh0/oV0HPYm7k7GxwvTivC+G63abpnvVABN8kvd3cZcM i2TL9oGYr78G+EnD65l1o9ZHrR2eyk5iyo8o9ymyTB640akn6Ka7magH1h29qoY3a8IqcW5ajGBFw +rbsBu5GS9Ajx8LTcpQ4CdB1tkhogHciA+5Jh52IKBwSuKTg5zLZF+N5PH1j9Wf/0K8XIQ5Sq53dY iHTi861VmHnvDAzBUTzA==; 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 1fuatP-0003h9-06; Tue, 28 Aug 2018 10:06:35 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fuatM-0003Zt-76 for linux-arm-kernel@bombadil.infradead.org; Tue, 28 Aug 2018 10:06:32 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-ID:Subject:Cc:To:From:Date:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=t34Jq3WRCfdlEWi8ntOQHsyGNkAU8Rm7d/6CzQM9b18=; b=np+pP3wcCy+Ir8oCR58bNJ7xqt izNVulcsMdu6AYGB6jdl9LHqwTBePFbKZ7yhEZKEK/vgE8ytsKhSlri6hE/FPVoI7fW8lH/EHdUZt j3GHVxXOy4/ofFmwbWpk1nGUfZz0c/uYIpc+i31l4skHQR/Pf4ps7SuqDsWx1YYcUhDi4fnbO+wMr wDgeiFrmE17EOvmrz2uP3rtI5IaGAhg9ii0O7LrAB/90rgv29Y2uT7TLPINZ4BscLJpIoPwCKxwYP B94KvAs1fxjaCzd1aV6n4z0HaeyaxXGmcFyfkXqE+BkYXKkn7gj3aQ/CjNwEpTObEFO2AYdyocmyb lSCmbheQ==; Received: from mail-eopbgr680077.outbound.protection.outlook.com ([40.107.68.77] helo=NAM04-BN3-obe.outbound.protection.outlook.com) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fuae5-0001nr-6v for linux-arm-kernel@lists.infradead.org; Tue, 28 Aug 2018 09:50:47 +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=t34Jq3WRCfdlEWi8ntOQHsyGNkAU8Rm7d/6CzQM9b18=; b=SLdvjRj33bu/GGe/ty3VplFAF8x8tlTp7GZgseUrXTjcaPfPNKFrNi5Jp1mLmhPsiMsJn0NvrNALR0OIGUfGTeQoga0Cvs+wr7S5eiwyW2BmDwZRtAD88FtJJVJaLAZ77ccumfgDQcs0ObKc5F7d3COi+RxksVsSMvH871LNZcI= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jisheng.Zhang@synaptics.com; Received: from xhacker.debian (124.74.246.114) by BLUPR0301MB1572.namprd03.prod.outlook.com (2a01:111:e400:52a9::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1080.15; Tue, 28 Aug 2018 09:50:24 +0000 Date: Tue, 28 Aug 2018 17:47:23 +0800 From: Jisheng Zhang To: Adrian Hunter , Ulf Hansson Subject: [PATCH v6 2/3] mmc: sdhci: introduce adma_write_desc() hook to struct sdhci_ops Message-ID: <20180828174723.4e729a27@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: OSAPR01CA0147.jpnprd01.prod.outlook.com (2603:1096:604:d::15) To BLUPR0301MB1572.namprd03.prod.outlook.com (2a01:111:e400:52a9::18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cce65cb5-1e2f-4171-b878-08d60ccbae20 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:BLUPR0301MB1572; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0301MB1572; 3:4ORWQ+9LhsSpml9lMOeMFrM0AI7ieYeBtu+Cmoa0Z0MD8B/5Q/f9g65268yxyTW9RtBdKwRsqV6mrt93Zy9EE62BIf8EqL3e0MUqoTTFN66F7vpHVAvFbo1ikP7k56grQoW0qoyM3vpvJPfQlIRaBt6FN/FaNDUoHOBmD1wPdlEOcWD/MxwMYhyAbFDDGyhRb3IzFZM4SgPFrtISGsu25IAuoXi17gMbL0l0u+4EGRSLxmWZBUZQri6XfE9WX7Rj; 25:iNazw2zsgDmt9+B5IISoE/UGdAjO7zzinEgoPrnDxAe8MBkdbDCRwS42d0VkZnl2rw9N8ypSVFJ6GCqBO1ObXLiZ5f9Lt9NnP0spjEiHl10Lb7S1nKiHjZAYAso7uUEme1OjinltoPMK9KVWrTH3Jc4/YeAYUBOZIR6KuAz9mNjNzTBi3KkETnCz9zKVvwYPNn7xa6A0nwBSpnvmvqEDW/zMOjkgXiGctCWHXW4S56DLHXR7c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XrqwLITJhTRbOLELOOcFlO7U5AvLGivs3nBw2GbvTGZzRIMTwximHSC/RkO19rAG2nZWrpkCnAYNDuKz0r6PvgfgWvqiYQFLPgDd+rMx76oBN7hV4tGA4TbgsULfxCFknYbhOITQbPu6y6o42y5IyPVNUxOx640EuKVTWThq 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)(3002001)(3231311)(944501410)(52105095)(10201501046)(149027)(150027)(6041310)(20161123564045)(20161123560045)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699016); SRVR:BLUPR0301MB1572; BCL:0; PCL:0; RULEID:; SRVR:BLUPR0301MB1572; X-Forefront-PRVS: 077884B8B5 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(136003)(366004)(376002)(396003)(39860400002)(346002)(189003)(199004)(7696005)(54906003)(6506007)(478600001)(110136005)(26005)(72206003)(386003)(186003)(16526019)(14444005)(76176011)(5660300001)(33896004)(2906002)(52116002)(446003)(106356001)(105586002)(1076002)(53936002)(55016002)(11346002)(316002)(81166006)(486006)(23726003)(3846002)(9686003)(6116002)(305945005)(50226002)(7736002)(68736007)(8936002)(230700001)(81156014)(8676002)(86362001)(476003)(4326008)(97736004)(956004)(66066001)(50466002)(47776003)(25786009)(39210200001); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR0301MB1572; 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; BLUPR0301MB1572; 23:9u08ubP2LBACsxQlIO0qTMw24KTE8ro3CvVoUy0?= nRvdOh1HVjsJSHuwpuucfJYM6OnPsDyzBBj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WzXKNG7eZ2DKsVmGIm168SahhovAospTXkNNuevqSirbdf5p3caynbAvEVG2W5Urp6oX80arxaYZtBFlfZz3l1tk=; 7:zNYGX2QTPP6RZWyHVBDf3WZzkbGSFWbWe5KS/BZaFcN18TheEzy6ZQIb6H3mSZSZ0YbThqonXv6RMquS6BZcL5loPiTYV1fYSc7uuLBwbWXM65xgp2sEokWzXybv3GIQBuMT5PM3b/JjrUIF89bOiu8qTbtuZSXgIpCE3eYS2fsKDZ5CWbtGsAELlDc57S35tQiEud5VRhpb5+IH8z1WvULrvqUzpMUh1yvPDTTRKEaRyHANKxPzlYE0iM6d2Ggg SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: synaptics.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Aug 2018 09:50:24.1642 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cce65cb5-1e2f-4171-b878-08d60ccbae20 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 335d1fbc-2124-4173-9863-17e7051a2a0e X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR0301MB1572 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180828_105045_333895_AF2CE2E7 X-CRM114-Status: GOOD ( 15.17 ) 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 Add this hook so that it can be overridden with driver specific implementations. We also let the original sdhci_adma_write_desc() accept &desc so that the function can set its new value. Then export the function so that it could be reused by driver's specific implementations. Signed-off-by: Jisheng Zhang Acked-by: Adrian Hunter --- drivers/mmc/host/sdhci.c | 37 +++++++++++++++++++++++-------------- drivers/mmc/host/sdhci.h | 4 ++++ 2 files changed, 27 insertions(+), 14 deletions(-) diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 52ccf4644384..eb21d2db7f05 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -554,10 +554,10 @@ static void sdhci_kunmap_atomic(void *buffer, unsigned long *flags) local_irq_restore(*flags); } -static void sdhci_adma_write_desc(struct sdhci_host *host, void *desc, - dma_addr_t addr, int len, unsigned cmd) +void sdhci_adma_write_desc(struct sdhci_host *host, void **desc, + dma_addr_t addr, int len, unsigned int cmd) { - struct sdhci_adma2_64_desc *dma_desc = desc; + struct sdhci_adma2_64_desc *dma_desc = *desc; /* 32-bit and 64-bit descriptors have these members in same position */ dma_desc->cmd = cpu_to_le16(cmd); @@ -566,6 +566,19 @@ static void sdhci_adma_write_desc(struct sdhci_host *host, void *desc, if (host->flags & SDHCI_USE_64_BIT_DMA) dma_desc->addr_hi = cpu_to_le32((u64)addr >> 32); + + *desc += host->desc_sz; +} +EXPORT_SYMBOL_GPL(sdhci_adma_write_desc); + +static inline void __sdhci_adma_write_desc(struct sdhci_host *host, + void **desc, dma_addr_t addr, + int len, unsigned int cmd) +{ + if (host->ops->adma_write_desc) + host->ops->adma_write_desc(host, desc, addr, len, cmd); + + sdhci_adma_write_desc(host, desc, addr, len, cmd); } static void sdhci_adma_mark_end(void *desc) @@ -618,28 +631,24 @@ static void sdhci_adma_table_pre(struct sdhci_host *host, } /* tran, valid */ - sdhci_adma_write_desc(host, desc, align_addr, offset, - ADMA2_TRAN_VALID); + __sdhci_adma_write_desc(host, &desc, align_addr, + offset, ADMA2_TRAN_VALID); BUG_ON(offset > 65536); align += SDHCI_ADMA2_ALIGN; align_addr += SDHCI_ADMA2_ALIGN; - desc += host->desc_sz; - addr += offset; len -= offset; } BUG_ON(len > 65536); - if (len) { - /* tran, valid */ - sdhci_adma_write_desc(host, desc, addr, len, - ADMA2_TRAN_VALID); - desc += host->desc_sz; - } + /* tran, valid */ + if (len) + __sdhci_adma_write_desc(host, &desc, addr, len, + ADMA2_TRAN_VALID); /* * If this triggers then we have a calculation bug @@ -656,7 +665,7 @@ static void sdhci_adma_table_pre(struct sdhci_host *host, } } else { /* Add a terminating entry - nop, end, valid */ - sdhci_adma_write_desc(host, desc, 0, 0, ADMA2_NOP_END_VALID); + __sdhci_adma_write_desc(host, &desc, 0, 0, ADMA2_NOP_END_VALID); } } diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index 25bddd21de31..2115416f973a 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h @@ -606,6 +606,8 @@ struct sdhci_ops { void (*adma_workaround)(struct sdhci_host *host, u32 intmask); void (*card_event)(struct sdhci_host *host); void (*voltage_switch)(struct sdhci_host *host); + void (*adma_write_desc)(struct sdhci_host *host, void **desc, + dma_addr_t addr, int len, unsigned int cmd); }; #ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS @@ -736,6 +738,8 @@ void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios); int sdhci_start_signal_voltage_switch(struct mmc_host *mmc, struct mmc_ios *ios); void sdhci_enable_sdio_irq(struct mmc_host *mmc, int enable); +void sdhci_adma_write_desc(struct sdhci_host *host, void **desc, + dma_addr_t addr, int len, unsigned int cmd); #ifdef CONFIG_PM int sdhci_suspend_host(struct sdhci_host *host); From patchwork Tue Aug 28 09:48:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 10578129 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 A751814E1 for ; Tue, 28 Aug 2018 09:55:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9374525D9E for ; Tue, 28 Aug 2018 09:55:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 87C1A28F47; Tue, 28 Aug 2018 09:55:25 +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 26A7625D9E for ; Tue, 28 Aug 2018 09:55:25 +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=VNQ+r66uFskGK+JuwSKJMI+tmvhKIm6+O3g16TdUVMw=; b=OFZr8TstSy7DJy PT6SukqrdFXjpuNzD4rB2BGb+ocw7V2SOrHJdyfv08vVLEAIeKZA3UFxJPqvqRw1f+xMK3hJubKNn irDn0x1BY3byIv9+xXuPuZ+aWHj76KI05UiMIrmr1rGjDG33pfFbKJFREvZwhEIMDRtzqDwSGpyBx Rj43cS7dzTjOwZQrbgseIeEpWgpwBZu2ScuRsnnTYL01Ib5kNukAsL4LKrAlVXRKv3XZiQEPp9h7g +EFBbnQ+kcZW4GIalwX+YCNQzNvNig+qcV+qPsJHAp77WIjIM3OyH5WYKk+PdDTe3g9uS6WE04i4a N/p/q0vsqgr0WctHOCuQ==; 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 1fuaiN-0005hp-7M; Tue, 28 Aug 2018 09:55:11 +0000 Received: from mail-eopbgr700087.outbound.protection.outlook.com ([40.107.70.87] helo=NAM04-SN1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fuaeo-00040q-Lt for linux-arm-kernel@lists.infradead.org; Tue, 28 Aug 2018 09:51:47 +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=4vaoEQz1IWgRSirqSCG2jo2WQ2A8ou5Ebi6qEcnTlmU=; b=uJA+TuLi/7PRsa/t6vjEpXQL/LaIUI0LnoYSVXUA7L9ACVyKJuMKDS/C7Qq7avcAKshsOsgip1Dnw7fGYGMAquotSPamH5DqVq6F5O8AxTVEUNkgTj5774RuJSOU+QTdlTpUhowdTgZ68KOCGs2v68qH8fZXDEiFOdVvX/HaLMk= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jisheng.Zhang@synaptics.com; Received: from xhacker.debian (124.74.246.114) by BY2PR0301MB1574.namprd03.prod.outlook.com (2a01:111:e400:526e::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1080.17; Tue, 28 Aug 2018 09:51:14 +0000 Date: Tue, 28 Aug 2018 17:48:14 +0800 From: Jisheng Zhang To: Adrian Hunter , Ulf Hansson Subject: [PATCH v6 3/3] mmc: sdhci-of-dwcmshc: solve 128MB DMA boundary limitation Message-ID: <20180828174814.40dfa48f@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: TYAPR01CA0018.jpnprd01.prod.outlook.com (2603:1096:404::30) To BY2PR0301MB1574.namprd03.prod.outlook.com (2a01:111:e400:526e::16) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d283c4ca-d006-48d4-f874-08d60ccbcbf6 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989137)(5600074)(711020)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020); SRVR:BY2PR0301MB1574; X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB1574; 3:Dt3GKAF0Vm19dsz+NkFK3JWNCCaUQEpMUdCZwA0eKmzmAO/88Kaesdi+pnt4lFpD1GjU3kDt+ejoIlPgH3BBq6SeU5DaR3xJ/AaM81UmkE9//PTpKFn9tfgrAFOdEAr2cbJOhcM9s+5e5V/cbVmyK07rW2NPpDmUEXU30uTbeGRFSLleOD0/QhkoeipnVkJI+2XvdDzOr2M725KMsNy0RpjDDQKxlo10l9Qf2LsFhApRHAhmmepz+9rGw6/tS2K9; 25:9lxI9ehjlBmSVPoffC0+eLDkRrufB1pPshl6jec+64cKkFuUnGttOUVLfWU3KzArPyU0HC4jSx+QoZhoLidlBfFI1IIBikVyHd3rZhY3TO/cX2qzf5ksIIH510sGCYE7QTB0Iqb3Cw/C9+OJEh3/tBYiaRSFjp7+3YKm0hEBnOTV+WdAigFR9q6uB00sPE/NFjGwZAWmwxdXgr8F61qpgAnYQhugHmV9J+5dYiua6sdmokNuo4WjZIMSBhgt6hpZf8J/5ahzgy7wWYLQd1hJHsGEdzuMoiHJ2mEoulh2pi9/bstg2/Kwe9J6xFpyUfgE+H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HBh677D61I2bSm32V8C4nDksI67jI24lPtiyl63apIJxqtbs00sI5NojFpg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(5005006)(8121501046)(3002001)(93006095)(93001095)(3231311)(944501410)(52105095)(10201501046)(149027)(150027)(6041310)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(201708071742011)(7699016); SRVR:BY2PR0301MB1574; BCL:0; PCL:0; RULEID:; SRVR:BY2PR0301MB1574; X-Forefront-PRVS: 077884B8B5 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(136003)(346002)(39860400002)(396003)(376002)(366004)(189003)(199004)(54906003)(25786009)(4326008)(16526019)(186003)(66066001)(72206003)(476003)(14444005)(86362001)(26005)(11346002)(6506007)(446003)(386003)(478600001)(956004)(5660300001)(81166006)(8676002)(97736004)(50226002)(8936002)(81156014)(486006)(47776003)(316002)(230700001)(1076002)(3846002)(105586002)(23726003)(7736002)(50466002)(68736007)(52116002)(106356001)(53936002)(33896004)(2906002)(76176011)(305945005)(7696005)(9686003)(110136005)(55016002)(6116002)(133343001)(39210200001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR0301MB1574; 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; BY2PR0301MB1574; 23:7y0KM2oALmFHHJhfBFHd2Mb7zskJDZy+wFwb5HK?= BZ/55anAaGpP/Ciu3tr7FYUwRlOdjO0eqXU5waP4F7h5B4taYtDjIi9/lJB8E/LTzpaEfPCkBfpK8xgH64EN9pG8MKkppEAuVXVVDrNeOS0islDK0ErVFgDrpgUNa8dtnhp5KZxEDU27WJd5T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hm58jzkn4gbIiUteW/uo=; 7:PG7uOMx4BPcBK7yNL1a3vMIQZNarf3ekfdUzkeeGxpSlmz40R1yPkRO66OQB3305pP1t+LCSJc0aWS5uoyOLhFTAkKKyNKBRepdJ2SzkQs6+5+XzQagnEj8P1ZX7kuHqDEdaRGMwosoAEdUkWuuLi6JBXIxiGOThQOIp4nm+V4HLr5mN0UHYSx0Vkd23cRDQRz3y1eekz+7EQ9g+XYvu7sza9uqcVz+vKnn9JEGj4pWjdy7OuwR3u2ZTZbMB7LRo SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: synaptics.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Aug 2018 09:51:14.5947 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d283c4ca-d006-48d4-f874-08d60ccbcbf6 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 335d1fbc-2124-4173-9863-17e7051a2a0e X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR0301MB1574 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180828_025130_809232_A7C0BFB1 X-CRM114-Status: GOOD ( 10.44 ) 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 When using DMA, if the DMA addr spans 128MB boundary, we have to split the DMA transfer into two so that each one doesn't exceed the boundary. Signed-off-by: Jisheng Zhang Acked-by: Adrian Hunter --- drivers/mmc/host/sdhci-of-dwcmshc.c | 39 +++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/drivers/mmc/host/sdhci-of-dwcmshc.c b/drivers/mmc/host/sdhci-of-dwcmshc.c index 1b7cd144fb01..a5137845a1c7 100644 --- a/drivers/mmc/host/sdhci-of-dwcmshc.c +++ b/drivers/mmc/host/sdhci-of-dwcmshc.c @@ -8,21 +8,51 @@ */ #include +#include +#include #include #include +#include #include "sdhci-pltfm.h" +#define BOUNDARY_OK(addr, len) \ + ((addr | (SZ_128M - 1)) == ((addr + len - 1) | (SZ_128M - 1))) + struct dwcmshc_priv { struct clk *bus_clk; }; +/* + * If DMA addr spans 128MB boundary, we split the DMA transfer into two + * so that each DMA transfer doesn't exceed the boundary. + */ +static void dwcmshc_adma_write_desc(struct sdhci_host *host, void **desc, + dma_addr_t addr, int len, unsigned int cmd) +{ + int tmplen, offset; + + if (likely(!len || BOUNDARY_OK(addr, len))) { + sdhci_adma_write_desc(host, desc, addr, len, cmd); + return; + } + + offset = addr & (SZ_128M - 1); + tmplen = SZ_128M - offset; + sdhci_adma_write_desc(host, desc, addr, tmplen, cmd); + + addr += tmplen; + len -= tmplen; + sdhci_adma_write_desc(host, desc, addr, len, cmd); +} + static const struct sdhci_ops sdhci_dwcmshc_ops = { .set_clock = sdhci_set_clock, .set_bus_width = sdhci_set_bus_width, .set_uhs_signaling = sdhci_set_uhs_signaling, .get_max_clock = sdhci_pltfm_clk_get_max_clock, .reset = sdhci_reset, + .adma_write_desc = dwcmshc_adma_write_desc, }; static const struct sdhci_pltfm_data sdhci_dwcmshc_pdata = { @@ -36,12 +66,21 @@ static int dwcmshc_probe(struct platform_device *pdev) struct sdhci_host *host; struct dwcmshc_priv *priv; int err; + u32 extra; host = sdhci_pltfm_init(pdev, &sdhci_dwcmshc_pdata, sizeof(struct dwcmshc_priv)); if (IS_ERR(host)) return PTR_ERR(host); + /* + * extra adma table cnt for cross 128M boundary handling. + */ + extra = DIV_ROUND_UP_ULL(dma_get_required_mask(&pdev->dev), SZ_128M); + if (extra > SDHCI_MAX_SEGS) + extra = SDHCI_MAX_SEGS; + host->adma_table_cnt += extra; + pltfm_host = sdhci_priv(host); priv = sdhci_pltfm_priv(pltfm_host);