Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp598083ybc; Tue, 19 Nov 2019 06:22:55 -0800 (PST) X-Google-Smtp-Source: APXvYqxQyDU5fBPkTcKDwkoOwa7a3A1JOXzP5N/mw0p1mfPmUPeL2LTT8EZ5Kg50hkqepWxOyU8N X-Received: by 2002:a7b:c768:: with SMTP id x8mr6277496wmk.26.1574173375786; Tue, 19 Nov 2019 06:22:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574173375; cv=none; d=google.com; s=arc-20160816; b=MQBNGRIjji04gmY3bWj2bdgOYdeSd0H34UOq+mSUmxw4UAT4EJaCpZCJOeVCn7nGY2 P1n2Tz+B2rXBkBlVcIfhqAijnz4yJE6EPF8KnRt/2GEcz9GEZLgt+XivagWwXW/LqTWK DBug7c7U/g9dDivb9dSPB6v7ursJzJNtqQ4hYcqZHzoYFzzwFOx1Wwh9LlWwPHTwMle5 oKzaSsYlAi/RJh8E6WwH0xWD2fqYOmRVx8uizeAtsMaMDV7rV+uDFdKdEdgh/tvso/Zi Lxad+i00pwQlBCOmP13bPj0ePdonYlNwJNh0wHxlHYFdEjwtSJywfvZt04SiVmLqw3KL mSSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=0vplzSQeM+yx3hEaPbma9vhspYzRm4HnGXPaSAw3MUg=; b=gb1/pNLyuAXFpLG+CnowGqxc+8xI3IPvyB1Sc/SSzx4lp+Lgq+xYkY5AvLjQEyVmRv 7xGpr+BQROlisdNFBkBs5ecqNeaQu6NpTFKozmLaAz6vhpfgJ90UkWl8E9Wwq1rMWeCl aURxFesjpYj0fULDw3OtN8zui7VU66c3EGrmT7tfol29b3PLWJL3WN8wP4l37BDVgZ4e s9BHbWhgv/xu7TT1El3n0hhsvXHmo8HXo0Vf1zB7Xch7r/e1Cn+fJcPeRZSb79PasRaU /U4gJVlFrqLFA17Yfonpje6UTAdJ/qA20RNhHw+0dSRw2mevf4WhCqFmqp2ma9IcBqbf 5c9A== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n4si14465081edy.53.2019.11.19.06.22.32; Tue, 19 Nov 2019 06:22:55 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727682AbfKSOUc (ORCPT + 99 others); Tue, 19 Nov 2019 09:20:32 -0500 Received: from mout.kundenserver.de ([212.227.17.13]:58385 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726202AbfKSOUb (ORCPT ); Tue, 19 Nov 2019 09:20:31 -0500 Received: from mail-lj1-f169.google.com ([209.85.208.169]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.145]) with ESMTPSA (Nemesis) id 1N3sNa-1hopfK0gXw-00zqGk; Tue, 19 Nov 2019 15:20:30 +0100 Received: by mail-lj1-f169.google.com with SMTP id n21so23476058ljg.12; Tue, 19 Nov 2019 06:20:30 -0800 (PST) X-Gm-Message-State: APjAAAUkc6WIgm9AxzCxawAeIQ+EFg4xiQ6pOFIfjMgUOSy1oCOnoq2J iaDGceFNIJ5OrttRDv7ugoYOmAPGwBTTy3HBKGc= X-Received: by 2002:a2e:9216:: with SMTP id k22mr4251098ljg.157.1574173229541; Tue, 19 Nov 2019 06:20:29 -0800 (PST) MIME-Version: 1.0 References: <20191114114525.12675-1-orson.zhai@unisoc.com> <20191114114525.12675-2-orson.zhai@unisoc.com> <20191118083952.GB6039@spreadtrum.com> In-Reply-To: <20191118083952.GB6039@spreadtrum.com> From: Arnd Bergmann Date: Tue, 19 Nov 2019 15:20:12 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/2] dt-bindings: Add syscon-names support To: Orson Zhai Cc: Orson Zhai , Lee Jones , Rob Herring , Mark Rutland , DTML , "linux-kernel@vger.kernel.org" , kevin.tang@unisoc.com Content-Type: text/plain; charset="UTF-8" X-Provags-ID: V03:K1:vXMbzqODOK9Gy8gjNJQaFObvxW8cU5um4AV5Y3do8MlVoNMLwYZ QSXwAV3lpPKXfv0hDP6JTK9TApIrUdL2bHq8tBhOtaI3lKJFmXf3a0v/kMV165WRAm1bylb 7V4QjazEY//FWG2qaFnc3Ci/TmY9QF0lOgWJdKRmaO9mTB5STOzG/cDZXFwddrAooqyB76f guZN/g/aQVWXn2CuHSb4w== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:5gWmMGTk0og=:RMAp8FsshDbOaegrptuD65 eB6ONnQ1vU5mEoGSdFbfPZzPbmQ5IaLvujmkQaOXFzFYNuAXPYnfuamvywEwCFV0KHhM7nk9q elvUYV/kJQzYxCNEqnTEdrVEu8zqDt8NvQnlGqApMrtLFxr9hg2916Ij+Z2QY1RnXRUlSi6bH rdo8YbMln+UN8F5DlbNTFdmEePtknVMagUKXIzJYV2BgbTQgXlH1kXB0tVFlOWIj4YbWLDkAC SusL/RX9tXYoBUuBzSR78TqE78udrkRE+2TYCQZ2yVxti7TGi7igo20+I/Q5IWzjCzzHHEW7D u/Y1+1RhszozYU4XZ0W53kirsqKLzyzBtJB7Edmgveq35ilNFY3TZkplepu4xFAGLW8lf+5ja djCobFdhDeOMN1ASoJA8zMmi4yiR7+nsyetkmwTT5Rc5vaHbJfHtq/cOT+u80sqQxABugKNNQ lIRtvD+zjPu4JrZTKP/4fNz0sWhn4lU7uGzN7SMIlBlIsxExQjXNZLXSDa3p1e5kDw93JCqdq XH/k//KQ+Y6xgdv4P6RTeZpe0ZnwnwJ9DOoa9my/6vCnDAvr4eNaoapYpqjqfgFa+acTrlLxs kIW3tnLwlHgjvW9RWGNe1qNE++HVjdYffFAKYBZNkblwwdo+AXyThvvpeDUpZ4u6k0uFkbjdP rBm771+175sHchq/WYkUXFB4s83BvKs/kWYZ3PzkHS82QIXApB6LeFLfagTl8ClmQ884vtBmF 3N2pK5HsJtkWeQOTgm6tOnwMJJ8Gy0Gbiw0kNwl6mKw0fCTKUWY8DuCboig8qE5sbAwWa8ObZ vcjZPrKZVLjjrCN1283LjOuTc28YqNDE7lepe2fydblFvtN3aCAXqKBqu+9g8e5+2qj9ULr2K /GFKonSOyRbsjRAebwXA== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 18, 2019 at 9:42 AM Orson Zhai wrote: > > Hi Arnd, > > On Fri, Nov 15, 2019 at 10:33:30AM +0100, Arnd Bergmann wrote: > > On Thu, Nov 14, 2019 at 12:48 PM Orson Zhai wrote: > > > > > > > > > Make life easier when syscon consumer want to access multiple syscon > > > nodes. > > > Add syscon-names and relative properties to help manage complicated > > > cases when accessing more one syscon node. > > > > > > Signed-off-by: Orson Zhai > > > > Hi Orson, > > > > Can you explain why the number of cells in this binding is specific > > to the syscon node rather than the node referencing it? > > The story is like this. I found there are too many global registers in > Unisoc(former Spreadtrum) chips. Dozens of offset with dozens of modules > were needed to be specified. So I thought the dts files would seem "horrible" > with a big chunk of syscon-xxx (say more than 20 lines) > > I learned from reg-names way which might look clean to hold all these mess things. > But to implement this, the users need to konw the cell-size if we add arguments to syscon node. > I thought to add cell-size into every syscon consumer node is a duplicated work and > I wanted to take advantage of of_parse_phandle_with_args. > So the bindings were created then. Ok, that makes sense. > > The way would otherwise handle the example from your binding > > would be with two separate properties in the display node, like > > > > syscon-enable = <&ap_apb_regs 0x4 0xf00>; > > syscon-power = <&aon_regs 0x8>; > > This is an option for consumers all the time. > Acturally my patches are not going to replace this. > I'd like to provide another option to save people like desperate engineers in Spreadtrum :) > > > > > in which case, the syscon driver does not need to know anything > > Whould it be better if I add syscon-cells into consumer's node? As I see it, there is no reason to put the syscon-cells property into any node, as this is implied by the driver binding using the syscon reference. I would only use the #xyz-cells style property if there are multiple interpretations that all make sense for the same binding. > Then I could read the cell size and use "of_parse_phandle_with_fixed_args()" instead. > This will not involve syscon node itself at all. This sounds better to me, yes. I had not even remembered this function exists, but I think this is a good idea. I can also see a point in favor of adding more infrastructure around this, possibly naming the entries in a syscon-names property as you suggested, combining of_parse_phandle_with_fixed_args() with a name, or combining with syscon_regmap_lookup_by_phandle() for convenience. This should all be possible without adding complexity to the syscon DT binding itself, and it would give more structure to the way it is used by drivers. Arnd