From nobody Sun Nov 24 11:51:59 2024 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) (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 767BD1E906B; Tue, 5 Nov 2024 18:36:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.153.233 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730831808; cv=none; b=hSbfhG2BbptyEne9gfXoOax9xuGTVo2y5FFXC5y1eyV+1DFwgzhOpLI2Lsqs9dYjH8O//XPeo8sjn8Wu0RF6cHh0bXqQ9InUgMn62FeTLdreinzz50KQmE7iDc876aEo1QkaLWVjqhTgmLy5AXwtNinS0cvxaRnNpQnSbVfSYwM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730831808; c=relaxed/simple; bh=xWSs+CCHo2cnkHp+YQIYQ9pyFy661acsmyXS6RC2uDQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=brl/p5ZQ12Glk17WlYoA/uEjyGMQUUXVSEHkV8WjmVr7Ilmpnw2hUAZ4wd3S/HubIAYl+gMuSUKgY7D5CAdAK+xtxblg9C+b1toNatgDmpmZAFaq3dqQLOezlyKXkYSrLqTJyYRGRuyLXgnPqUHq/9qnzFoRcLTcQ2Pf2UThyeo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=1tEkNUuH; arc=none smtp.client-ip=68.232.153.233 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="1tEkNUuH" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1730831808; x=1762367808; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=xWSs+CCHo2cnkHp+YQIYQ9pyFy661acsmyXS6RC2uDQ=; b=1tEkNUuHRk7AUnaqYVaMsetONqN4A6xtUj9pXHAv5eRivupRqTEZo9cl lL7Pf3RGtVoq0dSbQmyTKctbkn2J3sljImJYp3fyt+wq2hZC4SLyAEmKb masjKwRzBQdSu4IRMdmeF62Z0gIoFLz80boSZzFUg5Ct0BIeErdabNum8 pyynycXHC7VoPd4BSst+BxoggMkh5dFp8pGIb0DjQqW0Ng7y/eAnljIyJ uzm6Tkdf3yVZCnL1sCm4jXM3beZa+uHJ5wDMTZrZlknFVblu2Q78a2zDP vyBb9FfjphtJwRKd53QdtPHamVA+9yjKxndaP8jgwel2zUBt1pSeL+R7z g==; X-CSE-ConnectionGUID: aPvpj/ErQpCvLHGNHY35EA== X-CSE-MsgGUID: jnImxPs2QIOtuWapEmEzbw== X-IronPort-AV: E=Sophos;i="6.11,260,1725346800"; d="scan'208";a="33910624" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa3.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 05 Nov 2024 11:36:46 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Tue, 5 Nov 2024 11:36:18 -0700 Received: from valentina.microchip.com (10.10.85.11) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.35 via Frontend Transport; Tue, 5 Nov 2024 11:36:15 -0700 From: Valentina Fernandez To: , , , , , , , , , , , , , , , CC: , , Subject: [PATCH v3 1/4] riscv: sbi: vendorid_list: Add Microchip Technology to the vendor list Date: Tue, 5 Nov 2024 18:35:10 +0000 Message-ID: <20241105183513.1358736-2-valentina.fernandezalanis@microchip.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241105183513.1358736-1-valentina.fernandezalanis@microchip.com> References: <20241105183513.1358736-1-valentina.fernandezalanis@microchip.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 Microchip Technology to the RISC-V vendor list. Signed-off-by: Valentina Fernandez --- arch/riscv/include/asm/vendorid_list.h | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/riscv/include/asm/vendorid_list.h b/arch/riscv/include/as= m/vendorid_list.h index 2f2bb0c84f9a..a5150cdf34d8 100644 --- a/arch/riscv/include/asm/vendorid_list.h +++ b/arch/riscv/include/asm/vendorid_list.h @@ -6,6 +6,7 @@ #define ASM_VENDOR_LIST_H =20 #define ANDES_VENDOR_ID 0x31e +#define MICROCHIP_VENDOR_ID 0x029 #define SIFIVE_VENDOR_ID 0x489 #define THEAD_VENDOR_ID 0x5b7 =20 --=20 2.34.1 From nobody Sun Nov 24 11:51:59 2024 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) (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 828CA188703; Tue, 5 Nov 2024 18:36:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.153.233 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730831793; cv=none; b=S9jD1FK8RmjyUpkpGqzb2L3bhcTntjNJYeIf5idJKVx18zMPJElUD0APT9qP7CK6G0iKiVMtSXwwW1KdFT9QfTX1jjuKmxOcNyNgopMvsdc15yxufORbjOkSOJaWg74HbYrsDhQPhGDtT63EpX2g+un7rsaVlQKNqm/vnRxwzkk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730831793; c=relaxed/simple; bh=z6u/32qG+4VOxWxyQMcxtikghEw3g/GuPpIgKl24hiQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=JsL5tWHQK2YyFvdPuLFTMeBRQNqp+OpiXhpW5qUbfF1U5iw5OC+p3iczzFz+rsXzFYaL2OjwWJbvLH+Q2bQxZ+yAbSIyz92FlsrTZwggFbKp19wqNl8tCfZ6yJA5w7LE15OUiF+CRkMzuGUdr19J73SXCgw9OGSSAyRacx4YUJE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=r/eT5FBO; arc=none smtp.client-ip=68.232.153.233 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="r/eT5FBO" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1730831791; x=1762367791; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=z6u/32qG+4VOxWxyQMcxtikghEw3g/GuPpIgKl24hiQ=; b=r/eT5FBOHkYUYHYeYZ31tPDD456wYKoBHaITgKk6MgSrbkI8K/4FbuEm NvC9gwdQj7/7dXBwHBEQBW8kR6WkT0+zAlaIdZuG2BlPKRnZTO0KVU40v x8VZOfX2xWNzzhiXskRGJK4lOfC7+5pOLVlJjIvrdt7C+NuxuR5o2OBeA T888/yMe78uuRnaGqY/1hcrKBk7VWaqFXyNr25rafnfikzXsO+4utRwgq tHCQ04gbLCFGSlXW56xlPeoN7G066Hr+eZCWAQd4J82FSgrBYpgbYw4hU 6RM/+VRvx6cK4UsYjD8AFkuN6HtGEST2dTpV4tXywXGoLoRXHohMVuKr/ A==; X-CSE-ConnectionGUID: T1uVhdVNQzWREZUebUBC5w== X-CSE-MsgGUID: KUCIu0viQTCzfI5QziG2lQ== X-IronPort-AV: E=Sophos;i="6.11,260,1725346800"; d="scan'208";a="37385616" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa1.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 05 Nov 2024 11:36:24 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Tue, 5 Nov 2024 11:36:21 -0700 Received: from valentina.microchip.com (10.10.85.11) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.35 via Frontend Transport; Tue, 5 Nov 2024 11:36:18 -0700 From: Valentina Fernandez To: , , , , , , , , , , , , , , , CC: , , Subject: [PATCH v3 2/4] riscv: export __cpuid_to_hartid_map Date: Tue, 5 Nov 2024 18:35:11 +0000 Message-ID: <20241105183513.1358736-3-valentina.fernandezalanis@microchip.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241105183513.1358736-1-valentina.fernandezalanis@microchip.com> References: <20241105183513.1358736-1-valentina.fernandezalanis@microchip.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" EXPORT_SYMBOL_GPL() is missing for __cpuid_to_hartid_map array. Export this symbol to allow drivers compiled as modules to use cpuid_to_hartid_map(). Signed-off-by: Valentina Fernandez --- arch/riscv/kernel/smp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/riscv/kernel/smp.c b/arch/riscv/kernel/smp.c index c180a647a30e..d58b5e751286 100644 --- a/arch/riscv/kernel/smp.c +++ b/arch/riscv/kernel/smp.c @@ -43,6 +43,7 @@ enum ipi_message_type { unsigned long __cpuid_to_hartid_map[NR_CPUS] __ro_after_init =3D { [0 ... NR_CPUS-1] =3D INVALID_HARTID }; +EXPORT_SYMBOL_GPL(__cpuid_to_hartid_map); =20 void __init smp_setup_processor_id(void) { --=20 2.34.1 From nobody Sun Nov 24 11:51:59 2024 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) (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 994D11E8825; Tue, 5 Nov 2024 18:36:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.153.233 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730831795; cv=none; b=Ox95XbG3g5xPq9PMluCpoHCex1yiOCZDyVc+6JifF+uyVlah/lq7UlG3Pj8+fquh1Z0mI9qBJxyt1HEY4gu+WbHZvcodAj90QxEQyv7oJrO3TOUUs978lEWdjw4KvVOGv2nqhWzqRsR+u1+8/Ihnlzw8cBnDu6bdsIDxEAQn3DA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730831795; c=relaxed/simple; bh=o3lz7dS/0X/IsotdugNCOPCUgilgkWwAiXObrss6PhM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=t1MbnnvKh0ef7XHrR1E7+m1rWrG7XRtYMULWWrTZD0KpGyssadMPbhv5U9iygue3vxPNYaXzQLQ8Hm3rivREag06Bat/xJ6tQoWWGz3zeG+qvZSnVaCGnLAEddmhLKTy54WS3PGbtxe/MiMP38LaBU6L1oHLeKuLbwAw02VjNBI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=l20hPCFh; arc=none smtp.client-ip=68.232.153.233 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="l20hPCFh" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1730831793; x=1762367793; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=o3lz7dS/0X/IsotdugNCOPCUgilgkWwAiXObrss6PhM=; b=l20hPCFhR5e42DbKWvawnmVCd8G+OsL/AJ9hIV53i0MoNJaRyx+oc1CN 4zZ21PtaE7GO0AJKyJ1bPjK1IGS75n6CaCmzVGNRg4dAympe2IxsECWrL lsrdDDDtWOWYPXFDKxOkMf2h7vc8rwuOUnfoGmIxv9nvAEBYudax1621e 35Hp5ZJu6UJ1wG1gBm76jY96PrjHHroElAJf19BK8KBYxd0RJhy+WT/o1 j4bNyHgBsGtIYLvubiCZhfPY/byAy/e1MCH9QcFJYvUUWwm0EUgDc+IDj 2hfMPsXFhBdbKzRa0yuN7lucVt296FWCfeebzSZiWVna9V5ZG+kYQNv74 w==; X-CSE-ConnectionGUID: T1uVhdVNQzWREZUebUBC5w== X-CSE-MsgGUID: jf9X/ks1T1CHW9+cqU6PUA== X-IronPort-AV: E=Sophos;i="6.11,260,1725346800"; d="scan'208";a="37385617" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa1.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 05 Nov 2024 11:36:25 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Tue, 5 Nov 2024 11:36:24 -0700 Received: from valentina.microchip.com (10.10.85.11) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.35 via Frontend Transport; Tue, 5 Nov 2024 11:36:21 -0700 From: Valentina Fernandez To: , , , , , , , , , , , , , , , CC: , , Subject: [PATCH v3 3/4] dt-bindings: mailbox: add binding for Microchip IPC mailbox controller Date: Tue, 5 Nov 2024 18:35:12 +0000 Message-ID: <20241105183513.1358736-4-valentina.fernandezalanis@microchip.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241105183513.1358736-1-valentina.fernandezalanis@microchip.com> References: <20241105183513.1358736-1-valentina.fernandezalanis@microchip.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Add a dt-binding for the Microchip Inter-Processor Communication (IPC) mailbox controller. Signed-off-by: Valentina Fernandez --- .../bindings/mailbox/microchip,sbi-ipc.yaml | 117 ++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 Documentation/devicetree/bindings/mailbox/microchip,sbi= -ipc.yaml diff --git a/Documentation/devicetree/bindings/mailbox/microchip,sbi-ipc.ya= ml b/Documentation/devicetree/bindings/mailbox/microchip,sbi-ipc.yaml new file mode 100644 index 000000000000..9e67c09e4bea --- /dev/null +++ b/Documentation/devicetree/bindings/mailbox/microchip,sbi-ipc.yaml @@ -0,0 +1,117 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mailbox/microchip,sbi-ipc.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Microchip Inter-processor communication (IPC) mailbox controller + +maintainers: + - Valentina Fernandez + +description: + The Microchip Inter-processor Communication (IPC) facilitates + message passing between processors using an interrupt signaling + mechanism. + +properties: + compatible: + oneOf: + - description: + Intended for use by software running in supervisor privileged + mode (s-mode). This SBI interface is compatible with the Mi-V + Inter-hart Communication (IHC) IP. + items: + - const: microchip,sbi-ipc + + - description: + SoC-specific compatible, intended for use by the SBI + implementation in machine mode (m-mode). + items: + - const: microchip,miv-ihc-rtl-v2 + + reg: + maxItems: 1 + + interrupts: + minItems: 1 + maxItems: 5 + + interrupt-names: + minItems: 1 + maxItems: 5 + items: + pattern: "^hart-[0-5]+$" + + "#mbox-cells": + description: > + For the SBI "device", the cell represents the global "logical" chann= el IDs. + The meaning of channel IDs are platform firmware dependent. + + For the SoC-specific compatible string, the cell represents the phys= ical + channel and does not vary based on the platform firmware. + const: 1 + + microchip,ihc-chan-disabled-mask: + description: > + Represents the enable/disable state of the bi-directional IHC + channels within the MIV-IHC IP configuration. + + The mask is a 16-bit value, but only the first 15 bits are utilized. + Each of the bits corresponds to one of the 15 IHC channels. + + A bit set to '1' indicates that the corresponding channel is disable= d, + and any read or write operations to that channel will return zero. + + A bit set to '0' indicates that the corresponding channel is enabled + and will be accessible through its dedicated address range registers. + + The remaining bit of the 16-bit mask is reserved and should be ignor= ed. + + The actual enable/disable state of each channel is determined by the + IP block=E2=80=99s configuration. + $ref: /schemas/types.yaml#/definitions/uint16 + default: 0 + +required: + - compatible + - interrupts + - interrupt-names + - "#mbox-cells" + +additionalProperties: false + +allOf: + - if: + properties: + compatible: + contains: + const: microchip,sbi-ipc + then: + properties: + reg: false + microchip,ihc-chan-disabled-mask: false + else: + required: + - reg + - microchip,ihc-chan-disabled-mask + +examples: + - | + mailbox { + compatible =3D "microchip,sbi-ipc"; + interrupt-parent =3D <&plic>; + interrupts =3D <180>, <179>, <178>; + interrupt-names =3D "hart-1", "hart-2", "hart-3"; + #mbox-cells =3D <1>; + }; + - | + mailbox@50000000 { + compatible =3D "microchip,miv-ihc-rtl-v2"; + microchip,ihc-chan-disabled-mask =3D /bits/ 16 <0>; + reg =3D <0x50000000 0x1C000>; + interrupt-parent =3D <&plic>; + interrupts =3D <180>, <179>, <178>; + interrupt-names =3D "hart-1", "hart-2", "hart-3"; + #mbox-cells =3D <1>; + }; --=20 2.34.1 From nobody Sun Nov 24 11:51:59 2024 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) (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 BE6AE1EABB3; Tue, 5 Nov 2024 18:36:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.154.123 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730831811; cv=none; b=Krx9S7wQQn88AKgPjbAYUySVE4kVclraQJjoA/JyMUEgAlI1ctoAR+ZakAJ2ltYB/tiXeotZt1DfaPwwGXhyiTxR8AR99OVSe7ahF6HRhLAVqdViNUPOYQF8/QVf2INpUdRE+eTgNgy2/3Bmupb1Y0GSzFvydx2DjtKjw9BCUG0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730831811; c=relaxed/simple; bh=FLHDeq++xVhEQkkKYRwo9y7U4znMMKvDJ8Y4iIAqeuc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ahFuDTSaw6vdqq2xnfor6O3gn1uRKl0QLAaL9OVVE7f4ToRe1WyS8IP3o4rvvvlyTvCqUOJOi+dkCZ7v69TX7h3sW5061gYyu4KvM0Jr2t/SUzW3uhxADDv3py5iNiy7WK3bJSNdV33efXdHFvkmE/8CRoOtjvKvurjmnorO11E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=V6BqHTLm; arc=none smtp.client-ip=68.232.154.123 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="V6BqHTLm" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1730831810; x=1762367810; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=FLHDeq++xVhEQkkKYRwo9y7U4znMMKvDJ8Y4iIAqeuc=; b=V6BqHTLm4yEOD66I8ApJ8637Mpis+5cy1p9i6vfPSBYkG6H6NRy4lLLQ NQKUrx1IWokR+sQaLueA+HsWYYqLh6tlDnuHX16hyITJrOKs0gjAjNFgP Mwqg/V1V7bjSjah+7670hi1Qxn8Fc5nSjv12xSdCvJuRcOPp6WX5mUbY5 YqzRoXy8v7vEEARIEt08HmaCFHGH3UBfo80V0WxaUuqMDd+xcdieFTXN2 9iD5bZa7lonVqHA2V4WoQNZ8tpimIIP8MTx9HKieoTAU7/gphKgCuz5in wmixPCaYz4KjUjkH40T+Dxvcy2U+GOsGCfzUb5KoyYN/+Bb3EPdMoLQIn Q==; X-CSE-ConnectionGUID: Vlo3vhUxSC2d+IFPBbkdmg== X-CSE-MsgGUID: 0EZXqWKdSIKOxdpRPtnpVA== X-IronPort-AV: E=Sophos;i="6.11,260,1725346800"; d="scan'208";a="34426480" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa2.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 05 Nov 2024 11:36:48 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Tue, 5 Nov 2024 11:36:28 -0700 Received: from valentina.microchip.com (10.10.85.11) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.35 via Frontend Transport; Tue, 5 Nov 2024 11:36:25 -0700 From: Valentina Fernandez To: , , , , , , , , , , , , , , , CC: , , Subject: [PATCH v3 4/4] mailbox: add Microchip IPC support Date: Tue, 5 Nov 2024 18:35:13 +0000 Message-ID: <20241105183513.1358736-5-valentina.fernandezalanis@microchip.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241105183513.1358736-1-valentina.fernandezalanis@microchip.com> References: <20241105183513.1358736-1-valentina.fernandezalanis@microchip.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 a mailbox controller driver for the Microchip Inter-processor Communication (IPC), which is used to send and receive data between processors. The driver uses the RISC-V Supervisor Binary Interface (SBI) to communicate with software running in machine mode (M-mode) to access the IPC hardware block. Additional details on the Microchip vendor extension and the IPC function IDs described in the driver can be found in the following documentation: https://github.com/linux4microchip/microchip-sbi-ecall-extension This SBI interface in this driver is compatible with the Mi-V Inter-hart Communication (IHC) IP. Transmitting and receiving data through the mailbox framework is done through struct mchp_ipc_msg. Signed-off-by: Valentina Fernandez --- drivers/mailbox/Kconfig | 13 + drivers/mailbox/Makefile | 2 + drivers/mailbox/mailbox-mchp-ipc-sbi.c | 504 +++++++++++++++++++++++++ include/linux/mailbox/mchp-ipc.h | 33 ++ 4 files changed, 552 insertions(+) create mode 100644 drivers/mailbox/mailbox-mchp-ipc-sbi.c create mode 100644 include/linux/mailbox/mchp-ipc.h diff --git a/drivers/mailbox/Kconfig b/drivers/mailbox/Kconfig index 6fb995778636..a61b3b0c5da3 100644 --- a/drivers/mailbox/Kconfig +++ b/drivers/mailbox/Kconfig @@ -177,6 +177,19 @@ config POLARFIRE_SOC_MAILBOX =20 If unsure, say N. =20 +config MCHP_SBI_IPC_MBOX + tristate "Microchip Inter-processor Communication (IPC) SBI driver" + depends on RISCV_SBI || COMPILE_TEST + depends on ARCH_MICROCHIP + help + Mailbox implementation for Microchip devices with an + Inter-process communication (IPC) controller. + + To compile this driver as a module, choose M here. the + module will be called mailbox-mchp-ipc-sbi. + + If unsure, say N. + config QCOM_APCS_IPC tristate "Qualcomm APCS IPC driver" depends on ARCH_QCOM || COMPILE_TEST diff --git a/drivers/mailbox/Makefile b/drivers/mailbox/Makefile index 3c3c27d54c13..a78d1948e331 100644 --- a/drivers/mailbox/Makefile +++ b/drivers/mailbox/Makefile @@ -45,6 +45,8 @@ obj-$(CONFIG_BCM_FLEXRM_MBOX) +=3D bcm-flexrm-mailbox.o =20 obj-$(CONFIG_POLARFIRE_SOC_MAILBOX) +=3D mailbox-mpfs.o =20 +obj-$(CONFIG_MCHP_SBI_IPC_MBOX) +=3D mailbox-mchp-ipc-sbi.o + obj-$(CONFIG_QCOM_APCS_IPC) +=3D qcom-apcs-ipc-mailbox.o =20 obj-$(CONFIG_TEGRA_HSP_MBOX) +=3D tegra-hsp.o diff --git a/drivers/mailbox/mailbox-mchp-ipc-sbi.c b/drivers/mailbox/mailb= ox-mchp-ipc-sbi.c new file mode 100644 index 000000000000..a6e52009a424 --- /dev/null +++ b/drivers/mailbox/mailbox-mchp-ipc-sbi.c @@ -0,0 +1,504 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Microchip Inter-Processor communication (IPC) driver + * + * Copyright (c) 2021 - 2024 Microchip Technology Inc. All rights reserved. + * + * Author: Valentina Fernandez + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define IRQ_STATUS_BITS 12 +#define NUM_CHANS_PER_CLUSTER 5 +#define IPC_DMA_BIT_MASK 32 +#define SBI_EXT_MICROCHIP_TECHNOLOGY (SBI_EXT_VENDOR_START | \ + MICROCHIP_VENDOR_ID) + +enum { + SBI_EXT_IPC_PROBE =3D 0x100, + SBI_EXT_IPC_CH_INIT, + SBI_EXT_IPC_SEND, + SBI_EXT_IPC_RECEIVE, + SBI_EXT_IPC_STATUS, +}; + +enum ipc_hw { + MIV_IHC, +}; + +/** + * struct mchp_ipc_mbox_info - IPC probe message format + * + * @hw_type: IPC implementation available in the hardware + * @num_channels: number of IPC channels available in the hardware + * + * Used to retrieve information on the IPC implementation + * using the SBI_EXT_IPC_PROBE SBI function id. + */ +struct mchp_ipc_mbox_info { + enum ipc_hw hw_type; + u8 num_channels; +}; + +/** + * struct mchp_ipc_init - IPC channel init message format + * + * @max_msg_size: maxmimum message size in bytes of a given channel + * + * struct used by the SBI_EXT_IPC_CH_INIT SBI function id to get + * the max message size in bytes of the initialized channel. + */ +struct mchp_ipc_init { + u16 max_msg_size; +}; + +/** + * struct mchp_ipc_status - IPC status message format + * + * @status: interrupt status for all channels associated to a cluster + * @cluster: specifies the cluster instance that originated an irq + * + * struct used by the SBI_EXT_IPC_STATUS SBI function id to get + * the message present and message clear interrupt status for all the + * channels associated to a cluster. + */ +struct mchp_ipc_status { + u32 status; + u8 cluster; +}; + +/** + * struct mchp_ipc_sbi_msg - IPC SBI payload message + * + * @buf_addr: physical address where the received data should be copied to + * @size: maximum size(in bytes) that can be stored in the buffer pointed = to by `buf` + * @irq_type: mask representing the irq types that triggered an irq + * + * struct used by the SBI_EXT_IPC_SEND/SBI_EXT_IPC_RECEIVE SBI function + * ids to send/receive a message from an associated processor using + * the IPC. + */ +struct mchp_ipc_sbi_msg { + u64 buf_addr; + u16 size; + u8 irq_type; +}; + +struct mchp_ipc_cluster_cfg { + void *buf_base; + phys_addr_t buf_base_addr; + int irq; +}; + +struct mchp_ipc_sbi_mbox { + struct device *dev; + struct mbox_chan *chans; + struct mchp_ipc_cluster_cfg *cluster_cfg; + void *buf_base; + unsigned long buf_base_addr; + struct mbox_controller controller; + enum ipc_hw hw_type; +}; + +static int mchp_ipc_sbi_chan_send(u32 command, u32 channel, unsigned long = address) +{ + struct sbiret ret; + + ret =3D sbi_ecall(SBI_EXT_MICROCHIP_TECHNOLOGY, command, channel, + address, 0, 0, 0, 0); + + if (ret.error) + return sbi_err_map_linux_errno(ret.error); + else + return ret.value; +} + +static int mchp_ipc_sbi_send(u32 command, unsigned long address) +{ + struct sbiret ret; + + ret =3D sbi_ecall(SBI_EXT_MICROCHIP_TECHNOLOGY, command, address, + 0, 0, 0, 0, 0); + + if (ret.error) + return sbi_err_map_linux_errno(ret.error); + else + return ret.value; +} + +static struct mchp_ipc_sbi_mbox *to_mchp_ipc_mbox(struct mbox_controller *= mbox) +{ + return container_of(mbox, struct mchp_ipc_sbi_mbox, controller); +} + +static inline void mchp_ipc_prepare_receive_req(struct mbox_chan *chan) +{ + struct mchp_ipc_sbi_chan *chan_info =3D (struct mchp_ipc_sbi_chan *)chan-= >con_priv; + struct mchp_ipc_sbi_msg request; + + request.buf_addr =3D chan_info->msg_buf_rx_addr; + request.size =3D chan_info->max_msg_size; + memcpy(chan_info->buf_base_rx, &request, sizeof(struct mchp_ipc_sbi_msg)); +} + +static inline void mchp_ipc_process_received_data(struct mbox_chan *chan, + struct mchp_ipc_msg *ipc_msg) +{ + struct mchp_ipc_sbi_chan *chan_info =3D (struct mchp_ipc_sbi_chan *)chan-= >con_priv; + struct mchp_ipc_sbi_msg sbi_msg; + + memcpy(&sbi_msg, chan_info->buf_base_rx, sizeof(struct mchp_ipc_sbi_msg)); + ipc_msg->buf =3D (u32 *)chan_info->msg_buf_rx; + ipc_msg->size =3D sbi_msg.size; +} + +static irqreturn_t mchp_ipc_cluster_aggr_isr(int irq, void *data) +{ + struct mbox_chan *chan; + struct mchp_ipc_sbi_chan *chan_info; + struct mchp_ipc_sbi_mbox *ipc =3D (struct mchp_ipc_sbi_mbox *)data; + struct mchp_ipc_msg ipc_msg; + struct mchp_ipc_status status_msg; + int ret; + unsigned long hartid; + u32 i, chan_index, chan_id; + + /* Find out the hart that originated the irq */ + for_each_online_cpu(i) { + hartid =3D cpuid_to_hartid_map(i); + if (irq =3D=3D ipc->cluster_cfg[hartid].irq) + break; + } + + status_msg.cluster =3D hartid; + memcpy(ipc->cluster_cfg[hartid].buf_base, &status_msg, sizeof(struct mchp= _ipc_status)); + + ret =3D mchp_ipc_sbi_send(SBI_EXT_IPC_STATUS, ipc->cluster_cfg[hartid].bu= f_base_addr); + if (ret < 0) { + dev_err_ratelimited(ipc->dev, "could not get IHC irq status ret=3D%d\n",= ret); + return IRQ_HANDLED; + } + + memcpy(&status_msg, ipc->cluster_cfg[hartid].buf_base, sizeof(struct mchp= _ipc_status)); + + /* + * Iterate over each bit set in the IHC interrupt status register (IRQ_ST= ATUS) to identify + * the channel(s) that have a message to be processed/acknowledged. + * The bits are organized in alternating format, where each pair of bits = represents + * the status of the message present and message clear interrupts for eac= h cluster/hart + * (from hart 0 to hart 5). Each cluster can have up to 5 fixed channels = associated. + */ + + for_each_set_bit(i, (unsigned long *)&status_msg.status, IRQ_STATUS_BITS)= { + /* Find out the destination hart that triggered the interrupt */ + chan_index =3D i / 2; + + /* + * The IP has no loopback channels, so we need to decrement the index wh= en + * the target hart has a greater index than our own + */ + if (chan_index >=3D status_msg.cluster) + chan_index--; + + /* + * Calculate the channel id given the hart and channel index. Channel IDs + * are unique across all clusters of an IPC, and iterate contiguously + * across all clusters. + */ + chan_id =3D status_msg.cluster * (NUM_CHANS_PER_CLUSTER + chan_index); + + chan =3D &ipc->chans[chan_id]; + chan_info =3D (struct mchp_ipc_sbi_chan *)chan->con_priv; + + if (i % 2 =3D=3D 0) { + mchp_ipc_prepare_receive_req(chan); + ret =3D mchp_ipc_sbi_chan_send(SBI_EXT_IPC_RECEIVE, chan_id, + chan_info->buf_base_rx_addr); + if (ret < 0) + continue; + + mchp_ipc_process_received_data(chan, &ipc_msg); + mbox_chan_received_data(&ipc->chans[chan_id], (void *)&ipc_msg); + + } else { + ret =3D mchp_ipc_sbi_chan_send(SBI_EXT_IPC_RECEIVE, chan_id, + chan_info->buf_base_rx_addr); + mbox_chan_txdone(&ipc->chans[chan_id], ret); + } + } + return IRQ_HANDLED; +} + +static int mchp_ipc_send_data(struct mbox_chan *chan, void *data) +{ + struct mchp_ipc_sbi_chan *chan_info =3D (struct mchp_ipc_sbi_chan *)chan-= >con_priv; + const struct mchp_ipc_msg *msg =3D data; + struct mchp_ipc_sbi_msg sbi_payload; + + memcpy(chan_info->msg_buf_tx, msg->buf, msg->size); + sbi_payload.buf_addr =3D chan_info->msg_buf_tx_addr; + sbi_payload.size =3D msg->size; + memcpy(chan_info->buf_base_tx, &sbi_payload, sizeof(sbi_payload)); + + return mchp_ipc_sbi_chan_send(SBI_EXT_IPC_SEND, chan_info->id, chan_info-= >buf_base_tx_addr); +} + +static int mchp_ipc_startup(struct mbox_chan *chan) +{ + struct mchp_ipc_sbi_chan *chan_info =3D (struct mchp_ipc_sbi_chan *)chan-= >con_priv; + struct mchp_ipc_sbi_mbox *ipc =3D to_mchp_ipc_mbox(chan->mbox); + struct mchp_ipc_init ch_init_msg; + int ret; + + /* + * The TX base buffer is used to transmit two types of messages: + * - struct mchp_ipc_init to initialize the channel + * - struct mchp_ipc_sbi_msg to transmit user data/payload + * Ensure the TX buffer size is large enough to accommodate either messag= e type. + */ + size_t max_size =3D max(sizeof(struct mchp_ipc_init), sizeof(struct mchp_= ipc_sbi_msg)); + + chan_info->buf_base_tx =3D kmalloc(max_size, GFP_KERNEL); + if (!chan_info->buf_base_tx) { + ret =3D -ENOMEM; + goto fail; + } + + chan_info->buf_base_tx_addr =3D __pa(chan_info->buf_base_tx); + + chan_info->buf_base_rx =3D kmalloc(max_size, GFP_KERNEL); + if (!chan_info->buf_base_rx) { + ret =3D -ENOMEM; + goto fail_free_buf_base_tx; + } + + chan_info->buf_base_rx_addr =3D __pa(chan_info->buf_base_rx); + + ret =3D mchp_ipc_sbi_chan_send(SBI_EXT_IPC_CH_INIT, chan_info->id, + chan_info->buf_base_tx_addr); + if (ret < 0) { + dev_err(ipc->dev, "channel %u init failed\n", chan_info->id); + goto fail_free_buf_base_rx; + } + + memcpy(&ch_init_msg, chan_info->buf_base_tx, sizeof(struct mchp_ipc_init)= ); + chan_info->max_msg_size =3D ch_init_msg.max_msg_size; + + chan_info->msg_buf_tx =3D kmalloc(chan_info->max_msg_size, GFP_KERNEL); + if (!chan_info->msg_buf_tx) { + ret =3D -ENOMEM; + goto fail_free_buf_base_rx; + } + + chan_info->msg_buf_tx_addr =3D __pa(chan_info->msg_buf_tx); + + chan_info->msg_buf_rx =3D kmalloc(chan_info->max_msg_size, GFP_KERNEL); + if (!chan_info->msg_buf_rx) { + ret =3D -ENOMEM; + goto fail_free_buf_msg_tx; + } + + chan_info->msg_buf_rx_addr =3D __pa(chan_info->msg_buf_rx); + + switch (ipc->hw_type) { + case MIV_IHC: + return 0; + default: + goto fail_free_buf_msg_rx; + } + + if (ret) { + dev_err(ipc->dev, "failed to register interrupt(s)\n"); + goto fail_free_buf_msg_rx; + } + + return ret; + +fail_free_buf_msg_rx: + kfree(chan_info->msg_buf_rx); +fail_free_buf_msg_tx: + kfree(chan_info->msg_buf_tx); +fail_free_buf_base_rx: + kfree(chan_info->buf_base_rx); +fail_free_buf_base_tx: + kfree(chan_info->buf_base_tx); +fail: + return ret; +} + +static void mchp_ipc_shutdown(struct mbox_chan *chan) +{ + struct mchp_ipc_sbi_chan *chan_info =3D (struct mchp_ipc_sbi_chan *)chan-= >con_priv; + + kfree(chan_info->buf_base_tx); + kfree(chan_info->buf_base_rx); + kfree(chan_info->msg_buf_tx); + kfree(chan_info->msg_buf_rx); +} + +static const struct mbox_chan_ops mchp_ipc_ops =3D { + .startup =3D mchp_ipc_startup, + .send_data =3D mchp_ipc_send_data, + .shutdown =3D mchp_ipc_shutdown, +}; + +static struct mbox_chan *mchp_ipc_mbox_xlate(struct mbox_controller *contr= oller, + const struct of_phandle_args *spec) +{ + struct mchp_ipc_sbi_mbox *ipc =3D to_mchp_ipc_mbox(controller); + unsigned int chan_id =3D spec->args[0]; + + if (chan_id >=3D ipc->controller.num_chans) { + dev_err(ipc->dev, "invalid channel id %d\n", chan_id); + return ERR_PTR(-EINVAL); + } + + return &ipc->chans[chan_id]; +} + +static int mchp_ipc_get_cluster_aggr_irq(struct mchp_ipc_sbi_mbox *ipc) +{ + struct platform_device *pdev =3D to_platform_device(ipc->dev); + char *irq_name; + int cpuid, ret; + unsigned long hartid; + bool irq_found =3D false; + + for_each_online_cpu(cpuid) { + hartid =3D cpuid_to_hartid_map(cpuid); + irq_name =3D devm_kasprintf(ipc->dev, GFP_KERNEL, "hart-%lu", hartid); + ret =3D platform_get_irq_byname_optional(pdev, irq_name); + if (ret <=3D 0) + continue; + + ipc->cluster_cfg[hartid].irq =3D ret; + ret =3D devm_request_irq(ipc->dev, ipc->cluster_cfg[hartid].irq, + mchp_ipc_cluster_aggr_isr, IRQF_SHARED, + "miv-ihc-irq", ipc); + if (ret) + return ret; + + ipc->cluster_cfg[hartid].buf_base =3D devm_kmalloc(ipc->dev, + sizeof(struct mchp_ipc_status), + GFP_KERNEL); + + if (!ipc->cluster_cfg[hartid].buf_base) + return -ENOMEM; + + ipc->cluster_cfg[hartid].buf_base_addr =3D __pa(ipc->cluster_cfg[hartid]= .buf_base); + + irq_found =3D true; + } + + return irq_found; +} + +static int mchp_ipc_probe(struct platform_device *pdev) +{ + struct device *dev =3D &pdev->dev; + struct mchp_ipc_mbox_info ipc_info; + struct mchp_ipc_sbi_mbox *ipc; + struct mchp_ipc_sbi_chan *priv; + bool irq_avail =3D false; + int ret; + u32 chan_id; + + ret =3D sbi_probe_extension(SBI_EXT_MICROCHIP_TECHNOLOGY); + if (ret <=3D 0) + return dev_err_probe(dev, ret, "Microchip SBI extension not detected\n"); + + ipc =3D devm_kzalloc(dev, sizeof(*ipc), GFP_KERNEL); + if (!ipc) + return -ENOMEM; + + platform_set_drvdata(pdev, ipc); + + ipc->buf_base =3D devm_kmalloc(dev, sizeof(struct mchp_ipc_mbox_info), GF= P_KERNEL); + if (!ipc->buf_base) + return -ENOMEM; + + ipc->buf_base_addr =3D __pa(ipc->buf_base); + + ret =3D mchp_ipc_sbi_send(SBI_EXT_IPC_PROBE, ipc->buf_base_addr); + if (ret < 0) + return dev_err_probe(dev, ret, "could not probe IPC SBI service\n"); + + memcpy(&ipc_info, ipc->buf_base, sizeof(struct mchp_ipc_mbox_info)); + ipc->controller.num_chans =3D ipc_info.num_channels; + ipc->hw_type =3D ipc_info.hw_type; + + ipc->chans =3D devm_kcalloc(dev, ipc->controller.num_chans, sizeof(*ipc->= chans), GFP_KERNEL); + if (!ipc->chans) + return -ENOMEM; + + ipc->dev =3D dev; + ipc->controller.txdone_irq =3D true; + ipc->controller.dev =3D ipc->dev; + ipc->controller.ops =3D &mchp_ipc_ops; + ipc->controller.chans =3D ipc->chans; + ipc->controller.of_xlate =3D mchp_ipc_mbox_xlate; + + for (chan_id =3D 0; chan_id < ipc->controller.num_chans; chan_id++) { + priv =3D devm_kmalloc(dev, sizeof(*priv), GFP_KERNEL); + if (!priv) + return -ENOMEM; + + ipc->chans[chan_id].con_priv =3D priv; + priv->id =3D chan_id; + } + + if (ipc->hw_type =3D=3D MIV_IHC) { + ipc->cluster_cfg =3D devm_kcalloc(dev, num_online_cpus(), + sizeof(struct mchp_ipc_cluster_cfg), + GFP_KERNEL); + if (!ipc->cluster_cfg) + return -ENOMEM; + + if (mchp_ipc_get_cluster_aggr_irq(ipc)) + irq_avail =3D true; + } + + if (!irq_avail) + return dev_err_probe(dev, -ENODEV, "missing interrupt property\n"); + + ret =3D devm_mbox_controller_register(dev, &ipc->controller); + if (ret) + return dev_err_probe(dev, ret, + "Inter-Processor communication (IPC) registration failed\n"); + + return 0; +} + +static const struct of_device_id mchp_ipc_of_match[] =3D { + {.compatible =3D "microchip,sbi-ipc", }, + {} +}; +MODULE_DEVICE_TABLE(of, mchp_ipc_of_match); + +static struct platform_driver mchp_ipc_driver =3D { + .driver =3D { + .name =3D "microchip_ipc", + .of_match_table =3D mchp_ipc_of_match, + }, + .probe =3D mchp_ipc_probe, +}; + +module_platform_driver(mchp_ipc_driver); + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Valentina Fernandez "); +MODULE_DESCRIPTION("Microchip Inter-Processor Communication (IPC) driver"); diff --git a/include/linux/mailbox/mchp-ipc.h b/include/linux/mailbox/mchp-= ipc.h new file mode 100644 index 000000000000..f084ac9e291b --- /dev/null +++ b/include/linux/mailbox/mchp-ipc.h @@ -0,0 +1,33 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + *Copyright (c) 2024 Microchip Technology Inc. All rights reserved. + */ + +#ifndef _LINUX_MCHP_IPC_H_ +#define _LINUX_MCHP_IPC_H_ + +#include +#include + +struct mchp_ipc_msg { + u32 *buf; + u16 size; +}; + +struct mchp_ipc_sbi_chan { + void *buf_base_tx; + void *buf_base_rx; + void *msg_buf_tx; + void *msg_buf_rx; + phys_addr_t buf_base_tx_addr; + phys_addr_t buf_base_rx_addr; + phys_addr_t msg_buf_tx_addr; + phys_addr_t msg_buf_rx_addr; + int chan_aggregated_irq; + int mp_irq; + int mc_irq; + u32 id; + u32 max_msg_size; +}; + +#endif /* _LINUX_MCHP_IPC_H_ */ --=20 2.34.1