From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 302DBC47083 for ; Wed, 2 Jun 2021 16:07:40 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id F05BA61623 for ; Wed, 2 Jun 2021 16:07:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F05BA61623 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=/qGdrpPqrShBsDGE/GjfuHyfssIZcZOE2XMzaABHUvM=; b=0xU7IrbubWFF8C ViqCoKfdLPt0WvlZX37laMxsXdoTiOF+p5YUNRtGTWnqaVE7qc9LttzLKvD6xXKHEyBESCB6TFbsr b4pUUxBSu/qz1VKaydUD67Wun8ImZ0P05n/mikeBKSSHgnfsLW1ba9udJpH11ARK45hSkWi475Rg1 Hcp+Z3AknHRrvTTWnNECtGKSQ7/hYlJ2PJryVKZHjUDD0c6ZwG6an8fBAQWushhflb0ySHy8lrN4+ yrXgMDKsBwD8lXpeAK2yXzpPZJtCOmgSoVzOvgVx0s763jQDQ4v+rcBfOD9zPCDgZh7KEOEo+VZx3 CMi3M9guL86qK8sa4q+Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1loTMz-0051F3-L3; Wed, 02 Jun 2021 16:05:25 +0000 Received: from mail-pf1-f169.google.com ([209.85.210.169]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1loTMo-0051BD-U4 for linux-arm-kernel@lists.infradead.org; Wed, 02 Jun 2021 16:05:17 +0000 Received: by mail-pf1-f169.google.com with SMTP id g18so2563282pfr.2 for ; Wed, 02 Jun 2021 09:05:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=XKxsJlne+LArk5awxmh1nwPa7SN5h9s/re93Xtt4ka8=; b=FjEfvrJD0PcwRixn9+ipYc2UVI2BVVXxHzEBpdpdib/cTv5yJ75wIJx+OrYoVpxajD wj2ZV3OQxeN8Ily3fsGw06aAiUR198DJqYG8plUdI8K6LKjkv1/qHgqmSxSvjh1UWK0k k9/x+DtgsGZ9BrtzsjvfIAoDHHEcn550Qs0pUuddetVdM8fXClwxuZzWD9fdbZALjHUr xAfvKcoYYg8i1UdPItt4lObs+J5rspbn9XCEXmwH/YynjaMQ1BxeVXzJNirYDqGu6x2y wCjDJVYA44ppLpbjwsY5H6PTzRYZCgIzA2aU+0I2PBrftmIxDK/eICpD3WtVJgFYjqu2 g73g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=XKxsJlne+LArk5awxmh1nwPa7SN5h9s/re93Xtt4ka8=; b=BdZYoLLjhjMMRZ+PYWnW0tA5wwyct1bfNeu29CCJwvJQrYDs3pFSmjFXY54alKOvj4 NnljqhXUXmMA3dstmc17A2xp9cyg+wJNvr5NFrInWfE/x68feFPCqwDXlbqeGYjWlwYS xoekIxVCMU7E3AOp4IuI9gMdlieTdR/nwwJ637J5wYyEQmJJXRQNMC8t2Rg6wmKiVfXr 7X2gKG1ZEBCEfbpr/ch2SidvAjMiNiVGAK1IYfc0B3+42rVAApEBCQkxiRSsvhi/WNUe OY7PC2rXinWl5RfSlAUNi/g87w+Gjfz7mLuXtazZPgVPlDcMgsWAhFJO0cpBPV43w9+D Hh3Q== X-Gm-Message-State: AOAM533nh3z7uSlDGrOFusEPBhAL2UPWZ3LhJG/jAtsHtHQnzxDDEIFp ddq6mTZazfuX4HwlKaAP1p+zHg== X-Google-Smtp-Source: ABdhPJwMUb2pY+sg5TfsR33k8PDKyPC3ae62iZt5DGmYIGl1OkmztCpjP4ArzfBhi8o7V/STIGWjTA== X-Received: by 2002:a05:6a00:c86:b029:2e9:3041:162f with SMTP id a6-20020a056a000c86b02902e93041162fmr27619121pfv.78.1622649853558; Wed, 02 Jun 2021 09:04:13 -0700 (PDT) Received: from xps15 (S0106889e681aac74.cg.shawcable.net. [68.147.0.187]) by smtp.gmail.com with ESMTPSA id c130sm103715pfc.51.2021.06.02.09.04.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Jun 2021 09:04:12 -0700 (PDT) Date: Wed, 2 Jun 2021 10:04:10 -0600 From: Mathieu Poirier To: Suman Anna Cc: Bjorn Andersson , Lokesh Vutla , Tero Kristo , linux-remoteproc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 5/6] remoteproc: k3-dsp: Refactor mbox request code in start Message-ID: <20210602160410.GA1797307@xps15> References: <20210522000309.26134-1-s-anna@ti.com> <20210522000309.26134-6-s-anna@ti.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210522000309.26134-6-s-anna@ti.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210602_090515_024709_89C5D710 X-CRM114-Status: GOOD ( 27.48 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, May 21, 2021 at 07:03:08PM -0500, Suman Anna wrote: > Refactor out the mailbox request and associated ping logic code > from k3_dsp_rproc_start() function into its own separate function > so that it can be re-used in the soon to be added .attach() ops > callback. > > Signed-off-by: Suman Anna > --- > drivers/remoteproc/ti_k3_dsp_remoteproc.c | 65 ++++++++++++++--------- > 1 file changed, 39 insertions(+), 26 deletions(-) Reviewed-by: Mathieu Poirier > > diff --git a/drivers/remoteproc/ti_k3_dsp_remoteproc.c b/drivers/remoteproc/ti_k3_dsp_remoteproc.c > index fd4eb67a6681..faf60a274e8d 100644 > --- a/drivers/remoteproc/ti_k3_dsp_remoteproc.c > +++ b/drivers/remoteproc/ti_k3_dsp_remoteproc.c > @@ -216,6 +216,43 @@ static int k3_dsp_rproc_release(struct k3_dsp_rproc *kproc) > return ret; > } > > +static int k3_dsp_rproc_request_mbox(struct rproc *rproc) > +{ > + struct k3_dsp_rproc *kproc = rproc->priv; > + struct mbox_client *client = &kproc->client; > + struct device *dev = kproc->dev; > + int ret; > + > + client->dev = dev; > + client->tx_done = NULL; > + client->rx_callback = k3_dsp_rproc_mbox_callback; > + client->tx_block = false; > + client->knows_txdone = false; > + > + kproc->mbox = mbox_request_channel(client, 0); > + if (IS_ERR(kproc->mbox)) { > + ret = -EBUSY; > + dev_err(dev, "mbox_request_channel failed: %ld\n", > + PTR_ERR(kproc->mbox)); > + return ret; > + } > + > + /* > + * Ping the remote processor, this is only for sanity-sake for now; > + * there is no functional effect whatsoever. > + * > + * Note that the reply will _not_ arrive immediately: this message > + * will wait in the mailbox fifo until the remote processor is booted. > + */ > + ret = mbox_send_message(kproc->mbox, (void *)RP_MBOX_ECHO_REQUEST); > + if (ret < 0) { > + dev_err(dev, "mbox_send_message failed: %d\n", ret); > + mbox_free_channel(kproc->mbox); > + return ret; > + } > + > + return 0; > +} > /* > * The C66x DSP cores have a local reset that affects only the CPU, and a > * generic module reset that powers on the device and allows the DSP internal > @@ -273,37 +310,13 @@ static int k3_dsp_rproc_unprepare(struct rproc *rproc) > static int k3_dsp_rproc_start(struct rproc *rproc) > { > struct k3_dsp_rproc *kproc = rproc->priv; > - struct mbox_client *client = &kproc->client; > struct device *dev = kproc->dev; > u32 boot_addr; > int ret; > > - client->dev = dev; > - client->tx_done = NULL; > - client->rx_callback = k3_dsp_rproc_mbox_callback; > - client->tx_block = false; > - client->knows_txdone = false; > - > - kproc->mbox = mbox_request_channel(client, 0); > - if (IS_ERR(kproc->mbox)) { > - ret = -EBUSY; > - dev_err(dev, "mbox_request_channel failed: %ld\n", > - PTR_ERR(kproc->mbox)); > + ret = k3_dsp_rproc_request_mbox(rproc); > + if (ret) > return ret; > - } > - > - /* > - * Ping the remote processor, this is only for sanity-sake for now; > - * there is no functional effect whatsoever. > - * > - * Note that the reply will _not_ arrive immediately: this message > - * will wait in the mailbox fifo until the remote processor is booted. > - */ > - ret = mbox_send_message(kproc->mbox, (void *)RP_MBOX_ECHO_REQUEST); > - if (ret < 0) { > - dev_err(dev, "mbox_send_message failed: %d\n", ret); > - goto put_mbox; > - } > > boot_addr = rproc->bootaddr; > if (boot_addr & (kproc->data->boot_align_addr - 1)) { > -- > 2.30.1 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel