Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp3606648pxt; Tue, 10 Aug 2021 07:21:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxFiG45seORRMOWOlJJJ0HwFfD1w62kMszg4fVv8pW3JQfckcsSG9MfcutEmD7ATLQFzzig X-Received: by 2002:a05:6402:3551:: with SMTP id f17mr5239891edd.261.1628605315880; Tue, 10 Aug 2021 07:21:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628605315; cv=none; d=google.com; s=arc-20160816; b=HC82jsA7z1lsQNDHe4l3UbOcS0O3+uSnmyVJndRno9RjahUk1/Khe4cktT6FlJFasX Kpkb28mdScd8IJK7B89Ns9/IxgSFgs/Vu6mSghVIMU+uV5mK0rZSAWygXzYkyuFiH6+Q pDbGC8nIWotzJso047yMOcDbDC/XH8To67EZZgSJl5C1l0OOpJ3XyV846jAZi4/VVqb2 DLfKVXEJn+0Hhg4A4zu+DePwG8K3kQFo6J2B1hwdanAJZmxshHtyKCq1xEPLCxm0MBlL 4GRt9P4UURDU8cS0zhdRY4q994xXQPp/1wKjPS7PSFMgCdPb2vroHrfC3xgj6uYxvSW/ qaxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=GAUdFxB/nuyD8e37Y4/cSwL2QvDgaa+OvSAdElWuutE=; b=BaOboWc7WB6EgUL2CI++G0JyADMy4su8o4hual3cl5DAKkydBPEaVIDEUKSnFcEZgB HBsTxSivSJqukasMf896/FFO73+MiCrTpqwNNfeJQxyul3Xm9YfM6ERB7Wz/ZYvsk4xt yS8ujNk7QPLBLlS1qje6/xft7MlWixyUhMpyeycpfFeDqbFfzHrNFlKvNAbbu0+oa8Xp WQBCI4asaYJtxpStzQd7n0bYxzhJlyzebPQrU5HtRUPrR+Ntg5RzZgopmvy3nwUkgGmC oDNlZyFa5EL5dNkIPo6AM/RVedDC09+hRwD+W6Sobs1wGpWiYtWn1dYtzIR9zC+wtjWV RpiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FiZK96vE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a24si9897644edv.185.2021.08.10.07.21.08; Tue, 10 Aug 2021 07:21:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FiZK96vE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241416AbhHJNgi (ORCPT + 99 others); Tue, 10 Aug 2021 09:36:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238260AbhHJNgg (ORCPT ); Tue, 10 Aug 2021 09:36:36 -0400 Received: from mail-il1-x12a.google.com (mail-il1-x12a.google.com [IPv6:2607:f8b0:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02D1AC061798 for ; Tue, 10 Aug 2021 06:36:15 -0700 (PDT) Received: by mail-il1-x12a.google.com with SMTP id a4so6243804ilj.12 for ; Tue, 10 Aug 2021 06:36:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=GAUdFxB/nuyD8e37Y4/cSwL2QvDgaa+OvSAdElWuutE=; b=FiZK96vERTuIAuikDBL6Ooey+jHySbQUeXP0EOKfNnW56g/S1noMxovebcwVi9LqwN UzgjVfebf964xNDcNAYat32UQQSCPcH29GksaL3Zu3+e2dnptQyDj1+yCCFbjLt30UEW F+JL2qXk/po7FQaNvm4Bdr+NzFoIF4nnjdP3w7JweA0GmZuqpDcOfRGQC7zTASYZe0w5 LBvKNP+bP/me5K99z4dRX0bUTnnaTSPAxDhZrO8kBQbb9kaoKJAOjQlmUKBxfHeGKD4w 0U1MOobCPHu+8/7CgqhIwQxQbGSjxk7lo2LhL7uh4tM8GZwykestDrEJMsYPfWLGxhKd 5Eew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=GAUdFxB/nuyD8e37Y4/cSwL2QvDgaa+OvSAdElWuutE=; b=oII6gdl5YjJRJJOxR4maQWS6ftAAaZdN3H0i9iMfzV9wA6c1ruS/PaOFfjj54HDhcE VWHIFrhFOQm4OX4x5Pou6WhoRqiEZVcsl3ug0ivOqpLhRuTSJeQPXl9LGY7KZDNoNZIn ROiowvX82Vg6Qw3VUL5WeN0QEcInDyn1d5DHGabw/MIvmRUhEqrVck18WjRjvM2B9WWy T+Y81TCgF3wYZLprpQ7MWZ3k7IAvUAgMtfZWk6igbVTfxmwuKZDe1suBK6owf44Mtq71 MgZBAPUJXl9e/8Wq5dTUkHjXu/kKD8kzM4roqb3o78nIyEhm5YAaOWONTD7DVhaVsEDN AsAQ== X-Gm-Message-State: AOAM530i0FS1sBUpdfD5edOpoNym8sCuBmnWRoNRjfpeGSWkWhqTf/Ku ZW0Ol3UCwRkXelqfKVnjeGUNxcMgRdwu9fJ2UowqVQ== X-Received: by 2002:a92:c5c8:: with SMTP id s8mr651292ilt.140.1628602574443; Tue, 10 Aug 2021 06:36:14 -0700 (PDT) MIME-Version: 1.0 References: <20210717234859.351911-1-martin.blumenstingl@googlemail.com> <20210717234859.351911-3-martin.blumenstingl@googlemail.com> <20210728175823.GA2766167@p14s> <20210805161506.GA3205691@p14s> In-Reply-To: From: Mathieu Poirier Date: Tue, 10 Aug 2021 07:36:01 -0600 Message-ID: Subject: Re: [PATCH v3 2/2] remoteproc: meson-mx-ao-arc: Add a driver for the AO ARC remote procesor To: Martin Blumenstingl Cc: linux-remoteproc , linux-amlogic@lists.infradead.org, linux-arm-kernel , Linux Kernel Mailing List , Bjorn Andersson , Ohad Ben-Cohen Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 8 Aug 2021 at 14:37, Martin Blumenstingl wrote: > > Hi Mathieu, > > On Thu, Aug 5, 2021 at 6:15 PM Mathieu Poirier > wrote: > > > > On Wed, Aug 04, 2021 at 11:03:57PM +0200, Martin Blumenstingl wrote: > > > Hi Mathieu, > > > > > > thanks for taking the time to look into this! > > > > > > (I will address any of your comments that I am not mentioning in this > > > email anymore. Thanks a lot for the suggestions!) > > > > > > On Wed, Jul 28, 2021 at 7:58 PM Mathieu Poirier > > > wrote: > > > [...] > > > > > + writel(FIELD_PREP(AO_REMAP_REG0_REMAP_AHB_SRAM_BITS_17_14_FOR_ARM_CPU, > > > > > + priv->sram_pa >> 14), > > > > Indentation problem > > > The idea here is to align priv->sram_pa with AO_REMAP_REG0... which > > > are both arguments to FIELD_PREP > > > > Right, this is what I would have expected. When I applied the patch on my side > > "priv->sram_pa ..." was aligned wiht the 'M' of "AO_REMAP_ ...". > > > > > Maybe using something like this will make that easier to read: > > > tmp = FIELD_PREP(AO_REMAP_REG0_REMAP_AHB_SRAM_BITS_17_14_FOR_ARM_CPU, > > > priv->sram_pa >> 14); > > > writel(tmp, priv->remap_base + AO_REMAP_REG0); > > > > I think the main problem is that > > AO_REMAP_REG0_REMAP_AHB_SRAM_BITS_17_14_FOR_ARM_CPU is simply too long. I > > suggest making is shorter and add a comment to describe exactly what it does. > AO_CPU_CNTL_AHB_SRAM_BITS_31_20 is used below and when looking at it > now I think the alignment is also strange. > For the next version I'll go with the tmp variable as I think it > improves readability, even with the long(er) macro names. > > [...] > > > > > + priv->arc_reset = devm_reset_control_get_exclusive(dev, NULL); > > > > > + if (IS_ERR(priv->arc_reset)) { > > > > > > > > Function __reset_control_get() in __devm_reset_control_get() can return NULL so > > > > this should be IS_ERR_OR_NULL(). > > > The logic in there is: return optional ? NULL : ERR_PTR(-...); > > > > Ok, so you meant to do that. And I just checked reset_control_reset() and it does > > account for a NULL parameter. I'm good with this one but add a comment to > > make sure future readers don't think you've omitted to properly deal with the > > NULL return value. > > > > > I am requesting a mandatory reset line here, so reset core will never > > > return NULL > > > See also [0] > > > > Indeed, I've read that too. Nonetheless __reset_control_get() can return NULL > > by way of __reset_control_get_from_lookup(). > I could not find where __reset_control_get_from_lookup returns NULL in > case optional is false (which it is in this case because > devm_reset_control_get_exclusive requests a "mandatory" reset line). > Can you please point me to the problematic line(s) as I'd like to send > a patch (which fixes this) to the reset subsystem maintainers > I am currently traveling - I will get back to you in a week or so. > $ git grep -A1 devm_reset_control_get_exclusive | grep IS_ERR_OR_NULL > drivers/remoteproc/ti_k3_r5_remoteproc.c- if > (IS_ERR_OR_NULL(core->reset)) { > $ > > I suspect that this can be simplified then as well. > > > Best regards, > Martin > > > [0] https://elixir.bootlin.com/linux/v5.14-rc4/source/include/linux/reset.h#L227 > [1] https://elixir.bootlin.com/linux/v5.14-rc4/source/drivers/reset/core.c#L932