Received: by 2002:a05:6358:701b:b0:131:369:b2a3 with SMTP id 27csp4251394rwo; Tue, 25 Jul 2023 03:13:47 -0700 (PDT) X-Google-Smtp-Source: APBJJlFZHwqI3Crad1eyePzNzS0GMCU6HPFEDAAIyYcdQYSA5/Q/Ae/43D29uG5motGwzk9C3KNP X-Received: by 2002:a17:907:2c67:b0:99b:4bab:2841 with SMTP id ib7-20020a1709072c6700b0099b4bab2841mr2236112ejc.26.1690280027313; Tue, 25 Jul 2023 03:13:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690280027; cv=none; d=google.com; s=arc-20160816; b=tdj1ZdoWiz8kXbKd10y07CHylHl+se9iEDd3rnNxLKI9LxSmJVen2P+85D/t2dZ6CM lit8LD0pX7BcymD0C73rnSmB2F0tyeF7BWTci5Pd8luCuNSRM+xEyEhaUPJ3GY1FV8rr j8MRF7Ezg0uvSvHJQCYl+GoYbI+FZYMzeXAwL63TkufrwEGRdpz+w2xN38IIkIDxeMP3 +bnZFaZzk9YfBALh11satLeevAIxVLfC+O2XE++gqfbcCIDrPknOyNqkJKQpya4lZnui LdqIMdFiRCz9QZJsWSeeW+fHlKSt5TFBd24jZyNGgmetJCmmy/dtKYsA4opub0P6pMp2 ZisQ== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bg24-20020a170906a05800b00988da9cd05csi8112638ejb.23.2023.07.25.03.13.22; Tue, 25 Jul 2023 03:13:47 -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 S232127AbjGYJ1I (ORCPT + 99 others); Tue, 25 Jul 2023 05:27:08 -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 Content-Transfer-Encoding: 8bit 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 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) -- 2.41.0