Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1855471pxb; Fri, 22 Oct 2021 08:55:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzjzyzXcsQh49+iIJTxSySXkhF8C3fswiTJW1pQFKND70gfxM4KbAkaLGHODvjYK7QiwxEg X-Received: by 2002:a17:90a:307:: with SMTP id 7mr843866pje.176.1634918157241; Fri, 22 Oct 2021 08:55:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634918157; cv=none; d=google.com; s=arc-20160816; b=iXcKG8AOi3JAOOKf30WIUj//+tKS9VAIZomZwpXBMclGndRB/Q97aisLdyHpEN/MdN SdeLTk7PBNd5K+/O1SIUNHbvQ7EqY+bu5sqBVGL8TO/dbT2LKcrWGU6tf9mzO4CUtk2s xIM01INTXhd53o/6qpFO+PLphd98fO/BMKJ788+/xQ+7rZvduFV1LWjX78tEdArHXZa4 JODWPhmc0WnPUbjLGkCv7lh7c0OoyZZKDLfPk9dEbOn9i5/4FjOjzDwBwhTPUoeRH3B+ 8ZhSL4AWMwdL3XcQohpYiTchK4RF0l3yQrk4DbDLEWX+pbMHe1JanjuTC4n+gIBF8jRf 5JyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=pjDUt2tNep0QMuiwDZLG9JejHuPvIx1/xi24e1PrZvo=; b=Te7GXp5EfZshnxrfty8Xv2MyqqvPNLTbSZBv1HPYE9uZnHKuMA2/4ppwc76VqZPyvL YG+pTDRzLGzaUfF/MVZq7DOvbNgIaIs4+6XMUyMjeMaG+HieVltbcvTvtYwpRQcVhW1w cpgouC4iGC9FbPjwLSEL13xA/fufEjdfJgh1jGGrAdqezRyVhB16RBedpClRpVYiFFjV 7JZt7LpFL9ViSlRmR7PG+Tp72PG0o3ykS9X0TzSVAQBlKPcrORiJS7ztCiL5zeHSOcp2 NqYlw3q4yTNEKiEO44OMdRqqddkTsIx4tbQw+3SAAx9hdB8Sf8xerbjbZyh8IqHGH0UO iryA== 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; dmarc=fail (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 z21si11633884pfg.301.2021.10.22.08.55.43; Fri, 22 Oct 2021 08:55:57 -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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233411AbhJVP4y (ORCPT + 99 others); Fri, 22 Oct 2021 11:56:54 -0400 Received: from mga14.intel.com ([192.55.52.115]:50470 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233328AbhJVP4w (ORCPT ); Fri, 22 Oct 2021 11:56:52 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10145"; a="229597260" X-IronPort-AV: E=Sophos;i="5.87,173,1631602800"; d="scan'208";a="229597260" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Oct 2021 08:54:34 -0700 X-IronPort-AV: E=Sophos;i="5.87,173,1631602800"; d="scan'208";a="534971271" Received: from smile.fi.intel.com ([10.237.72.184]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Oct 2021 08:54:28 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.95) (envelope-from ) id 1mdwrs-00099C-P1; Fri, 22 Oct 2021 18:54:04 +0300 Date: Fri, 22 Oct 2021 18:54:04 +0300 From: Andy Shevchenko 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 , Jiri Slaby , Maximilian Luz , Sagar Kadam , Drew Fustini , Geert Uytterhoeven , Michael Zhu , Fu Wei , Anup Patel , Atish Patra , Matteo Croce , Linux Kernel Mailing List Subject: Re: [PATCH v2 09/16] reset: starfive-jh7100: Add StarFive JH7100 reset driver Message-ID: References: <20211021174223.43310-1-kernel@esmil.dk> <20211021174223.43310-10-kernel@esmil.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 22, 2021 at 05:36:21PM +0200, Emil Renner Berthing wrote: > On Fri, 22 Oct 2021 at 17:25, Andy Shevchenko wrote: > > On Fri, Oct 22, 2021 at 5:56 PM Emil Renner Berthing wrote: > > > On Fri, 22 Oct 2021 at 16:50, Andy Shevchenko wrote: > > > > On Fri, Oct 22, 2021 at 5:25 PM Emil Renner Berthing wrote: ... > > > > 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. > > > > I didn't get it, sorry. > > You will have a bitmap array which you will split to 32-bit values. > > What you will probably need is to move xgpio_get_value32() and void > > xgpio_set_value32() to the one of bitmap related headers (look for > > bitmap_get_value8() and friends). > > > > > > 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. > > > > I believe it's well possible to refactor this to look much better with > > bitmaps (as it represents the hardware very well). > > Right, but how exactly? This works on on 64bit, but not with 32bit COMPILE_TEST: > > static const DECLARE_BITMAP(jh7100_reset_asserted, JH7100_RSTN_END) = { > /* STATUS0 register */ > BIT_MASK(JH7100_RST_U74) | > BIT_MASK(JH7100_RST_VP6_DRESET) | > BIT_MASK(JH7100_RST_VP6_BRESET) | > /* STATUS1 register */ > BIT_MASK(JH7100_RST_HIFI4_DRESET) | > BIT_MASK(JH7100_RST_HIFI4_BRESET), > /* STATUS2 register */ > BIT_MASK(JH7100_RST_E24) | > /* STATUS3 register */ > 0, > }; BITMAP_FROM_U64() ? > > > > > 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. -- With Best Regards, Andy Shevchenko