From patchwork Thu Sep 17 18:19:48 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Duc Dang X-Patchwork-Id: 7209741 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 433B89F380 for ; Thu, 17 Sep 2015 18:23:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 654C92072F for ; Thu, 17 Sep 2015 18:23:39 +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 A20E6206F8 for ; Thu, 17 Sep 2015 18:23:38 +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 1Zcdop-0007gP-Kn; Thu, 17 Sep 2015 18:22:03 +0000 Received: from mail-pa0-x235.google.com ([2607:f8b0:400e:c03::235]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZcdoJ-00076q-Aj for linux-arm-kernel@lists.infradead.org; Thu, 17 Sep 2015 18:21:32 +0000 Received: by padhk3 with SMTP id hk3so26015963pad.3 for ; Thu, 17 Sep 2015 11:21:10 -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 :in-reply-to:references; bh=zHdUSuTbwlYNobpJJsoKuG1HTraOhuoq5lgbQz4+XV4=; b=r5DllI98GThnw4kYEedJGz42fMY7N+xbQBWBracH7q7L6UHVTcoLbteJ3GCC5Y0igu WxS6vdr20RIPKNCQQ7xLSwK+mLogyAld30DM2F6YwhQ8oZjAEuQtymqf/FMsjEU2ULw2 x9qjHdK5XAOokRmA6vU8T7cHAe9PAB8tSRikA= 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:in-reply-to:references; bh=zHdUSuTbwlYNobpJJsoKuG1HTraOhuoq5lgbQz4+XV4=; b=HdqSED7bca9fnTBoVwT/eqyNflREJHADDEg8r6xyzOPlHg3555qoQXGaiWMSzld4Ns Ap2NsSTLxnrS01ch40RzPxmsjwH3k9DHPKj8KMYX/Qo4H3IwAeOfdGkzoyCoXIbSyjPG wHOaKx8W+dYSX7Zm56JoPlmQExt/qaUkmLyw7cB8eBOAlDXJ0FjswDrhwpMbW2A1lzAd dXNr1QwD+z90CYyYfKE1RD02FSoVDD4FgGURhBDjRQ7hMbaj4MY+b3Q5SzBabuHWLzp0 BSgoK9H+8gmdRuioCzucUwVWebOYIKmjbvxxEGB447UV2UKxWu8yl3wocdgkMSV0C7hJ B8Jg== X-Gm-Message-State: ALoCoQnZJpfeqAJFQZv6NmEs5Peb8xxbfAsEssHpQ+asbBYDScRnSNGJpTHhsJwtLZAWkEURyyuU X-Received: by 10.68.219.194 with SMTP id pq2mr1047738pbc.20.1442514070836; Thu, 17 Sep 2015 11:21:10 -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 bs3sm4649923pbd.89.2015.09.17.11.21.09 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 17 Sep 2015 11:21:10 -0700 (PDT) From: Duc Dang To: Greg KH , Russell King - ARM Linux , Loc Ho , Arnd Bergmann , mathias.nyman@intel.com Subject: [PATCH v8 3/3] usb: xhci: configure 32-bit DMA if the controller does not support 64-bit DMA Date: Thu, 17 Sep 2015 11:19:48 -0700 Message-Id: <8e5db2c671927f55bc40ac50ac0b3a5e78ced245.1442513540.git.dhdang@apm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: References: In-Reply-To: References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150917_112131_485210_A5172040 X-CRM114-Status: GOOD ( 13.66 ) 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 , 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.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, 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 This change avoids DMA error in the cases where dma_mask and coherent_dma_mask of a 32-bit controller get configured as DMA_BIT_MASK(64) when running on a 64-bit system. Signed-off-by: Duc Dang --- drivers/usb/host/xhci.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 6b0f4a4..8cb8f39 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -4908,6 +4908,16 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks) !dma_set_mask(dev, DMA_BIT_MASK(64))) { xhci_dbg(xhci, "Enabling 64-bit DMA addresses.\n"); dma_set_coherent_mask(dev, DMA_BIT_MASK(64)); + } else { + /* + * This is to avoid error in cases where a 32-bit USB + * controller is used on a 64-bit capable system. + */ + retval = dma_set_mask(dev, DMA_BIT_MASK(32)); + if (retval) + return retval; + xhci_dbg(xhci, "Enabling 32-bit DMA addresses.\n"); + dma_set_coherent_mask(dev, DMA_BIT_MASK(32)); } xhci_dbg(xhci, "Calling HCD init\n");