forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-04 1543e317f1da31b75942316931e8f491a8920811
kernel/drivers/usb/dwc3/dwc3-omap.c
....@@ -1,8 +1,8 @@
11 // SPDX-License-Identifier: GPL-2.0
2
-/**
2
+/*
33 * dwc3-omap.c - OMAP Specific Glue layer
44 *
5
- * Copyright (C) 2010-2011 Texas Instruments Incorporated - http://www.ti.com
5
+ * Copyright (C) 2010-2011 Texas Instruments Incorporated - https://www.ti.com
66 *
77 * Authors: Felipe Balbi <balbi@ti.com>,
88 * Sebastian Andrzej Siewior <bigeasy@linutronix.de>
....@@ -14,7 +14,6 @@
1414 #include <linux/irq.h>
1515 #include <linux/interrupt.h>
1616 #include <linux/platform_device.h>
17
-#include <linux/platform_data/dwc3-omap.h>
1817 #include <linux/pm_runtime.h>
1918 #include <linux/dma-mapping.h>
2019 #include <linux/ioport.h>
....@@ -105,6 +104,12 @@
105104 #define USBOTGSS_UTMI_OTG_CTRL_SESSEND BIT(3)
106105 #define USBOTGSS_UTMI_OTG_CTRL_SESSVALID BIT(2)
107106 #define USBOTGSS_UTMI_OTG_CTRL_VBUSVALID BIT(1)
107
+
108
+enum dwc3_omap_utmi_mode {
109
+ DWC3_OMAP_UTMI_MODE_UNKNOWN = 0,
110
+ DWC3_OMAP_UTMI_MODE_HW,
111
+ DWC3_OMAP_UTMI_MODE_SW,
112
+};
108113
109114 struct dwc3_omap {
110115 struct device *dev;
....@@ -237,7 +242,7 @@
237242 break;
238243
239244 case OMAP_DWC3_ID_FLOAT:
240
- if (omap->vbus_reg)
245
+ if (omap->vbus_reg && regulator_is_enabled(omap->vbus_reg))
241246 regulator_disable(omap->vbus_reg);
242247 val = dwc3_omap_read_utmi_ctrl(omap);
243248 val |= USBOTGSS_UTMI_OTG_CTRL_IDDIG;
....@@ -451,14 +456,11 @@
451456 struct device_node *node = pdev->dev.of_node;
452457
453458 struct dwc3_omap *omap;
454
- struct resource *res;
455459 struct device *dev = &pdev->dev;
456460 struct regulator *vbus_reg = NULL;
457461
458462 int ret;
459463 int irq;
460
-
461
- u32 reg;
462464
463465 void __iomem *base;
464466
....@@ -474,13 +476,10 @@
474476 platform_set_drvdata(pdev, omap);
475477
476478 irq = platform_get_irq(pdev, 0);
477
- if (irq < 0) {
478
- dev_err(dev, "missing IRQ resource: %d\n", irq);
479
+ if (irq < 0)
479480 return irq;
480
- }
481481
482
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
483
- base = devm_ioremap_resource(dev, res);
482
+ base = devm_platform_ioremap_resource(pdev, 0);
484483 if (IS_ERR(base))
485484 return PTR_ERR(base);
486485
....@@ -506,9 +505,6 @@
506505
507506 dwc3_omap_map_offset(omap);
508507 dwc3_omap_set_utmi_mode(omap);
509
-
510
- /* check the DMA Status */
511
- reg = dwc3_omap_readl(omap->base, USBOTGSS_SYSCONFIG);
512508
513509 ret = dwc3_omap_extcon_register(omap);
514510 if (ret < 0)