From patchwork Sat Aug 8 01:03:35 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Duc Dang X-Patchwork-Id: 6973611 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 9EE6CC05AD for ; Sat, 8 Aug 2015 01:06:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C1C472069F for ; Sat, 8 Aug 2015 01:06:45 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8A3C4206A2 for ; Sat, 8 Aug 2015 01:06:44 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZNsZ7-0003aM-14; Sat, 08 Aug 2015 01:04:49 +0000 Received: from mail-pd0-x235.google.com ([2607:f8b0:400e:c02::235]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZNsZ3-0003Wy-Tu for linux-arm-kernel@lists.infradead.org; Sat, 08 Aug 2015 01:04:46 +0000 Received: by pdrg1 with SMTP id g1so50815333pdr.2 for ; Fri, 07 Aug 2015 18:04:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=apm.com; s=apm; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=HSF4alHvTz4lbSaAHn2qhwJ93NqmllOMkPUj1v75Tus=; b=B9FI36XVYzxDIZyv8g3ewHTsAFQyn3/79Bvchh3lSKH2XPoV5qoZNnUKkORm8GS52K WUTvUtiZjShb/532MuvH1o199IkquYQM9sgBIssDRg9qK1Bw0UgZsfuqKC1MZ2XL3m0Y VCqDusaWZFfVCvbPwK8rob0J8o7I3iVZzlo7k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=HSF4alHvTz4lbSaAHn2qhwJ93NqmllOMkPUj1v75Tus=; b=MH1Ax4j9WU45wO/PigOP8tHOW+y3fZ7gdmtqVKPkjOMG2V+469L3qFssGtBBscDNmR xgKuZ+690ovUz99d+zRFHrmh6jDG4DeqVmvfShju9S9ln/V1VAoKf4XJdXpdRFNpwDKY tTyeDfDxkFPyFZ7IVv1A8o8P1x0dZblPJNSSrBsu6/1NxJzRS2B49sqcYtugSwexuy4F P5YsOEf+8E/jo5MlDpmfOuMwyvB9NQ1K/g+6g/EgAe3sqLf/YpQNab5SsoTxF9F6Hztt GgKLfQNBnNOwQerrGdCoG0LD4vCZxWF6i8X8G59c3t9Jth1sbtys5jsxwWHdsRMdk0rX l+uA== X-Gm-Message-State: ALoCoQl12njsk3faIZKhii1osvIKe5RPgPc+6hCDiIFjPFSMFxPYE73YiHeR24fS/MYYG9z7p90Y X-Received: by 10.70.118.163 with SMTP id kn3mr15001117pdb.115.1438995864546; Fri, 07 Aug 2015 18:04:24 -0700 (PDT) Received: from dhdang-Precision-WorkStation-T3400.amcc.com (70-35-53-82.static.wiline.com. [70.35.53.82]) by smtp.gmail.com with ESMTPSA id s7sm11479355pdn.85.2015.08.07.18.04.23 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 07 Aug 2015 18:04:23 -0700 (PDT) From: Duc Dang To: Greg KH , Loc Ho Subject: [PATCH v4 1/2] usb: make xhci platform driver use 64 bit or 32 bit DMA Date: Fri, 7 Aug 2015 18:03:35 -0700 Message-Id: <07fb19170aa7c027f44af634aac7e7918daac7cd.1438994178.git.dhdang@apm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150807_180445_992137_A5B79EDB X-CRM114-Status: GOOD ( 13.25 ) X-Spam-Score: -2.7 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Feng Kan , Mark Langsdorf , mathias.nyman@intel.com, Duc Dang , USB list , patches , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The xhci platform driver needs to work on systems that either only support 64-bit DMA or only support 32-bit DMA. Attempt to set a coherent dma mask for 64-bit DMA, and attempt again with 32-bit DMA if that fails. [dhdang: regenerate the patch over 4.2-rc5] Signed-off-by: Mark Langsdorf Tested-by: Mark Salter Signed-off-by: Duc Dang --- Changes from v3: Re-generate the patch over 4.2-rc5 No code change. Changes from v2: None Changes from v1: Consolidated to use dma_set_mask_and_coherent Got rid of the check against sizeof(dma_addr_t) drivers/usb/host/xhci-plat.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index 890ad9d..5d03f8b 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c @@ -93,14 +93,14 @@ static int xhci_plat_probe(struct platform_device *pdev) if (irq < 0) return -ENODEV; - /* Initialize dma_mask and coherent_dma_mask to 32-bits */ - ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); - if (ret) - return ret; - if (!pdev->dev.dma_mask) - pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask; - else - dma_set_mask(&pdev->dev, DMA_BIT_MASK(32)); + /* Try setting the coherent_dma_mask to 64 bits, then try 32 bits */ + ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); + if (ret) { + ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); + if (ret) + return ret; + } + hcd = usb_create_hcd(driver, &pdev->dev, dev_name(&pdev->dev)); if (!hcd)