From patchwork Thu Dec 5 17:41:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 13895881 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1F27AE7716E for ; Thu, 5 Dec 2024 17:43:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=XKTSOcD5L+z2qw5+nXllrVScKZxcBqJj6UXu4K9Ii9s=; b=q/RY+E0dN0zo7B6+qLkL/tP5eJ gIquf7E47pAGkNJdgI8KqQU+6yQcA062ZgfZJCHzxuL9ZfYOXFbsrNwEeFtuEEwaZrWE7642ACV/h 7h+WWieeyjdC99MqU4ZAZd63meRILKh5oSr52GpkPVepmYt6lwPaiZxbVp9bEP90licHvMysA4L83 kT+d29C/8f69GvIMiqsCCRSxjX4TP0CY7NVaFq7G5KvWpqV5scxD1jWZ5RnoWBzESuXDpXajMf2+6 3FlA+wUobsYqIaBaAYbTPtlEPGZPl9QxZc2NV6aMfIESRPcfxNb/s9t/HBjzkyyU4uuSMcVrSZMUB 2VztyFbw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tJFtE-0000000GzxB-0cah; Thu, 05 Dec 2024 17:43:48 +0000 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tJFrD-0000000GzPZ-0nz5 for linux-arm-kernel@lists.infradead.org; Thu, 05 Dec 2024 17:41:44 +0000 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-4349fd77b33so11846305e9.2 for ; Thu, 05 Dec 2024 09:41:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733420501; x=1734025301; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=XKTSOcD5L+z2qw5+nXllrVScKZxcBqJj6UXu4K9Ii9s=; b=ifrGO0KKTlV3ft24aElc2ELJJmV70Rtr5ePek96bkavnwjm5C5WQjTTnAiGsHT2Ka3 M4CmDaXHY40akChs4XAbkn9OrJI/RxW3WwsNtDb43ukLpE0jhM6cAdVmMOYHnq0pm3Dd jUpqJYuqYeqSoGSo9B+c9Td0CQvO25vx9N2k13BoctmETuen/Pgz2VzU5+uKfvfT5XHb YA35sG9K+54RqyBgqIyKr82cASKhaovKRWg4UdmwUMIPWoA5FTb9mMXubn+//YtuAeLm r12IrjZYexFYRDJyn/tNHI6NQZz3pxkqJCWD4nGrGkecyAjLggCTat53RB3BFIanLbVF J2rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733420501; x=1734025301; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XKTSOcD5L+z2qw5+nXllrVScKZxcBqJj6UXu4K9Ii9s=; b=iaPk4RuQSAkLfnnra3DYJa6hlJoLrf4pZ64DJN21O91GSBNAMHDUed3WLZ81+l0+IL C7le9VBcaj4ngdTvi+UNktfGty7QW3RWq8zjgSd8IGOWOHqCMfyUAS5dKsI7MlZlTUyo MCXDPzOlk2Kp98z+ZBskdPXktFwH5qosXbsC3xsoywV7tWWVaFzPQyy/nNjA0eOs9X66 YtCJPpiTD2rxCn7M/wimiEziWl9/U6rYR4uIAY5oYUFvlJLnFzE/OzsEYDk1xm/WA0O5 CZunHs5JDOdC/8imBbEgc8G2PAQfIVaNreeYFFpVZ1nRqmwpbmz+RlSkEkhXS4ONiqMI Lm5Q== X-Forwarded-Encrypted: i=1; AJvYcCU+JAXpFyOGasOGQZbK1qNH47J9q7H2w4TGGBogc9KRiQXbBd02CyPInLbEQ/OclnQrzpgq5bbaTgCPWPsW3RnL@lists.infradead.org X-Gm-Message-State: AOJu0Yxfb5hlX8kGnJiZ+z/dZAvhqk3LANz819P90u5GDzmk6/oh32f2 gVmQx2abZDgrCzD5+CYA50kooozOdM1QYtWyaAlbMhWUx2QDlfTQANB0ktuDH4c= X-Gm-Gg: ASbGncsJB9O/Db1Qcog4pQ5NTT2WC8N3LBrnzSjIMbHBmvMKAYYqe9/M93RBBP2UiAn papvE3bd0uWbpEYK+cDkyJjeLv3DjlnVBXk+tp2jscT7k4uPJtyZrGLt1hUv3q1lB46P/f76Q/S cMPmoUpu03PVLQiv6+5RqzqPFYA4yzzupVRcHRfganNh2d8OEbwm5xhCG0jgVRKjvvKkwBdwy3V yOB0VDzBhLwANb+Di2Tz/ZqL/9wwmHgIMfUmzetQV124fB0FgPeYTOhL4H9q9Or05RZ2o61Trhh rAyk1+6G1LQTqfSJy1ETb0mNC07n3fud X-Google-Smtp-Source: AGHT+IGqhJzyDS4e04vMn1WyVytA3R0WpmSjXAbWRrFlxmWxFGHaT0ntvkzlA3YzSBZ0INS2vdnPeQ== X-Received: by 2002:a05:600c:3ca1:b0:434:9e1d:7626 with SMTP id 5b1f17b1804b1-434dded7366mr1195635e9.25.1733420501143; Thu, 05 Dec 2024 09:41:41 -0800 (PST) Received: from ta2.c.googlers.com.com (32.134.38.34.bc.googleusercontent.com. [34.38.134.32]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-434da0d6961sm30318525e9.12.2024.12.05.09.41.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Dec 2024 09:41:40 -0800 (PST) From: Tudor Ambarus To: jassisinghbrar@gmail.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, alim.akhtar@samsung.com Cc: linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, andre.draszik@linaro.org, kernel-team@android.com, willmcvicker@google.com, peter.griffin@linaro.org, Tudor Ambarus Subject: [PATCH v3 1/3] dt-bindings: mailbox: add bindings for samsung,exynos Date: Thu, 5 Dec 2024 17:41:35 +0000 Message-ID: <20241205174137.190545-2-tudor.ambarus@linaro.org> X-Mailer: git-send-email 2.47.0.338.g60cca15819-goog In-Reply-To: <20241205174137.190545-1-tudor.ambarus@linaro.org> References: <20241205174137.190545-1-tudor.ambarus@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241205_094143_227662_873FCE49 X-CRM114-Status: GOOD ( 14.75 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add bindings for the Samsung Exynos Mailbox Controller. Signed-off-by: Tudor Ambarus --- .../bindings/mailbox/samsung,exynos.yaml | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 Documentation/devicetree/bindings/mailbox/samsung,exynos.yaml diff --git a/Documentation/devicetree/bindings/mailbox/samsung,exynos.yaml b/Documentation/devicetree/bindings/mailbox/samsung,exynos.yaml new file mode 100644 index 000000000000..1fddec1fc64c --- /dev/null +++ b/Documentation/devicetree/bindings/mailbox/samsung,exynos.yaml @@ -0,0 +1,70 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +# Copyright 2024 Linaro Ltd. +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mailbox/samsung,exynos.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Samsung Exynos Mailbox Controller + +maintainers: + - Tudor Ambarus + +description: | + The samsung exynos mailbox controller has 16 flag bits for hardware interrupt + generation and a shared register for passing mailbox messages. When the + controller is used by the ACPM protocol the shared register is ignored and + the mailbox controller acts as a doorbell. The controller just raises the + interrupt to the firmware after the ACPM protocol has written the message to + SRAM. + +properties: + compatible: + const: google,gs101-acpm-mbox + + reg: + maxItems: 1 + + clocks: + maxItems: 1 + + clock-names: + items: + - const: pclk + + interrupts: + description: IRQ line for the RX mailbox. + maxItems: 1 + + '#mbox-cells': + const: 1 + +required: + - compatible + - reg + - clocks + - clock-names + - interrupts + - '#mbox-cells' + +additionalProperties: false + +examples: + # Doorbell mode. + - | + #include + #include + + soc { + #address-cells = <1>; + #size-cells = <1>; + + ap2apm_mailbox: mailbox@17610000 { + compatible = "google,gs101-acpm-mbox"; + reg = <0x17610000 0x1000>; + clocks = <&cmu_apm CLK_GOUT_APM_MAILBOX_APM_AP_PCLK>; + clock-names = "pclk"; + interrupts = ; + #mbox-cells = <1>; + }; + }; From patchwork Thu Dec 5 17:41:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 13895886 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 25AA4E7716E for ; Thu, 5 Dec 2024 17:45:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Wo6TX+bBHYFp5yEtuTvKYoGV7nlrucX5ZnLEJPkTV/E=; b=TO7iRNVAveIWgL314xgxJ3cP9d g3FYVWOvqUN7rCy8o9E1LDBoBdj2kRJHKdGK6XH9DdznmizeDj6jFCJLD/SlSJJ/NmpHrQdmloozd E8bCjJEsN6CpnqfDvNCszYl8/017tXXGGmoBxoivz7kl+8hjVx+TukJSUSQ8kG1HM3442j4YhHRhr VV7gyWmsrUW0tEam9nAHvBrRmAbtCY9Wj5XrdZAfRMMavl2fsntogIHkfC0oHolP6FbOTIHurt46t UHcliOMc9efcTP1a12/fLYHfaiRMB0OOQYDVCqJxbTB0Xg8TNncQNZpoKqPVueACxvX9rKA4m4xQt Qd5aRykA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tJFuD-0000000H0EQ-3J9p; Thu, 05 Dec 2024 17:44:49 +0000 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tJFrD-0000000GzQ2-2ilr for linux-arm-kernel@lists.infradead.org; Thu, 05 Dec 2024 17:41:44 +0000 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-434a2033562so11920095e9.1 for ; Thu, 05 Dec 2024 09:41:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733420502; x=1734025302; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Wo6TX+bBHYFp5yEtuTvKYoGV7nlrucX5ZnLEJPkTV/E=; b=bWc5QiijrdgvQ17Kd6/HHY2Be/jwXWez9t690rr0telDpqz85OM4ocdkrDpEJzKy75 Wj9bqYDcBH0j35qM+AUZGrJkRzO+wPKYF95kdNkSEnZwNvwVY0Sw9IVeEqLD+PcTw4Tr bsBxn+Qa7bNVcf1GB5ws69Sgae2egp5kIAdMfYaK1fmhDFBvBG1X94QG6b5a5M/ttf8U OU4VJ4Tl6WbJmjb2xn4jOPS64r/HJw5bR1sTg/OZtWFTkOXcAXeg237iYi+eHtzm8USQ pN4yGYrsriqifu2mGEuXZZS8fe/1d/GMRogm1sPWpU1F73sUpzth6vM96EoebERbx6O5 pSZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733420502; x=1734025302; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Wo6TX+bBHYFp5yEtuTvKYoGV7nlrucX5ZnLEJPkTV/E=; b=GjLIJ4tDzqpRr099eJ7Y5pc7524C/inAl6eAA3Rmzwr4kVa0ppFrmxL61VtWFtJJS7 uqafGMtC1UF8hr3blpF67b77Q1I5iXlIvxcx0Qdlo6gUagUUNeR5AfFqx4KG+U+vd6zn OBKJw1HrEv7GHPfgbixIG4MkroQB4S9e8d6hvrUMw56yx+3UGKsmJ1AtHwyunvITqIxQ Ry8ZTZe0i6lkOTAlm0Q5cz3gYfq0IfhpwX81FGNliVQdcQNUOtjroRCnh/thaccSN8LC xG+0V2IsA6ixOlsK4ewv5lO0Y4h/mGP+mZufXJ9JblYhsi+X9KisZdnKrZ6Or1R9x2AB 6g8w== X-Forwarded-Encrypted: i=1; AJvYcCVaEqq5ZxGOtMqFs7HxKcepvwwdMJH6g4EAR42b1zXr2OEE0k/XA01zIvH3uDfySDFIJ2hKwCdDZ/uGfxMbAZdI@lists.infradead.org X-Gm-Message-State: AOJu0YwOOg3f+QxGN8pGWYjMuCoGhgELE+A45tYKMtzSJNDzQpQk1Dfa mTf1F1KvFNDjptFuEVOf39VWiu323NDRzK5hSPMOUgDDjFRJuncmXwVNUp5B3UM= X-Gm-Gg: ASbGnctht384KK7YgmypNml4QjzIj4lCIO1lOkTa+dx59thDvj/OdRk5jM4wfdraKPX 5iqulvSDIL6a6V5RD+pwfZ0hZa9uGGPihf3jHomvJC2e15y7kAcA9LX4/fV6QLMIvCIdqaoxzkI ZlwLI//EcQ2yxHpUr84C5qjTnlAnwTU0P7rEL02HmXSGYa9vulUqqhBQvXmsUHO8mEY3RepvuNS QlGkWyhBq9O9qjbyc7gF6IOVRUdrN577TP7Qr/yc3eLw/SOc5GT4rtYfdKA+E1wUi5USxB7Od5I CBxXK7HM135wdDqXcCn6k2VjWgz3jCki X-Google-Smtp-Source: AGHT+IHb0o9dq8kY11HSiBExfA3eNeePmx2xXippa5MoXXeosok09IJCvD/BXrBGF6Agc4uVGD4lVQ== X-Received: by 2002:a05:600c:358f:b0:42c:de2f:da27 with SMTP id 5b1f17b1804b1-434ddeadeeemr1546605e9.2.1733420502047; Thu, 05 Dec 2024 09:41:42 -0800 (PST) Received: from ta2.c.googlers.com.com (32.134.38.34.bc.googleusercontent.com. [34.38.134.32]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-434da0d6961sm30318525e9.12.2024.12.05.09.41.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Dec 2024 09:41:41 -0800 (PST) From: Tudor Ambarus To: jassisinghbrar@gmail.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, alim.akhtar@samsung.com Cc: linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, andre.draszik@linaro.org, kernel-team@android.com, willmcvicker@google.com, peter.griffin@linaro.org, Tudor Ambarus Subject: [PATCH v3 2/3] mailbox: add samsung exynos driver Date: Thu, 5 Dec 2024 17:41:36 +0000 Message-ID: <20241205174137.190545-3-tudor.ambarus@linaro.org> X-Mailer: git-send-email 2.47.0.338.g60cca15819-goog In-Reply-To: <20241205174137.190545-1-tudor.ambarus@linaro.org> References: <20241205174137.190545-1-tudor.ambarus@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241205_094143_691643_DA83BA0B X-CRM114-Status: GOOD ( 25.28 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The samsung exynos mailbox controller has 16 flag bits for hardware interrupt generation and a shared register for passing mailbox messages. When the controller is used by the ACPM protocol the shared register is ignored and the mailbox controller acts as a doorbell. The controller just raises the interrupt to APM after the ACPM protocol has written the message to SRAM. Add support for the samsung exynos mailbox controller. Signed-off-by: Tudor Ambarus --- drivers/mailbox/Kconfig | 11 +++ drivers/mailbox/Makefile | 2 + drivers/mailbox/exynos-mailbox.c | 143 +++++++++++++++++++++++++++++++ 3 files changed, 156 insertions(+) create mode 100644 drivers/mailbox/exynos-mailbox.c diff --git a/drivers/mailbox/Kconfig b/drivers/mailbox/Kconfig index 8ecba7fb999e..44b808c4d97f 100644 --- a/drivers/mailbox/Kconfig +++ b/drivers/mailbox/Kconfig @@ -36,6 +36,17 @@ config ARM_MHU_V3 that provides different means of transports: supported extensions will be discovered and possibly managed at probe-time. +config EXYNOS_MBOX + tristate "Exynos Mailbox" + depends on ARCH_EXYNOS || COMPILE_TEST + help + Say Y here if you want to build the Samsung Exynos Mailbox controller + driver. The controller has 16 flag bits for hardware interrupt + generation and a shared register for passing mailbox messages. + When the controller is used by the ACPM protocol the shared register + is ignored and the mailbox controller acts as a doorbell that raises + the interrupt to the ACPM firmware. + config IMX_MBOX tristate "i.MX Mailbox" depends on ARCH_MXC || COMPILE_TEST diff --git a/drivers/mailbox/Makefile b/drivers/mailbox/Makefile index 5f4f5b0ce2cc..86192b5c7c32 100644 --- a/drivers/mailbox/Makefile +++ b/drivers/mailbox/Makefile @@ -11,6 +11,8 @@ obj-$(CONFIG_ARM_MHU_V2) += arm_mhuv2.o obj-$(CONFIG_ARM_MHU_V3) += arm_mhuv3.o +obj-$(CONFIG_EXYNOS_MBOX) += exynos-mailbox.o + obj-$(CONFIG_IMX_MBOX) += imx-mailbox.o obj-$(CONFIG_ARMADA_37XX_RWTM_MBOX) += armada-37xx-rwtm-mailbox.o diff --git a/drivers/mailbox/exynos-mailbox.c b/drivers/mailbox/exynos-mailbox.c new file mode 100644 index 000000000000..6d4e9b3106b2 --- /dev/null +++ b/drivers/mailbox/exynos-mailbox.c @@ -0,0 +1,143 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright 2020 Samsung Electronics Co., Ltd. + * Copyright 2020 Google LLC. + * Copyright 2024 Linaro Ltd. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define EXYNOS_MBOX_MCUCTRL 0x0 /* Mailbox Control Register */ +#define EXYNOS_MBOX_INTCR0 0x24 /* Interrupt Clear Register 0 */ +#define EXYNOS_MBOX_INTMR0 0x28 /* Interrupt Mask Register 0 */ +#define EXYNOS_MBOX_INTSR0 0x2c /* Interrupt Status Register 0 */ +#define EXYNOS_MBOX_INTMSR0 0x30 /* Interrupt Mask Status Register 0 */ +#define EXYNOS_MBOX_INTGR1 0x40 /* Interrupt Generation Register 1 */ +#define EXYNOS_MBOX_INTMR1 0x48 /* Interrupt Mask Register 1 */ +#define EXYNOS_MBOX_INTSR1 0x4c /* Interrupt Status Register 1 */ +#define EXYNOS_MBOX_INTMSR1 0x50 /* Interrupt Mask Status Register 1 */ + +#define EXYNOS_MBOX_INTMR0_MASK GENMASK(15, 0) +#define EXYNOS_MBOX_INTGR1_MASK GENMASK(15, 0) + +#define EXYNOS_MBOX_CHAN_COUNT HWEIGHT32(EXYNOS_MBOX_INTGR1_MASK) + +/** + * struct exynos_mbox - driver's private data. + * @regs: mailbox registers base address. + * @mbox: pointer to the mailbox controller. + * @dev: pointer to the mailbox device. + * @pclk: pointer to the mailbox peripheral clock. + */ +struct exynos_mbox { + void __iomem *regs; + struct mbox_controller *mbox; + struct device *dev; + struct clk *pclk; +}; + +static int exynos_mbox_chan_index(struct mbox_chan *chan) +{ + struct mbox_controller *mbox = chan->mbox; + int i; + + for (i = 0; i < mbox->num_chans; i++) + if (chan == &mbox->chans[i]) + return i; + return -EINVAL; +} + +static int exynos_mbox_send_data(struct mbox_chan *chan, void *data) +{ + struct exynos_mbox *exynos_mbox = dev_get_drvdata(chan->mbox->dev); + int index; + + index = exynos_mbox_chan_index(chan); + if (index < 0) + return index; + + writel_relaxed(BIT(index), exynos_mbox->regs + EXYNOS_MBOX_INTGR1); + + return 0; +} + +static const struct mbox_chan_ops exynos_mbox_chan_ops = { + .send_data = exynos_mbox_send_data, +}; + +static const struct of_device_id exynos_mbox_match[] = { + { .compatible = "google,gs101-acpm-mbox" }, + {}, +}; +MODULE_DEVICE_TABLE(of, exynos_mbox_match); + +static int exynos_mbox_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct exynos_mbox *exynos_mbox; + struct mbox_controller *mbox; + struct mbox_chan *chans; + int i; + + exynos_mbox = devm_kzalloc(dev, sizeof(*exynos_mbox), GFP_KERNEL); + if (!exynos_mbox) + return -ENOMEM; + + mbox = devm_kzalloc(dev, sizeof(*mbox), GFP_KERNEL); + if (!mbox) + return -ENOMEM; + + chans = devm_kcalloc(dev, EXYNOS_MBOX_CHAN_COUNT, sizeof(*chans), + GFP_KERNEL); + if (!chans) + return -ENOMEM; + + exynos_mbox->regs = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(exynos_mbox->regs)) + return PTR_ERR(exynos_mbox->regs); + + exynos_mbox->pclk = devm_clk_get_enabled(dev, "pclk"); + if (IS_ERR(exynos_mbox->pclk)) + return dev_err_probe(dev, PTR_ERR(exynos_mbox->pclk), + "Failed to enable clock.\n"); + + mbox->num_chans = EXYNOS_MBOX_CHAN_COUNT; + mbox->chans = chans; + mbox->dev = dev; + mbox->ops = &exynos_mbox_chan_ops; + + for (i = 0; i < EXYNOS_MBOX_CHAN_COUNT; i++) + chans[i].mbox = mbox; + + exynos_mbox->dev = dev; + exynos_mbox->mbox = mbox; + + platform_set_drvdata(pdev, exynos_mbox); + + /* Mask out all interrupts. We support just polling channels for now. */ + writel_relaxed(EXYNOS_MBOX_INTMR0_MASK, + exynos_mbox->regs + EXYNOS_MBOX_INTMR0); + + return devm_mbox_controller_register(dev, mbox); +} + +static struct platform_driver exynos_mbox_driver = { + .probe = exynos_mbox_probe, + .driver = { + .name = "exynos-acpm-mbox", + .of_match_table = of_match_ptr(exynos_mbox_match), + }, +}; +module_platform_driver(exynos_mbox_driver); + +MODULE_AUTHOR("Tudor Ambarus "); +MODULE_DESCRIPTION("Exynos mailbox driver"); +MODULE_LICENSE("GPL"); From patchwork Thu Dec 5 17:41:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 13895887 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 285F6E77170 for ; Thu, 5 Dec 2024 17:46:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=jKhrlzK7pKMmsPY9TXNGvHHUZJEtDgIZ1kDt6TVOg0Y=; b=zWednR54Pe3UB3ZQfYGQvQ8kl3 MZqaV9PmEH0zy8lL7hKNfjhvOPIrrmjD6fGtSEsEcEVVMEZbRu1ydPsz8PR79WY5KR1liEARhLEHI CjwTF4dY7ZeRz4PzjI9YJSosUb2NkL2jlFWDXIRZ7dMGTclOSY3kDUKNOJEWV1ovyqpEhmSLnWGak 4G6EvRr1L4BgaCZvgBEk3Wxx0qE7JcjKR96v45lydbXU0vFeClYM2GCuxYv8FZonjy8lYPmZTCC/f uwwOexhqqtCC8+Ls+bYyiXcjBy1W80DZbELZBkTuEjtEZfJJFsf+5HdiuDd6xymbnGD10nZGjDjyG DmWOYXCw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tJFvD-0000000H0Ql-1egs; Thu, 05 Dec 2024 17:45:51 +0000 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tJFrE-0000000GzQR-0CeD for linux-arm-kernel@lists.infradead.org; Thu, 05 Dec 2024 17:41:45 +0000 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-4349e1467fbso8603975e9.1 for ; Thu, 05 Dec 2024 09:41:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733420503; x=1734025303; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jKhrlzK7pKMmsPY9TXNGvHHUZJEtDgIZ1kDt6TVOg0Y=; b=qYFVK9aiG7qcxdDH3DIvfJR7dGcPAOZr8uQ05TZk89HiuoCd3u0CtfPTju4vnVG5KU NQDjxR8zKC+L85gre99PcEHShOqpFhAP/ZYHD+nk16HNmSTQh/4515nkcnB5fxwK8pP6 kAYH9DpqDM9ngUS0cKMb6qV992we+lh1yn350j10uGQLcfruANcOdiEB3FMt94pIlEZu T3xGM+Jbori3zcTFo89ozYAJyrX64ISo046swXKZk9cckZL/1qiwB6dTUcYPgD7ggqv8 4lCwPvQuEWKxyhLSVgDlg3Sz8qXJtC5284zhIEcUbx7ev3VYTGCXJdNcuNS0gsb3BDrh iXsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733420503; x=1734025303; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jKhrlzK7pKMmsPY9TXNGvHHUZJEtDgIZ1kDt6TVOg0Y=; b=WDdyJLlTHCbCkb3G7agV0nKruTVua1Mz2FsHzJcZDIvmyhVDneEsARAK9JdfDE/+v0 TbzoTxV+RrX4/7B0XCTlRWPSdNmyMNRBx8Iw9T4B+D/dAlzSD3h8oo5Q6neEXzDhdVm3 3W0da+dA/qUSzY4wMkZU7n6FYJHzpJ+SpcgfrXFNNhUzfQsanOhIjQOtpj0NuUD2NxkP BiUNryQFFJd6ORdCn0rf+JuA8Uc2whWS1G0STPdMkh2e13+bo/EmqjEa+V1PfmNq1z+l yAZaPlm72NuAbIV7y+o3sgSG3J+fXwmvuPO030yk7knzWVv3qa1WKcHDylKH7P+77G1r 2iGQ== X-Forwarded-Encrypted: i=1; AJvYcCVb2Ju5ReDW+xXev29GYPncT+AWzhk9gBfRImbQYVsZ3F9rhNWg/5LQDq757i6Dv8jm3scQ4HoKFqwpM81LdODX@lists.infradead.org X-Gm-Message-State: AOJu0YwGIBwMNTjWoMR+fQOmTZ2V84rgqprvig5pZIYIjq0+WBdkLPBj WDU02kAywI+4MU60nHtfAYGVG2v7W2AwVtVF5Ea3pvpq6OMctYDso2+APgaCLfI= X-Gm-Gg: ASbGncttR5EYGDnXWYIqUToFxLX+XdGvkH8G+F5UXuC+B9XxFJ9Xncqo33dNQNfTatL ESZWCFgQpF259TgKbbEt8gwtPwsyvpImSlXxw9sDa56sIvlP8gJ02k01Rz++lJPmSkgL3Mt2e/t hLJ5o/3ZvwUhnXA+jltRplDHlZNCwdrxq1p8K7V9TyVY4ncHNEU3P7yXBUCvSiMaLnbVhA9Dm00 LhU5gp8YYqDI/5vFE7rlw5mspEUxHXQ2MjafKmB9WpDZHExpkGVnWg5bWqiIV+7pixnrAE1hfSM 3oO8nvYifxOM7cv2n77hIUC7hJBTjuTZ X-Google-Smtp-Source: AGHT+IETTIMwCAt1THUCSfAIoi1qf9ZFSIPgjGWfgvAXtjPszoHVRLgp6w2ts+qYW08bZrcEVzFXEQ== X-Received: by 2002:a05:600c:350a:b0:434:a7e3:db66 with SMTP id 5b1f17b1804b1-434ddecfe72mr1375775e9.26.1733420502746; Thu, 05 Dec 2024 09:41:42 -0800 (PST) Received: from ta2.c.googlers.com.com (32.134.38.34.bc.googleusercontent.com. [34.38.134.32]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-434da0d6961sm30318525e9.12.2024.12.05.09.41.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Dec 2024 09:41:42 -0800 (PST) From: Tudor Ambarus To: jassisinghbrar@gmail.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, alim.akhtar@samsung.com Cc: linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, andre.draszik@linaro.org, kernel-team@android.com, willmcvicker@google.com, peter.griffin@linaro.org, Tudor Ambarus Subject: [PATCH v3 3/3] MAINTAINERS: add entry for samsung exynos mailbox driver Date: Thu, 5 Dec 2024 17:41:37 +0000 Message-ID: <20241205174137.190545-4-tudor.ambarus@linaro.org> X-Mailer: git-send-email 2.47.0.338.g60cca15819-goog In-Reply-To: <20241205174137.190545-1-tudor.ambarus@linaro.org> References: <20241205174137.190545-1-tudor.ambarus@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241205_094144_083360_F540F6E7 X-CRM114-Status: UNSURE ( 8.68 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add entry for the samsung exynos mailbox driver. Signed-off-by: Tudor Ambarus --- MAINTAINERS | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 1e930c7a58b1..41a29d1d6e4d 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3023,6 +3023,7 @@ F: drivers/*/*s3c24* F: drivers/*/*s3c64xx* F: drivers/*/*s5pv210* F: drivers/clocksource/samsung_pwm_timer.c +F: drivers/mailbox/exynos-mailbox.c F: drivers/memory/samsung/ F: drivers/pwm/pwm-samsung.c F: drivers/soc/samsung/ @@ -20712,6 +20713,14 @@ F: arch/arm64/boot/dts/exynos/exynos850* F: drivers/clk/samsung/clk-exynos850.c F: include/dt-bindings/clock/exynos850.h +SAMSUNG EXYNOS MAILBOX DRIVER +M: Tudor Ambarus +L: linux-kernel@vger.kernel.org +L: linux-samsung-soc@vger.kernel.org +S: Supported +F: Documentation/devicetree/bindings/mailbox/samsung,exynos.yaml +F: drivers/mailbox/exynos-mailbox.c + SAMSUNG EXYNOS PSEUDO RANDOM NUMBER GENERATOR (RNG) DRIVER M: Krzysztof Kozlowski L: linux-crypto@vger.kernel.org