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

Commit 75aab42b authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "usb: dwc: allow pre-configuration of DCTL[HIRD_Thresh]"

parents 5e741700 e4b25646
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -22,6 +22,8 @@ Optional properties:
 - snps,ssphy-clear-auto-suspend-on-disconnect: If present, clear auto suspend feaure with ssusb phy
   during cable disconnect.
 - snps,usb3-u1u2-disable: If present, disable u1u2 low power modes for DWC3 core controller in SS mode.
 - snps,hird_thresh: If present, will determine the value of DCTL[HIRD_Thresh] which, in turn,
	controls the UTMI sleep mechanism vs. the PHY. Default value is 12.

This is usually a subnode to DWC3 glue to which it is connected.

@@ -33,6 +35,4 @@ dwc3@4a030000 {
	usb-phy = <&usb2_phy>, <&usb3,phy>;
	tx-fifo-resize;
	snps,hsphy-auto-suspend-disable;
	snps,ssphy-clear-auto-suspend-on-disconnect;
	snps,usb3-u1u2-disable;
};
+5 −0
Original line number Diff line number Diff line
@@ -61,6 +61,8 @@

#include "debug.h"

#define DWC3_DCTL_HIRD_THRES_DEFAULT	12

/* -------------------------------------------------------------------------- */

void dwc3_set_mode(struct dwc3 *dwc, u32 mode)
@@ -606,6 +608,9 @@ static int dwc3_probe(struct platform_device *pdev)
	dwc->usb3_u1u2_disable = of_property_read_bool(node,
						"snps,usb3-u1u2-disable");
	dwc->maximum_speed = of_usb_get_maximum_speed(node);
	ret = of_property_read_u8(node, "snps,hird_thresh", &dwc->hird_thresh);
	if (res)
		dwc->hird_thresh = DWC3_DCTL_HIRD_THRES_DEFAULT;

	if (node) {
		dwc->usb2_phy = devm_usb_get_phy_by_phandle(dev, "usb-phy", 0);
+4 −2
Original line number Diff line number Diff line
@@ -770,6 +770,8 @@ struct dwc3_scratchpad_array {
 * @ssphy_clear_auto_suspend_on_disconnect: if true, clear ssphy autosuspend bit
 *	during disconnect and set it after device is configured.
 * @usb3_u1u2_disable: if true, disable U1U2 low power modes in Superspeed mode.
 * @hird_thresh: value to configure in DCTL[HIRD_Thresh]
 * @in_lpm: if 1, indicates that the controller is in low power mode (no clocks)
 */
struct dwc3 {
	struct usb_ctrlrequest	*ctrl_req;
@@ -880,9 +882,9 @@ struct dwc3 {
	bool			ssphy_clear_auto_suspend_on_disconnect;
	bool			usb3_u1u2_disable;
	bool			enable_suspend_event;
	struct dwc3_gadget_events	dbg_gadget_events;

	u8			hird_thresh;
	atomic_t		in_lpm;
	struct dwc3_gadget_events	dbg_gadget_events;
};

/* -------------------------------------------------------------------------- */
+1 −7
Original line number Diff line number Diff line
@@ -2835,13 +2835,7 @@ static void dwc3_gadget_conndone_interrupt(struct dwc3 *dwc)

		reg = dwc3_readl(dwc->regs, DWC3_DCTL);
		reg &= ~(DWC3_DCTL_HIRD_THRES_MASK | DWC3_DCTL_L1_HIBER_EN);

		/*
		 * TODO: This should be configurable. For now using
		 * maximum allowed HIRD threshold value of 0b1100
		 */
		reg |= DWC3_DCTL_HIRD_THRES(12);

		reg |= DWC3_DCTL_HIRD_THRES(dwc->hird_thresh);
		dwc3_writel(dwc->regs, DWC3_DCTL, reg);
	}