From patchwork Sat Sep 29 17:30:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 10620901 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-2.web.codeaurora.org (Postfix) with ESMTP id 637D6A6A for ; Sat, 29 Sep 2018 17:30:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4100829F12 for ; Sat, 29 Sep 2018 17:30:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3406229F15; Sat, 29 Sep 2018 17:30:52 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, 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 D8F1329F12 for ; Sat, 29 Sep 2018 17:30:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728462AbeI3AAF (ORCPT ); Sat, 29 Sep 2018 20:00:05 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:52220 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728364AbeI3AAF (ORCPT ); Sat, 29 Sep 2018 20:00:05 -0400 Received: by mail-wm1-f67.google.com with SMTP id y25-v6so4966071wmi.1 for ; Sat, 29 Sep 2018 10:30:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=9YKZ2NjTnd0KXHc/oopoOqxT42iKZhzAuvp860pmp7g=; b=nJlyEkpfHiJXnZM4MXfU5P3x42opgqEMoaN2DHoew+q2QzgBM+t+XO/s0LiwKV3T6p Q77G/8ea4coQITWdJUaG4+J5xsOl3/JQUZEDdq7oRZStT1540+PHMDSLWIh9smPhGbJt SExlaGEIvjzkIitAIM2/Bv6nrbOcivbTSIjXrnDaZXv++iN3nWIQNkttNZHod6hSTDV+ w/XzDWAA9KZwZOtlQ4e1Rpd1USvcBGmNUuRih4IEI7oioMEqBjx/nlO6xqh/S2TSxnPL F8e0E50KhKFrRbawMk+dLd6s0jH2xkBUlWu496Hxu9uY95SH56VxSYy1Txb4JpnLLUZv 4WEg== X-Gm-Message-State: ABuFfoiw5xLgrxg38glhzgTe/m1Hxor8glpn0OmShNGlYHjbgd0MJWgd reiwmAeMoI+IhjXalPs0jrmPkw== X-Google-Smtp-Source: ACcGV634rcJgx/IsG5aDY1lLZiy4VpjEc664Kv77abAUOJ256jimVk14aysYP1wz7XiB+1NCogGhcQ== X-Received: by 2002:a1c:e141:: with SMTP id y62-v6mr5150296wmg.138.1538242249453; Sat, 29 Sep 2018 10:30:49 -0700 (PDT) Received: from localhost.localdomain ([151.66.32.138]) by smtp.gmail.com with ESMTPSA id e64-v6sm3823631wmg.0.2018.09.29.10.30.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 29 Sep 2018 10:30:48 -0700 (PDT) From: Lorenzo Bianconi To: nbd@nbd.name Cc: sgruszka@redhat.com, linux-wireless@vger.kernel.org Subject: [PATCH] mt76x0: init: intrduce MT_H2M_* definitions Date: Sat, 29 Sep 2018 19:30:32 +0200 Message-Id: <20180929173032.32747-1-lorenzo.bianconi@redhat.com> X-Mailer: git-send-email 2.19.0 MIME-Version: 1.0 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 Add MT_H2M_BBP_AGENT, MT_H2M_MAILBOX_CSR and MT_H2M_INT_SRC and remove magic numbers Signed-off-by: Lorenzo Bianconi --- drivers/net/wireless/mediatek/mt76/mt76x0/init.c | 8 ++++---- drivers/net/wireless/mediatek/mt76/mt76x02_regs.h | 3 +++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/init.c b/drivers/net/wireless/mediatek/mt76/mt76x0/init.c index edfd5d94d197..4b8314844d36 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x0/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x0/init.c @@ -174,10 +174,10 @@ static void mt76x0_init_mac_registers(struct mt76x0_dev *dev) mt76_wr(dev, MT_WMM_CTRL, reg); /* TODO: Probably not needed */ - mt76_wr(dev, 0x7028, 0); - mt76_wr(dev, 0x7010, 0); - mt76_wr(dev, 0x7024, 0); - msleep(10); + mt76_wr(dev, MT_H2M_BBP_AGENT, 0); + mt76_wr(dev, MT_H2M_MAILBOX_CSR, 0); + mt76_wr(dev, MT_H2M_INT_SRC, 0); + usleep_range(10000, 20000); } static int mt76x0_init_wcid_mem(struct mt76x0_dev *dev) diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_regs.h b/drivers/net/wireless/mediatek/mt76/mt76x02_regs.h index f8003ee03a89..217bb0ac12fd 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x02_regs.h +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_regs.h @@ -622,8 +622,11 @@ #define MT_SRAM_BASE 0x4000 +#define MT_H2M_MAILBOX_CSR 0x7010 #define MT_H2M_MAILBOX_CID 0x7014 #define MT_H2M_MAILBOX_STATUS 0x701c +#define MT_H2M_INT_SRC 0x7024 +#define MT_H2M_BBP_AGENT 0x7028 #define MT_WCID_KEY_BASE 0x8000 #define MT_WCID_KEY(_n) (MT_WCID_KEY_BASE + (_n) * 32)