Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp4702092pxb; Tue, 2 Nov 2021 14:18:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw6NWb02YoADtKVOGQ7mwH5M0HTnxSM68s8+YjBVt+TMgjD64fTfwOh4hcgTalcL+T01K03 X-Received: by 2002:a92:3211:: with SMTP id z17mr27165698ile.271.1635887916702; Tue, 02 Nov 2021 14:18:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635887916; cv=none; d=google.com; s=arc-20160816; b=0XxVrCqu52D8/GR0cQ7igy/FW9X7LYZRNJ3TggemGivXK9SfKtHeKSbX3BsGsv2GZO P6fLiQp5PzeTdM2Wpl2FX2ZGn7yB+HKOWP5Pxg3MyHBrdZr6v8bxyok4b6AiRvcCM1fi pR54LKEBu0x1AB2DAZseE1Ita9sPGf4VLNg4Vmy+4MCRWr1jDrTT3sqfYoG1jDV67esI nP2i6lXKF5YxR7RQLRA3QfDZ34ObwrDRY3F7tALUBTkeVQFJxMuIalfwkBjhPk243LTq o+HEvPBBkHw6qTJwFfWXVuUG6cry+MZ53vFVe+L4HmJ+czc9Jf3zV9vY9xlI1WMCJ8MR 6hzw== 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=q3y5UxeQSpLyKQPZY321rv/0ZITkGbCXJhzW/7YHXdo=; b=aFumIwm6eXEGuQa9/7lhvPIC2fsfGDfQ+3M11bOkoT4hyRDy1A0/4J7Oo81O94LeYc 177xQOafj7CpdgdfvVlIQq3Ac6vKdd4CCj587ij/HBETGVPb0LYi6O1dY5LbIsOy+l/h Upao4zLtWgRa6+rAC+UMP8vkomfiMsN6B8aWBn3L+f4ugJwWYFDXf0b/tZF4gpqRoccc MsSDryGuxZUeggnbpDt2xmXpurpIGYJMsHjMBugyw2F9kzIsUVRXQWNw2xCD1dvvkICe k6v+YQQWyGhYoPpFa5aESxTfJdjt0D+A8XjdaFMq9F/5rgXVfCDbP1N1pSNvYlQSyWHJ YdUg== 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 s7si172998ild.65.2021.11.02.14.18.23; Tue, 02 Nov 2021 14:18:36 -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 S231314AbhKBVTw (ORCPT + 99 others); Tue, 2 Nov 2021 17:19:52 -0400 Received: from mail-pl1-f170.google.com ([209.85.214.170]:36364 "EHLO mail-pl1-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229931AbhKBVTv (ORCPT ); Tue, 2 Nov 2021 17:19:51 -0400 Received: by mail-pl1-f170.google.com with SMTP id u11so864484plf.3; Tue, 02 Nov 2021 14:17:16 -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=q3y5UxeQSpLyKQPZY321rv/0ZITkGbCXJhzW/7YHXdo=; b=x6QsW+aTrEmPDoDxf/ujFsmJrx7Y8vJFmcoz5NjjOnqjt58UqMhAwgwJMupWDfuae2 sySplTnaviF7XxdIrW68c7GdChwqFF/VzMtcEfrINSqiv2ZIAayA58lrO6Uy5NXV6ljb pG5BGoLWTscbikhcSs5Z4HnyJqkhPrfhQvQBGv+c5oUTWHKPlzGaP361diy/IDoDYdf2 A3VK82vxtd1ZlTtSitXNLC4nVm2m+1oqElOE10T0Kf6JAZ3ZNVvm2Q4KMEHT1OJD/boO raTMXAVzi1fka+bTNsGugF+oFrR+NU2tAp1xvFjGPltAXuk9PmMEykPL5B+rmHX5ofAU 8NLg== X-Gm-Message-State: AOAM533KVAY0FQYRRb8z0GznhOxU7FsdwmWDImg8Zyhb1umSQ4OgenAb mdtA64RMpAucRfLyH/PvUhSkGod2WDwVdx4UoQc/AjhSjMc= X-Received: by 2002:a17:90a:5b0c:: with SMTP id o12mr9978948pji.194.1635887835692; Tue, 02 Nov 2021 14:17:15 -0700 (PDT) MIME-Version: 1.0 References: <20211102161125.1144023-1-kernel@esmil.dk> <20211102161125.1144023-10-kernel@esmil.dk> In-Reply-To: From: Emil Renner Berthing Date: Tue, 2 Nov 2021 22:17:04 +0100 Message-ID: Subject: Re: [PATCH v3 09/16] reset: starfive-jh7100: Add StarFive JH7100 reset driver To: Andy Shevchenko Cc: Yury Norov , 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 Tue, 2 Nov 2021 at 21:14, Andy Shevchenko wrote: > On Tue, Nov 2, 2021 at 9:59 PM Emil Renner Berthing wrote: > > On Tue, 2 Nov 2021 at 20:43, Andy Shevchenko wrote: > > > On Tue, Nov 2, 2021 at 6:50 PM Emil Renner Berthing wrote: > > ... > > > > > +/* > > > > + * the registers work like a 32bit bitmap, so writing a 1 to the m'th bit of > > > > + * the n'th ASSERT register asserts line 32n + m, and writing a 0 deasserts the > > > > + * same line. > > > > + * most reset lines have their status inverted so a 0 in the STATUS register > > > > + * means the line is asserted and a 1 means it's deasserted. a few lines don't > > > > + * though, so store the expected value of the status registers when all lines > > > > + * are asserted. > > > > + */ > > > > > > Besides missing capitalization, > > > > I'm confused. it was you who wanted all comments to capitalized the same.. > > Yes and there are two types of the comments, one-liners and > multi-line. In multi-line you usually use proper English grammar, > where capitalization means what it means. For the one-liners just > choose either small letters or capital letters to start them with. That sounds reasonable, it was just that you complained about inconsistent comments in the pinctrl driver that follows the above. > > if it sounds like bitmap, use bitmap. > > > I have checked DT definitions and it seems you don't even need the > > > BIT_MASK() macro, > > > > > > > +static const u32 jh7100_reset_asserted[4] = { > > > > + /* STATUS0 register */ > > > > + BIT_MASK32(JH7100_RST_U74) | > > > > + BIT_MASK32(JH7100_RST_VP6_DRESET) | > > > > + BIT_MASK32(JH7100_RST_VP6_BRESET), > > > > + /* STATUS1 register */ > > > > + BIT_MASK32(JH7100_RST_HIFI4_DRESET) | > > > > + BIT_MASK32(JH7100_RST_HIFI4_BRESET), > > > > + /* STATUS2 register */ > > > > + BIT_MASK32(JH7100_RST_E24), > > > > + /* STATUS3 register */ > > > > + 0, > > > > +}; > > > > > > Yury, do we have any clever (clean) way to initialize a bitmap with > > > particular bits so that it will be a constant from the beginning? If > > > no, any suggestion what we can provide to such users? > > > > The problem is, that even if we could initialize this without the > > monstrosity in our last conversation a 64bit bitmap would still > > produce worse code. As it is now it's simply a 32bit load and mask > > with index and mask already calculated for the registers. In the > > status callback the mask can even be folded into the register read > > mask. With a 64bit bitmap you'd need to calculate new 64bit index and > > masks, and then conditionally shift the bits into position. > > Why? You may use 8 byte IO (writeq() / readq() or their relaxed versions), no? > > ... > > > If this reflection of the 32bit registers bothers you that much > > What bothers me is hidden endianess issues (yeah, here it might be > theoretical, but consider that somebody will look at your code and use > it as the best example ever). Wouldn't endian issues be a reason to make sure we read 32bit registers with 32bit reads? Or do you expect a hypothetical big-endian StarFive SoC to also change the order of the registers?