From patchwork Tue Jan 15 03:33:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 155616 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp4412306jaa; Mon, 14 Jan 2019 19:34:05 -0800 (PST) X-Google-Smtp-Source: ALg8bN5Bi5ukEjCyCKtu/e/8Fk9H98xETXFsEJUjrOANmTMp8ubXFAKlJxMzJCVQcgGGAYs0V4L6 X-Received: by 2002:a17:902:bb05:: with SMTP id l5mr1968920pls.230.1547523245150; Mon, 14 Jan 2019 19:34:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547523245; cv=none; d=google.com; s=arc-20160816; b=wXvpz2x7YXuXHfI4LdRUDslTAqxTvgku9Ln+81QEAefKajLdABsBn8eZB2CKKnJdKK PTKURxK3paTOQ3kg2wQaxBLaumFW7Ga0yg3yfYVoS8LcNjunS6DHQJ0Vbq+SaqJEN5fw FFrc7uv/l/uM3FMs/ku9rDHZzId+3e8KsFz9hHHrpnWSYZhxLfXsm8B/MT0oECsxCY3g qlYJIzCiIVKAIsgaPQi481JId5vx/Xyxi8tPJCOywB2gjsP42sd/NaoIoR9D/x09MK5C 4dHjdFFkelwqkfbp0XY5UlxhmNHv5ARzT21bOfYALxwTzzPkmhX74tRBSKTETbjLlGi2 BU6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=wGON2lybsGy7FC0OgCUYudVtpokObJD+vq+U001MecQ=; b=0yj8zNEptAfJ0Tr48gCHeXF0ikJl/oc1TIOwf4CzaIn+2xdDX3VQTg29s9xOHc8f6j 0hDfQwIlPa/0vVrIWF+JQpr4USa87H0HFz4dyiAjaIvReugvdWGBN4tWgZMCC6s6oPzi dNQE/sT8oAi9flLoifi0kpiLbFBzx2TFqn8uMax2xvYMkccWgOQuQTIcz9kFeKFrnmde RcbihtVNC7E4IoD7yrfhcVtWOl9mqJXhAG0xJJsjv8y/FUE1KpE4TXfvp2+fXmNxkePy 5WtomS7BhLIpkEzbgufPCdwhanqfB60wRnZnj6vck58Nh8opEGibJ2hUtdP4mwEC9ZI0 0pTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kt5uwZj0; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s59si2302014plb.350.2019.01.14.19.34.04; Mon, 14 Jan 2019 19:34:05 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of devicetree-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=@linaro.org header.s=google header.b=kt5uwZj0; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727574AbfAODeE (ORCPT + 7 others); Mon, 14 Jan 2019 22:34:04 -0500 Received: from mail-pg1-f196.google.com ([209.85.215.196]:34716 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727513AbfAODeD (ORCPT ); Mon, 14 Jan 2019 22:34:03 -0500 Received: by mail-pg1-f196.google.com with SMTP id j10so612783pga.1 for ; Mon, 14 Jan 2019 19:34:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=wGON2lybsGy7FC0OgCUYudVtpokObJD+vq+U001MecQ=; b=kt5uwZj0n2jIfhdmMmww8CUoQKLY9VIyrpit7LW9KHb2Y8A+0NVIfw3j0Jb3nTwEsf 5qi7MQ1We/Fmmg8Rkc4ZKICZFn/0yuLCBmApFxOa2eE5YgqO2os5oq8o8TtpxaSbFmuQ hiJe336DjVtBrAgMtEKNYL2ZywH9BXbOPsPfo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=wGON2lybsGy7FC0OgCUYudVtpokObJD+vq+U001MecQ=; b=b2+wUuYbYfPPn7PYS0yS5/fvfvMLI412R8VOnxlXwcoP/qHBmuh2SBH8WSv7mvXxa9 lmHUU2zO0cY01FcZYjp6mywCTU+Lnl2VuZZT28Wk+uB2snXvyJmKne72Jb3X2EAtX0YA C1hJ7Zic40y7H4B+iUpJOH4INurgZe4Xy6dYqFzOkW71bKNSH80k+FqTqQ3beQbPI+t1 XUQkXQFHJ1XXD3bKjYYvOC0WByTOZXn6XKbRPy5QISMYHwH85gi8alRlO9GUHFIMJUub NZ6lbMPZ2/5/SpI1kNLXqjfQHPKN+XGdITEtdklHXYmJbpjzLMpj7fmbuu1ReP0UUy3t x5gA== X-Gm-Message-State: AJcUukcd43ngVD6NeqqudRcI9ItW7Hm64jcAaCoQu+2o+XqRWOGzHbGa nO7FEG+ZqgNGga06pBEYevDD X-Received: by 2002:a65:4946:: with SMTP id q6mr1769075pgs.201.1547523242855; Mon, 14 Jan 2019 19:34:02 -0800 (PST) Received: from localhost.localdomain ([2409:4072:6084:4813:7cd6:42d1:f14c:3e90]) by smtp.gmail.com with ESMTPSA id s9sm2137023pgl.88.2019.01.14.19.33.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Jan 2019 19:34:02 -0800 (PST) From: Manivannan Sadhasivam To: sboyd@kernel.org, mturquette@baylibre.com, afaerber@suse.de, robh+dt@kernel.org, linux-arm-kernel@lists.infradead.org, linux-actions@lists.infradead.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Cc: Manivannan Sadhasivam Subject: [PATCH v2 1/6] clk: actions: Add configurable PLL delay Date: Tue, 15 Jan 2019 09:03:35 +0530 Message-Id: <20190115033340.25016-2-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190115033340.25016-1-manivannan.sadhasivam@linaro.org> References: <20190115033340.25016-1-manivannan.sadhasivam@linaro.org> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org S500 SoC requires configurable delay for different PLLs. Hence, add a separate macro for declaring a PLL with configurable delay and also modify the existing OWL_PLL_NO_PARENT macro to use default delay so that no need to modify the existing S700/S900 drivers. Signed-off-by: Manivannan Sadhasivam --- drivers/clk/actions/owl-pll.c | 2 +- drivers/clk/actions/owl-pll.h | 30 ++++++++++++++++++++++++------ 2 files changed, 25 insertions(+), 7 deletions(-) -- 2.17.1 diff --git a/drivers/clk/actions/owl-pll.c b/drivers/clk/actions/owl-pll.c index 058e06d7099f..02437bdedf4d 100644 --- a/drivers/clk/actions/owl-pll.c +++ b/drivers/clk/actions/owl-pll.c @@ -179,7 +179,7 @@ static int owl_pll_set_rate(struct clk_hw *hw, unsigned long rate, regmap_write(common->regmap, pll_hw->reg, reg); - udelay(PLL_STABILITY_WAIT_US); + udelay(pll_hw->delay); return 0; } diff --git a/drivers/clk/actions/owl-pll.h b/drivers/clk/actions/owl-pll.h index 0aae30abd5dc..6fb0d45bb088 100644 --- a/drivers/clk/actions/owl-pll.h +++ b/drivers/clk/actions/owl-pll.h @@ -13,6 +13,8 @@ #include "owl-common.h" +#define OWL_PLL_DEF_DELAY 50 + /* last entry should have rate = 0 */ struct clk_pll_table { unsigned int val; @@ -27,6 +29,7 @@ struct owl_pll_hw { u8 width; u8 min_mul; u8 max_mul; + u8 delay; const struct clk_pll_table *table; }; @@ -36,7 +39,7 @@ struct owl_pll { }; #define OWL_PLL_HW(_reg, _bfreq, _bit_idx, _shift, \ - _width, _min_mul, _max_mul, _table) \ + _width, _min_mul, _max_mul, _delay, _table) \ { \ .reg = _reg, \ .bfreq = _bfreq, \ @@ -45,6 +48,7 @@ struct owl_pll { .width = _width, \ .min_mul = _min_mul, \ .max_mul = _max_mul, \ + .delay = _delay, \ .table = _table, \ } @@ -52,8 +56,8 @@ struct owl_pll { _shift, _width, _min_mul, _max_mul, _table, _flags) \ struct owl_pll _struct = { \ .pll_hw = OWL_PLL_HW(_reg, _bfreq, _bit_idx, _shift, \ - _width, _min_mul, \ - _max_mul, _table), \ + _width, _min_mul, _max_mul, \ + OWL_PLL_DEF_DELAY, _table), \ .common = { \ .regmap = NULL, \ .hw.init = CLK_HW_INIT(_name, \ @@ -67,8 +71,23 @@ struct owl_pll { _shift, _width, _min_mul, _max_mul, _table, _flags) \ struct owl_pll _struct = { \ .pll_hw = OWL_PLL_HW(_reg, _bfreq, _bit_idx, _shift, \ - _width, _min_mul, \ - _max_mul, _table), \ + _width, _min_mul, _max_mul, \ + OWL_PLL_DEF_DELAY, _table), \ + .common = { \ + .regmap = NULL, \ + .hw.init = CLK_HW_INIT_NO_PARENT(_name, \ + &owl_pll_ops, \ + _flags), \ + }, \ + } + +#define OWL_PLL_NO_PARENT_DELAY(_struct, _name, _reg, _bfreq, _bit_idx, \ + _shift, _width, _min_mul, _max_mul, _delay, _table, \ + _flags) \ + struct owl_pll _struct = { \ + .pll_hw = OWL_PLL_HW(_reg, _bfreq, _bit_idx, _shift, \ + _width, _min_mul, _max_mul, \ + _delay, _table), \ .common = { \ .regmap = NULL, \ .hw.init = CLK_HW_INIT_NO_PARENT(_name, \ @@ -78,7 +97,6 @@ struct owl_pll { } #define mul_mask(m) ((1 << ((m)->width)) - 1) -#define PLL_STABILITY_WAIT_US (50) static inline struct owl_pll *hw_to_owl_pll(const struct clk_hw *hw) {