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

Commit 4c874ac2 authored by Hemant Kumar's avatar Hemant Kumar
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
[jackp@codeaurora.org: squashed with usb: host: Fix passing of
core-id property to xhci-plat]
Signed-off-by: default avatarHemant Kumar <hemantk@codeaurora.org>
parent 90d1f7e7
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -96,6 +96,7 @@ Optional properties:
			enable periodic ESS TX threshold.
 - 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
@@ -1130,6 +1130,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");
	device_property_read_u8(dev, "snps,rx-thr-num-pkt-prd",
+2 −0
Original line number Diff line number Diff line
@@ -987,6 +987,7 @@ struct dwc3_scratchpad_array {
 * @imod_interval: set the interrupt moderation interval in 250ns
 *                 increments or 0 to disable.
 * @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;
@@ -1157,6 +1158,7 @@ struct dwc3 {

	u16			imod_interval;
	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
@@ -44,7 +44,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];
@@ -54,6 +54,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)
@@ -104,6 +105,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_array = false;
		core_id_prop.type = DEV_PROP_U32;
		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
@@ -313,6 +313,9 @@ static int xhci_plat_probe(struct platform_device *pdev)
	device_property_read_u32(&pdev->dev, "imod-interval-ns",
				 &xhci->imod_interval);

	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