From patchwork Mon Aug 27 08:20:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 10576617 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 443661390 for ; Mon, 27 Aug 2018 08:23:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2F2BB29798 for ; Mon, 27 Aug 2018 08:23:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2331729807; Mon, 27 Aug 2018 08:23:49 +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 BCE7B29798 for ; Mon, 27 Aug 2018 08:23:48 +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=OrHwx+QFjM+lc7eQcpo/mW8XWRG+ieQOK5bxZwsE/yc=; b=o6jSSlz6XJuRb8 S3faVPu4BxW3JBgr0A/dL5fa/Op8ys7/5cLY3MgjDS7/xc5JX7aY69dqpGw/W/AXbaA1tdFY8/K0x 0KFBMucOCY/gGraUDtZABuHSpVPf+QV0x/YqNt+0NF7+HCvuHA/7/sUBtiyX86MngJG07Nemn2K1A /lnrrPo4H0D3fqRLasEkPVPUqLH/+WTJvKk1w6k0u+yEeypD2WEIkQOj65C/4NuvbaRDmr80BiEj+ Fo/6syVwIUGT1NxVx8VMQAHfskkgedtFD4eAOBXi96fW2mj499AQRIvI0ZiL3fM9NkBinObXs+Xzy hCJ9uVEkT+nRKmKjfk2Q==; 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 1fuCoJ-0008NH-PC; Mon, 27 Aug 2018 08:23:43 +0000 Received: from mail-eopbgr720047.outbound.protection.outlook.com ([40.107.72.47] helo=NAM05-CO1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fuCoG-0008Ag-38 for linux-arm-kernel@lists.infradead.org; Mon, 27 Aug 2018 08:23:41 +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=BI98gPlZS4bCcGS/GVVcu+MGSnwvcsWKA2d0ucP+YUU=; b=eEMWdlTVhrT41dQOJhXj+PwmQUwm39BJf8WvgkxB+oq7R/9OiqzmHVhWnQvjnVJ50WyGaIuf9LE5OdtHkuwvumpGozUf4/Hpe3hEjap50/KKPQJFYtOdqyVZDdXaO44pMgVlY8NQO3A/3cRBUohVSjyzg3KqIw5bOCEGzG4+z48= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jisheng.Zhang@synaptics.com; Received: from xhacker.debian (124.74.246.114) by CY1PR0301MB1578.namprd03.prod.outlook.com (2a01:111:e400:529c::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1080.14; Mon, 27 Aug 2018 08:23:26 +0000 Date: Mon, 27 Aug 2018 16:20:26 +0800 From: Jisheng Zhang To: Adrian Hunter , Ulf Hansson Subject: [PATCH v5 0/3] solve SDHCI DWC MSHC 128MB DMA boundary limitation Message-ID: <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: TYAPR01CA0023.jpnprd01.prod.outlook.com (2603:1096:404::35) To CY1PR0301MB1578.namprd03.prod.outlook.com (2a01:111:e400:529c::16) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6ff0340b-a62d-4bc1-56c0-08d60bf65d8e X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:CY1PR0301MB1578; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1578; 3:zHzahhfL6h07hXmF7YXokiogtuka+BuvniJ3o8bumpgTkRCUxTxvXCCKG5Xm7XciP0MPhSeR961QJXordmVS02HnibqPf5j5l58fPVVCCmfqEtennxbyPvpTI/Qa+Zfmp4YK9WZH2muv+Y2LxgqDrM836HSCtdsHG/HUmopXQoa9BJvn3zcGk0AVr3VmXRxJ+ar/O4/m8x47GOhybAuMeJ9D1LvJnh60MOcn4QD9RkI4AQfUpaS15mXDHRNh2sZO; 25:s101zUJgOkpJ7a/JXM8ebBOFsYRWmg95cuMAEdUMjcdLb+FIAn87tH0AStO8kzKtibStt/iLa2Wdkh9ZsdIiMqo7r5SAgeqU45HdUeibLwLOO1TpH/LLsswJZ2VAecAI1SvxcNtAPHXpGs9Q9Qhdbx4vO89/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sVDb6v7sxEKliixiOWRX7nsZg6JV4P2J7+Zt3ODLzdL3M/Y1+Om9D+W8Iq3BMlrP7k5I+MGSnlxku+BBMufORG9MmJJaMxX0LU/izgURgnJtY8eQgWBy9npKkWBaxjtzwW+PKCL63H7xqP8/j/KJL4TGmXreVmEAXagy7Lqdl7YCIfwNidN5JetxA/bfLv6BzfBUkjBeORMwwp6720yQ== 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)(3002001)(10201501046)(3231311)(944501410)(52105095)(149027)(150027)(6041310)(20161123564045)(20161123558120)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699016); SRVR:CY1PR0301MB1578; BCL:0; PCL:0; RULEID:; SRVR:CY1PR0301MB1578; X-Forefront-PRVS: 07778E4001 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39850400004)(346002)(366004)(136003)(396003)(376002)(199004)(189003)(217873002)(23726003)(6116002)(3846002)(478600001)(230700001)(4326008)(47776003)(72206003)(956004)(476003)(54906003)(316002)(53936002)(110136005)(50226002)(9686003)(8676002)(5660300001)(66066001)(81156014)(81166006)(105586002)(186003)(16526019)(25786009)(2906002)(97736004)(7736002)(106356001)(8936002)(33896004)(55016002)(50466002)(26005)(68736007)(6506007)(305945005)(86362001)(1076002)(7696005)(52116002)(486006)(386003)(14444005)(39210200001); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR0301MB1578; 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; CY1PR0301MB1578; 23:MWkacPCEm+E9iSMeFX+IQRf5dMvC6YuSqIQp4uW?=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zrahr2o+z1muFsqxpLTnwWZKEIFHpzA0WsL83R5/l86spLKoD7kXtfwSW8G0nC+qmopJp6ZjDFaZ0=; 7:SVB4mEJmoAjl3HKAvxXCSI34zs4AzztnCTkGWxEINgZH4apOPaH/16sUVY2iP/LrzJzhQl3niktSpsHO8L/I6rlYO/TKalEnnt5QxJVDfDZ4y2bYwh1nOzXYAbOLnRESd5KiArqQ97CsNLRwxL0tPyisir/iTKXVfFygJ5/xZS8USKRnXXYNylRODuVq4qJdyub7ENDEK5KieygJyYTE4nXLo0JXnkpQv/nQ3wlBSsYSYPrNJIkXO6ednnwnD8ht SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: synaptics.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Aug 2018 08:23:26.1629 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6ff0340b-a62d-4bc1-56c0-08d60bf65d8e X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 335d1fbc-2124-4173-9863-17e7051a2a0e X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR0301MB1578 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180827_012340_188810_73A9B1A0 X-CRM114-Status: UNSURE ( 7.63 ) 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 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)) - 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 | 41 ++++++++++++++++++++++ drivers/mmc/host/sdhci.c | 54 +++++++++++++++++------------ drivers/mmc/host/sdhci.h | 7 ++++ 3 files changed, 80 insertions(+), 22 deletions(-)