usb: misc: Add support for Microchip USB5744
Subsystems (2)
cover usb: misc: Add support for Microchip USB5744
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
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
Signature · 7 lines
2.30.0 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 1/2 dt-bindings: usb: misc: Add binding for Microchip usb5744 hub
From: Piyush Mehta <[email protected]>
Added dt binding for usb5744 driver.
---
.../bindings/usb/microchip,usb5744.yaml | 56 +++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 57 insertions(+) create mode 100644 Documentation/devicetree/bindings/usb/microchip,usb5744.yaml
Documentation/devicetree/bindings/usb/microchip,usb5744.yaml new file +56 -0
@@ -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 <[email protected]> + - Michal Simek <[email protected]> + +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>; + }; + };
MAINTAINERS +1 -0
@@ -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
Signature · 7 lines
2.30.0 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 2/2 usb: misc: usb5744: Add support for USB hub controller
In reply to Michal SimekFrom: Piyush Mehta <[email protected]>
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.
---
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
MAINTAINERS +1 -0
@@ -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
drivers/usb/misc/Kconfig +9 -0
@@ -242,6 +242,15 @@ config USB_HUB_USB251XB parameters may be set in devicetree or platform data. Say Y or M here if you need to configure such a device via SMBus. +config USB_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_HSIC_USB3503 tristate "USB3503 HSIC to USB20 Driver" depends on I2C
drivers/usb/misc/Makefile +1 -0
@@ -25,6 +25,7 @@ obj-$(CONFIG_USB_USS720) += uss720.o obj-$(CONFIG_USB_SEVSEG) += usbsevseg.o obj-$(CONFIG_USB_YUREX) += yurex.o obj-$(CONFIG_USB_HUB_USB251XB) += usb251xb.o +obj-$(CONFIG_USB_USB5744) += usb5744.o obj-$(CONFIG_USB_HSIC_USB3503) += usb3503.o obj-$(CONFIG_USB_HSIC_USB4604) += usb4604.o obj-$(CONFIG_USB_CHAOSKEY) += chaoskey.o
drivers/usb/misc/usb5744.c new file +115 -0
115 lines not on this page · raw message
Signature · 7 lines
2.30.0 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Greg Kroah-Hartman
maintainerRe: [PATCH 2/2] usb: misc: usb5744: Add support for USB hub controller
Quoted 62 lines · Michal Simek
From: Piyush Mehta <[email protected]>
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 <[email protected]>Signed-off-by Michal Simek <[email protected]>---
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.cMAINTAINERS +1
-0@@ -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: xilinxdrivers/usb/misc/Kconfig +9
-0@@ -242,6 +242,15 @@ config USB_HUB_USB251XB parameters may be set in devicetree or platform data. Say Y or M here if you need to configure such a device via SMBus. +config USB_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_HSIC_USB3503 tristate "USB3503 HSIC to USB20 Driver" depends on I2Cdrivers/usb/misc/Makefile +0
-0
drivers/usb/misc/Makefile obj-$(CONFIG_USB_USS720) += uss720.o · line 28
Quoted 4 lines
drivers/usb/misc/Makefile +1
-0@@ -25,6 +25,7 @@ obj-$(CONFIG_USB_USS720) += uss720.o obj-$(CONFIG_USB_SEVSEG) += usbsevseg.o obj-$(CONFIG_USB_YUREX) += yurex.o obj-$(CONFIG_USB_HUB_USB251XB) += usb251xb.o +obj-$(CONFIG_USB_USB5744) += usb5744.o
Can you follow the convention of the config options we have already, and make this USB_HUB_USB5744 please?
drivers/usb/misc/Makefile obj-$(CONFIG_USB_USS720) += uss720.o · line 30
Quoted 2 lines
drivers/usb/misc/Makefile +0
-0obj-$(CONFIG_USB_HSIC_USB3503) += usb3503.o obj-$(CONFIG_USB_HSIC_USB4604) += usb4604.o
And then put it in sorted order :)
thanks,
greg k-h
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Re: [PATCH 2/2] usb: misc: usb5744: Add support for USB hub controller
Quoted 62 lines · Greg Kroah-Hartman
Quoted 61 lines · Michal Simek
From: Piyush Mehta <[email protected]>
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 <[email protected]>Signed-off-by Michal Simek <[email protected]>---
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.cMAINTAINERS +1
-0@@ -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: xilinxdrivers/usb/misc/Kconfig +9
-0@@ -242,6 +242,15 @@ config USB_HUB_USB251XB parameters may be set in devicetree or platform data. Say Y or M here if you need to configure such a device via SMBus. +config USB_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_HSIC_USB3503 tristate "USB3503 HSIC to USB20 Driver" depends on I2Cdrivers/usb/misc/Makefile +0
-0
Quoted 8 lines
drivers/usb/misc/Makefile obj-$(CONFIG_USB_USS720) += uss720.o · line 28
Quoted 5 lines
drivers/usb/misc/Makefile +1
-0@@ -25,6 +25,7 @@ obj-$(CONFIG_USB_USS720) += uss720.o obj-$(CONFIG_USB_SEVSEG) += usbsevseg.o obj-$(CONFIG_USB_YUREX) += yurex.o obj-$(CONFIG_USB_HUB_USB251XB) += usb251xb.o +obj-$(CONFIG_USB_USB5744) += usb5744.oCan you follow the convention of the config options we have already, and make this
USB_HUB_USB5744please?
Sure.
Quoted 5 lines
drivers/usb/misc/Makefile obj-$(CONFIG_USB_USS720) += uss720.o · line 30
Quoted 3 lines
drivers/usb/misc/Makefile +0
-0obj-$(CONFIG_USB_HSIC_USB3503) += usb3503.o obj-$(CONFIG_USB_HSIC_USB4604) += usb4604.oAnd then put it in sorted order :)
Do you want me to sort the whole Makefile and Kconfig as separate patch? It is pretty much unsorted now.
And any other problem with the driver itself?
Thanks,
Michal
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Greg Kroah-Hartman
maintainerRe: [PATCH 2/2] usb: misc: usb5744: Add support for USB hub controller
Quoted 77 lines · Michal Simek
Quoted 62 lines · Greg Kroah-Hartman
Quoted 61 lines · Michal Simek
From: Piyush Mehta <[email protected]>
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 <[email protected]>Signed-off-by Michal Simek <[email protected]>---
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.cMAINTAINERS +1
-0@@ -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: xilinxdrivers/usb/misc/Kconfig +9
-0@@ -242,6 +242,15 @@ config USB_HUB_USB251XB parameters may be set in devicetree or platform data. Say Y or M here if you need to configure such a device via SMBus. +config USB_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_HSIC_USB3503 tristate "USB3503 HSIC to USB20 Driver" depends on I2Cdrivers/usb/misc/Makefile +0
-0Quoted 8 lines
drivers/usb/misc/Makefile obj-$(CONFIG_USB_USS720) += uss720.o · line 28
Quoted 5 lines
drivers/usb/misc/Makefile +1
-0@@ -25,6 +25,7 @@ obj-$(CONFIG_USB_USS720) += uss720.o obj-$(CONFIG_USB_SEVSEG) += usbsevseg.o obj-$(CONFIG_USB_YUREX) += yurex.o obj-$(CONFIG_USB_HUB_USB251XB) += usb251xb.o +obj-$(CONFIG_USB_USB5744) += usb5744.oCan you follow the convention of the config options we have already, and make this
USB_HUB_USB5744please?Sure.
Quoted 1 line
Quoted 6 lines
Quoted 4 lines
drivers/usb/misc/Makefile obj-$(CONFIG_USB_USS720) += uss720.o · line 30
Quoted 2 lines
drivers/usb/misc/Makefile +0
-0obj-$(CONFIG_USB_HSIC_USB3503) += usb3503.o obj-$(CONFIG_USB_HSIC_USB4604) += usb4604.oAnd then put it in sorted order :)
Do you want me to sort the whole
MakefileandKconfigas separate patch?
No, but at least put your new line in the obvious place, in order :)
Quoted 1 line
And any other problem with the driver itself?
No idea, I stopped here in reviewing...
thanks,
greg k-h
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Re: [PATCH 2/2] usb: misc: usb5744: Add support for USB hub controller
In reply to Michal Simekdrivers/usb/misc/usb5744.c line 49
Quoted 13 lines · Michal Simek
drivers/usb/misc/usb5744.c new file +13
-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 ));
Hi Michal
This is not my area of the kernel. But that swab16() stood out, and made me wonder about endianness. Will this work correctly on big and little endian hosts?
Andrew
Re: [PATCH 2/2] usb: misc: usb5744: Add support for USB hub controller
Hi Andrew,
Quoted 17 lines · Andrew Lunn
drivers/usb/misc/usb5744.c line 49
Quoted 13 lines · Michal Simek
drivers/usb/misc/usb5744.c new file +13
-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 ));Hi Michal
Quoted 3 lines
This is not my area of the kernel. But that
swab16()stood out, and made me wonder about endianness. Will this work correctly on big and little endian hosts?
thanks for bringing this up. I didn't test it on BE system.
I have grepped the kernel
[linux](xnext/usb5744)$ git grep i2c_smbus_write_word_data | grep swabdrivers/media/i2c/uda1342.c:17: i2c_smbus_write_word_data(client, reg,
swab16(value));drivers/media/i2c/vpx3220.c:97: if (i2c_smbus_write_word_data(client,0x27, swab16(fpaddr)) == -1) {drivers/media/i2c/vpx3220.c:106: if (i2c_smbus_write_word_data(client,0x28, swab16(data)) == -1) {drivers/media/i2c/vpx3220.c:120: if (i2c_smbus_write_word_data(client,0x26, swab16(fpaddr)) == -1) {drivers/usb/misc/usb5744.c:50: ret = i2c_smbus_write_word_data(client,0xAA, swab16(0x5600));include/linux/i2c.h:168: return i2c_smbus_write_word_data(client,
command, swab16(value));
And last one is interesting
164 static inline s32
165 i2c_smbus_write_word_swapped(const struct i2c_client *client,
166 u8 command, u16 value)
167 {
168 return i2c_smbus_write_word_data(client, command,
swab16(value));
169 }
And this function is also used
[linux](xnext/usb5744)$ git grep i2c_smbus_write_word_swapped | wc -l 76
I think it would be the best to test it and see if this code works on BE but I need to prepare it first.
And current code is aligned with others but it doesn't mean that it is correct.
Thanks,
Michal
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel