From patchwork Tue Jan 17 12:46:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 9520995 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 CB2946020A for ; Tue, 17 Jan 2017 13:37:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A79DD2853C for ; Tue, 17 Jan 2017 13:37:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 997912855C; Tue, 17 Jan 2017 13:37:02 +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 175CA2853C for ; Tue, 17 Jan 2017 13:37:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750917AbdAQNhB (ORCPT ); Tue, 17 Jan 2017 08:37:01 -0500 Received: from newton.telenet-ops.be ([195.130.132.45]:38402 "EHLO newton.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750787AbdAQNg7 (ORCPT ); Tue, 17 Jan 2017 08:36:59 -0500 X-Greylist: delayed 1529 seconds by postgrey-1.27 at vger.kernel.org; Tue, 17 Jan 2017 08:36:59 EST Received: from albert.telenet-ops.be (albert.telenet-ops.be [IPv6:2a02:1800:110:4::f00:1a]) by newton.telenet-ops.be (Postfix) with ESMTPS id 3v2qd72dspzMs5GP for ; Tue, 17 Jan 2017 13:47:39 +0100 (CET) Received: from ayla.of.borg ([84.193.137.253]) by albert.telenet-ops.be with bizsmtp id ZQme1u0065UCtCs06Qmeh2; Tue, 17 Jan 2017 13:46:38 +0100 Received: from ramsan.of.borg ([192.168.97.29] helo=ramsan) by ayla.of.borg with esmtp (Exim 4.82) (envelope-from ) id 1cTT9q-00062S-0Z; Tue, 17 Jan 2017 13:46:38 +0100 Received: from geert by ramsan with local (Exim 4.82) (envelope-from ) id 1cTT9t-0003Lv-AM; Tue, 17 Jan 2017 13:46:41 +0100 From: Geert Uytterhoeven To: Michael Turquette , Stephen Boyd Cc: linux-clk@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH 2/2] clk: renesas: mstp: Make INTC-SYS a critical clock Date: Tue, 17 Jan 2017 13:46:30 +0100 Message-Id: <1484657190-12838-3-git-send-email-geert+renesas@glider.be> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1484657190-12838-1-git-send-email-geert+renesas@glider.be> References: <1484657190-12838-1-git-send-email-geert+renesas@glider.be> Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP INTC-SYS is the module clock for the GIC. Accessing the GIC while it is disabled causes: Unhandled fault: asynchronous external abort (0x1211) at 0x00000000 Currently, the GIC-400 driver cannot enable its module clock for several reasons: - It does not use a platform device, so Runtime PM is not an option, - gic_of_init() runs before any clocks are registered, so it cannot enable the clock explicitly, - gic_of_init() cannot return -EPROBE_DEFER, as IRQCHIP_DECLARE() doesn't support deferred probing. Hence we have to keep on relying on the boot loader for enabling the module clock. To prevent the module clock from being disabled when the CCF core thinks it is unused, and thus causing a system lock-up, add a check to the MSTP clock driver and enable CLK_IS_CRITICAL. This will make sure the module clock is never disabled. This is a hard dependency for describing the INTC-SYS clock in DT on R-Mobile APE6 and R-Car Gen2. Signed-off-by: Geert Uytterhoeven Acked-by: Stephen Boyd --- This is v2 of "[PATCH/RFC 1/5] clk: renesas: mstp: Never disable INTC-SYS". v2: - Use the new CLK_ENABLE_HAND_OFF flag instead of adding a quirk to cpg_mstp_clock_endisable(), - drivers/clk/shmobile/ was renamed to drivers/clk/renesas/, - Migrate from CLK_ENABLE_HAND_OFF to CLK_IS_CRITICAL. --- drivers/clk/renesas/clk-mstp.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/clk/renesas/clk-mstp.c b/drivers/clk/renesas/clk-mstp.c index 9375777776d99407..c0319b8acf3521a2 100644 --- a/drivers/clk/renesas/clk-mstp.c +++ b/drivers/clk/renesas/clk-mstp.c @@ -144,6 +144,11 @@ static int cpg_mstp_clock_is_enabled(struct clk_hw *hw) init.name = name; init.ops = &cpg_mstp_clock_ops; init.flags = CLK_IS_BASIC | CLK_SET_RATE_PARENT; + /* INTC-SYS is the module clock of the GIC, and must not be disabled */ + if (!strcmp(name, "intc-sys")) { + pr_debug("MSTP %s setting CLK_IS_CRITICAL\n", name); + init.flags |= CLK_IS_CRITICAL; + } init.parent_names = &parent_name; init.num_parents = 1;