From patchwork Fri Jan 26 07:46:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ping-Ke Shih X-Patchwork-Id: 10185205 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7752760383 for ; Fri, 26 Jan 2018 07:47:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6980B28FFD for ; Fri, 26 Jan 2018 07:47:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5E734290DB; Fri, 26 Jan 2018 07:47:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CE9B428FFD for ; Fri, 26 Jan 2018 07:47:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752068AbeAZHrM (ORCPT ); Fri, 26 Jan 2018 02:47:12 -0500 Received: from rtits2.realtek.com ([211.75.126.72]:39010 "EHLO rtits2.realtek.com.tw" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751861AbeAZHrJ (ORCPT ); Fri, 26 Jan 2018 02:47:09 -0500 Authenticated-By: X-SpamFilter-By: BOX Solutions SpamTrap 5.62 with qID w0Q7kxqS004322, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (rtitcas12.realtek.com.tw [172.21.6.16]) by rtits2.realtek.com.tw (8.15.2/2.57/5.78) with ESMTP id w0Q7kxqS004322; Fri, 26 Jan 2018 15:46:59 +0800 Received: from RTITCASV01.realtek.com.tw (172.21.6.18) by RTITCAS12.realtek.com.tw (172.21.6.16) with Microsoft SMTP Server (TLS) id 14.3.361.1; Fri, 26 Jan 2018 15:46:59 +0800 Received: from localhost.localdomain (172.21.69.107) by RTITCASV01.realtek.com.tw (172.21.6.18) with Microsoft SMTP Server id 14.3.294.0; Fri, 26 Jan 2018 15:46:58 +0800 From: To: CC: , Subject: [PATCH 08/10] rtlwifi: add efuse ops for other components Date: Fri, 26 Jan 2018 15:46:43 +0800 Message-ID: <20180126074645.27201-9-pkshih@realtek.com> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180126074645.27201-1-pkshih@realtek.com> References: <20180126074645.27201-1-pkshih@realtek.com> MIME-Version: 1.0 X-Originating-IP: [172.21.69.107] Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Ping-Ke Shih The new component phydm need to access efuse content, so we prepare ops for reference. Signed-off-by: Tsang-Shian Lin Signed-off-by: Ping-Ke Shih Acked-by: Larry Finger --- drivers/net/wireless/realtek/rtlwifi/efuse.c | 13 +++++++++++++ drivers/net/wireless/realtek/rtlwifi/efuse.h | 2 +- drivers/net/wireless/realtek/rtlwifi/pci.c | 1 + drivers/net/wireless/realtek/rtlwifi/wifi.h | 7 +++++++ 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/realtek/rtlwifi/efuse.c b/drivers/net/wireless/realtek/rtlwifi/efuse.c index 35b50be633f1..fd13d4ef53b8 100644 --- a/drivers/net/wireless/realtek/rtlwifi/efuse.c +++ b/drivers/net/wireless/realtek/rtlwifi/efuse.c @@ -50,6 +50,11 @@ static const struct efuse_map RTL8712_SDIO_EFUSE_TABLE[] = { {11, 0, 0, 28} }; +static const struct rtl_efuse_ops efuse_ops = { + .efuse_onebyte_read = efuse_one_byte_read, + .efuse_logical_map_read = efuse_shadow_read, +}; + static void efuse_shadow_read_1byte(struct ieee80211_hw *hw, u16 offset, u8 *value); static void efuse_shadow_read_2byte(struct ieee80211_hw *hw, u16 offset, @@ -1364,3 +1369,11 @@ void rtl_fill_dummy(u8 *pfwbuf, u32 *pfwlen) *pfwlen = fwlen; } EXPORT_SYMBOL_GPL(rtl_fill_dummy); + +void rtl_efuse_ops_init(struct ieee80211_hw *hw) +{ + struct rtl_priv *rtlpriv = rtl_priv(hw); + + rtlpriv->efuse.efuse_ops = &efuse_ops; +} +EXPORT_SYMBOL_GPL(rtl_efuse_ops_init); diff --git a/drivers/net/wireless/realtek/rtlwifi/efuse.h b/drivers/net/wireless/realtek/rtlwifi/efuse.h index 952fdc288f0e..dfa31c13fc7a 100644 --- a/drivers/net/wireless/realtek/rtlwifi/efuse.h +++ b/drivers/net/wireless/realtek/rtlwifi/efuse.h @@ -116,5 +116,5 @@ void rtl_fill_dummy(u8 *pfwbuf, u32 *pfwlen); void rtl_fw_page_write(struct ieee80211_hw *hw, u32 page, const u8 *buffer, u32 size); void rtl_fw_block_write(struct ieee80211_hw *hw, const u8 *buffer, u32 size); - +void rtl_efuse_ops_init(struct ieee80211_hw *hw); #endif diff --git a/drivers/net/wireless/realtek/rtlwifi/pci.c b/drivers/net/wireless/realtek/rtlwifi/pci.c index 01ccf8884831..2437422625bf 100644 --- a/drivers/net/wireless/realtek/rtlwifi/pci.c +++ b/drivers/net/wireless/realtek/rtlwifi/pci.c @@ -2238,6 +2238,7 @@ int rtl_pci_probe(struct pci_dev *pdev, rtlpriv->cfg = (struct rtl_hal_cfg *)(id->driver_data); rtlpriv->intf_ops = &rtl_pci_ops; rtlpriv->glb_var = &rtl_global_var; + rtl_efuse_ops_init(hw); /* MEM map */ err = pci_request_regions(pdev, KBUILD_MODNAME); diff --git a/drivers/net/wireless/realtek/rtlwifi/wifi.h b/drivers/net/wireless/realtek/rtlwifi/wifi.h index 2e9a20273a2d..0e8aae0c05c1 100644 --- a/drivers/net/wireless/realtek/rtlwifi/wifi.h +++ b/drivers/net/wireless/realtek/rtlwifi/wifi.h @@ -1812,6 +1812,7 @@ struct rtl_dm { #define EFUSE_MAX_LOGICAL_SIZE 512 struct rtl_efuse { + const struct rtl_efuse_ops *efuse_ops; bool autoLoad_ok; bool bootfromefuse; u16 max_physical_size; @@ -1917,6 +1918,12 @@ struct rtl_efuse { u8 channel_plan; }; +struct rtl_efuse_ops { + int (*efuse_onebyte_read)(struct ieee80211_hw *hw, u16 addr, u8 *data); + void (*efuse_logical_map_read)(struct ieee80211_hw *hw, u8 type, + u16 offset, u32 *value); +}; + struct rtl_tx_report { atomic_t sn; u16 last_sent_sn;