#ifdef CONFIG_AMLOGIC_LEGACY_EARLY_SUSPEND
#include <linux/amlogic/pm.h>
#endif
+#include <linux/extcon.h>
#define DWC_DRIVER_VERSION "3.10a 12-MAY-2014"
#define DWC_DRIVER_DESC "HS OTG USB Controller driver"
struct dwc_otg_driver_module_params *pcore_para;
static int dcount;
int controller_type = USB_NORMAL;
+#if IS_ENABLED(CONFIG_EXTCON)
+ bool g_extcon_always_on = false;
+#endif
dev_dbg(&pdev->dev, "dwc_otg_driver_probe(%p)\n", pdev);
phy_interface = 2;
}
+#if IS_ENABLED(CONFIG_EXTCON)
+ g_extcon_always_on =
+ of_property_read_bool(of_node, "g-extcon-always-on");
+#endif
+
dwc_otg_module_params.host_rx_fifo_size = dwc_otg_module_params.data_fifo_size / 2;
DWC_PRINTF("dwc_otg: %s: type: %d speed: %d, ",
s_clock_name, port_type, port_speed);
memset(dwc_otg_device, 0, sizeof(*dwc_otg_device));
dwc_otg_device->os_dep.reg_offset = 0xFFFFFFFF;
+#if IS_ENABLED(CONFIG_EXTCON)
+ if (g_extcon_always_on) {
+ struct extcon_dev *edev;
+ static const unsigned int supported_cable[] = {
+ EXTCON_USB,
+ EXTCON_NONE,
+ };
+
+ edev = devm_extcon_dev_allocate(&pdev->dev, supported_cable);
+ if (IS_ERR(edev))
+ return PTR_ERR(edev);
+
+ retval = devm_extcon_dev_register(&pdev->dev, edev);
+ if (retval)
+ return retval;
+
+ extcon_set_cable_state_(edev, EXTCON_USB, true);
+ }
+#endif
+
/*
* Map the DWC_otg Core memory into virtual address space.
*/