Received: by 10.192.165.148 with SMTP id m20csp104364imm; Thu, 26 Apr 2018 17:01:43 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqN6wjK0BJ4qXCuwcGCVNp2HWyp7IzeJ2HqcWnjddabc9NZiQNnatWMV98wjfpIJMePrgdV X-Received: by 2002:a63:316:: with SMTP id 22-v6mr85869pgd.277.1524787303208; Thu, 26 Apr 2018 17:01:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524787303; cv=none; d=google.com; s=arc-20160816; b=GPB0JIiUie996zhuhEt5Q9hWXw2DG+hVt+2/UlhP3RH3mVVfSxoNmISNXzul5K0E89 f9hTW9fzt2Chf1GNuxULjSq+nFTsNQt74NviHOjhVn4CHj5RzSjZs1LEL2eZq8klYIFC ZENNpUe/AsRGOcIQDoabVVYllX/+LwzXQNYqCt/RiG21NbHvhA/x4C7aZEwMzpDVSScD Cy5a5K6CweI3th8gzHbX/FlAVxKb8veLX2+VfbUU9wiQ5zW7Np5+zH2G3CI8Ohe5XQkG 5iR1cgKgtS8lbxtlKMpo6BOcy9zatCUyivgDcnucExtGy86BweYKiKe8bcCd+FuusJTF 8bXg== 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:arc-authentication-results; bh=0D+vqmGvvUICaGe3L/2H3vK9I5PBlPJsm9W0a2F53+w=; b=044MkB4sib/oJY+TaTypTj0qb7uYzzl79k7+LIOI9o7dFVgS0tL3iG8WYBnEKiMBQ1 AZTpY24CuB9/dgp2KcZ7tPQoAd7yWHcxiN5qVWiW+Dc5S4WPdPWQ7BCXo5+/YJD3u3xm Cg/kBvDB1/5KtgjGU9+f1LU/cyySsmmCF15KCD3d1Zlp6ZNCEq1pqMN8S5/IlDHNvHQA tFW6WHm8tbKnUcgGnjf5foodfiwjzFhUIfPx68ZOi1CreYmEbp1YLZCrPFHAqUR3zZrP mH6AvEP65FUmfeLzzsJbkRpGx+O2DWi28ocMG4wPIF8nfxj6Q8qPxV9WkRSP48IEXVKP tiIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=VCMkq+qk; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s3-v6si33428pgr.421.2018.04.26.17.01.28; Thu, 26 Apr 2018 17:01:43 -0700 (PDT) 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=pass header.i=@gmail.com header.s=20161025 header.b=VCMkq+qk; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932276AbeDZX7u (ORCPT + 99 others); Thu, 26 Apr 2018 19:59:50 -0400 Received: from mail-lf0-f66.google.com ([209.85.215.66]:44647 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753628AbeDZX66 (ORCPT ); Thu, 26 Apr 2018 19:58:58 -0400 Received: by mail-lf0-f66.google.com with SMTP id h197-v6so128666lfg.11; Thu, 26 Apr 2018 16:58:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=0D+vqmGvvUICaGe3L/2H3vK9I5PBlPJsm9W0a2F53+w=; b=VCMkq+qks5Xfkf2AkMyT0enDAaefXkZtzGbsVmIZMYKX+A709kiRhiXKNpEyW/T5xv PmRRPYlqAz1JMS4QvYq4d1waIr5UoWqRbalSQeazuO6+XATUqj7HUJMrQhVYw6QbFP3V n7www8iS9q2HUlHwUsDgsv4YPnBIdO/amdhrHAacLBjrq/WhpzK+dIMeFWKy0Adl5ziC tMFhTzpyuB64mR5YH6LE/vfc5C4ulZgh/asvD1X/XVcXU++mpm3PUncFc7CciUzUQA4e lxmANcRFqbbaDEr32WAvAf3OcOSpHgi+HyWOWQs24syfsH7Pqu1P5Y0f1VxvRugMhqux KiEw== 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=0D+vqmGvvUICaGe3L/2H3vK9I5PBlPJsm9W0a2F53+w=; b=QqR4djUJMCkxrqsO2xn5mLUGnRztCtiTqYJqoVcpTwa5gRCixvQxt0qS8x0gKw8yHZ hukIpUs/gtcuzJ9z9Mg1Uwb2dfmgqsb19luEum7u/MomZQbdjegNyxrV1vg/i6oS+IpT p8EiFCCULsMD9rgX+VAFscSEfRX9Ko5WvHtAFc3kOaV7weOj9/U3Q1CRBYmhH7tQ/0Vu PYocsr4DJDBXGfwupiVtrPKdYGo2GJEI3qVQs/t37GhsfS+3dKxUQVEdvfPPtKDh8EL3 aT4TJCWcv28WsJO58c/dtthXHR6qXoSyyfczhIPuq0nU/vU113XvSTvfXI9Vr9NsQAsk gXjQ== X-Gm-Message-State: ALQs6tDdRwW5Hxg32DqCD3mIvNKII0qoNiLrflZbGL4+6Xj/Ouy/Tf76 vT8MJHeigQYxLDTima38mF6AIzrI X-Received: by 2002:a2e:3806:: with SMTP id f6-v6mr62690lja.25.1524787136748; Thu, 26 Apr 2018 16:58:56 -0700 (PDT) Received: from localhost.localdomain (ppp109-252-91-130.pppoe.spdop.ru. [109.252.91.130]) by smtp.gmail.com with ESMTPSA id o4-v6sm7420ljh.39.2018.04.26.16.58.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Apr 2018 16:58:56 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Peter De Schrijver , Prashant Gaikwad , Stephen Boyd , Michael Turquette , Linus Walleij , Marcel Ziswiler , Marc Dietrich Cc: linux-clk@vger.kernel.org, linux-gpio@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 2/4] pinctrl: tegra20: Provide CDEV1/2 clock muxes Date: Fri, 27 Apr 2018 02:58:16 +0300 Message-Id: <20180426235818.10018-3-digetx@gmail.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180426235818.10018-1-digetx@gmail.com> References: <20180426235818.10018-1-digetx@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Muxing of pins MCLK1/2 determine the muxing of the corresponding clocks. Make pinctrl driver to provide clock muxes for the CDEV1/2 pingroups, so that main clk-controller driver could get an actual parent clock for the CDEV1/2 clocks. Signed-off-by: Dmitry Osipenko --- drivers/pinctrl/tegra/pinctrl-tegra.c | 11 --------- drivers/pinctrl/tegra/pinctrl-tegra.h | 11 +++++++++ drivers/pinctrl/tegra/pinctrl-tegra20.c | 30 ++++++++++++++++++++++++- 3 files changed, 40 insertions(+), 12 deletions(-) diff --git a/drivers/pinctrl/tegra/pinctrl-tegra.c b/drivers/pinctrl/tegra/pinctrl-tegra.c index 72c718e66ebb..49c7c1499bc3 100644 --- a/drivers/pinctrl/tegra/pinctrl-tegra.c +++ b/drivers/pinctrl/tegra/pinctrl-tegra.c @@ -33,17 +33,6 @@ #include "../pinctrl-utils.h" #include "pinctrl-tegra.h" -struct tegra_pmx { - struct device *dev; - struct pinctrl_dev *pctl; - - const struct tegra_pinctrl_soc_data *soc; - const char **group_pins; - - int nbanks; - void __iomem **regs; -}; - static inline u32 pmx_readl(struct tegra_pmx *pmx, u32 bank, u32 reg) { return readl(pmx->regs[bank] + reg); diff --git a/drivers/pinctrl/tegra/pinctrl-tegra.h b/drivers/pinctrl/tegra/pinctrl-tegra.h index 33b17cb1471e..aa33c20766c4 100644 --- a/drivers/pinctrl/tegra/pinctrl-tegra.h +++ b/drivers/pinctrl/tegra/pinctrl-tegra.h @@ -16,6 +16,17 @@ #ifndef __PINMUX_TEGRA_H__ #define __PINMUX_TEGRA_H__ +struct tegra_pmx { + struct device *dev; + struct pinctrl_dev *pctl; + + const struct tegra_pinctrl_soc_data *soc; + const char **group_pins; + + int nbanks; + void __iomem **regs; +}; + enum tegra_pinconf_param { /* argument: tegra_pinconf_pull */ TEGRA_PINCONF_PARAM_PULL, diff --git a/drivers/pinctrl/tegra/pinctrl-tegra20.c b/drivers/pinctrl/tegra/pinctrl-tegra20.c index 7e38ee9bae78..f31e39d797f9 100644 --- a/drivers/pinctrl/tegra/pinctrl-tegra20.c +++ b/drivers/pinctrl/tegra/pinctrl-tegra20.c @@ -19,6 +19,7 @@ * more details. */ +#include #include #include #include @@ -2231,9 +2232,36 @@ static const struct tegra_pinctrl_soc_data tegra20_pinctrl = { .drvtype_in_mux = false, }; +static const char *cdev1_parents[4] = { + "cdev1_osc_div", "pll_a_out0", "pll_m_out1", "audio", +}; + +static const char *cdev2_parents[4] = { + "cdev2_osc_div", "hclk", "pclk", "pll_p_out4", +}; + +static void tegra20_pinctrl_register_clock_muxes(struct platform_device *pdev) +{ + struct tegra_pmx *pmx = platform_get_drvdata(pdev); + + clk_register_mux(NULL, "cdev1_mux", cdev1_parents, 4, 0, + pmx->regs[1] + 0x8, 2, 2, CLK_MUX_READ_ONLY, NULL); + + clk_register_mux(NULL, "cdev2_mux", cdev2_parents, 4, 0, + pmx->regs[1] + 0x8, 4, 2, CLK_MUX_READ_ONLY, NULL); +} + static int tegra20_pinctrl_probe(struct platform_device *pdev) { - return tegra_pinctrl_probe(pdev, &tegra20_pinctrl); + int err; + + err = tegra_pinctrl_probe(pdev, &tegra20_pinctrl); + if (err) + return err; + + tegra20_pinctrl_register_clock_muxes(pdev); + + return 0; } static const struct of_device_id tegra20_pinctrl_of_match[] = { -- 2.17.0