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 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 1A742C47080 for ; Tue, 1 Jun 2021 17:24:24 +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 D206D6008E for ; Tue, 1 Jun 2021 17:24:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D206D6008E 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=3dPREDv6ReD9rJo/Non1kSjNVikLLju4KIsTNcBzGgM=; b=ksislZ+BlDt6sF ml7n0C54+F8/lqypYmZBzmiLFhkJ4Cyd/z9xsiwKrJ+ERJ9juYjNFS3ZS1CsbsylmTzuUH7yxzuUB am2dwe4XcjKdkPKKg09t8X94kUJwcZ0vjYhyIy4WaoPaBSaPtoDkUGGdr8RrBAqc7VePwXOD52Qj4 LoOh+dRrhe5XmC0NW9qlxFEPeZeI/YB+6rhacQ0xdq5h+GdX9uo0EON9Dxb6hvsW1yADa7Brd1Wh2 t+N863/7uGxJcTkliGeTmz+DKa4RrtJ1qKS+v0TE+RzaYKOun3hi6OYpl8wGSlWLROejgty6fufSH 8/dVqQvgsRKRxc5I/MGg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lo86T-0004jH-1R; Tue, 01 Jun 2021 17:22:57 +0000 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lo86P-0004iQ-TJ for linux-arm-kernel@lists.infradead.org; Tue, 01 Jun 2021 17:22:55 +0000 Received: by mail-pl1-x635.google.com with SMTP id c13so2323349plz.0 for ; Tue, 01 Jun 2021 10:22:53 -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=Wn+gKBGF4EW/y5WIOTECsgw0m1+QurVLeNYFkfOOlsc=; b=KaKo3ASizyyNS70aGjfD2CcGO1zJazK2GwwfwvSDL1366zyLuIx9NfJKBHPZcjAhcR vX0AbC2oHljZnGGRc/XS5xCmjuDsk609QOjj7IVVjsb+V9QpFznQxRSuC505guk3wOFU DmgriTVuhb6AKOHffCMEcxz3gtIvMTmjnZ8k156lEkXSjCHnCLv7KrUyLYYP5G3Q3dUW 6U5Sou2Lagvt4fEcYIYMQlFZxvcx8uZOEItvN+JUOrgmwd7BCt/XDIJtmmBGL23i0XGr A1iqUDqigsFVP8B4rQgIcPWbEAEjavVSdYiMVtQMfZXSCLNkxxd9sZcx1DlmipZ3Q3OO P5OQ== 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=Wn+gKBGF4EW/y5WIOTECsgw0m1+QurVLeNYFkfOOlsc=; b=KkaweHj0F36RMnPWwg6BjoOG7CGCuGlAiZZknTnqQSxL+WcLMHzUALZLy/KxvNysu3 zcVS6lKSF1msiDqr3ULhvG9b9HMdC6D+APNtyCvm+awZEbr9h0bn6Abc5yVvo1ASXaHP yGCv9ZXNpjyJ5CQnECTmJgbz9s/ayOnLErMOcA2qasDqUOyoh0tAEq3YIwtPSiNUMOp+ wpZuPnd2xo026ccejtB26fSU5rHVLhWkB60nKD1CawzmPu2qfgCPKGht2wHdGZ8s9pM8 C0GWx5wQVKpcFZhlynqHhWVH7TjcfnJpuE2V1acO0UE0ev5ySsnrrefHqWmMY9eVltd4 W3xQ== X-Gm-Message-State: AOAM531teJdHcDn0cGXj/dOSfNDhjXx7kOdpbOk4JKGDwi4+oDGlt1s0 ivokturWkE8DfymghhZAtvWDjw== X-Google-Smtp-Source: ABdhPJzQnr7G/z0kDsVkdqTKrBm/w6okKdf+GtoK7mDZWhZj9hSJI2bxukIoInbklBcA+b52dMTsJw== X-Received: by 2002:a17:903:248e:b029:101:fa49:3f96 with SMTP id p14-20020a170903248eb0290101fa493f96mr17923282plw.16.1622568172919; Tue, 01 Jun 2021 10:22:52 -0700 (PDT) Received: from xps15 (S0106889e681aac74.cg.shawcable.net. [68.147.0.187]) by smtp.gmail.com with ESMTPSA id y5sm6870301pfb.19.2021.06.01.10.22.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Jun 2021 10:22:52 -0700 (PDT) Date: Tue, 1 Jun 2021 11:22:50 -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 3/6] remoteproc: k3-r5: Refactor mbox request code in start Message-ID: <20210601172250.GD1759269@xps15> References: <20210522000309.26134-1-s-anna@ti.com> <20210522000309.26134-4-s-anna@ti.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210522000309.26134-4-s-anna@ti.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210601_102253_982255_AFDDBD77 X-CRM114-Status: GOOD ( 27.41 ) 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:06PM -0500, Suman Anna wrote: > Refactor out the mailbox request and associated ping logic code > from k3_r5_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_r5_remoteproc.c | 66 ++++++++++++++---------- > 1 file changed, 40 insertions(+), 26 deletions(-) > Reviewed-by: Mathieu Poirier > diff --git a/drivers/remoteproc/ti_k3_r5_remoteproc.c b/drivers/remoteproc/ti_k3_r5_remoteproc.c > index 2975393ebacd..e7e1ca71763e 100644 > --- a/drivers/remoteproc/ti_k3_r5_remoteproc.c > +++ b/drivers/remoteproc/ti_k3_r5_remoteproc.c > @@ -376,6 +376,44 @@ static inline int k3_r5_core_run(struct k3_r5_core *core) > 0, PROC_BOOT_CTRL_FLAG_R5_CORE_HALT); > } > > +static int k3_r5_rproc_request_mbox(struct rproc *rproc) > +{ > + struct k3_r5_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_r5_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 R5F cores have controls for both a reset and a halt/run. The code > * execution from DDR requires the initial boot-strapping code to be run > @@ -495,38 +533,14 @@ static int k3_r5_rproc_start(struct rproc *rproc) > { > struct k3_r5_rproc *kproc = rproc->priv; > struct k3_r5_cluster *cluster = kproc->cluster; > - struct mbox_client *client = &kproc->client; > struct device *dev = kproc->dev; > struct k3_r5_core *core; > u32 boot_addr; > int ret; > > - client->dev = dev; > - client->tx_done = NULL; > - client->rx_callback = k3_r5_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_r5_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; > /* TODO: add boot_addr sanity checking */ > -- > 2.30.1 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel