From patchwork Fri Dec 2 15:38:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 9458819 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 CF67960515 for ; Fri, 2 Dec 2016 15:40:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C3D7828489 for ; Fri, 2 Dec 2016 15:40:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B88BD2849B; Fri, 2 Dec 2016 15:40:12 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 6759928489 for ; Fri, 2 Dec 2016 15:40:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753025AbcLBPja (ORCPT ); Fri, 2 Dec 2016 10:39:30 -0500 Received: from mail-wm0-f41.google.com ([74.125.82.41]:37712 "EHLO mail-wm0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751882AbcLBPj1 (ORCPT ); Fri, 2 Dec 2016 10:39:27 -0500 Received: by mail-wm0-f41.google.com with SMTP id t79so19179682wmt.0 for ; Fri, 02 Dec 2016 07:39:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=pbphaGTlW0ssvSHDYhfWD72uf9ImSP1e9AbisRXbycY=; b=K6eyasesdsc5kccKHHTjtUCUhagNM0eaLR6+R68dlXaPVXtRNTkz6NRN1fVB2kTV7o 4JLDjQVkUP+JG/HpLn78cKgr8cwOrkdwPxDJaGdzd23BC5y+yA1I+3cHHhoLVgBHmomV GydEckealpJ5nYnc89qrcbqISQ6PSLH/ZFh7SNyiMaBSju6FvQ3R+ks/azOAj8ovBpn4 POjkO+r9uBoRQkzAVgAoACHa/MAoewnyt3lLcVK2PnrCBxRYVuj1PEGbVt8KTmoVISQo 10+9ANEQzac4zX8Wau42/wbOwglVyC9D3zuoIVRWrXJwjdZC70Mcl3lsfOgg+Bg6bwnu u/Lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=pbphaGTlW0ssvSHDYhfWD72uf9ImSP1e9AbisRXbycY=; b=NmeIZv82Vx2wNZ7tFcyPEh5i26W4PznbQX3UfQqnRnzxBmbJG0e2dmX9BIK6TolNwz LzG0Mi0wpp/wKT1rRMUAbTiqsIOzK1eSxIUYI8+acqtUBYJWfq9ybgGlHi2BxClVbB0K pIIkQU9zyqF+avv7k6MYnZHBhQiNLznEPd/fihLjznEwiRJwVk13FAhmuXC3caGePCNf jsGLvJfHZLaTelqikO6YzJt2vBFwHyBpRBzTmUjNK0cIfzcfeGIXEgri+fPGrot3HetG EFo9om3lPPSQJekXf7oMudsWY+CbaUM0VpZhBhZZEUa6PiBgPX0tL2FZn1GTfpaVf7Dq BTOg== X-Gm-Message-State: AKaTC00TKQw/YrxXnMDVN+Oi0zh/N8xL65lk81MIttEVxEziAFaDIuJ5OANVcQc1PvsW6t2c X-Received: by 10.28.27.208 with SMTP id b199mr3394502wmb.82.1480693165733; Fri, 02 Dec 2016 07:39:25 -0800 (PST) Received: from bgdev-debian.lan (jua06-1-82-242-157-225.fbx.proxad.net. [82.242.157.225]) by smtp.gmail.com with ESMTPSA id x140sm3769666wme.19.2016.12.02.07.39.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 02 Dec 2016 07:39:25 -0800 (PST) From: Bartosz Golaszewski To: Kevin Hilman , Michael Turquette , Sekhar Nori , Peter Ujfalusi , Russell King , Viresh Kumar , Boris Brezillon , "Rafael J. Wysocki" , Richard Weinberger , David Woodhouse , Brian Norris , Marek Vasut , Cyrille Pitchen Cc: LKML , arm-soc , linux-pm@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH v2 1/3] ARM: da850: fix infinite loop in clk_set_rate() Date: Fri, 2 Dec 2016 16:38:52 +0100 Message-Id: <1480693134-31324-2-git-send-email-bgolaszewski@baylibre.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1480693134-31324-1-git-send-email-bgolaszewski@baylibre.com> References: <1480693134-31324-1-git-send-email-bgolaszewski@baylibre.com> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The aemif clock is added twice to the lookup table in da850.c. This breaks the children list of pll0_sysclk3 as we're using the same list links in struct clk. When calling clk_set_rate(), we get stuck in propagate_rate(). Create a separate clock for nand, inheriting the rate of the aemif clock and retrieve it in the davinci_nand module. Signed-off-by: Bartosz Golaszewski --- arch/arm/mach-davinci/da850.c | 7 ++++++- drivers/mtd/nand/davinci_nand.c | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c index e770c97..1fcc986 100644 --- a/arch/arm/mach-davinci/da850.c +++ b/arch/arm/mach-davinci/da850.c @@ -367,6 +367,11 @@ static struct clk aemif_clk = { .flags = ALWAYS_ENABLED, }; +static struct clk nand_clk = { + .name = "nand", + .parent = &aemif_clk, +}; + static struct clk usb11_clk = { .name = "usb11", .parent = &pll0_sysclk4, @@ -537,7 +542,7 @@ static struct clk_lookup da850_clks[] = { CLK("da830-mmc.0", NULL, &mmcsd0_clk), CLK("da830-mmc.1", NULL, &mmcsd1_clk), CLK("ti-aemif", NULL, &aemif_clk), - CLK(NULL, "aemif", &aemif_clk), + CLK(NULL, "nand", &nand_clk), CLK("ohci-da8xx", "usb11", &usb11_clk), CLK("musb-da8xx", "usb20", &usb20_clk), CLK("spi_davinci.0", NULL, &spi0_clk), diff --git a/drivers/mtd/nand/davinci_nand.c b/drivers/mtd/nand/davinci_nand.c index 27fa8b8..5857d06 100644 --- a/drivers/mtd/nand/davinci_nand.c +++ b/drivers/mtd/nand/davinci_nand.c @@ -694,7 +694,7 @@ static int nand_davinci_probe(struct platform_device *pdev) ret = -EINVAL; - info->clk = devm_clk_get(&pdev->dev, "aemif"); + info->clk = devm_clk_get(&pdev->dev, "nand"); if (IS_ERR(info->clk)) { ret = PTR_ERR(info->clk); dev_dbg(&pdev->dev, "unable to get AEMIF clock, err %d\n", ret);