From mboxrd@z Thu Jan 1 00:00:00 1970 From: jbrunet@baylibre.com (Jerome Brunet) Date: Mon, 15 Jan 2018 13:45:33 +0100 Subject: [RFT net-next v4 3/5] net: stmmac: dwmac-meson8b: fix internal RGMII clock configuration In-Reply-To: References: <20180114214858.7217-1-martin.blumenstingl@googlemail.com> <20180114214858.7217-4-martin.blumenstingl@googlemail.com> <1516016986.2608.16.camel@baylibre.com> Message-ID: <1516020333.2608.24.camel@baylibre.com> To: linus-amlogic@lists.infradead.org List-Id: linus-amlogic.lists.infradead.org On Mon, 2018-01-15 at 13:08 +0100, Martin Blumenstingl wrote: > can you share your thoughts how to do this? > I can devm_kzalloc the memory for struct clk_mux, clk_divider and > clk_fixed_factor in the function which registers these clocks. but I > cannot declare them on the stack, because the clk-* implementations > still need it during runtime You can declare the init_data on the stack, CCF makes a copy of what it needs. For clk_mux, clk_gate and friends, yes, use devm functions is the way to go For the struct *clk, you can also use devm. Just keep a reference on the leaf clock to be able to call set_rate() and prepare_enable(). You don't need the rest. > this would leave us with only the struct clk instances in meson8_dwmac You may have a look at drivers/mmc/host/meson-gx-mmc.c. The clock scheme of this IP is actually very clock the ethernet one. Cheers From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jerome Brunet Subject: Re: [RFT net-next v4 3/5] net: stmmac: dwmac-meson8b: fix internal RGMII clock configuration Date: Mon, 15 Jan 2018 13:45:33 +0100 Message-ID: <1516020333.2608.24.camel@baylibre.com> References: <20180114214858.7217-1-martin.blumenstingl@googlemail.com> <20180114214858.7217-4-martin.blumenstingl@googlemail.com> <1516016986.2608.16.camel@baylibre.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Cc: netdev@vger.kernel.org, ingrassia@epigenesys.com, linus.luessing@c0d3.blue, khilman@baylibre.com, linux-amlogic@lists.infradead.org, Neil Armstrong , peppe.cavallaro@st.com, alexandre.torgue@st.com To: Martin Blumenstingl Return-path: Received: from mail-wm0-f68.google.com ([74.125.82.68]:43543 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966666AbeAOMpg (ORCPT ); Mon, 15 Jan 2018 07:45:36 -0500 Received: by mail-wm0-f68.google.com with SMTP id g1so1661647wmg.2 for ; Mon, 15 Jan 2018 04:45:35 -0800 (PST) In-Reply-To: Sender: netdev-owner@vger.kernel.org List-ID: On Mon, 2018-01-15 at 13:08 +0100, Martin Blumenstingl wrote: > can you share your thoughts how to do this? > I can devm_kzalloc the memory for struct clk_mux, clk_divider and > clk_fixed_factor in the function which registers these clocks. but I > cannot declare them on the stack, because the clk-* implementations > still need it during runtime You can declare the init_data on the stack, CCF makes a copy of what it needs. For clk_mux, clk_gate and friends, yes, use devm functions is the way to go For the struct *clk, you can also use devm. Just keep a reference on the leaf clock to be able to call set_rate() and prepare_enable(). You don't need the rest. > this would leave us with only the struct clk instances in meson8_dwmac You may have a look at drivers/mmc/host/meson-gx-mmc.c. The clock scheme of this IP is actually very clock the ethernet one. Cheers