From patchwork Mon Jul 22 23:49:18 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Figa X-Patchwork-Id: 2831628 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C89759F4D4 for ; Mon, 22 Jul 2013 23:51:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D2C0F2021A for ; Mon, 22 Jul 2013 23:51:04 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E076220208 for ; Mon, 22 Jul 2013 23:51:03 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1V1Ps0-0002Nl-Pz; Mon, 22 Jul 2013 23:50:25 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1V1Prq-0001Bu-Ub; Mon, 22 Jul 2013 23:50:14 +0000 Received: from mail-ea0-x22c.google.com ([2a00:1450:4013:c01::22c]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1V1PrZ-00016w-Qj for linux-arm-kernel@lists.infradead.org; Mon, 22 Jul 2013 23:49:59 +0000 Received: by mail-ea0-f172.google.com with SMTP id q10so4132355eaj.17 for ; Mon, 22 Jul 2013 16:49:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=jDGVOcohL33EMMP/ziGPrZnmiaRxkoqIhPkKdYy/gfc=; b=todpzqtby1OhQoKW1KP5LIU3urNQ0QY6u1+xEBj4UfOmVK7MkieTrwa7+EqV/kqIbC 4ZPrTwJGkt4H7Ngw+iJErxIpfJb4rAryRV+w6XRoVyKhS8NG8ztIOG35IC6UonWO8cFd AGmeRsfD/qsJhWcIaZoCRFgPpKySi7yC6naK/llTuSxSQ9XXqknerbWSMYBf+XGC8EEl AE0pJ50gHcKZHdzzCTqDo17Xfo/NuYe9/5vM5wg5Bv1WORv9O9+Ys5DMkUd3Ole5zBhv 4rN4r69NLjcuHrA2tyh51Y0B6zybwEei3yAjs1rOpuws86prlf9QXeFR/ock7ZPjTY6L gyaA== X-Received: by 10.15.32.194 with SMTP id a42mr30222143eev.43.1374536975722; Mon, 22 Jul 2013 16:49:35 -0700 (PDT) Received: from flatron.tomeq (87-207-52-162.dynamic.chello.pl. [87.207.52.162]) by mx.google.com with ESMTPSA id n45sm54626864eew.1.2013.07.22.16.49.33 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 22 Jul 2013 16:49:34 -0700 (PDT) From: Tomasz Figa To: linux-samsung-soc@vger.kernel.org Subject: [PATCH v2 1/8] clk: mux: Add support for read-only muxes. Date: Tue, 23 Jul 2013 01:49:18 +0200 Message-Id: <1374536965-3545-2-git-send-email-tomasz.figa@gmail.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1374536965-3545-1-git-send-email-tomasz.figa@gmail.com> References: <1374536965-3545-1-git-send-email-tomasz.figa@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130722_194958_031993_F4D2C72A X-CRM114-Status: GOOD ( 13.81 ) X-Spam-Score: -2.0 (--) Cc: devicetree@vger.kernel.org, Kukjin Kim , Mike Turquette , =?UTF-8?q?Heiko=20St=C3=BCbner?= , Arnd Bergmann , gregkh@linuxfoundation.org, linux-usb@vger.kernel.org, Tomasz Figa , Mark Brown , stern@rowland.harvard.edu, Olof Johansson , Thomas Abraham , Sylwester Nawrocki , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Some platforms have read-only clock muxes that are preconfigured at reset and cannot be changed at runtime. This patch extends mux clock driver to allow handling such read-only muxes by adding new CLK_MUX_READ_ONLY mux flag. Signed-off-by: Tomasz Figa Acked-by: Mike Turquette --- drivers/clk/clk-mux.c | 10 +++++++++- include/linux/clk-provider.h | 2 ++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/clk/clk-mux.c b/drivers/clk/clk-mux.c index 614444c..92f1a1b 100644 --- a/drivers/clk/clk-mux.c +++ b/drivers/clk/clk-mux.c @@ -107,6 +107,11 @@ const struct clk_ops clk_mux_ops = { }; EXPORT_SYMBOL_GPL(clk_mux_ops); +const struct clk_ops clk_mux_ro_ops = { + .get_parent = clk_mux_get_parent, +}; +EXPORT_SYMBOL_GPL(clk_mux_ro_ops); + struct clk *clk_register_mux_table(struct device *dev, const char *name, const char **parent_names, u8 num_parents, unsigned long flags, void __iomem *reg, u8 shift, u32 mask, @@ -133,7 +138,10 @@ struct clk *clk_register_mux_table(struct device *dev, const char *name, } init.name = name; - init.ops = &clk_mux_ops; + if (clk_mux_flags & CLK_MUX_READ_ONLY) + init.ops = &clk_mux_ro_ops; + else + init.ops = &clk_mux_ops; init.flags = flags | CLK_IS_BASIC; init.parent_names = parent_names; init.num_parents = num_parents; diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 1ec14a7..9487b96 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -327,8 +327,10 @@ struct clk_mux { #define CLK_MUX_INDEX_ONE BIT(0) #define CLK_MUX_INDEX_BIT BIT(1) #define CLK_MUX_HIWORD_MASK BIT(2) +#define CLK_MUX_READ_ONLY BIT(3) /* mux setting cannot be changed */ extern const struct clk_ops clk_mux_ops; +extern const struct clk_ops clk_mux_ro_ops; struct clk *clk_register_mux(struct device *dev, const char *name, const char **parent_names, u8 num_parents, unsigned long flags,