From patchwork Mon Jan 26 11:13:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 43732 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f72.google.com (mail-ee0-f72.google.com [74.125.83.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id AEED023FFF for ; Mon, 26 Jan 2015 11:14:38 +0000 (UTC) Received: by mail-ee0-f72.google.com with SMTP id e49sf3874845eek.3 for ; Mon, 26 Jan 2015 03:14:37 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-type :content-transfer-encoding:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=oJ6uhZjk1b8l+p4wZ76X1taEX+oq09qU2JKscWu8eCU=; b=ZQoqNlPKdMxhtX2wR5sVK45miVkRd6Q7cHC4zbdnDi2WlVU601dQZggXsjdUnbW82i RKxwuRL5w6KbSHsJ6j0eyV5u0KAV7vHw2JAKnykZakc/UPqfdoz3R8S/Sw3MgwjqY1+A PQrzVJvLIM+k1l1hf2v+RFUV45V788dAhKKNOQWpV2DXGN5fFPmNW2UuYcGPijFnmbq3 e5FGkzzdKBKFTg1S/WVl6mnQFAEW39Jyt5bpbo6HY7Ej1ixe2qR4an60nFLQEkQLLJRv JlRNmD2ewxvbCSbe0exa/DM1vqKHoAyfDtX1wlU9hXsLrOh0Dut06QmnQi55bLNzayiC BSSg== X-Gm-Message-State: ALoCoQk9Ou2RIiwAU6W5GjSwN/HiuqfPiIj1Rk5WuJ03tHdPaHP39enCJnjfkbT70bgCxqqLELNp X-Received: by 10.112.35.135 with SMTP id h7mr694467lbj.23.1422270877583; Mon, 26 Jan 2015 03:14:37 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.121.35 with SMTP id lh3ls374844lab.12.gmail; Mon, 26 Jan 2015 03:14:37 -0800 (PST) X-Received: by 10.152.234.140 with SMTP id ue12mr19968680lac.78.1422270877411; Mon, 26 Jan 2015 03:14:37 -0800 (PST) Received: from mail-lb0-f173.google.com (mail-lb0-f173.google.com. [209.85.217.173]) by mx.google.com with ESMTPS id oc7si1251864lbb.27.2015.01.26.03.14.37 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 26 Jan 2015 03:14:37 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.173 as permitted sender) client-ip=209.85.217.173; Received: by mail-lb0-f173.google.com with SMTP id p9so7000171lbv.4 for ; Mon, 26 Jan 2015 03:14:37 -0800 (PST) X-Received: by 10.152.6.132 with SMTP id b4mr20794986laa.59.1422270877265; Mon, 26 Jan 2015 03:14:37 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.35.133 with SMTP id h5csp744756lbj; Mon, 26 Jan 2015 03:14:36 -0800 (PST) X-Received: by 10.66.192.106 with SMTP id hf10mr33557428pac.90.1422270872746; Mon, 26 Jan 2015 03:14:32 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bl1si11770700pbb.192.2015.01.26.03.14.31; Mon, 26 Jan 2015 03:14:32 -0800 (PST) Received-SPF: none (google.com: devicetree-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755204AbbAZLOT (ORCPT + 5 others); Mon, 26 Jan 2015 06:14:19 -0500 Received: from mail-ie0-f170.google.com ([209.85.223.170]:35426 "EHLO mail-ie0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755140AbbAZLOQ (ORCPT ); Mon, 26 Jan 2015 06:14:16 -0500 Received: by mail-ie0-f170.google.com with SMTP id y20so8000418ier.1 for ; Mon, 26 Jan 2015 03:14:16 -0800 (PST) X-Received: by 10.50.43.133 with SMTP id w5mr15509695igl.44.1422270856137; Mon, 26 Jan 2015 03:14:16 -0800 (PST) Received: from localhost.localdomain (host86-129-140-127.range86-129.btcentralplus.com. [86.129.140.127]) by mx.google.com with ESMTPSA id r93sm5786253ioi.1.2015.01.26.03.14.14 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 26 Jan 2015 03:14:15 -0800 (PST) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: lee.jones@linaro.org, kernel@stlinux.com, mturquette@linaro.org, sboyd@codeaurora.org, devicetree@vger.kernel.org Subject: [PATCH 3/4] clk: st: Provide a clock domain Date: Mon, 26 Jan 2015 11:13:59 +0000 Message-Id: <1422270840-3039-4-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1422270840-3039-1-git-send-email-lee.jones@linaro.org> References: <1422270840-3039-1-git-send-email-lee.jones@linaro.org> MIME-Version: 1.0 Sender: devicetree-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: devicetree@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: lee.jones@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.173 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , ST's h/w contains clocks which if turned off would prove fatal. The only way to recover is to restart the board(s). This driver takes references to clocks which are required to be always-on in order to prevent the common clk framework from trying to turn them off during the clk_disabled_unused() procedure. Signed-off-by: Lee Jones --- drivers/clk/st/Makefile | 2 +- drivers/clk/st/clk-domain.c | 63 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 drivers/clk/st/clk-domain.c diff --git a/drivers/clk/st/Makefile b/drivers/clk/st/Makefile index ede7b2f..ac09be6 100644 --- a/drivers/clk/st/Makefile +++ b/drivers/clk/st/Makefile @@ -1 +1 @@ -obj-y += clkgen-mux.o clkgen-pll.o clkgen-fsyn.o clk-flexgen.o +obj-y += clkgen-mux.o clkgen-pll.o clkgen-fsyn.o clk-flexgen.o clk-domain.o diff --git a/drivers/clk/st/clk-domain.c b/drivers/clk/st/clk-domain.c new file mode 100644 index 0000000..e34049b --- /dev/null +++ b/drivers/clk/st/clk-domain.c @@ -0,0 +1,63 @@ +/* + * ST Clock Domain + * + * Copyright (C) 2015 STMicroelectronics – All Rights Reserved + * + * Author: Lee Jones + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include +#include +#include +#include +#include + +static void st_clk_domain_hog_clock(struct platform_device *pdev, int index) +{ + struct device_node *np = pdev->dev.of_node; + struct clk *clk; + int ret; + + clk = of_clk_get(np, index); + if (IS_ERR(clk)) { + dev_warn(&pdev->dev, "Failed get clock %s[%d]: %li\n", + np->full_name, index, PTR_ERR(clk)); + return; + } + + ret = clk_prepare_enable(clk); + if (ret) + dev_warn(&pdev->dev, "Failed to enable clock: %s\n", clk->name); +} + +static int st_clk_domain_probe(struct platform_device *pdev) +{ + struct device_node *np = pdev->dev.of_node; + int nclks, i; + + nclks = of_count_phandle_with_args(np, "clocks", "#clock-cells"); + + for (i = 0; i < nclks; i++) + st_clk_domain_hog_clock(pdev, i); + + return 0; +} + +static const struct of_device_id st_clk_domain_match[] = { + { .compatible = "st,clk-domain" }, + { }, +}; + +static struct platform_driver st_clk_domain_driver = { + .probe = st_clk_domain_probe, + .driver = { + .name = "st-clk-domain", + .of_match_table = st_clk_domain_match, + }, +}; +module_platform_driver(st_clk_domain_driver);