From patchwork Thu Nov 24 03:18:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sujuan Chen X-Patchwork-Id: 25297 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp3165047wrr; Wed, 23 Nov 2022 19:21:48 -0800 (PST) X-Google-Smtp-Source: AA0mqf7uRv9TdIcs8JFYwOPz5EDLjnMg0GasPCHw7XZUwXOIOKKuYoguSR1OpiIiAUPzwZH4uQxS X-Received: by 2002:a17:902:8604:b0:188:d78e:16ec with SMTP id f4-20020a170902860400b00188d78e16ecmr24670241plo.154.1669260108267; Wed, 23 Nov 2022 19:21:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669260108; cv=none; d=google.com; s=arc-20160816; b=FvBITMbkHrzWw+LSSpmHqRLyF4FOQ8ecwoQ9SJ9xFsZSGbg1UceMVGQsquRMxcqkxk B0IMecQPTVrjYDHt0yadGF2LTXLeQhNj9326bjEfa1yi3V2TGKX1ntHNWRRq1MnK6rSN 2gJjyqXDA9klsl/YjB+Y5O9PrJF3imhRIMUPoyFNlwU7k11AJngcD31BhwcytCDNXdXd ZZj4pHi2dji6jzbiY9HeJp0mn4woD6stGzp6gOiMF23NyoCDoVpc/Kr0qxQeUqWjHw85 rH2IReHDA1H6sySZKjIV+XOCgQt8jLi4blcrGzPKj8FmgU/wQcw/TTW82rUiIOFZmT8e Q4hw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=u5+pFYua6/l1kuQGRysiQMlUlfivreEacbkKmrw9oA4=; b=mslTBGnxsNBOUOJgy925RBVQ6wQz1VDGZRBIvYOIqGCwWVQY+4I3XOInqqn2milbb7 HD8z2fyhs+9wpsbKSQi6o8SJ9KdruxS84Q+Al4/tirIeKFncB6pmjBSiUdFRNzuNITvt Zhmy6TyIOy2OGQarxe7S+2cWYOI4Hu91i79oDXznoVZ/0p+dTzjgev0yVn9RAQYmpoXK OYk/8Wi4xT3QKMAB7Rgfa7J6MJfy905Zi0njUGyzoMku5HJF1XWl5dLlOiGDGyocs5h0 SXMFKnsAdGXr0gQxqwp98EnExTJwpXMLIJGOg+ZrvgqxkxM6c/Bls5c0xlTuSMzAI8fO yJuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=lL37L19i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u24-20020a63d358000000b00477c2398283si208258pgi.299.2022.11.23.19.21.35; Wed, 23 Nov 2022 19:21:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=lL37L19i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229931AbiKXDS3 (ORCPT + 99 others); Wed, 23 Nov 2022 22:18:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229647AbiKXDS1 (ORCPT ); Wed, 23 Nov 2022 22:18:27 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D5E8CB680; Wed, 23 Nov 2022 19:18:21 -0800 (PST) X-UUID: 9a08e972898247dea47641fafa7c5869-20221124 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:Message-ID:Date:Subject:CC:To:From; bh=u5+pFYua6/l1kuQGRysiQMlUlfivreEacbkKmrw9oA4=; b=lL37L19ishtpHa1/javh0ehkX4mte53sVDScT12cq5UzUP8WALtEmGtuJdgo3Id/QyyHO/4/mdGj6Hj1vQArbIHsUzYC8Wa0poaBmZ1BAPDqF4mTvBnSaZUNsQloiz09KR3tsjA8/rewWx21piTRBdifs3sVEmvJec7NjdzyrbE=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.13,REQID:8fa159ea-1209-4567-8176-d266b5b5984e,IP:0,U RL:0,TC:0,Content:-5,EDM:0,RT:0,SF:100,FILE:0,BULK:0,RULE:Release_Ham,ACTI ON:release,TS:95 X-CID-INFO: VERSION:1.1.13,REQID:8fa159ea-1209-4567-8176-d266b5b5984e,IP:0,URL :0,TC:0,Content:-5,EDM:0,RT:0,SF:100,FILE:0,BULK:0,RULE:Spam_GS981B3D,ACTI ON:quarantine,TS:95 X-CID-META: VersionHash:d12e911,CLOUDID:c6ee27f9-3a34-4838-abcf-dfedf9dd068e,B ulkID:22112311232651OBQXJC,BulkQuantity:5,Recheck:0,SF:28|17|19|48,TC:nil, Content:0,EDM:-3,IP:nil,URL:0,File:nil,Bulk:40,QS:nil,BEC:nil,COL:0 X-UUID: 9a08e972898247dea47641fafa7c5869-20221124 Received: from mtkcas11.mediatek.inc [(172.21.101.40)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1476388266; Thu, 24 Nov 2022 11:18:18 +0800 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs10n2.mediatek.inc (172.21.101.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.3; Thu, 24 Nov 2022 11:18:17 +0800 Received: from mcddlt001.gcn.mediatek.inc (10.19.240.15) by mtkmbs11n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Thu, 24 Nov 2022 11:18:16 +0800 From: Sujuan Chen To: CC: Felix Fietkau , , "Lorenzo Bianconi" , Mark Lee , "Evelyn Tsai" , Bo Jiao , linux-mediatek , Sujuan Chen Subject: [PATCH,v2] net: ethernet: mtk_wed: add wcid overwritten support for wed v1 Date: Thu, 24 Nov 2022 11:18:14 +0800 Message-ID: <36d6cf34361ba648ad307affb0371d94663c108d.1669259807.git.sujuan.chen@mediatek.com> X-Mailer: git-send-email 2.17.0 MIME-Version: 1.0 X-MTK: N X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, T_SPF_TEMPERROR,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750346086933956003?= X-GMAIL-MSGID: =?utf-8?q?1750346086933956003?= All wed versions should enable the wcid overwritten feature, since the wcid size is controlled by the wlan driver. Tested-by: Sujuan Chen Co-developed-by: Bo Jiao Signed-off-by: Bo Jiao Signed-off-by: Sujuan Chen --- v2: get rid of the unnecessary if condition --- drivers/net/ethernet/mediatek/mtk_wed.c | 13 ++++++++----- drivers/net/ethernet/mediatek/mtk_wed_regs.h | 2 ++ include/linux/soc/mediatek/mtk_wed.h | 3 +++ 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/mediatek/mtk_wed.c b/drivers/net/ethernet/mediatek/mtk_wed.c index 7d8842378c2b..16d7af88bbac 100644 --- a/drivers/net/ethernet/mediatek/mtk_wed.c +++ b/drivers/net/ethernet/mediatek/mtk_wed.c @@ -526,9 +526,9 @@ mtk_wed_dma_disable(struct mtk_wed_device *dev) MTK_WED_WPDMA_RX_D_RX_DRV_EN); wed_clr(dev, MTK_WED_WDMA_GLO_CFG, MTK_WED_WDMA_GLO_CFG_TX_DDONE_CHK); - - mtk_wed_set_512_support(dev, false); } + + mtk_wed_set_512_support(dev, false); } static void @@ -1290,9 +1290,10 @@ mtk_wed_start(struct mtk_wed_device *dev, u32 irq_mask) if (mtk_wed_rro_cfg(dev)) return; - mtk_wed_set_512_support(dev, dev->wlan.wcid_512); } + mtk_wed_set_512_support(dev, dev->wlan.wcid_512); + mtk_wed_dma_enable(dev); dev->running = true; } @@ -1358,11 +1359,13 @@ mtk_wed_attach(struct mtk_wed_device *dev) } mtk_wed_hw_init_early(dev); - if (hw->version == 1) + if (hw->version == 1) { regmap_update_bits(hw->hifsys, HIFSYS_DMA_AG_MAP, BIT(hw->index), 0); - else + } else { + dev->rev_id = wed_r32(dev, MTK_WED_REV_ID); ret = mtk_wed_wo_init(hw); + } out: if (ret) mtk_wed_detach(dev); diff --git a/drivers/net/ethernet/mediatek/mtk_wed_regs.h b/drivers/net/ethernet/mediatek/mtk_wed_regs.h index 9e39dace95eb..873d50b9a6e6 100644 --- a/drivers/net/ethernet/mediatek/mtk_wed_regs.h +++ b/drivers/net/ethernet/mediatek/mtk_wed_regs.h @@ -20,6 +20,8 @@ struct mtk_wdma_desc { __le32 info; } __packed __aligned(4); +#define MTK_WED_REV_ID 0x004 + #define MTK_WED_RESET 0x008 #define MTK_WED_RESET_TX_BM BIT(0) #define MTK_WED_RESET_TX_FREE_AGENT BIT(4) diff --git a/include/linux/soc/mediatek/mtk_wed.h b/include/linux/soc/mediatek/mtk_wed.h index 8294978f4bca..1b1ef57609f7 100644 --- a/include/linux/soc/mediatek/mtk_wed.h +++ b/include/linux/soc/mediatek/mtk_wed.h @@ -85,6 +85,9 @@ struct mtk_wed_device { int irq; u8 version; + /* used by wlan driver */ + u32 rev_id; + struct mtk_wed_ring tx_ring[MTK_WED_TX_QUEUES]; struct mtk_wed_ring rx_ring[MTK_WED_RX_QUEUES]; struct mtk_wed_ring txfree_ring;