Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1893416ybe; Tue, 3 Sep 2019 05:13:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqzvzpwLduu5SEaTQZCrmrLd0qyslKQr3uznMl5mEME1SCZzM1ifSW8/DYmiTqQwFFxnxGz4 X-Received: by 2002:a17:90a:17aa:: with SMTP id q39mr18380699pja.106.1567512797855; Tue, 03 Sep 2019 05:13:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567512797; cv=none; d=google.com; s=arc-20160816; b=xND64SKjWHgGoMD7eZ6/32m62W0wJgjMxMqrVblHuqHUE+dbHtMXv7RE4tm6YnpLJ0 XJdSXKbO+w082hGvfh/ql/7TGvFkaFtAqQaVsgAo+56sHEpBLnG1lrU2In6vcJl8KIG9 ufT3mvS9GQ9CTaONt5QhAbs96Xz96aLHCQNUpy1xMeIGEvu3aFP4rHC1zPY6qyM52Zk6 W4lrnFZyBkBYpAmjH/t63z8eOnzONZAf4U3Z3hEbizS+03wGpqVn7w3XJtskbL5W7H0z /dki+qfApJTyJjfaPrIf8mC46mJzGVeMEnJKTE8cQKBIxUjCeA3hdcnzMmMYzC0eKTWn L7Hw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=YG82gTiuuy+0hjDFZwdVihvNtCRA+nbPq+TJHRMwA8g=; b=bQvTUVNmWltt33kq6Z3uZS/2ftvaOQhBHyL0KFgbvjh85wPbEyom9HpJS+V2Mz/PwI P8tWvtRadK0MWqcGzIlRyv3kWc0o6D+6x2hFl2KGX4HiChUgVp2FEPLNmHWOe8CKU4lh Pp8XCk+a+WZ4CvkKBn7pJhFhC/rCLx0qb2CwiaM9ymB9M3OSc1+4u5FtUz54hVoBLXR/ jfAMWl1naC/3oQvSm+NeewFzDWspWjDvKk7veRZGGQzGWuUZfyh652WvMZWm7Q3zCAaT PXBGAwiQcWBiaH4gGYoLGunG1QN8Dj86FeqbMSgDNxCUhZwouedYYZBnbNSRe+4swsXc 8HMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=QVtX35MH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d25si14388119pge.301.2019.09.03.05.13.02; Tue, 03 Sep 2019 05:13:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=QVtX35MH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729083AbfICMMR (ORCPT + 99 others); Tue, 3 Sep 2019 08:12:17 -0400 Received: from heliosphere.sirena.org.uk ([172.104.155.198]:48960 "EHLO heliosphere.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727077AbfICMMR (ORCPT ); Tue, 3 Sep 2019 08:12:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sirena.org.uk; s=20170815-heliosphere; h=In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=YG82gTiuuy+0hjDFZwdVihvNtCRA+nbPq+TJHRMwA8g=; b=QVtX35MHWtQ5hElB6gtdpxIeU s3sh1krACvGd+5yXcOHzgxtF3q5KhaCK6CHRslv8J4WZBfYIA9FOce5sdI9Km0OcParWy3oQYWzDW 4n7VnCclDWNi8eRH1SEtNr574EwlCS5JoO5lnRGzQIYZGJpOEMT7GGAYxubJqgiQ0EjzI=; Received: from cpc102320-sgyl38-2-0-cust46.18-2.cable.virginm.net ([82.37.168.47] helo=ypsilon.sirena.org.uk) by heliosphere.sirena.org.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1i57fP-0008VC-Na; Tue, 03 Sep 2019 12:12:11 +0000 Received: by ypsilon.sirena.org.uk (Postfix, from userid 1000) id D972B2742D32; Tue, 3 Sep 2019 13:12:10 +0100 (BST) Date: Tue, 3 Sep 2019 13:12:10 +0100 From: Mark Brown To: Ben Whitten Cc: LKML , Andreas =?iso-8859-1?Q?F=E4rber?= , Greg Kroah-Hartman , "Rafael J. Wysocki" , nandor.han@vaisala.com Subject: Re: [PATCH] regmap: fix writes to non incrementing registers Message-ID: <20190903121210.GA7916@sirena.co.uk> References: <20190813212251.12316-1-ben.whitten@gmail.com> <20190814100115.GF4640@sirena.co.uk> <20190814161938.GI4640@sirena.co.uk> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="envbJBWh7q8WU6mo" Content-Disposition: inline In-Reply-To: X-Cookie: You will pass away very quickly. User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --envbJBWh7q8WU6mo Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Sep 03, 2019 at 10:42:59AM +0100, Ben Whitten wrote: > You mentioned that we likely have breakage elsewhere, I believe that > regmap_noinc_write probably shouldn't ever have been calling > _regmap_raw_write. > Whilst regmap_noinc_read calls _regmap_raw_read, this function doesn't > do any massage and just calls map->bus->read after selecting a page. > regmap_raw_write on the other hand is meant for writing blocks to > register ranges as these added checks show, and does split work based > on page length etc. > This splitting up is something that shouldn't apply to the FIFO as it's a > deep register. This just means that we need to take care of nonincrementing registers in there, we don't want to end up with too many different places where we might have to handle formatting since that leads to duplication. It's about marshalling for physical I/O, it's a bit misnamed at this point but nonincrementing registers definitely fit in there for me. > I modified regmap_noinc_write to be much more like the raw_read > internals, just select page then attempt a map->bus->gather_write, > falling back to linearising if that's not supported. > This approach worked at getting writing working into the FIFO. Modify raw_write() to handle this instead, it is a mirror of the read side it's just that writes are more complicated since there's more things that could happen as you're discovering here. > So I would propose that there are two 'Fixes:' patches here, one > enhancing the checking when writing a register range to ensure you > don't stumble into a noinc register. Yes. > And one to fix noinc_writes to send data directly to the bus once the > page is selected with no splitting up as you would a range. Push that into raw_write(), it just needs to special case when the first register in a block is non-incrementing in the page selection logic (add a !nonincrmenting in the while loop I think). --envbJBWh7q8WU6mo Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAl1uWJoACgkQJNaLcl1U h9DPtgf/QDJZEpN/oh11BWf2OipytBVamOF1yMTPyALBAHdYTihwHFTrO7gWAbg4 V+3wRiHEpEAjudpyqt+YnTxKEt3MJm2mqfMRcVuZah/FfXFOa3SEuJeBhi8fjWdE 568d9++vG2mRlrCgqcPFZBI3VhMpifwmfiHC/r3auNIDGWhSBr1gG1T31NemVsd7 XCvOjkHGRU7SowtC5VQ75w/LKmCYzDHzGo52sCh+RCPb5BlAJF9PCHeQ6np0SDvn 0ptOHJVJZsLu1MxcR8BP+bNKDIsO5N/Fnbop9ed95wW9tIYP2M0XAA3T75UXkVpR gy2roGuCXQgZIs4QtdZ/vfJO3aQOSw== =YiAn -----END PGP SIGNATURE----- --envbJBWh7q8WU6mo--