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

Commit eb619026 authored by Jack Pham's avatar Jack Pham
Browse files

usb: dwc3: Fix setting of hird_thres property



First there was a one character typo ("res" instead of "ret")
that prevented the read value of the "snps,hird_thres" property
from being applied properly. Secondly, of_property_read_u8()
expects the property to be set in DT thusly:

     snps,hird_thresh = /bits/ 8 <0x1f>;

Without the "/bits/ 8" specifier, the device tree compiler will
typically encode an integer value as 32-bits, and
of_property_read_u8() will fail to read it. Let's relax the bit
width requirement in device tree and simply read it as a full
integer into a temporary variable instead, which can then be
downcasted to the u8 member.

Change-Id: Ia3894b0d57eab223aab8baa3f10a355d51d07469
Signed-off-by: default avatarJack Pham <jackp@codeaurora.org>
parent 3511ae2a
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -572,6 +572,7 @@ static int dwc3_probe(struct platform_device *pdev)
	void __iomem		*regs;
	void			*mem;

	u32			hird_thresh;
	u8			mode;
	bool			host_only_mode;

@@ -636,8 +637,10 @@ 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)
	ret = of_property_read_u32(node, "snps,hird_thresh", &hird_thresh);
	if (!ret)
		dwc->hird_thresh = (u8) hird_thresh;
	else
		dwc->hird_thresh = DWC3_DCTL_HIRD_THRES_DEFAULT;

	dwc->enable_bus_suspend = of_property_read_bool(node,
+1 −1
Original line number Diff line number Diff line
@@ -250,7 +250,7 @@
#define DWC3_DCTL_LSFTRST	(1 << 29)

#define DWC3_DCTL_HIRD_THRES_MASK	(0x1f << 24)
#define DWC3_DCTL_HIRD_THRES(n)	((n) << 24)
#define DWC3_DCTL_HIRD_THRES(n)	(((n) << 24) & DWC3_DCTL_HIRD_THRES_MASK)

#define DWC3_DCTL_APPL1RES	(1 << 23)