From patchwork Mon Dec 31 18:55:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 154630 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp11197372ljp; Mon, 31 Dec 2018 10:55:48 -0800 (PST) X-Google-Smtp-Source: ALg8bN4Opp4BUPCeczm0iwe20mYnnfD99EURDpS33u2bLIp5dItcImzlrfTOJNekAk0CQdrC8Mn1 X-Received: by 2002:a17:902:4124:: with SMTP id e33mr37847139pld.236.1546282548180; Mon, 31 Dec 2018 10:55:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546282548; cv=none; d=google.com; s=arc-20160816; b=NNqKQM5KVdHEs09hiZDd4b8bO9UaFYb0i6Qh23B4ksb1VhV2BtH9fcrpcNHWZNhVRR V1gmcL+IyQjJ/NJIDp5eQj4CGp+Olan9ijmQnA3vtmkGI4QlytizllKrhnGjjhfCmwrt Ue5l41HQ3XGXO5LsjLhB7y2eQLVen1FqWajRB/+7tI4pHdcHc6iT0wbDKMrjB84HXcQa uVI4Bz4vKuXbN3KeMQAFXeE/s87npav1vpP8hryAY9p5uTYcbbMXY/M4HgHOpV6xsGIZ jUA5kUeQ9IujHe6s/7NgdluqBhHKlay5KlNSzhnWdzriDMSpr1EnENBAhsoJYyuB52i0 Q19Q== 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=H64jNWKYki2XIZcMnP0PoJrb80dbRQHGUDbGDGTXqMTVGpftegF8Gb9FvIjWIY+bCx ESC+Viq+HFSERDb91w+Mh+KkkNgNq/sZ3fkFCf69Du9RO1saUd+sBonDSjteiR1qdNkH Ub6AK8aahSB5GeGCqk8p+B5QM4/+N3fOL/L7YlA3d25/uVOHmPp+ZvgRj5S17KDlZlsP PNODQXUWDAjn1sIbU6kwXWNHo+qO+RUpJFhfS2Cs6Jeu8OLKjDLVTNI/9Tr9v439OGrx ZXnY/c2lGPooWC7IVKsKlcbWE/psMd1rz4GcbH5EG3TClfBuYIEPlI68AFRRf/nvaTP9 apxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=X8Tt52Jc; 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 o195si8652274pfg.106.2018.12.31.10.55.47; Mon, 31 Dec 2018 10:55:48 -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=X8Tt52Jc; 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 S1727777AbeLaSzp (ORCPT + 7 others); Mon, 31 Dec 2018 13:55:45 -0500 Received: from mail-pl1-f195.google.com ([209.85.214.195]:36212 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727772AbeLaSzp (ORCPT ); Mon, 31 Dec 2018 13:55:45 -0500 Received: by mail-pl1-f195.google.com with SMTP id g9so12896349plo.3 for ; Mon, 31 Dec 2018 10:55:45 -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=X8Tt52JcCR8ZkeN2DDakfZzHCPRVV4UzdKgl85bFhx1Btuy/aWNp56Wa1wbQuEAxvX /6FPeBENCGfp9th/naRoCzH1Em3pitOhqvpb8ASdME5jGaStYrLVfWR45Km9V/MoK3RH 9hQfv8eqdpXnFgZsEYmGWIB+ds0g8icOp38qw= 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=pK3pHhPrjSCtBQGgRVknB3/s6H/tX7EcD5ekgnyZ2j2FsZy/VVG16C8ZIUSpHl7WvS 5glQQy9jiaLYH1I4+N2GZmutLr6TYtU3pK+mrfE9Ks0ClMR4TJ+dhTRfk4La9snjzzu4 /icWhO/rrUzsOQQ1g75j0GJBA0Z2r4b1WzfaiLj8AGS7mIWO1EHdEDD8DhB0hPKICrFw srZ0eboxFIwgvSX5WWS9H0Xlvmw1/fhRPKjaVpi7F930AcnW6wAbB+H0XWAsDbSSn+J+ 00XS+rK2FlmDCLiQcys3uLsXiVLDOtKbHlTwCgJW5oaL28DNpNWzZa5IfIp3aGiO4+z3 W3ow== X-Gm-Message-State: AJcUukfQ6Wz8t4413iTxakB+1A6IlLi+lpiGBWKNApvLnLpRIPlHhXQT 9eH6lUca380q+4HBXs4X0o32 X-Received: by 2002:a17:902:c05:: with SMTP id 5mr38534757pls.155.1546282544662; Mon, 31 Dec 2018 10:55:44 -0800 (PST) Received: from localhost.localdomain ([2405:204:7440:b882:8d58:e15f:9ff4:efc2]) by smtp.gmail.com with ESMTPSA id s9sm66146224pgl.88.2018.12.31.10.55.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 31 Dec 2018 10:55:44 -0800 (PST) From: Manivannan Sadhasivam To: sboyd@kernel.org, mturquette@baylibre.com, afaerber@suse.de, robh+dt@kernel.org Cc: 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, Manivannan Sadhasivam Subject: [PATCH 1/6] clk: actions: Add configurable PLL delay Date: Tue, 1 Jan 2019 00:25:12 +0530 Message-Id: <20181231185517.18517-2-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181231185517.18517-1-manivannan.sadhasivam@linaro.org> References: <20181231185517.18517-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) {