Received: by 2002:a05:6500:1b45:b0:1f5:f2ab:c469 with SMTP id cz5csp815511lqb; Wed, 17 Apr 2024 11:28:30 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW8erUGRAtLqPJ5JwH4u4i2D+tcF7Mwi6IjmoCvjPWqCwr4v8l9qiPbGsctMMw7/s2GBhQv1irArY6+Sl9FmBnXA8gAcFu4E5/AkBJTFQ== X-Google-Smtp-Source: AGHT+IEpxe4S7dOAKXWEnjmt2FOOndHre4uCgltNIdKhU2NooqMH3YM5/vHpxxntGJg2IVq4zJea X-Received: by 2002:a17:903:2351:b0:1e7:d482:9e32 with SMTP id c17-20020a170903235100b001e7d4829e32mr437448plh.7.1713378509403; Wed, 17 Apr 2024 11:28:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713378509; cv=pass; d=google.com; s=arc-20160816; b=DjWvraD19Tv1UixNj4nnCiVVhwhzQMk2jv5d+yH6S6X0WntDi1T0RyP/s9bRJB/hnF tVuIYmq4Pw+mPGGJ65gBkSRNQ4q7hK9ErpQnYF988qi6rufjLhNVo2/yjgAnS9eqtSfR 7KMtnM0CjmM3gGMU50WBIitjKSRSS75xHSGGFdK5jbgJY+8y27vniWDgNBsowZKj61Se n7EPizICdoYSGuIXqaAIcA698wPdB0umfhDchImoy2k/q5Zq5pC91fh6ZL/opUSnkkbk /LlY1iSuZg3u6VvjemMLKfYoO+Fm7SExIB1divRmPDzTBnwbw/0tiCDr1pD/PxDUdS1U MFnQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=lMJDNkP5na580+qTNDtzkCRkb8re5nWvcJtefU2xHjw=; fh=LOaxW1gE+7qFzdALePB64E/Ij9ZnoeSwRI1Or8mUxGo=; b=wMpWpeNpDloZVPasRny0qPsInkHP9GHETIZEJuVqaihhZ1hGoWS0NSsPm3EYK7gc0O tKnvENGvriid2Tp5l3S/jk/AnbozAlu1/lpUzB1BdWaU9yowDwyLS45bBtoRVIjdZB7Q 39jtFD4qtAOf2rWz76irEKm6sHaW62PT3He3UZqu3Whj042daQfS50CcSoOfUvLa24vT ECRpi66EQ+dVsvaGbG+ixfM4q0Dd8FFkiTM0jSP8YJrqLUXBAmx+o4UP8c4TDIdxYw7r V40vX8REq7GcY7/OoS6I6CjeUzgx3nSH550FnDcDuAF6+PTK79wIZcHtQNoWsw2sKBKU qWGQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=N9g0lEyf; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-149051-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-149051-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id y10-20020a17090322ca00b001e4a87f3424si11939097plg.445.2024.04.17.11.28.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Apr 2024 11:28:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-149051-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=N9g0lEyf; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-149051-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-149051-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id B3CFB282B77 for ; Wed, 17 Apr 2024 18:28:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1FF45173343; Wed, 17 Apr 2024 18:28:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="N9g0lEyf" Received: from mail-yb1-f174.google.com (mail-yb1-f174.google.com [209.85.219.174]) (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 AA00B174EC0 for ; Wed, 17 Apr 2024 18:28:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713378488; cv=none; b=uNrk10KIajZcRolrvmkbiRckOy3tarMZM5gbxV4ZIxP2uxKJBu4Npl++0TpA+GBNSP3UFP/o3ajDoT4A/NOgWkg2EZNA/XKNANLJgOwH9Qeh3c375Y6F1uzO4f1gh4DhFPqiPV81lf75liqYh1MjdJk2+lYCGSgLBfP6V2BwHOI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713378488; c=relaxed/simple; bh=wmN8h4ozB0UgeEBmo+osjEtM80kKRFiGaQdWkFBBeZw=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=bMKqY3ys8U8mqD+hH0OTQYZaJvcnk6edQb1CIAmrmlguzhTvkx6rKGpRSkpd7UDgBil4tCObpDut0cL28XL2prbVLazrrPyk1dVQBX0sQccjfwlOcSY9eZmfPg0DFyQ5Gf/qT2G/bfbvzArjcTRoPOTNvj7RITXQwfKmC2MG07Y= 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=N9g0lEyf; arc=none smtp.client-ip=209.85.219.174 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 Received: by mail-yb1-f174.google.com with SMTP id 3f1490d57ef6-dcd9e34430cso53209276.1 for ; Wed, 17 Apr 2024 11:28:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1713378486; x=1713983286; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=lMJDNkP5na580+qTNDtzkCRkb8re5nWvcJtefU2xHjw=; b=N9g0lEyf+Wd+sxViMrtYayfC6wep/Wnz4cPJeau2olF0rFVNkcGrGIWZDpAbN4qka2 N0q+sfEl9RS7Qgs25KpK6M9tDOUyF8Vyzlk+Iq7xEE+UDI8CkNowev82GsF39a3NJlrh HLm986gWDS7/ER1ZJ1mVzAp7C59StJ/hYHiXOBeSsBPU/Z3iyFHk7hzO5aAUHCBPnqZP iwti9xibQwcNaHvakSGiWizfrCXHCWu/5X7Hicc1Rd4QLX0mKgH8Aciscxb6eXipcM9U 9o+JU2JSKIzV118CWgWavweHwuAQk/X3KWiHlpKyBCDsOq/shsLCEsbaOH0F5IgjgbAf hR7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713378486; x=1713983286; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=lMJDNkP5na580+qTNDtzkCRkb8re5nWvcJtefU2xHjw=; b=sY5e8FlAN0m3JcxSnfUs9FP743baKyownfv9mzp7YpLK28Mhz6b41I5NtrY82UOSJX fpDyF2mZSbqyAYJyWze5qmkyPlgDZD1YYLtA6LPE2QnxEbxAUF2gYSE7zWrXjuS3FRyH RwJDcSpmMyZy7H4JsQFTLgxL8NyTCiNi7zYXy5Inq33xbEC6k94Jw8CScnqa312qxep5 smvmyF64iMprnEkZfkoE8NwykZCmWA0g7mAMec1bsqNNj26WRM1QAjn7xOoR4Rt21GhS ht9xR7J22MmttDORYmJz2xgi6LX1lXV+gly/gZY60ctMeBbfBHM7IP3Q9PBrgVL5Ezjf uwBg== X-Forwarded-Encrypted: i=1; AJvYcCXbs4tiydg8zUO+tiZEUEVMCP3rgQfsGGNAWZnpYuo1JuG5JIR/VG8+E+IjtAZ/1OsOcHN0xbMv03HzRY3iLEAf2UGfW/x6+GnOrtbR X-Gm-Message-State: AOJu0Yy//7VTRtMt/RR31iDmJJW7MjO1/2XnLTrgO7/wXnwyPcYRJKZ4 NK6k7zT1N3xJnbNVfPJTTXbRSHBCHEAfuBEwGbj22nYFHKFum+Pd0UkMjr8tzPTFqAjJQJLEMX3 WNBVuCXLl8Y6mZGdrgptsEYv54dlV6aF44+HPUw== X-Received: by 2002:a5b:c4e:0:b0:dcf:4663:ecd8 with SMTP id d14-20020a5b0c4e000000b00dcf4663ecd8mr208017ybr.8.1713378485731; Wed, 17 Apr 2024 11:28:05 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240417132856.1106250-1-quic_sibis@quicinc.com> <20240417132856.1106250-3-quic_sibis@quicinc.com> In-Reply-To: <20240417132856.1106250-3-quic_sibis@quicinc.com> From: Dmitry Baryshkov Date: Wed, 17 Apr 2024 21:27:54 +0300 Message-ID: Subject: Re: [PATCH V3 2/5] mailbox: Add support for QTI CPUCP mailbox controller To: Sibi Sankar Cc: sudeep.holla@arm.com, cristian.marussi@arm.com, andersson@kernel.org, konrad.dybcio@linaro.org, jassisinghbrar@gmail.com, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, quic_rgottimu@quicinc.com, quic_kshivnan@quicinc.com, conor+dt@kernel.org, quic_gkohli@quicinc.com, quic_nkela@quicinc.com, quic_psodagud@quicinc.com Content-Type: text/plain; charset="UTF-8" On Wed, 17 Apr 2024 at 16:29, Sibi Sankar wrote: > > Add support for CPUSS Control Processor (CPUCP) mailbox controller, > this driver enables communication between AP and CPUCP by acting as > a doorbell between them. > > Signed-off-by: Sibi Sankar > --- > > v2: > * Use BIT() instead of manual shift. [Dmitry] > * Define RX_MBOX_CMD to account for chan calculation. [Dmitry] > * Clear the bit instead of the entire status within the spinlock. [Dmitry] > * Use dev_err_probe instead. [Dmitry] > * Drop superfluous error message while handling errors from get_irq. [Dmitry] > * Use devm_mbox_controller_register and drop remove path. [Dmitry] > * Define TX_MBOX_CMD to account for chan calculation. > * Use cpucp->dev in probe path for conformity. > > drivers/mailbox/Kconfig | 8 ++ > drivers/mailbox/Makefile | 2 + > drivers/mailbox/qcom-cpucp-mbox.c | 188 ++++++++++++++++++++++++++++++ > 3 files changed, 198 insertions(+) > create mode 100644 drivers/mailbox/qcom-cpucp-mbox.c > > diff --git a/drivers/mailbox/Kconfig b/drivers/mailbox/Kconfig > index 42940108a187..23741a6f054e 100644 > --- a/drivers/mailbox/Kconfig > +++ b/drivers/mailbox/Kconfig > @@ -273,6 +273,14 @@ config SPRD_MBOX > to send message between application processors and MCU. Say Y here if > you want to build the Spreatrum mailbox controller driver. > > +config QCOM_CPUCP_MBOX > + tristate "Qualcomm Technologies, Inc. CPUCP mailbox driver" > + depends on ARCH_QCOM || COMPILE_TEST > + help > + Qualcomm Technologies, Inc. CPUSS Control Processor (CPUCP) mailbox > + controller driver enables communication between AP and CPUCP. Say > + Y here if you want to build this driver. > + > config QCOM_IPCC > tristate "Qualcomm Technologies, Inc. IPCC driver" > depends on ARCH_QCOM || COMPILE_TEST > diff --git a/drivers/mailbox/Makefile b/drivers/mailbox/Makefile > index 18793e6caa2f..53b512800bde 100644 > --- a/drivers/mailbox/Makefile > +++ b/drivers/mailbox/Makefile > @@ -59,4 +59,6 @@ obj-$(CONFIG_SUN6I_MSGBOX) += sun6i-msgbox.o > > obj-$(CONFIG_SPRD_MBOX) += sprd-mailbox.o > > +obj-$(CONFIG_QCOM_CPUCP_MBOX) += qcom-cpucp-mbox.o > + > obj-$(CONFIG_QCOM_IPCC) += qcom-ipcc.o > diff --git a/drivers/mailbox/qcom-cpucp-mbox.c b/drivers/mailbox/qcom-cpucp-mbox.c > new file mode 100644 > index 000000000000..059eb25f217c > --- /dev/null > +++ b/drivers/mailbox/qcom-cpucp-mbox.c > @@ -0,0 +1,188 @@ > +// SPDX-License-Identifier: GPL-2.0-only > +/* > + * Copyright (c) 2024, The Linux Foundation. All rights reserved. > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > + > +#define APSS_CPUCP_IPC_CHAN_SUPPORTED 3 > +#define APSS_CPUCP_MBOX_CMD_OFF 0x4 > + > +/* Tx Registers */ > +#define APSS_CPUCP_TX_MBOX_IDR 0 I don't see _IDR defines being used. Other than that: Reviewed-by: Dmitry Baryshkov > +#define APSS_CPUCP_TX_MBOX_CMD(i) (0x100 + ((i) * 8)) > + > +/* Rx Registers */ > +#define APSS_CPUCP_RX_MBOX_IDR 0 > +#define APSS_CPUCP_RX_MBOX_CMD(i) (0x100 + ((i) * 8)) > +#define APSS_CPUCP_RX_MBOX_MAP 0x4000 > +#define APSS_CPUCP_RX_MBOX_STAT 0x4400 > +#define APSS_CPUCP_RX_MBOX_CLEAR 0x4800 > +#define APSS_CPUCP_RX_MBOX_EN 0x4C00 > +#define APSS_CPUCP_RX_MBOX_CMD_MASK 0xFFFFFFFFFFFFFFFF -- With best wishes Dmitry