From patchwork Thu Dec 12 15:43:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 849953 Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EBE532210FE for ; Thu, 12 Dec 2024 15:44:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734018243; cv=none; b=uxFPoawyzIrdj7HaL49rG4SayZta05YL8BtAB7q22RoEQSBojhih+EWldjycUpXUvUC6PEBmPjcze1wwJdKKgbflyTobO6NJloQ0kRtfXFcDNChnhqRqLfBPskI43uRj0F3CRGWdb9f1MnytRcBofGwwY6CqW6G2EozAEjn4Zn0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734018243; c=relaxed/simple; bh=2U3cIpMR781g/GfpmXVJzVTA2XVkQ1k3SY+wzu3Tc7o=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ad/5o9c5H3IXaGiIinGRIKSdNPZcdYl5wrDhSwMuCtCvMtqQnTgwUucQME0fSLRAaCRizCEQgwqn8Dl0Ir6Hl6CqrODvGGPr8yY+AMhMUQeen3dVztHj0Ht8POzVfG9DG+S5e8RFkXXxtjIVv4d3fObCrKL/L8NltMMCNeQD/Ag= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=aKaohNa1; arc=none smtp.client-ip=209.85.128.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="aKaohNa1" Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-4361b0ec57aso7274765e9.0 for ; Thu, 12 Dec 2024 07:44:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734018240; x=1734623040; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=6sYCGfkHDNTUYrfu1p0MBWMT4rMemdA0rLxD3BGGzRo=; b=aKaohNa1d0alWzEJAisniAod8Osi6/unH9cFs0zZQtJvjs6zUrpvMmOv5uCHaOv9JJ lSq386koxwYPFB5BpTGK2QblUiLYu9kIOrtmAzfbNN7R7Qaf+l1tBrC4MYC6kOtWSvbC J8DLZanEH5i+t7N2JTiOD3tWJEIb0z3ibZMjktyj+xytXDL7hIOGnb56pHEzMFVXMDpm H6gmvUfnkn3xQ7A1JzbVvvOeVm17aKBNZcVPu3BBjeVoc1lJf0aaCQyy6KrYrsJWU+9t HKlmWmeRTvZmCRf2d45nBu5Dgr57Kj4n9qetRtlz5N2Q4nF+JNBWVPfCWYKQPLnvExQQ 0ELA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734018240; x=1734623040; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6sYCGfkHDNTUYrfu1p0MBWMT4rMemdA0rLxD3BGGzRo=; b=dbozrzWopAIF0c+iJjFMd4QNe4M/yDQc9mVGE56Vsf7U2+xVlhkaIfJ8uOe220nNNg CGg7H+eU6pJaRAM3I58YECBD9WXZAmeB7wfl0ERAgnAOP6Xj6MbEF62EVNIJNpcvQBhI uQHE0JEDJC78qTJyrNXUwRx74flW5rco+WJ/rjBxCfAUHvlyOQU/nrDOYGXa1Rp3XUMm VErdpZzp0Cr6c3IYPTK/cyiDC1J6KHuZYAXs+NuGwA4KCURngqaiFJpS0WnFnAPtAtWc HcELduEYI0rtL/ASbRaCLaAuFnOD5nCT1J1sUUs6B+O9D7dbN4R5lEtzedETdkX+2PCW Z9nA== X-Forwarded-Encrypted: i=1; AJvYcCXM7QGcL33pFTCMg600dMBHlr+hlMXBoHaWgNRwABzdvdYpFvvqgXqfNVaVZxSqKFtvK/QiHXFtq22wOVEY6C0Z1g==@vger.kernel.org X-Gm-Message-State: AOJu0Yw5j8bVCZq1QPLyUY1prGkfseNbCDeR7MvbMfmY93UmIYfSTA75 eSNz5RBnYZqJkczunW4hrizR0H5G0ADro5eryEhQ5seh6Tv3ymJji6nun6hQiOg= X-Gm-Gg: ASbGnctr1TPD0V/JAKQl3x35vEgde6S1Lw27R9EWesDRdiVHRhB9IWhdhSHWSRJwM44 BqlGMIk2n1O/LlEAzC78zj4Zej1yPRyse/+Rw7bv7Arl9Rgn9idm40faEDMbOOk3Q0E29eRf1sg aJ/0YqkDfietG6APpoK2o3Q6FOoYw93ID1rZBxFyxrpGO++oxc6HIM/T7vgU2ETcfRIOMCaFHJJ NZkJffPiQ9ltbyHTmEq+pToJdqgZtFxnpiy8IkEagGmBaUn1oVAKqaKBP0rhazSWz7F0gGC83jb oef8Hz0v1WugulAVAwOlnB/Q/wswn6nsUA== X-Google-Smtp-Source: AGHT+IFWnLDcBs1YFh+lFtIQyXRCp4fpmS1qTnnxvwviVbcPJl2inWgtyLS88igyMkaBIy8IzkTXtQ== X-Received: by 2002:a05:600c:3b0e:b0:435:32e:8270 with SMTP id 5b1f17b1804b1-4362282e38dmr38316825e9.14.1734018240277; Thu, 12 Dec 2024 07:44:00 -0800 (PST) Received: from ta2.c.googlers.com (32.134.38.34.bc.googleusercontent.com. [34.38.134.32]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43625553208sm19992375e9.9.2024.12.12.07.43.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Dec 2024 07:43:59 -0800 (PST) From: Tudor Ambarus Date: Thu, 12 Dec 2024 15:43:45 +0000 Subject: [PATCH v4 1/3] dt-bindings: mailbox: add google,gs101-mbox bindings Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241212-acpm-v4-upstream-mbox-v4-1-02f8de92cfaf@linaro.org> References: <20241212-acpm-v4-upstream-mbox-v4-0-02f8de92cfaf@linaro.org> In-Reply-To: <20241212-acpm-v4-upstream-mbox-v4-0-02f8de92cfaf@linaro.org> To: Jassi Brar , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Krzysztof Kozlowski , Alim Akhtar 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, peter.griffin@linaro.org, kernel-team@android.com, willmcvicker@google.com, daniel.lezcano@linaro.org, vincent.guittot@linaro.org, ulf.hansson@linaro.org, arnd@arndb.de, Tudor Ambarus X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1734018238; l=3410; i=tudor.ambarus@linaro.org; s=20241212; h=from:subject:message-id; bh=2U3cIpMR781g/GfpmXVJzVTA2XVkQ1k3SY+wzu3Tc7o=; b=dj2pBC8lHn3zTW4F13RoMR+aFB5b4vyOkBgO8VAohZvTmW8QzdjekCEaA6kmDl97zt9qxO0Xh Ojms8YxxxiXAskMypQsCMWWvbcesVPqLxkYfimBf7PziCcQdg+RzkQ/ X-Developer-Key: i=tudor.ambarus@linaro.org; a=ed25519; pk=uQzE0NXo3dIjeowMTOPCpIiPHEz12IA/MbyzrZVh9WI= Add bindings for the Samsung Exynos Mailbox Controller. Signed-off-by: Tudor Ambarus --- .../bindings/mailbox/google,gs101-mbox.yaml | 79 ++++++++++++++++++++++ include/dt-bindings/mailbox/google,gs101.h | 14 ++++ 2 files changed, 93 insertions(+) diff --git a/Documentation/devicetree/bindings/mailbox/google,gs101-mbox.yaml b/Documentation/devicetree/bindings/mailbox/google,gs101-mbox.yaml new file mode 100644 index 000000000000..efc2f605acea --- /dev/null +++ b/Documentation/devicetree/bindings/mailbox/google,gs101-mbox.yaml @@ -0,0 +1,79 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +# Copyright 2024 Linaro Ltd. +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mailbox/google,gs101-mbox.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-mbox + + reg: + maxItems: 1 + + clocks: + maxItems: 1 + + clock-names: + items: + - const: pclk + + interrupts: + description: IRQ line for the RX mailbox. + maxItems: 1 + + '#mbox-cells': + description: | + <&phandle type channel> + phandle : label name of controller. + type : channel type, doorbell or data-transfer. + channel : channel number. + + Here is how a client can reference them: + mboxes = <&ap2apm_mailbox DOORBELL 2>; + mboxes = <&ap2apm_mailbox DATA 3>; + const: 2 + +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 = <2>; + }; + }; diff --git a/include/dt-bindings/mailbox/google,gs101.h b/include/dt-bindings/mailbox/google,gs101.h new file mode 100644 index 000000000000..7ff4fe669f9e --- /dev/null +++ b/include/dt-bindings/mailbox/google,gs101.h @@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */ +/* + * Copyright 2024 Linaro Ltd. + * + * This header provides constants for the defined mailbox channel types. + */ + +#ifndef _DT_BINDINGS_MAILBOX_GOOGLE_GS101_H +#define _DT_BINDINGS_MAILBOX_GOOGLE_GS101_H + +#define DOORBELL 0 +#define DATA 1 + +#endif /* _DT_BINDINGS_MAILBOX_GOOGLE_GS101_H */ From patchwork Thu Dec 12 15:43:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 849952 Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C783F222D42 for ; Thu, 12 Dec 2024 15:44:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734018246; cv=none; b=YunOSApgYwCRalGsNQHKQM2Ji+YYv3BpHFsxNobyTe6gZ4CXcWHa3QcokvB3ULgczEz207gK9g3PhZqhfXTRC/P5gsixnIMBR2A69K59Jvyt2xOfBS/uswIi27sy+2m79zWBrTIG6yk1LFREqw8IyrcdcFOKaGV/FGA6EOiwQ3Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734018246; c=relaxed/simple; bh=X/1icvZKJeqR3KnjovgE2kcPV2dM831cK3pJl0uCKhg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=H7mbRCjEJzrK7B9dR/ktbP81KXTlSqN/U/GIFhPK2k53qsSGTaEWg4oRHOuMT1kEJ+GTvdBB5lRDFJ3DhQle1l4IcMEdPdFxoGpsjy10GZTEr29t3Q0hZa34WlTnY7VhdCDpnBMIknIncfwQi0OPBw5Y/M324OVk6w8cKhbUCqc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=yWFTK5aA; arc=none smtp.client-ip=209.85.128.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="yWFTK5aA" Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-4361c705434so5633885e9.3 for ; Thu, 12 Dec 2024 07:44:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734018241; x=1734623041; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=fgpSzAOCp0YR2ZXnX79Ksyv6GF6rHp7i7F7WNiVo5as=; b=yWFTK5aAzN8x7yhsiBpdwFlTnGUPVX0bHdFjZDGfA2LUw17mY/OyNSQQHiyuCACXkv u/0niOWl29b7T/uJTuhaatuMMwpujEp33tnVqC1qlTmDeC04v2/KX/LfzaETqOovO812 jTy8TaPN0ensB3Kzo/YcD2cyW6k3wCO1rprTw83b1YhtS5l+sbDnvfyZ9B9HYHUPrq4L zFLVG4SV8bKcGDCsozVzkMZ9U48WUVn9/+zhsf1BidMYEWZwx/9cUQLLWb/DLhgcTVC9 a9kY7cyMkIi8lL27/YEz7RKXG/V1xMFJd7DVtbCb4OuZAGf7Qk5EKqGdZvp0wkCY4nHm 36Kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734018241; x=1734623041; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fgpSzAOCp0YR2ZXnX79Ksyv6GF6rHp7i7F7WNiVo5as=; b=QjL05RqtM2yu37XVJPvHXXJreQq89RKQB8IYU9GvCB1erMeV1+bCysFdso+aFIzEZg tKFX5BA+xFzsNN8/p68a0yghEVIH4LhT8YYLS8EYoubklsWssRIEtuOHAx1Ffopewfm3 VytSumnJQtKwmfPyNW2Je7coAQQN21GjNodCGsPxSW4jnABnhwM6TSMWyR3hwi81oPOe FvG0vyzwpTHqBHpewFOPQWrJ1KMCApDyyI/17dYXfS9twvKUVdsBGsuH5VraZgJGiCO2 QfDd6M4UxyBicOAPa4xOXdvLQJpLHQMycXSXQ3Qfi4FewnpxODQV1Z4A2J+1KSHfj4EN 5ZSg== X-Forwarded-Encrypted: i=1; AJvYcCUPPizaXDUUkIXDYQ8lCb852c1cyfDIQDrR+PInn38634b6i0kIAkFanzfOL51mH7HvOK7LQJN30NEDHMStuZHvFg==@vger.kernel.org X-Gm-Message-State: AOJu0Yx+zmUxDoW4OpDO++qqH+snmiTRX0INuNcBmbGNKGOO3gkMThpS ++q3qMU5PCM/KM+V7krxS5OZ/div4x2MvvIFOPYaoNEIfpuL88HWbixVhV9m5lo= X-Gm-Gg: ASbGncsDfA8IytxngIvspNwzbxO4wHY1C4qwRhgDDHvuc+T2xoPpMQtcdAx/wTIgX3z 4hxbO9EZ1nEpGQvPEvc5cp7cGDjt0wjD0MGNQdTc5YiOiEAZodcVSmVDqB3sKlouxe8E6c0qsaA oIhVCHP1rZzQxQZcfE1vU9NCeorjjCPwzWxqCuVOzHJgSloBuFWIrNVKI8p+7Qe2exmrThqRuPQ IIM7BGZ0+TlKnj4ev04Rhmjtg4KLmdHqa/ql+EMcdnsvotCysTv/X30TiBMOv7yFK7X9hvxug9j mbIy0AMF3NmTeUA6BVTM5aBHl8NHnTos1g== X-Google-Smtp-Source: AGHT+IEWWQ2O76/EM3WBb1JzX6C/IoVjeIbDF+l3rmuPNaQysakNoPGOaYe3UOaHVDHGjqG8GZxYxg== X-Received: by 2002:a05:600c:468c:b0:434:ff30:a165 with SMTP id 5b1f17b1804b1-4361c366d8dmr58750755e9.8.1734018240984; Thu, 12 Dec 2024 07:44:00 -0800 (PST) Received: from ta2.c.googlers.com (32.134.38.34.bc.googleusercontent.com. [34.38.134.32]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43625553208sm19992375e9.9.2024.12.12.07.44.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Dec 2024 07:44:00 -0800 (PST) From: Tudor Ambarus Date: Thu, 12 Dec 2024 15:43:46 +0000 Subject: [PATCH v4 2/3] mailbox: add Samsung Exynos driver Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241212-acpm-v4-upstream-mbox-v4-2-02f8de92cfaf@linaro.org> References: <20241212-acpm-v4-upstream-mbox-v4-0-02f8de92cfaf@linaro.org> In-Reply-To: <20241212-acpm-v4-upstream-mbox-v4-0-02f8de92cfaf@linaro.org> To: Jassi Brar , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Krzysztof Kozlowski , Alim Akhtar 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, peter.griffin@linaro.org, kernel-team@android.com, willmcvicker@google.com, daniel.lezcano@linaro.org, vincent.guittot@linaro.org, ulf.hansson@linaro.org, arnd@arndb.de, Tudor Ambarus X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1734018238; l=7613; i=tudor.ambarus@linaro.org; s=20241212; h=from:subject:message-id; bh=X/1icvZKJeqR3KnjovgE2kcPV2dM831cK3pJl0uCKhg=; b=yM7Eixi7/+jRwS4A30NZ6pMK4Qjl4GOfEY68cbQpfUrNnVrg4g72yuv/ONzmAJNyvVzWwoKB/ anAqJt613BLAvWKUm3/Uc4dEsJuYK94m24qDW2oQqChuUFoU0XgcQQE X-Developer-Key: i=tudor.ambarus@linaro.org; a=ed25519; pk=uQzE0NXo3dIjeowMTOPCpIiPHEz12IA/MbyzrZVh9WI= 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 | 184 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 197 insertions(+) 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..9d875806d0f9 --- /dev/null +++ b/drivers/mailbox/exynos-mailbox.c @@ -0,0 +1,184 @@ +// 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 +#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) + +enum { + EXYNOS_MBOX_CELL_TYPE, + EXYNOS_MBOX_CELL_ID, + EXYNOS_MBOX_CELLS +}; + +#define EXYNOS_MBOX_CELL_TYPE_COUNT 2 + +/** + * 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(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 struct mbox_chan *exynos_mbox_of_xlate(struct mbox_controller *mbox, + const struct of_phandle_args *sp) +{ + u32 type, id; + + if (sp->args_count != EXYNOS_MBOX_CELLS) { + dev_err(mbox->dev, "Invalid argument count %d\n", + sp->args_count); + return ERR_PTR(-EINVAL); + } + + type = sp->args[EXYNOS_MBOX_CELL_TYPE]; + if (type >= EXYNOS_MBOX_CELL_TYPE_COUNT) { + dev_err(mbox->dev, "Invalid channel type %d\n", type); + return ERR_PTR(-EINVAL); + } + + if (type == DATA) { + dev_err(mbox->dev, "DATA channel type [%d] not supported\n", + type); + return ERR_PTR(-EINVAL); + }; + + id = sp->args[EXYNOS_MBOX_CELL_ID]; + if (id >= mbox->num_chans) { + dev_err(mbox->dev, "Invalid channel ID %d\n", id); + return ERR_PTR(-EINVAL); + } + + return &mbox->chans[id]; +} + +static const struct of_device_id exynos_mbox_match[] = { + { .compatible = "google,gs101-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; + mbox->of_xlate = exynos_mbox_of_xlate; + + 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(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 = exynos_mbox_match, + }, +}; +module_platform_driver(exynos_mbox_driver); + +MODULE_AUTHOR("Tudor Ambarus "); +MODULE_DESCRIPTION("Samsung Exynos mailbox driver"); +MODULE_LICENSE("GPL"); From patchwork Thu Dec 12 15:43:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 850951 Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A72A5223E9C for ; Thu, 12 Dec 2024 15:44:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734018245; cv=none; b=sogXu12K4FZJCEEil/qSx+Y1a54yAfo1PfsynaJAIyG7YvgSmJammAVIZz0RC4RoFk7vk1e2hXEGrAtUxr34YNPLe2aca3gZWA4ok/5C6dY6HInTj3IqW3MBNQjIJconKV/OwZgcQ5E/wQM4zo4UoWcyP5rv2Uqthn6fq5JQi1g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734018245; c=relaxed/simple; bh=8mV9HZFeUbw3Rtv6RCuQBzzPvwJEiDZDgZep1nTSp4k=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Y/8kec5YLwjBBaHiHf0fw3LvVE8lQF9g1GlAgdnZyMpRouaOP4u9gRy/jVwN3KBUer9pe8bM3mw03gLQekO9rJW/BxY8KW5LAK2UehvzONnH4iJTwwTFuEinONLKwEbbeu8jreTvg+9GJsdPdUWZhpGY2ho1Y/NnAbVruozAWuY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=KzKjtM/v; arc=none smtp.client-ip=209.85.128.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="KzKjtM/v" Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-436202dd730so5555795e9.2 for ; Thu, 12 Dec 2024 07:44:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734018242; x=1734623042; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=7jmpxBMmEPk/hDGZYt5vcaNwz+hoDqezVHu8V6ZILUc=; b=KzKjtM/vAxUhC/ipD/OXH+pEBuTLz15oWR50i/f8J3Gvc3RMiO1PV+3NBMwtKyXcRm gKKCfSSLNH/H2+vQxB39h6EDkKNDTE3Af4j+twoqFH5hBrKaKnou8bnhyDreezltbemT ge6SYujkqjzZqayzu6yeW9R9Q5T7RhJhplQT4ucEMnn0fi9eARa3Qpa9aNmQEH70BEqU inFfZavxD5ajisWpAO4R/UniJk+e/aNLRrdAPnCati1sC4K8AJzhz+J/hAlD3t+vHK5b 17B4Hu/R/D5oCpcX7cZ2dlg9OfZ1O38kw9Sm/eYUqelYzuIlWuIlN4kZVF/OAnfCrLt3 dL2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734018242; x=1734623042; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7jmpxBMmEPk/hDGZYt5vcaNwz+hoDqezVHu8V6ZILUc=; b=REONd0VjG8qTCu7tZw5juQXnZOt1T2NUoaH7/72mqALTxzAZa9tjiIiJtgCnLJtIeo h2kipcLfyoRDZ3R/kj2PiPH9ce8fwwKlHFA8+R8wuYg+KO855k+8Yc/fksp/5Lfmp9E6 01dx4MX+hSmsU1HIKKcr+KN/BZY/gkEd4MMsUan/Pd7702OlEdhodOWhXvQlJAdpWgCa yP82Wy00QSkcX1Qm3YFTS+QSN14fsbxUbVrMNKPcmaBAWDghKsskSfHyZHjQOjkfFiuI ordV95gyuO9PAATbQAalVver8rk3YGKlyo3q9OauWmu++CJuxuaZwtXuv4di6EpbFRN0 8QQA== X-Forwarded-Encrypted: i=1; AJvYcCUgi/opS9u08XOeEjpuReVryH0A0aE0c6FMbimzel1UxjcTkurqqXsG8DfFJAQVif9S2uuwoCZ6rFwHA0iOjHSAIw==@vger.kernel.org X-Gm-Message-State: AOJu0YzhMXl1s0qdCRZFXqKi2m6mVoAdHDOeyPLdz6k2unHAxFW5vUmQ Gkj51r8vZB7I8uqmwBBXMbQjHEe4PqjzIeXo/2JM/KsLPRQoSpvJShwuwpvmy0Q= X-Gm-Gg: ASbGncvrfan0gV9jLTkgkFXjL6sVRqEwnc6h2Qa61FobMIB2K6tbo+Mzc1VDCMUQpu2 d8calKzLVeLKOO6kE3Qpuecsbu1R159qYpM7UQ+W15Es92c6feuOLHatP7QxTfKDkIEjzlQhQAA 32NhXJTekLL5l+YCeHsLrNZBq+bYuKVfhMlVmUNdRL0hi7nsOOSWT2UqHOQOY+fcHGdPzQot1Jq o/WF9mm7DGw7XvfGFNgkVF08U1QUDmHgirmlXN1N/WyuPDEE+Db+Jz52ZKnkSI4wSt4ZJXJjgxf 6L0xPh90XBLcv31RfU0vgJkNxNwGoe+OPw== X-Google-Smtp-Source: AGHT+IHcg+gCbENXrOnWdym/CCFPs4XNPvTW5TwhNoQhFdCZwrQBeC1rscXUkfAVw1V8vMafB1xEDw== X-Received: by 2002:a05:600c:3d1b:b0:433:c76d:d57e with SMTP id 5b1f17b1804b1-436228236bfmr33478765e9.5.1734018241710; Thu, 12 Dec 2024 07:44:01 -0800 (PST) Received: from ta2.c.googlers.com (32.134.38.34.bc.googleusercontent.com. [34.38.134.32]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43625553208sm19992375e9.9.2024.12.12.07.44.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Dec 2024 07:44:01 -0800 (PST) From: Tudor Ambarus Date: Thu, 12 Dec 2024 15:43:47 +0000 Subject: [PATCH v4 3/3] MAINTAINERS: add entry for Samsung Exynos mailbox driver Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241212-acpm-v4-upstream-mbox-v4-3-02f8de92cfaf@linaro.org> References: <20241212-acpm-v4-upstream-mbox-v4-0-02f8de92cfaf@linaro.org> In-Reply-To: <20241212-acpm-v4-upstream-mbox-v4-0-02f8de92cfaf@linaro.org> To: Jassi Brar , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Krzysztof Kozlowski , Alim Akhtar 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, peter.griffin@linaro.org, kernel-team@android.com, willmcvicker@google.com, daniel.lezcano@linaro.org, vincent.guittot@linaro.org, ulf.hansson@linaro.org, arnd@arndb.de, Tudor Ambarus X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1734018238; l=1216; i=tudor.ambarus@linaro.org; s=20241212; h=from:subject:message-id; bh=8mV9HZFeUbw3Rtv6RCuQBzzPvwJEiDZDgZep1nTSp4k=; b=yeuoS/sNPk65uWseJnVuPuzWQtD58gzxjfTW1Kw/0dd1iXCyllusrv6nI04K9dKfxAk86WG2E olThScAHX1mBffXV+8E8qd53mstn3yY00cjPYRoq6hqenWh0IjLvpyL X-Developer-Key: i=tudor.ambarus@linaro.org; a=ed25519; pk=uQzE0NXo3dIjeowMTOPCpIiPHEz12IA/MbyzrZVh9WI= Add entry for the Samsung Exynos mailbox driver. Signed-off-by: Tudor Ambarus --- MAINTAINERS | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 17daa9ee9384..b3b472771476 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/ @@ -20715,6 +20716,15 @@ 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/google,gs101-mbox.yaml +F: drivers/mailbox/exynos-mailbox.c +F: include/dt-bindings/mailbox/google,gs101.h + SAMSUNG EXYNOS PSEUDO RANDOM NUMBER GENERATOR (RNG) DRIVER M: Krzysztof Kozlowski L: linux-crypto@vger.kernel.org