Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1799950pxb; Fri, 22 Oct 2021 07:55:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJywB/2u0VTDKpJHLGqhiE+W6o0Yf5a+2iWlJ2NM04HhUR+WRw5CCYcqE7WJmGfaIZK6u4sR X-Received: by 2002:aa7:c501:: with SMTP id o1mr574115edq.99.1634914505410; Fri, 22 Oct 2021 07:55:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634914505; cv=none; d=google.com; s=arc-20160816; b=oNnjebKkgZJcdItkWLnnYcOXoiYOXpdESMwp9GlJSGSpqGsjtR80UYMqSRVFnZgTa3 jaE80EnaV3fH9j4KQ330+SUpwCV6DZe+0JuSLxtzxFEdplnCpfYCm0/0meA4BXAsltoJ mnwE+Q//CU3jn7L/6VpnLu219HJeDq0DrLyh8oJcLkwGNuec3SBLN67yKs0RuBHGdGUJ 67Y6QF+/cxigHfZGl6GrLe9p1hWIuGgPcMmKdJtD5HDNCbkau0pK719m3hhaRrlFboM7 M0KZ8pcQBeMAa86NnhPfUIVpzuJxMbTAP/cUkFrcXr/ImwaNMoiXYeckjz851WTZobQJ p0ZA== 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=va1CWMK0fvoaygUpYfBZZ7pMG5xay62hu0qP41q24WM=; b=RGRxqzLaPnW+44eqJm/iNmgaQk6PsOCewPoJnZkrsOBklj75cryPc5rFopBkMnviGW kClzjoIQbjd4AyEKA5ulV3ws1JSczidWOfZXYfL2Qryyg9muIICnsppR7JreWT7pHofv fwAzb9UfFlkreuLIO9M2OLvvnvW2gjH1/NhcYCTtp+nYbOs5cq26DXhsrfPu66qzZq2O ze9kV4X3HBNvCqD1MwAZXrcbnZVUczrT1E0dfoNE6zVtprdxexaVCa57W3BVOwk09T7w 7RLBvIoA+tk7/oaLHdLKmCTCYtlxm5fbhqxN/sNyLxnV8gBEA8qMNqu/cPfKGBvxiJVo bpIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=CKeP7lyt; 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 b6si743556edu.99.2021.10.22.07.54.40; Fri, 22 Oct 2021 07:55:05 -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=CKeP7lyt; 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 S233327AbhJVOw2 (ORCPT + 99 others); Fri, 22 Oct 2021 10:52:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233102AbhJVOwT (ORCPT ); Fri, 22 Oct 2021 10:52:19 -0400 Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8E9EC061348; Fri, 22 Oct 2021 07:50:01 -0700 (PDT) Received: by mail-ed1-x536.google.com with SMTP id u13so692468edy.10; Fri, 22 Oct 2021 07:50:01 -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=va1CWMK0fvoaygUpYfBZZ7pMG5xay62hu0qP41q24WM=; b=CKeP7lytVF2WkjwAJ3hD8Kd6INjvDsFkxaVTxTc8yC/7vZCj1kMaef78g39jBHveY+ S+AGNMDTKcU/WRpAh0Z2ezSX5BpxMM7ezZvxscn6c1tKQcNK1eM5hsI9Ym32DKcjSVQy dphH8+5XgSNA/4PxM217K/JrdtmTdIWlDR4lpZCKYpWMvk04aAkFE27YxQv9I7wpTwGu +q1Xew6H4P5lAszpRgfOgkUcckJJHk5qjCC5URaGmUHDjoj7e7aa0VJIJorxpXeC+pKc ApBzBILqxGdG03VcdSzpLItUi9rXzigsB3cagUGHuIR2Cj/c5ZIe1LGEPMLaX3tDPefr wCSw== 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=va1CWMK0fvoaygUpYfBZZ7pMG5xay62hu0qP41q24WM=; b=iSgam4pTZpiH9HfX3DXWrxDd192PSftx9NXiYJfprGN2sMy6/hkadYWnvzth8GuXnn YbG0RWOIds0ydHUzRsc2sLzAZh5vQlZycNoem477861iSt8559/LZQbeTr17Zgb/p4qx zttzDt65eAniM98O2D4z1fPfb9xgtks5GHqtprVgFBSyYK/ftTY6sGYSELnL/j+nBazE sWQv2cnB3h8A7ET+5V9j4qSeK/xK8lFkpavoctHbVIDmJtggddOZQt9KzNDbX63T7PnK 7MJ0rbOaL05RNbsOuCREEva3BHyUU6S+XRVFibJjRB9NlUpGzMzE97SQoLeXl9O8JGLt yB4A== X-Gm-Message-State: AOAM532klJj0JaVM8wtBqppUrBSo2zESWKmAkFF03pB9TCx6GNCPJIQI 6BqsCqHHQVJMT3JKZty63hLRDs2WSUtOT7ZPiNA= X-Received: by 2002:a17:906:a158:: with SMTP id bu24mr58564ejb.356.1634914200398; Fri, 22 Oct 2021 07:50:00 -0700 (PDT) MIME-Version: 1.0 References: <20211021174223.43310-1-kernel@esmil.dk> <20211021174223.43310-10-kernel@esmil.dk> In-Reply-To: From: Andy Shevchenko Date: Fri, 22 Oct 2021 17:49:04 +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 Fri, Oct 22, 2021 at 5:25 PM Emil Renner Berthing wrote: > On Fri, 22 Oct 2021 at 15:39, Andy Shevchenko wrote: > > On Fri, Oct 22, 2021 at 4:35 PM Emil Renner Berthing wrote: > > > On Fri, 22 Oct 2021 at 14:56, Andy Shevchenko wrote: > > > > On Thu, Oct 21, 2021 at 8:43 PM Emil Renner Berthing wrote: ... > > > > Why all these ugly % 32 against constants? > > > > > > Because the JH7100_RST_ values goes higher than 31. There is a > > > BIT_MASK macro, but that does % BITS_PER_LONG and this is a 64bit > > > machine. > > > > And? It's exactly what you have to use! > > So you want me to use an unsigned long array or DECLARE_BITMAP and > juggle two different index and bit offsets? What are the offsets of those status registers? AFAICS they are sequential 4 32-bit registers. So bitmap is exactly what is suitable here, you are right! See gpio-xilinx and gpio-pca953x on how to use bitmaps in the GPIO drivers. > Also is there a macro for handling that we'd then need 4 commas on > 32bit COMPILE_TEST and 2 commas on 64bit? > If you have some other way in mind you'll have to be a lot more explicit again. > > The point of the jh7100_reset_asserted array is that it exactly > mirrors the values of the status registers when the lines are > asserted. Maybe writing it like this would be more explicit: > > static const u32 jh7100_reset_asserted[4] = { > /* STATUS0 register */ > BIT(JH7100_RST_U74 % 32) | > BIT(JH7100_RST_VP6_DRESET % 32) | > BIT(JH7100_RST_VP6_BRESET % 32), > /* STATUS1 register */ > BIT(JH7100_RST_HIFI4_DRESET % 32) | > BIT(JH7100_RST_HIFI4_BRESET % 32), > /* STATUS2 register */ > BIT(JH7100_RST_E24 % 32), > /* STATUS3 register */ > 0, > }; -- With Best Regards, Andy Shevchenko