From patchwork Wed Sep 9 10:04:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Barker X-Patchwork-Id: 261263 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=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT 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 B0163C43461 for ; Wed, 9 Sep 2020 10:04:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6EE8221D7A for ; Wed, 9 Sep 2020 10:04:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=konsulko.com header.i=@konsulko.com header.b="EsiWTg2D" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728360AbgIIKEs (ORCPT ); Wed, 9 Sep 2020 06:04:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726399AbgIIKEi (ORCPT ); Wed, 9 Sep 2020 06:04:38 -0400 Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A7F9C061755 for ; Wed, 9 Sep 2020 03:04:38 -0700 (PDT) Received: by mail-wr1-x441.google.com with SMTP id c18so2252701wrm.9 for ; Wed, 09 Sep 2020 03:04:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pRUN7p1qzh/z0sF2kkFkWXZEvmC67k/rtM33VZEr1RY=; b=EsiWTg2DgucOy7ksi0tfoaZP/MIDdLVdJK6TrCTZfdujWCAm0vtNaoQsxNyys0HHjk UN/wZNC1fFhLtMWN+LqYZLyzaHHa7QBPfVqxj0zSMTOqwF4DSYX5WDXnEPP2otEm4VgA +IKEqwFdqSbPfJrSTn/N4fMX11qScykaIqZig= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pRUN7p1qzh/z0sF2kkFkWXZEvmC67k/rtM33VZEr1RY=; b=dPZlpcaOn5fxpofMjKluvkenic6RPMb4hZKYUk6o63Na1MwFDC/J9iWQSTO6Supy6g doSYyjZKtQnNtpOKyMp5lF/7jBakenwXFlz/zzHynkMF9gjlk8qCezgOr6ap7LNueWcK NojvAcfA4JgCigfsF14KlyHYGjgp7i8QKoWMH5ZQGvOrmjc0+UiINk/G8ubyUlBtKFBS GaHoYnl6uXMnYMr5mn6gtKooiGaza4YtCyLU2cV6xihMroS33oGutIkE1FEJX/71QWCP VB8Ctmg6nwczg4YbNDk9rUmsUOyVLG/306rrD1HJa4lLkMy41pohcqCEbPGzt19KL9Qs H7cw== X-Gm-Message-State: AOAM533m3ITvj9ZMAoqdM+oonvvtqOqyI0V1UNFhJM/ykn1AsJUwbpqi RnsbKZAUTnTzQBw199b3etpOqA== X-Google-Smtp-Source: ABdhPJzswvZt4mmoAPxtvxnzDKiIP+BRMmg7AkmT1c0NdWDTfK22qJv1fOUxhe0V0WqcmqSOfNvRqg== X-Received: by 2002:a5d:60cc:: with SMTP id x12mr3132553wrt.84.1599645876890; Wed, 09 Sep 2020 03:04:36 -0700 (PDT) Received: from ar2.home.b5net.uk ([213.48.11.149]) by smtp.gmail.com with ESMTPSA id l16sm3828237wrb.70.2020.09.09.03.04.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Sep 2020 03:04:36 -0700 (PDT) From: Paul Barker To: Woojung Huh , Microchip Linux Driver Support , Andrew Lunn , Vivien Didelot , Florian Fainelli , "David S . Miller" Cc: Paul Barker , netdev@vger.kernel.org Subject: [PATCH v3 4/4] net: dsa: microchip: Implement recommended reset timing Date: Wed, 9 Sep 2020 11:04:17 +0100 Message-Id: <20200909100417.380011-5-pbarker@konsulko.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200909100417.380011-1-pbarker@konsulko.com> References: <20200909100417.380011-1-pbarker@konsulko.com> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The datasheet for the ksz9893 and ksz9477 switches recommend waiting at least 100us after the de-assertion of reset before trying to program the device through any interface. Also switch the existing msleep() call to usleep_range() as recommended in Documentation/timers/timers-howto.rst. The 2ms range used here is somewhat arbitrary, as long as the reset is asserted for at least 10ms we should be ok. Signed-off-by: Paul Barker Reviewed-by: Florian Fainelli --- drivers/net/dsa/microchip/ksz_common.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c index 8d53b12d40a8..a31738662d95 100644 --- a/drivers/net/dsa/microchip/ksz_common.c +++ b/drivers/net/dsa/microchip/ksz_common.c @@ -400,8 +400,9 @@ int ksz_switch_register(struct ksz_device *dev, if (dev->reset_gpio) { gpiod_set_value_cansleep(dev->reset_gpio, 1); - mdelay(10); + usleep_range(10000, 12000); gpiod_set_value_cansleep(dev->reset_gpio, 0); + usleep_range(100, 1000); } mutex_init(&dev->dev_mutex);