Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp6739797rwi; Mon, 24 Oct 2022 05:38:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6mJ5Wob8rKRAGTmpocK8ULyi+Pi45ePD6oq3ee1KGQGGwBcgjC5VChJj2vNnqQK9uPLM+o X-Received: by 2002:a17:902:c20c:b0:186:b3d0:f77 with SMTP id 12-20020a170902c20c00b00186b3d00f77mr1805247pll.26.1666615098120; Mon, 24 Oct 2022 05:38:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615098; cv=none; d=google.com; s=arc-20160816; b=RpNS2xWLUlUodDQluesgVZFyzJDJe0jIGzfoR06djyI3qy06IzCEzuJN5rzqLpK0FE i6Es1+Gwh3+9LCx+oG1BWrRec2T99n3LCVS7W75d4dBbFgeuuAGWnhws9LcHPw8JD80u e3sdEW+rGQzGWkP/NOAZUiyzDMFtpD+eNWTXZavxxfyvyvUF3uMkQmh/dm0tlhZYiCmn Ozc2Bzjt3Stf9cpZ7m28uVZ0KLhy7hQR8u738sUEQ8pOLENLXTOw+Jwwbf3bAvQcv2p9 3nyB8gRlsP8DwYNyVaef7mdKqKjhn2RaQ6Wnf3LqxF/mrW+K2HYjo8+72LlBv93LEhGK o0/Q== 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=e3loH1nVwOtQuELDA6esEWvlJ/DScy8CT7D2BFcHtrs=; b=mgNpjoRQrHiE2NjB6VjERwPp7FEaqfNhg5eBowfFrTLmOBpylloaXEa8KyYqygSxSA V8kMGBdixkEvzifYLZlr6RJlGogpNUsy1TlcHV9W8cELFLuB5CDsrt/EomYAmJiFOSkC YVVvvVUgjwo28+AbplHFl9sI1BrkShnKetsGywgLf53k+e9s8nmltZFgYVaZ78TqGhSM qX9025RQDv9J9jIKdFfCSMoBL69L8k9seG1kPDMzH4lGLiXA8jO6JEcpOczsXuwlKuxt aGjh5fyNqP6jiOQoXaFfonNcRdXcT5UMp3c5whEgdzN6ogvIF5CQiM9P57LzlZkyNBqR g9TA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cSFbbyRY; 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 m3-20020a635803000000b00440403ac602si37306227pgb.618.2022.10.24.05.38.06; Mon, 24 Oct 2022 05:38:18 -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=cSFbbyRY; 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 S232976AbiJXMNS (ORCPT + 99 others); Mon, 24 Oct 2022 08:13:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232941AbiJXMMX (ORCPT ); Mon, 24 Oct 2022 08:12:23 -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 086954B495; Mon, 24 Oct 2022 04:54:08 -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 48452612DD; Mon, 24 Oct 2022 11:53:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 58763C433C1; Mon, 24 Oct 2022 11:53:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612386; bh=NJCqAoZMT1hBBgidJI6oolu+SE17C6YShP1K46PYaBc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cSFbbyRY8t24TBkJagEYae59pJZ8zh1JUoaWWfQV95hbtFjftH1GXePx3YyNuxb3r DR56KTTjn3A22Z+rWDbzdDyWvZRzYWtMN+hcbdMf3ZJgJh7FSrUqoqelznOh05wPxK SuDAieHgPV6Dw4AKEWnbu4Lp4LsEyUrKMBt/D7zM= 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.14 179/210] wifi: rt2x00: set SoC wmac clock register Date: Mon, 24 Oct 2022 13:31:36 +0200 Message-Id: <20221024113002.777680514@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@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.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 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 0c90bf0540b9..57fa472b5c4e 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c @@ -5567,6 +5567,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