summaryrefslogtreecommitdiffstats
path: root/drivers/usb/dwc2/core.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/dwc2/core.c')
-rw-r--r--drivers/usb/dwc2/core.c34
1 files changed, 32 insertions, 2 deletions
diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c
index d0af25f4b4..b198ba6bf8 100644
--- a/drivers/usb/dwc2/core.c
+++ b/drivers/usb/dwc2/core.c
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0+
+// SPDX-License-Identifier: GPL-2.0-or-later
#include "dwc2.h"
/* Returns the controller's GHWCFG2.OTG_MODE. */
@@ -61,6 +61,9 @@ static void dwc2_set_param_phy_type(struct dwc2 *dwc2)
case GHWCFG2_HS_PHY_TYPE_ULPI:
val = DWC2_PHY_TYPE_PARAM_ULPI;
break;
+ default:
+ dwc2_warn(dwc2, "Unhandled HS PHY type\n");
+ fallthrough;
case GHWCFG2_HS_PHY_TYPE_NOT_SUPPORTED:
val = DWC2_PHY_TYPE_PARAM_FS;
break;
@@ -185,6 +188,33 @@ void dwc2_set_default_params(struct dwc2 *dwc2)
}
}
+void dwc2_get_device_properties(struct dwc2 *dwc2)
+{
+ struct dwc2_core_params *p = &dwc2->params;
+ struct device_node *np = dwc2->dev->of_node;
+ int num;
+
+ if ((dwc2->dr_mode == USB_DR_MODE_PERIPHERAL) ||
+ (dwc2->dr_mode == USB_DR_MODE_OTG)) {
+ of_property_read_u32(np, "g-rx-fifo-size",
+ &p->g_rx_fifo_size);
+
+ of_property_read_u32(np, "g-np-tx-fifo-size",
+ &p->g_np_tx_fifo_size);
+
+ num = of_property_count_elems_of_size(np, "g-tx-fifo-size", sizeof(u32));
+ if (num > 0) {
+ num = min(num, 15);
+ memset(p->g_tx_fifo_size, 0,
+ sizeof(p->g_tx_fifo_size));
+ of_property_read_u32_array(np,
+ "g-tx-fifo-size",
+ &p->g_tx_fifo_size[1],
+ num);
+ }
+ }
+}
+
int dwc2_check_core_version(struct dwc2 *dwc2)
{
struct dwc2_hw_params *hw = &dwc2->hw_params;
@@ -642,7 +672,7 @@ int dwc2_get_dr_mode(struct dwc2 *dwc2)
{
enum usb_dr_mode mode;
- mode = of_usb_get_dr_mode(dwc2->dev->device_node, NULL);
+ mode = of_usb_get_dr_mode(dwc2->dev->of_node, NULL);
dwc2->dr_mode = mode;
if (dwc2_hw_is_device(dwc2)) {