From patchwork Wed Dec 7 15:22:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 9464715 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 3CB6C60459 for ; Wed, 7 Dec 2016 15:25:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4007728493 for ; Wed, 7 Dec 2016 15:25:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 34655284F5; Wed, 7 Dec 2016 15:25:45 +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=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6A93428493 for ; Wed, 7 Dec 2016 15:25:42 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1cEe4T-0004mx-B2; Wed, 07 Dec 2016 15:23:49 +0000 Received: from mail-wj0-x230.google.com ([2a00:1450:400c:c01::230]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1cEe3U-0003tr-Hn for linux-arm-kernel@lists.infradead.org; Wed, 07 Dec 2016 15:22:58 +0000 Received: by mail-wj0-x230.google.com with SMTP id xy5so363955328wjc.0 for ; Wed, 07 Dec 2016 07:22:28 -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=d2pYRm1fddzAUglKxcCnoeBfivzrg6/Jll/RKmHLUR0=; b=TX1P9s5Tf67Dc40SOYBWCZZRjoY8GXe6B7ex9Yr+3hHQLsCXA9Xnhwd6psVlNG6XjL zHRrl87HgIfetlb6DizQuAZ0jiL1xlNQjJBRudU7BDnSEIX+3BZNk16qwmw0wMxkziDf C5ugV/xPFmrRUa23ubZ7kFalRLiFIV7bzw+2w6T9LEhna+OoMG7KgKjemPzAO3qcQbRo 9QcO2BT276Gc9DnMJ0Fem2VxdGBHmnhFw2gmB0EqVZH3lNuIsAMIOfYeKPX/pOoT4Kvw xyA8+3MoqG3QQrEev5B+ZTGO1MHDtzk6vPjTFYVD2nLv4uM5PRmnhOLS4OBMCwjZhXXF 65Lw== 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=d2pYRm1fddzAUglKxcCnoeBfivzrg6/Jll/RKmHLUR0=; b=MWUzfB4xYsNWPJA/EMkBbZG1WbbQx1Jo3w9afUkTM7XRyvGSMDFrkrm0SSeRV0I5BL +kWUFWq/D8mL1TaGhU4E4FSZ442QG1G5ejJNtaRX09z5JZgP1ELlLbGtsHVOrQQEaT2d w0NIx5QKmoJu0iCM/1AXIrfawlU5Pd42ceCDV0mtkqwK5i2k+91UFIiPk8lLJ3O4stz1 jZV7GL1Y/h6rgO7vOGMD0qqYFrsviMeiELGelXV4Rle7515+4aF15Qv3LM+U+5KO+w56 LpgwUfU1UjQeKn9mn8qLEJcVqWaoZ34YmaJrXKF9z1oXK4bB6tDDvwxLRaAekJnspyyz p+JA== X-Gm-Message-State: AKaTC03MMfXH2biJ1nZ0m6RCfe2u69OFcf69M69duiKliqEGW1axS+OHp7bEGO4qlVBAAz83 X-Received: by 10.194.23.67 with SMTP id k3mr61005316wjf.103.1481124146741; Wed, 07 Dec 2016 07:22:26 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id r138sm10198123wme.9.2016.12.07.07.22.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 07 Dec 2016 07:22: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 Subject: [PATCH v4 1/4] ARM: da850: fix infinite loop in clk_set_rate() Date: Wed, 7 Dec 2016 16:22:15 +0100 Message-Id: <1481124138-27337-2-git-send-email-bgolaszewski@baylibre.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1481124138-27337-1-git-send-email-bgolaszewski@baylibre.com> References: <1481124138-27337-1-git-send-email-bgolaszewski@baylibre.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161207_072248_973277_3DF157B4 X-CRM114-Status: GOOD ( 15.21 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartosz Golaszewski , LKML , arm-soc , linux-pm@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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 | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c index e770c97..e9d019c 100644 --- a/arch/arm/mach-davinci/da850.c +++ b/arch/arm/mach-davinci/da850.c @@ -367,6 +367,16 @@ static struct clk aemif_clk = { .flags = ALWAYS_ENABLED, }; +/* + * In order to avoid adding the aemif_clk to the clock lookup table twice (and + * screwing up the linked list in the process) create a separate clock for + * nand inheriting the rate from aemif_clk. + */ +static struct clk aemif_nand_clk = { + .name = "nand", + .parent = &aemif_clk, +}; + static struct clk usb11_clk = { .name = "usb11", .parent = &pll0_sysclk4, @@ -537,7 +547,15 @@ 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), + /* + * The only user of this clock is davinci_nand and it get's it through + * con_id. The nand node itself is created from within the aemif + * driver to guarantee that it's probed after the aemif timing + * parameters are configured. of_dev_auxdata is not accessible from + * the aemif driver and can't be passed to of_platform_populate(). For + * that reason we're leaving the dev_id here as NULL. + */ + CLK(NULL, "aemif", &aemif_nand_clk), CLK("ohci-da8xx", "usb11", &usb11_clk), CLK("musb-da8xx", "usb20", &usb20_clk), CLK("spi_davinci.0", NULL, &spi0_clk),