From patchwork Tue Dec 17 09:40:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 13911521 Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (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 746BC1DC19F for ; Tue, 17 Dec 2024 09:40:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734428450; cv=none; b=Ofku4mXCBPJW3lF2yWJGU7g1nwOvL+QZEI1uLkKUOUphYDfGEg8rAC/4vOiZ1voSHeDTukojXJyL2FOXHjitd3F1fa5B79y/MmeFd+cvpQKbrxERXo+z+A8mXCqcWOf00CjXaPi9+bP4TrrifAym1LGXaFhW9jQq52SxOa7wwCs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734428450; c=relaxed/simple; bh=oGbadS/EXFOmnPlUbzd78fQ8Sa6oboYVtVmK/tk9ZNU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=OdXjH/xtLpmBVipR+QepgEi2KewmGi2J6FCXpDA57N04MxIO0OJ1Sisg7/oR5AW+M9wY7K8jaMt96Ls2f2822oFs+knOqzfu8JZYEXAMMbDHfhdeV9L9fezWJ8Fmai1QKW/CrzNFgPz4UaakXDaJw6BYoFNEk3XIPWrX07dphYc= 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=LHI0jIgx; arc=none smtp.client-ip=209.85.128.41 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="LHI0jIgx" Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-436326dcb1cso24604195e9.0 for ; Tue, 17 Dec 2024 01:40:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734428447; x=1735033247; 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=6vhnMvIq2ObCy9hYEzmIANhln4VKtCIO/wzhfP7ECA8=; b=LHI0jIgxOvMmgbt4G3GOcTiXnd5gY7E/xl26Hr20B1QsDylu633OqnhE/ZSE/DSH+g f47hvA35EYPfyuSXZtGPbi6DV7ehRVuvrVKl6NBq4rtFr7MDBKzTjemfs2pGp8Xhvwjf hwoXbxvU62D+AYVveVh6u+cCz2/km6gnG151uTIqiW1pTyUgB3RPb6kyAxz/QodrjTcY tFZYBgZDSndq1TBtMTX63UN+XKIfLG/5ukMRpOa9M6yDAMSqQ5PsDlP2w5/Soxk+tWnA YzvgRElqnr6VkyYZcHcVFHYcr9rrVFQuQJdizMDM5cYMZs6q0Df8pxbHZaN9kcdnc/iI hQ/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734428447; x=1735033247; 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=6vhnMvIq2ObCy9hYEzmIANhln4VKtCIO/wzhfP7ECA8=; b=sH1xf7g/xzHHT2miDiTQ/5cP5jKAvXerHsMoLsz/WdcepCxkK4qIUnztM9gEQV6gC0 ppXEejnGpcZBQQ6d9XmOoiqAJQoTyDxPsWjooHKpWbXa4Wv9gTCOo+ssZb3zCn4xFvWj sGdjj2ay5v0mTzGiV01ARKeSXi8eVpvDDdPvVoptcFVeW2AQIKvtls7HM/M9n85ab7OR F6LCC2+qK3fCuxpjLXD0rleBh3lRgiyOPbXUMAZzZYYEvZ7AFJD4z+MlllmM3UmfV6mR vok4vhwQ2BoqT8TjTDfYm7H+C63o6jH02GO+mHp51b8h01URBw0d8kNKMIFqNuy5sftw VEVA== X-Forwarded-Encrypted: i=1; AJvYcCXIpzhRoLz6BYmYUQwsKOZqVRuwFhxGUFL7VpvMyqXSfkBG0kNnI42UJmO1Ry34ZbrHIGMuERev0w+ZqVwaNkmxWg==@vger.kernel.org X-Gm-Message-State: AOJu0Yyk5OQyCaoiEu5yM/anuZRaYhx58TEB1tKxl4Qlw7g32VExIPze ECWqCeL9flVBya7nTsyjJRGqXUFGcpCBBjTlFlc7ClKULkXgatPFUcOKB67NIH0= X-Gm-Gg: ASbGnctu/1KCqfYmR4wdsrjGhupk5fRp9iwSq909sQA1dtgMYA8pDaxh+VwZqOYqbgu AR7JH+CEGCQoHg/7x6KlmHecoHBag3WJ1sJQtamBQUr5XrDsxGqbtWCVEfA13++v6vpnPnYVs5X mfokllAw2UfbAROX52G52Vm/0issm9ssoZAY8t05wcYtq8/C+hTg3AQdFO8KzYSqt5dvOGTFQlG uk+znLjnwfSRgT0fl5TSOnX2m3hPNmf4g7rE6mTSlFQfCVJEMCVxWIFbnHoMHGw6xa7LhNLkEhx jGq6zCvTFbNjdcD3y1L7z7sSj1f1MwiKbg== X-Google-Smtp-Source: AGHT+IEypn72K2XDLMunXNz64L674R1qAE0jbL8OdemRX1WFc/rB6qj/zLgF+xCW8NIwgy+CMsESIg== X-Received: by 2002:a05:600c:378f:b0:434:f335:83b with SMTP id 5b1f17b1804b1-4362aa155c1mr111751935e9.5.1734428446754; Tue, 17 Dec 2024 01:40:46 -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-4362559ec46sm167475755e9.20.2024.12.17.01.40.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Dec 2024 01:40:46 -0800 (PST) From: Tudor Ambarus Date: Tue, 17 Dec 2024 09:40:20 +0000 Subject: [PATCH v5 1/3] dt-bindings: mailbox: add google,gs101-mbox Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241217-acpm-v4-upstream-mbox-v5-1-cd1d3951fe84@linaro.org> References: <20241217-acpm-v4-upstream-mbox-v5-0-cd1d3951fe84@linaro.org> In-Reply-To: <20241217-acpm-v4-upstream-mbox-v5-0-cd1d3951fe84@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=1734428445; l=3405; i=tudor.ambarus@linaro.org; s=20241212; h=from:subject:message-id; bh=oGbadS/EXFOmnPlUbzd78fQ8Sa6oboYVtVmK/tk9ZNU=; b=o39r/a65k4kXSV5QfRaDOokAx5BK2B4HFYrhAv0oPz7TlgqFXptplibdlk3n/NcgfUf68gxSi 1BS6mafZikSDarVm9MLWDNTdW21MMS5QWgqUCvz37F8c5DiFzt9IgE/ 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 Reviewed-by: Krzysztof Kozlowski Reviewed-by: Peter Griffin --- .../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..bc7288923795 --- /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-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 Tue Dec 17 09:40:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 13911523 Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (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 4F35A1DE891 for ; Tue, 17 Dec 2024 09:40:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734428452; cv=none; b=G0daquDL6kdumYq+Cx16KUZ2IoSbswLbydH9UEgsbQy4VhkVBCmouwzho/Q7xW5uU9WhufgMZdiLnikZ26eSdPpLybm092UfHVMM8NWdvjcE8rothp+WV6dVzHtdwrjLzOP7aEAwpUEuromSEs/BCPCuP2zv50sphTLzgQ48mmU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734428452; c=relaxed/simple; bh=ch9bLEDAwuuM6wIBFS8dUZsQMo2a87ncAz/QuVGegyA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=FHfbj6Kz/ViOlKwfVzgA3RHBiVxDYf8XJsyhcGrl2O1DO7tY74iOk4dsafybleu9oaPlJbkZZwEropMotDLktaQ3LzXfSDi9Jp4usRUjJ2S3P2oadJlVw4o0VFYrK3ZmUgKRTS/ZBjQckdI4FtFRHLA5Ou2bJ+qJY/PhCROCVWA= 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=TV70rXLx; arc=none smtp.client-ip=209.85.128.49 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="TV70rXLx" Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-436249df846so35191915e9.3 for ; Tue, 17 Dec 2024 01:40:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734428448; x=1735033248; 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=6/Djx8gAdq+6Madviq7gLnC0w9gcqNrwEJGOMmsFz5k=; b=TV70rXLxoXI4OgqPIgHXwRC4ZGgK9DLlEj7xOYzuYvQyPfBQP/C45RszQPIJLpPN9f G2C/3ra/labXB1h8soDzcqv3q9Pyiq7hJZ6LA9NM1Zly5HTEA/N4eUernSDJtB5E4qpG NwpPMm2Sg+6BShr0zzg7U2JVC5JEd1FzE+5JPYWZQ2sHLc6GeVJH96LUpF+3sq+u4pZ9 zWTrpDaUScln0ofJkadOAxzE97WFkRX1FqlAOsLEwbAS2sRFl09Ae8tDJiuNd0PyzfnD ZISdkdRmN2+WXaEettEUS9H8JzxrOlDqx9CFmPoE/vPpBb7BEYS13XzDNfhT4FvU+pK8 bjug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734428448; x=1735033248; 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=6/Djx8gAdq+6Madviq7gLnC0w9gcqNrwEJGOMmsFz5k=; b=BZ5k5aqzpAnwpNv8AOm7KvXbPaQMlXi8yj7wCVHChyyIe1VQXVHeYMhoz2oo19LY/W LvR+zPxdpV3ybh8hdMkUjhmdrUiSaHYL29TWrmT+LyZtotJ8imxUme/xHXjJV2+PTPZ1 t1jZDQkR6SswJJF4UjPAq7zioTQag6FWLVfVG4MB/ajBF815bwgjWeTiU6OFs6zYe1D+ WRqUMr3E/gwQtMVUAqcH4mTef99HbPBstB3EqqHpAfKLMD50gqU0wVK6eYr05QwCYez6 LmqoB4r2+jl2aYOLyHt7AaGWwewoxBd1SmA3kBUV+cfuEtSmysORMaSSyLM6s4uG8wrY B9jw== X-Forwarded-Encrypted: i=1; AJvYcCUD14PoAz+5RLaPhmE9vdOuvWtu22cKAvOZbI2aTUPAsYNKec6jxdGro+6nnxs73FaCEpewfETjZAMF20qAJQAMdg==@vger.kernel.org X-Gm-Message-State: AOJu0YzI9c/kwi7oYOrrGWVy5AD7gvKQjzS5CMmL45K2OV7mCDRnPlse Fe4XMN2HCPnvItqS4ZNoje5S2T4fhiup/9GEbOvQ6L7b4Zl87P8256QhVxeXE5M= X-Gm-Gg: ASbGncuglB44V/efzC2djKkmKG6zNdk+QbPVTe+59vlmppGQUExmyOARGwChHCVXJh+ Q90haW277WXQFz6Vso9O4kApsQq5endngGpY0IkqhM6SFbCNjgeuVHMO4zUjFYCaokDOOxnYMRB qIsUuOa7STnX6eWr9oKzdImT18Hxu+gj+d0x3+8+Hh7f+zkW8iB4BVypYU/NhAtTR8y4hcqT0GQ 8RI+yfqI0UA8URGSBLQvyEeYJf0pkRbwWl39wSQanAzC3o3b35B2KUa5VB0fh+1t+3zj5Eot4l9 xxxsvZ4LxyPtDuuMZdTLb8kNrpYi4p+9PQ== X-Google-Smtp-Source: AGHT+IG+k2qI5CN/3b8k5L/klKgTjAfvpmyras46GJtNglWrMmcnTcB9ds0ar2l+dqxP5ENqco2mOQ== X-Received: by 2002:a05:600c:1e14:b0:434:f1d5:1453 with SMTP id 5b1f17b1804b1-4362a987b06mr149065085e9.0.1734428447704; Tue, 17 Dec 2024 01:40:47 -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-4362559ec46sm167475755e9.20.2024.12.17.01.40.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Dec 2024 01:40:47 -0800 (PST) From: Tudor Ambarus Date: Tue, 17 Dec 2024 09:40:21 +0000 Subject: [PATCH v5 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: <20241217-acpm-v4-upstream-mbox-v5-2-cd1d3951fe84@linaro.org> References: <20241217-acpm-v4-upstream-mbox-v5-0-cd1d3951fe84@linaro.org> In-Reply-To: <20241217-acpm-v4-upstream-mbox-v5-0-cd1d3951fe84@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=1734428445; l=7613; i=tudor.ambarus@linaro.org; s=20241212; h=from:subject:message-id; bh=ch9bLEDAwuuM6wIBFS8dUZsQMo2a87ncAz/QuVGegyA=; b=HWP8gwFS9ptfi3AaIeb3AKQ+iprpG9u2wio+GD624E3JpOIVeTIIaXaABprepkLT1aF8Rh93H q2JPx5KG9vxCho8aFuENRfcLF0k2Zb0bFQT7EFy2timfM1nk31d5rbQ 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 Reviewed-by: Krzysztof Kozlowski Reviewed-by: Peter Griffin --- 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 Tue Dec 17 09:40:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 13911522 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 147BA1DE3D9 for ; Tue, 17 Dec 2024 09:40:49 +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=1734428451; cv=none; b=jURK8IQvnT5e2iR+lRhNFHIOfcWS+j5BueZQQiQjk5kjWSvhWJcfbkXG8Yye+BLN2DzE0yhhSmfvX9y/zaZxcqYgFfKjvrQaqywXRsciKiASg8id3B4yn3LzyrwfgIcbLclaNMMDLJmFokInCIdxIwe6JD/TI6Bxd33hp2qm/Ec= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734428451; c=relaxed/simple; bh=9mXBYawofpPepE2BF91P/arRig7nezklsaAdla8ShbI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=a0Yxk6MHDShcmn0wNtfy8RiP+/XMIvhYSMkXcts0vgaEnNfm4TVMQ355LTFaAwgB15hkrGNY905YVkBe8UY0HFSktTJEy0LdenmtBNvAyGvUCKSKiIuuLpJ5o5qpBtWlZaFTmuVaB44lqELwY0VKpxOmHJP1gzY0zi/ivqweHV8= 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=tjtpFszZ; 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="tjtpFszZ" Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-4361c705434so36403715e9.3 for ; Tue, 17 Dec 2024 01:40:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734428448; x=1735033248; 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=1rzC8vvycH/Cp0hUw6Wfj4qRoaSuoHKIpGfYrmHMjP8=; b=tjtpFszZBqyEWbGzafu9eK0SUpTkJSX3dM2pIUF6obToLzLDDqttBgCpOOwvKRwk34 8g1xd6Tf3hY77JRmUguI0+PvKA+nvGfXZGhn3TsQ47ttT3qsJzuO23JJxDGN/BfJazW2 rev1is6gfjvMCZ1jK8cWbiTWs+UPCJWmx/NQlspo9yeDOyfihG+k8hGGrg92hgGhUb8P xejFm3xFgMuOpkiL2ZGDOW750hmSZOiDlW1RiHzQmvCWxKJUrZBrEio2E0jcpnSSD0ri l/Avs/5DhVJ76I4jYYpONbUDuFUGLH/6SpaX/yZSEG0dDeanwJbg7VweXrRLuJW3HUvL ylcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734428448; x=1735033248; 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=1rzC8vvycH/Cp0hUw6Wfj4qRoaSuoHKIpGfYrmHMjP8=; b=Ausd8S9LyYHVNnCHu0BX3FnjYG/lNQDXm6iAYYPbb6JaK1PIGTkjEWLpaA/7aJDpLn 485YujgfUa/9M8X1HHn9Ht1zk+L1teW1U8jOPZlGUFsE9JTn90qD81ynFfgqxUlquTLd bUfd8/ZrwS9w1EPvaDzMlZEsZW7M50Z1ahhe9ZSAi1p1QoSvYXfHqYwK4LBu5eSdlOKn A7Q6g0sFfdHSKMjiJZqBn3UqyhkPPdhLFCjmz/xUJA1QACXXObxx2x37U7nFS8/Ryz5H wwq+GMegRvJoMkindxtgTcnCvzNXrw6f3wlQeUi03nuOaTHY/QrMAgZHKXvXqGgmJe1U CIog== X-Forwarded-Encrypted: i=1; AJvYcCXpwRwjGodlM/8PnzrV6X6Ug8uXacsi0g9g04wqNxLJgUXSt/B6HJc1TanrbPtOf2lMFV5yMjCmvT2ARs8AKqr2rg==@vger.kernel.org X-Gm-Message-State: AOJu0Yy6dFsKhBaf+FuluGfojaBnZzKhPb5xQl1JSU/MWdS/IwYiqRPq hdcSEU3jPTkMq9/LQ2s6zaqEpNvGhgZuMbpkZxmNPPTXouFYQ2sAqdaKVQz4Rdg= X-Gm-Gg: ASbGncsw5LGfCluQB1mYwbUBwpVmqfFTu65rEk2lK0rWvadDaq+epAl1fQ3ndSEB0KP AzuqWQukfqvnXsXlD0aimz8zWoKJ27sfj9r1ELUCkx8pncLaV16qBaUnvqOf1/3okVju5YD2KgR UzgysNOxKaUMvBqb7E8GmmOEKx67v4gH5Btvzimx8HWnR1fQN/VvnxqQFAaXx1jRL5UiR7BmD0Q NXwe7KGA4F5B17ZI7rRygt+4QefV46h2URu7tw8LFWxGt3SZEofLf0EZw12fVtdl7zQHDg4NKHX 4J5pdxoJ83++fsBvX67CZOokz5dly6h/BA== X-Google-Smtp-Source: AGHT+IGdL77URRUUDel/620o0E15cA6VUq4GPfffaHhqeuBMk65coFdHp1nDn5rm38NPj5m5jvSG6g== X-Received: by 2002:a05:600c:1d1f:b0:434:f0df:9f6 with SMTP id 5b1f17b1804b1-4364767f087mr28742535e9.3.1734428448580; Tue, 17 Dec 2024 01:40:48 -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-4362559ec46sm167475755e9.20.2024.12.17.01.40.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Dec 2024 01:40:48 -0800 (PST) From: Tudor Ambarus Date: Tue, 17 Dec 2024 09:40:22 +0000 Subject: [PATCH v5 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: <20241217-acpm-v4-upstream-mbox-v5-3-cd1d3951fe84@linaro.org> References: <20241217-acpm-v4-upstream-mbox-v5-0-cd1d3951fe84@linaro.org> In-Reply-To: <20241217-acpm-v4-upstream-mbox-v5-0-cd1d3951fe84@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=1734428445; l=1216; i=tudor.ambarus@linaro.org; s=20241212; h=from:subject:message-id; bh=9mXBYawofpPepE2BF91P/arRig7nezklsaAdla8ShbI=; b=Z0AXVvEDLX3dGQQUU6S7FG2YiVuEm8f4RKNyhHzyRa5O41uaawalfgmZW9iW5t8kzyPwvDlhN g3py0lZDyAoDARc+CygZuhG7TGX1DhEtmkfDDEsBIZmbJzbmsW3NitI 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 Reviewed-by: Krzysztof Kozlowski Reviewed-by: Peter Griffin --- MAINTAINERS | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index baf0eeb9a355..6bef5fc5e4ee 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/ @@ -20717,6 +20718,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