From patchwork Thu Oct 6 13:44:44 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Martinez Canillas X-Patchwork-Id: 9364849 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 232D36077E for ; Thu, 6 Oct 2016 13:44:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1455A29032 for ; Thu, 6 Oct 2016 13:44:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 08F9429034; Thu, 6 Oct 2016 13:44:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B770129032 for ; Thu, 6 Oct 2016 13:44:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S941822AbcJFNoy (ORCPT ); Thu, 6 Oct 2016 09:44:54 -0400 Received: from ec2-52-27-115-49.us-west-2.compute.amazonaws.com ([52.27.115.49]:56828 "EHLO s-opensource.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S941813AbcJFNox (ORCPT ); Thu, 6 Oct 2016 09:44:53 -0400 Received: from localhost (localhost [127.0.0.1]) by s-opensource.com (Postfix) with ESMTP id 2634DA0E77; Thu, 6 Oct 2016 13:44:59 +0000 (UTC) X-Virus-Scanned: amavisd-new at osg.samsung.com Received: from s-opensource.com ([127.0.0.1]) by localhost (s-opensource.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qKN9L2NMo31z; Thu, 6 Oct 2016 13:44:57 +0000 (UTC) Received: from [192.168.0.4] (unknown [181.121.136.80]) by s-opensource.com (Postfix) with ESMTPSA id 1CB44A0DFA; Thu, 6 Oct 2016 13:44:54 +0000 (UTC) Subject: Re: Problem: "clk: max77686: Migrate to clk_hw based OF and registration APIs" breaks s3c-rtc on Odroid U3 To: Tobias Jakobi , Markus Reichl , linux-samsung-soc@vger.kernel.org, stephen.boyd@linaro.org, krzk@kernel.org References: <29925ac0-3c97-df1d-0700-de25f1191082@fivetechno.de> <57F63554.1050703@math.uni-bielefeld.de> Cc: ldewangan@nvidia.com From: Javier Martinez Canillas Message-ID: <48b59954-02c6-424f-c485-02edd637ef6d@osg.samsung.com> Date: Thu, 6 Oct 2016 10:44:44 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: <57F63554.1050703@math.uni-bielefeld.de> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hello, On 10/06/2016 08:28 AM, Tobias Jakobi wrote: > Hello, > > I quickly went over the commit, and I don't see the 'num_clks' fields > being initialized anywhere. So that's probably the reason why it's > always zero and the check in of_clk_max77686_get() fails. > Tobias is correct, that's the issue. I wonder why it worked for me when I tested the patch, probably because the bootloader enables the clocks so I didn't see the difference... Anyways, following is a patch [0] as suggested by Tobias. I don't have access to my platform now to test but if it fixes the issue I can post it as a proper patch. [0]: From 93402366eb4b2e39f2885cb11066d90b70f0c1b8 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Thu, 6 Oct 2016 10:20:02 -0300 Subject: [RFT PATCH] clk: max77686: fix number of clocks setup for clk_hw based registration The commit 9b4cac33adc7 ("clk: max77686: Migrate to clk_hw based OF and registration APIs") converted the driver to use the new provider API to register clocks using clk_hw. But unfortunately, in the conversion it missed to set the num_clks value which lead to the following error when trying to register a clk provider: [ 1.963782] of_clk_max77686_get: invalid index 0 [ 1.967460] ERROR: could not get clock /rtc@10070000:rtc_src(1) [ 1.973638] s3c-rtc 10070000.rtc: failed to find rtc source clock Fix it by correctly set the max77686_clk_driver_data .num_clks member. Fixes: 9b4cac33adc7 ("clk: max77686: Migrate to clk_hw based OF and registration APIs") Reported-by: Markus Reichl Suggested-by: Tobias Jakobi Signed-off-by: Javier Martinez Canillas Tested-by: Markus Reichl --- drivers/clk/clk-max77686.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/clk/clk-max77686.c b/drivers/clk/clk-max77686.c index b637f5979023..eb953d3b0b69 100644 --- a/drivers/clk/clk-max77686.c +++ b/drivers/clk/clk-max77686.c @@ -216,6 +216,7 @@ static int max77686_clk_probe(struct platform_device *pdev) return -EINVAL; } + drv_data->num_clks = num_clks; drv_data->max_clk_data = devm_kcalloc(dev, num_clks, sizeof(*drv_data->max_clk_data), GFP_KERNEL);