Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp195481rdb; Mon, 18 Sep 2023 12:05:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG3HgaC1wn1lzO6Ys8RuID0/2a76UEi09KYbA3+b/Xk4Rx5ZeJQEZ2Dr6japxory+bCKLe1 X-Received: by 2002:a05:6a20:12c4:b0:14b:f86f:d9c3 with SMTP id v4-20020a056a2012c400b0014bf86fd9c3mr10264302pzg.61.1695063924764; Mon, 18 Sep 2023 12:05:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695063924; cv=none; d=google.com; s=arc-20160816; b=awRhbjOuivalY/D4GrYTMf7uO8cJhrqTuxhiq/0KBYHF1WTfy1+5Mwmg8sjwHTtRSk jVCdC+2kPiUuA3vSc+MD82pdrHthdn3MofgkxSG/bDtbE6GyIlzzH3XFbNvwpmWaCH6f 8BaIvefaspPM9SK5w9HArnGdgyD2c6AXiHYpOiggGnnhopBBl+X45La0vPxL8/841Dcl K79ad7LdYqaS/jN8+5O0R9a7Q6HxPy2+Ok6uglxFILKKYRSVKkqGgNjYeMSTW+B/BTTi GA3ioYmlRPustMP5YDkzg8GiL1/VlacFj3RgWnIB0n6lVf515j9pAJ4PLYSTBSNGoMgo Kw0w== 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=FfyGp6Kddb3DCMaY63FRlBCmjrpoU/tnkcgquAmU9Do=; fh=/d3R8lXxHdVLFPhpCZdcWsEx2NplWBQZuX9p1nS5xIs=; b=Yv1hUJTYQo45Prp8x7pV+9qWAa6tnJGqlajqbEZ04j6nFvZx6OInagWIDsJSLRgKn0 NIGetg0pQBuYJBM+zIl7HpEjJAwCw/k17XBjmgXDcqL1cSV1j8LhClGoBEkwsgPwXbzd u534V2xbcMa2l+hm6HnIi3kef4vTKiUsyXEOUpWJRmnIGIJB5l7WvdJHOLC1BGV36jt6 u+P8s+/dxVQK4cOhnno6cJMYuzsidAup2b/RbGTmCdGNe5FoWEiu9g0lvFy3NpY/85Zt 0a0PRM1K9Ejudaoz3gRQsrJbujO3O9+tG00r6oED3uA5rI9rLWIsodz7N+k1Usl08HLb KHxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ZXnT8j1d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id 84-20020a630257000000b00578a2dbbcd2si585502pgc.215.2023.09.18.12.05.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Sep 2023 12:05:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ZXnT8j1d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (Postfix) with ESMTP id 4642780AFEB4; Mon, 18 Sep 2023 03:38:53 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236400AbjIRKiT (ORCPT + 99 others); Mon, 18 Sep 2023 06:38:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241169AbjIRKhw (ORCPT ); Mon, 18 Sep 2023 06:37:52 -0400 Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A98ECD2; Mon, 18 Sep 2023 03:36:43 -0700 (PDT) Received: by mail-ed1-x52a.google.com with SMTP id 4fb4d7f45d1cf-530e180ffcbso1625481a12.1; Mon, 18 Sep 2023 03:36:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695033401; x=1695638201; 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=FfyGp6Kddb3DCMaY63FRlBCmjrpoU/tnkcgquAmU9Do=; b=ZXnT8j1dk5JU5/+YhhTP6gVtk1YpDFU4WcoXiqumFRPGfzUv58Uvpj4wvK6oX23afh cLthyQW9JRusRgCI5V5s5uZLQM7mK/O8edonQblEAokZ7VOvYWd9k1o5Hoiz24E0v9eo KR2g8IabHp33s1GLVGGC7WCi2I2n1YPgUgmq4Q8AzGk2Y7giEz0wIKlm9DdZtBmYydVN xsA87wmmLjWAwzUctxXM75scm6U12u1nolUAre6C244I9Brx0UwMkXglYdzds/I+j9DN JltHFWTWwyCva0JXm2zcv8cb0/7SRVSxMoCnTu7+E692QpqqJTaSzSo/DGm4Drfyf16G vtWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695033401; x=1695638201; 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=FfyGp6Kddb3DCMaY63FRlBCmjrpoU/tnkcgquAmU9Do=; b=twpIlaTGSTm4zEbE22Tua5uqXjYBseR++4QrB1nnQXZLvnwQuNdao4eavEoG9NQEyM YWCHLzwu7/5sgIl8DsRWglx0XyMdtU4vwPXU2S6/ClxwuzHXdhsqCi9WLeWnB3m+3+Ps DONG11wOhtccsXwzW3LY49I1mZVzCOiO+7cIi9T988qUJUHg3ccjstT5OvnQ/YFVBrM8 HqGsInH4Aj7Fu5fbu64+F+RwJjloK4CsakhUXUobT6w+FJNf81tiVb+N17s87rODOtmI AYVtMWwDlCKHI/B3EMF9zKIoBY/uQwgkXv2PDNvFBFN0Jy4fS9uzMZreyPNRHLb8gwOr VXQA== X-Gm-Message-State: AOJu0Yymlb/j71ZIOQwXxluyctYJyGBGgoN+1HqGVsxbgqf8Iezo0whe +cEprNAtK+l4F908tFWkQ5a6i4zzFSdEeMu5/UGZleXRqZE= X-Received: by 2002:aa7:d1c5:0:b0:52c:9f89:4445 with SMTP id g5-20020aa7d1c5000000b0052c9f894445mr6203415edp.21.1695033401103; Mon, 18 Sep 2023 03:36:41 -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: <20230917-imx95-mbox-v1-2-440245287356@nxp.com> From: Daniel Baluta Date: Mon, 18 Sep 2023 13:36:25 +0300 Message-ID: Subject: Re: [PATCH 2/2] mailbox: imx: support channel type tx doorbell v2 To: "Peng Fan (OSS)" Cc: Jassi Brar , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Dong Aisheng , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, Peng Fan Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email 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 (morse.vger.email [0.0.0.0]); Mon, 18 Sep 2023 03:38:53 -0700 (PDT) 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 > TX 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 the > 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->dc= fg->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->dc= fg->type, cp->idx), 0); > + break; > default: > dev_warn_ratelimited(priv->dev, "Send data on wrong chann= el 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 doorbell channel. Can you please add it in a separate patch with proper explanation? > + > + chan =3D type * 4 + idx; > if (chan >=3D mbox->num_chans) { > dev_err(mbox->dev, "Not supported channel number: %d. (ty= pe: %d, idx: %d)\n", chan, type, idx); > return ERR_PTR(-EINVAL); > } > > - return &mbox->chans[chan]; > + p_chan =3D &mbox->chans[chan]; > + > + if (type =3D=3D IMX_MU_TYPE_TXDB_V2) > + p_chan->txdone_method =3D TXDONE_BY_ACK; > + > + return p_chan; > } > > static struct mbox_chan *imx_mu_seco_xlate(struct mbox_controller *mbox, > > -- > 2.37.1 >