From patchwork Thu Oct 30 18:16:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Langsdorf X-Patchwork-Id: 5199521 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 22B19C11AC for ; Thu, 30 Oct 2014 18:19:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5561A201C7 for ; Thu, 30 Oct 2014 18:19:21 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 730D620173 for ; Thu, 30 Oct 2014 18:19:20 +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 1XjuHb-0004A1-3O; Thu, 30 Oct 2014 18:17:15 +0000 Received: from mx1.redhat.com ([209.132.183.28]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XjuHU-00046r-26 for linux-arm-kernel@lists.infradead.org; Thu, 30 Oct 2014 18:17:08 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s9UIGiN2007197 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 30 Oct 2014 14:16:44 -0400 Received: from redhatnow.redhat.com.com (vpn-63-242.rdu2.redhat.com [10.10.63.242]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s9UIGZ8H014363; Thu, 30 Oct 2014 14:16:42 -0400 From: Mark Langsdorf To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 1/2] [usb] make xhci platform driver use 64 bit or 32 bit DMA Date: Thu, 30 Oct 2014 13:16:28 -0500 Message-Id: <1414692989-23128-2-git-send-email-mlangsdo@redhat.com> In-Reply-To: <1414692989-23128-1-git-send-email-mlangsdo@redhat.com> References: <1414692989-23128-1-git-send-email-mlangsdo@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141030_111708_171142_847207C4 X-CRM114-Status: GOOD ( 11.96 ) X-Spam-Score: -5.6 (-----) Cc: Mark Langsdorf , catalin.marinas@arm.com, linux-usb@vger.kernel.org, will.deacon@arm.com, mathias.nyman@intel.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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=-2.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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. Signed-off-by: Mark Langsdorf --- drivers/usb/host/xhci-plat.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index 1a0cf9f..3045e77 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c @@ -147,14 +147,17 @@ static int xhci_plat_probe(struct platform_device *pdev) return ret; } - /* 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; + /* Try setting the coherent_dma_mask to 64 bits, then try 32 bits */ + if (sizeof(dma_addr_t) < 8 || + dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(64))) { + 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)); + dma_set_mask(&pdev->dev, pdev->dev.coherent_dma_mask); hcd = usb_create_hcd(driver, &pdev->dev, dev_name(&pdev->dev)); if (!hcd)