Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1687707pxb; Fri, 22 Oct 2021 05:58:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxqnrS6JOglxhcjpQqp2zpO43sPxb0twbrv8aa4gzwkDOUgss6hZ/NSHId/Z9tKQxELn108 X-Received: by 2002:a63:9d4c:: with SMTP id i73mr9203458pgd.216.1634907490562; Fri, 22 Oct 2021 05:58:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634907490; cv=none; d=google.com; s=arc-20160816; b=rId2QpV9H/jnPe4Ku7+7bBVUe2cWONJso1KGaPhKcjYnr/HxF/rEy3yjrxGY+ZcKUV IUoMfZYQ/iIfl/UHDM0yEyMQ/4QCKIkZWrkvpVduEXUbjpOSLropqXUQdWnY7XI6oa/V mxamfbOVMo/WVpjcRDb8xntJccw2MkizCtYfFVgatPVDqAg0w/82Vbg5lmL0nqY+e3W4 /uKEjZrdrmDIbkTXUWJ42po+mHBLDdD9QbsUYbpcThctY2obPPO2lFfngFdgZlltL5Bj Z/JOoFBZDkPT+2xVRdMscKtMYg7EOO0bKmekidOqaaPkhSmoyUhU/NIKkZkjm28+nO9x HhTA== 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=+qOi8f1v4+rJCxOKM/1lFt8oaZPEX6smhRzqey4rSCg=; b=CLZ/V5yLs8raba557QoaATG5zBXcBFhusLtieXifrS2TS44ZPsXy2+H5E0tWuZpOoa i3rGox/YUizqGwvQlyjUBq05rRaXV/FuxQxkxUlQCt3C5O9DMuJlgMDUUpPqW1/k6/yC MxybsXNrqcGo0Ev6iBcLFjS+5AOE0k8sh9qnrmy8f77eXaJM8K7JNeuWM216LI22lQBm e/6ArnRwNkx470x6dQPewo+xNd+xDw3QVBqd4DU8v0Subm6nG/IR71WNHzOAoD5OG7SF EzZ+hCgsnhzZbrFfiEdlSw/jFGFdK34dJsi8zlgeJ77QVumsLK1afR0S/SJToKfbqzxl MGxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="YivvG/Js"; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t3si4996972ply.291.2021.10.22.05.57.57; Fri, 22 Oct 2021 05:58:10 -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=@gmail.com header.s=20210112 header.b="YivvG/Js"; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232858AbhJVM60 (ORCPT + 99 others); Fri, 22 Oct 2021 08:58:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232805AbhJVM6Z (ORCPT ); Fri, 22 Oct 2021 08:58:25 -0400 Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BAB45C061764; Fri, 22 Oct 2021 05:56:07 -0700 (PDT) Received: by mail-ed1-x52f.google.com with SMTP id t16so5048563eds.9; Fri, 22 Oct 2021 05:56:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=+qOi8f1v4+rJCxOKM/1lFt8oaZPEX6smhRzqey4rSCg=; b=YivvG/JsMBUvbb3Fs9tTmqksEjk8+rN0v5A+vUK4z8jS13RgQj58cSSwV7Hs+IWsGB adNRyKbM3yrg9wi18C8DLlOUORLq1BF4FYNWg7JzYi9UuIUeEq4Rn/rDkk/y1zhLxtEc aOJwG8ueEq8fZmlCGlZRCr1VCFNZmF0LBwCeNKdP2CPqZ8YkdZryhKGqdvn5XSpjL1oP 4o6i1XlLhy5Ivwsx0XRyu4wrcaRPgu1kTvO9jQ+GdztgGf9HLtxndmPFXuqPLPJ6Ep1B hDkRcHpvS7zlSUe5S45XqZYbcF6yhFGCeBVedFGDj8jrOQeCynGBXo9ZCYD+Q7EnHKgo 5Pew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=+qOi8f1v4+rJCxOKM/1lFt8oaZPEX6smhRzqey4rSCg=; b=5+uTAOrr2V0dcaVJzZBFq07KW7zK7NmkyRwdwtaiARaSfz73n3ZxgLedNJdgSCcE33 xsKyityjBnqQSTB2SAf3jTt3XUjh1D1Q0xdaYWAXKfWPftFNBwilaeQHj7qe1gdxAfoH HveW2bflwxYw9eH6MhI+w6Nvtub3vlCjjtwlyzuKcHub7IIng4wHQLh5JYWruMfWnqpw kPIHTBH3bdwWhTKtepq6wqfueuiyEVgqYvI3hFTic+u0Oeb7H2EMicbiW6AnyJM47C1Z idX1VBSMCDr09/3awkhzPErZG3HVj0hNUbt2Ta23hUKYV90LTEU89hFqmESnw62yeHkW 97ng== X-Gm-Message-State: AOAM532Q4yyAHXMJDDEFOxDdejELBl7sReiYReMuxZCtVmG54PNyRhWk IHK7LNQsA420HTBS2U1DXi9Qi+WWM0BQtftyME8= X-Received: by 2002:a17:906:5a47:: with SMTP id my7mr14665000ejc.128.1634907366155; Fri, 22 Oct 2021 05:56:06 -0700 (PDT) MIME-Version: 1.0 References: <20211021174223.43310-1-kernel@esmil.dk> <20211021174223.43310-10-kernel@esmil.dk> In-Reply-To: <20211021174223.43310-10-kernel@esmil.dk> From: Andy Shevchenko Date: Fri, 22 Oct 2021 15:55:10 +0300 Message-ID: Subject: Re: [PATCH v2 09/16] reset: starfive-jh7100: Add StarFive JH7100 reset driver To: Emil Renner Berthing Cc: linux-riscv , devicetree , linux-clk , "open list:GPIO SUBSYSTEM" , "open list:SERIAL DRIVERS" , Palmer Dabbelt , Paul Walmsley , Rob Herring , Michael Turquette , Stephen Boyd , Thomas Gleixner , Marc Zyngier , Philipp Zabel , Linus Walleij , Greg Kroah-Hartman , Daniel Lezcano , Andy Shevchenko , Jiri Slaby , Maximilian Luz , Sagar Kadam , Drew Fustini , Geert Uytterhoeven , Michael Zhu , Fu Wei , Anup Patel , Atish Patra , Matteo Croce , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 21, 2021 at 8:43 PM Emil Renner Berthing wrote: > > Add a driver for the StarFive JH7100 reset controller. ... > +config RESET_STARFIVE_JH7100 > + bool "StarFive JH7100 Reset Driver" > + depends on SOC_STARFIVE || COMPILE_TEST > + depends on OF No evidence of this dependency. Why to limit test coverage? > + default SOC_STARFIVE ... > +/* > + * Reset driver for the StarFive JH7100 SoC > + * > + * Copyright (C) 2021 Emil Renner Berthing > + * Redundant empty line. > + */ ... > +#include No evidence of any usage of this header. Perhaps you meant mod_devicetable.h? ... > +static const u32 jh7100_reset_asserted[4] = { > + BIT(JH7100_RST_U74 % 32) | > + BIT(JH7100_RST_VP6_DRESET % 32) | > + BIT(JH7100_RST_VP6_BRESET % 32), It's hard to notice that this is only one entry. See also below. > + BIT(JH7100_RST_HIFI4_DRESET % 32) | > + BIT(JH7100_RST_HIFI4_BRESET % 32), > + > + BIT(JH7100_RST_E24 % 32) + Comma. > +}; Why all these ugly % 32 against constants? ... > + if (!assert) > + done ^= mask; Can you convert this to simple if (assert) ret = readl_... else ret = readl_... below? > + spin_lock_irqsave(&data->lock, flags); > + > + value = readl(reg_assert); > + if (assert) > + value |= mask; > + else > + value &= ~mask; > + writel(value, reg_assert); > + /* if the associated clock is gated, deasserting might otherwise hang forever */ > + ret = readl_poll_timeout(reg_status, value, (value & mask) == done, 0, 1000); You run delays under spin lock. You need to use _atomic variant. > + spin_unlock_irqrestore(&data->lock, flags); ... > + u32 value = (readl(reg_status) ^ jh7100_reset_asserted[offset]) & mask; > + dev_dbg(rcdev->dev, "status(%lu) = %d\n", id, !value); > + return !value; Dup of ! operator. Can it be value = !(...); above? -- With Best Regards, Andy Shevchenko