Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965510AbcCJEJg (ORCPT ); Wed, 9 Mar 2016 23:09:36 -0500 Received: from mail-ig0-f170.google.com ([209.85.213.170]:33037 "EHLO mail-ig0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965467AbcCJEJc (ORCPT ); Wed, 9 Mar 2016 23:09:32 -0500 From: "Thang Q. Nguyen" References: <1453731985-13835-1-git-send-email-tqnguyen@apm.com> In-Reply-To: <1453731985-13835-1-git-send-email-tqnguyen@apm.com> MIME-Version: 1.0 X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: AdFXfIdrlXkNh6zNSJevlSInz8qKegjBf4Iw Date: Thu, 10 Mar 2016 11:09:29 +0700 Message-ID: <0167d2d94eb773138609361a34d88f90@mail.gmail.com> Subject: RE: [PATCH v2 1/2] usb:dwc3: Enable support for 64-bit system To: "Thang Q. Nguyen" , Felipe Balbi , Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm@lists.infradead.org Cc: Phong Vo , Loc Ho , patches Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1666 Lines: 57 Hi, I would like to ask if I need to update anything else for this change? Thanks, Thang Q. Nguyen - -----Original Message----- From: Thang Q. Nguyen [mailto:tqnguyen@apm.com] Sent: Monday, January 25, 2016 9:26 PM To: Felipe Balbi; Greg Kroah-Hartman; linux-usb@vger.kernel.org; linux-omap@vger.kernel.org; linux-kernel@vger.kernel.org; linux-arm@lists.infradead.org Cc: Thang Nguyen; Phong Vo; Loc Ho; patches@apm.com Subject: [PATCH v2 1/2] usb:dwc3: Enable support for 64-bit system Add 64-bit DMA operation support to the USB DWC3 driver. First attempt to set the coherent DMA mask for 64-bit DMA. If that failed, attempt again with 32-bit DMA. Signed-off-by: Thang Q. Nguyen --- Changes from v1: - Remove WARN_ON if dma_mask is NULL drivers/usb/dwc3/core.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index de5e01f..2479c24 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -831,6 +831,21 @@ static int dwc3_probe(struct platform_device *pdev) dwc->mem = mem; dwc->dev = dev; + /* Try to set 64-bit DMA first */ + if (!pdev->dev.dma_mask) + /* Platform did not initialize dma_mask */ + ret = dma_coerce_mask_and_coherent(&pdev->dev, + DMA_BIT_MASK(64)); + else + ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); + + /* If seting 64-bit DMA mask fails, fall back to 32-bit DMA mask */ + if (ret) { + ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); + if (ret) + return ret; + } + res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); if (!res) { dev_err(dev, "missing IRQ\n"); -- 2.2.0