Received: by 10.223.185.116 with SMTP id b49csp2858242wrg; Mon, 5 Mar 2018 09:47:34 -0800 (PST) X-Google-Smtp-Source: AG47ELvq9jResUdIOvn4GW0RYur/sz9wSPJ12KeaI/hRxWmo1CMjuRZNUehWCGoN34voYw6keS82 X-Received: by 10.101.98.205 with SMTP id m13mr12751808pgv.100.1520272054712; Mon, 05 Mar 2018 09:47:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520272054; cv=none; d=google.com; s=arc-20160816; b=xqY9NLQJvnCZwmlMzSQ+I2ZEHDDE+KkAZqUH1URidVz0/3B6IwQlBVwZT58LmV+aGT pxJlAwjtt8e/flE+treLOFGPmQTY0wPkYOD4ylq9Jv53dUZSYQL/olHXye27KifWTUTZ 2uORTs8qV/w5kbyRrAmomRpzsj2NpjxiBLRRRekeuikPo4dIrExuZArGjpO6GYn0e5mN VgmhZ9tRXyCoNBx7YdaYQw31CgAGgtkrF7qufp2NqxqLRCCSIcVlSvraE+1Ou6dTOnAN wkjeSQ8bPltrOmSgKbEni5n8kB14WtAyhw+AbpvH8XDh5tr+37D4LJFbNh7aIY1g1ZkY c78Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:references:cc:to:from:subject:dkim-signature :arc-authentication-results; bh=Lqt6H8MQ8lb58YAr4hwpMaugOx9F/GNEvjssZC+amz0=; b=zQCDtxL1S5ddYNQT4N688ImH4QZA5UNRWXxDz/a7WMi2E7AiNKksV/gnZojioOdOga F/oTIvHpMoCamjhNLqFsPibzkwHPUacYz/HiyU+eC1u5UVwjR2ASaYCFWlLaeXd5lRvq ajH+FeN2OWB9sM9f8XXTsfRd8FSCbXXkvHas2DUu10ktghJPw/Kx4rCDGC61nfjotxDZ wR9zqe/qaatvpu7A7/tZYQC7oUEaU3Wfs6TRu4yzLRQx14kKOtXPsQRGMBdTCcK3LZ80 qxcJQF8JKTR04eQsZOPUyEee7TezhMq7KjoxIv1rXhWplfa+0Y+/OoKtpkknyYtwy3oz mWUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@lechnology.com header.s=default header.b=RP3oTaKJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u13-v6si9483879plq.823.2018.03.05.09.47.19; Mon, 05 Mar 2018 09:47:34 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@lechnology.com header.s=default header.b=RP3oTaKJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752507AbeCERq0 (ORCPT + 99 others); Mon, 5 Mar 2018 12:46:26 -0500 Received: from vern.gendns.com ([206.190.152.46]:34062 "EHLO vern.gendns.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751723AbeCERqY (ORCPT ); Mon, 5 Mar 2018 12:46:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lechnology.com; s=default; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:MIME-Version:Date:Message-ID:References:Cc:To:From:Subject:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Lqt6H8MQ8lb58YAr4hwpMaugOx9F/GNEvjssZC+amz0=; b=RP3oTaKJ/C0S/vN++PZEMy7w2Z MFR4sYpQoNpEBPJBRlOWjifBmw8wt5mqOUNQvS8pLe23gjnev6CCgriqMD581e22UQOdH2hOkODGl JXJ9IrcbfugpYz8DTJz690+V3yqcTbPDY/D21dxjfNneo5ZBxQZsF6PDhUQrkX6tl4ckVftUqzc0z ZCud/x6LKnaybr8KJPokgEclR9gJKgoIi0F8CXLIzbGJBdvDmm9H1ezC0IP2CsZDWOPR8mYMKYbwe sknrVpoDg2NYyiTXRFN2YhkK3Xe7uMtD0M1aZSKUH9cLvwHBClCXqQGn+J2R8IQH8jdL9WXLdzeJx bI5TxanA==; Received: from 108-198-5-147.lightspeed.okcbok.sbcglobal.net ([108.198.5.147]:47078 helo=[192.168.0.134]) by vern.gendns.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.89_1) (envelope-from ) id 1esuAC-002nti-AX; Mon, 05 Mar 2018 12:44:40 -0500 Subject: Re: [PATCH v7 10/42] clk: davinci: New driver for davinci PSC clocks From: David Lechner To: Bartosz Golaszewski Cc: Bartosz Golaszewski , linux-clk@vger.kernel.org, linux-devicetree , arm-soc , Michael Turquette , Stephen Boyd , Rob Herring , Mark Rutland , Sekhar Nori , Kevin Hilman , Adam Ford , LKML References: <1519071723-31790-1-git-send-email-david@lechnology.com> <1519071723-31790-11-git-send-email-david@lechnology.com> <93696fc8-bb93-aa20-3506-3d7216c17cd2@lechnology.com> <6bbe9bf3-24c1-acd9-200d-513520d34558@lechnology.com> Message-ID: <919e6c76-0818-b330-b0f0-71c3c3f4518d@lechnology.com> Date: Mon, 5 Mar 2018 11:46:46 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - vern.gendns.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - lechnology.com X-Get-Message-Sender-Via: vern.gendns.com: authenticated_id: davidmain+lechnology.com/only user confirmed/virtual account not confirmed X-Authenticated-Sender: vern.gendns.com: davidmain@lechnology.com X-Source: X-Source-Args: X-Source-Dir: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/05/2018 10:23 AM, David Lechner wrote: > On 03/05/2018 07:02 AM, Bartosz Golaszewski wrote: >> 2018-03-01 17:44 GMT+01:00 David Lechner : >>> On 03/01/2018 02:36 AM, Bartosz Golaszewski wrote: >>>> >>>> 2018-02-28 22:40 GMT+01:00 David Lechner : >>>>> >>>>> On 02/28/2018 06:38 AM, Bartosz Golaszewski wrote: >>>>>> >>>>>> >>>>>> >>>>>> I think I found the reason for the strange crashes we were >>>>>> experiencing (emac core->name being NULL) thanks to Sekhar who pointed >>>>>> me in the right direction. >>>>>> >>>>>> The mdio driver fails to probe with v7 due to the supplied clock rate >>>>>> being wrong. Before failing we register the emac clock with >>>>>> pm_clk_add_clk(). When clock_ops puts the clock, it decreases the >>>>>> reference count of the clock, but we never actually increased it in >>>>>> the first place in the line above. The core clock code then destroys >>>>>> the associated clk_core structure. When the next user comes around (in >>>>>> our case the clk debug functions) the system crashes. >>>>>> >>>>>> I believe there to be two issues: one is with v7 - we need to increase >>>>>> the clock reference count in davinci_psc_genpd_attach_dev(). >>>>>> >>>>>> Second is the error path in the clock framework - we should remove the >>>>>> destroyed clk_core from the debug list, which is not being done now. >>>>>> >>>>>> Why we even need to track the refcount of clk_core is a mistery for me >>>>>> though. Stephen, Mike? >>>>>> >>>>>> Best regards, >>>>>> Bartosz Golaszewski >>>>> >>>>> >>>>> >>>>> Great find. I figured it had to be something like this, but I wasn't >>>>> able to reproduce the problem yet. >>>>> >>>>> I suppose it is time to spin up a v8 with some fixes. >>>> >>>> >>>> I still don't know why the mdio clock rate is much lower than in >>>> mainline though. Any ideas? >>>> >>>> Thanks, >>>> Bart >>>> >>> >>> Now that you have fixed the crash, can you answer the questions I have >>> asked earlier? >>> >>>> Can you post the output of this command so that I can see how your >>> >>> clocks are setup: >>> >>> cat /sys/kernel/debug/clk/clk_summary >>> >>>> Using your workaround, can you run: >>> >>> >>> cat /sys/kernel/debug/pm_genpd/pm_genpd_summary >>> >>> If you see: >>>    1e27000.clock-controller: emac  off-0 >>> >>> then genpd is not working like it is supposed to. You should see something >>> like this for device that are working: >>>            1e27000.clock-controller: uart2  on >>>      /devices/platform/soc@1c00000/1d0d000.serial        active >> >> Hi David, Sekhar, >> >> I tried booting the board today over tftp but didn't succeed. I then >> switched to a normal boot from SD card and the boot process froze at >> the same moment (right after the DHCP config, or after rtc config if I >> disabled DHCP in bootargs). I then realized that the emac clock can't >> be the culprit. After some digging I found out that the late_initcall >> to clk_disable_unused() disables sysclk6 - the parent of the arm >> clock, which of course freezes the device. >> >> If I remove the call to clk_disable_unused(), I can boot just fine. >> >> The following other clocks are disabled before pll0_sysclk6: >> pll1_sysclk3 >> pll0_obsclk >> pll0_sysclk7 >> >> davinci_lpsc_clk_enable() is never called for these clocks - in fact >> it's not called for any parent that's not explicitly defined in >> psc-da850.c - I believe this may be one of the reasons. I will get >> back to debugging it tomorrow. >> >> Best regards, >> Bartosz Golaszewski >> > > Thanks for continuing to dig into this. I think I know what needs to > be done now. I think I don't have the dependencies quite right where > the PSC clocks are being registered before the PLL clocks, in which > case they aren't getting the correct parent clock. > Bartosz, One more thing to check: I think I had some typos in da850.dtsi where I wrote clock_names instead of clock-names. Please make sure this is fixed in your working branch.