Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 70d5cdf6 authored by Chandana Kishori Chiluveru's avatar Chandana Kishori Chiluveru Committed by Gerrit - the friendly Code Review server
Browse files

dwc3-msm: Map IPA GSI channel doorbell register for different UDC core



Currently GSI endpoint usb_request pointer is allocated only once
during boot time and it used by dwc3 driver for mapping doorbell register
address with USB endpoint request only once. During composition switch
or connect/disconnect scenarios same USB endpoint is being re-enabled and
does not create mapping again.

On some platforms multiple UDC cores can work in device mode. In case of
binding the UDC with primary controller first and then disconnect the
primary and bind UDC to secondary controller. Driver does not re-mapping
the doorbell address with current UDC core and USB GSI wrapper is trying
to access previously mapped GSI DBL address with previous core
resulting into smmu fault.

Fix this issue by adding re-mapping of doorbell using dwc->sysdev node
to map the doorbell register with correct UDC.

Change-Id: I327126148c2311884aee2aa99bb59b7add06e302
Signed-off-by: default avatarChandana Kishori Chiluveru <cchiluve@codeaurora.org>
parent f4f64c90
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -976,11 +976,20 @@ static void gsi_store_ringbase_dbl_info(struct usb_ep *ep,
		GSI_RING_BASE_ADDR_L(mdwc->gsi_reg[RING_BASE_ADDR_L], (n)),
		dwc3_trb_dma_offset(dep, &dep->trb_pool[0]));

	if (request->mapped_db_reg_phs_addr_lsb &&
			dwc->sysdev != request->dev) {
		dma_unmap_resource(request->dev,
			request->mapped_db_reg_phs_addr_lsb,
			PAGE_SIZE, DMA_BIDIRECTIONAL, 0);
		request->mapped_db_reg_phs_addr_lsb = 0;
	}

	if (!request->mapped_db_reg_phs_addr_lsb) {
		request->mapped_db_reg_phs_addr_lsb =
			dma_map_resource(dwc->sysdev,
				(phys_addr_t)request->db_reg_phs_addr_lsb,
				PAGE_SIZE, DMA_BIDIRECTIONAL, 0);
		request->dev = dwc->sysdev;
		if (dma_mapping_error(dwc->sysdev,
				request->mapped_db_reg_phs_addr_lsb))
			dev_err(mdwc->dev, "mapping error for db_reg_phs_addr_lsb\n");
+2 −0
Original line number Diff line number Diff line
@@ -85,6 +85,7 @@ enum gsi_ep_op {
 * @db_reg_phs_addr_msb: IPA channel doorbell register's physical address MSB
 * @sgt_trb_xfer_ring: USB TRB ring related sgtable entries
 * @sgt_data_buff: Data buffer related sgtable entries
 * @dev: pointer to the DMA-capable dwc device
 */
struct usb_gsi_request {
	void *buf_base_addr;
@@ -96,6 +97,7 @@ struct usb_gsi_request {
	u32 db_reg_phs_addr_msb;
	struct sg_table sgt_trb_xfer_ring;
	struct sg_table sgt_data_buff;
	struct device *dev;
};

/*