From patchwork Tue Jul 25 09:23:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Herve Codina X-Patchwork-Id: 125455 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9010:0:b0:3e4:2afc:c1 with SMTP id l16csp2346353vqg; Tue, 25 Jul 2023 02:31:21 -0700 (PDT) X-Google-Smtp-Source: APBJJlEPGw6Pbo30q7LK99q4DNuNLJG2YBbky8Oeg2GvvqKnz1tCPTDfz1D20fE5ORDvFNnWXn8T X-Received: by 2002:aa7:cb18:0:b0:521:728f:d84e with SMTP id s24-20020aa7cb18000000b00521728fd84emr2084919edt.0.1690277481537; Tue, 25 Jul 2023 02:31:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690277481; cv=none; d=google.com; s=arc-20160816; b=WxnBxwHh9XLvCpmZbys9zPyG3gg0fzMa2IWy/vs+FHI8QFuSrEziVbkRhtVA8mOipT nsW2Pz/ROUKF+wCaBW9fiwJBWJP2Wqv7f7jNV2vw4I08TCTfqy/qQr2gDUkctNuOn+6K lIE1Dx/OUoN+KiTMeSfmi5NbkeegahopCdk/CciBkWQNiiAzP0+ABQvcivx29xqc37lE mf9YstEn8jHbmqL5WRFxz6BHKuCvXMpJVW9998uq/NJcuXAdnvCoVgmDd7CZEqo1w8ll cbzBg4SgSMY2o8m6VqoZLx1SnZGcNWJLKl0hGiPoUTgiZdHoNwFg9BuJoDLno3NcCZBT NL+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=PGPsXXtMWY75ybXe0b5dmZT1/eNTZycbZPNt7Yn/q9Y=; fh=j5z+1OhFuGBFoHpqsKfNW8PvbyYDiDyztgOSDrYZWKg=; b=JRj3LQcrdz4W4qElHdPyH3MMKBXN5Rf9gmHnYsJRO7T28UjZeyIM2mfyswyyg8aPo/ RyG8T4PSMm+jj849ANHNqc2qWqgDrk8p8C955MJoSGQIKC6MkctvoJLMBRX/gzvQb3sp lLCo0zIrbprRh7e6mEIFBg8n0blzqlYYY7ZzXG9Aj2PS9Px5j8BssrAu9CmQ4ZkN5UD7 cf7KwmNI2h5hARBUDZteOaJDX+ReF6bqUHUnOphgu+qyAAzJkbAea7/4yBhlg+WJQkNk yDM3OnJj6LsYmVRheEZN8i+lU6M9sdAAS1E9nSLzxlIICR7xLrbmLtCRvaN7hG6psaJm 2kNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=jy9V3+gs; 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=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g25-20020aa7c599000000b005222c413404si2785772edq.681.2023.07.25.02.30.57; Tue, 25 Jul 2023 02:31:21 -0700 (PDT) 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=@bootlin.com header.s=gm1 header.b=jy9V3+gs; 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=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232986AbjGYJ1J (ORCPT + 99 others); Tue, 25 Jul 2023 05:27:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232893AbjGYJ01 (ORCPT ); Tue, 25 Jul 2023 05:26:27 -0400 Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BAC7526B9; Tue, 25 Jul 2023 02:25:30 -0700 (PDT) Received: by mail.gandi.net (Postfix) with ESMTPA id BFADA40002; Tue, 25 Jul 2023 09:25:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1690277128; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PGPsXXtMWY75ybXe0b5dmZT1/eNTZycbZPNt7Yn/q9Y=; b=jy9V3+gsIpT0GyIyt7ymEGOXt7n4DcDhe2I8crJBBlha1Crl4H7SBwRF2XD4gZr+fvC5Mu MZxM2f7CfNEPecPwZIbTMaAZb/sK3sdncyyCLjN04/kkMBzmqYRWLpcqwL+EHl0NRWD7Td JhJVXbceA5VKrQqDpCNq3WsD/VEFnXbnSokZO3FCbAAdYiMrxIwbzGCz7inivCbq5TAzbe nPOLHA6wjfwseA58YN79FvU7E07TTKU2aNoztjMfPhE8ywPbLg6s+5O9B2Nfp61p5e+W0Y ZL485rWtk05GEiTZuMsl2gxd47vD+aQ/MwAq994c0V8OZly7WVtOOeDafm7YOQ== From: Herve Codina To: Herve Codina , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Lee Jones , Linus Walleij , Qiang Zhao , Li Yang , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Shengjiu Wang , Xiubo Li , Fabio Estevam , Nicolin Chen , Christophe Leroy Cc: netdev@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, alsa-devel@alsa-project.org, Thomas Petazzoni Subject: [PATCH 12/26] soc: fsl: cpm1: qmc: Split Tx and Rx TSA entries setup Date: Tue, 25 Jul 2023 11:23:48 +0200 Message-ID: <20230725092417.43706-13-herve.codina@bootlin.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230725092417.43706-1-herve.codina@bootlin.com> References: <20230725092417.43706-1-herve.codina@bootlin.com> MIME-Version: 1.0 X-GND-Sasl: herve.codina@bootlin.com X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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: INBOX X-GMAIL-THRID: 1772384400601806704 X-GMAIL-MSGID: 1772384400601806704 The Tx and Rx entries for a given channel are set in one function. In order to modify Rx entries and Tx entries independently of one other, split this function in one for the Rx part and one for the Tx part. Signed-off-by: Herve Codina --- drivers/soc/fsl/qe/qmc.c | 49 ++++++++++++++++++++++++++++------------ 1 file changed, 35 insertions(+), 14 deletions(-) diff --git a/drivers/soc/fsl/qe/qmc.c b/drivers/soc/fsl/qe/qmc.c index e19782808f5b..d02acbc1d7e1 100644 --- a/drivers/soc/fsl/qe/qmc.c +++ b/drivers/soc/fsl/qe/qmc.c @@ -610,14 +610,14 @@ static int qmc_chan_setup_tsa_64rxtx(struct qmc_chan *chan, const struct tsa_ser return 0; } -static int qmc_chan_setup_tsa_32rx_32tx(struct qmc_chan *chan, const struct tsa_serial_info *info, - bool enable) +static int qmc_chan_setup_tsa_32rx(struct qmc_chan *chan, const struct tsa_serial_info *info, + bool enable) { unsigned int i; u16 curr; u16 val; - /* Use a Tx 32 entries table and a Rx 32 entries table */ + /* Use a Rx 32 entries table */ val = QMC_TSA_VALID | QMC_TSA_MASK | QMC_TSA_CHANNEL(chan->id); @@ -633,6 +633,30 @@ static int qmc_chan_setup_tsa_32rx_32tx(struct qmc_chan *chan, const struct tsa_ return -EBUSY; } } + + /* Set entries based on Rx stuff */ + for (i = 0; i < info->nb_rx_ts; i++) { + if (!(chan->rx_ts_mask & (((u64)1) << i))) + continue; + + qmc_clrsetbits16(chan->qmc->scc_pram + QMC_GBL_TSATRX + (i * 2), + ~QMC_TSA_WRAP, enable ? val : 0x0000); + } + + return 0; +} + +static int qmc_chan_setup_tsa_32tx(struct qmc_chan *chan, const struct tsa_serial_info *info, + bool enable) +{ + unsigned int i; + u16 curr; + u16 val; + + /* Use a Tx 32 entries table */ + + val = QMC_TSA_VALID | QMC_TSA_MASK | QMC_TSA_CHANNEL(chan->id); + /* Check entries based on Tx stuff */ for (i = 0; i < info->nb_tx_ts; i++) { if (!(chan->tx_ts_mask & (((u64)1) << i))) @@ -646,14 +670,6 @@ static int qmc_chan_setup_tsa_32rx_32tx(struct qmc_chan *chan, const struct tsa_ } } - /* Set entries based on Rx stuff */ - for (i = 0; i < info->nb_rx_ts; i++) { - if (!(chan->rx_ts_mask & (((u64)1) << i))) - continue; - - qmc_clrsetbits16(chan->qmc->scc_pram + QMC_GBL_TSATRX + (i * 2), - ~QMC_TSA_WRAP, enable ? val : 0x0000); - } /* Set entries based on Tx stuff */ for (i = 0; i < info->nb_tx_ts; i++) { if (!(chan->tx_ts_mask & (((u64)1) << i))) @@ -680,9 +696,14 @@ static int qmc_chan_setup_tsa(struct qmc_chan *chan, bool enable) * Setup one common 64 entries table or two 32 entries (one for Tx * and one for Tx) according to assigned TS numbers. */ - return ((info.nb_tx_ts > 32) || (info.nb_rx_ts > 32)) ? - qmc_chan_setup_tsa_64rxtx(chan, &info, enable) : - qmc_chan_setup_tsa_32rx_32tx(chan, &info, enable); + if (info.nb_tx_ts > 32 || info.nb_rx_ts > 32) + return qmc_chan_setup_tsa_64rxtx(chan, &info, enable); + + ret = qmc_chan_setup_tsa_32rx(chan, &info, enable); + if (ret) + return ret; + + return qmc_chan_setup_tsa_32tx(chan, &info, enable); } static int qmc_chan_command(struct qmc_chan *chan, u8 qmc_opcode)