From patchwork Mon Oct 24 11:31:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9383 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp478070wru; Mon, 24 Oct 2022 07:16:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7eAkG39Dl+5IMOsS6fddbSMkyYWuhZ0jPzAwwu9utLT9BmLu1HdGld3OBJuMRsi6lmGJVF X-Received: by 2002:a17:907:7639:b0:79f:d1dd:2f86 with SMTP id jy25-20020a170907763900b0079fd1dd2f86mr11749898ejc.586.1666621009321; Mon, 24 Oct 2022 07:16:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666621009; cv=none; d=google.com; s=arc-20160816; b=IBHwJuw4Z4368DBCQy7HqocgZTSaTPIthc4fKFsbVPlULBnbiCmnM/t7fExK+q84kH /OZ0jcxA/qwQcAzWYzdb3MCk/FsZBwN2EzzLZX1lmXaluK6QilYxOOq4MB0aEbshnQry VvHfMtfpF+DokYn98FLJADYfRESUg1dXNryExzDOgLFgVnw7Tp/MoPFiIkzzwRzEakzb m7p/BzbFZ0s0mwkeZpEQ6Sjv4jTZLkVhhPRRd1xZ0Ns6RvP8BlCPuj4/JTUl4Rj+0e0m PHnG4o4dyV/l6eEItne4XQebvqmCr1FlwnHCNxOGXhsZzufNWKbq4Dq00KfUxDae76KO U6rQ== 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=QY6xAejFJlWZG1zvBTNL0DI/lyyDQekAjroTbmdeCOI=; b=kT6RuSxPAP0r9ywrTw1CtpXPDBBFZNbM/7kWmVtKRLz/IlJT7VbYwPXlx/qnL66GeC +HSJ6J5FIn+rHOpOETjNLYX3c9VSoLd01ig7Ej47spI/c0fvAipy09Eo5m9axkBtQDfl tIOJOtGGZqbSm32yMICoKF3aJbo4NWfziPDWzU9PomSN1+7ZCHWUarZpwYAuqsNpoRw4 p1+V2q5wCBA2/PawMOBPqO3i94Yl0tUvHASFGrUdStWRfzi+JM+qDCHfi7BkzYmZdpOv QlCSozBWXqPprVrFuvp6Mb8gXMZ8PcGuzK7ZQPk21e2+wPP4DmOTYWJnokDNhttVHMOt L0cA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CnbzUlbz; 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 lb25-20020a170907785900b00741d9a1e2dbsi25165578ejc.1004.2022.10.24.07.16.22; Mon, 24 Oct 2022 07:16:49 -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=CnbzUlbz; 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 S235712AbiJXOCv (ORCPT + 99 others); Mon, 24 Oct 2022 10:02:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233281AbiJXOB7 (ORCPT ); Mon, 24 Oct 2022 10:01:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F1CE8FD7F; Mon, 24 Oct 2022 05:48:01 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 2477B612F3; Mon, 24 Oct 2022 12:13:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 36AD6C433D6; Mon, 24 Oct 2022 12:13:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613616; bh=xGI2wG7CiwyktkV1VprJ5NZ4V+fFPQKZUvtJ9ivpDGg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CnbzUlbzL+xwIKAy1DkM1QqKRDBe3jaJIb+4qwhWgPHUUmpXnEoSUpdtqWHFSaqUN wxvZQxbu8ugeOPs5IoZ8l+YFkEO0cOIWu8jn2oCooriVWQdNO2M8qZ7X1mzCPBlb/8 EqhyX/f/3ZZ27kNjR21lsJ0Jn+71CZX0Kg2eNv5s= 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 5.4 205/255] wifi: rt2x00: set SoC wmac clock register Date: Mon, 24 Oct 2022 13:31:55 +0200 Message-Id: <20221024113009.855226789@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@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?1747578791270568448?= X-GMAIL-MSGID: =?utf-8?q?1747578791270568448?= 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 ab0d673253f0..c303d52b6820 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c @@ -6115,6 +6115,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);