From patchwork Sat Aug 8 03:18: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: 6973871 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 17C81C05AC for ; Sat, 8 Aug 2015 03:22:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 003D2206A6 for ; Sat, 8 Aug 2015 03:22:30 +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 0E2F5206A1 for ; Sat, 8 Aug 2015 03:22:29 +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 1ZNufd-00045e-66; Sat, 08 Aug 2015 03:19:41 +0000 Received: from mail-pd0-x22c.google.com ([2607:f8b0:400e:c02::22c]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZNufT-00041K-Hi for linux-arm-kernel@lists.infradead.org; Sat, 08 Aug 2015 03:19:32 +0000 Received: by pdbfa8 with SMTP id fa8so11597333pdb.1 for ; Fri, 07 Aug 2015 20:19: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; bh=FVpLUaDqhQMHxr/KbsaQ1mc+ZfhElYiRZOp3+6HzllA=; b=OuRCfGPt3C04f2ZiWdyWMsJ9I2wxrLA8IeSqslLIIQbSpaKed/ZlTUKeW2hroNHeGA ojam9J5Ygv4kmLGtCleReuMddNxp/QSknnEKLF+qmgjqH2906hnpmeSXqLXH/5u/CKwf YEFBUu8sBBRXsBtS5j9w0K+2Pm2pdxTorXYm8= 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=FVpLUaDqhQMHxr/KbsaQ1mc+ZfhElYiRZOp3+6HzllA=; b=kTw3ogfuhsH4XEP65hcYdbFRw8sxpMUK/gUGWiPGtXsOJxKUE5hyCm5lyKyMLATOzX NNMwo6BwnJacv9ZIo9EWb8VYOy6tyBmqkd6Y00s8K4jZRBmzBffE23HMh4D04S1wvvyu 4IrzNhrE/H9sT7dM1YRrstK954TghQkKvG8FDXIj5A4n42pYZwnD79VrWnP3/5dp7am6 m8GFkqhbUgdTZAu6MVWBL4OPg50DsL89EUYX5SJqUtjZwc7CwlB3vTG1jEWz+Jkh+CJr skQfvD5LkRHi0j+LTwxuc3HhxuKJ5B1mEllhsFQ7IH3P9tBYYn9K1e4PiiRhMwIcS02r nqRg== X-Gm-Message-State: ALoCoQliTOeN4W3V7KhXt1Ycek9F58oysCK65ImcyhSAkO5gi+zvUTItAn1DjXmR+umpWLOuDuKu X-Received: by 10.70.65.38 with SMTP id u6mr21144843pds.99.1439003950001; Fri, 07 Aug 2015 20:19: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 rl15sm11675294pbb.44.2015.08.07.20.19.08 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 07 Aug 2015 20:19:09 -0700 (PDT) From: Duc Dang To: Greg KH , Loc Ho Subject: [PATCH v5 1/2] usb: make xhci platform driver use 64 bit or 32 bit DMA Date: Fri, 7 Aug 2015 20:18:48 -0700 Message-Id: <74fe0b014334a5ac1db90dec46bdbf6c30c07895.1439002338.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_201931_705761_2E0B943F 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 v4: None 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)