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: 23417 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f198.google.com (mail-ob0-f198.google.com [209.85.214.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D0F50203C6 for ; Mon, 20 Jan 2014 20:55:39 +0000 (UTC) Received: by mail-ob0-f198.google.com with SMTP id wp4sf11061366obc.9 for ; Mon, 20 Jan 2014 12:55:39 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=/ZXrHLmvOGyuXYNKGhpibTUkcJ/LY/IdQGIbMZKDeQw=; b=T+DHgDHj8kLD6dO7CLbABGES7gr1jylb0fVGwJGSQ69Q5Zq5HYiJw7ocl6ooGrhRo5 FhsQF716AoRQJkjUN7wMvA79wAk/4rZnrIIYGP2sfo/lyyu0bY+e5hNtmJGUnXi0gN65 tP8MScdBLfcaY1Q67u9lp3qTZvV5d99rmJ0k5lrpsxSFOx6I1gy3hzpAoGV5jkZRC+2c Krq+sFrxjr+jgnDv8COrwnlZ+fi6iv97x/lfhPtLMDkOpWB2kFfLfYheU5nLA7pjCC4b p0m1GzDVlm1u0sIqI/LoxRPb6aTgBn8mAdOQf1GKiyqZc/qMWw+nOQSOALByCXaqbEMV h33A== X-Gm-Message-State: ALoCoQny0tpc8xa4ddkJ/LIQkG+svvJmMoHQg4N3TmCCErzkXTs8/sGaOBAOkneO+J0VU9cOFvi8 X-Received: by 10.182.19.231 with SMTP id i7mr7601931obe.25.1390251338870; Mon, 20 Jan 2014 12:55:38 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.50.171 with SMTP id s40ls1104690qga.17.gmail; Mon, 20 Jan 2014 12:55:38 -0800 (PST) X-Received: by 10.53.9.201 with SMTP id du9mr65883vdd.36.1390251338603; Mon, 20 Jan 2014 12:55:38 -0800 (PST) Received: from mail-vb0-f54.google.com (mail-vb0-f54.google.com [209.85.212.54]) by mx.google.com with ESMTPS id xo6si777228veb.4.2014.01.20.12.55.38 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 20 Jan 2014 12:55:38 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.54 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.54; Received: by mail-vb0-f54.google.com with SMTP id w20so3133281vbb.27 for ; Mon, 20 Jan 2014 12:55:38 -0800 (PST) X-Received: by 10.58.227.38 with SMTP id rx6mr12080109vec.10.1390251338490; Mon, 20 Jan 2014 12:55:38 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp76177vcz; Mon, 20 Jan 2014 12:55:38 -0800 (PST) X-Received: by 10.180.106.165 with SMTP id gv5mr11564717wib.32.1390251337598; Mon, 20 Jan 2014 12:55:37 -0800 (PST) Received: from mail-we0-f175.google.com (mail-we0-f175.google.com [74.125.82.175]) by mx.google.com with ESMTPS id x10si1697388wiw.42.2014.01.20.12.55.37 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 20 Jan 2014 12:55:37 -0800 (PST) Received-SPF: neutral (google.com: 74.125.82.175 is neither permitted nor denied by best guess record for domain of linus.walleij@linaro.org) client-ip=74.125.82.175; Received: by mail-we0-f175.google.com with SMTP id p61so7251568wes.6 for ; Mon, 20 Jan 2014 12:55:37 -0800 (PST) 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 Cc: Linus Walleij 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-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: linus.walleij@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.54 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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,