Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp1378542lqp; Mon, 15 Apr 2024 05:03:11 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXN7gI7g0pwnR/Swuj5FWMk+bW1yXBYmPuEYb8B3YjN59l36zXqTUnJkadgnvn4EDrz8OuVxNG3HEw0fekvyIxeXYhEato0hdHRW8NIBw== X-Google-Smtp-Source: AGHT+IH86agHuTHT5kg5mKZfyJezzcqiVlM7w3x0sIXci8b7x61ZXo9jtwV+60XeZz5U9cHqIDCA X-Received: by 2002:a05:6a20:3cab:b0:1a9:97fb:40cc with SMTP id b43-20020a056a203cab00b001a997fb40ccmr9430535pzj.2.1713182590921; Mon, 15 Apr 2024 05:03:10 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713182590; cv=pass; d=google.com; s=arc-20160816; b=NkSfpPJZl5BUn4a64T5Eo1HVf+Hmcf5Uu5GWh6CvY2tMOlEpA13I3HN+TAAM9GUndv /fMQuHl3fRx1KIhaGu4Tl7xxA9F9yx85zCCO+SXv931rpy+JmFc/2JsconVJNsBugehd bq35+oQZ9MKFknpnsPDlzgvQKlT85ty39S2wj+L+77e1r6XrVdomz6snyjfckAgrPXil 1YzpaPVCrP+CyVlUXJIyLipnEeOhIQhD+mDx6XQBvxqJxeqL2KQnbe2KKVJOEAL5VrgA vBGlBNYooCO6I+cUdfuSC+2VqZ+G2qOHjYe4KiN14PhYgJ2iT5B9kyZnR7BmvIXA/Z81 tuDg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=da4YEBdABIccPLZeOMn/2oJ/R2r9vorUrZWeIod9d+A=; fh=3/5z00DksLVABfPDw/iCZrt2KrXhhhnPMbR0aYyKDSs=; b=WG3qXSQ3a6HUyRhhWPaMxk/Dp/ZwHKG3lWw9jTyLNKTJ5icKI9FXXUg4RaM1f7M7H9 O3VFu47SxafmnceSi9G6T4FWL6owhmicBMFcPOO4mOM9U3Wh7eya2DFaYNBDTnKukyWz e/2P/LlKk6YFBLriS07rvxvYw4P9u8M88X3ghxaneCf3Ro+J/I0hsjAJh41CiyRt64/f RTWla0qB21V7KWxyzyFOwonuTFMWpaKKGZHaNajqkBU1UtJQPHwxcBkM18k2BJ30ayO5 t0vXawGOLLXZD/YUfxg3spTEi1atJ14plNmAsjvDTc28dG3mZtUBeg4DJWceXYOjnPmY 1EpQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mRTtDkr0; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-145023-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-145023-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 36-20020a631064000000b005dc82a6711fsi7638857pgq.102.2024.04.15.05.03.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 05:03:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-145023-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mRTtDkr0; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-145023-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-145023-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.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 963C4282AF4 for ; Mon, 15 Apr 2024 12:02:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 462476A031; Mon, 15 Apr 2024 12:02:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="mRTtDkr0" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6464A679ED; Mon, 15 Apr 2024 12:02:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713182564; cv=none; b=abihrJwNcZ5ZNVD3VKFNRyPFbiCRDrnIfTW+oMaRBAhRXwrjs2XtwpTkrqcKCbn7k6vqiijDKOaZSHrkCXCHIRonRlzbTHjBGMGQPXn7f3450jIqGpFFKiHYwTt2vsgzfjJjUu+v/Z/jELccyRqXwZDX+ytYkBfGHK6HPYuB9EU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713182564; c=relaxed/simple; bh=NchaIwl0enMKrAZADevkzNL4pVQIaCSWH3SoIG+yOuo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Dn/jlgw0VgokqBgH+CE5ptpK2OWqw8GN8W9d0JXbHDQHlDyu2Ku1xcXNhQDhxve2gyrIAB2XIn8gBkyZiuw4n8gQESJvOhLMSSyofhofu2nMfq2n+W/+OUqS/A2D4Bo+28IpLFWoUWDn9mMEf5zGbunWkLnHXL50s1KIYHjLT9M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=mRTtDkr0; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id BCB75C2BD11; Mon, 15 Apr 2024 12:02:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713182563; bh=NchaIwl0enMKrAZADevkzNL4pVQIaCSWH3SoIG+yOuo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=mRTtDkr0BCzbP+RDDyHgfeVPUsM9Gi2YfaRdVU+mGIlC50ZY5PwPARWJuuwoEGovK qJuIV1B1gLnkK7IKvSJqVKdd6eG93brhZeGjaDK+AoMaMVFkhC6p5uX4RdAexBioL1 Ook+NV9X0aJL1u91pE7/aLKhXxSpuxVzAHGPScXbfEFD44EWe8YdYkpWUGdPK2nZKM VfWsdNhbgDYQeW8D/GxBNHKNCFBi3AtnjHq14GSlbP5yWcCAayZ5XwD/+HkuO9u+Lm 1yfn0tYg6mmGI/S6q4w00NjX7AItSA4kq6If2Bwm8QRt3e+yRMgbCz/mZjfQanyw+3 j073IdJlm/yRw== Date: Mon, 15 Apr 2024 17:32:37 +0530 From: Manivannan Sadhasivam To: Qiang Yu Cc: quic_jhugo@quicinc.com, mhi@lists.linux.dev, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, quic_cang@quicinc.com, quic_mrana@quicinc.com Subject: Re: [PATCH v3 2/3] bus: mhi: host: Add a new API for getting channel doorbell address Message-ID: <20240415120237.GG7537@thinkpad> References: <1713170945-44640-1-git-send-email-quic_qianyu@quicinc.com> <1713170945-44640-3-git-send-email-quic_qianyu@quicinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1713170945-44640-3-git-send-email-quic_qianyu@quicinc.com> On Mon, Apr 15, 2024 at 04:49:04PM +0800, Qiang Yu wrote: > Some controllers may want to know the address of a certain doorbell. Hence > add a new API where we read CHDBOFF register to get the base address of > doorbell, so that the controller can calculate the address of the doorbell > it wants by adding additional offset. > > Signed-off-by: Qiang Yu > --- > drivers/bus/mhi/host/main.c | 17 +++++++++++++++++ > include/linux/mhi.h | 7 +++++++ > 2 files changed, 24 insertions(+) > > diff --git a/drivers/bus/mhi/host/main.c b/drivers/bus/mhi/host/main.c > index 15d657a..947b5ec 100644 > --- a/drivers/bus/mhi/host/main.c > +++ b/drivers/bus/mhi/host/main.c > @@ -1691,3 +1691,20 @@ void mhi_unprepare_from_transfer(struct mhi_device *mhi_dev) > } > } > EXPORT_SYMBOL_GPL(mhi_unprepare_from_transfer); > + > +int mhi_get_channel_doorbell(struct mhi_controller *mhi_cntrl, u32 *chdb_offset) s/mhi_get_channel_doorbell/mhi_get_channel_doorbell_offset > +{ > + struct device *dev = &mhi_cntrl->mhi_dev->dev; > + void __iomem *base = mhi_cntrl->regs; > + int ret; > + > + /* Read channel db offset */ No need of this comment. > + ret = mhi_read_reg(mhi_cntrl, base, CHDBOFF, chdb_offset); > + if (ret) { > + dev_err(dev, "Unable to read CHDBOFF register\n"); > + return -EIO; > + } > + > + return 0; > +} Why can't you use this API in mhi_init_mmio()? > +EXPORT_SYMBOL_GPL(mhi_get_channel_doorbell); > diff --git a/include/linux/mhi.h b/include/linux/mhi.h > index 8280545..1135142 100644 > --- a/include/linux/mhi.h > +++ b/include/linux/mhi.h > @@ -816,4 +816,11 @@ int mhi_queue_skb(struct mhi_device *mhi_dev, enum dma_data_direction dir, > */ > bool mhi_queue_is_full(struct mhi_device *mhi_dev, enum dma_data_direction dir); > > +/** > + * mhi_get_channel_doorbell - read channel doorbell offset register to get 'Get the channel doorbell offset' > + * channel doorbell address > + * @mhi_cntrl: MHI controller > + * @chdb_offset: channel doorbell address s/channel doorbell address/Channel doorbell offset - Mani -- மணிவண்ணன் சதாசிவம்