From patchwork Thu Aug 30 02:29:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carl Huang X-Patchwork-Id: 10581157 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8C436174A for ; Thu, 30 Aug 2018 02:30:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7DD182BCFF for ; Thu, 30 Aug 2018 02:30:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7C5432BD25; Thu, 30 Aug 2018 02:30:21 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0CC502BD36 for ; Thu, 30 Aug 2018 02:30:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=Zj6idBTVPfmeilprVHVTzZopwakughLWiljcV+c9mk4=; b=kDUhztL/mWPleBeRb0f2A7RF9Y 3czk2IZ6WuYDA3SMl8S9R7PYUJXC//Vi3T39JC3gElA6+fuU0waEL4eiElEh70PuvWWG9nmBdcPXl GcQjyh4rwY0hRfF7mQwppHMBdRmgENuVTmQHlyUiC90X+2G0EhlsIuABgvuu5hIm4f59Dsyo3Krvu U+8kDu7NNYpm+zh+vfdQPaAmoDi1RxT57EsFif1pp9h7hxVjxaIKIZPERCjNHzpBOLvRwX7KvyhHv KXm2ekJ7AdlUu34aOw27EMPyE79UnP2b1mKmP/oB9M/od2TxfF7Y2Cx4OIG1Zqq2kyETPxp8suOUo hD2qvUTg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fvCis-00072r-Vv; Thu, 30 Aug 2018 02:30:15 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fvCii-0006X9-R3 for ath10k@lists.infradead.org; Thu, 30 Aug 2018 02:30:06 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id C2DBE6055B; Thu, 30 Aug 2018 02:29:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1535596195; bh=sESKmbKH4Jiqlnd4VlNv1o9ltKfQ+tlj3jZBzGqZiCE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GDnCESLDLv7XcXsr+yhbeIwplJMDSdxBGHc/mrMyqGsIxaotnf9OOXIkEhOrpLx0V 5mVadm1cM3Hus6D3oiQCp0AOsFSqfIyez70WjlqTstVoLeajLDNsavZdI77lKmTSGy AXscygecr+C1QQGrYY+P0GJVZO5hCziNRIfGTonQ= Received: from cjhuang-station.qca.qualcomm.com (unknown [180.166.53.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: cjhuang@codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id AB1C760540; Thu, 30 Aug 2018 02:29:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1535596195; bh=sESKmbKH4Jiqlnd4VlNv1o9ltKfQ+tlj3jZBzGqZiCE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GDnCESLDLv7XcXsr+yhbeIwplJMDSdxBGHc/mrMyqGsIxaotnf9OOXIkEhOrpLx0V 5mVadm1cM3Hus6D3oiQCp0AOsFSqfIyez70WjlqTstVoLeajLDNsavZdI77lKmTSGy AXscygecr+C1QQGrYY+P0GJVZO5hCziNRIfGTonQ= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org AB1C760540 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=cjhuang@codeaurora.org From: Carl Huang To: ath10k@lists.infradead.org Subject: [PATCH 2/3] ath10k: support to access target space below 1M for qca6174 and qca9377 Date: Thu, 30 Aug 2018 10:29:41 +0800 Message-Id: <1535596182-18038-3-git-send-email-cjhuang@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1535596182-18038-1-git-send-email-cjhuang@codeaurora.org> References: <1535596182-18038-1-git-send-email-cjhuang@codeaurora.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180829_193004_956828_3CE492C1 X-CRM114-Status: GOOD ( 13.30 ) X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-wireless@vger.kernel.org MIME-Version: 1.0 Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP To download firmware via diag interface, driver needs to write the target memory space below 1M. It means the bit20 should be zero for the converted address if the target memory space is below 1M. Otherwise, bit20 is one if the target address is larger or equal to 1M space. As downloading firmware via diag interface is only required for qca6174 and qca9377, a new specific function is introduced to convert the target address to ce address: ath10k_pci_qca6174_targ_cpu_to_ce_addri(). This function supports to convert any target address to ce address. It's tested with QCA6174 hw3.2 and firmware-6.bin_WLAN.RM.4.4.1-00111-QCARMSWP-1. QCA9377 is also affected. Signed-off-by: Carl Huang --- drivers/net/wireless/ath/ath10k/pci.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c index 7edbfe5..c82f17c 100644 --- a/drivers/net/wireless/ath/ath10k/pci.c +++ b/drivers/net/wireless/ath/ath10k/pci.c @@ -870,6 +870,21 @@ static u32 ath10k_pci_qca988x_targ_cpu_to_ce_addr(struct ath10k *ar, u32 addr) return val; } +/* Refactor from ath10k_pci_qca988x_targ_cpu_to_ce_addr. + * Support to access target space below 1M for qca6174 and qca9377. + * If target space is below 1M, the bit[20] of converted CE addr is 0. + * Otherwise bit[20] of converted CE addr is 1. + */ +static u32 ath10k_pci_qca6174_targ_cpu_to_ce_addr(struct ath10k *ar, u32 addr) +{ + u32 val = 0, region = addr & 0xfffff; + + val = (ath10k_pci_read32(ar, SOC_CORE_BASE_ADDRESS + CORE_CTRL_ADDRESS) + & 0x7ff) << 21; + val |= ((addr >= 0x100000) ? 0x100000 : 0) | region; + return val; +} + static u32 ath10k_pci_qca99x0_targ_cpu_to_ce_addr(struct ath10k *ar, u32 addr) { u32 val = 0, region = addr & 0xfffff; @@ -3514,7 +3529,7 @@ static int ath10k_pci_probe(struct pci_dev *pdev, pci_ps = true; pci_soft_reset = ath10k_pci_warm_reset; pci_hard_reset = ath10k_pci_qca6174_chip_reset; - targ_cpu_to_ce_addr = ath10k_pci_qca988x_targ_cpu_to_ce_addr; + targ_cpu_to_ce_addr = ath10k_pci_qca6174_targ_cpu_to_ce_addr; break; case QCA99X0_2_0_DEVICE_ID: hw_rev = ATH10K_HW_QCA99X0; @@ -3542,7 +3557,7 @@ static int ath10k_pci_probe(struct pci_dev *pdev, pci_ps = true; pci_soft_reset = NULL; pci_hard_reset = ath10k_pci_qca6174_chip_reset; - targ_cpu_to_ce_addr = ath10k_pci_qca988x_targ_cpu_to_ce_addr; + targ_cpu_to_ce_addr = ath10k_pci_qca6174_targ_cpu_to_ce_addr; break; default: WARN_ON(1);