Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2794582imj; Mon, 11 Feb 2019 08:34:44 -0800 (PST) X-Google-Smtp-Source: AHgI3IZAuR1NV+zhuAC9ogwzwqSDBeGAxa3+fSVRDJkO9IPJhauF8JtocVHIsajKy2S/mRpm3WIt X-Received: by 2002:a17:902:2dc3:: with SMTP id p61mr37685835plb.166.1549902884001; Mon, 11 Feb 2019 08:34:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549902883; cv=none; d=google.com; s=arc-20160816; b=rWR7GaNadALK0coNV00RCrhgcGDb8YciBw2zuSOzrRU/lN1A/Q5BYdlxk7CCrEpHC9 hogBh9u+/oEjPjdzbFs7LEqv6FFjWVpsRn+p/x3cv/kMN9qHq/9btx6AeXKa3GZaiJlV aaHsaqAJ60u6YLao9+n5j9BPS0SVEF/4inIO2LzMEAElyOEJQsGRLLIj7gWS3yWTg/5N 1EzmryQEh2ymZSKZAr6GYk0SHYkT3SGeZDPNun9l8twxFv1FKqVxwozWmuUZiFOUzDsd SMBOyqQHT4dc1uAL7wkwrNVfuU6nQD86ck763jLeiPNks2TDFtuclQmkCHFnOp3YJ6q7 4ukw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:references:cc:to:from:subject; bh=xoj76eMnDeGfw8dMR6iWuUkB1t89EQnVW3PA0ImoXyM=; b=0fn7GtsCXkHOTyhCWs0B1rs4zr28ZGJLEu1VK9woNq4mTAsYS/Aei+JC4aR9EVm1aV p1x6fgGC56mbRddjn9mWDdc7SJGiDpLnA5rCMMcx88sFe5xf4lF6TMMtIzMrUbP+qh0U VEdHDyk6DuSevaVctfe9EIG1QftVgs+7YHqOafjqGtVb+yajEVuACoO8T315jZAtWYlc eCnqGHCnqFGky3ZCW7r7j74qAS+30pFzPT12aGVmBGyjvC8K1InmSaiVIMUlwecww0KI cOtTEShiWzm1MpzKNE0bEsh1C2VcLYU+ifcS9mHDPFMlQcACLxu1FJP80UM2kKtbwvQf xuNg== 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 e21si9224429pgv.271.2019.02.11.08.34.26; Mon, 11 Feb 2019 08:34:43 -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 S1728867AbfBKQcs (ORCPT + 99 others); Mon, 11 Feb 2019 11:32:48 -0500 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:50070 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727084AbfBKQcr (ORCPT ); Mon, 11 Feb 2019 11:32:47 -0500 Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx08-00178001.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x1BGUtYY018755; Mon, 11 Feb 2019 17:32:33 +0100 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx08-00178001.pphosted.com with ESMTP id 2qjfy5yf5f-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Mon, 11 Feb 2019 17:32:33 +0100 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 931EA34; Mon, 11 Feb 2019 16:32:32 +0000 (GMT) Received: from Webmail-eu.st.com (sfhdag5node3.st.com [10.75.127.15]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 5FC845235; Mon, 11 Feb 2019 16:32:32 +0000 (GMT) Received: from [10.48.0.167] (10.75.127.51) by SFHDAG5NODE3.st.com (10.75.127.15) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Mon, 11 Feb 2019 17:32:31 +0100 Subject: Re: [PATCH v2 2/3] mfd: syscon: Add optional clock support From: Fabrice Gasnier To: Arnd Bergmann CC: Lee Jones , Rob Herring , Alexandre Torgue , Maxime Coquelin , Mark Rutland , Gabriel Fernandez , DTML , Linux Kernel Mailing List , , Linux ARM References: <1544604495-4082-1-git-send-email-fabrice.gasnier@st.com> <1544604495-4082-3-git-send-email-fabrice.gasnier@st.com> <9e0ee154-a399-9bff-3beb-adfd9d6c6fee@st.com> <47a3fe9f-8adb-8f47-e7c1-342f8fc318aa@st.com> Message-ID: <01d49f11-a68e-1674-e6b7-d1b87aa973c9@st.com> Date: Mon, 11 Feb 2019 17:32:30 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <47a3fe9f-8adb-8f47-e7c1-342f8fc318aa@st.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.75.127.51] X-ClientProxiedBy: SFHDAG3NODE2.st.com (10.75.127.8) To SFHDAG5NODE3.st.com (10.75.127.15) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-02-11_11:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/28/19 2:20 PM, Fabrice Gasnier wrote: > On 1/16/19 4:11 PM, Arnd Bergmann wrote: >> On Wed, Jan 16, 2019 at 3:10 PM Fabrice Gasnier wrote: >>> >>> On 1/16/19 1:14 PM, Arnd Bergmann wrote: >>>> (sorry for the late reply, I just realized that I had never sent out the >>>> mail after Lee asked me for a review last year and I had drafted >>>> my reply). >>> >>> Hi Arnd, >>> >>> Many thanks for reviewing, no worries :-) >>> >>>> >>>> On Wed, Dec 12, 2018 at 9:48 AM Fabrice Gasnier wrote: >>>>> >>>>> Some system control registers need to be clocked, so the registers can >>>>> be accessed. Add an optional clock and attach it to regmap. >>>>> >>>>> Signed-off-by: Fabrice Gasnier >>>> >>>> This looks ok to me in principle, but I have one question: When we >>>> do a clk_get() and clk_prepare() as part of regmap_mmio_attach_clk(), >>>> does that change the behavior of syscon nodes that are otherwise >>>> unused? >>> >>> I'm not sure I correctly understand this question. I don't think it will >>> change the behavior for "unused" nodes. These should remain unused with >>> this patch. >> >> What I mean is that nodes that listed as 'compatible="syscon"' get >> probed by the syscon driver even when no other driver references >> them, and that in turn would acquire the clock, right? > > Hi Arnd, > > Sorry for the late reply. > > When no other driver references them, nothing happens at probe time on > the clock: no calls to get/prepare... the clock. > > => The clock will remain unrequested & unused until another driver calls > one of "of_syscon_register()" variants: > - syscon_node_to_regmap > - syscon_regmap_lookup_by_compatible > - syscon_regmap_lookup_by_phandle > > When another driver references them (e.g. one of the above calls), then > it will acquire the optional clock and use it, e.g.: > - clk_prepare() upon of_syscon_register() variants > - clk_enable & clk_disable when accessing the registers > > I hope this clarifies. > > Please advise, > Best Regards, > Fabrice Hi Arnd, Gentlemen reminder for this. I would appreciate to have your feedback. Many thanks, Fabrice > >> >>>> I think we have a bunch of devices that started out as a syscon but >>>> then we added a proper driver for them, which would handle the >>>> clocks explicitly. Is it guaranteed that this will keep working (including >>>> shutting down the clocks when they are unused) if we have two drivers >>>> that call clk_get() on the same device node? >>> >>> I'd expect nothing wrong happens when two drivers call clk_get() for the >>> same clock. >>> Are there some case where two drivers are bind (e.g. syscon driver + >>> another driver) for the same piece of hardware ? >> >> You won't actually have two drivers binding to the same device, but you >> could have a driver and a syscon user that does relies on the >> syscon_regmap_lookup_by_*() functions. >> >> I think we've had a couple of cases where we started out representing >> a device as syscon, and then later decided that a high-level abstraction >> would be needed because syscon didn't quite support all the needed >> features. >> >> Since each syscon node should also have a more specific >> compatible value, you can then have another driver that binds >> to that compatible string. >> >> Arnd >>