From patchwork Mon Oct 24 11:31:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10333 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp669813wru; Mon, 24 Oct 2022 14:58:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4BwORE+K1X8uv0OktHocQ/7WEybKuOvTqkUj8D2TU/GzSlrEARb3GW5QbJmR1JvBOq+vx7 X-Received: by 2002:a17:907:2e0d:b0:78e:1d21:8001 with SMTP id ig13-20020a1709072e0d00b0078e1d218001mr28887202ejc.246.1666648712316; Mon, 24 Oct 2022 14:58:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666648712; cv=none; d=google.com; s=arc-20160816; b=kVrefv/oQ5msh8UTZJikyFWCyUOnxiXVuq8ECKurzQf+XFkGyttt+apPbFYznZ4t18 7JFsO2ZliKzDezBcTQNtymWmCZljt9ZUUO63EX7BINZt4egrugir9i47QvU02aA1cWKb VC6JjRYDH4vs3YBW3wsyHaVntr6AXAUJ4sawJ+YmbcRATOJYO09BfE1e89/aPDgvkj9l zocdp8h8J+/bFyeCYqYn43yAEBuWzzdnTmI3twQ7pyFfsUnS6Xuji4Fty5MEGrZZV+gL 6iPykbdk22SkLvAQr927wUnJDXiJsFu7lZb6Ezs+JkeJUOzw6J6cGp+fxHBKPgLReNKA FJsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=YGU5yDuv6+inuh5cOAOae0EGbAF3j18A6bfz+rfRZ8o=; b=N5Od4IWE7dkMw9F+jv1hCxHDjwY7tS813ElzaDeQgbfx+WOjMxI0VrZtz5kn6LKxsS I2Exo+MGat0zX3VfHV5qmpxCLUvZ0Q3D8YHIbXIYEhdCdNyoMFExXn4+Q2FS5yrvnF4e 4aJt8nCV4UPDqJJm1QvsN71w0Rd/48RWpk3m0HIvpTspSJx073WdwdNSmnQEZ/QXwna4 dGAgClKaqN9j0mzZEcASx9CSBnZNwbbXEDvNNKmhs25X1NNk3DJZgXzQn91b046+fD82 i9v2OLqMDepDZwVyXNnjWzebdxBRMJFxEWJOR7aBfCwX09F5u7sObpleDWEmDGmSEmSW xWyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SPytivKE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a11-20020a170906368b00b0073ce34d1a13si657195ejc.499.2022.10.24.14.58.08; Mon, 24 Oct 2022 14:58:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SPytivKE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229968AbiJXVuq (ORCPT + 99 others); Mon, 24 Oct 2022 17:50:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230261AbiJXVuL (ORCPT ); Mon, 24 Oct 2022 17:50:11 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7AD4E2F047F; Mon, 24 Oct 2022 13:03:12 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D8782B81195; Mon, 24 Oct 2022 12:04:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3A368C433D6; Mon, 24 Oct 2022 12:04:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613048; bh=sX2gRoFUhS/b17jy2aWNfgFBlBHg0RqVEUsQmHyGTCo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SPytivKEugRqvEK7xi2ZxXQVmKifOvxkJZki90iEdKWlKICYBLjNiGsx7+smHqlme G3PZuGKjBjJ5iBgCJwExI9+PdIPXDY+iO/cSz763ymH+pGIGXNhks6pbw9u2lZb6oW aU274iPqB/E0xhOuHec/fS3Onn4/4g35Pdo7qNEY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Serge Vasilugin , Daniel Golle , Stanislaw Gruszka , Kalle Valo , Sasha Levin Subject: [PATCH 4.19 188/229] wifi: rt2x00: set SoC wmac clock register Date: Mon, 24 Oct 2022 13:31:47 +0200 Message-Id: <20221024113005.200542027@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747607840273531914?= X-GMAIL-MSGID: =?utf-8?q?1747607840273531914?= From: Daniel Golle [ Upstream commit cbde6ed406a51092d9e8a2df058f5f8490f27443 ] Instead of using the default value 33 (pci), set US_CYC_CNT init based on Programming guide: If available, set chipset bus clock with fallback to cpu clock/3. Reported-by: Serge Vasilugin Signed-off-by: Daniel Golle Acked-by: Stanislaw Gruszka Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/3e275d259f476f597dab91a9c395015ef3fe3284.1663445157.git.daniel@makrotopia.org Signed-off-by: Sasha Levin --- .../net/wireless/ralink/rt2x00/rt2800lib.c | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c index b8224b215532..9469517ac65f 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c @@ -5570,6 +5570,27 @@ static int rt2800_init_registers(struct rt2x00_dev *rt2x00dev) reg = rt2800_register_read(rt2x00dev, US_CYC_CNT); rt2x00_set_field32(®, US_CYC_CNT_CLOCK_CYCLE, 125); rt2800_register_write(rt2x00dev, US_CYC_CNT, reg); + } else if (rt2x00_is_soc(rt2x00dev)) { + struct clk *clk = clk_get_sys("bus", NULL); + int rate; + + if (IS_ERR(clk)) { + clk = clk_get_sys("cpu", NULL); + + if (IS_ERR(clk)) { + rate = 125; + } else { + rate = clk_get_rate(clk) / 3000000; + clk_put(clk); + } + } else { + rate = clk_get_rate(clk) / 1000000; + clk_put(clk); + } + + reg = rt2800_register_read(rt2x00dev, US_CYC_CNT); + rt2x00_set_field32(®, US_CYC_CNT_CLOCK_CYCLE, rate); + rt2800_register_write(rt2x00dev, US_CYC_CNT, reg); } reg = rt2800_register_read(rt2x00dev, HT_FBK_CFG0);