From nobody Mon Apr 6 23:17:57 2026 Received: from mail.zeus03.de (zeus03.de [194.117.254.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D2DD73C9421 for ; Tue, 17 Mar 2026 13:06:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=194.117.254.33 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773752814; cv=none; b=bH53WvvGDUTO6373iE3Ivocz3ButFF6FQH7RcA0CEnXZf+JesWYwgctFQrnFAYDK5i1AYG8bd0Fa3PIVmtHq0Qsfq5TO73YHY3xF2H5QQgqEK3voptNo+lm3DFeVkkUA1rcvVZGp9sUlhD4y5h+e/mtQf/42ZzevEdSgGYdH26w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773752814; c=relaxed/simple; bh=koNgmkGi4oFAcsPtky+xnrZgg7RT7H4mBMLj0Q5EbGU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Cc1cZ6mx0HZtNYNhzGiPuPJzLD6mGXRHFM1DOyC+X8yP0C6j9Z6bleotkDQzywNEWBYHEg7Yn3uAc7vbzi6hp5bnNkzG2QUEGzuDSuY038skbF0YMrBbFjHSHBUurBdftgl2HAkE3hykSbiDLdWDPvIQZLEqI8A5jeYbsdHJz5w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com; spf=pass smtp.mailfrom=sang-engineering.com; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b=WLs+1S1I; arc=none smtp.client-ip=194.117.254.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b="WLs+1S1I" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= sang-engineering.com; h=from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; s=k1; bh=Ah+2nLXC2lBaRkQZlxgJFibBRO1HhXx+HwZXFiGcHrY=; b=WLs+1S 1I8UpyTQ2lBRvc5DEaYYynR0x3WUHcCHviUXcPifKmb/D2xb9rFBGBTDUhK4RnrV xRieXo2AUz20j6IwbQJqRGCjq/Nl5oa2TSR9/SOtz9wEk3zFBGqGmZ88cC1EIFTV InUbAl9nZaSGDKTYmjfQbwpTwiDvjqbPz/5Qlk6CxTrhTiyQjtHnwea78IiIT/q2 As9hM4T+6Wgmi2iFOo/pzIhg7Ib7SIjq14Nmggbu4Hq13Qr88Yughy/Gv8WR6ML5 b9LL0xB6qDRRMrQvBJokBAU8AyQOzHH9VhpXw/yZpeOF57XwXMIUYxGe4nGjYHwf Zmh0j6fTDQFjd6Hw== Received: (qmail 287550 invoked from network); 17 Mar 2026 14:06:49 +0100 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 17 Mar 2026 14:06:49 +0100 X-UD-Smtp-Session: l3s3148p1@KYYYAjhN9o8+XdJ7 From: Wolfram Sang To: linux-renesas-soc@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Jassi Brar , Wolfram Sang , Geert Uytterhoeven , Magnus Damm , Rob Herring , Krzysztof Kozlowski , Conor Dooley , devicetree@vger.kernel.org Subject: [PATCH 1/3] dt-bindings: soc: renesas: add MFIS binding documentation Date: Tue, 17 Mar 2026 14:06:34 +0100 Message-ID: <20260317130638.2804-2-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260317130638.2804-1-wsa+renesas@sang-engineering.com> References: <20260317130638.2804-1-wsa+renesas@sang-engineering.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add device tree bindings for the Renesas Multifunctional Interface (MFIS) as found on the Renesas R-Car X5H (r8a78000) SoC. MFIS includes features like Mailbox/HW Spinlock/Product Register. Signed-off-by: Wolfram Sang --- Checked with 'dt_bindings_check'. Family-compatible values are not introduced here because MFIS is usually very different per SoC. .../soc/renesas/renesas,r8a78000-mfis.yaml | 160 ++++++++++++++++++ .../mailbox/renesas,r8a78000-mfis.h | 27 +++ 2 files changed, 187 insertions(+) create mode 100644 Documentation/devicetree/bindings/soc/renesas/renesas,r= 8a78000-mfis.yaml create mode 100644 include/dt-bindings/mailbox/renesas,r8a78000-mfis.h diff --git a/Documentation/devicetree/bindings/soc/renesas/renesas,r8a78000= -mfis.yaml b/Documentation/devicetree/bindings/soc/renesas/renesas,r8a78000= -mfis.yaml new file mode 100644 index 000000000000..dbda28ac781c --- /dev/null +++ b/Documentation/devicetree/bindings/soc/renesas/renesas,r8a78000-mfis.y= aml @@ -0,0 +1,160 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/soc/renesas/renesas,r8a78000-mfis.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Renesas MFIS (Multifunctional Interface) controller + +maintainers: + - Wolfram Sang + +description: + Renesas Multifunctional Interface (MFIS) provides functionality for + communication between different CPU cores. Those cores can be in various + domains like AP, RT, or SCP. Functionality includes features like + mailboxes, hardware spinlocks and such. + +properties: + compatible: + enum: + - renesas,r8a78000-mfis # R-Car X5H (AP<->AP, with PRR) + - renesas,r8a78000-mfis-scp # R-Car X5H (AP<->SCP, without PRR) + + reg: + minItems: 2 + maxItems: 2 + + reg-names: + items: + - const: common + - const: mboxes + + interrupts: + minItems: 32 + maxItems: 128 + description: + The interrupts raised by the remote doorbells. + + interrupt-names: + minItems: 32 + maxItems: 128 + items: + pattern: "^ch[0-9]+[ie]$" + description: + An interrupt name is constructed with the prefix 'ch'. Then, the + channel number as specified in the documentation of the SoC. Finally, + the letter 'i' if the interrupt is raised by the IICR register. Or '= e' + if it is raised by the EICR register. + + "#hwlock-cells": + const: 1 + + "#mbox-cells": + const: 2 + description: + The first cell is the channel number as specified in the documentati= on + of the SoC. The second cell may specify flags as described in the fi= le + . + +required: + - compatible + - reg + - reg-names + - interrupts + - interrupt-names + - "#hwlock-cells" + - "#mbox-cells" + +additionalProperties: false + +examples: + - | + #include + mfis: syscon@189e0000 { + compatible =3D "renesas,r8a78000-mfis"; + reg =3D <0x189e0000 0x1000>, <0x18800000 0x40000>; + reg-names =3D "common", "mboxes"; + interrupts =3D , , + , , + , , + , , + , , + , , + , , + , , + , , + , , + , , + , , + , , + , , + , , + , , + , , + , , + , , + , , + , , + , , + , , + , , + , , + , , + , , + , , + , , + , , + , , + , , + , , + , , + , , + , , + , , + , , + , , + , , + , , + , , + , , + , , + , , + , , + , , + , , + , , + , , + , , + , , + , , + , , + , , + , , + , , + , , + , , + , , + , , + , , + , , + , ; + interrupt-names =3D "ch0i", "ch0e", "ch1i", "ch1e", "ch2i", "c= h2e", "ch3i", "ch3e", + "ch4i", "ch4e", "ch5i", "ch5e", "ch6i", "ch6= e", "ch7i", "ch7e", + "ch8i", "ch8e", "ch9i", "ch9e", "ch10i", "ch= 10e", "ch11i", "ch11e", + "ch12i", "ch12e", "ch13i", "ch13e", "ch14i",= "ch14e", "ch15i", "ch15e", + "ch16i", "ch16e", "ch17i", "ch17e", "ch18i",= "ch18e", "ch19i", "ch19e", + "ch20i", "ch20e", "ch21i", "ch21e", "ch22i",= "ch22e", "ch23i", "ch23e", + "ch24i", "ch24e", "ch25i", "ch25e", "ch26i",= "ch26e", "ch27i", "ch27e", + "ch28i", "ch28e", "ch29i", "ch29e", "ch30i",= "ch30e", "ch31i", "ch31e", + "ch32i", "ch32e", "ch33i", "ch33e", "ch34i",= "ch34e", "ch35i", "ch35e", + "ch36i", "ch36e", "ch37i", "ch37e", "ch38i",= "ch38e", "ch39i", "ch39e", + "ch40i", "ch40e", "ch41i", "ch41e", "ch42i",= "ch42e", "ch43i", "ch43e", + "ch44i", "ch44e", "ch45i", "ch45e", "ch46i",= "ch46e", "ch47i", "ch47e", + "ch48i", "ch48e", "ch49i", "ch49e", "ch50i",= "ch50e", "ch51i", "ch51e", + "ch52i", "ch52e", "ch53i", "ch53e", "ch54i",= "ch54e", "ch55i", "ch55e", + "ch56i", "ch56e", "ch57i", "ch57e", "ch58i",= "ch58e", "ch59i", "ch59e", + "ch60i", "ch60e", "ch61i", "ch61e", "ch62i",= "ch62e", "ch63i", "ch63e"; + #hwlock-cells =3D <1>; + #mbox-cells =3D <2>; + }; diff --git a/include/dt-bindings/mailbox/renesas,r8a78000-mfis.h b/include/= dt-bindings/mailbox/renesas,r8a78000-mfis.h new file mode 100644 index 000000000000..89489c2a4847 --- /dev/null +++ b/include/dt-bindings/mailbox/renesas,r8a78000-mfis.h @@ -0,0 +1,27 @@ +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */ +/* + * Constants for the mailbox part of the Renesas MFIS IP core. + */ + +#ifndef _DT_BINDINGS_MAILBOX_RENESAS_MFIS_H +#define _DT_BINDINGS_MAILBOX_RENESAS_MFIS_H + +/* + * MFIS HW design before r8a78001 requires a channel to be marked as either + * TX or RX. + */ +#define MFIS_CHANNEL_TX (0 << 0) +#define MFIS_CHANNEL_RX (1 << 0) + +/* + * MFIS variants before r8a78001 work with pairs of IICR and EICR register= s. + * Usually, it is specified in the datasheets which of the two a specific = core + * should use. Then, it does not need extra description in DT. For plain M= FIS + * of r8a78000, this is selectable, though. According to the system design= and + * the firmware in use, these channels need to be marked. This is not need= ed + * with other versions of the MFIS, not even with MFIS-SCP of r8a78000. + */ +#define MFIS_CHANNEL_IICR (0 << 1) +#define MFIS_CHANNEL_EICR (1 << 1) + +#endif --=20 2.51.0 From nobody Mon Apr 6 23:17:57 2026 Received: from mail.zeus03.de (zeus03.de [194.117.254.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 48BE43CA485 for ; Tue, 17 Mar 2026 13:06:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=194.117.254.33 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773752819; cv=none; b=spJWF+1HxX2ZW2r1qAjEdr5V+a/WKm9qpLfkoQe7/StTynIHHUvsYS365HMM/xdGdr2jnWIXqktRxWwC033NtlV7+2s/0Nz13WKBUF1tXrLZ1MyCy7rbQ7XfuXnVNpUFNSnHqS9dxKZ1FErQoxHuxxu26aoyj1DqsOnDkDVCtMU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773752819; c=relaxed/simple; bh=gaP2BF6uTIp8tmP1ihOfCRsjwAXcQE4ggeO5pfRtL7A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RH3nOZdbyjC0MhVe+w73FZaRZrK+likeIHgvOog0bDUou/DFWcd1OHr417RChWdxnX9SVRD+jP/XerLRLfXEBNnVytTvJaH2+G6batm3MIu/qPXoMkZD6KLsLN5koSxGsqMdESKrfpT+ENGd8xuEXk2b4dqHmgNsYg2lzCOYcuE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com; spf=pass smtp.mailfrom=sang-engineering.com; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b=LwznLAF/; arc=none smtp.client-ip=194.117.254.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b="LwznLAF/" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= sang-engineering.com; h=from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; s=k1; bh=xdWoHSZWX+22gooZFZs/PDMfqpwJKA5xPignriyUEDI=; b=LwznLA F/Y3JLRER9eIYqG5NLdQBy/Nf9G5ArdE9cqukE25VJ9+4UT85CdwqNhjsnUc/tGH IKX4aIMDqWhG2pS/fAG0uJoq78kH2fW43EkNF1vSRhkoaoMYN1RkjZjkxckFd9ma c16guL9Zdr/5dNnZN/0/c0yIq872Rpmp7BPrOjUT16ZVLl2dcWxaE9eFwTDSiraE GQNiIw4XUwYlPfcx35EWPYZuxSOakTqIra7Ddy93qt5FgqLiLmgS28IcRE/RElmh 021OfbOiT+8pHbUTn6NGmX1hYi/kvS5ciqzgwfNsmeKU4i2K6sDsoKEs9MZ6bdwe cSBGxkd+UL1XWpog== Received: (qmail 287651 invoked from network); 17 Mar 2026 14:06:55 +0100 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 17 Mar 2026 14:06:55 +0100 X-UD-Smtp-Session: l3s3148p1@ZiF6AjhN+I8+XdJ7 From: Wolfram Sang To: linux-renesas-soc@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Jassi Brar , Wolfram Sang , Kuninori Morimoto , Geert Uytterhoeven , Magnus Damm Subject: [PATCH 2/3] soc: renesas: Add Renesas R-Car MFIS driver Date: Tue, 17 Mar 2026 14:06:35 +0100 Message-ID: <20260317130638.2804-3-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260317130638.2804-1-wsa+renesas@sang-engineering.com> References: <20260317130638.2804-1-wsa+renesas@sang-engineering.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Renesas R-Car MFIS offers multiple features but most importantly mailboxes and hwspinlocks. Because they share a common register space and a common register unprotection mechanism, a single driver was chosen to handle all dependencies. (MFD and auxiliary bus have been tried as well, but they failed because of circular dependencies.) In this first step, the driver implements common register access and a mailbox controller. hwspinlock support will be added incrementally, once the subsystem allows out-of-directory drivers. Signed-off-by: Kuninori Morimoto Signed-off-by: Wolfram Sang Acked-by: Jassi Brar Reported-by: Sashiko:Gemini 3.1 Pro Reviewed-by: is generally only applicable once *all* of the issues Suggested-by: is generlly used when someone inspires a particular --- This driver is already prepared for upcoming r8a78001 support which will break away from the IICR/EICR register pair. Actual support will be added later once HW is available. drivers/soc/renesas/Kconfig | 9 + drivers/soc/renesas/Makefile | 1 + drivers/soc/renesas/rcar-mfis.c | 325 ++++++++++++++++++++++++++++++++ 3 files changed, 335 insertions(+) create mode 100644 drivers/soc/renesas/rcar-mfis.c diff --git a/drivers/soc/renesas/Kconfig b/drivers/soc/renesas/Kconfig index 26bed0fdceb0..6c472c951ab3 100644 --- a/drivers/soc/renesas/Kconfig +++ b/drivers/soc/renesas/Kconfig @@ -465,6 +465,15 @@ config ARCH_R9A07G043 =20 endif # RISCV =20 +config RCAR_MFIS + tristate "Renesas R-Car MFIS driver" + depends on ARCH_RENESAS || COMPILE_TEST + depends on MAILBOX + help + Select this option to enable the Renesas R-Car MFIS core driver for + the MFIS device found on SoCs like R-Car. On families like Gen5, this + is needed to communicate with the SCP. + config PWC_RZV2M bool "Renesas RZ/V2M PWC support" if COMPILE_TEST =20 diff --git a/drivers/soc/renesas/Makefile b/drivers/soc/renesas/Makefile index 655dbcb08747..21eb78a05fc0 100644 --- a/drivers/soc/renesas/Makefile +++ b/drivers/soc/renesas/Makefile @@ -13,6 +13,7 @@ obj-$(CONFIG_SYS_R9A09G056) +=3D r9a09g056-sys.o obj-$(CONFIG_SYS_R9A09G057) +=3D r9a09g057-sys.o =20 # Family +obj-$(CONFIG_RCAR_MFIS) +=3D rcar-mfis.o obj-$(CONFIG_PWC_RZV2M) +=3D pwc-rzv2m.o obj-$(CONFIG_RST_RCAR) +=3D rcar-rst.o obj-$(CONFIG_RZN1_IRQMUX) +=3D rzn1_irqmux.o diff --git a/drivers/soc/renesas/rcar-mfis.c b/drivers/soc/renesas/rcar-mfi= s.c new file mode 100644 index 000000000000..5fb9cd352b76 --- /dev/null +++ b/drivers/soc/renesas/rcar-mfis.c @@ -0,0 +1,325 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Renesas R-Car MFIS (Multifunctional Interface) driver + * + * Copyright (C) Renesas Solutions Corp. + * Kuninori Morimoto + * Wolfram Sang + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define MFISWPCNTR 0x0900 +#define MFISWACNTR 0x0904 + +#define MFIS_UNPROTECT_KEY 0xACCE0000 + +struct mfis_priv; + +struct mfis_reg { + void __iomem *base; + resource_size_t start; + struct mfis_priv *priv; +}; + +struct mfis_info { + u32 unprotect_mask; + unsigned int mb_num_channels; + unsigned int mb_reg_comes_from_dt:1; + unsigned int mb_tx_uses_eicr:1; + unsigned int mb_channels_are_unidir:1; +}; + +struct mfis_per_chan_priv { + u32 reg; + int irq; +}; + +struct mfis_priv { + struct device *dev; + struct mfis_reg common_reg; + struct mfis_reg mbox_reg; + const struct mfis_info *info; + + /* mailbox private data */ + struct mbox_controller mbox; + struct mfis_per_chan_priv *per_chan_privs; +}; + +static u32 mfis_read(struct mfis_reg *mreg, unsigned int reg) +{ + return ioread32(mreg->base + reg); +} + +static void mfis_write(struct mfis_reg *mreg, u32 reg, u32 val) +{ + struct mfis_priv *priv =3D mreg->priv; + u32 unprotect_mask =3D priv->info->unprotect_mask; + u32 unprotect_code; + + /* + * [Gen4] key: 0xACCE0000, mask: 0x0000FFFF + * [Gen5] key: 0xACC00000, mask: 0x000FFFFF + */ + unprotect_code =3D (MFIS_UNPROTECT_KEY & ~unprotect_mask) | + ((mreg->start | reg) & unprotect_mask); + + iowrite32(unprotect_code, priv->common_reg.base + MFISWACNTR); + iowrite32(val, mreg->base + reg); +} + +/**************************************************** + * Mailbox + ****************************************************/ + +#define mfis_mb_mbox_to_priv(_m) container_of((_m), struct mfis_priv, mbox) + +static irqreturn_t mfis_mb_iicr_interrupt(int irq, void *data) +{ + struct mbox_chan *chan =3D data; + struct mfis_priv *priv =3D mfis_mb_mbox_to_priv(chan->mbox); + struct mfis_per_chan_priv *per_chan_priv =3D chan->con_priv; + + mbox_chan_received_data(chan, NULL); + /* Stop remote(!) doorbell */ + mfis_write(&priv->mbox_reg, per_chan_priv->reg, 0); + + return IRQ_HANDLED; +} + +static int mfis_mb_startup(struct mbox_chan *chan) +{ + struct mfis_per_chan_priv *per_chan_priv =3D chan->con_priv; + int ret =3D 0; + + if (per_chan_priv->irq) + ret =3D request_irq(per_chan_priv->irq, mfis_mb_iicr_interrupt, 0, + dev_name(chan->mbox->dev), chan); + + return ret; +} + +static void mfis_mb_shutdown(struct mbox_chan *chan) +{ + struct mfis_per_chan_priv *per_chan_priv =3D chan->con_priv; + + free_irq(per_chan_priv->irq, chan); +} + +static int mfis_mb_iicr_send_data(struct mbox_chan *chan, void *data) +{ + struct mfis_priv *priv =3D mfis_mb_mbox_to_priv(chan->mbox); + struct mfis_per_chan_priv *per_chan_priv =3D chan->con_priv; + + /* Our doorbell still active? */ + if (mfis_read(&priv->mbox_reg, per_chan_priv->reg) & 1) + return -EBUSY; + + /* Start our doorbell */ + mfis_write(&priv->mbox_reg, per_chan_priv->reg, 1); + + return 0; +} + +static bool mfis_mb_iicr_last_tx_done(struct mbox_chan *chan) +{ + struct mfis_priv *priv =3D mfis_mb_mbox_to_priv(chan->mbox); + struct mfis_per_chan_priv *per_chan_priv =3D chan->con_priv; + + /* Our doorbell still active? */ + return !(mfis_read(&priv->mbox_reg, per_chan_priv->reg) & 1); +} + +/* For MFIS variants using the IICR/EICR register pair */ +static const struct mbox_chan_ops mfis_iicr_ops =3D { + .startup =3D mfis_mb_startup, + .shutdown =3D mfis_mb_shutdown, + .send_data =3D mfis_mb_iicr_send_data, + .last_tx_done =3D mfis_mb_iicr_last_tx_done, +}; + +static struct mbox_chan *mfis_mb_of_xlate(struct mbox_controller *mbox, + const struct of_phandle_args *sp) +{ + struct mfis_priv *priv =3D mfis_mb_mbox_to_priv(mbox); + struct mfis_per_chan_priv *per_chan_priv; + struct mbox_chan *chan; + u32 chan_num, chan_flags; + bool tx_uses_eicr, is_only_rx; + + if (sp->args_count !=3D 2) + return ERR_PTR(-EINVAL); + + chan_num =3D sp->args[0]; + chan_flags =3D sp->args[1]; + + /* Channel layout is described in mfis_mb_probe() */ + if (priv->info->mb_channels_are_unidir) { + is_only_rx =3D chan_flags & MFIS_CHANNEL_RX; + chan =3D mbox->chans + 2 * chan_num + is_only_rx; + } else { + is_only_rx =3D false; + chan =3D mbox->chans + chan_num; + } + + if (priv->info->mb_reg_comes_from_dt) { + tx_uses_eicr =3D chan_flags & MFIS_CHANNEL_EICR; + if (tx_uses_eicr) + chan +=3D mbox->num_chans / 2; + } else { + tx_uses_eicr =3D priv->info->mb_tx_uses_eicr; + } + + per_chan_priv =3D chan->con_priv; + per_chan_priv->reg =3D chan_num * 0x1000 + (tx_uses_eicr ^ is_only_rx) * = 4; + + if (!priv->info->mb_channels_are_unidir || is_only_rx) { + char irqname[8]; + char suffix =3D tx_uses_eicr ? 'i' : 'e'; + + /* "ch0i" or "ch0e" */ + scnprintf(irqname, sizeof(irqname), "ch%d%c", chan_num, suffix); + + per_chan_priv->irq =3D of_irq_get_byname(mbox->dev->of_node, irqname); + if (per_chan_priv->irq < 0) + return ERR_PTR(per_chan_priv->irq); + else if (per_chan_priv->irq =3D=3D 0) + return ERR_PTR(-ENOENT); + } + + return chan; +} + +static int mfis_mb_probe(struct mfis_priv *priv) +{ + struct device *dev =3D priv->dev; + struct mbox_chan *chan; + struct mbox_controller *mbox; + unsigned int i, num_chan =3D priv->info->mb_num_channels; + + if (priv->info->mb_channels_are_unidir) + /* Channel layout: Ch0-TX, Ch0-RX, Ch1-TX... */ + num_chan *=3D 2; + + if (priv->info->mb_reg_comes_from_dt) + /* Channel layout: IICR channels, EICR channels */ + num_chan *=3D 2; + + chan =3D devm_kcalloc(dev, num_chan, sizeof(*chan), GFP_KERNEL); + if (!chan) + return -ENOMEM; + + priv->per_chan_privs =3D devm_kcalloc(dev, num_chan, sizeof(*priv->per_ch= an_privs), + GFP_KERNEL); + if (!priv->per_chan_privs) + return -ENOMEM; + + mbox =3D &priv->mbox; + + for (i =3D 0; i < num_chan; i++) + chan[i].con_priv =3D &priv->per_chan_privs[i]; + + mbox->chans =3D chan; + mbox->num_chans =3D num_chan; + mbox->txdone_poll =3D true; + mbox->ops =3D &mfis_iicr_ops; + mbox->dev =3D dev; + mbox->of_xlate =3D mfis_mb_of_xlate; + + return mbox_controller_register(mbox); +} + +/**************************************************** + * Common + ****************************************************/ +static int mfis_reg_probe(struct platform_device *pdev, struct mfis_priv *= priv, + struct mfis_reg *mreg, const char *name, bool required) +{ + struct resource *res; + void __iomem *base; + + res =3D platform_get_resource_byname(pdev, IORESOURCE_MEM, name); + + /* If there is no mailbox resource, registers are in the common space */ + if (!res && !required) { + priv->mbox_reg =3D priv->common_reg; + } else { + base =3D devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(base)) + return PTR_ERR(base); + + mreg->base =3D base; + mreg->start =3D res->start; + mreg->priv =3D priv; + } + + return 0; +} + +static int mfis_probe(struct platform_device *pdev) +{ + struct mfis_priv *priv; + struct device *dev =3D &pdev->dev; + int ret; + + priv =3D devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + if (!priv) + return -ENOMEM; + + priv->dev =3D dev; + priv->info =3D of_device_get_match_data(dev); + + ret =3D mfis_reg_probe(pdev, priv, &priv->common_reg, "common", true); + if (ret) + return ret; + + ret =3D mfis_reg_probe(pdev, priv, &priv->mbox_reg, "mboxes", false); + if (ret) + return ret; + + return mfis_mb_probe(priv); +} + +static const struct mfis_info mfis_info_r8a78000 =3D { + .unprotect_mask =3D 0x000fffff, + .mb_num_channels =3D 64, + .mb_reg_comes_from_dt =3D true, + .mb_channels_are_unidir =3D true, +}; + +static const struct mfis_info mfis_info_r8a78000_scp =3D { + .unprotect_mask =3D 0x000fffff, + .mb_num_channels =3D 32, + .mb_tx_uses_eicr =3D true, + .mb_channels_are_unidir =3D true, +}; + +static const struct of_device_id mfis_mfd_of_match[] =3D { + { .compatible =3D "renesas,r8a78000-mfis", .data =3D &mfis_info_r8a78000,= }, + { .compatible =3D "renesas,r8a78000-mfis-scp", .data =3D &mfis_info_r8a78= 000_scp, }, + {} +}; +MODULE_DEVICE_TABLE(of, mfis_mfd_of_match); + +static struct platform_driver mfis_driver =3D { + .driver =3D { + .name =3D "rcar-mfis", + .of_match_table =3D mfis_mfd_of_match, + }, + .probe =3D mfis_probe, +}; +module_platform_driver(mfis_driver); + +MODULE_AUTHOR("Kuninori Morimoto "); +MODULE_AUTHOR("Wolfram Sang "); +MODULE_LICENSE("GPL"); +MODULE_DESCRIPTION("Renesas R-Car MFIS driver"); --=20 2.51.0 From nobody Mon Apr 6 23:17:57 2026 Received: from mail.zeus03.de (zeus03.de [194.117.254.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 730F23CA4BA for ; Tue, 17 Mar 2026 13:06:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=194.117.254.33 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773752820; cv=none; b=C7fSs7xJNbJo77UEqJ9Ew4i6EGe2rSngR+lDbC72hQmNEzBNStoAYLLyD/EinkU+T1rrpybGufC8JwUVdWI/6uwx5PBrmN/a6fXG1UQtIWoDeF6Wfxu4JeaSrgxnVln2ZWKHv1f99A2E3cOUopcpUTB/VBEDskC5aSGbN8+tpVw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773752820; c=relaxed/simple; bh=Z6SEu1iR0OOJVNDnzwLH7jOvHp/9H66QVURaeQ55kqA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=snsptrXESIZOBWM9xBvrajXT+qBzZI56y0oRj8miK792B5A/FlIs4pDaqknhW9mnis2mxrDYy2w7qI5YO5EHdKDtxFwVGPsg52S/zzCKhAfkowM+eYZMEe/3C+kkecF0v8O0pAFDFuD2i1hF2VFsT+of8DrLMVAVr31iShZGXq0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com; spf=pass smtp.mailfrom=sang-engineering.com; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b=OBEMeRuI; arc=none smtp.client-ip=194.117.254.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b="OBEMeRuI" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= sang-engineering.com; h=from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; s=k1; bh=66cafDy73BMhGTMwKqMyviHzFurY54vde5tII7vbsUQ=; b=OBEMeR uIBD3GYHLir+BELJtokKcd6c18qIX7Om/WwRHUjwlfT/N4YGZm9pSiCmVxeND7sU vALxLdvCGGTYJPPrTdC0Sow2P1UlzM/QSHtQ+7aEEa932LBIjA9D0TvZ45C1rkl7 FKfFZp482aYvFzPYcegwD4EbNRKy7X+dXTSjEUYBTEBnFWRoXzOZOENBOntpO0p/ eDVu+xD6iZHhz9Xl0NERuK8/V2hlpLIxOugcEMMeKYPMvQLv+IQ1ftHsfE2X5ciO J+saMkVYLhYXl0rIMJlEvIRMeeguJNgj0JnI7OK+5kLLXdX+tMzFd2iGY8Lqgjya BdOgACsmnlTV3bQA== Received: (qmail 287691 invoked from network); 17 Mar 2026 14:06:56 +0100 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 17 Mar 2026 14:06:56 +0100 X-UD-Smtp-Session: l3s3148p1@5wuKAjhNWrQ+XdJ7 From: Wolfram Sang To: linux-renesas-soc@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Jassi Brar , Wolfram Sang , Geert Uytterhoeven , Magnus Damm Subject: [PATCH 3/3] soc: renesas: add X5H PRR support Date: Tue, 17 Mar 2026 14:06:36 +0100 Message-ID: <20260317130638.2804-4-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260317130638.2804-1-wsa+renesas@sang-engineering.com> References: <20260317130638.2804-1-wsa+renesas@sang-engineering.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" On this SoC, PRR is now inside the MFIS memory block, so we need to access it similar to e.g. RZ/G2L. Suggested-by: Geert Uytterhoeven Signed-off-by: Wolfram Sang Reviewed-by: Geert Uytterhoeven --- drivers/soc/renesas/renesas-soc.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/soc/renesas/renesas-soc.c b/drivers/soc/renesas/renesa= s-soc.c index 38ff0b823bda..60b09020c935 100644 --- a/drivers/soc/renesas/renesas-soc.c +++ b/drivers/soc/renesas/renesas-soc.c @@ -442,8 +442,14 @@ static const struct renesas_id id_prr __initconst =3D { .mask =3D 0xff00, }; =20 +static const struct renesas_id id_mfis __initconst =3D { + .offset =3D 0x44, + .mask =3D 0xff00, +}; + static const struct of_device_id renesas_ids[] __initconst =3D { { .compatible =3D "renesas,bsid", .data =3D &id_bsid }, + { .compatible =3D "renesas,r8a78000-mfis", .data =3D &id_mfis }, { .compatible =3D "renesas,r9a07g043-sysc", .data =3D &id_rzg2l }, { .compatible =3D "renesas,r9a07g044-sysc", .data =3D &id_rzg2l }, { .compatible =3D "renesas,r9a07g054-sysc", .data =3D &id_rzg2l }, @@ -501,7 +507,7 @@ static int __init renesas_soc_init(void) product =3D readl(chipid + id->offset); iounmap(chipid); =20 - if (id =3D=3D &id_prr) { + if (id =3D=3D &id_prr || id =3D=3D &id_mfis) { /* R-Car M3-W ES1.1 incorrectly identifies as ES2.0 */ if ((product & 0x7fff) =3D=3D 0x5210) product ^=3D 0x11; --=20 2.51.0