Commit abdd1eef authored by Prashanth K's avatar Prashanth K Committed by Greg Kroah-Hartman
Browse files

usb: dwc3: Remove of dep->regs



Remove dep->regs from struct dwc3_ep and reuse dwc->regs instead.
Thus eliminating redundant iomem addresses and making register
access more consistent across the driver.

Signed-off-by: default avatarPrashanth K <prashanth.k@oss.qualcomm.com>
Acked-by: default avatarThinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://patch.msgid.link/20260114100748.2950103-2-prashanth.k@oss.qualcomm.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent cea2a125
Loading
Loading
Loading
Loading
+4 −6
Original line number Diff line number Diff line
@@ -165,10 +165,10 @@
#define DWC3_DCFG1		0xc740 /* DWC_usb32 only */

#define DWC3_DEP_BASE(n)	(0xc800 + ((n) * 0x10))
#define DWC3_DEPCMDPAR2		0x00
#define DWC3_DEPCMDPAR1		0x04
#define DWC3_DEPCMDPAR0		0x08
#define DWC3_DEPCMD		0x0c
#define DWC3_DEPCMDPAR2(n)	(DWC3_DEP_BASE(n) + 0x00)
#define DWC3_DEPCMDPAR1(n)	(DWC3_DEP_BASE(n) + 0x04)
#define DWC3_DEPCMDPAR0(n)	(DWC3_DEP_BASE(n) + 0x08)
#define DWC3_DEPCMD(n)		(DWC3_DEP_BASE(n) + 0x0c)

#define DWC3_DEV_IMOD(n)	(0xca00 + ((n) * 0x4))

@@ -749,8 +749,6 @@ struct dwc3_ep {
	struct list_head	pending_list;
	struct list_head	started_list;

	void __iomem		*regs;

	struct dwc3_trb		*trb_pool;
	dma_addr_t		trb_pool_dma;
	struct dwc3		*dwc;
+4 −8
Original line number Diff line number Diff line
@@ -36,23 +36,19 @@
#define dump_ep_register_set(n)			\
	{					\
		.name = "DEPCMDPAR2("__stringify(n)")",	\
		.offset = DWC3_DEP_BASE(n) +	\
			DWC3_DEPCMDPAR2,	\
		.offset = DWC3_DEPCMDPAR2(n),	\
	},					\
	{					\
		.name = "DEPCMDPAR1("__stringify(n)")",	\
		.offset = DWC3_DEP_BASE(n) +	\
			DWC3_DEPCMDPAR1,	\
		.offset = DWC3_DEPCMDPAR1(n),	\
	},					\
	{					\
		.name = "DEPCMDPAR0("__stringify(n)")",	\
		.offset = DWC3_DEP_BASE(n) +	\
			DWC3_DEPCMDPAR0,	\
		.offset = DWC3_DEPCMDPAR0(n),	\
	},					\
	{					\
		.name = "DEPCMD("__stringify(n)")",	\
		.offset = DWC3_DEP_BASE(n) +	\
			DWC3_DEPCMD,		\
		.offset = DWC3_DEPCMD(n),		\
	}


+6 −6
Original line number Diff line number Diff line
@@ -320,6 +320,7 @@ int dwc3_send_gadget_ep_cmd(struct dwc3_ep *dep, unsigned int cmd,

	int			cmd_status = 0;
	int			ret = -EINVAL;
	u8			epnum = dep->number;

	/*
	 * When operating in USB 2.0 speeds (HS/FS), if GUSB2PHYCFG.ENBLSLPM or
@@ -355,9 +356,9 @@ int dwc3_send_gadget_ep_cmd(struct dwc3_ep *dep, unsigned int cmd,
	 * improve performance.
	 */
	if (DWC3_DEPCMD_CMD(cmd) != DWC3_DEPCMD_UPDATETRANSFER) {
		dwc3_writel(dep->regs, DWC3_DEPCMDPAR0, params->param0);
		dwc3_writel(dep->regs, DWC3_DEPCMDPAR1, params->param1);
		dwc3_writel(dep->regs, DWC3_DEPCMDPAR2, params->param2);
		dwc3_writel(dwc->regs, DWC3_DEPCMDPAR0(epnum), params->param0);
		dwc3_writel(dwc->regs, DWC3_DEPCMDPAR1(epnum), params->param1);
		dwc3_writel(dwc->regs, DWC3_DEPCMDPAR2(epnum), params->param2);
	}

	/*
@@ -381,7 +382,7 @@ int dwc3_send_gadget_ep_cmd(struct dwc3_ep *dep, unsigned int cmd,
	else
		cmd |= DWC3_DEPCMD_CMDACT;

	dwc3_writel(dep->regs, DWC3_DEPCMD, cmd);
	dwc3_writel(dwc->regs, DWC3_DEPCMD(epnum), cmd);

	if (!(cmd & DWC3_DEPCMD_CMDACT) ||
		(DWC3_DEPCMD_CMD(cmd) == DWC3_DEPCMD_ENDTRANSFER &&
@@ -391,7 +392,7 @@ int dwc3_send_gadget_ep_cmd(struct dwc3_ep *dep, unsigned int cmd,
	}

	do {
		reg = dwc3_readl(dep->regs, DWC3_DEPCMD);
		reg = dwc3_readl(dwc->regs, DWC3_DEPCMD(epnum));
		if (!(reg & DWC3_DEPCMD_CMDACT)) {
			cmd_status = DWC3_DEPCMD_STATUS(reg);

@@ -3381,7 +3382,6 @@ static int dwc3_gadget_init_endpoint(struct dwc3 *dwc, u8 epnum)
	dep->dwc = dwc;
	dep->number = epnum;
	dep->direction = direction;
	dep->regs = dwc->regs + DWC3_DEP_BASE(epnum);
	dwc->eps[epnum] = dep;
	dep->combo_num = 0;
	dep->start_cmd_status = 0;
+1 −1
Original line number Diff line number Diff line
@@ -132,7 +132,7 @@ static inline void dwc3_gadget_ep_get_transfer_index(struct dwc3_ep *dep)
{
	u32			res_id;

	res_id = dwc3_readl(dep->regs, DWC3_DEPCMD);
	res_id = dwc3_readl(dep->dwc->regs, DWC3_DEPCMD(dep->number));
	dep->resource_index = DWC3_DEPCMD_GET_RSC_IDX(res_id);
}