standard XHCI driver.
endif
+
+if USB_CDNS3_STARFIVE
+
+config USB_CDNS3_STARFIVE_EXTCON
+ bool "Extcon USB state support on Cadence USB3 of Starfive SoC"
+ depends on EXTCON
+ help
+ Say Y here to enable external connector event of the StarFive SoC
+ platforms that contain Cadence USB3 controller core.
+
+endif
#include <linux/reset.h>
#include <linux/regmap.h>
#include <linux/usb/otg.h>
+#if IS_ENABLED(CONFIG_USB_CDNS3_STARFIVE_EXTCON)
+#include <linux/extcon-provider.h>
+#endif
#include "core.h"
#define USB_STRAP_HOST BIT(17)
struct clk_bulk_data *clks;
int num_clks;
u32 stg_usb_mode;
+#if IS_ENABLED(CONFIG_USB_CDNS3_STARFIVE_EXTCON)
+ struct extcon_dev *edev;
+#endif
};
static void cdns_mode_init(struct platform_device *pdev,
clk_bulk_disable_unprepare(data->num_clks, data->clks);
}
+#if IS_ENABLED(CONFIG_USB_CDNS3_STARFIVE_EXTCON)
+static const unsigned int supported_cable[] = {
+ EXTCON_USB,
+ EXTCON_NONE,
+};
+#endif
+
static int cdns_starfive_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct cdns_starfive *data;
+#if IS_ENABLED(CONFIG_USB_CDNS3_STARFIVE_EXTCON)
+ struct extcon_dev *edev;
+#endif
unsigned int args;
int ret;
return -ENOMEM;
data->dev = dev;
+#if IS_ENABLED(CONFIG_USB_CDNS3_STARFIVE_EXTCON)
+ edev = devm_extcon_dev_allocate(dev, supported_cable);
+ if (IS_ERR(edev))
+ return PTR_ERR(edev);
+
+ ret = devm_extcon_dev_register(dev, edev);
+ if (ret)
+ return ret;
+
+ /* Set starfive cdns3 usb always connected because of hw limitation */
+ extcon_set_state_sync(edev, EXTCON_USB, true);
+
+ data->edev = edev;
+#endif
data->stg_syscon =
syscon_regmap_lookup_by_phandle_args(pdev->dev.of_node,