Received: by 2002:a05:7412:f589:b0:e2:908c:2ebd with SMTP id eh9csp733039rdb; Wed, 1 Nov 2023 00:22:47 -0700 (PDT) X-Google-Smtp-Source: AGHT+IER8aIfBL9n7tCTULHA5A4qUiQi0LLSCjM7ye4R1LeMS+3JyWu9GK77WRUcumV5iCXnVux9 X-Received: by 2002:a17:902:6803:b0:1c9:ca02:645c with SMTP id h3-20020a170902680300b001c9ca02645cmr10808110plk.36.1698823366726; Wed, 01 Nov 2023 00:22:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698823366; cv=none; d=google.com; s=arc-20160816; b=ky8ojzLQhfmjoyUwJUV64w30EpuVuqF2mX7XczE7NaxssY/iLNGLN5D028D75u0tt8 Uz41RtyUfCuGjqsqlMkyHo0djRFNbs5yNoeRUj6HhEYuH94YJcHbbYi1Dr1PC+zTfqWH FmG2/fc0L1w29Um4mugVewrtZPrirvEFv5GD3GnXe0vZjgW0MSvjSzA4Ce4zZWlfh8yK 6q1cnDSKzUrx4oHAFNhfNk0Jfc3q7nvHpUzuN+y7CFFrpMnrd2RE64WB/orptrxt5kk2 YnVUIDauuGQSgfVQ1BN7JFFAJMhMf6+42vgexU01EAj+e/YTnC56iCBfbt8bNx8LoMOx 3Pgw== 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 :message-id:date:subject:cc:to:from; bh=7Utyj9hJ5coP4jS6mk7Dwk8A5yeniRN/mG/nH7u3/Fc=; fh=119R0DZRwIns1LRpqAK2A6izyPVjL4TEe6VydCwW0T8=; b=IPqUgPRstDAzBan3D9JNFLlJbsBgkJTorqJLjU4sviUfTwaOYHRL8m42E5iXhNL/Bh ZwvmABzJ3tRlcNHRreYmHTQh2HoTv/1erOehUk+FGV9jCxhaSXAQ9QQ+0lGiiz8pkG71 XPpquOnwKUBkgGfdhRiUcBzNlhYXGaCE/+1UAgO1AsQapkOeIcp81gdqWtn1CtNRWRhR f7/3JqSC/wDXSyprf5D8xApNFulgj/s0MkuqLn/eBHwkOseBh2RUtZhKzXLcbdLRsGov CR08hhinpw9XwYYJ3yiLm4mZYfM8vVneyk7vpUhcmSQAkZMKISdIqxDJIA3ewTujWHd6 nPDw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id km15-20020a17090327cf00b001cc5f995bccsi2326846plb.182.2023.11.01.00.22.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Nov 2023 00:22:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 0A89180320E5; Wed, 1 Nov 2023 00:22:42 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230093AbjKAHWm (ORCPT + 52 others); Wed, 1 Nov 2023 03:22:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230028AbjKAHWl (ORCPT ); Wed, 1 Nov 2023 03:22:41 -0400 Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E231EE4 for ; Wed, 1 Nov 2023 00:22:38 -0700 (PDT) X-SpamFilter-By: ArmorX SpamTrap 5.78 with qID 3A17MUQH01220453, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (rtexh36506.realtek.com.tw[172.21.6.27]) by rtits2.realtek.com.tw (8.15.2/2.93/5.92) with ESMTPS id 3A17MUQH01220453 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 1 Nov 2023 15:22:30 +0800 Received: from RTEXMBS04.realtek.com.tw (172.21.6.97) by RTEXH36506.realtek.com.tw (172.21.6.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.17; Wed, 1 Nov 2023 15:22:30 +0800 Received: from [127.0.1.1] (172.21.69.94) by RTEXMBS04.realtek.com.tw (172.21.6.97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.7; Wed, 1 Nov 2023 15:22:29 +0800 From: Ping-Ke Shih To: CC: Subject: [PATCH 0/5] wifi: rtw89: pci: add PCI generation struct to reuse common flow Date: Wed, 1 Nov 2023 15:21:44 +0800 Message-ID: <20231101072149.21997-1-pkshih@realtek.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [172.21.69.94] X-ClientProxiedBy: RTEXMBS02.realtek.com.tw (172.21.6.95) To RTEXMBS04.realtek.com.tw (172.21.6.97) X-KSE-ServerInfo: RTEXMBS04.realtek.com.tw, 9 X-KSE-AntiSpam-Interceptor-Info: license violation X-KSE-Antivirus-Attachment-Filter-Interceptor-Info: license violation X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Wed, 01 Nov 2023 00:22:42 -0700 (PDT) For WiFi 7 chips, the PCI settings are similar, but registers' names are changed, so it will be difficult to understand the code if we mix the code of two generations into one function. Therefore, we add a struct to abstract PCI generation info, and put the code used by WiFi 7 chips in pci_be.c. Then, the struct hierarchy looks like rtwdev | v const struct rtw89_pci_info *pci_info; // per chip (e.g. 8922ae.c) | v const struct rtw89_pci_gen_def *gen_def; // per generation (e.g. pci_be.c) Ping-Ke Shih (5): wifi: rtw89: pci: add PCI generation information to pci_info for each chip wifi: rtw89: pci: use gen_def pointer to configure mac_{pre,post}_init and clear PCI ring index wifi: rtw89: pci: implement PCI mac_pre_init for WiFi 7 chips wifi: rtw89: pci: add LTR v2 for WiFi 7 chip wifi: rtw89: pci: implement PCI mac_post_init for WiFi 7 chips drivers/net/wireless/realtek/rtw89/pci.c | 16 +- drivers/net/wireless/realtek/rtw89/pci.h | 150 ++++++ drivers/net/wireless/realtek/rtw89/pci_be.c | 429 ++++++++++++++++++ drivers/net/wireless/realtek/rtw89/reg.h | 271 +++++++++++ .../net/wireless/realtek/rtw89/rtw8851be.c | 1 + .../net/wireless/realtek/rtw89/rtw8852ae.c | 1 + .../net/wireless/realtek/rtw89/rtw8852be.c | 1 + .../net/wireless/realtek/rtw89/rtw8852ce.c | 1 + .../net/wireless/realtek/rtw89/rtw8922ae.c | 2 + 9 files changed, 868 insertions(+), 4 deletions(-) create mode 100644 drivers/net/wireless/realtek/rtw89/pci_be.c -- 2.25.1