Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2538677yba; Mon, 6 May 2019 07:41:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqzNMzL3iPv8S2IpP2oi7FKPtsg7IOrJ4P88jbFyjBsi8nMMOYRK6hsarRIq5w2KCTSLEmjU X-Received: by 2002:a63:e110:: with SMTP id z16mr32585144pgh.165.1557153712563; Mon, 06 May 2019 07:41:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557153712; cv=none; d=google.com; s=arc-20160816; b=f2CEO82heyBaQq+iy7P6j2PzcyLUyNY9i/xDxJ1vB9A18XEKsdyz8niF3rOadiFh1Z i75oPd56Zb0mDx22PFCbnju8sW8levwTigDksuGReOgKHKTZpiugMZDH4rToaZ67W104 iQvxEPR7J82m81qul+CLmGFshECmbvWanQKgYd15bd5P60vyr4vsMvCUDb9lEHCdXepg VYKujvPCo23WB9FacJcwkx++LSUAiIwzNLbdfY9FdjZacFuJRuKfWGDaGH7miPbDXrS9 4NebTPqH7iKo1oJKcLKHWngN2DT+LabtZrCULKSAD8WwygsA26TIueEiQS6SJzG9EqGE /RGg== 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:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=cY6NezcWhEq4SbSfmm/xodYKxTQHQYtVspm7LHloVJM=; b=Bx2d+YnRcA6b1BKT+uSPscbH/moneyf4S8D7tP+11vU5ze/fB3shFgkcRTSwAakA8l 1QjkYzh/MUS7/lX1QBe4H7JWlt+XGw6dVjcfmy3gvre/NwIMQTyFfDH9wgo8BRhXuVdk rGW9N3EZf3NWqtI367t8V51ZtP93h8A1xGE8ZM65aauuxeoW1k63ANLWmF68XiIXR0Bl VYOVkCJQh5PlzSgoPfnBX8YRINx6Gv2lT45gdK/icfYgVY/U94M63jxoJJJYhwupVd3h SoVcHgjTZu4kmWX6mCKjO1PU/jZNyc56BgWwEaxF4m/00ezp2RF4OryaF5md4LVeHD2O XJRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=oN7Vkqup; 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 l10si14019070pgq.334.2019.05.06.07.41.37; Mon, 06 May 2019 07:41:52 -0700 (PDT) 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=pass header.i=@kernel.org header.s=default header.b=oN7Vkqup; 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 S1727642AbfEFOie (ORCPT + 99 others); Mon, 6 May 2019 10:38:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:59676 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727632AbfEFOic (ORCPT ); Mon, 6 May 2019 10:38:32 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4683C206A3; Mon, 6 May 2019 14:38:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1557153511; bh=PfLeZyYVsYOyH47/cY4Cr0MKkIiL4NuQjQGlWyG1dHs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oN7VkqupQiJSDix0MuwGxZfhAIEp0GppTDNSJvYJtgUluU20KIGTsdSZoWvBKSEC/ W2TFfxvbNkoHM5UU6eOnxSP7nd5bWyCV65Xm3rEGwGNuMqZRYArGyH+0E6zUqg0igy 8fvWWNM1m39mLViC7AmPeFL8y9TuiXq/nR2Y6Urk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?David=20M=C3=BCller?= , Hans de Goede , Andy Shevchenko , Stephen Boyd Subject: [PATCH 5.0 117/122] clk: x86: Add system specific quirk to mark clocks as critical Date: Mon, 6 May 2019 16:32:55 +0200 Message-Id: <20190506143104.880055534@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190506143054.670334917@linuxfoundation.org> References: <20190506143054.670334917@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: David Müller commit 7c2e07130090ae001a97a6b65597830d6815e93e upstream. Since commit 648e921888ad ("clk: x86: Stop marking clocks as CLK_IS_CRITICAL"), the pmc_plt_clocks of the Bay Trail SoC are unconditionally gated off. Unfortunately this will break systems where these clocks are used for external purposes beyond the kernel's knowledge. Fix it by implementing a system specific quirk to mark the necessary pmc_plt_clks as critical. Fixes: 648e921888ad ("clk: x86: Stop marking clocks as CLK_IS_CRITICAL") Signed-off-by: David Müller Signed-off-by: Hans de Goede Reviewed-by: Andy Shevchenko Signed-off-by: Stephen Boyd Signed-off-by: Greg Kroah-Hartman --- drivers/clk/x86/clk-pmc-atom.c | 14 +++++++++++--- drivers/platform/x86/pmc_atom.c | 21 +++++++++++++++++++++ include/linux/platform_data/x86/clk-pmc-atom.h | 3 +++ 3 files changed, 35 insertions(+), 3 deletions(-) --- a/drivers/clk/x86/clk-pmc-atom.c +++ b/drivers/clk/x86/clk-pmc-atom.c @@ -165,7 +165,7 @@ static const struct clk_ops plt_clk_ops }; static struct clk_plt *plt_clk_register(struct platform_device *pdev, int id, - void __iomem *base, + const struct pmc_clk_data *pmc_data, const char **parent_names, int num_parents) { @@ -184,9 +184,17 @@ static struct clk_plt *plt_clk_register( init.num_parents = num_parents; pclk->hw.init = &init; - pclk->reg = base + PMC_CLK_CTL_OFFSET + id * PMC_CLK_CTL_SIZE; + pclk->reg = pmc_data->base + PMC_CLK_CTL_OFFSET + id * PMC_CLK_CTL_SIZE; spin_lock_init(&pclk->lock); + /* + * On some systems, the pmc_plt_clocks already enabled by the + * firmware are being marked as critical to avoid them being + * gated by the clock framework. + */ + if (pmc_data->critical && plt_clk_is_enabled(&pclk->hw)) + init.flags |= CLK_IS_CRITICAL; + ret = devm_clk_hw_register(&pdev->dev, &pclk->hw); if (ret) { pclk = ERR_PTR(ret); @@ -332,7 +340,7 @@ static int plt_clk_probe(struct platform return PTR_ERR(parent_names); for (i = 0; i < PMC_CLK_NUM; i++) { - data->clks[i] = plt_clk_register(pdev, i, pmc_data->base, + data->clks[i] = plt_clk_register(pdev, i, pmc_data, parent_names, data->nparents); if (IS_ERR(data->clks[i])) { err = PTR_ERR(data->clks[i]); --- a/drivers/platform/x86/pmc_atom.c +++ b/drivers/platform/x86/pmc_atom.c @@ -17,6 +17,7 @@ #include #include +#include #include #include #include @@ -391,11 +392,27 @@ static int pmc_dbgfs_register(struct pmc } #endif /* CONFIG_DEBUG_FS */ +/* + * Some systems need one or more of their pmc_plt_clks to be + * marked as critical. + */ +static const struct dmi_system_id critclk_systems[] __initconst = { + { + .ident = "MPL CEC1x", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "MPL AG"), + DMI_MATCH(DMI_PRODUCT_NAME, "CEC10 Family"), + }, + }, + { /*sentinel*/ } +}; + static int pmc_setup_clks(struct pci_dev *pdev, void __iomem *pmc_regmap, const struct pmc_data *pmc_data) { struct platform_device *clkdev; struct pmc_clk_data *clk_data; + const struct dmi_system_id *d = dmi_first_match(critclk_systems); clk_data = kzalloc(sizeof(*clk_data), GFP_KERNEL); if (!clk_data) @@ -403,6 +420,10 @@ static int pmc_setup_clks(struct pci_dev clk_data->base = pmc_regmap; /* offset is added by client */ clk_data->clks = pmc_data->clks; + if (d) { + clk_data->critical = true; + pr_info("%s critclks quirk enabled\n", d->ident); + } clkdev = platform_device_register_data(&pdev->dev, "clk-pmc-atom", PLATFORM_DEVID_NONE, --- a/include/linux/platform_data/x86/clk-pmc-atom.h +++ b/include/linux/platform_data/x86/clk-pmc-atom.h @@ -35,10 +35,13 @@ struct pmc_clk { * * @base: PMC clock register base offset * @clks: pointer to set of registered clocks, typically 0..5 + * @critical: flag to indicate if firmware enabled pmc_plt_clks + * should be marked as critial or not */ struct pmc_clk_data { void __iomem *base; const struct pmc_clk *clks; + bool critical; }; #endif /* __PLATFORM_DATA_X86_CLK_PMC_ATOM_H */