[PATCH 2/3] usb: dwc3: of-simple: Add compatible string fsl,ls1028a-dwc3

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add compatible string fsl,ls1028a-dwc3 and create a software managed node
property 'snps,gsbuscfg0-reqinfo' to enable cache snoop if dma is coherent.

Signed-off-by: Frank Li <Frank.Li@xxxxxxx>
---
 drivers/usb/dwc3/dwc3-of-simple.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/drivers/usb/dwc3/dwc3-of-simple.c b/drivers/usb/dwc3/dwc3-of-simple.c
index be7be00ecb349..0aa21ddd93cda 100644
--- a/drivers/usb/dwc3/dwc3-of-simple.c
+++ b/drivers/usb/dwc3/dwc3-of-simple.c
@@ -18,6 +18,7 @@
 #include <linux/dma-mapping.h>
 #include <linux/clk.h>
 #include <linux/of.h>
+#include <linux/of_address.h>
 #include <linux/of_platform.h>
 #include <linux/pm_runtime.h>
 #include <linux/reset.h>
@@ -52,6 +53,26 @@ static int dwc3_of_simple_probe(struct platform_device *pdev)
 	if (of_device_is_compatible(np, "rockchip,rk3399-dwc3"))
 		simple->need_reset = true;
 
+	if (of_device_is_compatible(np, "fsl,ls1028a-dwc3")) {
+		struct device_node *np = dev->of_node;
+		struct property_entry props[2] = {};
+		int prop_idx = 0, ret = 0;
+		struct device_node *dwc3_np __free(device_node)
+				    = of_get_compatible_child(np, "snps,dwc3");
+
+		if (!dwc3_np)
+			return dev_err_probe(dev, -ENODEV, "failed to find dwc3 core child\n");
+
+		if (of_dma_is_coherent(dwc3_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 ret;
+	}
+
 	simple->resets = of_reset_control_array_get_optional_exclusive(np);
 	if (IS_ERR(simple->resets)) {
 		ret = PTR_ERR(simple->resets);
@@ -174,6 +195,7 @@ static const struct of_device_id of_dwc3_simple_match[] = {
 	{ .compatible = "hisilicon,hi3670-dwc3" },
 	{ .compatible = "hisilicon,hi3798mv200-dwc3" },
 	{ .compatible = "intel,keembay-dwc3" },
+	{ .compatible = "fsl,ls1028a-dwc3" },
 	{ /* Sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, of_dwc3_simple_match);

-- 
2.34.1





[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux