From patchwork Mon Jan 20 20:55:32 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 3514481 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E0E36C02DC for ; Mon, 20 Jan 2014 20:58:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 04212200F0 for ; Mon, 20 Jan 2014 20:58:07 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D2D732013D for ; Mon, 20 Jan 2014 20:58:05 +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 1W5Lte-0003uB-8U; Mon, 20 Jan 2014 20:56:39 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1W5LtF-0003iP-RI; Mon, 20 Jan 2014 20:56:13 +0000 Received: from mail-wg0-f54.google.com ([74.125.82.54]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1W5Lt0-0003fT-Vr for linux-arm-kernel@lists.infradead.org; Mon, 20 Jan 2014 20:56:00 +0000 Received: by mail-wg0-f54.google.com with SMTP id x13so7197506wgg.21 for ; Mon, 20 Jan 2014 12:55: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:from:to:cc:subject:date:message-id; bh=/ZXrHLmvOGyuXYNKGhpibTUkcJ/LY/IdQGIbMZKDeQw=; b=f6H9IKHPeXGAiksWhBrTy6IK3MOguMjSswY0uIsw2twNAAWMMVuJSDAQtp1PZo6D2W ib8mt5oxhS6KSRuPVgrr+JT0YbZS+c/Qcw9oq6N9WTYFmaahauB2VKb/q+h4jCxxDSf8 h6bShqT//zXVeF18jcv8maip7+Dj0ucY19MaVqzTw2Cc1yAnFg1RiEJyvmbBpKmGv9A3 Wlb1Gh6cshbWQFHuCPuP3DYRRZeoUlqurcR8cXH8PESkn/EMr0K6vOuVGktoLP5Ht8+V toGiLd5Z6KCpYXFIXyhbODv0qcXQDvdUPN4l2NhlXQKDdM03twQHgMf1uQdmhsiHuoZY wj9A== X-Gm-Message-State: ALoCoQnlwUHL9KD/XpYNe+NJpdENIbng/7AsVTPaYw62cCUI6+qW3E7ln+02VKa/gX50htIBY8EO X-Received: by 10.180.211.208 with SMTP id ne16mr11067283wic.21.1390251337167; Mon, 20 Jan 2014 12:55:37 -0800 (PST) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id 12sm3522113wjm.10.2014.01.20.12.55.35 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Jan 2014 12:55:36 -0800 (PST) From: Linus Walleij To: linux-arm-kernel@lists.infradead.org, Mike Turquette Subject: [PATCH 5/5] clk: versatile: respect parent rate in ICST clock Date: Mon, 20 Jan 2014 21:55:32 +0100 Message-Id: <1390251332-6411-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 1.8.4.2 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140120_155559_231588_7BB07A84 X-CRM114-Status: GOOD ( 15.96 ) X-Spam-Score: -2.6 (--) Cc: Linus Walleij 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=-4.8 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, 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 If the ICST clock has a parent, respect the rate of the parent when calculating the clock frequency. Alter const arguments as this involves modifying the ICST parameter struct, and do not define the reference clock on the Integrator as we have the reference clock from the device tree. Keep it everywhere else. Cc: Mike Turquette Signed-off-by: Linus Walleij --- Hi Mike, looking for an ACK for this one as well. --- drivers/clk/versatile/clk-icst.c | 10 +++++++--- drivers/clk/versatile/clk-icst.h | 2 +- drivers/clk/versatile/clk-impd1.c | 4 ++-- drivers/clk/versatile/clk-integrator.c | 3 +-- drivers/clk/versatile/clk-realview.c | 2 +- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/drivers/clk/versatile/clk-icst.c b/drivers/clk/versatile/clk-icst.c index c98adbe62733..4bbfbf49b009 100644 --- a/drivers/clk/versatile/clk-icst.c +++ b/drivers/clk/versatile/clk-icst.c @@ -33,7 +33,7 @@ struct clk_icst { struct clk_hw hw; void __iomem *vcoreg; void __iomem *lockreg; - const struct icst_params *params; + struct icst_params *params; unsigned long rate; }; @@ -84,6 +84,8 @@ static unsigned long icst_recalc_rate(struct clk_hw *hw, struct clk_icst *icst = to_icst(hw); struct icst_vco vco; + if (parent_rate) + icst->params->ref = parent_rate; vco = vco_get(icst->vcoreg); icst->rate = icst_hz(icst->params, vco); return icst->rate; @@ -105,6 +107,8 @@ static int icst_set_rate(struct clk_hw *hw, unsigned long rate, struct clk_icst *icst = to_icst(hw); struct icst_vco vco; + if (parent_rate) + icst->params->ref = parent_rate; vco = icst_hz_to_vco(icst->params, rate); icst->rate = icst_hz(icst->params, vco); vco_set(icst->lockreg, icst->vcoreg, vco); @@ -135,8 +139,8 @@ struct clk *icst_clk_register(struct device *dev, init.name = name; init.ops = &icst_ops; init.flags = CLK_IS_ROOT; - init.parent_names = NULL; - init.num_parents = 0; + init.parent_names = (parent_name ? &parent_name : NULL); + init.num_parents = (parent_name ? 1 : 0); icst->hw.init = &init; icst->params = desc->params; icst->vcoreg = base + desc->vco_offset; diff --git a/drivers/clk/versatile/clk-icst.h b/drivers/clk/versatile/clk-icst.h index 04e6f0aef588..e72b1c15d084 100644 --- a/drivers/clk/versatile/clk-icst.h +++ b/drivers/clk/versatile/clk-icst.h @@ -8,7 +8,7 @@ * memory base */ struct clk_icst_desc { - const struct icst_params *params; + struct icst_params *params; u32 vco_offset; u32 lock_offset; }; diff --git a/drivers/clk/versatile/clk-impd1.c b/drivers/clk/versatile/clk-impd1.c index 6d8b8e1a080a..a3edc0463517 100644 --- a/drivers/clk/versatile/clk-impd1.c +++ b/drivers/clk/versatile/clk-impd1.c @@ -39,7 +39,7 @@ static struct impd1_clk impd1_clks[4]; * There are two VCO's on the IM-PD1 */ -static const struct icst_params impd1_vco1_params = { +static struct icst_params impd1_vco1_params = { .ref = 24000000, /* 24 MHz */ .vco_max = ICST525_VCO_MAX_3V, .vco_min = ICST525_VCO_MIN, @@ -57,7 +57,7 @@ static const struct clk_icst_desc impd1_icst1_desc = { .lock_offset = IMPD1_LOCK, }; -static const struct icst_params impd1_vco2_params = { +static struct icst_params impd1_vco2_params = { .ref = 24000000, /* 24 MHz */ .vco_max = ICST525_VCO_MAX_3V, .vco_min = ICST525_VCO_MIN, diff --git a/drivers/clk/versatile/clk-integrator.c b/drivers/clk/versatile/clk-integrator.c index 5d36a719fefb..b1f46d5154ea 100644 --- a/drivers/clk/versatile/clk-integrator.c +++ b/drivers/clk/versatile/clk-integrator.c @@ -20,8 +20,7 @@ /* Base offset for the core module */ static void __iomem *cm_base; -static const struct icst_params cp_auxosc_params = { - .ref = 24000000, +static struct icst_params cp_auxosc_params = { .vco_max = ICST525_VCO_MAX_5V, .vco_min = ICST525_VCO_MIN, .vd_min = 8, diff --git a/drivers/clk/versatile/clk-realview.c b/drivers/clk/versatile/clk-realview.c index c8b523117fb7..a1491590e028 100644 --- a/drivers/clk/versatile/clk-realview.c +++ b/drivers/clk/versatile/clk-realview.c @@ -21,7 +21,7 @@ * Implementation of the ARM RealView clock trees. */ -static const struct icst_params realview_oscvco_params = { +static struct icst_params realview_oscvco_params = { .ref = 24000000, .vco_max = ICST307_VCO_MAX, .vco_min = ICST307_VCO_MIN,