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;