summaryrefslogtreecommitdiffstats
path: root/drivers/usb/dwc3
diff options
context:
space:
mode:
authorKishon Vijay Abraham I <kishon@ti.com>2015-02-23 18:40:07 +0530
committerMarek Vasut <marex@denx.de>2015-04-14 05:48:10 +0200
commit3f52e1b98527a8943718871f85de10d37a24f011 (patch)
tree269cc29b66aa0b5b005bc37de8966168731ec3ee /drivers/usb/dwc3
parent27d3b89d3362c912dccf1d9d27bcefc1e361fe19 (diff)
downloadblackbird-obmc-uboot-3f52e1b98527a8943718871f85de10d37a24f011.tar.gz
blackbird-obmc-uboot-3f52e1b98527a8943718871f85de10d37a24f011.zip
usb: dwc3: dwc3-omap: make dwc3-omap build in uboot
*) Changed the included header files to that used in u-boot. *) Removed extcon_* APIs *) Removed regulator_* APIs *) Fixed other misc warnings *) Added dwc3-omap.h to include the definitions of UTMI modes. Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
Diffstat (limited to 'drivers/usb/dwc3')
-rw-r--r--drivers/usb/dwc3/dwc3-omap.c144
1 files changed, 8 insertions, 136 deletions
diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c
index ce2d6a6a52..b38598757d 100644
--- a/drivers/usb/dwc3/dwc3-omap.c
+++ b/drivers/usb/dwc3/dwc3-omap.c
@@ -14,21 +14,16 @@
* SPDX-License-Identifier: GPL-2.0
*/
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/slab.h>
-#include <linux/interrupt.h>
-#include <linux/platform_device.h>
-#include <linux/platform_data/dwc3-omap.h>
-#include <linux/dma-mapping.h>
+#include <common.h>
+#include <malloc.h>
+#include <asm/io.h>
+#include <linux/usb/dwc3-omap.h>
#include <linux/ioport.h>
-#include <linux/io.h>
-#include <linux/of.h>
-#include <linux/of_platform.h>
-#include <linux/extcon.h>
-#include <linux/regulator/consumer.h>
#include <linux/usb/otg.h>
+#include <linux/compat.h>
+
+#include "linux-compat.h"
/*
* All these registers belong to OMAP's Wrapper around the
@@ -113,7 +108,6 @@
struct dwc3_omap {
struct device *dev;
- int irq;
void __iomem *base;
u32 utmi_otg_status;
@@ -124,13 +118,6 @@ struct dwc3_omap {
u32 irq0_offset;
u32 dma_status:1;
-
- struct extcon_specific_cable_nb extcon_vbus_dev;
- struct extcon_specific_cable_nb extcon_id_dev;
- struct notifier_block vbus_nb;
- struct notifier_block id_nb;
-
- struct regulator *vbus_reg;
};
enum omap_dwc3_vbus_id_status {
@@ -205,21 +192,12 @@ static void dwc3_omap_write_irq0_set(struct dwc3_omap *omap, u32 value)
static void dwc3_omap_set_mailbox(struct dwc3_omap *omap,
enum omap_dwc3_vbus_id_status status)
{
- int ret;
u32 val;
switch (status) {
case OMAP_DWC3_ID_GROUND:
dev_dbg(omap->dev, "ID GND\n");
- if (omap->vbus_reg) {
- ret = regulator_enable(omap->vbus_reg);
- if (ret) {
- dev_dbg(omap->dev, "regulator enable failed\n");
- return;
- }
- }
-
val = dwc3_omap_read_utmi_status(omap);
val &= ~(USBOTGSS_UTMI_OTG_STATUS_IDDIG
| USBOTGSS_UTMI_OTG_STATUS_VBUSVALID
@@ -242,9 +220,6 @@ static void dwc3_omap_set_mailbox(struct dwc3_omap *omap,
break;
case OMAP_DWC3_ID_FLOAT:
- if (omap->vbus_reg)
- regulator_disable(omap->vbus_reg);
-
case OMAP_DWC3_VBUS_OFF:
dev_dbg(omap->dev, "VBUS Disconnect\n");
@@ -349,32 +324,6 @@ static void dwc3_omap_disable_irqs(struct dwc3_omap *omap)
static u64 dwc3_omap_dma_mask = DMA_BIT_MASK(32);
-static int dwc3_omap_id_notifier(struct notifier_block *nb,
- unsigned long event, void *ptr)
-{
- struct dwc3_omap *omap = container_of(nb, struct dwc3_omap, id_nb);
-
- if (event)
- dwc3_omap_set_mailbox(omap, OMAP_DWC3_ID_GROUND);
- else
- dwc3_omap_set_mailbox(omap, OMAP_DWC3_ID_FLOAT);
-
- return NOTIFY_DONE;
-}
-
-static int dwc3_omap_vbus_notifier(struct notifier_block *nb,
- unsigned long event, void *ptr)
-{
- struct dwc3_omap *omap = container_of(nb, struct dwc3_omap, vbus_nb);
-
- if (event)
- dwc3_omap_set_mailbox(omap, OMAP_DWC3_VBUS_VALID);
- else
- dwc3_omap_set_mailbox(omap, OMAP_DWC3_VBUS_OFF);
-
- return NOTIFY_DONE;
-}
-
static void dwc3_omap_map_offset(struct dwc3_omap *omap)
{
struct device_node *node = omap->dev->of_node;
@@ -420,42 +369,6 @@ static void dwc3_omap_set_utmi_mode(struct dwc3_omap *omap)
dwc3_omap_write_utmi_status(omap, reg);
}
-static int dwc3_omap_extcon_register(struct dwc3_omap *omap)
-{
- int ret;
- struct device_node *node = omap->dev->of_node;
- struct extcon_dev *edev;
-
- if (of_property_read_bool(node, "extcon")) {
- edev = extcon_get_edev_by_phandle(omap->dev, 0);
- if (IS_ERR(edev)) {
- dev_vdbg(omap->dev, "couldn't get extcon device\n");
- return -EPROBE_DEFER;
- }
-
- omap->vbus_nb.notifier_call = dwc3_omap_vbus_notifier;
- ret = extcon_register_interest(&omap->extcon_vbus_dev,
- edev->name, "USB",
- &omap->vbus_nb);
- if (ret < 0)
- dev_vdbg(omap->dev, "failed to register notifier for USB\n");
-
- omap->id_nb.notifier_call = dwc3_omap_id_notifier;
- ret = extcon_register_interest(&omap->extcon_id_dev,
- edev->name, "USB-HOST",
- &omap->id_nb);
- if (ret < 0)
- dev_vdbg(omap->dev, "failed to register notifier for USB-HOST\n");
-
- if (extcon_get_cable_state(edev, "USB") == true)
- dwc3_omap_set_mailbox(omap, OMAP_DWC3_VBUS_VALID);
- if (extcon_get_cable_state(edev, "USB-HOST") == true)
- dwc3_omap_set_mailbox(omap, OMAP_DWC3_ID_GROUND);
- }
-
- return 0;
-}
-
static int dwc3_omap_probe(struct platform_device *pdev)
{
struct device_node *node = pdev->dev.of_node;
@@ -463,11 +376,8 @@ static int dwc3_omap_probe(struct platform_device *pdev)
struct dwc3_omap *omap;
struct resource *res;
struct device *dev = &pdev->dev;
- struct regulator *vbus_reg = NULL;
int ret;
- int irq;
-
u32 reg;
void __iomem *base;
@@ -483,29 +393,13 @@ static int dwc3_omap_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, omap);
- irq = platform_get_irq(pdev, 0);
- if (irq < 0) {
- dev_err(dev, "missing IRQ resource\n");
- return -EINVAL;
- }
-
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
base = devm_ioremap_resource(dev, res);
if (IS_ERR(base))
return PTR_ERR(base);
- if (of_property_read_bool(node, "vbus-supply")) {
- vbus_reg = devm_regulator_get(dev, "vbus");
- if (IS_ERR(vbus_reg)) {
- dev_err(dev, "vbus init failed\n");
- return PTR_ERR(vbus_reg);
- }
- }
-
omap->dev = dev;
- omap->irq = irq;
omap->base = base;
- omap->vbus_reg = vbus_reg;
dev->dma_mask = &dwc3_omap_dma_mask;
dwc3_omap_map_offset(omap);
@@ -515,34 +409,16 @@ static int dwc3_omap_probe(struct platform_device *pdev)
reg = dwc3_omap_readl(omap->base, USBOTGSS_SYSCONFIG);
omap->dma_status = !!(reg & USBOTGSS_SYSCONFIG_DMADISABLE);
- ret = devm_request_irq(dev, omap->irq, dwc3_omap_interrupt, 0,
- "dwc3-omap", omap);
- if (ret) {
- dev_err(dev, "failed to request IRQ #%d --> %d\n",
- omap->irq, ret);
- goto err0;
- }
-
dwc3_omap_enable_irqs(omap);
- ret = dwc3_omap_extcon_register(omap);
- if (ret < 0)
- goto err1;
-
ret = of_platform_populate(node, NULL, NULL, dev);
if (ret) {
dev_err(&pdev->dev, "failed to create dwc3 core\n");
- goto err2;
+ goto err1;
}
return 0;
-err2:
- if (omap->extcon_vbus_dev.edev)
- extcon_unregister_interest(&omap->extcon_vbus_dev);
- if (omap->extcon_id_dev.edev)
- extcon_unregister_interest(&omap->extcon_id_dev);
-
err1:
dwc3_omap_disable_irqs(omap);
@@ -554,10 +430,6 @@ static int dwc3_omap_remove(struct platform_device *pdev)
{
struct dwc3_omap *omap = platform_get_drvdata(pdev);
- if (omap->extcon_vbus_dev.edev)
- extcon_unregister_interest(&omap->extcon_vbus_dev);
- if (omap->extcon_id_dev.edev)
- extcon_unregister_interest(&omap->extcon_id_dev);
dwc3_omap_disable_irqs(omap);
device_for_each_child(&pdev->dev, NULL, dwc3_omap_remove_core);
OpenPOWER on IntegriCloud