From patchwork Tue Dec 19 12:06:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xinming Hu X-Patchwork-Id: 10123141 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 705646019C for ; Tue, 19 Dec 2017 12:07:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 58F2D292C8 for ; Tue, 19 Dec 2017 12:07:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4D500292D9; Tue, 19 Dec 2017 12:07:35 +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 CB9AC292C8 for ; Tue, 19 Dec 2017 12:07:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1762565AbdLSMHd (ORCPT ); Tue, 19 Dec 2017 07:07:33 -0500 Received: from mx0a-0016f401.pphosted.com ([67.231.148.174]:43410 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1762571AbdLSMHc (ORCPT ); Tue, 19 Dec 2017 07:07:32 -0500 Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id vBJC59db005869; Tue, 19 Dec 2017 04:07:28 -0800 Received: from sc-exch04.marvell.com ([199.233.58.184]) by mx0a-0016f401.pphosted.com with ESMTP id 2ew1qn2dj1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 19 Dec 2017 04:07:28 -0800 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Tue, 19 Dec 2017 04:07:27 -0800 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server id 15.0.1210.3 via Frontend Transport; Tue, 19 Dec 2017 04:07:27 -0800 Received: from smtp.marvell.com (unknown [10.38.32.107]) by maili.marvell.com (Postfix) with SMTP id 1ABF73F703F; Tue, 19 Dec 2017 04:07:22 -0800 (PST) Received: by smtp.marvell.com (sSMTP sendmail emulation); Tue, 19 Dec 2017 20:07:17 +0800 From: Xinming Hu To: Linux MMC CC: Ulf Hansson , Kalle Valo , Arend van Spriel , Franky Lin , Hante Meuleman , Chi-Hsien Lin , Wright Feng , Zhiyuan Yang , Tim Song , Cathy Luo , James Cao , Ganapathi Bhat , Xu Wang , Bob Tan , Xinming Hu Subject: [PATCH v6 3/4] brcmfmac: change to use mmc api for accessing host supported maximum segment count and size Date: Tue, 19 Dec 2017 20:06:49 +0800 Message-ID: <1513685211-640-3-git-send-email-huxm@marvell.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1513685211-640-1-git-send-email-huxm@marvell.com> References: <1513685211-640-1-git-send-email-huxm@marvell.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-12-19_07:, , signatures=0 X-Proofpoint-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1712190176 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Using mmc standard api to get the host sg capability. Signed-off-by: Xinming Hu --- v6: separate driver patch from patch 1/4. --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c index cd58732..d0e08d0 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c @@ -886,19 +886,21 @@ void brcmf_sdiod_sgtable_alloc(struct brcmf_sdio_dev *sdiodev) { struct sdio_func *func; struct mmc_host *host; + unsigned short max_segs = 0; uint max_blocks; uint nents; int err; func = sdiodev->func[2]; host = func->card->host; - sdiodev->sg_support = host->max_segs > 1; + + max_segs = sdio_get_host_max_seg_count(func); + sdiodev->sg_support = max_segs > 1; max_blocks = min_t(uint, host->max_blk_count, 511u); sdiodev->max_request_size = min_t(uint, host->max_req_size, max_blocks * func->cur_blksize); - sdiodev->max_segment_count = min_t(uint, host->max_segs, - SG_MAX_SINGLE_ALLOC); - sdiodev->max_segment_size = host->max_seg_size; + sdiodev->max_segment_count = min_t(uint, SG_MAX_SINGLE_ALLOC, max_segs); + sdiodev->max_segment_size = sdio_get_host_max_seg_size(func); if (!sdiodev->sg_support) return;