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

Commit d29d4a83 authored by Hemant Kumar's avatar Hemant Kumar Committed by Jack Pham
Browse files

usb: host: xhci: Add support for usb core indexing



Unique usb core id is used to differentiate between
different usb controllers.

Change-Id: Ibd886f704e7ecedfbf035b8e5adea2852ddf25bf
Signed-off-by: default avatarHemant Kumar <hemantk@codeaurora.org>
[jackp@codeaurora.org: squashed with usb: host: Fix passing of
core-id property to xhci-plat]
Signed-off-by: default avatarJack Pham <jackp@codeaurora.org>
parent c77da935
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -57,6 +57,7 @@ Optional properties:
	fladj_30mhz_sdbnd signal is invalid or incorrect.
 - snps,xhci-imod-value: Interrupt moderation interval for host mode
	(in increments of 250nsec).
 - usb-core-id: Differentiates between different controllers present on a device.

 - <DEPRECATED> tx-fifo-resize: determines if the FIFO *has* to be reallocated.

+3 −0
Original line number Diff line number Diff line
@@ -1036,6 +1036,9 @@ static void dwc3_get_properties(struct dwc3 *dwc)
	device_property_read_u32(dev, "snps,xhci-imod-value",
			&dwc->xhci_imod_value);

	dwc->core_id = -1;
	device_property_read_u32(dev, "usb-core-id", &dwc->core_id);

	dwc->usb3_lpm_capable = device_property_read_bool(dev,
				"snps,usb3_lpm_capable");

+2 −0
Original line number Diff line number Diff line
@@ -906,6 +906,7 @@ struct dwc3_scratchpad_array {
 * @index: dwc3's instance number
 * @dwc_ipc_log_ctxt: dwc3 ipc log context
 * @xhci_imod_value: imod value to use with xhci
 * @core_id: usb core id to differentiate different controller
 */
struct dwc3 {
	struct work_struct	drd_work;
@@ -1063,6 +1064,7 @@ struct dwc3 {
	void			*dwc_ipc_log_ctxt;
	struct dwc3_gadget_events	dbg_gadget_events;
	u32			xhci_imod_value;
	int			core_id;
};

#define work_to_dwc(w)		(container_of((w), struct dwc3, drd_work))
+11 −1
Original line number Diff line number Diff line
@@ -52,7 +52,7 @@ static int dwc3_host_get_irq(struct dwc3 *dwc)
	return irq;
}

#define NUMBER_OF_PROPS	4
#define NUMBER_OF_PROPS	5
int dwc3_host_init(struct dwc3 *dwc)
{
	struct property_entry	props[NUMBER_OF_PROPS];
@@ -62,6 +62,7 @@ int dwc3_host_init(struct dwc3 *dwc)
	struct platform_device	*dwc3_pdev = to_platform_device(dwc->dev);
	int			prop_idx = 0;
	struct property_entry	imod_prop;
	struct property_entry	core_id_prop;

	irq = dwc3_host_get_irq(dwc);
	if (irq < 0)
@@ -112,6 +113,15 @@ int dwc3_host_init(struct dwc3 *dwc)
		props[prop_idx++] = imod_prop;
	}

	if (dwc->core_id >= 0) {
		core_id_prop.name  = "usb-core-id";
		core_id_prop.length  = sizeof(u32);
		core_id_prop.is_string = false;
		core_id_prop.is_array = false;
		core_id_prop.value.u32_data = dwc->core_id;
		props[prop_idx++] = core_id_prop;
	}

	/**
	 * WORKAROUND: dwc3 revisions <=3.00a have a limitation
	 * where Port Disable command doesn't work.
+3 −0
Original line number Diff line number Diff line
@@ -327,6 +327,9 @@ static int xhci_plat_probe(struct platform_device *pdev)
	if (device_property_read_u32(&pdev->dev, "xhci-imod-value", &imod))
		imod = 0;

	if (device_property_read_u32(&pdev->dev, "usb-core-id", &xhci->core_id))
		xhci->core_id = -EINVAL;

	hcd->usb_phy = devm_usb_get_phy_by_phandle(sysdev, "usb-phy", 0);
	if (IS_ERR(hcd->usb_phy)) {
		ret = PTR_ERR(hcd->usb_phy);
Loading