From: "Sven Peter" <sven@svenpeter.dev> To: "Tony Lindgren" <tony@atomide.com> Cc: "Rob Herring" <robh+dt@kernel.org>, devicetree@vger.kernel.org, linux-clk <linux-clk@vger.kernel.org>, linux-arm-kernel <linux-arm-kernel@lists.infradead.org>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>, "Hector Martin" <marcan@marcan.st>, "Michael Turquette" <mturquette@baylibre.com>, "Stephen Boyd" <sboyd@kernel.org>, "Mark Kettenis" <mark.kettenis@xs4all.nl>, "Arnd Bergmann" <arnd@kernel.org> Subject: Re: [PATCH 0/3] Apple M1 clock gate driver Date: Thu, 03 Jun 2021 14:55:45 +0200 [thread overview] Message-ID: <1ff54382-7137-49d6-841d-318e400e956e@www.fastmail.com> (raw) In-Reply-To: <YLdOsA63GyMj4SgR@atomide.com> Hi Tony, On Wed, Jun 2, 2021, at 11:26, Tony Lindgren wrote: > * Sven Peter <sven@svenpeter.dev> [210530 11:09]: > > > > Now the big question is *how* to describe this additional data in the > > dts. Essentially I need to specify that e.g. to enable clock 0x270 > > I first need to enable the (internal) clocks 0x1c0 and then 0x220. > > Are you aware of any generic way to describe this? I'm not even sure > > how a sane non-generic way would look like when I just have a single > > clock controller node. > > To me it seems you might be able to recycle the assigned-clocks and > assigned-clock-parents etc properties in the clock controller node. > > Sure the assigned-clocks property will point to clocks in the > clock controller itself, and will have tens of entries, but should > work :) Thanks for the suggestion, I really like that idea! If I understand the assigned-clocks-parent property correctly it's meant to select one of the possible parents of e.g. a mux clock at startup. Internally it just uses clk_set_parent which, unless I'm mistaken, would require to assign each clock as a possible parent of every other clock. Now the good news is that Apple seems to have sorted the clocks topologically on the bus, i.e. there never is a clock at address X that requires a parent with an address bigger than X. The bad news is that I'd probably still have to setup clocks at 0x0, 0x4, 0x8, ..., X-0x4 as possible parents of the clock at X. Another possibility this made me think of is to instead just use the clocks property the way it's usually used and simply refer to the controller itself, e.g. #define APPLE_CLK_UART0 0x270 #define APPLE_CLK_UART_P 0x220 #define APPLE_CLK_SIO 0x1c0 pmgr0: clock-controller@23b700000 { compatible = "apple,t8103-gate-clock"; #clock-cells = <1>; reg = <0x2 0x3b700000 0x0 0x4000>; clock-indices = <APPLE_CLK_SIO>, <APPLE_CLK_UART_P>, <APPLE_CLK_UART0>; clock-output-names = "clock-sio", "clock-uart-", "clock-uart0"; clocks = <&some_dummy_root_clock>, <&pmgr0 APPLE_CLK_SIO>, <&pmgr0 APPLE_CLK_UART_P>; }; to represent the UART clocks UART0 (0x23b700270), parent: UART_P UART_P (0x23b700220), parent: SIO SIO (0x23b7001c0), parent: n/a and then have the consumer as serial0: serial@235200000 { // ... clocks = <&pmgr0 APPLE_CLK_UART0>, <&clk24>; clock-names = "uart", "clk_uart_baud0"; // ... }; I'd have to see if it's possible to implement this sanely though if this binding was acceptable. The self-reference to a node that hasn't been fully initialized yet may turn out to be ugly. > > And sounds like you can generate that list with some script from the > Apple dtb. Yup, absolutely. I don't want to write this all out by hand if I can avoid that :-) > > Regards, > > Tony > Thanks, Sven
WARNING: multiple messages have this Message-ID (diff)
From: "Sven Peter" <sven@svenpeter.dev> To: "Tony Lindgren" <tony@atomide.com> Cc: "Rob Herring" <robh+dt@kernel.org>, devicetree@vger.kernel.org, linux-clk <linux-clk@vger.kernel.org>, linux-arm-kernel <linux-arm-kernel@lists.infradead.org>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>, "Hector Martin" <marcan@marcan.st>, "Michael Turquette" <mturquette@baylibre.com>, "Stephen Boyd" <sboyd@kernel.org>, "Mark Kettenis" <mark.kettenis@xs4all.nl>, "Arnd Bergmann" <arnd@kernel.org> Subject: Re: [PATCH 0/3] Apple M1 clock gate driver Date: Thu, 03 Jun 2021 14:55:45 +0200 [thread overview] Message-ID: <1ff54382-7137-49d6-841d-318e400e956e@www.fastmail.com> (raw) In-Reply-To: <YLdOsA63GyMj4SgR@atomide.com> Hi Tony, On Wed, Jun 2, 2021, at 11:26, Tony Lindgren wrote: > * Sven Peter <sven@svenpeter.dev> [210530 11:09]: > > > > Now the big question is *how* to describe this additional data in the > > dts. Essentially I need to specify that e.g. to enable clock 0x270 > > I first need to enable the (internal) clocks 0x1c0 and then 0x220. > > Are you aware of any generic way to describe this? I'm not even sure > > how a sane non-generic way would look like when I just have a single > > clock controller node. > > To me it seems you might be able to recycle the assigned-clocks and > assigned-clock-parents etc properties in the clock controller node. > > Sure the assigned-clocks property will point to clocks in the > clock controller itself, and will have tens of entries, but should > work :) Thanks for the suggestion, I really like that idea! If I understand the assigned-clocks-parent property correctly it's meant to select one of the possible parents of e.g. a mux clock at startup. Internally it just uses clk_set_parent which, unless I'm mistaken, would require to assign each clock as a possible parent of every other clock. Now the good news is that Apple seems to have sorted the clocks topologically on the bus, i.e. there never is a clock at address X that requires a parent with an address bigger than X. The bad news is that I'd probably still have to setup clocks at 0x0, 0x4, 0x8, ..., X-0x4 as possible parents of the clock at X. Another possibility this made me think of is to instead just use the clocks property the way it's usually used and simply refer to the controller itself, e.g. #define APPLE_CLK_UART0 0x270 #define APPLE_CLK_UART_P 0x220 #define APPLE_CLK_SIO 0x1c0 pmgr0: clock-controller@23b700000 { compatible = "apple,t8103-gate-clock"; #clock-cells = <1>; reg = <0x2 0x3b700000 0x0 0x4000>; clock-indices = <APPLE_CLK_SIO>, <APPLE_CLK_UART_P>, <APPLE_CLK_UART0>; clock-output-names = "clock-sio", "clock-uart-", "clock-uart0"; clocks = <&some_dummy_root_clock>, <&pmgr0 APPLE_CLK_SIO>, <&pmgr0 APPLE_CLK_UART_P>; }; to represent the UART clocks UART0 (0x23b700270), parent: UART_P UART_P (0x23b700220), parent: SIO SIO (0x23b7001c0), parent: n/a and then have the consumer as serial0: serial@235200000 { // ... clocks = <&pmgr0 APPLE_CLK_UART0>, <&clk24>; clock-names = "uart", "clk_uart_baud0"; // ... }; I'd have to see if it's possible to implement this sanely though if this binding was acceptable. The self-reference to a node that hasn't been fully initialized yet may turn out to be ugly. > > And sounds like you can generate that list with some script from the > Apple dtb. Yup, absolutely. I don't want to write this all out by hand if I can avoid that :-) > > Regards, > > Tony > Thanks, Sven _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2021-06-03 12:56 UTC|newest] Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-05-24 18:27 [PATCH 0/3] Apple M1 clock gate driver Sven Peter 2021-05-24 18:27 ` Sven Peter 2021-05-24 18:27 ` [PATCH 1/3] dt-bindings: clock: add DT bindings for apple,gate-clock Sven Peter 2021-05-24 18:27 ` Sven Peter 2021-05-24 18:27 ` [PATCH 2/3] clk: add support for gate clocks on Apple SoCs Sven Peter 2021-05-24 18:27 ` Sven Peter 2021-05-26 3:09 ` Stephen Boyd 2021-05-26 3:09 ` Stephen Boyd 2021-05-30 11:17 ` Sven Peter 2021-05-30 11:17 ` Sven Peter 2021-05-24 18:27 ` [PATCH 3/3] arm64: apple: add uart gate clocks Sven Peter 2021-05-24 18:27 ` Sven Peter 2021-05-26 3:10 ` Stephen Boyd 2021-05-26 3:10 ` Stephen Boyd 2021-05-30 11:11 ` Sven Peter 2021-05-30 11:11 ` Sven Peter 2021-05-25 17:41 ` [PATCH 0/3] Apple M1 clock gate driver Rob Herring 2021-05-25 17:41 ` Rob Herring 2021-05-26 7:18 ` Tony Lindgren 2021-05-26 7:18 ` Tony Lindgren 2021-05-30 11:08 ` Sven Peter 2021-05-30 11:08 ` Sven Peter 2021-06-02 9:26 ` Tony Lindgren 2021-06-02 9:26 ` Tony Lindgren 2021-06-03 12:55 ` Sven Peter [this message] 2021-06-03 12:55 ` Sven Peter 2021-06-04 7:43 ` Tony Lindgren 2021-06-04 7:43 ` Tony Lindgren 2021-06-05 12:12 ` Sven Peter 2021-06-05 12:12 ` Sven Peter 2021-06-06 5:59 ` Tony Lindgren 2021-06-06 5:59 ` Tony Lindgren 2021-05-30 11:05 ` Sven Peter 2021-05-30 11:05 ` Sven Peter 2021-06-02 9:28 ` Tony Lindgren 2021-06-02 9:28 ` Tony Lindgren
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1ff54382-7137-49d6-841d-318e400e956e@www.fastmail.com \ --to=sven@svenpeter.dev \ --cc=arnd@kernel.org \ --cc=devicetree@vger.kernel.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-clk@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=marcan@marcan.st \ --cc=mark.kettenis@xs4all.nl \ --cc=mturquette@baylibre.com \ --cc=robh+dt@kernel.org \ --cc=sboyd@kernel.org \ --cc=tony@atomide.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.