From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752605AbbKANkz (ORCPT ); Sun, 1 Nov 2015 08:40:55 -0500 Received: from mail-wm0-f44.google.com ([74.125.82.44]:37911 "EHLO mail-wm0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752546AbbKANku (ORCPT ); Sun, 1 Nov 2015 08:40:50 -0500 From: Jens Kuske Subject: Re: [PATCH v4 1/6] clk: sunxi: Let divs clocks read the base factor clock name from devicetree To: Chen-Yu Tsai References: <1445964626-6484-1-git-send-email-jenskuske@gmail.com> <1445964626-6484-2-git-send-email-jenskuske@gmail.com> Cc: Maxime Ripard , Michael Turquette , Linus Walleij , Rob Herring , Philipp Zabel , =?UTF-8?Q?Emilio_L=c3=b3pez?= , Vishnu Patekar , Hans de Goede , devicetree , linux-arm-kernel , linux-kernel , linux-sunxi Message-ID: <56360F70.3050400@gmail.com> Date: Sun, 1 Nov 2015 14:11:12 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 30/10/15 08:46, Chen-Yu Tsai wrote: > On Wed, Oct 28, 2015 at 12:50 AM, Jens Kuske wrote: [..] >> @@ -991,8 +985,30 @@ static void __init sunxi_divs_clk_setup(struct device_node *node, >> if (data->ndivs) >> ndivs = data->ndivs; >> >> + /* Try to find a name for base factor clock */ >> + for (i = 0; i < ndivs; i++) { >> + if (data->div[i].self) { >> + of_property_read_string_index(node, "clock-output-names", >> + i, &factors.name); >> + break; >> + } >> + } >> + /* If we don't have a .self clk use the first output-name up to '_' */ > > This actually only works for the sun4i divs clocks. sun6i-a31-pll6 uses a > different naming convention. sun4i-a10-pll2 uses yet another, though that's > not a divs clock. Maybe we should work on unifying them. Maxime? All the divs clocks I could find either have a .self (handled by the first case above) or follow this naming convention, so it should work. But if we find a better way to clean up the divs without breaking devicetree bindings (as far as I understood we must not break them, am I right there?) I'd be happy with that too. Jens > > Other than these 2 bits of information, this patch looks good. > > > Regards > ChenYu > >> + if (factors.name == NULL) { >> + of_property_read_string_index(node, "clock-output-names", >> + 0, &clk_name); >> + >> + for (i = 0; i < SUNXI_DIVS_BASE_NAME_MAX_LEN - 1 && >> + clk_name[i] != '_' && >> + clk_name[i] != '\0'; i++) >> + base_name[i] = clk_name[i]; >> + >> + base_name[i] = '\0'; >> + factors.name = base_name; >> + } >> + >> /* Set up factor clock that we will be dividing */ >> - pclk = sunxi_factors_clk_setup(node, data->factors); >> + pclk = sunxi_factors_clk_setup(node, &factors); >> parent = __clk_get_name(pclk); >> >> reg = of_iomap(node, 0); >> -- >> 2.6.2 >> >