Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp384435rdb; Mon, 18 Sep 2023 20:00:40 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG0nvoPnw/29qu0pNVeEFaGg4Bt9DLF9CscHqPVeeucZLsz02uiieSBe+O6HB8uegynWPx8 X-Received: by 2002:a17:903:2288:b0:1c5:6691:4978 with SMTP id b8-20020a170903228800b001c566914978mr5135387plh.37.1695092440382; Mon, 18 Sep 2023 20:00:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695092440; cv=none; d=google.com; s=arc-20160816; b=hCWR0YNAZTzBQJhYLq5VX63p/nGqpy6OCDoKzViloLgoXXnH72ItALzhDcLKaBDgrP /e3OcK+/m34DpwSv6auBdox19ZyFpWCpHvcBZ6fV7YfZZDkWURkSlLydxvII8L4ZNivB kTo5tppGkYfOyWUy5I0+MCs6ZsAoUg0auBguTeOJUob0M6PGiIFTM0XMvuBxfYutg2Wa qtlVFYcGVahhlwdph7tAcOCX77KOLfF3ze+4mSCUUKq+Gduq0l96ItUl5eEMIevjgIOQ DWiFd/XSeQPqD4umExNtbUkJ9f0AAw2YwjizoD04iggUBZ9sDdOj8F4StZR0PinpoeTS bqxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=N6Dam8wepJ4zTEsAGl1ifZ/9z5ojdIJio/zwc1lNnsg=; fh=MzHLmwXduTHR2rRFG5/r5+uYSp6Se9Ag9xVDP5C0qsI=; b=NNxvFktZ7fYf2/gP9PpKaGfVGCIOUTmhw3sfYPXTT1QczzQ/TotlX61BOZGaqgMruS ASqlnSECIl1ciL6DbDuPkkGbDSr4e+lp2FVEoLxHRYqDpHDeuJhQCEgZ9DiBAT5Ajak2 pm1YPsXWmUmLbflfEt8otQ/+1vEtjrBHMoHBzjCuMze777WHasYKf/QgUWG/VPVKkITp ibmjETsffhZMlqnezGkC/1JzAjRNfyDssg2ryVAZTu4MAPcz/FBrWBS3mS8iP5WpBON3 inUMZy9y2D6i9aBGnrFLpGiU72nio5tFWkkeKWKR/yElQpHrZCllX716DE4D7OPl9tkz pLiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=QBhis5VT; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id a12-20020a170902eccc00b001b39e50bfdasi9295108plh.638.2023.09.18.20.00.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Sep 2023 20:00:40 -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=@gmail.com header.s=20230601 header.b=QBhis5VT; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id F0DE280C5F9C; Mon, 18 Sep 2023 09:27:42 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230120AbjIRQ1o (ORCPT + 99 others); Mon, 18 Sep 2023 12:27:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229939AbjIRQ10 (ORCPT ); Mon, 18 Sep 2023 12:27:26 -0400 Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F47135B19; Mon, 18 Sep 2023 09:24:34 -0700 (PDT) Received: by mail-ej1-x629.google.com with SMTP id a640c23a62f3a-99bdeae1d0aso587776566b.1; Mon, 18 Sep 2023 09:24:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695054273; x=1695659073; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=N6Dam8wepJ4zTEsAGl1ifZ/9z5ojdIJio/zwc1lNnsg=; b=QBhis5VTJsZ5vBqSOjgTXpuX8AASEM97ZTPldTuau4z0o0sdGKZtz+QhMvjeecCUkn cGa0uv083ZH2doEqjWuuz52Sqp5S1pOWrX621a+pnOZ0G/qyZWj2v/Cq3B8dnWP88N0/ g//+zFmkB2C5IQbxOxkib4pBJxx4PjsyZXqX/kxJgNkHXyzlExm4j9dvIFR6URiv7rUo OO7xNCjVJcu4rv2am9Ww5gdcBAiEj4sU2eE2b7VPg42zQs3OeICwYF29JNu9ZqR5j+jZ OTy34LoE0U7VPJrvQjt+puj1nQTD0vzwq5+lYU2BIBLrPIiV9tzcUCaGp15PJcHnbQa3 /FCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695054273; x=1695659073; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=N6Dam8wepJ4zTEsAGl1ifZ/9z5ojdIJio/zwc1lNnsg=; b=WiBckEhl1iysfXV3mFLEO5aR6j2EcxTYigTHKO3EtiLCVg4ZPYbZv9Klsuj8gl3vW1 HBavRQVGT4IY1JzdGCnFrk9uhTdeLTuuKKFNmzImfKjb4jLmAyQeKoZxX/QI9eiWdzHu yNEwokxVFUUFyuy9X11Xcu5JIX2+3NgiMiZd6fDQIOn8LvWhFsik+L09boP/Ug0oY/DA U2m3wByD2dKx4I0lNKyjnrsqK2SC6Uh9iEo44wzqGp7EKl2CqCmhELYcClR2iPLMBFOF 4bZlzgBwLmnQBxgckqQI7541XlCFfsCqJYtkFxsaSZYTGcUojnRZzN/g3bK6bfChUbh2 Mmew== X-Gm-Message-State: AOJu0YxHEhqZNJn5OR6ht6smMbw3cb7xQ3x78Zm4XzDZDBTi9mxXoFrL Jl+euOQRZWJsytsZZk+AgZP7s6dnIGWL+eSBoY3vrA3CmwE= X-Received: by 2002:a05:6402:48f:b0:52e:9eff:1e5f with SMTP id k15-20020a056402048f00b0052e9eff1e5fmr6842083edv.15.1695048020209; Mon, 18 Sep 2023 07:40:20 -0700 (PDT) MIME-Version: 1.0 References: <20230917-imx95-mbox-v1-0-440245287356@nxp.com> <20230917-imx95-mbox-v1-2-440245287356@nxp.com> In-Reply-To: From: Daniel Baluta Date: Mon, 18 Sep 2023 17:40:08 +0300 Message-ID: Subject: Re: [PATCH 2/2] mailbox: imx: support channel type tx doorbell v2 To: Peng Fan Cc: "Peng Fan (OSS)" , Jassi Brar , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , dl-linux-imx , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Aisheng Dong , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "devicetree@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 18 Sep 2023 09:27:43 -0700 (PDT) On Mon, Sep 18, 2023 at 3:01=E2=80=AFPM Peng Fan wrote: > > Hi Daniel, > > > Subject: Re: [PATCH 2/2] mailbox: imx: support channel type tx doorbell= v2 > > > > On Sun, Sep 17, 2023 at 5:45=E2=80=AFPM Peng Fan (OSS) > > wrote: > > > > > > From: Peng Fan > > > > > > The Message Unit(MU) General Purpose Control registers are used for T= X > > > doorbell, but there is no hardware ACK support. > > > > > > The current TX doorbell channel is using tasklet to emulate hardware > > > ACK support to kick the TX tick from controller driver side. > > > > > > The new added TX doorbell channel V2 not using tasklet to emulate the > > > hardware ACK support. The behavior for the channel is just writing th= e > > > GCR register, and no else. This will be used for SCMI mailbox. > > > > > > Signed-off-by: Peng Fan > > > --- > > > drivers/mailbox/imx-mailbox.c | 32 +++++++++++++++++++++++++++++--- > > > 1 file changed, 29 insertions(+), 3 deletions(-) > > > > > > diff --git a/drivers/mailbox/imx-mailbox.c > > > b/drivers/mailbox/imx-mailbox.c index 3ef4dd8adf5d..0af739ab571c > > > 100644 > > > --- a/drivers/mailbox/imx-mailbox.c > > > +++ b/drivers/mailbox/imx-mailbox.c > > > @@ -20,7 +20,9 @@ > > > #include > > > #include > > > > > > -#define IMX_MU_CHANS 17 > > > +#include "mailbox.h" > > > + > > > +#define IMX_MU_CHANS 24 > > > /* TX0/RX0/RXDB[0-3] */ > > > #define IMX_MU_SCU_CHANS 6 > > > /* TX0/RX0 */ > > > @@ -39,6 +41,7 @@ enum imx_mu_chan_type { > > > IMX_MU_TYPE_TXDB =3D 2, /* Tx doorbell */ > > > IMX_MU_TYPE_RXDB =3D 3, /* Rx doorbell */ > > > IMX_MU_TYPE_RST =3D 4, /* Reset */ > > > + IMX_MU_TYPE_TXDB_V2 =3D 5, /* Tx doorbell with S/W ACK */ > > > }; > > > > > > enum imx_mu_xcr { > > > @@ -226,6 +229,9 @@ static int imx_mu_generic_tx(struct imx_mu_priv > > *priv, > > > imx_mu_xcr_rmw(priv, IMX_MU_GCR, IMX_MU_xCR_GIRn(priv= - > > >dcfg->type, cp->idx), 0); > > > tasklet_schedule(&cp->txdb_tasklet); > > > break; > > > + case IMX_MU_TYPE_TXDB_V2: > > > + imx_mu_xcr_rmw(priv, IMX_MU_GCR, IMX_MU_xCR_GIRn(priv= - > > >dcfg->type, cp->idx), 0); > > > + break; > > > default: > > > dev_warn_ratelimited(priv->dev, "Send data on wrong c= hannel > > type: %d\n", cp->type); > > > return -EINVAL; > > > @@ -554,6 +560,9 @@ static int imx_mu_startup(struct mbox_chan *chan) > > > int ret; > > > > > > pm_runtime_get_sync(priv->dev); > > > + if (cp->type =3D=3D IMX_MU_TYPE_TXDB_V2) > > > + return 0; > > > + > > > if (cp->type =3D=3D IMX_MU_TYPE_TXDB) { > > > /* Tx doorbell don't have ACK support */ > > > tasklet_init(&cp->txdb_tasklet, imx_mu_txdb_tasklet, > > > @@ -595,6 +604,11 @@ static void imx_mu_shutdown(struct mbox_chan > > *chan) > > > int ret; > > > u32 sr; > > > > > > + if (cp->type =3D=3D IMX_MU_TYPE_TXDB_V2) { > > > + pm_runtime_put_sync(priv->dev); > > > + return; > > > + } > > > + > > > if (cp->type =3D=3D IMX_MU_TYPE_TXDB) { > > > tasklet_kill(&cp->txdb_tasklet); > > > pm_runtime_put_sync(priv->dev); @@ -671,6 +685,7 @@ > > > static struct mbox_chan *imx_mu_specific_xlate(struct mbox_controller > > > *mbox, static struct mbox_chan * imx_mu_xlate(struct mbox_controller > > *mbox, > > > const struct of_phandle_args > > > *sp) { > > > + struct mbox_chan *p_chan; > > > u32 type, idx, chan; > > > > > > if (sp->args_count !=3D 2) { > > > @@ -680,14 +695,25 @@ static struct mbox_chan * imx_mu_xlate(struct > > > mbox_controller *mbox, > > > > > > type =3D sp->args[0]; /* channel type */ > > > idx =3D sp->args[1]; /* index */ > > > - chan =3D type * 4 + idx; > > > > > > + /* RST only supports 1 channel */ > > > + if ((type =3D=3D IMX_MU_TYPE_RST) && idx) { > > > + dev_err(mbox->dev, "Invalid RST channel %d\n", idx); > > > + return ERR_PTR(-EINVAL); > > > + } > > > > I don't understand how is this related to introduction of a new doorbel= l > > channel. Can you please add it in a separate patch with proper explanat= ion? > > RST only supports 1 channel, but its value is 4, so here I extend to 4 ch= annel > for RST in code, to make the calculation a bit easier to get TXDB_V2 chan= nel > pointer. But from user side, nothing changed > > IMX_MU_TYPE_RST =3D 4, /* Reset */ > IMX_MU_TYPE_TXDB_V2 =3D 5, /* Tx doorbell with S/W ACK */ > > It does not make much sense to separate this change, because this change > Would only make sense together with TXDB_V2 changes. Ok, I see. Good for me, then.