From patchwork Mon Oct 24 11:33:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9944 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp606786wru; Mon, 24 Oct 2022 12:05:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4g28DxlkjNWC9oPS3ThPKdarIck8GLZoTOrQ/VFVc+TMTxJRtRReeQhNG/A0vcAugLN2Oy X-Received: by 2002:a17:902:c40b:b0:17f:9636:9014 with SMTP id k11-20020a170902c40b00b0017f96369014mr34299916plk.150.1666638323685; Mon, 24 Oct 2022 12:05:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666638323; cv=none; d=google.com; s=arc-20160816; b=jKPdQA7HkcRSYr/6pLpiGWEiecJW13iUXn5D1i4AYb0R8yBqyWOplXGJRiNc/I8MjS 6dmJFU379oWAC1r1U/ucSz7PaGSt1ESxbEDv7ZFkxjK05fiTq4IebnZR+HMpl2UTb94N YNWtGRU8f5aMgUcMM0W8MZfaiQr4mgR9TfiAwJkxFicGx1M7hqa6OfhGA+rZcqYPINyT CUncZ0x+0XkD25px9icmQR5sOEl1Xe4Y8W1Ey8xCLf8hZqA0x5t5RMD+rt8uOEwsZ/6g mKTTXt1lgwzG/bXN6hmK6bbQQ+GRFOprc44EO0vN26ENh41HLHG73GIo66dyeE67vcD0 12LQ== 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=tY33N5/UcvuZ+X1Zq8vhh9Gp/tNdkTS3fuV7wINMuFo=; b=jvJrbShygvrhOMtv/Z/GfI/HGmZE4MgLdHjYlG30/4dx7yISZUrfL1nNwXdQYWs52U LYsf/DixKfxfIdZb4wBOCMQU1ynjmeiPCHmTTyjssBSvTV6shOfotg6Q2eU2lN4MomAA mHfG+Ow+iZLh7lxf/g3zM7ziO6OPgQ/pzfimTHAHqPoxlrOWrip4HoVNK+4nzqMOLOWG UQWjuOkkhN8Rg6OOr19k9VFlpSRUnuRi9kFsMuMKyJdWXMdydoewgPf1fkiLP2JSNwAU u2VLnMVUUlGnuwWhcWUq/XDdRcWU9DbHxVqkoVhnqM4fZco4TnDwP8xbiz7J/TuRZP80 cRpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mhBgNOzP; 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 i17-20020a170902c95100b001867bac69cdsi388125pla.342.2022.10.24.12.05.09; Mon, 24 Oct 2022 12:05:23 -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=mhBgNOzP; 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 S232233AbiJXSyj (ORCPT + 99 others); Mon, 24 Oct 2022 14:54:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233183AbiJXSyH (ORCPT ); Mon, 24 Oct 2022 14:54:07 -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 27ED8167F5C; Mon, 24 Oct 2022 10:35:28 -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 4ED5E6128D; Mon, 24 Oct 2022 12:52:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 649ADC433D6; Mon, 24 Oct 2022 12:52:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666615928; bh=Nex5Re1kr8gbTzWoW29rQQjZq/FFg1laMYhpNyhNQ7g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mhBgNOzP40xH0nYFWG70S0P8mw0TXeSWrEfbSjsC5U+sG5jgNSqZ3OGHUkjOSOQp7 biB9eD1MY/fFq5JIkDP4J89xPwnWYWsceIgzXltNtwJXJGu7+p7sPtT5QENo8q+cwm 21Wh7l0F5AbDbqLONmxKdopJGvVaaYjdfsnyo0GE= 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.15 437/530] wifi: rt2x00: set SoC wmac clock register Date: Mon, 24 Oct 2022 13:33:01 +0200 Message-Id: <20221024113104.856811983@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113044.976326639@linuxfoundation.org> References: <20221024113044.976326639@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?1747596946755839247?= X-GMAIL-MSGID: =?utf-8?q?1747596946755839247?= 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 92a5231cdd95..d7b862b7bf67 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c @@ -6131,6 +6131,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);