linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pankaj Dubey <pankaj.dubey@samsung.com>
To: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: mathias.nyman@intel.com, gregkh@linuxfoundation.org,
	jingoohan1@gmail.com, krzk@kernel.org, mgautam@codeaurora.org,
	robin.murphy@arm.com, felipe.balbi@linux.intel.com,
	Sriram Dash <sriram.dash@samsung.com>,
	Pankaj Dubey <pankaj.dubey@samsung.com>
Subject: [PATCH] usb: xhci: inherit dma_mask from bus if set correctly
Date: Tue, 02 Apr 2019 15:10:11 +0530	[thread overview]
Message-ID: <1554198011-24342-1-git-send-email-pankaj.dubey@samsung.com> (raw)
In-Reply-To: CGME20190402094246epcas1p1f43795d840b4c3a1f7efddc0523b2c89@epcas1p1.samsung.com

From: Sriram Dash <sriram.dash@samsung.com>

The xhci forcefully converts the dma_mask to either 64 or 32 and the
dma-mask set by the bus is somewhat ignored. If the platform  sets the
correct dma_mask, then respect that.

Signed-off-by: Pankaj Dubey <pankaj.dubey@samsung.com>
Signed-off-by: Sriram Dash <sriram.dash@samsung.com>
---
 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 005e659..55cf89e 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -5119,6 +5119,16 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks)
 		dma_set_coherent_mask(dev, DMA_BIT_MASK(32));
 	}
 
+	/*
+	 * A platform may require coherent masks other than 64/32 bit, and we
+	 * should respect that. If the firmware has already requested for a
+	 * dma-range, we inherit the dma_mask presuming the platform knows
+	 * what it is doing.
+	 */
+
+	if (dev->bus_dma_mask)
+		dma_set_mask_and_coherent(dev, dev->bus_dma_mask);
+
 	xhci_dbg(xhci, "Calling HCD init\n");
 	/* Initialize HCD and host controller data structures. */
 	retval = xhci_init(hcd);
-- 
2.7.4


       reply	other threads:[~2019-04-02  9:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20190402094246epcas1p1f43795d840b4c3a1f7efddc0523b2c89@epcas1p1.samsung.com>
2019-04-02  9:40 ` Pankaj Dubey [this message]
2019-04-02 10:02   ` [PATCH] usb: xhci: inherit dma_mask from bus if set correctly Robin Murphy
2019-04-02 16:22     ` Pankaj Dubey
2019-04-09  2:56       ` Sriram Dash
2019-04-09 23:02         ` Robin Murphy
2019-04-24  9:05           ` Pankaj Dubey
2019-04-24 10:58             ` Robin Murphy
2019-04-26  4:46               ` Pankaj Dubey
2019-04-26 14:03                 ` Robin Murphy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1554198011-24342-1-git-send-email-pankaj.dubey@samsung.com \
    --to=pankaj.dubey@samsung.com \
    --cc=felipe.balbi@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jingoohan1@gmail.com \
    --cc=krzk@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mathias.nyman@intel.com \
    --cc=mgautam@codeaurora.org \
    --cc=robin.murphy@arm.com \
    --cc=sriram.dash@samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).