All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] usb: misc: Add support for Microchip USB5744
@ 2021-02-09 10:48 ` Michal Simek
  0 siblings, 0 replies; 18+ messages in thread
From: Michal Simek @ 2021-02-09 10:48 UTC (permalink / raw)
  To: linux-kernel, monstr, michal.simek, git
  Cc: Al Cooper, Alan Stern, Alexander A. Klimov, Bastien Nocera,
	Greg Kroah-Hartman, Masahiro Yamada, Piyush Mehta, Rob Herring,
	devicetree, linux-arm-kernel, linux-usb

Hi,

the series is adding basic support for this USB hub. The key part is
running reset over GPIO line and when i2c is connected it is necessary to
send command to boot the hub. This chip is available on Xilinx
zcu100/Ultra96 v1 board.

Thanks,
Michal

Changes in v2:
- s/USB_USB5744/USB_HUB_USB5744/g
- Fix order in Makefile and Kconfig

Piyush Mehta (2):
  dt-bindings: usb: misc: Add binding for Microchip usb5744 hub
  usb: misc: usb5744: Add support for USB hub controller

 .../bindings/usb/microchip,usb5744.yaml       |  56 +++++++++
 MAINTAINERS                                   |   2 +
 drivers/usb/misc/Kconfig                      |   9 ++
 drivers/usb/misc/Makefile                     |   1 +
 drivers/usb/misc/usb5744.c                    | 115 ++++++++++++++++++
 5 files changed, 183 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/microchip,usb5744.yaml
 create mode 100644 drivers/usb/misc/usb5744.c

-- 
2.30.0


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH v2 0/2] usb: misc: Add support for Microchip USB5744
@ 2021-02-09 10:48 ` Michal Simek
  0 siblings, 0 replies; 18+ messages in thread
From: Michal Simek @ 2021-02-09 10:48 UTC (permalink / raw)
  To: linux-kernel, monstr, michal.simek, git
  Cc: devicetree, linux-usb, Alexander A. Klimov, Greg Kroah-Hartman,
	Masahiro Yamada, Al Cooper, Rob Herring, Alan Stern,
	Bastien Nocera, Piyush Mehta, linux-arm-kernel

Hi,

the series is adding basic support for this USB hub. The key part is
running reset over GPIO line and when i2c is connected it is necessary to
send command to boot the hub. This chip is available on Xilinx
zcu100/Ultra96 v1 board.

Thanks,
Michal

Changes in v2:
- s/USB_USB5744/USB_HUB_USB5744/g
- Fix order in Makefile and Kconfig

Piyush Mehta (2):
  dt-bindings: usb: misc: Add binding for Microchip usb5744 hub
  usb: misc: usb5744: Add support for USB hub controller

 .../bindings/usb/microchip,usb5744.yaml       |  56 +++++++++
 MAINTAINERS                                   |   2 +
 drivers/usb/misc/Kconfig                      |   9 ++
 drivers/usb/misc/Makefile                     |   1 +
 drivers/usb/misc/usb5744.c                    | 115 ++++++++++++++++++
 5 files changed, 183 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/microchip,usb5744.yaml
 create mode 100644 drivers/usb/misc/usb5744.c

-- 
2.30.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH v2 1/2] dt-bindings: usb: misc: Add binding for Microchip usb5744 hub
  2021-02-09 10:48 ` Michal Simek
@ 2021-02-09 10:48   ` Michal Simek
  -1 siblings, 0 replies; 18+ messages in thread
From: Michal Simek @ 2021-02-09 10:48 UTC (permalink / raw)
  To: linux-kernel, monstr, michal.simek, git
  Cc: Piyush Mehta, Greg Kroah-Hartman, Rob Herring, devicetree,
	linux-arm-kernel, linux-usb

From: Piyush Mehta <piyush.mehta@xilinx.com>

Added dt binding for usb5744 driver.

Signed-off-by: Piyush Mehta <piyush.mehta@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---

Changes in v2: None

 .../bindings/usb/microchip,usb5744.yaml       | 56 +++++++++++++++++++
 MAINTAINERS                                   |  1 +
 2 files changed, 57 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/microchip,usb5744.yaml

diff --git a/Documentation/devicetree/bindings/usb/microchip,usb5744.yaml b/Documentation/devicetree/bindings/usb/microchip,usb5744.yaml
new file mode 100644
index 000000000000..fe222f6db81d
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/microchip,usb5744.yaml
@@ -0,0 +1,56 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/usb/microchip,usb5744.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: Bindings for the Microchip USB5744 4-port Hub Controller
+
+description:
+  Microchip’s USB5744 SmartHub™ IC is a 4 port, SuperSpeed (SS)/Hi-Speed (HS),
+  low power, low pin count configurable and fully compliant with the USB 3.1
+  Gen 1 specification. The USB5744 also supports Full Speed (FS) and Low Speed
+  (LS) USB signaling, offering complete coverage of all defined USB operating
+  speeds. The new SuperSpeed hubs operate in parallel with the USB 2.0
+  controller, so 5 Gbps SuperSpeed data transfers are not affected by slower
+  USB 2.0 traffic.
+
+maintainers:
+  - Piyush Mehta <piyush.mehta@xilinx.com>
+  - Michal Simek <michal.simek@xilinx.com>
+
+properties:
+  compatible:
+    const: microchip,usb5744
+
+  reg:
+    maxItems: 1
+    description: |
+      Specifies the i2c slave address, it is required and should be 0x2d
+      if I2C is used.
+
+  reset-gpios:
+    maxItems: 1
+    description:
+      The phandle and specifier for the GPIO that controls the RESET line of
+      USB hub.
+
+required:
+  - compatible
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        usb5744@2d {
+            compatible = "microchip,usb5744";
+            reg = <0x2d>;
+            reset-gpios = <&gpio 44 GPIO_ACTIVE_HIGH>;
+        };
+    };
diff --git a/MAINTAINERS b/MAINTAINERS
index 41e8d3d7faec..7439471b5d37 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2697,6 +2697,7 @@ W:	http://wiki.xilinx.com
 T:	git https://github.com/Xilinx/linux-xlnx.git
 F:	Documentation/devicetree/bindings/i2c/cdns,i2c-r1p10.yaml
 F:	Documentation/devicetree/bindings/i2c/xlnx,xps-iic-2.00.a.yaml
+F:	Documentation/devicetree/bindings/usb/microchip,usb5744.yaml
 F:	arch/arm/mach-zynq/
 F:	drivers/block/xsysace.c
 F:	drivers/clocksource/timer-cadence-ttc.c
-- 
2.30.0


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v2 1/2] dt-bindings: usb: misc: Add binding for Microchip usb5744 hub
@ 2021-02-09 10:48   ` Michal Simek
  0 siblings, 0 replies; 18+ messages in thread
From: Michal Simek @ 2021-02-09 10:48 UTC (permalink / raw)
  To: linux-kernel, monstr, michal.simek, git
  Cc: devicetree, Piyush Mehta, linux-usb, Rob Herring,
	Greg Kroah-Hartman, linux-arm-kernel

From: Piyush Mehta <piyush.mehta@xilinx.com>

Added dt binding for usb5744 driver.

Signed-off-by: Piyush Mehta <piyush.mehta@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---

Changes in v2: None

 .../bindings/usb/microchip,usb5744.yaml       | 56 +++++++++++++++++++
 MAINTAINERS                                   |  1 +
 2 files changed, 57 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/microchip,usb5744.yaml

diff --git a/Documentation/devicetree/bindings/usb/microchip,usb5744.yaml b/Documentation/devicetree/bindings/usb/microchip,usb5744.yaml
new file mode 100644
index 000000000000..fe222f6db81d
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/microchip,usb5744.yaml
@@ -0,0 +1,56 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/usb/microchip,usb5744.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: Bindings for the Microchip USB5744 4-port Hub Controller
+
+description:
+  Microchip’s USB5744 SmartHub™ IC is a 4 port, SuperSpeed (SS)/Hi-Speed (HS),
+  low power, low pin count configurable and fully compliant with the USB 3.1
+  Gen 1 specification. The USB5744 also supports Full Speed (FS) and Low Speed
+  (LS) USB signaling, offering complete coverage of all defined USB operating
+  speeds. The new SuperSpeed hubs operate in parallel with the USB 2.0
+  controller, so 5 Gbps SuperSpeed data transfers are not affected by slower
+  USB 2.0 traffic.
+
+maintainers:
+  - Piyush Mehta <piyush.mehta@xilinx.com>
+  - Michal Simek <michal.simek@xilinx.com>
+
+properties:
+  compatible:
+    const: microchip,usb5744
+
+  reg:
+    maxItems: 1
+    description: |
+      Specifies the i2c slave address, it is required and should be 0x2d
+      if I2C is used.
+
+  reset-gpios:
+    maxItems: 1
+    description:
+      The phandle and specifier for the GPIO that controls the RESET line of
+      USB hub.
+
+required:
+  - compatible
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        usb5744@2d {
+            compatible = "microchip,usb5744";
+            reg = <0x2d>;
+            reset-gpios = <&gpio 44 GPIO_ACTIVE_HIGH>;
+        };
+    };
diff --git a/MAINTAINERS b/MAINTAINERS
index 41e8d3d7faec..7439471b5d37 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2697,6 +2697,7 @@ W:	http://wiki.xilinx.com
 T:	git https://github.com/Xilinx/linux-xlnx.git
 F:	Documentation/devicetree/bindings/i2c/cdns,i2c-r1p10.yaml
 F:	Documentation/devicetree/bindings/i2c/xlnx,xps-iic-2.00.a.yaml
+F:	Documentation/devicetree/bindings/usb/microchip,usb5744.yaml
 F:	arch/arm/mach-zynq/
 F:	drivers/block/xsysace.c
 F:	drivers/clocksource/timer-cadence-ttc.c
-- 
2.30.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v2 2/2] usb: misc: usb5744: Add support for USB hub controller
  2021-02-09 10:48 ` Michal Simek
@ 2021-02-09 10:48   ` Michal Simek
  -1 siblings, 0 replies; 18+ messages in thread
From: Michal Simek @ 2021-02-09 10:48 UTC (permalink / raw)
  To: linux-kernel, monstr, michal.simek, git
  Cc: Piyush Mehta, Al Cooper, Alan Stern, Alexander A. Klimov,
	Bastien Nocera, Greg Kroah-Hartman, Masahiro Yamada,
	linux-arm-kernel, linux-usb

From: Piyush Mehta <piyush.mehta@xilinx.com>

This patch adds a USB GPIO based hub reset for USB5744 hub. This usb5744
driver trigger hub reset signal after soft reset or core Reset. The HUB
needs to be resetted after completion of phy initialization. After the
toggling of gpio, hub configure using i2c usb attached command.

USB5744 hub can be used without any I2C connection, is handled by a
simple platform device driver.

As part of the reset, sets the direction of the pin to output before
toggling the pin. Delay of millisecond is added in between low and
high to meet the setup and hold time requirement of the reset.

Signed-off-by: Piyush Mehta <piyush.mehta@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---

Changes in v2:
- s/USB_USB5744/USB_HUB_USB5744/g
- Fix order in Makefile and Kconfig

 MAINTAINERS                |   1 +
 drivers/usb/misc/Kconfig   |   9 +++
 drivers/usb/misc/Makefile  |   1 +
 drivers/usb/misc/usb5744.c | 115 +++++++++++++++++++++++++++++++++++++
 4 files changed, 126 insertions(+)
 create mode 100644 drivers/usb/misc/usb5744.c

diff --git a/MAINTAINERS b/MAINTAINERS
index 7439471b5d37..56d1fcdd24f6 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2706,6 +2706,7 @@ F:	drivers/edac/synopsys_edac.c
 F:	drivers/i2c/busses/i2c-cadence.c
 F:	drivers/i2c/busses/i2c-xiic.c
 F:	drivers/mmc/host/sdhci-of-arasan.c
+F:	drivers/usb/misc/usb5744.c
 N:	zynq
 N:	xilinx
 
diff --git a/drivers/usb/misc/Kconfig b/drivers/usb/misc/Kconfig
index 8f1144359012..9995a5701fd9 100644
--- a/drivers/usb/misc/Kconfig
+++ b/drivers/usb/misc/Kconfig
@@ -255,6 +255,15 @@ config USB_HSIC_USB4604
 	help
 	  This option enables support for SMSC USB4604 HSIC to USB 2.0 Driver.
 
+config USB_HUB_USB5744
+	tristate "Microchip USB5744 Hub driver"
+	depends on I2C
+	depends on GPIOLIB
+	help
+	  This option enables support for Microchip USB5744 Hub. This driver
+	  optionally reset the hub using gpio pin and configure hub via i2c if
+	  connected.
+
 config USB_LINK_LAYER_TEST
 	tristate "USB Link Layer Test driver"
 	help
diff --git a/drivers/usb/misc/Makefile b/drivers/usb/misc/Makefile
index 5f4e598573ab..fbb9adf08f8c 100644
--- a/drivers/usb/misc/Makefile
+++ b/drivers/usb/misc/Makefile
@@ -27,6 +27,7 @@ obj-$(CONFIG_USB_YUREX)			+= yurex.o
 obj-$(CONFIG_USB_HUB_USB251XB)		+= usb251xb.o
 obj-$(CONFIG_USB_HSIC_USB3503)		+= usb3503.o
 obj-$(CONFIG_USB_HSIC_USB4604)		+= usb4604.o
+obj-$(CONFIG_USB_HUB_USB5744)		+= usb5744.o
 obj-$(CONFIG_USB_CHAOSKEY)		+= chaoskey.o
 
 obj-$(CONFIG_USB_SISUSBVGA)		+= sisusbvga/
diff --git a/drivers/usb/misc/usb5744.c b/drivers/usb/misc/usb5744.c
new file mode 100644
index 000000000000..729b76345c69
--- /dev/null
+++ b/drivers/usb/misc/usb5744.c
@@ -0,0 +1,115 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Driver for the Microchip USB5744 4-port hub.
+ *
+ * Copyright (c) 2021 Xilinx, Inc.
+ */
+
+#include <linux/delay.h>
+#include <linux/err.h>
+#include <linux/i2c.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/gpio/consumer.h>
+#include <linux/platform_device.h>
+
+static int usb5744_init_hw(struct device *dev)
+{
+	struct gpio_desc *reset_gpio;
+
+	reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
+	if (IS_ERR(reset_gpio)) {
+		dev_err(dev, "Failed to bind reset gpio");
+		return -ENODEV;
+	}
+
+	if (reset_gpio) {
+		/* Toggle RESET_N to reset the hub. */
+		gpiod_set_value(reset_gpio, 0);
+		usleep_range(5, 20); /* trstia */
+		gpiod_set_value(reset_gpio, 1);
+		usleep_range(5000, 10000); /* tcsh */
+	}
+
+	return 0;
+}
+
+static int usb5744_i2c_probe(struct i2c_client *client,
+			     const struct i2c_device_id *id)
+{
+	struct device *dev = &client->dev;
+	int ret;
+
+	/* Trigger gpio reset to the hub. */
+	ret = usb5744_init_hw(dev);
+	if (ret)
+		return ret;
+
+	/* Send SMBus command to boot hub. */
+	ret = i2c_smbus_write_word_data(client, 0xAA, swab16(0x5600));
+	if (ret < 0)
+		dev_err(dev, "Sending boot command failed");
+
+	return ret;
+}
+
+static int usb5744_platform_probe(struct platform_device *pdev)
+{
+	/* Trigger gpio reset to the hub. */
+	return usb5744_init_hw(&pdev->dev);
+}
+
+static const struct i2c_device_id usb5744_id[] = {
+	{ "usb5744", 0 },
+	{}
+};
+MODULE_DEVICE_TABLE(i2c, usb5744_id);
+
+static struct i2c_driver usb5744_i2c_driver = {
+	.driver = {
+		.name = "usb5744",
+	},
+	.probe = usb5744_i2c_probe,
+	.id_table = usb5744_id,
+};
+
+static const struct of_device_id usb5744_platform_id[] = {
+	{ .compatible = "microchip,usb5744", },
+	{ }
+};
+
+static struct platform_driver usb5744_platform_driver = {
+	.driver = {
+		.name = "microchip,usb5744",
+		.of_match_table = usb5744_platform_id,
+	},
+	.probe = usb5744_platform_probe,
+};
+
+static int __init usb5744_init(void)
+{
+	int err;
+
+	err = i2c_add_driver(&usb5744_i2c_driver);
+	if (err != 0)
+		pr_err("usb5744: Failed to register I2C driver: %d\n", err);
+
+	err = platform_driver_register(&usb5744_platform_driver);
+	if (err != 0)
+		pr_err("usb5744: Failed to register platform driver: %d\n",
+		       err);
+	return 0;
+}
+module_init(usb5744_init);
+
+static void __exit usb5744_exit(void)
+{
+	platform_driver_unregister(&usb5744_platform_driver);
+	i2c_del_driver(&usb5744_i2c_driver);
+}
+module_exit(usb5744_exit);
+
+MODULE_AUTHOR("Piyush Mehta <piyush.mehta@xilinx.com>");
+MODULE_AUTHOR("Michal Simek <michal.simek@xilinx.com>");
+MODULE_DESCRIPTION("USB5744 Hub");
+MODULE_LICENSE("GPL v2");
-- 
2.30.0


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v2 2/2] usb: misc: usb5744: Add support for USB hub controller
@ 2021-02-09 10:48   ` Michal Simek
  0 siblings, 0 replies; 18+ messages in thread
From: Michal Simek @ 2021-02-09 10:48 UTC (permalink / raw)
  To: linux-kernel, monstr, michal.simek, git
  Cc: linux-usb, Alexander A. Klimov, Piyush Mehta, Masahiro Yamada,
	Al Cooper, Alan Stern, Bastien Nocera, Greg Kroah-Hartman,
	linux-arm-kernel

From: Piyush Mehta <piyush.mehta@xilinx.com>

This patch adds a USB GPIO based hub reset for USB5744 hub. This usb5744
driver trigger hub reset signal after soft reset or core Reset. The HUB
needs to be resetted after completion of phy initialization. After the
toggling of gpio, hub configure using i2c usb attached command.

USB5744 hub can be used without any I2C connection, is handled by a
simple platform device driver.

As part of the reset, sets the direction of the pin to output before
toggling the pin. Delay of millisecond is added in between low and
high to meet the setup and hold time requirement of the reset.

Signed-off-by: Piyush Mehta <piyush.mehta@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---

Changes in v2:
- s/USB_USB5744/USB_HUB_USB5744/g
- Fix order in Makefile and Kconfig

 MAINTAINERS                |   1 +
 drivers/usb/misc/Kconfig   |   9 +++
 drivers/usb/misc/Makefile  |   1 +
 drivers/usb/misc/usb5744.c | 115 +++++++++++++++++++++++++++++++++++++
 4 files changed, 126 insertions(+)
 create mode 100644 drivers/usb/misc/usb5744.c

diff --git a/MAINTAINERS b/MAINTAINERS
index 7439471b5d37..56d1fcdd24f6 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2706,6 +2706,7 @@ F:	drivers/edac/synopsys_edac.c
 F:	drivers/i2c/busses/i2c-cadence.c
 F:	drivers/i2c/busses/i2c-xiic.c
 F:	drivers/mmc/host/sdhci-of-arasan.c
+F:	drivers/usb/misc/usb5744.c
 N:	zynq
 N:	xilinx
 
diff --git a/drivers/usb/misc/Kconfig b/drivers/usb/misc/Kconfig
index 8f1144359012..9995a5701fd9 100644
--- a/drivers/usb/misc/Kconfig
+++ b/drivers/usb/misc/Kconfig
@@ -255,6 +255,15 @@ config USB_HSIC_USB4604
 	help
 	  This option enables support for SMSC USB4604 HSIC to USB 2.0 Driver.
 
+config USB_HUB_USB5744
+	tristate "Microchip USB5744 Hub driver"
+	depends on I2C
+	depends on GPIOLIB
+	help
+	  This option enables support for Microchip USB5744 Hub. This driver
+	  optionally reset the hub using gpio pin and configure hub via i2c if
+	  connected.
+
 config USB_LINK_LAYER_TEST
 	tristate "USB Link Layer Test driver"
 	help
diff --git a/drivers/usb/misc/Makefile b/drivers/usb/misc/Makefile
index 5f4e598573ab..fbb9adf08f8c 100644
--- a/drivers/usb/misc/Makefile
+++ b/drivers/usb/misc/Makefile
@@ -27,6 +27,7 @@ obj-$(CONFIG_USB_YUREX)			+= yurex.o
 obj-$(CONFIG_USB_HUB_USB251XB)		+= usb251xb.o
 obj-$(CONFIG_USB_HSIC_USB3503)		+= usb3503.o
 obj-$(CONFIG_USB_HSIC_USB4604)		+= usb4604.o
+obj-$(CONFIG_USB_HUB_USB5744)		+= usb5744.o
 obj-$(CONFIG_USB_CHAOSKEY)		+= chaoskey.o
 
 obj-$(CONFIG_USB_SISUSBVGA)		+= sisusbvga/
diff --git a/drivers/usb/misc/usb5744.c b/drivers/usb/misc/usb5744.c
new file mode 100644
index 000000000000..729b76345c69
--- /dev/null
+++ b/drivers/usb/misc/usb5744.c
@@ -0,0 +1,115 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Driver for the Microchip USB5744 4-port hub.
+ *
+ * Copyright (c) 2021 Xilinx, Inc.
+ */
+
+#include <linux/delay.h>
+#include <linux/err.h>
+#include <linux/i2c.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/gpio/consumer.h>
+#include <linux/platform_device.h>
+
+static int usb5744_init_hw(struct device *dev)
+{
+	struct gpio_desc *reset_gpio;
+
+	reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
+	if (IS_ERR(reset_gpio)) {
+		dev_err(dev, "Failed to bind reset gpio");
+		return -ENODEV;
+	}
+
+	if (reset_gpio) {
+		/* Toggle RESET_N to reset the hub. */
+		gpiod_set_value(reset_gpio, 0);
+		usleep_range(5, 20); /* trstia */
+		gpiod_set_value(reset_gpio, 1);
+		usleep_range(5000, 10000); /* tcsh */
+	}
+
+	return 0;
+}
+
+static int usb5744_i2c_probe(struct i2c_client *client,
+			     const struct i2c_device_id *id)
+{
+	struct device *dev = &client->dev;
+	int ret;
+
+	/* Trigger gpio reset to the hub. */
+	ret = usb5744_init_hw(dev);
+	if (ret)
+		return ret;
+
+	/* Send SMBus command to boot hub. */
+	ret = i2c_smbus_write_word_data(client, 0xAA, swab16(0x5600));
+	if (ret < 0)
+		dev_err(dev, "Sending boot command failed");
+
+	return ret;
+}
+
+static int usb5744_platform_probe(struct platform_device *pdev)
+{
+	/* Trigger gpio reset to the hub. */
+	return usb5744_init_hw(&pdev->dev);
+}
+
+static const struct i2c_device_id usb5744_id[] = {
+	{ "usb5744", 0 },
+	{}
+};
+MODULE_DEVICE_TABLE(i2c, usb5744_id);
+
+static struct i2c_driver usb5744_i2c_driver = {
+	.driver = {
+		.name = "usb5744",
+	},
+	.probe = usb5744_i2c_probe,
+	.id_table = usb5744_id,
+};
+
+static const struct of_device_id usb5744_platform_id[] = {
+	{ .compatible = "microchip,usb5744", },
+	{ }
+};
+
+static struct platform_driver usb5744_platform_driver = {
+	.driver = {
+		.name = "microchip,usb5744",
+		.of_match_table = usb5744_platform_id,
+	},
+	.probe = usb5744_platform_probe,
+};
+
+static int __init usb5744_init(void)
+{
+	int err;
+
+	err = i2c_add_driver(&usb5744_i2c_driver);
+	if (err != 0)
+		pr_err("usb5744: Failed to register I2C driver: %d\n", err);
+
+	err = platform_driver_register(&usb5744_platform_driver);
+	if (err != 0)
+		pr_err("usb5744: Failed to register platform driver: %d\n",
+		       err);
+	return 0;
+}
+module_init(usb5744_init);
+
+static void __exit usb5744_exit(void)
+{
+	platform_driver_unregister(&usb5744_platform_driver);
+	i2c_del_driver(&usb5744_i2c_driver);
+}
+module_exit(usb5744_exit);
+
+MODULE_AUTHOR("Piyush Mehta <piyush.mehta@xilinx.com>");
+MODULE_AUTHOR("Michal Simek <michal.simek@xilinx.com>");
+MODULE_DESCRIPTION("USB5744 Hub");
+MODULE_LICENSE("GPL v2");
-- 
2.30.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 2/2] usb: misc: usb5744: Add support for USB hub controller
  2021-02-09 10:48   ` Michal Simek
@ 2021-02-09 11:20     ` Greg Kroah-Hartman
  -1 siblings, 0 replies; 18+ messages in thread
From: Greg Kroah-Hartman @ 2021-02-09 11:20 UTC (permalink / raw)
  To: Michal Simek
  Cc: linux-kernel, monstr, git, Piyush Mehta, Al Cooper, Alan Stern,
	Alexander A. Klimov, Bastien Nocera, Masahiro Yamada,
	linux-arm-kernel, linux-usb

On Tue, Feb 09, 2021 at 11:48:10AM +0100, Michal Simek wrote:
> From: Piyush Mehta <piyush.mehta@xilinx.com>
> 
> This patch adds a USB GPIO based hub reset for USB5744 hub. This usb5744
> driver trigger hub reset signal after soft reset or core Reset. The HUB
> needs to be resetted after completion of phy initialization. After the
> toggling of gpio, hub configure using i2c usb attached command.
> 
> USB5744 hub can be used without any I2C connection, is handled by a
> simple platform device driver.
> 
> As part of the reset, sets the direction of the pin to output before
> toggling the pin. Delay of millisecond is added in between low and
> high to meet the setup and hold time requirement of the reset.
> 
> Signed-off-by: Piyush Mehta <piyush.mehta@xilinx.com>
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> ---
> 
> Changes in v2:
> - s/USB_USB5744/USB_HUB_USB5744/g
> - Fix order in Makefile and Kconfig
> 
>  MAINTAINERS                |   1 +
>  drivers/usb/misc/Kconfig   |   9 +++
>  drivers/usb/misc/Makefile  |   1 +
>  drivers/usb/misc/usb5744.c | 115 +++++++++++++++++++++++++++++++++++++
>  4 files changed, 126 insertions(+)
>  create mode 100644 drivers/usb/misc/usb5744.c
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 7439471b5d37..56d1fcdd24f6 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -2706,6 +2706,7 @@ F:	drivers/edac/synopsys_edac.c
>  F:	drivers/i2c/busses/i2c-cadence.c
>  F:	drivers/i2c/busses/i2c-xiic.c
>  F:	drivers/mmc/host/sdhci-of-arasan.c
> +F:	drivers/usb/misc/usb5744.c
>  N:	zynq
>  N:	xilinx
>  
> diff --git a/drivers/usb/misc/Kconfig b/drivers/usb/misc/Kconfig
> index 8f1144359012..9995a5701fd9 100644
> --- a/drivers/usb/misc/Kconfig
> +++ b/drivers/usb/misc/Kconfig
> @@ -255,6 +255,15 @@ config USB_HSIC_USB4604
>  	help
>  	  This option enables support for SMSC USB4604 HSIC to USB 2.0 Driver.
>  
> +config USB_HUB_USB5744
> +	tristate "Microchip USB5744 Hub driver"
> +	depends on I2C
> +	depends on GPIOLIB
> +	help
> +	  This option enables support for Microchip USB5744 Hub. This driver
> +	  optionally reset the hub using gpio pin and configure hub via i2c if
> +	  connected.
> +
>  config USB_LINK_LAYER_TEST
>  	tristate "USB Link Layer Test driver"
>  	help
> diff --git a/drivers/usb/misc/Makefile b/drivers/usb/misc/Makefile
> index 5f4e598573ab..fbb9adf08f8c 100644
> --- a/drivers/usb/misc/Makefile
> +++ b/drivers/usb/misc/Makefile
> @@ -27,6 +27,7 @@ obj-$(CONFIG_USB_YUREX)			+= yurex.o
>  obj-$(CONFIG_USB_HUB_USB251XB)		+= usb251xb.o
>  obj-$(CONFIG_USB_HSIC_USB3503)		+= usb3503.o
>  obj-$(CONFIG_USB_HSIC_USB4604)		+= usb4604.o
> +obj-$(CONFIG_USB_HUB_USB5744)		+= usb5744.o
>  obj-$(CONFIG_USB_CHAOSKEY)		+= chaoskey.o
>  
>  obj-$(CONFIG_USB_SISUSBVGA)		+= sisusbvga/
> diff --git a/drivers/usb/misc/usb5744.c b/drivers/usb/misc/usb5744.c
> new file mode 100644
> index 000000000000..729b76345c69
> --- /dev/null
> +++ b/drivers/usb/misc/usb5744.c
> @@ -0,0 +1,115 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Driver for the Microchip USB5744 4-port hub.
> + *
> + * Copyright (c) 2021 Xilinx, Inc.
> + */
> +
> +#include <linux/delay.h>
> +#include <linux/err.h>
> +#include <linux/i2c.h>
> +#include <linux/kernel.h>
> +#include <linux/module.h>
> +#include <linux/gpio/consumer.h>
> +#include <linux/platform_device.h>
> +
> +static int usb5744_init_hw(struct device *dev)
> +{
> +	struct gpio_desc *reset_gpio;
> +
> +	reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
> +	if (IS_ERR(reset_gpio)) {
> +		dev_err(dev, "Failed to bind reset gpio");
> +		return -ENODEV;
> +	}
> +
> +	if (reset_gpio) {
> +		/* Toggle RESET_N to reset the hub. */
> +		gpiod_set_value(reset_gpio, 0);
> +		usleep_range(5, 20); /* trstia */
> +		gpiod_set_value(reset_gpio, 1);
> +		usleep_range(5000, 10000); /* tcsh */
> +	}
> +
> +	return 0;
> +}
> +
> +static int usb5744_i2c_probe(struct i2c_client *client,
> +			     const struct i2c_device_id *id)
> +{
> +	struct device *dev = &client->dev;
> +	int ret;
> +
> +	/* Trigger gpio reset to the hub. */
> +	ret = usb5744_init_hw(dev);
> +	if (ret)
> +		return ret;
> +
> +	/* Send SMBus command to boot hub. */
> +	ret = i2c_smbus_write_word_data(client, 0xAA, swab16(0x5600));
> +	if (ret < 0)
> +		dev_err(dev, "Sending boot command failed");
> +
> +	return ret;
> +}
> +
> +static int usb5744_platform_probe(struct platform_device *pdev)
> +{
> +	/* Trigger gpio reset to the hub. */
> +	return usb5744_init_hw(&pdev->dev);
> +}
> +
> +static const struct i2c_device_id usb5744_id[] = {
> +	{ "usb5744", 0 },
> +	{}
> +};
> +MODULE_DEVICE_TABLE(i2c, usb5744_id);
> +
> +static struct i2c_driver usb5744_i2c_driver = {
> +	.driver = {
> +		.name = "usb5744",
> +	},
> +	.probe = usb5744_i2c_probe,
> +	.id_table = usb5744_id,
> +};
> +
> +static const struct of_device_id usb5744_platform_id[] = {
> +	{ .compatible = "microchip,usb5744", },
> +	{ }
> +};
> +
> +static struct platform_driver usb5744_platform_driver = {
> +	.driver = {
> +		.name = "microchip,usb5744",
> +		.of_match_table = usb5744_platform_id,
> +	},
> +	.probe = usb5744_platform_probe,
> +};
> +
> +static int __init usb5744_init(void)
> +{
> +	int err;
> +
> +	err = i2c_add_driver(&usb5744_i2c_driver);
> +	if (err != 0)
> +		pr_err("usb5744: Failed to register I2C driver: %d\n", err);
> +
> +	err = platform_driver_register(&usb5744_platform_driver);
> +	if (err != 0)
> +		pr_err("usb5744: Failed to register platform driver: %d\n",
> +		       err);
> +	return 0;

So, no matter how many failures happen, you still say everything is good
and continue on with loading the module?

Please don't.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 2/2] usb: misc: usb5744: Add support for USB hub controller
@ 2021-02-09 11:20     ` Greg Kroah-Hartman
  0 siblings, 0 replies; 18+ messages in thread
From: Greg Kroah-Hartman @ 2021-02-09 11:20 UTC (permalink / raw)
  To: Michal Simek
  Cc: monstr, linux-usb, Bastien Nocera, Piyush Mehta, Masahiro Yamada,
	Al Cooper, linux-kernel, Alan Stern, git, Alexander A. Klimov,
	linux-arm-kernel

On Tue, Feb 09, 2021 at 11:48:10AM +0100, Michal Simek wrote:
> From: Piyush Mehta <piyush.mehta@xilinx.com>
> 
> This patch adds a USB GPIO based hub reset for USB5744 hub. This usb5744
> driver trigger hub reset signal after soft reset or core Reset. The HUB
> needs to be resetted after completion of phy initialization. After the
> toggling of gpio, hub configure using i2c usb attached command.
> 
> USB5744 hub can be used without any I2C connection, is handled by a
> simple platform device driver.
> 
> As part of the reset, sets the direction of the pin to output before
> toggling the pin. Delay of millisecond is added in between low and
> high to meet the setup and hold time requirement of the reset.
> 
> Signed-off-by: Piyush Mehta <piyush.mehta@xilinx.com>
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> ---
> 
> Changes in v2:
> - s/USB_USB5744/USB_HUB_USB5744/g
> - Fix order in Makefile and Kconfig
> 
>  MAINTAINERS                |   1 +
>  drivers/usb/misc/Kconfig   |   9 +++
>  drivers/usb/misc/Makefile  |   1 +
>  drivers/usb/misc/usb5744.c | 115 +++++++++++++++++++++++++++++++++++++
>  4 files changed, 126 insertions(+)
>  create mode 100644 drivers/usb/misc/usb5744.c
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 7439471b5d37..56d1fcdd24f6 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -2706,6 +2706,7 @@ F:	drivers/edac/synopsys_edac.c
>  F:	drivers/i2c/busses/i2c-cadence.c
>  F:	drivers/i2c/busses/i2c-xiic.c
>  F:	drivers/mmc/host/sdhci-of-arasan.c
> +F:	drivers/usb/misc/usb5744.c
>  N:	zynq
>  N:	xilinx
>  
> diff --git a/drivers/usb/misc/Kconfig b/drivers/usb/misc/Kconfig
> index 8f1144359012..9995a5701fd9 100644
> --- a/drivers/usb/misc/Kconfig
> +++ b/drivers/usb/misc/Kconfig
> @@ -255,6 +255,15 @@ config USB_HSIC_USB4604
>  	help
>  	  This option enables support for SMSC USB4604 HSIC to USB 2.0 Driver.
>  
> +config USB_HUB_USB5744
> +	tristate "Microchip USB5744 Hub driver"
> +	depends on I2C
> +	depends on GPIOLIB
> +	help
> +	  This option enables support for Microchip USB5744 Hub. This driver
> +	  optionally reset the hub using gpio pin and configure hub via i2c if
> +	  connected.
> +
>  config USB_LINK_LAYER_TEST
>  	tristate "USB Link Layer Test driver"
>  	help
> diff --git a/drivers/usb/misc/Makefile b/drivers/usb/misc/Makefile
> index 5f4e598573ab..fbb9adf08f8c 100644
> --- a/drivers/usb/misc/Makefile
> +++ b/drivers/usb/misc/Makefile
> @@ -27,6 +27,7 @@ obj-$(CONFIG_USB_YUREX)			+= yurex.o
>  obj-$(CONFIG_USB_HUB_USB251XB)		+= usb251xb.o
>  obj-$(CONFIG_USB_HSIC_USB3503)		+= usb3503.o
>  obj-$(CONFIG_USB_HSIC_USB4604)		+= usb4604.o
> +obj-$(CONFIG_USB_HUB_USB5744)		+= usb5744.o
>  obj-$(CONFIG_USB_CHAOSKEY)		+= chaoskey.o
>  
>  obj-$(CONFIG_USB_SISUSBVGA)		+= sisusbvga/
> diff --git a/drivers/usb/misc/usb5744.c b/drivers/usb/misc/usb5744.c
> new file mode 100644
> index 000000000000..729b76345c69
> --- /dev/null
> +++ b/drivers/usb/misc/usb5744.c
> @@ -0,0 +1,115 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Driver for the Microchip USB5744 4-port hub.
> + *
> + * Copyright (c) 2021 Xilinx, Inc.
> + */
> +
> +#include <linux/delay.h>
> +#include <linux/err.h>
> +#include <linux/i2c.h>
> +#include <linux/kernel.h>
> +#include <linux/module.h>
> +#include <linux/gpio/consumer.h>
> +#include <linux/platform_device.h>
> +
> +static int usb5744_init_hw(struct device *dev)
> +{
> +	struct gpio_desc *reset_gpio;
> +
> +	reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
> +	if (IS_ERR(reset_gpio)) {
> +		dev_err(dev, "Failed to bind reset gpio");
> +		return -ENODEV;
> +	}
> +
> +	if (reset_gpio) {
> +		/* Toggle RESET_N to reset the hub. */
> +		gpiod_set_value(reset_gpio, 0);
> +		usleep_range(5, 20); /* trstia */
> +		gpiod_set_value(reset_gpio, 1);
> +		usleep_range(5000, 10000); /* tcsh */
> +	}
> +
> +	return 0;
> +}
> +
> +static int usb5744_i2c_probe(struct i2c_client *client,
> +			     const struct i2c_device_id *id)
> +{
> +	struct device *dev = &client->dev;
> +	int ret;
> +
> +	/* Trigger gpio reset to the hub. */
> +	ret = usb5744_init_hw(dev);
> +	if (ret)
> +		return ret;
> +
> +	/* Send SMBus command to boot hub. */
> +	ret = i2c_smbus_write_word_data(client, 0xAA, swab16(0x5600));
> +	if (ret < 0)
> +		dev_err(dev, "Sending boot command failed");
> +
> +	return ret;
> +}
> +
> +static int usb5744_platform_probe(struct platform_device *pdev)
> +{
> +	/* Trigger gpio reset to the hub. */
> +	return usb5744_init_hw(&pdev->dev);
> +}
> +
> +static const struct i2c_device_id usb5744_id[] = {
> +	{ "usb5744", 0 },
> +	{}
> +};
> +MODULE_DEVICE_TABLE(i2c, usb5744_id);
> +
> +static struct i2c_driver usb5744_i2c_driver = {
> +	.driver = {
> +		.name = "usb5744",
> +	},
> +	.probe = usb5744_i2c_probe,
> +	.id_table = usb5744_id,
> +};
> +
> +static const struct of_device_id usb5744_platform_id[] = {
> +	{ .compatible = "microchip,usb5744", },
> +	{ }
> +};
> +
> +static struct platform_driver usb5744_platform_driver = {
> +	.driver = {
> +		.name = "microchip,usb5744",
> +		.of_match_table = usb5744_platform_id,
> +	},
> +	.probe = usb5744_platform_probe,
> +};
> +
> +static int __init usb5744_init(void)
> +{
> +	int err;
> +
> +	err = i2c_add_driver(&usb5744_i2c_driver);
> +	if (err != 0)
> +		pr_err("usb5744: Failed to register I2C driver: %d\n", err);
> +
> +	err = platform_driver_register(&usb5744_platform_driver);
> +	if (err != 0)
> +		pr_err("usb5744: Failed to register platform driver: %d\n",
> +		       err);
> +	return 0;

So, no matter how many failures happen, you still say everything is good
and continue on with loading the module?

Please don't.

thanks,

greg k-h

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 1/2] dt-bindings: usb: misc: Add binding for Microchip usb5744 hub
  2021-02-09 10:48   ` Michal Simek
@ 2021-02-10 22:22     ` Rob Herring
  -1 siblings, 0 replies; 18+ messages in thread
From: Rob Herring @ 2021-02-10 22:22 UTC (permalink / raw)
  To: Michal Simek
  Cc: linux-kernel, monstr, git, Piyush Mehta, Greg Kroah-Hartman,
	devicetree, linux-arm-kernel, linux-usb

On Tue, Feb 09, 2021 at 11:48:09AM +0100, Michal Simek wrote:
> From: Piyush Mehta <piyush.mehta@xilinx.com>
> 
> Added dt binding for usb5744 driver.
> 
> Signed-off-by: Piyush Mehta <piyush.mehta@xilinx.com>
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> ---
> 
> Changes in v2: None
> 
>  .../bindings/usb/microchip,usb5744.yaml       | 56 +++++++++++++++++++
>  MAINTAINERS                                   |  1 +
>  2 files changed, 57 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/usb/microchip,usb5744.yaml
> 
> diff --git a/Documentation/devicetree/bindings/usb/microchip,usb5744.yaml b/Documentation/devicetree/bindings/usb/microchip,usb5744.yaml
> new file mode 100644
> index 000000000000..fe222f6db81d
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/usb/microchip,usb5744.yaml
> @@ -0,0 +1,56 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: "http://devicetree.org/schemas/usb/microchip,usb5744.yaml#"
> +$schema: "http://devicetree.org/meta-schemas/core.yaml#"
> +
> +title: Bindings for the Microchip USB5744 4-port Hub Controller
> +
> +description:
> +  Microchip’s USB5744 SmartHub™ IC is a 4 port, SuperSpeed (SS)/Hi-Speed (HS),
> +  low power, low pin count configurable and fully compliant with the USB 3.1
> +  Gen 1 specification. The USB5744 also supports Full Speed (FS) and Low Speed
> +  (LS) USB signaling, offering complete coverage of all defined USB operating
> +  speeds. The new SuperSpeed hubs operate in parallel with the USB 2.0
> +  controller, so 5 Gbps SuperSpeed data transfers are not affected by slower
> +  USB 2.0 traffic.
> +
> +maintainers:
> +  - Piyush Mehta <piyush.mehta@xilinx.com>
> +  - Michal Simek <michal.simek@xilinx.com>
> +
> +properties:
> +  compatible:
> +    const: microchip,usb5744
> +
> +  reg:
> +    maxItems: 1
> +    description: |
> +      Specifies the i2c slave address, it is required and should be 0x2d
> +      if I2C is used.

If I2C is not used, then this should be underneath the USB host as a USB 
device. That also implies a different compatible string. I'd suggest you 
just say I2C is required if that's your use.

'const: 0x2d' instead of maxItems is the schema to express the address 
if fixed.

> +
> +  reset-gpios:
> +    maxItems: 1
> +    description:
> +      The phandle and specifier for the GPIO that controls the RESET line of
> +      USB hub.
> +
> +required:
> +  - compatible
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    #include <dt-bindings/gpio/gpio.h>
> +
> +    i2c {
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +
> +        usb5744@2d {
> +            compatible = "microchip,usb5744";
> +            reg = <0x2d>;
> +            reset-gpios = <&gpio 44 GPIO_ACTIVE_HIGH>;
> +        };
> +    };
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 41e8d3d7faec..7439471b5d37 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -2697,6 +2697,7 @@ W:	http://wiki.xilinx.com
>  T:	git https://github.com/Xilinx/linux-xlnx.git
>  F:	Documentation/devicetree/bindings/i2c/cdns,i2c-r1p10.yaml
>  F:	Documentation/devicetree/bindings/i2c/xlnx,xps-iic-2.00.a.yaml
> +F:	Documentation/devicetree/bindings/usb/microchip,usb5744.yaml
>  F:	arch/arm/mach-zynq/
>  F:	drivers/block/xsysace.c
>  F:	drivers/clocksource/timer-cadence-ttc.c
> -- 
> 2.30.0
> 

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 1/2] dt-bindings: usb: misc: Add binding for Microchip usb5744 hub
@ 2021-02-10 22:22     ` Rob Herring
  0 siblings, 0 replies; 18+ messages in thread
From: Rob Herring @ 2021-02-10 22:22 UTC (permalink / raw)
  To: Michal Simek
  Cc: devicetree, monstr, Piyush Mehta, linux-usb, linux-kernel, git,
	Greg Kroah-Hartman, linux-arm-kernel

On Tue, Feb 09, 2021 at 11:48:09AM +0100, Michal Simek wrote:
> From: Piyush Mehta <piyush.mehta@xilinx.com>
> 
> Added dt binding for usb5744 driver.
> 
> Signed-off-by: Piyush Mehta <piyush.mehta@xilinx.com>
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> ---
> 
> Changes in v2: None
> 
>  .../bindings/usb/microchip,usb5744.yaml       | 56 +++++++++++++++++++
>  MAINTAINERS                                   |  1 +
>  2 files changed, 57 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/usb/microchip,usb5744.yaml
> 
> diff --git a/Documentation/devicetree/bindings/usb/microchip,usb5744.yaml b/Documentation/devicetree/bindings/usb/microchip,usb5744.yaml
> new file mode 100644
> index 000000000000..fe222f6db81d
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/usb/microchip,usb5744.yaml
> @@ -0,0 +1,56 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: "http://devicetree.org/schemas/usb/microchip,usb5744.yaml#"
> +$schema: "http://devicetree.org/meta-schemas/core.yaml#"
> +
> +title: Bindings for the Microchip USB5744 4-port Hub Controller
> +
> +description:
> +  Microchip’s USB5744 SmartHub™ IC is a 4 port, SuperSpeed (SS)/Hi-Speed (HS),
> +  low power, low pin count configurable and fully compliant with the USB 3.1
> +  Gen 1 specification. The USB5744 also supports Full Speed (FS) and Low Speed
> +  (LS) USB signaling, offering complete coverage of all defined USB operating
> +  speeds. The new SuperSpeed hubs operate in parallel with the USB 2.0
> +  controller, so 5 Gbps SuperSpeed data transfers are not affected by slower
> +  USB 2.0 traffic.
> +
> +maintainers:
> +  - Piyush Mehta <piyush.mehta@xilinx.com>
> +  - Michal Simek <michal.simek@xilinx.com>
> +
> +properties:
> +  compatible:
> +    const: microchip,usb5744
> +
> +  reg:
> +    maxItems: 1
> +    description: |
> +      Specifies the i2c slave address, it is required and should be 0x2d
> +      if I2C is used.

If I2C is not used, then this should be underneath the USB host as a USB 
device. That also implies a different compatible string. I'd suggest you 
just say I2C is required if that's your use.

'const: 0x2d' instead of maxItems is the schema to express the address 
if fixed.

> +
> +  reset-gpios:
> +    maxItems: 1
> +    description:
> +      The phandle and specifier for the GPIO that controls the RESET line of
> +      USB hub.
> +
> +required:
> +  - compatible
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    #include <dt-bindings/gpio/gpio.h>
> +
> +    i2c {
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +
> +        usb5744@2d {
> +            compatible = "microchip,usb5744";
> +            reg = <0x2d>;
> +            reset-gpios = <&gpio 44 GPIO_ACTIVE_HIGH>;
> +        };
> +    };
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 41e8d3d7faec..7439471b5d37 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -2697,6 +2697,7 @@ W:	http://wiki.xilinx.com
>  T:	git https://github.com/Xilinx/linux-xlnx.git
>  F:	Documentation/devicetree/bindings/i2c/cdns,i2c-r1p10.yaml
>  F:	Documentation/devicetree/bindings/i2c/xlnx,xps-iic-2.00.a.yaml
> +F:	Documentation/devicetree/bindings/usb/microchip,usb5744.yaml
>  F:	arch/arm/mach-zynq/
>  F:	drivers/block/xsysace.c
>  F:	drivers/clocksource/timer-cadence-ttc.c
> -- 
> 2.30.0
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 1/2] dt-bindings: usb: misc: Add binding for Microchip usb5744 hub
  2021-02-10 22:22     ` Rob Herring
@ 2021-02-11  9:35       ` Michal Simek
  -1 siblings, 0 replies; 18+ messages in thread
From: Michal Simek @ 2021-02-11  9:35 UTC (permalink / raw)
  To: Rob Herring, Michal Simek
  Cc: linux-kernel, monstr, git, Piyush Mehta, Greg Kroah-Hartman,
	devicetree, linux-arm-kernel, linux-usb

Hi Rob,

On 2/10/21 11:22 PM, Rob Herring wrote:
> On Tue, Feb 09, 2021 at 11:48:09AM +0100, Michal Simek wrote:
>> From: Piyush Mehta <piyush.mehta@xilinx.com>
>>
>> Added dt binding for usb5744 driver.
>>
>> Signed-off-by: Piyush Mehta <piyush.mehta@xilinx.com>
>> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
>> ---
>>
>> Changes in v2: None
>>
>>  .../bindings/usb/microchip,usb5744.yaml       | 56 +++++++++++++++++++
>>  MAINTAINERS                                   |  1 +
>>  2 files changed, 57 insertions(+)
>>  create mode 100644 Documentation/devicetree/bindings/usb/microchip,usb5744.yaml
>>
>> diff --git a/Documentation/devicetree/bindings/usb/microchip,usb5744.yaml b/Documentation/devicetree/bindings/usb/microchip,usb5744.yaml
>> new file mode 100644
>> index 000000000000..fe222f6db81d
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/usb/microchip,usb5744.yaml
>> @@ -0,0 +1,56 @@
>> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
>> +%YAML 1.2
>> +---
>> +$id: "http://devicetree.org/schemas/usb/microchip,usb5744.yaml#"
>> +$schema: "http://devicetree.org/meta-schemas/core.yaml#"
>> +
>> +title: Bindings for the Microchip USB5744 4-port Hub Controller
>> +
>> +description:
>> +  Microchip’s USB5744 SmartHub™ IC is a 4 port, SuperSpeed (SS)/Hi-Speed (HS),
>> +  low power, low pin count configurable and fully compliant with the USB 3.1
>> +  Gen 1 specification. The USB5744 also supports Full Speed (FS) and Low Speed
>> +  (LS) USB signaling, offering complete coverage of all defined USB operating
>> +  speeds. The new SuperSpeed hubs operate in parallel with the USB 2.0
>> +  controller, so 5 Gbps SuperSpeed data transfers are not affected by slower
>> +  USB 2.0 traffic.
>> +
>> +maintainers:
>> +  - Piyush Mehta <piyush.mehta@xilinx.com>
>> +  - Michal Simek <michal.simek@xilinx.com>
>> +
>> +properties:
>> +  compatible:
>> +    const: microchip,usb5744
>> +
>> +  reg:
>> +    maxItems: 1
>> +    description: |
>> +      Specifies the i2c slave address, it is required and should be 0x2d
>> +      if I2C is used.
> 
> If I2C is not used, then this should be underneath the USB host as a USB 
> device. That also implies a different compatible string. I'd suggest you 
> just say I2C is required if that's your use.

We can't say that i2c is required because we have both cases. One is
really usb hub connected over i2c which at least requires to send one
smbus command to start operate. But it can be extended to add more
features - limit speeds, disable ports, etc.

And the second is really the same usb hub without i2c connected which
runs in default mode. But reset is required to ensure proper reset
sequence.
Hub also have external clock chip which is not handled now because it is
just crystal on the board but if you want I can also model it via fixed
clock and call clock enable for it.

It is the same use case as is with
Documentation/devicetree/bindings/usb/usb3503.txt

Can you please elaborate why different compatible string should be used?
It is still the same device and not quite sure why different compatible
string should be used.

Do you also want to example where this node is the part of usb node?

> 
> 'const: 0x2d' instead of maxItems is the schema to express the address 
> if fixed.

Will fix.

Thanks,
Michal

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 1/2] dt-bindings: usb: misc: Add binding for Microchip usb5744 hub
@ 2021-02-11  9:35       ` Michal Simek
  0 siblings, 0 replies; 18+ messages in thread
From: Michal Simek @ 2021-02-11  9:35 UTC (permalink / raw)
  To: Rob Herring, Michal Simek
  Cc: devicetree, monstr, Piyush Mehta, linux-usb, linux-kernel, git,
	Greg Kroah-Hartman, linux-arm-kernel

Hi Rob,

On 2/10/21 11:22 PM, Rob Herring wrote:
> On Tue, Feb 09, 2021 at 11:48:09AM +0100, Michal Simek wrote:
>> From: Piyush Mehta <piyush.mehta@xilinx.com>
>>
>> Added dt binding for usb5744 driver.
>>
>> Signed-off-by: Piyush Mehta <piyush.mehta@xilinx.com>
>> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
>> ---
>>
>> Changes in v2: None
>>
>>  .../bindings/usb/microchip,usb5744.yaml       | 56 +++++++++++++++++++
>>  MAINTAINERS                                   |  1 +
>>  2 files changed, 57 insertions(+)
>>  create mode 100644 Documentation/devicetree/bindings/usb/microchip,usb5744.yaml
>>
>> diff --git a/Documentation/devicetree/bindings/usb/microchip,usb5744.yaml b/Documentation/devicetree/bindings/usb/microchip,usb5744.yaml
>> new file mode 100644
>> index 000000000000..fe222f6db81d
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/usb/microchip,usb5744.yaml
>> @@ -0,0 +1,56 @@
>> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
>> +%YAML 1.2
>> +---
>> +$id: "http://devicetree.org/schemas/usb/microchip,usb5744.yaml#"
>> +$schema: "http://devicetree.org/meta-schemas/core.yaml#"
>> +
>> +title: Bindings for the Microchip USB5744 4-port Hub Controller
>> +
>> +description:
>> +  Microchip’s USB5744 SmartHub™ IC is a 4 port, SuperSpeed (SS)/Hi-Speed (HS),
>> +  low power, low pin count configurable and fully compliant with the USB 3.1
>> +  Gen 1 specification. The USB5744 also supports Full Speed (FS) and Low Speed
>> +  (LS) USB signaling, offering complete coverage of all defined USB operating
>> +  speeds. The new SuperSpeed hubs operate in parallel with the USB 2.0
>> +  controller, so 5 Gbps SuperSpeed data transfers are not affected by slower
>> +  USB 2.0 traffic.
>> +
>> +maintainers:
>> +  - Piyush Mehta <piyush.mehta@xilinx.com>
>> +  - Michal Simek <michal.simek@xilinx.com>
>> +
>> +properties:
>> +  compatible:
>> +    const: microchip,usb5744
>> +
>> +  reg:
>> +    maxItems: 1
>> +    description: |
>> +      Specifies the i2c slave address, it is required and should be 0x2d
>> +      if I2C is used.
> 
> If I2C is not used, then this should be underneath the USB host as a USB 
> device. That also implies a different compatible string. I'd suggest you 
> just say I2C is required if that's your use.

We can't say that i2c is required because we have both cases. One is
really usb hub connected over i2c which at least requires to send one
smbus command to start operate. But it can be extended to add more
features - limit speeds, disable ports, etc.

And the second is really the same usb hub without i2c connected which
runs in default mode. But reset is required to ensure proper reset
sequence.
Hub also have external clock chip which is not handled now because it is
just crystal on the board but if you want I can also model it via fixed
clock and call clock enable for it.

It is the same use case as is with
Documentation/devicetree/bindings/usb/usb3503.txt

Can you please elaborate why different compatible string should be used?
It is still the same device and not quite sure why different compatible
string should be used.

Do you also want to example where this node is the part of usb node?

> 
> 'const: 0x2d' instead of maxItems is the schema to express the address 
> if fixed.

Will fix.

Thanks,
Michal

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 1/2] dt-bindings: usb: misc: Add binding for Microchip usb5744 hub
  2021-02-11  9:35       ` Michal Simek
@ 2021-02-11 14:42         ` Rob Herring
  -1 siblings, 0 replies; 18+ messages in thread
From: Rob Herring @ 2021-02-11 14:42 UTC (permalink / raw)
  To: Michal Simek
  Cc: linux-kernel, Michal Simek, git, Piyush Mehta,
	Greg Kroah-Hartman, devicetree, linux-arm-kernel, Linux USB List

On Thu, Feb 11, 2021 at 3:35 AM Michal Simek <michal.simek@xilinx.com> wrote:
>
> Hi Rob,
>
> On 2/10/21 11:22 PM, Rob Herring wrote:
> > On Tue, Feb 09, 2021 at 11:48:09AM +0100, Michal Simek wrote:
> >> From: Piyush Mehta <piyush.mehta@xilinx.com>
> >>
> >> Added dt binding for usb5744 driver.
> >>
> >> Signed-off-by: Piyush Mehta <piyush.mehta@xilinx.com>
> >> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> >> ---
> >>
> >> Changes in v2: None
> >>
> >>  .../bindings/usb/microchip,usb5744.yaml       | 56 +++++++++++++++++++
> >>  MAINTAINERS                                   |  1 +
> >>  2 files changed, 57 insertions(+)
> >>  create mode 100644 Documentation/devicetree/bindings/usb/microchip,usb5744.yaml
> >>
> >> diff --git a/Documentation/devicetree/bindings/usb/microchip,usb5744.yaml b/Documentation/devicetree/bindings/usb/microchip,usb5744.yaml
> >> new file mode 100644
> >> index 000000000000..fe222f6db81d
> >> --- /dev/null
> >> +++ b/Documentation/devicetree/bindings/usb/microchip,usb5744.yaml
> >> @@ -0,0 +1,56 @@
> >> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> >> +%YAML 1.2
> >> +---
> >> +$id: "http://devicetree.org/schemas/usb/microchip,usb5744.yaml#"
> >> +$schema: "http://devicetree.org/meta-schemas/core.yaml#"
> >> +
> >> +title: Bindings for the Microchip USB5744 4-port Hub Controller
> >> +
> >> +description:
> >> +  Microchip’s USB5744 SmartHub™ IC is a 4 port, SuperSpeed (SS)/Hi-Speed (HS),
> >> +  low power, low pin count configurable and fully compliant with the USB 3.1
> >> +  Gen 1 specification. The USB5744 also supports Full Speed (FS) and Low Speed
> >> +  (LS) USB signaling, offering complete coverage of all defined USB operating
> >> +  speeds. The new SuperSpeed hubs operate in parallel with the USB 2.0
> >> +  controller, so 5 Gbps SuperSpeed data transfers are not affected by slower
> >> +  USB 2.0 traffic.
> >> +
> >> +maintainers:
> >> +  - Piyush Mehta <piyush.mehta@xilinx.com>
> >> +  - Michal Simek <michal.simek@xilinx.com>
> >> +
> >> +properties:
> >> +  compatible:
> >> +    const: microchip,usb5744
> >> +
> >> +  reg:
> >> +    maxItems: 1
> >> +    description: |
> >> +      Specifies the i2c slave address, it is required and should be 0x2d
> >> +      if I2C is used.
> >
> > If I2C is not used, then this should be underneath the USB host as a USB
> > device. That also implies a different compatible string. I'd suggest you
> > just say I2C is required if that's your use.
>
> We can't say that i2c is required because we have both cases. One is
> really usb hub connected over i2c which at least requires to send one
> smbus command to start operate. But it can be extended to add more
> features - limit speeds, disable ports, etc.
>
> And the second is really the same usb hub without i2c connected which
> runs in default mode. But reset is required to ensure proper reset
> sequence.
> Hub also have external clock chip which is not handled now because it is
> just crystal on the board but if you want I can also model it via fixed
> clock and call clock enable for it.
>
> It is the same use case as is with
> Documentation/devicetree/bindings/usb/usb3503.txt

Yes, there are examples of how we don't want to do it.

> Can you please elaborate why different compatible string should be used?
> It is still the same device and not quite sure why different compatible
> string should be used.
>
> Do you also want to example where this node is the part of usb node?

See usb/usb-device.txt. And there is this[1] under review.

For these cases with I2C, I'd really rather see the hub always under
the USB bus with a link to the I2C bus when connected.

Rob

[1] https://lore.kernel.org/linux-devicetree/20210210091015.v5.1.I248292623d3d0f6a4f0c5bc58478ca3c0062b49a@changeid/

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 1/2] dt-bindings: usb: misc: Add binding for Microchip usb5744 hub
@ 2021-02-11 14:42         ` Rob Herring
  0 siblings, 0 replies; 18+ messages in thread
From: Rob Herring @ 2021-02-11 14:42 UTC (permalink / raw)
  To: Michal Simek
  Cc: devicetree, Michal Simek, Piyush Mehta, Linux USB List,
	linux-kernel, git, Greg Kroah-Hartman, linux-arm-kernel

On Thu, Feb 11, 2021 at 3:35 AM Michal Simek <michal.simek@xilinx.com> wrote:
>
> Hi Rob,
>
> On 2/10/21 11:22 PM, Rob Herring wrote:
> > On Tue, Feb 09, 2021 at 11:48:09AM +0100, Michal Simek wrote:
> >> From: Piyush Mehta <piyush.mehta@xilinx.com>
> >>
> >> Added dt binding for usb5744 driver.
> >>
> >> Signed-off-by: Piyush Mehta <piyush.mehta@xilinx.com>
> >> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> >> ---
> >>
> >> Changes in v2: None
> >>
> >>  .../bindings/usb/microchip,usb5744.yaml       | 56 +++++++++++++++++++
> >>  MAINTAINERS                                   |  1 +
> >>  2 files changed, 57 insertions(+)
> >>  create mode 100644 Documentation/devicetree/bindings/usb/microchip,usb5744.yaml
> >>
> >> diff --git a/Documentation/devicetree/bindings/usb/microchip,usb5744.yaml b/Documentation/devicetree/bindings/usb/microchip,usb5744.yaml
> >> new file mode 100644
> >> index 000000000000..fe222f6db81d
> >> --- /dev/null
> >> +++ b/Documentation/devicetree/bindings/usb/microchip,usb5744.yaml
> >> @@ -0,0 +1,56 @@
> >> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> >> +%YAML 1.2
> >> +---
> >> +$id: "http://devicetree.org/schemas/usb/microchip,usb5744.yaml#"
> >> +$schema: "http://devicetree.org/meta-schemas/core.yaml#"
> >> +
> >> +title: Bindings for the Microchip USB5744 4-port Hub Controller
> >> +
> >> +description:
> >> +  Microchip’s USB5744 SmartHub™ IC is a 4 port, SuperSpeed (SS)/Hi-Speed (HS),
> >> +  low power, low pin count configurable and fully compliant with the USB 3.1
> >> +  Gen 1 specification. The USB5744 also supports Full Speed (FS) and Low Speed
> >> +  (LS) USB signaling, offering complete coverage of all defined USB operating
> >> +  speeds. The new SuperSpeed hubs operate in parallel with the USB 2.0
> >> +  controller, so 5 Gbps SuperSpeed data transfers are not affected by slower
> >> +  USB 2.0 traffic.
> >> +
> >> +maintainers:
> >> +  - Piyush Mehta <piyush.mehta@xilinx.com>
> >> +  - Michal Simek <michal.simek@xilinx.com>
> >> +
> >> +properties:
> >> +  compatible:
> >> +    const: microchip,usb5744
> >> +
> >> +  reg:
> >> +    maxItems: 1
> >> +    description: |
> >> +      Specifies the i2c slave address, it is required and should be 0x2d
> >> +      if I2C is used.
> >
> > If I2C is not used, then this should be underneath the USB host as a USB
> > device. That also implies a different compatible string. I'd suggest you
> > just say I2C is required if that's your use.
>
> We can't say that i2c is required because we have both cases. One is
> really usb hub connected over i2c which at least requires to send one
> smbus command to start operate. But it can be extended to add more
> features - limit speeds, disable ports, etc.
>
> And the second is really the same usb hub without i2c connected which
> runs in default mode. But reset is required to ensure proper reset
> sequence.
> Hub also have external clock chip which is not handled now because it is
> just crystal on the board but if you want I can also model it via fixed
> clock and call clock enable for it.
>
> It is the same use case as is with
> Documentation/devicetree/bindings/usb/usb3503.txt

Yes, there are examples of how we don't want to do it.

> Can you please elaborate why different compatible string should be used?
> It is still the same device and not quite sure why different compatible
> string should be used.
>
> Do you also want to example where this node is the part of usb node?

See usb/usb-device.txt. And there is this[1] under review.

For these cases with I2C, I'd really rather see the hub always under
the USB bus with a link to the I2C bus when connected.

Rob

[1] https://lore.kernel.org/linux-devicetree/20210210091015.v5.1.I248292623d3d0f6a4f0c5bc58478ca3c0062b49a@changeid/

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 1/2] dt-bindings: usb: misc: Add binding for Microchip usb5744 hub
  2021-02-11 14:42         ` Rob Herring
@ 2021-02-24 13:37           ` Michal Simek
  -1 siblings, 0 replies; 18+ messages in thread
From: Michal Simek @ 2021-02-24 13:37 UTC (permalink / raw)
  To: Rob Herring, Michal Simek
  Cc: linux-kernel, Michal Simek, git, Piyush Mehta,
	Greg Kroah-Hartman, devicetree, linux-arm-kernel, Linux USB List,
	Wolfram Sang

Hi Rob,

On 2/11/21 3:42 PM, Rob Herring wrote:
> On Thu, Feb 11, 2021 at 3:35 AM Michal Simek <michal.simek@xilinx.com> wrote:
>>
>> Hi Rob,
>>
>> On 2/10/21 11:22 PM, Rob Herring wrote:
>>> On Tue, Feb 09, 2021 at 11:48:09AM +0100, Michal Simek wrote:
>>>> From: Piyush Mehta <piyush.mehta@xilinx.com>
>>>>
>>>> Added dt binding for usb5744 driver.
>>>>
>>>> Signed-off-by: Piyush Mehta <piyush.mehta@xilinx.com>
>>>> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
>>>> ---
>>>>
>>>> Changes in v2: None
>>>>
>>>>  .../bindings/usb/microchip,usb5744.yaml       | 56 +++++++++++++++++++
>>>>  MAINTAINERS                                   |  1 +
>>>>  2 files changed, 57 insertions(+)
>>>>  create mode 100644 Documentation/devicetree/bindings/usb/microchip,usb5744.yaml
>>>>
>>>> diff --git a/Documentation/devicetree/bindings/usb/microchip,usb5744.yaml b/Documentation/devicetree/bindings/usb/microchip,usb5744.yaml
>>>> new file mode 100644
>>>> index 000000000000..fe222f6db81d
>>>> --- /dev/null
>>>> +++ b/Documentation/devicetree/bindings/usb/microchip,usb5744.yaml
>>>> @@ -0,0 +1,56 @@
>>>> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
>>>> +%YAML 1.2
>>>> +---
>>>> +$id: "http://devicetree.org/schemas/usb/microchip,usb5744.yaml#"
>>>> +$schema: "http://devicetree.org/meta-schemas/core.yaml#"
>>>> +
>>>> +title: Bindings for the Microchip USB5744 4-port Hub Controller
>>>> +
>>>> +description:
>>>> +  Microchip’s USB5744 SmartHub™ IC is a 4 port, SuperSpeed (SS)/Hi-Speed (HS),
>>>> +  low power, low pin count configurable and fully compliant with the USB 3.1
>>>> +  Gen 1 specification. The USB5744 also supports Full Speed (FS) and Low Speed
>>>> +  (LS) USB signaling, offering complete coverage of all defined USB operating
>>>> +  speeds. The new SuperSpeed hubs operate in parallel with the USB 2.0
>>>> +  controller, so 5 Gbps SuperSpeed data transfers are not affected by slower
>>>> +  USB 2.0 traffic.
>>>> +
>>>> +maintainers:
>>>> +  - Piyush Mehta <piyush.mehta@xilinx.com>
>>>> +  - Michal Simek <michal.simek@xilinx.com>
>>>> +
>>>> +properties:
>>>> +  compatible:
>>>> +    const: microchip,usb5744
>>>> +
>>>> +  reg:
>>>> +    maxItems: 1
>>>> +    description: |
>>>> +      Specifies the i2c slave address, it is required and should be 0x2d
>>>> +      if I2C is used.
>>>
>>> If I2C is not used, then this should be underneath the USB host as a USB
>>> device. That also implies a different compatible string. I'd suggest you
>>> just say I2C is required if that's your use.
>>
>> We can't say that i2c is required because we have both cases. One is
>> really usb hub connected over i2c which at least requires to send one
>> smbus command to start operate. But it can be extended to add more
>> features - limit speeds, disable ports, etc.
>>
>> And the second is really the same usb hub without i2c connected which
>> runs in default mode. But reset is required to ensure proper reset
>> sequence.
>> Hub also have external clock chip which is not handled now because it is
>> just crystal on the board but if you want I can also model it via fixed
>> clock and call clock enable for it.
>>
>> It is the same use case as is with
>> Documentation/devicetree/bindings/usb/usb3503.txt
> 
> Yes, there are examples of how we don't want to do it.

ok.

> 
>> Can you please elaborate why different compatible string should be used?
>> It is still the same device and not quite sure why different compatible
>> string should be used.
>>
>> Do you also want to example where this node is the part of usb node?
> 
> See usb/usb-device.txt. And there is this[1] under review.
> 
> For these cases with I2C, I'd really rather see the hub always under
> the USB bus with a link to the I2C bus when connected.

I read that thread and also looked at his device and it is very similar
to this one. Binding should also have information about i2c or spi. It
is the same case here that you can use this hub without any bus
connected which works in default mode. Or when i2c/smbus is connected
and the hub is waiting for initialization sequence. And I expect spi
behaves very similarly but don't have this setup here.

Do we have any binding doc which is using suggested bus link?

Thanks,
Michal



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 1/2] dt-bindings: usb: misc: Add binding for Microchip usb5744 hub
@ 2021-02-24 13:37           ` Michal Simek
  0 siblings, 0 replies; 18+ messages in thread
From: Michal Simek @ 2021-02-24 13:37 UTC (permalink / raw)
  To: Rob Herring, Michal Simek
  Cc: devicetree, Michal Simek, Wolfram Sang, Piyush Mehta,
	Linux USB List, linux-kernel, git, Greg Kroah-Hartman,
	linux-arm-kernel

Hi Rob,

On 2/11/21 3:42 PM, Rob Herring wrote:
> On Thu, Feb 11, 2021 at 3:35 AM Michal Simek <michal.simek@xilinx.com> wrote:
>>
>> Hi Rob,
>>
>> On 2/10/21 11:22 PM, Rob Herring wrote:
>>> On Tue, Feb 09, 2021 at 11:48:09AM +0100, Michal Simek wrote:
>>>> From: Piyush Mehta <piyush.mehta@xilinx.com>
>>>>
>>>> Added dt binding for usb5744 driver.
>>>>
>>>> Signed-off-by: Piyush Mehta <piyush.mehta@xilinx.com>
>>>> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
>>>> ---
>>>>
>>>> Changes in v2: None
>>>>
>>>>  .../bindings/usb/microchip,usb5744.yaml       | 56 +++++++++++++++++++
>>>>  MAINTAINERS                                   |  1 +
>>>>  2 files changed, 57 insertions(+)
>>>>  create mode 100644 Documentation/devicetree/bindings/usb/microchip,usb5744.yaml
>>>>
>>>> diff --git a/Documentation/devicetree/bindings/usb/microchip,usb5744.yaml b/Documentation/devicetree/bindings/usb/microchip,usb5744.yaml
>>>> new file mode 100644
>>>> index 000000000000..fe222f6db81d
>>>> --- /dev/null
>>>> +++ b/Documentation/devicetree/bindings/usb/microchip,usb5744.yaml
>>>> @@ -0,0 +1,56 @@
>>>> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
>>>> +%YAML 1.2
>>>> +---
>>>> +$id: "http://devicetree.org/schemas/usb/microchip,usb5744.yaml#"
>>>> +$schema: "http://devicetree.org/meta-schemas/core.yaml#"
>>>> +
>>>> +title: Bindings for the Microchip USB5744 4-port Hub Controller
>>>> +
>>>> +description:
>>>> +  Microchip’s USB5744 SmartHub™ IC is a 4 port, SuperSpeed (SS)/Hi-Speed (HS),
>>>> +  low power, low pin count configurable and fully compliant with the USB 3.1
>>>> +  Gen 1 specification. The USB5744 also supports Full Speed (FS) and Low Speed
>>>> +  (LS) USB signaling, offering complete coverage of all defined USB operating
>>>> +  speeds. The new SuperSpeed hubs operate in parallel with the USB 2.0
>>>> +  controller, so 5 Gbps SuperSpeed data transfers are not affected by slower
>>>> +  USB 2.0 traffic.
>>>> +
>>>> +maintainers:
>>>> +  - Piyush Mehta <piyush.mehta@xilinx.com>
>>>> +  - Michal Simek <michal.simek@xilinx.com>
>>>> +
>>>> +properties:
>>>> +  compatible:
>>>> +    const: microchip,usb5744
>>>> +
>>>> +  reg:
>>>> +    maxItems: 1
>>>> +    description: |
>>>> +      Specifies the i2c slave address, it is required and should be 0x2d
>>>> +      if I2C is used.
>>>
>>> If I2C is not used, then this should be underneath the USB host as a USB
>>> device. That also implies a different compatible string. I'd suggest you
>>> just say I2C is required if that's your use.
>>
>> We can't say that i2c is required because we have both cases. One is
>> really usb hub connected over i2c which at least requires to send one
>> smbus command to start operate. But it can be extended to add more
>> features - limit speeds, disable ports, etc.
>>
>> And the second is really the same usb hub without i2c connected which
>> runs in default mode. But reset is required to ensure proper reset
>> sequence.
>> Hub also have external clock chip which is not handled now because it is
>> just crystal on the board but if you want I can also model it via fixed
>> clock and call clock enable for it.
>>
>> It is the same use case as is with
>> Documentation/devicetree/bindings/usb/usb3503.txt
> 
> Yes, there are examples of how we don't want to do it.

ok.

> 
>> Can you please elaborate why different compatible string should be used?
>> It is still the same device and not quite sure why different compatible
>> string should be used.
>>
>> Do you also want to example where this node is the part of usb node?
> 
> See usb/usb-device.txt. And there is this[1] under review.
> 
> For these cases with I2C, I'd really rather see the hub always under
> the USB bus with a link to the I2C bus when connected.

I read that thread and also looked at his device and it is very similar
to this one. Binding should also have information about i2c or spi. It
is the same case here that you can use this hub without any bus
connected which works in default mode. Or when i2c/smbus is connected
and the hub is waiting for initialization sequence. And I expect spi
behaves very similarly but don't have this setup here.

Do we have any binding doc which is using suggested bus link?

Thanks,
Michal



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 1/2] dt-bindings: usb: misc: Add binding for Microchip usb5744 hub
  2021-02-24 13:37           ` Michal Simek
@ 2021-03-04 20:02             ` Rob Herring
  -1 siblings, 0 replies; 18+ messages in thread
From: Rob Herring @ 2021-03-04 20:02 UTC (permalink / raw)
  To: Michal Simek
  Cc: linux-kernel, Michal Simek, git, Piyush Mehta,
	Greg Kroah-Hartman, devicetree, linux-arm-kernel, Linux USB List,
	Wolfram Sang

On Wed, Feb 24, 2021 at 7:38 AM Michal Simek <michal.simek@xilinx.com> wrote:
>
> Hi Rob,
>
> On 2/11/21 3:42 PM, Rob Herring wrote:
> > On Thu, Feb 11, 2021 at 3:35 AM Michal Simek <michal.simek@xilinx.com> wrote:
> >>
> >> Hi Rob,
> >>
> >> On 2/10/21 11:22 PM, Rob Herring wrote:
> >>> On Tue, Feb 09, 2021 at 11:48:09AM +0100, Michal Simek wrote:
> >>>> From: Piyush Mehta <piyush.mehta@xilinx.com>
> >>>>
> >>>> Added dt binding for usb5744 driver.
> >>>>
> >>>> Signed-off-by: Piyush Mehta <piyush.mehta@xilinx.com>
> >>>> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> >>>> ---
> >>>>
> >>>> Changes in v2: None
> >>>>
> >>>>  .../bindings/usb/microchip,usb5744.yaml       | 56 +++++++++++++++++++
> >>>>  MAINTAINERS                                   |  1 +
> >>>>  2 files changed, 57 insertions(+)
> >>>>  create mode 100644 Documentation/devicetree/bindings/usb/microchip,usb5744.yaml
> >>>>
> >>>> diff --git a/Documentation/devicetree/bindings/usb/microchip,usb5744.yaml b/Documentation/devicetree/bindings/usb/microchip,usb5744.yaml
> >>>> new file mode 100644
> >>>> index 000000000000..fe222f6db81d
> >>>> --- /dev/null
> >>>> +++ b/Documentation/devicetree/bindings/usb/microchip,usb5744.yaml
> >>>> @@ -0,0 +1,56 @@
> >>>> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> >>>> +%YAML 1.2
> >>>> +---
> >>>> +$id: "http://devicetree.org/schemas/usb/microchip,usb5744.yaml#"
> >>>> +$schema: "http://devicetree.org/meta-schemas/core.yaml#"
> >>>> +
> >>>> +title: Bindings for the Microchip USB5744 4-port Hub Controller
> >>>> +
> >>>> +description:
> >>>> +  Microchip’s USB5744 SmartHub™ IC is a 4 port, SuperSpeed (SS)/Hi-Speed (HS),
> >>>> +  low power, low pin count configurable and fully compliant with the USB 3.1
> >>>> +  Gen 1 specification. The USB5744 also supports Full Speed (FS) and Low Speed
> >>>> +  (LS) USB signaling, offering complete coverage of all defined USB operating
> >>>> +  speeds. The new SuperSpeed hubs operate in parallel with the USB 2.0
> >>>> +  controller, so 5 Gbps SuperSpeed data transfers are not affected by slower
> >>>> +  USB 2.0 traffic.
> >>>> +
> >>>> +maintainers:
> >>>> +  - Piyush Mehta <piyush.mehta@xilinx.com>
> >>>> +  - Michal Simek <michal.simek@xilinx.com>
> >>>> +
> >>>> +properties:
> >>>> +  compatible:
> >>>> +    const: microchip,usb5744
> >>>> +
> >>>> +  reg:
> >>>> +    maxItems: 1
> >>>> +    description: |
> >>>> +      Specifies the i2c slave address, it is required and should be 0x2d
> >>>> +      if I2C is used.
> >>>
> >>> If I2C is not used, then this should be underneath the USB host as a USB
> >>> device. That also implies a different compatible string. I'd suggest you
> >>> just say I2C is required if that's your use.
> >>
> >> We can't say that i2c is required because we have both cases. One is
> >> really usb hub connected over i2c which at least requires to send one
> >> smbus command to start operate. But it can be extended to add more
> >> features - limit speeds, disable ports, etc.
> >>
> >> And the second is really the same usb hub without i2c connected which
> >> runs in default mode. But reset is required to ensure proper reset
> >> sequence.
> >> Hub also have external clock chip which is not handled now because it is
> >> just crystal on the board but if you want I can also model it via fixed
> >> clock and call clock enable for it.
> >>
> >> It is the same use case as is with
> >> Documentation/devicetree/bindings/usb/usb3503.txt
> >
> > Yes, there are examples of how we don't want to do it.
>
> ok.
>
> >
> >> Can you please elaborate why different compatible string should be used?
> >> It is still the same device and not quite sure why different compatible
> >> string should be used.
> >>
> >> Do you also want to example where this node is the part of usb node?
> >
> > See usb/usb-device.txt. And there is this[1] under review.
> >
> > For these cases with I2C, I'd really rather see the hub always under
> > the USB bus with a link to the I2C bus when connected.
>
> I read that thread and also looked at his device and it is very similar
> to this one. Binding should also have information about i2c or spi. It
> is the same case here that you can use this hub without any bus
> connected which works in default mode. Or when i2c/smbus is connected
> and the hub is waiting for initialization sequence. And I expect spi
> behaves very similarly but don't have this setup here.
>
> Do we have any binding doc which is using suggested bus link?

'i2c-bus' or 'ddc-i2c-bus' properties for I2C. Don't think we have
anything for SPI, but I'd expect it would be similar though we'd need
a cell for the chip-select.

Rob

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 1/2] dt-bindings: usb: misc: Add binding for Microchip usb5744 hub
@ 2021-03-04 20:02             ` Rob Herring
  0 siblings, 0 replies; 18+ messages in thread
From: Rob Herring @ 2021-03-04 20:02 UTC (permalink / raw)
  To: Michal Simek
  Cc: linux-kernel, Michal Simek, git, Piyush Mehta,
	Greg Kroah-Hartman, devicetree, linux-arm-kernel, Linux USB List,
	Wolfram Sang

On Wed, Feb 24, 2021 at 7:38 AM Michal Simek <michal.simek@xilinx.com> wrote:
>
> Hi Rob,
>
> On 2/11/21 3:42 PM, Rob Herring wrote:
> > On Thu, Feb 11, 2021 at 3:35 AM Michal Simek <michal.simek@xilinx.com> wrote:
> >>
> >> Hi Rob,
> >>
> >> On 2/10/21 11:22 PM, Rob Herring wrote:
> >>> On Tue, Feb 09, 2021 at 11:48:09AM +0100, Michal Simek wrote:
> >>>> From: Piyush Mehta <piyush.mehta@xilinx.com>
> >>>>
> >>>> Added dt binding for usb5744 driver.
> >>>>
> >>>> Signed-off-by: Piyush Mehta <piyush.mehta@xilinx.com>
> >>>> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> >>>> ---
> >>>>
> >>>> Changes in v2: None
> >>>>
> >>>>  .../bindings/usb/microchip,usb5744.yaml       | 56 +++++++++++++++++++
> >>>>  MAINTAINERS                                   |  1 +
> >>>>  2 files changed, 57 insertions(+)
> >>>>  create mode 100644 Documentation/devicetree/bindings/usb/microchip,usb5744.yaml
> >>>>
> >>>> diff --git a/Documentation/devicetree/bindings/usb/microchip,usb5744.yaml b/Documentation/devicetree/bindings/usb/microchip,usb5744.yaml
> >>>> new file mode 100644
> >>>> index 000000000000..fe222f6db81d
> >>>> --- /dev/null
> >>>> +++ b/Documentation/devicetree/bindings/usb/microchip,usb5744.yaml
> >>>> @@ -0,0 +1,56 @@
> >>>> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> >>>> +%YAML 1.2
> >>>> +---
> >>>> +$id: "http://devicetree.org/schemas/usb/microchip,usb5744.yaml#"
> >>>> +$schema: "http://devicetree.org/meta-schemas/core.yaml#"
> >>>> +
> >>>> +title: Bindings for the Microchip USB5744 4-port Hub Controller
> >>>> +
> >>>> +description:
> >>>> +  Microchip’s USB5744 SmartHub™ IC is a 4 port, SuperSpeed (SS)/Hi-Speed (HS),
> >>>> +  low power, low pin count configurable and fully compliant with the USB 3.1
> >>>> +  Gen 1 specification. The USB5744 also supports Full Speed (FS) and Low Speed
> >>>> +  (LS) USB signaling, offering complete coverage of all defined USB operating
> >>>> +  speeds. The new SuperSpeed hubs operate in parallel with the USB 2.0
> >>>> +  controller, so 5 Gbps SuperSpeed data transfers are not affected by slower
> >>>> +  USB 2.0 traffic.
> >>>> +
> >>>> +maintainers:
> >>>> +  - Piyush Mehta <piyush.mehta@xilinx.com>
> >>>> +  - Michal Simek <michal.simek@xilinx.com>
> >>>> +
> >>>> +properties:
> >>>> +  compatible:
> >>>> +    const: microchip,usb5744
> >>>> +
> >>>> +  reg:
> >>>> +    maxItems: 1
> >>>> +    description: |
> >>>> +      Specifies the i2c slave address, it is required and should be 0x2d
> >>>> +      if I2C is used.
> >>>
> >>> If I2C is not used, then this should be underneath the USB host as a USB
> >>> device. That also implies a different compatible string. I'd suggest you
> >>> just say I2C is required if that's your use.
> >>
> >> We can't say that i2c is required because we have both cases. One is
> >> really usb hub connected over i2c which at least requires to send one
> >> smbus command to start operate. But it can be extended to add more
> >> features - limit speeds, disable ports, etc.
> >>
> >> And the second is really the same usb hub without i2c connected which
> >> runs in default mode. But reset is required to ensure proper reset
> >> sequence.
> >> Hub also have external clock chip which is not handled now because it is
> >> just crystal on the board but if you want I can also model it via fixed
> >> clock and call clock enable for it.
> >>
> >> It is the same use case as is with
> >> Documentation/devicetree/bindings/usb/usb3503.txt
> >
> > Yes, there are examples of how we don't want to do it.
>
> ok.
>
> >
> >> Can you please elaborate why different compatible string should be used?
> >> It is still the same device and not quite sure why different compatible
> >> string should be used.
> >>
> >> Do you also want to example where this node is the part of usb node?
> >
> > See usb/usb-device.txt. And there is this[1] under review.
> >
> > For these cases with I2C, I'd really rather see the hub always under
> > the USB bus with a link to the I2C bus when connected.
>
> I read that thread and also looked at his device and it is very similar
> to this one. Binding should also have information about i2c or spi. It
> is the same case here that you can use this hub without any bus
> connected which works in default mode. Or when i2c/smbus is connected
> and the hub is waiting for initialization sequence. And I expect spi
> behaves very similarly but don't have this setup here.
>
> Do we have any binding doc which is using suggested bus link?

'i2c-bus' or 'ddc-i2c-bus' properties for I2C. Don't think we have
anything for SPI, but I'd expect it would be similar though we'd need
a cell for the chip-select.

Rob

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2021-03-04 20:04 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-09 10:48 [PATCH v2 0/2] usb: misc: Add support for Microchip USB5744 Michal Simek
2021-02-09 10:48 ` Michal Simek
2021-02-09 10:48 ` [PATCH v2 1/2] dt-bindings: usb: misc: Add binding for Microchip usb5744 hub Michal Simek
2021-02-09 10:48   ` Michal Simek
2021-02-10 22:22   ` Rob Herring
2021-02-10 22:22     ` Rob Herring
2021-02-11  9:35     ` Michal Simek
2021-02-11  9:35       ` Michal Simek
2021-02-11 14:42       ` Rob Herring
2021-02-11 14:42         ` Rob Herring
2021-02-24 13:37         ` Michal Simek
2021-02-24 13:37           ` Michal Simek
2021-03-04 20:02           ` Rob Herring
2021-03-04 20:02             ` Rob Herring
2021-02-09 10:48 ` [PATCH v2 2/2] usb: misc: usb5744: Add support for USB hub controller Michal Simek
2021-02-09 10:48   ` Michal Simek
2021-02-09 11:20   ` Greg Kroah-Hartman
2021-02-09 11:20     ` Greg Kroah-Hartman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.