From patchwork Tue Apr 26 12:33:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniels Umanovskis X-Patchwork-Id: 566269 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B33B1C433EF for ; Tue, 26 Apr 2022 12:35:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347148AbiDZMi3 (ORCPT ); Tue, 26 Apr 2022 08:38:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350012AbiDZMi2 (ORCPT ); Tue, 26 Apr 2022 08:38:28 -0400 Received: from pnkfpffh.outbound-mail.sendgrid.net (pnkfpffh.outbound-mail.sendgrid.net [50.31.63.240]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C1DC2676 for ; Tue, 26 Apr 2022 05:35:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axentia.se; h=from:subject:in-reply-to:references:mime-version:to:cc: content-transfer-encoding:content-type; s=s1; bh=RrLMc7YEIvvrCxGx5Vwj3xRkR1+bqOfHKLFzXrdpbc0=; b=JExwz+2Zp38GBYLC7qxDXGqnaC+kYd+Vgw5thPttIvV06mAg9iiDULtYG3Y+9sKpSzA+ LJ+OR5c3DcufKyBCQu2zQjFuVRChvfmJEaXwA9ONgjc+xF1qVjR2ZphrBwMQzkP5ZnXxH9 ekTdwO8I9esgu+xhQEjpNh1DTBy/exjD6AuhSVSaObcxoSAdwwEsskFoeWVbHL3Z5UfQbJ JOCeDEp8Q0SKNfcN/vcj4ohkCAJ4uK6aHGq7IATwP1J3nZVOOYvEJIwqPtOaIqUC7ZnH9r KrJdbFuUGNyQfRGPHbBA2NvG5ue5UwcWiKTpSxw5ZZrNCDIMK1DKlW9iVqE5N4Fg== Received: by filterdrecv-5645d9c87f-rl4kk with SMTP id filterdrecv-5645d9c87f-rl4kk-1-6267E6AB-33 2022-04-26 12:33:47.465219873 +0000 UTC m=+1694969.561547146 Received: from midgard.internal.axentia.se (unknown) by geopod-ismtpd-3-0 (SG) with ESMTP id 5DhQvuEGSQ6Q4oyZMYJApQ Tue, 26 Apr 2022 12:33:47.159 +0000 (UTC) From: Daniels Umanovskis Subject: [PATCH 1/2] dt-bindings: usb: usb251xb: add documentation for reset-delay-us Date: Tue, 26 Apr 2022 12:33:47 +0000 (UTC) Message-Id: <20220426123329.775-2-du@axentia.se> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220426123329.775-1-du@axentia.se> References: <20220426123329.775-1-du@axentia.se> MIME-Version: 1.0 X-SG-EID: Q0J120W4ZU2dvxvzBhStZcyp23eAYLPzAz2fSUg6MjfeWGicT4FGxyT7O14zxpkiRPCLaCzZjS7wquF0+OL7Xp00izHgGiJjr0TiVtxcuoH0pMBLfwrhU1JicvAcZctNDMtA2jP0/lVbnDySQ1d7SNciRCIuoSK1+7jldW9fJ7FZk90FzyADEhXlTdnLD0Kc/CDxx6r6h4lKFiSXIS9Ec6N+J/nFeSf1yMd04PZ6F13ViGQqIA6zeJT7QrH0RAJD To: richard.leitner@skidata.com, linux-usb@vger.kernel.org, robh+dt@kernel.org, devicetree@vger.kernel.org Cc: Daniels Umanovskis X-Entity-ID: eEMfc9IaaDEroFpbtZJ/HA== Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Next patch implements support for this property Signed-off-by: Daniels Umanovskis --- Documentation/devicetree/bindings/usb/usb251xb.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/usb/usb251xb.txt b/Documentation/devicetree/bindings/usb/usb251xb.txt index 1a934eab175e..d95c8ae518e7 100644 --- a/Documentation/devicetree/bindings/usb/usb251xb.txt +++ b/Documentation/devicetree/bindings/usb/usb251xb.txt @@ -12,6 +12,8 @@ Required properties : Optional properties : - reset-gpios : Should specify the gpio for hub reset + - reset-delay-us: Specifies delay in microseconds after reset deassert + on hub power-up. (32 bit, default is 500us) - vdd-supply : Should specify the phandle to the regulator supplying vdd - skip-config : Skip Hub configuration, but only send the USB-Attach command - vendor-id : Set USB Vendor ID of the hub (16 bit, default is 0x0424) From patchwork Tue Apr 26 12:34:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniels Umanovskis X-Patchwork-Id: 566270 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 72727C433EF for ; Tue, 26 Apr 2022 12:34:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344279AbiDZMhy (ORCPT ); Tue, 26 Apr 2022 08:37:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347308AbiDZMhx (ORCPT ); Tue, 26 Apr 2022 08:37:53 -0400 X-Greylist: delayed 62 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Tue, 26 Apr 2022 05:34:45 PDT Received: from pnkfpffh.outbound-mail.sendgrid.net (pnkfpffh.outbound-mail.sendgrid.net [50.31.63.240]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 640C915F5A3 for ; Tue, 26 Apr 2022 05:34:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axentia.se; h=from:subject:in-reply-to:references:mime-version:to:cc: content-transfer-encoding:content-type; s=s1; bh=tKivB06jD0vEN4LSj525+NdsXpl479kkX9c86GXrax8=; b=LC8TGohw80eHDqceyKT9VqUQsUYWM8KERYXcR7JTdPMJ1Dw15nFc0LpPHTfIXDfhDMkI Kfc2hhpFA8TXI/zW0ReKXkRs1X5ufJkGLHY2ZyQrlwV96k+R5bmgu8oHOTSyUMG/V6HvTc AzrV4PfeIjw/Zh8tyi1JGSPzuGHNhtq5tirfvBObaBI3wNBgOkcHN0+5BOO7WDz1RoyOjQ dTA9cGFyVbkKfTPobcmD4L/QjpnPP1n2MGApbEAwq/bRxKV2TluML9/G4tf+w0TigQDYF7 sPt7wEbIYA7fKYhMES6pQLCnN94CFmovS2fT545gwIjySN2o8O/DWfwnmSDOQb4Q== Received: by filterdrecv-5645d9c87f-rl4kk with SMTP id filterdrecv-5645d9c87f-rl4kk-1-6267E6C5-7 2022-04-26 12:34:13.158990696 +0000 UTC m=+1694995.255317925 Received: from midgard.internal.axentia.se (unknown) by geopod-ismtpd-3-0 (SG) with ESMTP id YmmnWkn5RoaUPX8JGydl6A Tue, 26 Apr 2022 12:34:12.849 +0000 (UTC) From: Daniels Umanovskis Subject: [PATCH 2/2] usb: usb251xb: make power-up reset delay configurable in device tree Date: Tue, 26 Apr 2022 12:34:13 +0000 (UTC) Message-Id: <20220426123329.775-3-du@axentia.se> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220426123329.775-1-du@axentia.se> References: <20220426123329.775-1-du@axentia.se> MIME-Version: 1.0 X-SG-EID: Q0J120W4ZU2dvxvzBhStZcyp23eAYLPzAz2fSUg6MjfeWGicT4FGxyT7O14zxpkiRPCLaCzZjS7wquF0+OL7XlA/A0u2lbOaVeFrtlD1uXfRKoi74EoVwe9Jh7i2To+txtFBnL0ybB98MmLW8ASRnB43Iph3B8fpRZ+B1iuf+QJ4bSJR4sw6oL1+YIEVyhkcEJolBeH6OQfZ7CEbtlmZaGpH+4iuVTV8dW4rxv4Rx9w7b9eZl0hZi/+NwY4kZAmU To: richard.leitner@skidata.com, linux-usb@vger.kernel.org, robh+dt@kernel.org, devicetree@vger.kernel.org Cc: Daniels Umanovskis X-Entity-ID: eEMfc9IaaDEroFpbtZJ/HA== Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org According to the datasheet, the hub should be operational 500us after the reset has been deasserted. Some individual circuits have been observed not to reset within the specified 500us and require a longer wait for subsequent configuration to succeed. Signed-off-by: Daniels Umanovskis --- drivers/usb/misc/usb251xb.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/usb/misc/usb251xb.c b/drivers/usb/misc/usb251xb.c index 04c4e3fed094..e287e241ef96 100644 --- a/drivers/usb/misc/usb251xb.c +++ b/drivers/usb/misc/usb251xb.c @@ -115,6 +115,7 @@ struct usb251xb { struct regulator *vdd; u8 skip_config; struct gpio_desc *gpio_reset; + u32 reset_delay_us; u16 vendor_id; u16 product_id; u16 device_id; @@ -278,7 +279,7 @@ static void usb251xb_reset(struct usb251xb *hub) gpiod_set_value_cansleep(hub->gpio_reset, 0); /* wait for hub recovery/stabilization */ - usleep_range(500, 750); /* >=500us after RESET_N deasserted */ + fsleep(hub->reset_delay_us); i2c_unlock_bus(hub->i2c->adapter, I2C_LOCK_SEGMENT); } @@ -424,6 +425,9 @@ static int usb251xb_get_ofdata(struct usb251xb *hub, return err; } + if (of_property_read_u32(np, "reset-delay-us", &hub->reset_delay_us)) + hub->reset_delay_us = 500; + if (of_property_read_u16_array(np, "vendor-id", &hub->vendor_id, 1)) hub->vendor_id = USB251XB_DEF_VENDOR_ID;