Received: by 10.223.185.116 with SMTP id b49csp3624536wrg; Mon, 26 Feb 2018 03:19:36 -0800 (PST) X-Google-Smtp-Source: AH8x225Ak/rhzIXU+SEs5/tfMDyGnHEDp6TDzZJUtZdR1YiWP+UhH9HnRlw6Ixv30f5DCmRquyGO X-Received: by 10.101.100.208 with SMTP id t16mr7881499pgv.398.1519643975965; Mon, 26 Feb 2018 03:19:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519643975; cv=none; d=google.com; s=arc-20160816; b=vZVkUiEF4Y5mTuJNlxJaXMxl2sX3GE/GyGER6h0L6f9gsFz/fOBfwe6M0NOz6FoYU9 gWOPDSbEdu1cOjWoJiMJPNQCy6iWrkF8PwWOJuxErSSLA2JYqPmdXpppuPb9UEWxTPjb maEK+Ct1O5E+0re43LqMgpDZ/Xh3p6eUmHp7bwff1y4bHvMn2h/mXA46deOC7GQkcGCO ZqALsLSkDTUfnsujDOeR7dhseZysLtsZ79fySWs+tEqakYvnPqByCqEPzwA2WEG8qpll TEEz5UB8PxtN2Ir3ZMvm6JZkQYdZGSTFzmCS8i/ofdDAYZR6JUfBDr4ZSnNCxA0STiBM B+vg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:message-id:in-reply-to:subject:cc:to :from:dkim-signature:arc-authentication-results; bh=Da09n9HWSv0T9MOlm1bcl4D7fwEs9kVDSIf7yVjNGww=; b=wY5bivX3wxrmEs57zldxffzXKiEhX9ao64OYj4Eg6wIqidZFuW1sDPIuuw70RJJxkp 7NCBbqI5rqiu2z/JqfpNoXZHla9B+kxd8bGUUog4F3Er6ZYzeLWtQeP8t+KbbgY3lgZp qmnsmmvmSnNaQL+3qA8FaezSmZwQ6ahVHd46uCdhCx5V/HQ5HZpG3mtwEtIFXyaPgLK1 hOP5TQ5lgwstQCttyDkLPeusabKjYdTsSFb3NmIuQlvqQbdsbHgmDg+Rwfkx31vHUrNE ylPRyvdbfFq84izeN99S3BH/1kmQTAKZhm3uMfShxJphxPshulLxnUORap+KmTyRGPAg 71Ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=cSGfMZrk; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 31-v6si6622383plk.699.2018.02.26.03.19.21; Mon, 26 Feb 2018 03:19:35 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=cSGfMZrk; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752877AbeBZLSP (ORCPT + 99 others); Mon, 26 Feb 2018 06:18:15 -0500 Received: from heliosphere.sirena.org.uk ([172.104.155.198]:52280 "EHLO heliosphere.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752258AbeBZLSE (ORCPT ); Mon, 26 Feb 2018 06:18:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sirena.org.uk; s=20170815-heliosphere; h=Date:Message-Id:In-Reply-To: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:References: List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner: List-Archive; bh=Da09n9HWSv0T9MOlm1bcl4D7fwEs9kVDSIf7yVjNGww=; b=cSGfMZrkKWZ9 IY/yEFjeXtyNsmMswEJHpD/lueE4vL9hjOqIFWlH7n/vgC1gLCHcNP3UjXsMnnaU8hv6DarrWu75S xQol2fqg2vDvddljlFWITq2Y1+aTldFAmMMKCuPjXZOh3PLUMjEjnGgoAAiP5UAGt9wPzDn2VxyiN 0q/Ew=; Received: from debutante.sirena.org.uk ([2001:470:1f1d:6b5::3] helo=debutante) by heliosphere.sirena.org.uk with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1eqGn0-0007wF-4R; Mon, 26 Feb 2018 11:17:50 +0000 Received: from broonie by debutante with local (Exim 4.90_1) (envelope-from ) id 1eqGmz-0005ZC-LJ; Mon, 26 Feb 2018 11:17:49 +0000 From: Mark Brown To: Maxime Ripard Cc: Mark Brown , Mark Brown , Thierry Reding , Chen-Yu Tsai , Maxime Ripard , Mark Rutland , Rob Herring , dri-devel@lists.freedesktop.org, Gustavo Padovan , Daniel Vetter , Maarten Lankhorst , Sean Paul , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Thomas Petazzoni , linux-kernel@vger.kernel.org Subject: Applied "regmap: mmio: Add function to attach a clock" to the regmap tree In-Reply-To: <1155920db000d014fd1cd604ed48d1b9a8f64ac1.1519204731.git-series.maxime.ripard@bootlin.com> Message-Id: Date: Mon, 26 Feb 2018 11:17:49 +0000 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The patch regmap: mmio: Add function to attach a clock has been applied to the regmap tree at https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark From 31895662f9ba81e8ea9ef05abf8edcb29d4b9c18 Mon Sep 17 00:00:00 2001 From: Maxime Ripard Date: Wed, 21 Feb 2018 10:20:25 +0100 Subject: [PATCH] regmap: mmio: Add function to attach a clock regmap_init_mmio_clk allows to specify a clock that needs to be enabled while accessing the registers. However, that clock is retrieved through its clock ID, which means it will lookup that clock based on the current device that registers the regmap, and, in the DT case, will only look in that device OF node. This might be problematic if the clock to enable is stored in another node. Let's add a function that allows to attach a clock that has already been retrieved to a regmap in order to fix this. Signed-off-by: Maxime Ripard Signed-off-by: Mark Brown --- drivers/base/regmap/regmap-mmio.c | 24 ++++++++++++++++++++++++ include/linux/regmap.h | 3 +++ 2 files changed, 27 insertions(+) diff --git a/drivers/base/regmap/regmap-mmio.c b/drivers/base/regmap/regmap-mmio.c index 5189fd6182f6..5cadfd3394d8 100644 --- a/drivers/base/regmap/regmap-mmio.c +++ b/drivers/base/regmap/regmap-mmio.c @@ -28,6 +28,8 @@ struct regmap_mmio_context { void __iomem *regs; unsigned val_bytes; + + bool attached_clk; struct clk *clk; void (*reg_write)(struct regmap_mmio_context *ctx, @@ -363,4 +365,26 @@ struct regmap *__devm_regmap_init_mmio_clk(struct device *dev, } EXPORT_SYMBOL_GPL(__devm_regmap_init_mmio_clk); +int regmap_mmio_attach_clk(struct regmap *map, struct clk *clk) +{ + struct regmap_mmio_context *ctx = map->bus_context; + + ctx->clk = clk; + ctx->attached_clk = true; + + return clk_prepare(ctx->clk); +} +EXPORT_SYMBOL_GPL(regmap_mmio_attach_clk); + +void regmap_mmio_detach_clk(struct regmap *map) +{ + struct regmap_mmio_context *ctx = map->bus_context; + + clk_unprepare(ctx->clk); + + ctx->attached_clk = false; + ctx->clk = NULL; +} +EXPORT_SYMBOL_GPL(regmap_mmio_detach_clk); + MODULE_LICENSE("GPL v2"); diff --git a/include/linux/regmap.h b/include/linux/regmap.h index 6a3aeba40e9e..5f7ad0552c03 100644 --- a/include/linux/regmap.h +++ b/include/linux/regmap.h @@ -21,6 +21,7 @@ #include struct module; +struct clk; struct device; struct i2c_client; struct irq_domain; @@ -905,6 +906,8 @@ bool regmap_ac97_default_volatile(struct device *dev, unsigned int reg); __regmap_lockdep_wrapper(__devm_regmap_init_sdw, #config, \ sdw, config) +int regmap_mmio_attach_clk(struct regmap *map, struct clk *clk); +void regmap_mmio_detach_clk(struct regmap *map); void regmap_exit(struct regmap *map); int regmap_reinit_cache(struct regmap *map, const struct regmap_config *config); -- 2.16.1