Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3465417rdb; Wed, 13 Sep 2023 12:54:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGUuvcgNKMIZjOaTxLM1aMOgEppHN4f1fCtVfcqoZYTi9xiofhpSRgDSRUeTT1FMjYaa+8o X-Received: by 2002:a05:6a21:33a7:b0:136:faec:a7dc with SMTP id yy39-20020a056a2133a700b00136faeca7dcmr4254063pzb.11.1694634863833; Wed, 13 Sep 2023 12:54:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694634863; cv=none; d=google.com; s=arc-20160816; b=FSf1tSleq9DQEWYkv0SZmayhEvuE/d5BTfe6qkd/wDX25FAD3csz+23k9FEBydG/Jk XVqa497a/2BK9FnGfhI+aZj9NoGgGdSW6umZLsWHKOyJIRVCxv8tnCUgKxMzEFaGTc76 xhw0yLsoiexlS2wcHZvvmjO4UduEpyNT+m6w8XSBdGUDJFrFbKGV9Z10DPS7VcO3j8Dv 6EGr/hOjqZPfMqCR+IgRI6GrtocovuFzx7kJbzPuzO5gqRd31+c2HxY4KF1DPFa3poSv b/CoyVRmOxToJhnvYdOwCDRVmICCbRowNWcirimZupTEZEr0Vd8TgWJOjgZFA7h8INvE EuOQ== 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=qjQmQsbnaiD273GfIaW7dbRNzNm/Y5ffs7in68JAzGQ=; fh=5rCQDomVZxLXb7yR2oN4iSS3zxUnzGJP2HoQaRzhQu0=; b=YtrucXNV/s0tMofGqak63SrAFCnF3fkxN1UMC7RIwIdfR4nTuo3u5D/uxcmsTvWb02 MnTs8u4CH7n4osNWrgjtqtUoZrwP0CSii1ui4WjFkAMT+HgOWrxcTEA+ZcxhHKje1tKC xVI32Co1mITfz4TpoCclMq6gTZi48jgFsgLOscVGmxmNZMZioULZTPXf7jReLCz7vWfx Zv68NJUUBM0qvTpa5XxSdmkbLu+75NL6p7joA3B+82pF7tqSkG0HwIUo32mUK6/uDSpl PUuFVBJT3A1fCnojVAMTrPNtAztwmIW0UroPO8CqvAoCFxjkG3LvnjgSAHoz6YR5VJtP XoRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=A2dg+l9w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id t19-20020a63dd13000000b00563f8e3fca8si5646041pgg.49.2023.09.13.12.54.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 12:54:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=A2dg+l9w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 17BFD815963D; Tue, 12 Sep 2023 03:14:23 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.8 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234195AbjILKOW (ORCPT + 99 others); Tue, 12 Sep 2023 06:14:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234084AbjILKOF (ORCPT ); Tue, 12 Sep 2023 06:14:05 -0400 Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::226]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B20E22133; Tue, 12 Sep 2023 03:13:57 -0700 (PDT) Received: by mail.gandi.net (Postfix) with ESMTPA id B58EDC0005; Tue, 12 Sep 2023 10:13:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1694513636; 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=qjQmQsbnaiD273GfIaW7dbRNzNm/Y5ffs7in68JAzGQ=; b=A2dg+l9wT0VI/LoNMavkRIVq5tTeRuaSHeTfA9HJ53fed7CiE1pHKJKiSnf4lPMh9W9RoM KzgU3x3fgq5vIsQz3Qi4oOLgD0gY6N+oWOqyi2NOd95nWvxr5kGB7+3LGaqAEsgXuu1fDS 8y15RNf8pzh4z+lIWwMI+s+Jizcs7Zr/KCyoY83Cppoz/UHXVUFMcF+22FOABGZ308LOVj 0kpiTilU9J6KoQXZRDJHZkmos8Xs2zT3CppJTE6p9iy2lLUMxJjtJiQmtH2H+fF0qTXyEW LE07Fo6NtUqZSk/LFxrZyElv9tdSf/YuiHzPpiDKZai8UrP0NiI0eAGF7a164w== 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 , Randy Dunlap 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, Simon Horman , Christophe JAILLET , Thomas Petazzoni Subject: [PATCH v5 18/31] soc: fsl: cpm1: qmc: Split Tx and Rx TSA entries setup Date: Tue, 12 Sep 2023 12:13:52 +0200 Message-ID: <20230912101352.225628-1-herve.codina@bootlin.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230912081527.208499-1-herve.codina@bootlin.com> References: <20230912081527.208499-1-herve.codina@bootlin.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-GND-Sasl: herve.codina@bootlin.com Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 12 Sep 2023 03:14:23 -0700 (PDT) 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 Reviewed-by: Christophe Leroy Signed-off-by: Christophe Leroy --- 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 26cd7e1ccafc..eeceb81bf107 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