Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1878111rwl; Thu, 30 Mar 2023 02:48:31 -0700 (PDT) X-Google-Smtp-Source: AKy350aqkFGZVBw5rWzuTFU6G/cn590dOg77aO+tN59VwG2u3kcz5Y3KPYdkHFf7ibi09HwFVVaI X-Received: by 2002:a05:6402:40d6:b0:502:367:d5b8 with SMTP id z22-20020a05640240d600b005020367d5b8mr2214759edb.4.1680169711743; Thu, 30 Mar 2023 02:48:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680169711; cv=none; d=google.com; s=arc-20160816; b=Kvntcy8ayD1smNb2JW2LKtpPMh5oVbShFLQXb7WZJekONP9pWmFJon1rlj7Sm9es2Z WOPG/NTYhgVhlK+kaU3+V7JgO4VNp1cQkWnav/5HTh0zHlu1Qd0YlhP6aPFk+3Us3Rg1 vBZ2i7O91gNoirPIs14w0meky0C8ZJfSw4ttKZL5jlh503PLtwEmZv6EZo8ESRDJrm40 69jHC1MTyned0bc7zZ02Fe8zTzqfF5iqFTfekPQymlF4BU0xgbBV0tKhi3GVzymHPtlT tsASVtP4AXasDq1or8KibmcqWsoL8UloYGUmzQ+bz3iz5YsFaFl3uGS9wqfiVwosvfRL nARw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=8DcFbRjA6OLnfowxommhv/QB/ro2DTlI/VFsp0ilEL0=; b=M4dJ38gsIdXb3XmMXHsUeImYK/BAbaLUvw7ec1k/Ep79z+oglZFAt2ccKps6q0sawI PQL/8deicY0iFzu5C0Y6iWnGH1FW22IJGYxD3hYByodKa8LmV82+70OhhMsfONQfWh5J DJiLRxHvYezE+AUpY5eWqKe15TN91u6rfTMyvB/0FX7yN0xj5MLYQROR3ld80e5TMAY8 I0YXgz+oMv5zu8DqDovgbhA7olYpoE8c9BXYzEBw+Bp43cyeDlw1Wq7jP8Ov1ozNLF2Q 2y1y24CHf5IaenoBTMLoBIx+cNAJq+1dm9WENa5Qu+5C/p9xzan4zn0LpHRJkRTNxa58 VzkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=i4an1Kmi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dy2-20020a05640231e200b004fa2bfc0d55si31776067edb.574.2023.03.30.02.48.07; Thu, 30 Mar 2023 02:48:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=i4an1Kmi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230424AbjC3Jqo (ORCPT + 99 others); Thu, 30 Mar 2023 05:46:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229718AbjC3JqP (ORCPT ); Thu, 30 Mar 2023 05:46:15 -0400 Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::225]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 121AB8699; Thu, 30 Mar 2023 02:45:52 -0700 (PDT) Received: (Authenticated sender: maxime.chevallier@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 6F1121C000D; Thu, 30 Mar 2023 09:45:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1680169551; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8DcFbRjA6OLnfowxommhv/QB/ro2DTlI/VFsp0ilEL0=; b=i4an1KmiqVszoBaZHSPjH6Lw8y1yP2g1Wur7RHMV8u8ljZJW2DmrAUt9O26Xm95eFMr/Pv S+wefPljVBNzWm5/0pdC61aIDmJFyU1aKjSNZsHrsa3EdGhxrLnAFlc4bFmSTUgoc8XV21 fkZON+6eKxut4rKl3Dy9tmhtGKQIkde0iGrL/JrzHqIepqot8eftODrQSaeCTRpZcFxiE/ ezhSvnZbu4JOtLOJnCYvCozTHZJPwIhpsrcNmUQ1LELqsvSLoXJhI03pH6gznSUzqT0YxS jRICZftmpRy32uWFmow9iU9xIrBYL2DasxCQF88sZRyjnTAZvBV+/4EJYq+Vgg== Date: Thu, 30 Mar 2023 11:45:46 +0200 From: Maxime Chevallier To: Mark Brown Cc: Greg Kroah-Hartman , rafael@kernel.org, Colin Foster , Vladimir Oltean , Lee Jones , davem@davemloft.net, Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , Heiner Kallweit , Russell King , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, thomas.petazzoni@bootlin.com Subject: Re: [RFC 2/7] regmap: check for alignment on translated register addresses Message-ID: <20230330114546.13472135@pc-7.home> In-Reply-To: References: <20230324093644.464704-1-maxime.chevallier@bootlin.com> <20230324093644.464704-3-maxime.chevallier@bootlin.com> Organization: Bootlin X-Mailer: Claws Mail 4.1.1 (GTK 3.24.37; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello Mark, On Fri, 24 Mar 2023 18:51:19 +0000 Mark Brown wrote: > On Fri, Mar 24, 2023 at 10:36:39AM +0100, Maxime Chevallier wrote: > > With regmap->reg_base and regmap->reg_downshift, the actual register > > address that is going to be used for the next operation might not > > be the same as the one we have as an input. Addresses can be offset > > with reg_base and shifted, which will affect alignment. > > > > Check for alignment on the real register address. > > It is not at all clear to me that the combination of stride and > downshift particularly makes sense, and especially not that the > stride should be applied after downshifting rather than to what > the user is passing in. I agree on the part where the ordering of "adding and offset, then down/upshifting" isn't natural. This is the order in which operations are done today, and from what I could gather, only the ocelot-spi MFD driver uses both of these operations. It would indeed make sense to first shift the register to have the proper spacing between register addresses, then adding the offset. So maybe we should address that in ocelot-spi in the next iteration, Colin, would you agree ? Thanks, Maxime