Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp164554ybl; Wed, 11 Dec 2019 15:55:00 -0800 (PST) X-Google-Smtp-Source: APXvYqwTf3Sgu+1qkTA9lNWq90CViNbUEu0roTpaXiaOJ5Up81N8wII9EYkN5n6Md1cKs/xG9I9b X-Received: by 2002:a05:6830:1e69:: with SMTP id m9mr4622541otr.335.1576108500124; Wed, 11 Dec 2019 15:55:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576108500; cv=none; d=google.com; s=arc-20160816; b=KNylMvWoUOX5DyOoXFI2k9UFay4DS15arT/p9PW+kT9WXztxUV5lepJSOYAy8nag6P +lTD+SFvjW6OWRM06ahFVTrAMOFDxSKSGeT1+9aBEHAJ0YXSe3fKG/xsRg54VOdQC3Y1 hy5doJufD/znmvPR77YziIbmoUtt/p4/0wVkO37+z5JuGJHur2YxFmCMnA/1Q5haKC3S vZYVqxq/unYV491DVci/JmUTHO1TQ6I+uFxe8a1mgkMgnsV0rwytqVZldmWK+Pwc2lyP 4kghEyj+d+PmWBfFQH+pdj7J3CV5Bp8+OH3BHet0NGV6gGtEEsG/yUmTL6deJjvnt2ea ebcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Zs/mNtKBe7I6i4Z6rFTOzFYV/fAnWaxRRskE4RfAEGk=; b=QtG1NSsGi/DPxKCaNv/whVAHBun1XR2ZBo/Mf2u/WiL+QeCxMUt+KwdAVkfCkVowOc h1bjPXSjOZJPf2mfHJIlHyFGeTanCKNA2BJ5u046qRo6RVTm7UQYbC20CnLx192nhTvS vIEqh4CKKhay8YABDPgQHscgU5xsPRJ8HN6NznHa6FuxffjwD/9tMVN7axGfdd9hG3q/ YhSd+XIv7intcARnKc2MPU5tZLTDtcABUZ0O/OmNDJiE+ccDM4+FU2p3cDL6mEue07ef 1JHI8taEQ9r97hf5H4HwiqXdf9fhBjXCj6oPUVoGDgGAED65YL0p+KjmN1LYPX2L9VrC 91nA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@web.de header.s=dbaedf251592 header.b=QHfjrJCv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 5si2063169ott.186.2019.12.11.15.54.47; Wed, 11 Dec 2019 15:55:00 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@web.de header.s=dbaedf251592 header.b=QHfjrJCv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727346AbfLKXxq (ORCPT + 99 others); Wed, 11 Dec 2019 18:53:46 -0500 Received: from mout.web.de ([212.227.17.11]:36427 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727226AbfLKXxb (ORCPT ); Wed, 11 Dec 2019 18:53:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=dbaedf251592; t=1576108389; bh=Jw3d/3FG5d2fs3pbP5cmR9tz+imTkB9FfgldNiz16/M=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=QHfjrJCvhmuCCnSf1F/RiTE3u7NdGsOyiro4sUDoDIQ+BV6PzAODPhHh1Cl7rbGB8 8g2zq0CxIlQxFOZ0mVoVjj+Q1dN150ZDpr5DsCsqGUV2gw/Iy4detaBikD0SXnkeal jfU6VBuWfOIv7zxNJOfScJziWrGpu8ob2L2xUIF0= X-UI-Sender-Class: c548c8c5-30a9-4db5-a2e7-cb6cb037b8f9 Received: from localhost.localdomain ([89.204.139.166]) by smtp.web.de (mrweb101 [213.165.67.124]) with ESMTPSA (Nemesis) id 0Mhlmh-1iJYJC0mhf-00MwBd; Thu, 12 Dec 2019 00:53:09 +0100 From: Soeren Moch To: Kalle Valo , Heiko Stuebner Cc: Chung-Hsien Hsu , Soeren Moch , Arend van Spriel , Franky Lin , Hante Meuleman , Chi-Hsien Lin , Wright Feng , linux-wireless@vger.kernel.org, brcm80211-dev-list.pdl@broadcom.com, brcm80211-dev-list@cypress.com, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/9] brcmfmac: set F2 blocksize and watermark for 4359 Date: Thu, 12 Dec 2019 00:52:46 +0100 Message-Id: <20191211235253.2539-3-smoch@web.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191211235253.2539-1-smoch@web.de> References: <20191211235253.2539-1-smoch@web.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:vMAckOgNBxG6cLi2IX3dVxNnAjzrN9nQcd36iOgEGjn7lSyOXK0 nMmPQF96FpuS9n/OnUjpHNPcWxW8ctz5fO3ibNoNVUPj3EW+6zvheCwlxSOOoWs2gDf+gmY p4EirClUV1rcJdk7pgxNeOvTWz8mX1eiqcst5vCJFqdAHlgxEYhaMFLTEBK2i2tiRaxBzO3 pyg4nxvbZPxpAHrGgvnZQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:Jm6PikBj8do=:bhZOh8ji0Cm3PXLd8vpAhB c7KTXi1ITKNxCijfIlhgJKvVQDYDAgkGWFdQSKy8WVmVRRXjzTWL5dkSRcpZbYZT/kCdMcv5E cNSQdgYK9OoY0+QUPV9M6+5lAymFlzhjrWU0y/umHkgscJK/l68t/ge+xV3POxR16m3yKl7gd T0AU3Mgz18Rm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dk1Ha00y/U9Id/PqaUSR1JB4ifYan N5MNtNk3cmZwBbpmRKtsp9azFnviVwGUl/Yy3vw== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chung-Hsien Hsu Set F2 blocksize to 256 bytes and watermark to 0x40 for 4359. Also enable and configure F1 MesBusyCtrl. It fixes DMA error while having UDP bi-directional traffic. Signed-off-by: Chung-Hsien Hsu [slightly adapted for rebase on mainline linux] Signed-off-by: Soeren Moch Reviewed-by: Chi-Hsien Lin =2D-- changes in v2: - add review tag received for v1 Cc: Kalle Valo Cc: Heiko Stuebner Cc: Arend van Spriel Cc: Franky Lin Cc: Hante Meuleman Cc: Chi-Hsien Lin Cc: Wright Feng Cc: linux-wireless@vger.kernel.org Cc: brcm80211-dev-list.pdl@broadcom.com Cc: brcm80211-dev-list@cypress.com Cc: netdev@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-rockchip@lists.infradead.org Cc: linux-kernel@vger.kernel.org =2D-- .../wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 6 +++++- .../wireless/broadcom/brcm80211/brcmfmac/sdio.c | 15 +++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c b/d= rivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c index 96fd8e2bf773..68baf0189305 100644 =2D-- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c @@ -43,6 +43,7 @@ #define SDIO_FUNC1_BLOCKSIZE 64 #define SDIO_FUNC2_BLOCKSIZE 512 +#define SDIO_4359_FUNC2_BLOCKSIZE 256 /* Maximum milliseconds to wait for F2 to come up */ #define SDIO_WAIT_F2RDY 3000 @@ -903,6 +904,7 @@ static void brcmf_sdiod_host_fixup(struct mmc_host *ho= st) static int brcmf_sdiod_probe(struct brcmf_sdio_dev *sdiodev) { int ret =3D 0; + unsigned int f2_blksz =3D SDIO_FUNC2_BLOCKSIZE; sdio_claim_host(sdiodev->func1); @@ -912,7 +914,9 @@ static int brcmf_sdiod_probe(struct brcmf_sdio_dev *sd= iodev) sdio_release_host(sdiodev->func1); goto out; } - ret =3D sdio_set_block_size(sdiodev->func2, SDIO_FUNC2_BLOCKSIZE); + if (sdiodev->func2->device =3D=3D SDIO_DEVICE_ID_BROADCOM_4359) + f2_blksz =3D SDIO_4359_FUNC2_BLOCKSIZE; + ret =3D sdio_set_block_size(sdiodev->func2, f2_blksz); if (ret) { brcmf_err("Failed to set F2 blocksize\n"); sdio_release_host(sdiodev->func1); diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/dri= vers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c index 264ad63232f8..21e535072f3f 100644 =2D-- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c @@ -42,6 +42,8 @@ #define DEFAULT_F2_WATERMARK 0x8 #define CY_4373_F2_WATERMARK 0x40 #define CY_43012_F2_WATERMARK 0x60 +#define CY_4359_F2_WATERMARK 0x40 +#define CY_4359_F1_MESBUSYCTRL (CY_4359_F2_WATERMARK | SBSDIO_MESBUSYCTRL= _ENAB) #ifdef DEBUG @@ -4205,6 +4207,19 @@ static void brcmf_sdio_firmware_callback(struct dev= ice *dev, int err, brcmf_sdiod_writeb(sdiod, SBSDIO_DEVICE_CTL, devctl, &err); break; + case SDIO_DEVICE_ID_BROADCOM_4359: + brcmf_dbg(INFO, "set F2 watermark to 0x%x*4 bytes\n", + CY_4359_F2_WATERMARK); + brcmf_sdiod_writeb(sdiod, SBSDIO_WATERMARK, + CY_4359_F2_WATERMARK, &err); + devctl =3D brcmf_sdiod_readb(sdiod, SBSDIO_DEVICE_CTL, + &err); + devctl |=3D SBSDIO_DEVCTL_F2WM_ENAB; + brcmf_sdiod_writeb(sdiod, SBSDIO_DEVICE_CTL, devctl, + &err); + brcmf_sdiod_writeb(sdiod, SBSDIO_FUNC1_MESBUSYCTRL, + CY_4359_F1_MESBUSYCTRL, &err); + break; default: brcmf_sdiod_writeb(sdiod, SBSDIO_WATERMARK, DEFAULT_F2_WATERMARK, &err); =2D- 2.17.1