From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7C4AF51FCD9 for ; Fri, 4 Sep 2026 18:53:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788547998; cv=none; b=VO2z6Hc5wBUQC5kI13xGg1SW6KDBImLVSieQxorZ3z1Mvh59G0w0DYV5iC/ujKtIU7Wmg3y9rXGZvz30M8S4EqruPFGKZ9ZTE4ctyBxVaoDvSSaEPm+MkfZvbN/NVGxovOIdlIeGo+MSCy6QoELLJrgP5f7S0Ts8iAcHcsSbf8M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788547998; c=relaxed/simple; bh=EZdaHNjU+TIXVe4GCjTzp2mJ0V1U6rUpYJ8v6fB/t8E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=XHhzx17ow1jVrgPbeH86yomZQAEau/diDE6wUf4Y+IxukCdriGD5Fghy+KDk1/GbIvfil0C1SLaKsc5OV1RR4diNST+UEFJUTsm7CLcPYIdDEav0tmTHvqq7UuVuSevkE73rXzU2EvT5kDz8lzFa+DTbYd5tRsSw+KTNybR10G8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=aOdXFWcu; arc=none smtp.client-ip=209.85.128.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="aOdXFWcu" Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-4995b0343c1so17631575e9.3 for ; Fri, 04 Sep 2026 11:53:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1788547994; x=1789152794; darn=vger.kernel.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:sender:from:to:cc :subject:date:message-id:reply-to:content-type; bh=K8YmC3OILkqrRt2yACBkxysDZXA8U3Xzaub87X9aEHc=; b=aOdXFWcu1MQKzgnUQmcUQ/Ft1eQzast+KzSNf3hA8X0VGH/tVODP7J0t2bK1OGhYo1 a22pNeqhE3/NNDSTLwcnMYMp+Va9TNE9Yi4YUgTkmIrnEeT3FN4vCsTgvvCnnO8tgh1l nFsV3VlY2+b0iQSo7BFn2Mc6z4bX2txV0z7I0nsr9+Lhppmbe84zseZ0JZePHOvvVdCm XhEA34U2gIKfOKRcujSGwoinSCW6y8QjnKJbnM4W13AKEmSQWVz+Cau0DVCvTwcaNy1l 5S9NnRHhH4CXXMid1hZHq9QYkJTuu3V/OTQK7vNvCTcHzcMacaHDr9yVu6z0ZIVJqip1 8jJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788547994; x=1789152794; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:sender:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=K8YmC3OILkqrRt2yACBkxysDZXA8U3Xzaub87X9aEHc=; b=V93gQ52B+/CLzTdX1a/5edXFF8xGrYVvyxMGTKBckNhpMakr48KdpKa9/rO3dgoZcg RuOEUde3dR7nTiDgiOiGC2KuPkdXnF6fHY/wCnfTdYXf+tuWeD6JfxuotbUWGmVMJO5D veF54rR45VNlttdgP1E1I0AKy0MHrZKRKfPr04TuA1vSZmw/+oJ22jq9GVYt5jxgVGna YenFhRSX4MUaHI4RCW322y0qHq2v3fdyN3D7zLFw4tac25Bv9Vbq4SAHm1c2SrasKr+B LV7ldUsEetGERfFQCluhPbpaSztlSMv/dhsOQ04pZUc2n1660e4/MrU2O+kAO6P28gy9 /fhw== X-Gm-Message-State: AFuF++nyeddVHbPhssO3p4+3bNuGn5MCP8rzhRsTnhK3xn/MYvkw4w64 HzDkI/OEKMat5QIxURSIoPSdgVbjRWaJKxBT7zF0rVTEtF2wmYpVlYY= X-Gm-Gg: AYBFou20V5rWnpB5L/yJWicvaN2G+bl4eHzLM6vlaU/knCNjk4oP/0Vw8p3lOKMGzF7 2Ck/DqSF+yo7DoffVB3WK4A7lOpH4NgG3tbXg+izytqDWMLV2VyQuYaWjB8MyhfA98cZ384WFve z+9dIA5R+MZjiUED6DpJW4q2GNyxeiw81l7eXEuSpLWkYhGNGNyhTrOzXwWs4GEhTAP0p88FNpd EsGWNtYSucn4gOLys/rM6laB6PpTfTvKK7iHSrV7lrGw0IXH9l2eSltZKcd4RZ3nwYQUSCxT4bA KcN/DXcVi647lO7laCX14cQfNguUYxOSNGJf4dXGjBHoWTab3RohfnOVcnbX257ZNVVA3rKvxTy 4Va66Ms3gxzFo3cLbXjRoMwd+4XLEjqzVSEavkgfQRKTaMBomDRPPjp+K11GtQyZTYK1MJV43tu 0v6BTBHrqswkcdeYAqJAczub6hsKbYY617C/w3vBr2vYP5Is3repV3NnaMSSS1dANT0JItJUtA3 5QjJh5+72U2l+xoKtAHTurh70NCC3QZDaXCIhvGeUHTQc234lZC0PdUQbaaYIcVSy54xcKqX1tz 820C X-Received: by 2002:a05:600c:4e4c:b0:499:621a:2ec2 with SMTP id 5b1f17b1804b1-49cf8206e4dmr84668845e9.3.1788547994177; Fri, 04 Sep 2026 11:53:14 -0700 (PDT) Received: from nn ([2001:1ab8:1003:0:5454:f357:ba89:4e22]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49cfbe5b252sm58607715e9.3.2026.09.04.11.53.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Sep 2026 11:53:13 -0700 (PDT) Sender: N B From: =?UTF-8?q?Nerijus=20Bend=C5=BEi=C5=ABnas?= To: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= , linux-wireless@vger.kernel.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH v3 4/5] wifi: ath9k: batch the read-modify-writes of a channel change Date: Fri, 4 Sep 2026 21:52:52 +0300 Message-ID: <20260904185253.809209-5-nerijus.bendziunas@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260904185253.809209-1-nerijus.bendziunas@gmail.com> References: <20260904185253.809209-1-nerijus.bendziunas@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ar5008_hw_set_delta_slope() and ath9k_hw_start_nfcal() each issue a run of read-modify-writes with no register read in between. Both run on every channel change, and on the USB devices each REG_RMW is a separate WMI command. Wrap both runs in ENABLE_REG_RMW_BUFFER() and REG_RMW_BUFFER_FLUSH() so the USB transport sends each run as one command. PCI does not install the buffer callbacks, so the macros do nothing there and the writes are issued as before. The same holds for USB devices with firmware older than 1.4, which have no WMI_REG_RMW_CMDID. ar5008_hw_set_delta_slope() is the AR5008 and AR9002 callback; AR9003 has its own and is not touched. Assisted-by: Claude:claude-fable-5-1 Signed-off-by: Nerijus Bendžiūnas --- drivers/net/wireless/ath/ath9k/ar5008_phy.c | 2 ++ drivers/net/wireless/ath/ath9k/calib.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/drivers/net/wireless/ath/ath9k/ar5008_phy.c b/drivers/net/wireless/ath/ath9k/ar5008_phy.c index 7a45f5f62826..af05dcf95a61 100644 --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c @@ -868,6 +868,7 @@ static void ar5008_hw_set_delta_slope(struct ath_hw *ah, ath9k_hw_get_delta_slope_vals(ah, coef_scaled, &ds_coef_man, &ds_coef_exp); + ENABLE_REG_RMW_BUFFER(ah); REG_RMW_FIELD(ah, AR_PHY_TIMING3, AR_PHY_TIMING3_DSC_MAN, ds_coef_man); REG_RMW_FIELD(ah, AR_PHY_TIMING3, @@ -882,6 +883,7 @@ static void ar5008_hw_set_delta_slope(struct ath_hw *ah, AR_PHY_HALFGI_DSC_MAN, ds_coef_man); REG_RMW_FIELD(ah, AR_PHY_HALFGI, AR_PHY_HALFGI_DSC_EXP, ds_coef_exp); + REG_RMW_BUFFER_FLUSH(ah); } static bool ar5008_hw_rfbus_req(struct ath_hw *ah) diff --git a/drivers/net/wireless/ath/ath9k/calib.c b/drivers/net/wireless/ath/ath9k/calib.c index b4ab85bd7895..73c63ab32d53 100644 --- a/drivers/net/wireless/ath/ath9k/calib.c +++ b/drivers/net/wireless/ath/ath9k/calib.c @@ -224,6 +224,7 @@ void ath9k_hw_start_nfcal(struct ath_hw *ah, bool update) if (ah->caldata) set_bit(NFCAL_PENDING, &ah->caldata->cal_flags); + ENABLE_REG_RMW_BUFFER(ah); REG_SET_BIT(ah, AR_PHY_AGC_CONTROL(ah), AR_PHY_AGC_CONTROL_ENABLE_NF); @@ -235,6 +236,7 @@ void ath9k_hw_start_nfcal(struct ath_hw *ah, bool update) AR_PHY_AGC_CONTROL_NO_UPDATE_NF); REG_SET_BIT(ah, AR_PHY_AGC_CONTROL(ah), AR_PHY_AGC_CONTROL_NF); + REG_RMW_BUFFER_FLUSH(ah); } int ath9k_hw_loadnf(struct ath_hw *ah, struct ath9k_channel *chan) -- 2.55.0