Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1803396pxb; Fri, 22 Oct 2021 07:59:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxZ4Z8FHH0RJeXCd1u3yl5EOmX516I7tOj/m7slYJy7yfJi8tBfWIKkbhbKqbeDOFehccYg X-Received: by 2002:a05:6402:4410:: with SMTP id y16mr633723eda.366.1634914770643; Fri, 22 Oct 2021 07:59:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634914770; cv=none; d=google.com; s=arc-20160816; b=MHaAl8X4KoKowJTmvATIH6cnmHLpGw9hLvU1O0g14MnFYUYZv6R9BQBiaurjsAMgU8 Ze7lYrkq1ZgQ+NIscdvCpqLHnrMaNkmH1MCukr8+d7vb/Ilo0lJJwIr8y+TvdKrtZeon tP+2sUIAuVPWyXO2UI3wGI7UEE+AGFOYgG1+llJHViRe1jRlZOQSMuooxfODUHpxWxuE mcfgzdqTUZL1XlrAvuJfYcHN/7dCzjVlufVVzI+Wv7TSMm4Z9l/v8n2vjY8VD21DttKu Du4eudg2iNRcjo1WGgadGUxdNKJZ14VEDaOvA4FsjzvYpK+CLHk8Bg4Wi7HdWDcWMeaV FbGg== 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; bh=bP/PBZ5dE4p5HX2+QicYK3rA0pH5Cba6d4G9S+AUf1E=; b=UH92rs7tY1AwVGTyqK4LJfFzFdf5hvxSmfF8i3FmHvleBGzjSstcpoewTJHwpc20im ZwKamEcc2NFaCj+LzGDb/MSn6jjuSDR+nM6j3m9XpZYO5zMBgxj3anL8D5dUtTqRnelq RWVHo8ZniJsYCcKQJXrnN2hZg56cg0qtsxTewHmrn2hByPw0rph2hmcBq1716OBTnqan kb/phel43twMVDZU80cT0J63BXyW4aga1ksFRxMIheZfyyzfUgNCLrfGc1MbqmO5hZ9l av/aylKYwDk/lqx4t82bsFsKHT9u2Xt5/H/lNVVG+BO8V3kD0c/HZEVvf+IaiSGhp+V9 uqqg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g3si16827854ejt.525.2021.10.22.07.59.06; Fri, 22 Oct 2021 07:59:30 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233186AbhJVO7S (ORCPT + 99 others); Fri, 22 Oct 2021 10:59:18 -0400 Received: from mail-pl1-f177.google.com ([209.85.214.177]:46955 "EHLO mail-pl1-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233102AbhJVO7P (ORCPT ); Fri, 22 Oct 2021 10:59:15 -0400 Received: by mail-pl1-f177.google.com with SMTP id i1so2840164plr.13; Fri, 22 Oct 2021 07:56:57 -0700 (PDT) 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=bP/PBZ5dE4p5HX2+QicYK3rA0pH5Cba6d4G9S+AUf1E=; b=Je9zJuspXn4Spq26r2VAWVcdx4rDKm1V5uKeXekx6DwyqvfgYcec088ZUaBmSesZsc 6L2gNIKufUPe+Aj6VIncal8qM9ILX1o6Xqz2u4Tro3NOiybYPgi/KtuhjhSsw736vKwL xD8KtICfSDOvFXLOcnds0lsJCilAL6cEDG7PpWNyTFjHrowaVpP1qU8WQQPiw+jOOAPj AoYYMXZbKqX+qgqgvai8fHPvzKliRt5bEK1FL2sQP+V8Y3nyxKx5xPqbmMDnaJRF9Toh uehjGN6retNIFXMS87SUzVljhb/aoVbBZPzpktSsMAoLpVRPsSEw/3J/Lcn/VZh7UodN ILQw== X-Gm-Message-State: AOAM533YbKZARQ+UCOgfqxeGHwrbL0xtfjeFmhejhsyFk+HM8IHtsfLp 1fX1HAerJgkpBnAm3guHc8rQMjVLnRpHycPZwpA= X-Received: by 2002:a17:902:7783:b0:13d:fee6:8095 with SMTP id o3-20020a170902778300b0013dfee68095mr453870pll.7.1634914616930; Fri, 22 Oct 2021 07:56:56 -0700 (PDT) MIME-Version: 1.0 References: <20211021174223.43310-1-kernel@esmil.dk> <20211021174223.43310-10-kernel@esmil.dk> In-Reply-To: From: Emil Renner Berthing Date: Fri, 22 Oct 2021 16:56:45 +0200 Message-ID: Subject: Re: [PATCH v2 09/16] reset: starfive-jh7100: Add StarFive JH7100 reset driver To: Andy Shevchenko 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, 22 Oct 2021 at 16:50, Andy Shevchenko wrote: > 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. That's right, but we're on a 64bit machine, so DECLARE_BITMAP will give us an unsigned long array that doesn't match that. > 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. None of them has a pre-initialized const DECLARE_BITMAP, so they don't have to deal with the 4 vs. 2 commas problem. > > 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