Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp908497rwi; Wed, 19 Oct 2022 04:36:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4EJFXntPl0Yjj3x5QWejC4DgUP/mjXwkUUaLfBvQet5G2RGTjvCGtK7fBLDP/EfTG1959c X-Received: by 2002:a17:902:d544:b0:17d:318a:adf7 with SMTP id z4-20020a170902d54400b0017d318aadf7mr8202963plf.148.1666179403502; Wed, 19 Oct 2022 04:36:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666179403; cv=none; d=google.com; s=arc-20160816; b=iEe1+2BrBZ4OVVX2f02oIpV9P5ulQ29D3r9cd3Mjr7ynp8c6t/bQU7fvxGtxeLI4jf qehwdNochGlukXmJQo+Wo6vVnGxAXIjEtwmHFFq/BpC7vq7yXTQo/bSD1FYAwfPCfq/o 7ZuvLJhqSMrn5ncNESlm2E2sZlLpTtQKkswj91t4nwlm/frQQBE5v32JmBlJ1VlaOfJZ UHgp9DnGOOP8Krts5Pabp3bCI/6CB5ysRy5DoodvPfJxc/rd6YyUMV8aIOQgo7RBbhKH 1Atwq/TXJxkhh0wZhBlb/XJ4eGBCm0rY8OJ6oHnAje5kw5cNjmfazMFgVVWZ0xLyoLTf Qp2w== 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=frTGj75I2Ahm7oCZKwpuW8FqOVBP+w9ThXFlOjCJiVY=; b=vm0EXaHZ+fNmDBRvxfxdJGSDG1Twp/M+sl3sgEzNwaANDvI2l/o4/1KP4thvfuLoX1 Dg918N4HjoGx8XxO5l6Nex0/7E47RgIqz7IghmNKmGugQry6VkcTVd8ZiwPoqZ3Wn7Ar JFGUV2NQI5el3L5raUeCa7QBAdU24ZIyR9avzv4LSzwLBXOD43p8lbUqfObF73673pEF +tBsWoYwyVwvsCo8HczWhFpRw8QVuvTy6op/WPw31V2r26JhWCfoLxa1d8zsZTR+VA77 8jiHSxdgVG6OKWkYZI8tYaFj3TeDLrOrkKntwKbVbDaNUBqtEwTds2U4Q2QEVvy8fI8B JMHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RJS3Bap6; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d1-20020a17090a8d8100b001fde53d5d79si23695087pjo.5.2022.10.19.04.36.31; Wed, 19 Oct 2022 04:36:43 -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=RJS3Bap6; 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 S231145AbiJSLJl (ORCPT + 99 others); Wed, 19 Oct 2022 07:09:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231266AbiJSLIq (ORCPT ); Wed, 19 Oct 2022 07:08:46 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A8AB616F; Wed, 19 Oct 2022 03:37:36 -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 sin.source.kernel.org (Postfix) with ESMTPS id 6D2A2CE219E; Wed, 19 Oct 2022 09:10:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3E4F8C433B5; Wed, 19 Oct 2022 09:10:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170600; bh=5c7vIPknLGWDgnfWcLuRVY7n/9ucMfEhHISPPQPSWSI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RJS3Bap6lMjGQ6+hW5R9lhna5YroWoHJaeEAbPCplrS3t05Vg5oNeLZIYFFyKTqL8 GP4A21N35x4Y4Wvwjaq+wV6gwpoNRDDrXbSLfuX8upnMFddQzoTJ1Y0Srvcu4PxN+E CosxBjFzzjEF4W/AoD7gVfq457SJsIGxO/FWXdxI= 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 6.0 717/862] wifi: rt2x00: set SoC wmac clock register Date: Wed, 19 Oct 2022 10:33:24 +0200 Message-Id: <20221019083321.623667120@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.4 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 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 fec85db7dbc7..b30b062243bb 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); -- 2.35.1