From patchwork Tue Aug 28 09:45:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 10578107 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 9DC1A5A4 for ; Tue, 28 Aug 2018 09:49:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8D2FC2942F for ; Tue, 28 Aug 2018 09:49:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8152929495; Tue, 28 Aug 2018 09:49:10 +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=ham 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 7BAB42942F for ; Tue, 28 Aug 2018 09:49: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: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:In-Reply-To:References: List-Owner; bh=K+FZzda7SmEtBKbE5cQNGVXqdMwbJUKG1VwJm1+u1eo=; b=DS8hfta9l0/+Ht 4PVrt3jTfTLNOcqzXqEpXDfDf235kppHxKPCXwZYZ1UPjy1K1e1Dc3fTxIONLmwBVz8Ga/VDOXTEn CY7EOmVoR4OZA90LREy5xHAPVFdLaLenJiB5E4mPO5PUl3XvhZaWPBJaVIU6KgHRlSw3P17R4KqPO 3T/8cLVuCTI+aw9txi8Vjs8I/otj6EBm5QUxTWKEsU3QmepGXxrZHs823XjbJOJo6ULOiNZvexjh1 J+qVhLhVZz+enmT0adm1Ul1E1/xpm9PpLSeyYVta83+s1h4GGt7grLeEQvENk0CegPTyqwR2epUeU df4NIePrn8+qpQ0gVetw==; 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 1fuacQ-0001s1-CY; Tue, 28 Aug 2018 09:49:02 +0000 Received: from mail-dm3nam03on061b.outbound.protection.outlook.com ([2a01:111:f400:fe49::61b] helo=NAM03-DM3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fuacM-0001q7-7c for linux-arm-kernel@lists.infradead.org; Tue, 28 Aug 2018 09:48:59 +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=SPVqHNByEiCSqnKU+rkrqKliRa4UGfRZRbWYP+VbAfE=; b=Gtpc12TQfcGZ9tucbf9U5zU8mUNaP4Fgi73aXG84nZOmBupv2khez/jelR0stacmvqLmP3S6/2A9hv12Zwai+MgS3/A74E654IurRELfImZkpZ8zLLBmK9G2R3BAJB87K9/dR6IVDoDnkAzw0EgF1C9bs8iBMiU+FgESNsb9uyM= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jisheng.Zhang@synaptics.com; Received: from xhacker.debian (124.74.246.114) by BLUPR0301MB1569.namprd03.prod.outlook.com (2a01:111:e400:52a9::15) 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:48:40 +0000 Date: Tue, 28 Aug 2018 17:45:34 +0800 From: Jisheng Zhang To: Adrian Hunter , Ulf Hansson Subject: [PATCH v6 0/3] solve SDHCI DWC MSHC 128MB DMA boundary limitation Message-ID: <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: TYAPR03CA0009.apcprd03.prod.outlook.com (2603:1096:404:14::21) To BLUPR0301MB1569.namprd03.prod.outlook.com (2a01:111:e400:52a9::15) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7e702f29-6c68-414a-1003-08d60ccb7019 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:BLUPR0301MB1569; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0301MB1569; 3:rTe2k17tzChjyrTJIqSzjsHRyGZaJTThSYq7TLFCOhZqdm+ziL+DFnWmic53XnIPir2CVS7DxCllyFEfwO7vGwe7w6EZva+JREY6JPNBGzGaO/5Tv+lySK6vxc9sfEGEclR8b4n0Y06NDJlA+0BFREUbWDDwChBSSItKXqcveMcdlfPRmicVmHqIDBf7nW9q19NesTNFbNwqB0iNK499nTYp1ktf+MsZVOBHN5sQ1KxIOS5q5IedWRLcODWWXWK1; 25:m58Kmjywa7PnsHQZuG1WcJAquM2pxmhxNKiJkZaVBB8hgKUM7W0KA/C5PjhlogjolIffPvmFrtaJHQqBoMK7LMQTCxA3J2kCKN3QBHzerGp7iiPzxDbJFC0xIZqCxT5bDjcNWmoDmCRHdu4rCwg7XAZMn36IoTs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q7aOs8spcPN1DAq4oitg2DreIt/D6uEFY0kqOWSeeE4tbGppT/rBKbKX28/jJemIJsWCMFWEvsFBoPW+ev8bjdpZO65INsIMF8RXqd/ZrRD+072BSGgVIlKeFTeSnJMGR9Y6qomcNS0FL4WITgSZ7T9hyqh7fE/kyCowHx6/lKxb3DLp2iAINs1j9IvG4BOM/nxeAsZM8hIILCci5/RDz+R7sfg== 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)(8121501046)(5005006)(93006095)(93001095)(10201501046)(3002001)(3231311)(944501410)(52105095)(149027)(150027)(6041310)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(20161123564045)(201708071742011)(7699016); SRVR:BLUPR0301MB1569; BCL:0; PCL:0; RULEID:; SRVR:BLUPR0301MB1569; X-Forefront-PRVS: 077884B8B5 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(136003)(376002)(366004)(346002)(39860400002)(396003)(189003)(199004)(478600001)(33896004)(316002)(54906003)(16526019)(26005)(230700001)(50466002)(386003)(6506007)(8676002)(97736004)(186003)(50226002)(8936002)(25786009)(7696005)(52116002)(110136005)(53936002)(55016002)(9686003)(1076002)(23726003)(217873002)(14444005)(81166006)(5660300001)(47776003)(105586002)(66066001)(956004)(2906002)(106356001)(7736002)(81156014)(4326008)(486006)(72206003)(68736007)(6666003)(3846002)(6116002)(86362001)(476003)(305945005)(39210200001); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR0301MB1569; 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; BLUPR0301MB1569; 23:nk4ihayggfty6stxjf2n+MXAVbxPuao4mE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PFpfdnj6WjZkS38ABCdr28IrtSxQmbZU7312wnyujUHxKG1qJWjAnU239wTWbIBxvt7/iCtcX5yxmJNx5TL7yfwalUBfAc9y0rase0O5sItVz297fI=; 7:e5UPPSRdERNWyPJpjiGAoNGqbidCvO7wGl/gOBPjHkuTfxOPxUvigmqe7GWlo8Xda3kEpwOgiMOv0L6Wj59equgmIIUlV7YMVaoEMU6qtdR467xq+yuqhvLukFQQ9x12vqgH6uqUgsiLdWm5QW6yYp3ejnBHIMHqk/UpAV9KVW0dOABvrWRCT5zQN4DBN/RqW4ajlAjRHOVUYcdMIj4T+pK3qClsGhHuiwSfcHKcTo0PQHMQ1CwcztpVNNpd3YEN SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: synaptics.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Aug 2018 09:48:40.1784 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7e702f29-6c68-414a-1003-08d60ccb7019 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 335d1fbc-2124-4173-9863-17e7051a2a0e X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR0301MB1569 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180828_024858_428717_AF1BE84B X-CRM114-Status: UNSURE ( 7.69 ) X-CRM114-Notice: Please train this message. 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. patch1 adds adma_table_cnt to struct sdhci_host so that driver can control the ADMA table count. patch2 introduces adma_write_desc() hook to struct sdhci_ops so that driver can override it. patch3 finally solves the 128MB boundary limitation. since v5: - use dma_get_required_mask() to calculate the extra adma_table_cnt since v4: - add Adrian's ack to patch 1 and patch 2 - address Adrian's comment -- if the boundary is fine, we have to return after writing dma desc once; adma_table_cnt updating could make use of the fact that it's already initialized by the common sdhci code, we just need to tune. since v3: - s/adma_table_num/adma_table_cnt - add comment to adma_table_cnt - make the exported function name without the _ - let sdhci_adma_write_desc() accept &desc param and set the new desc value since v2: - make use of "likely" to check (!len || BOUNDARY_OK(addr, len)) - explicitly include for SZ_128M since v1: - fix BOUNDARY_OK macro if addr+len is aligned to 128MB - use DIV_ROUND_UP to cal extra desc num - fix !len for dwcmshc_adma_write_desc() Jisheng Zhang (3): mmc: sdhci: add adma_table_cnt member to struct sdhci_host mmc: sdhci: introduce adma_write_desc() hook to struct sdhci_ops mmc: sdhci-of-dwcmshc: solve 128MB DMA boundary limitation drivers/mmc/host/sdhci-of-dwcmshc.c | 39 +++++++++++++++++++++ drivers/mmc/host/sdhci.c | 54 +++++++++++++++++------------ drivers/mmc/host/sdhci.h | 7 ++++ 3 files changed, 78 insertions(+), 22 deletions(-)