From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 62271C433DB for ; Tue, 9 Feb 2021 11:21:20 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E9E9364D9F for ; Tue, 9 Feb 2021 11:21:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E9E9364D9F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=zXyMLhsM6/oTCiRqj1kzVYfPqh8dgguNuP/WRuwsarg=; b=cT/+STTp1Vpsolc6uMgw0Hdsj tHvcAsBfWW2ufwJYYT0N/E55Xfxn2Mcs4h/dmk7OcFljV7YP75szR0KA0Y1C84nbLqpUmv8UO+r/u 5LWVd7TYjiF0/fcOB5e6xIfEiAc4wIpURsfyuHHQ8lFR+i26BVaeoMKGy3P0EMZofYVgt0K78jgLj /GpC/PbrqWS+LHDUr/WtFil0gtqsNEyMhSVXP3NEaWzLuINz0FggtcRsrLwjOsqzGJyGo3ATRqC8a Un6UuosVMnllTXeVtTWrJOJ4hKnSgauVgNin/I70BX7hQOcdrpUvsKY5fYQr2ms7lwJQwp3IBm8x/ u2W9Ce8ng==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l9R41-0000MO-Ps; Tue, 09 Feb 2021 11:20:13 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l9R3z-0000Ls-7c for linux-arm-kernel@lists.infradead.org; Tue, 09 Feb 2021 11:20:12 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 941FD64E6B; Tue, 9 Feb 2021 11:20:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1612869610; bh=O66toB/7BMykQ77TijJRtJ+Twsm+4LxeZAE82BtmgTU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ylg3/b9g0w+Em/zrEMNoKWNN/on+pUJdzinH6/iqrLfJOJwnMkZNfjz8MGjaNzObO rge7MtjJFZKImE3wmE23XKSjyW3G5nfdSFoENID+BHLJPGZTKR/ZWZH1dCGucCKa2r MT8SCFgIqsnDdOcfIKW6uVCGsAyqycmC0C9+7ks8= Date: Tue, 9 Feb 2021 12:20:07 +0100 From: Greg Kroah-Hartman To: Michal Simek Subject: Re: [PATCH v2 2/2] usb: misc: usb5744: Add support for USB hub controller Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210209_062011_423549_EE962F65 X-CRM114-Status: GOOD ( 32.13 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: monstr@monstr.eu, linux-usb@vger.kernel.org, Bastien Nocera , Piyush Mehta , Masahiro Yamada , Al Cooper , linux-kernel@vger.kernel.org, Alan Stern , git@xilinx.com, "Alexander A. Klimov" , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Feb 09, 2021 at 11:48:10AM +0100, Michal Simek wrote: > From: Piyush Mehta > > 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 > Signed-off-by: Michal Simek > --- > > 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 > +#include > +#include > +#include > +#include > +#include > +#include > + > +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