From patchwork Thu Aug 23 10:05:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 10573683 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 5CF361390 for ; Thu, 23 Aug 2018 10:09:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3F90B2B954 for ; Thu, 23 Aug 2018 10:09:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 329482B95C; Thu, 23 Aug 2018 10:09: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 C6B822B956 for ; Thu, 23 Aug 2018 10:09: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=6P/UdvYMjNqUKNNyW0nckeAPdBWcr5Cw0ONm4YdbGiI=; b=nGB0EinCNiCKD9 w48Zphd/kM7XlXDS10o93j228Mtl7lCBSxuMMD3L724PsvCAUULRjix6S17ld/4TGvHc9FOup3fyb XjMQHagQBMhrODpRfOqCo4xNBc697tB7zg/rCsupTJtjFad85/Hs+FA90EK0S18em3ComyAox5doJ 45VZfC70MQslWcAXyJ5RIh46nEn3sWUNfQL6GMbvNvuJbx3xEtH5Bq0fwV7wjvAf2i8SE3+BAV0XH cn19vrwIPXcIfcjTb6Vjz5vZBeTxwzUmhCNVKNqvkz9ysFJv/pG5mbkHvxuOP7ECEC1UgEplR71yg B1doaTIca8hm5n6aelDg==; 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 1fsmY8-0000tb-LS; Thu, 23 Aug 2018 10:09:08 +0000 Received: from mail-bn3nam04on062b.outbound.protection.outlook.com ([2a01:111:f400:fe4e::62b] helo=NAM04-BN3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fsmY5-0000sL-SK for linux-arm-kernel@lists.infradead.org; Thu, 23 Aug 2018 10:09:07 +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=9hysea9UFcL3FppkQ2P4N+Ba4g6bzUajyLtruoawRqM=; b=Mf8TwfWGL56QxWzwrPvm8V21bYpeNuKxGwXak6eBnd3LRNKuTN6tfPz6Aze5OfPa8mtU9kt7msGHRq8wky+51g/MDg9zsNUhGJZjAbjt729UJ84gC6FZZUFIHXeqOl3rS1ZAA47quBu/+0efNysz6litenyPCd1ywqWOFJnfZ5k= 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.1080.13; Thu, 23 Aug 2018 10:08:48 +0000 Date: Thu, 23 Aug 2018 18:05:49 +0800 From: Jisheng Zhang To: Adrian Hunter , Ulf Hansson Subject: [PATCH v4 0/3] solve SDHCI DWC MSHC 128MB DMA boundary limitation Message-ID: <20180823180549.78e508db@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: TY1PR01CA0173.jpnprd01.prod.outlook.com (2603:1096:402::25) To SN1PR0301MB1582.namprd03.prod.outlook.com (2a01:111:e400:5232::16) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8ad12380-fa9a-428e-04ac-08d608e06c6c 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:oj4+Z3pTBh6F/tS2xLE8fM/kLw8hb1ftlr8vPYCRg5jxjkwJ6oncVpOfIV3iaOPwkhBD95fdqRNkL4JwWNVy26TBV33lrLSKWMuNEoVajnkOeADbTsfxYOjhCBZcagjMNfDL0cxKPuyTURYJdAuAhDcOLM0RKI8rjGjbAiQRoi8bEbXo/cOrLduMT9o0mwapGrWweVAMaNlx7Ppj+NvU20NewemFBQjzAmwe52+IXdNhWkJvVF5S9Hb7kBdZzOAX; 25:Culry0TXHvIj0lC1SBBEqDvVQ0cW8uNrF0OSRuT4GDb+5Mm48zLG+ug6vgkpcglfOpE7MwqZgfduvZ9ImdV00Zp3z2ybF2YlJnxmZ+M8KxAAPxnvYX+MRthOUNJL0N+j1unngXXw0RYRXvT0YdVxQL/UhsZXMuppVClPFhlFe7s3qWfkS+o3SV8dww0Bf3cFR7lmDC6Kkkk0A3keL+t2cLANTFCquqPyYu5cHHEbJh0mpeK6ysSQZeY7J9aGlAgJ/uZJ0DVEvVzk3VvRKUkTP4DEqzIrS9Pzapj77FhI+VahAlcBxxp/++z1tlNqsl9CDQt1ngDkdyyNn7pXV7vuMw==; 31:XsFgYzP1mSJWJ1P25mP9QOBFbTIm9nUg04ZPLzZy/SDfSN31/f7+1f6/qUYDL1OA6ULY+SiGDuCrrRlybmRbJd6GZqr2irNnL+kqzYT0VK4cR9fdeJJwoB+VJh1HARZOxAtPFl9sRTkh9W1dlbrXLDm549uaR1nGOm4qZU8TBx2ibzsHlF/SSJNb4VvbYRjlFUz4xiCzKH4dplCkWBjWMnsxODtQVdCI3JR/GVucmUM= X-MS-TrafficTypeDiagnostic: SN1PR0301MB1582: Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jisheng.Zhang@synaptics.com; X-Microsoft-Exchange-Diagnostics: 1; SN1PR0301MB1582; 20:ULvrlWEycFtfbaJTYwpO6jZX+ivw7A/stOvyzW0one4JuhiqxlyRlNNgcK8Qepg/VY3sK3AA6AkBw8iB26rQSsdVzYgEXJwX+KwVJ1kARk83d0AaJLVYUjqrfOqFZ6q3WG/EoDE3H8yN3tMCQ59T1P70wGwJhniBNPmSIPXZQPA0fycHnAkX/SrhBatr5PN1sgHKEOoJqNgphq9VnBqzdb93eVGstA9LKbrQWrjIKUiABrZ/62aPYjhwIxxvhrlKCjirHy8JYSFTl/IvB+lpfM2EasgnPgZ3bjvqPsrrYBNfJbGVgwe/Z3oAwJtXZQOE8ouTun616nls/q4QTfSWRuOo9bSo89In8fRneqgJ9KRrWOXHl3SPnME5gQd16+kBwKDi1bazSohrbuSULcYI2tG4ItI9EzDYkkrzqhYR8R+4nZ5euAeQEbmXbI9CGgKn02ui/NIR4BNJWJASBMpUhwAr9cc/dqjrwPfoIkMZxcm64fmOtE2hvPKGq2qF6V7y; 4:5cjenahAHPY48eqcYLx6+7VR2DHwaVOPxSgek1zHy1Dv3JS3b5ETPYDBvUm4tV/YVhu8qeBvyEvF9uAUkahTy9vy69FfP5Vp8hYhr6UqBzeasXmo/UhoyFrCzcuRM+STPT3/wjRUqnH+XjfIab8CwJwY2zXGuL10Cf+JQhrlPX6WVjPK+8j0aqxdx3kjhgbcCGLea/rEmxqX7Ar1iUYWAoSA0qKw8jWDkCCBZ0pGPw2mWPiNFJYrww6g13gjzwkDIMX6TnZZh+tqEAScXxJ1tA== 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)(3231311)(944501410)(52105095)(3002001)(10201501046)(149027)(150027)(6041310)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123564045)(20161123558120)(201708071742011)(7699016); SRVR:SN1PR0301MB1582; BCL:0; PCL:0; RULEID:; SRVR:SN1PR0301MB1582; X-Forefront-PRVS: 0773BB46AC X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39860400002)(346002)(396003)(366004)(376002)(136003)(199004)(189003)(66066001)(25786009)(6116002)(52116002)(3846002)(5660300001)(110136005)(956004)(50466002)(54906003)(81166006)(81156014)(7696005)(86362001)(33896004)(8936002)(47776003)(478600001)(106356001)(97736004)(186003)(4326008)(486006)(16526019)(105586002)(386003)(6506007)(50226002)(26005)(2906002)(1076002)(72206003)(23726003)(53936002)(14444005)(217873002)(7736002)(476003)(68736007)(305945005)(316002)(9686003)(55016002)(8676002)(230700001)(39210200001); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR0301MB1582; 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; SN1PR0301MB1582; 23:eJq6qzmg30BishWlhmaKnFPxloHABIbDo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5OEkYOmIvDmxVnFqGyEEjjWatdAQWCJckwOLtD2hefbNT0K4QiLmuieCngB5cG354OTUJy3Yi3Q4tJx4AZmqZ9A=; 7:p3QEWXRHYwxmY3+26t68coTvqmPqIXYIMK0G+sDsAatgLNBZQSO1mpm8uKElmP1+U09U9Ly0ciGx8W5jkahylwm/1GaHxJ0O1NGuBjE9bf/A2Bhuhv6hMYDQlu6EkUlG+YwPGvhKd3n2HMsyfoIJgcuqgTbtwvzSfngkni7dowekK8BsYagyv3QUKg8Mc1lwreNZ3fKcHv/xDaXqpMPSRwOxQ7FuZSWt+tulCX3b4AVIYt9dnB5YEHD/lp4pLK3Q SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: synaptics.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Aug 2018 10:08:48.9999 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8ad12380-fa9a-428e-04ac-08d608e06c6c 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-20180823_030906_072425_B0DC7C8A X-CRM114-Status: UNSURE ( 6.55 ) 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_num to struct sdhci_host so that driver can control the ADMA table number. patch2 introduces adma_write_desc() hook to struct sdhci_ops so that driver can override it. patch3 finally solves the 128MB boundary limitation. 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)) - explictly 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(-)