@@ -150,6 +150,16 @@ config USB_DWC3_IMX8MP
functionality.
Say 'Y' or 'M' if you have one such device.
+config USB_DWC3_LAYERSCAPE
+ tristate "NXP Layerscape Platform"
+ depends on OF && COMMON_CLK
+ depends on ARCH_LAYERSCAPE || COMPILE_TEST
+ default USB_DWC3
+ help
+ NXP LAYERSCAPE SoC use DesignWare Core IP for USB2/3
+ functionality.
+ Say 'Y' or 'M' if you have one such device.
+
config USB_DWC3_XILINX
tristate "Xilinx Platforms"
depends on (ARCH_ZYNQMP || COMPILE_TEST) && OF
@@ -54,6 +54,7 @@ obj-$(CONFIG_USB_DWC3_ST) += dwc3-st.o
obj-$(CONFIG_USB_DWC3_QCOM) += dwc3-qcom.o
obj-$(CONFIG_USB_DWC3_QCOM) += dwc3-qcom-legacy.o
obj-$(CONFIG_USB_DWC3_IMX8MP) += dwc3-imx8mp.o
+obj-$(CONFIG_USB_DWC3_LAYERSCAPE) += dwc3-layerscape.o
obj-$(CONFIG_USB_DWC3_XILINX) += dwc3-xilinx.o
obj-$(CONFIG_USB_DWC3_OCTEON) += dwc3-octeon.o
obj-$(CONFIG_USB_DWC3_RTK) += dwc3-rtk.o
new file mode 100644
@@ -0,0 +1,88 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2020 NXP
+ */
+
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/platform_device.h>
+#include <linux/usb/of.h>
+
+#include "core.h"
+#include "glue.h"
+
+struct dwc3_ls {
+ struct device *dev;
+ struct dwc3 dwc;
+};
+
+static int dwc3_ls_probe(struct platform_device *pdev)
+{
+ struct device_node *np = pdev->dev.of_node;
+ struct dwc3_probe_data probe_data = {};
+ struct property_entry props[2] = {};
+ struct device *dev = &pdev->dev;
+ struct resource *res;
+ struct dwc3_ls *ls;
+ int prop_idx = 0;
+ int ret = 0;
+
+ ls = devm_kzalloc(&pdev->dev, sizeof(*ls), GFP_KERNEL);
+ if (!ls)
+ return -ENOMEM;
+
+ ls->dev = &pdev->dev;
+
+ ls->dwc.dev = dev;
+
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ if (!res)
+ dev_err_probe(&pdev->dev, -ENODEV, "missing memory resource\n");
+
+ if (of_dma_is_coherent(np))
+ props[prop_idx++] = PROPERTY_ENTRY_U16("snps,gsbuscfg0-reqinfo", 0x2222);
+
+ if (prop_idx)
+ ret = device_create_managed_software_node(dev, props, NULL);
+
+ if (ret)
+ return dev_err_probe(dev, ret, "fail create software managed property node\n");
+
+ probe_data.dwc = &ls->dwc;
+ probe_data.res = res;
+ ret = dwc3_core_probe(&probe_data);
+ if (ret)
+ return dev_err_probe(dev, ret, "failed to register DWC3 Core\n");
+
+ return 0;
+}
+
+static void dwc3_ls_remove(struct platform_device *pdev)
+{
+ struct dwc3 *dwc = platform_get_drvdata(pdev);
+
+ dwc3_core_remove(dwc);
+}
+
+static const struct of_device_id of_dwc3_ls_match[] = {
+ {
+ .compatible = "fsl,ls1028a-dwc3"
+ },
+ {},
+};
+MODULE_DEVICE_TABLE(of, of_dwc3_ls_match);
+
+static struct platform_driver dwc3_ls_driver = {
+ .probe = dwc3_ls_probe,
+ .remove = dwc3_ls_remove,
+ .driver = {
+ .name = "ls-dwc3",
+ .of_match_table = of_dwc3_ls_match,
+ },
+};
+
+module_platform_driver(dwc3_ls_driver);
+
+MODULE_AUTHOR("Frank Li <frank.li@nxp.com>");
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("Freescale Layerscape USB3 Controller Driver");
Add layerscape dwc3 support by using flatten dwc3 core library. Layerscape dwc3 need set software managed property snps,gsbuscfg0-reqinfo as 0x2222 when dma-coherence set. Signed-off-by: Frank Li <Frank.Li@nxp.com> --- drivers/usb/dwc3/Kconfig | 10 +++++ drivers/usb/dwc3/Makefile | 1 + drivers/usb/dwc3/dwc3-layerscape.c | 88 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 99 insertions(+)