Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2352842pxj; Sat, 5 Jun 2021 23:03:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwKHMLilTacOaNaxa0lCtZUPyUKk5c6PkaSzgmjAXlmMjM09AUW34GBacuiEQTzxVkmbDPC X-Received: by 2002:a17:906:a1d2:: with SMTP id bx18mr12100651ejb.423.1622959395916; Sat, 05 Jun 2021 23:03:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622959395; cv=none; d=google.com; s=arc-20160816; b=mYiImwIhIUTsePCLVL/UL420ipdjozzxEysEMksq8ssuv5lsLPgQNzVPLDtB4N0C83 7fuuPi151zihSx+GdPTFy45KYmDDUa0NXSnsvnT63R+TWs1+Y0i7fHy3XMye/qbLlMuk E506IOol+/nOsP0Ph85Y3Lw0HJbA9FDRk1jvRWWe892cyYTO64NRS9d+Q6IZqunFQzZx 7SI83RKLyM06KzfRpi4HUdPFDNrWGnIaXg0gYZuUcw6U2kho8esxRi2vk3O848mSvhYe PxYkEV0Ljm0NEJeLeLMbO0NuTPPQtJNfDp1PVoU1Cks7nTCWd8BDlU6nVbSMd5WjHE+t 4wwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=w16KiYR0TrtGZ8FROfqmH9Z56DW2F0wTTQsA+Wp5a0Y=; b=eT+6aOPTaYxAIP9Q6d2+CHrlg6KBCn1jeP8nWNHK4fWyEO/3yRpLjIYziQOOF6nDR1 OmYhlYsgQhW7Ywz99qNlE3HDyO1ut8oWCZD/GDXPRgZNhXyJ0QAuI9DARuwi5cMkh8Ea 2gnZiL/vGH16wWttIzVdZb+r7bPP/KngcIj46bsF1zHARDlLEE8plaFodJsmdrx4a8Li lRBzuEfjosyS1HAWfJ8aNeCP2LyJYx/URg2sorDuCUbOKT+AYYKFJjA3FLB3sFRvlVbx 0ls89iMdpsGKW/8wRzQ3sWL9U7tTRMMDf3Yx+gCqbfsELi056ofbLaX0OM1sL99HFDoM S1jQ== 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 p8si8353231ejc.107.2021.06.05.23.02.52; Sat, 05 Jun 2021 23:03:15 -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 S230085AbhFFGBP (ORCPT + 99 others); Sun, 6 Jun 2021 02:01:15 -0400 Received: from muru.com ([72.249.23.125]:36958 "EHLO muru.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229504AbhFFGBP (ORCPT ); Sun, 6 Jun 2021 02:01:15 -0400 Received: from atomide.com (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTPS id 6A9FC80E5; Sun, 6 Jun 2021 05:59:31 +0000 (UTC) Date: Sun, 6 Jun 2021 08:59:20 +0300 From: Tony Lindgren To: Sven Peter Cc: Rob Herring , devicetree@vger.kernel.org, linux-clk , linux-arm-kernel , "linux-kernel@vger.kernel.org" , Hector Martin , Michael Turquette , Stephen Boyd , Mark Kettenis , Arnd Bergmann Subject: Re: [PATCH 0/3] Apple M1 clock gate driver Message-ID: References: <20210524182745.22923-1-sven@svenpeter.dev> <9ff6ec26-4b78-4684-9c23-16d5cbfef857@www.fastmail.com> <1ff54382-7137-49d6-841d-318e400e956e@www.fastmail.com> <02176203-7f29-4ff4-933b-70235cf0dd22@www.fastmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <02176203-7f29-4ff4-933b-70235cf0dd22@www.fastmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Sven Peter [210605 12:13]: > Hi Tony, > > On Fri, Jun 4, 2021, at 09:43, Tony Lindgren wrote: > > Hi, > > > > How about the following where you set up the gate clocks as separate > > child nodes: > > > > pmgr0: clock-controller@23b700000 { > > compatible = "apple,foo-clock-controller"; > > #clock-cells = <1>; > > reg = <0x2 0x3b700000 0x0 0x4000>; > > > > clk_uart0: clock@270 { > > compatible = "apple,t8103-gate-clock"; > > #clock-cells = <0>; > > assigned-clock-parents = <&pmgr0 APPLE_CLK_SIO>, > > <&pmgr0 APPLE_CLK_UART_P>; > > // ... > > }; > > > > }; > > > > Keep the clock controller still addressable by offset from base as discussed, > > and additionally have the driver parse and set up the child node clocks. > > Nice, I like that one even better! We can keep the internal clocks "hidden" > inside the parent node and only need to model the actual consumer clocks > as separate nodes. I guess the child nodes could also use just a clocks property above instead of assigned-clock related properties if there are no configurable source clock mux registers. > Are you aware of any clock driver that implements something similar? > I'd like to avoid reinventing the wheel if it's already been done before. I'm only aware of a partial implementation so far :) The "offset from clock controller base" approach has worked well for the TI clkctrl clocks. The clkctrl gate clocks still have the SoC specific source clock data build into the clock driver(s). That's the Documentation/devicetree/bindings/clock/ti-clkctrl.txt binding. For the clkctrl clocks, the SoC specific source clock data is in drivers/clk/ti/clk-*.c files. With the Apple dtb describing the gate clock parents, you might be able to leave out most of the SoC specific built-in driver data sounds like. Regards, Tony