From patchwork Wed Jan 16 17:54:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 155743 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp947325jaa; Wed, 16 Jan 2019 09:54:57 -0800 (PST) X-Google-Smtp-Source: ALg8bN4W2nu5AJx8/X5TryOz9uyqsF03IF/jY0heSpSPaUrWbRFvN0S8laXjBgCJgzM5Wd0kMdg6 X-Received: by 2002:a17:902:9a9:: with SMTP id 38mr10949693pln.204.1547661297557; Wed, 16 Jan 2019 09:54:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547661297; cv=none; d=google.com; s=arc-20160816; b=a9sztPFoMtZrYXmz/so07N0L/QGx6c6eD4Kq2gcccwwRbitLqJ9r3oinvTHI0hju8A ccTofpogDz3w+OJFb7ofsxAF6HemBpBLH6N3cbavaHAB97DMSJt46845cWzK9kgSUiwP vHMjtnAoyQy1t5XyADGRe/+8+14drYLHuiCapRSxlHmCwUbPkwqBHVzwih6A+vRQsyaI O3jZGb8Q/PKMF/V+iE6eacbgYl8TwCjE3OOZ4YeaVupP9Od0iiEByUXEVICcZA8FDiKK 28a6PnR6rv9rXjqGRBPJbZLIH4a1NSO4PvuX11x3vfn6RvP5tI+LvkOgkFr5/a5l8u9t 1hGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ZEFgIUtqQbsi+JQedq7tZ44e0QX9Tj/+bq0nOMFDQxo=; b=KirKC44g7Uw7UlUzBxtL2stBouKZSpP4EkEBNjc0HELV9p1Y/EyvmyubeaaYOhFxzY WOqCBOvACg8IdZ3aXNfs7YTitfZ6F3a6ymA1KPZFE+C+YA0aoI+kwRS2Led26zaXgOH7 EjlVeKVnlXMbGvTQNuN17nTZzL29n6seEDlEzTJZW6xGephaqmPUUkt6GntuF7bLcWVE tOpcMY8GUbqrXJKpPB7kjoW84Ps95zUYRy9+9qBpyksDBqS5ssvcXJJjJOQ+rvG+BCrQ CH3A9WQ4/cNn2dxY/Lwy6FvseurT1A8mCZR05a3xvNf4QsIiC2p2K9hU5pNY/bfmUq29 wp/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=WqWEQS4l; 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 b70si6820078pfe.168.2019.01.16.09.54.57; Wed, 16 Jan 2019 09:54:57 -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=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=WqWEQS4l; 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 S1727819AbfAPRy4 (ORCPT + 22 others); Wed, 16 Jan 2019 12:54:56 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:40152 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727773AbfAPRyw (ORCPT ); Wed, 16 Jan 2019 12:54:52 -0500 Received: by mail-wr1-f65.google.com with SMTP id p4so7963650wrt.7 for ; Wed, 16 Jan 2019 09:54:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ZEFgIUtqQbsi+JQedq7tZ44e0QX9Tj/+bq0nOMFDQxo=; b=WqWEQS4l3cv9mvkBmJx/pU7rAbx39S1J9STqryyUF160UnzNMbPRNAcGFoADcjh/ai Y0HLj5rezE12Y6SqrSHVyRQ2DHNRky91VZn2GOpWnO88dK9uwAWYw3TT3L7RVMVhpvjr MPRdStIa7rih0uehNegWLknAbL0M9aiOFj9VZqIFHkldwVpKHwhnXoJgeMti4ucZJ2ah a6GXdrNWVrcrEayZVSHigs0qdba61s6zSsQxJuCFj4aMygen0O752BWVTrr38GKD/vaM eaZpYv1QxEOcov3Ih3JAsae5nZSmzaRUX16e2vxLF+BdETtHcF5IrwxcZQpBz69pwxql +Uow== 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:mime-version:content-transfer-encoding; bh=ZEFgIUtqQbsi+JQedq7tZ44e0QX9Tj/+bq0nOMFDQxo=; b=kb0Zb/fMSqw9kcoxpyFfbdg+tfCWlQRdc0dl5Hqef7Ct836HU9G6a7ygZ45vF1BpWq dpB+9oSup3Y79wPpHU3Rwwz2XxYiwx0MLYNlQcmrSEX1n02MNQdoRhrim+0unTW4mgBr COcUkERRZVovP3fCzQtB8ek1CQdjM3nvSxouHwygW+2oOwEgYKC9uMqmENdKXDDgpwv+ remF7PsxKP13RD2/dt/49GvS2iGzNDXRuoiPmQ8k59Ohp8UPzvtdAoOLmR/E6GUIKoXP LW+M/v9g0h3nbR7/NKLvA8f4MJxLij7QPh8LsVQZE8xMfeo9dFYELaXE1uEGWzYLLOv7 xMuw== X-Gm-Message-State: AJcUukfeEsAVGGjEiPI7ociz3jokiGpey+kDk1BMPogZpYSadXP5imkx VjAB/pfprhu1vY0IidifPaJskA== X-Received: by 2002:a5d:470b:: with SMTP id y11mr8528017wrq.16.1547661290420; Wed, 16 Jan 2019 09:54:50 -0800 (PST) Received: from boomer.local (lmontsouris-657-1-212-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.googlemail.com with ESMTPSA id z9sm68703861wrs.63.2019.01.16.09.54.49 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 16 Jan 2019 09:54:49 -0800 (PST) From: Jerome Brunet To: Neil Armstrong Cc: Jerome Brunet , Michael Turquette , Stephen Boyd , Kevin Hilman , linux-amlogic@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, patchwork-bot+notify@kernel.org Subject: [PATCH 1/3] clk: meson: gxbb: claim clock controller input clock from DT Date: Wed, 16 Jan 2019 18:54:33 +0100 Message-Id: <20190116175435.4990-2-jbrunet@baylibre.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190116175435.4990-1-jbrunet@baylibre.com> References: <20190116175435.4990-1-jbrunet@baylibre.com> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Instead of relying on a fixed name for the xtal clock, claim the controller input clock trough DT. Signed-off-by: Jerome Brunet --- drivers/clk/meson/gxbb.c | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) -- 2.20.1 diff --git a/drivers/clk/meson/gxbb.c b/drivers/clk/meson/gxbb.c index 65f2599e5243..ecf9a8f6281c 100644 --- a/drivers/clk/meson/gxbb.c +++ b/drivers/clk/meson/gxbb.c @@ -16,6 +16,8 @@ #include "gxbb.h" #include "clk-regmap.h" +#define IN_PREFIX "ee-in-" + static DEFINE_SPINLOCK(meson_clk_lock); static const struct pll_params_table gxbb_gp0_pll_params_table[] = { @@ -118,7 +120,7 @@ static struct clk_regmap gxbb_fixed_pll_dco = { .hw.init = &(struct clk_init_data){ .name = "fixed_pll_dco", .ops = &meson_clk_pll_ro_ops, - .parent_names = (const char *[]){ "xtal" }, + .parent_names = (const char *[]){ IN_PREFIX "xtal" }, .num_parents = 1, }, }; @@ -148,7 +150,7 @@ static struct clk_fixed_factor gxbb_hdmi_pll_pre_mult = { .hw.init = &(struct clk_init_data){ .name = "hdmi_pll_pre_mult", .ops = &clk_fixed_factor_ops, - .parent_names = (const char *[]){ "xtal" }, + .parent_names = (const char *[]){ IN_PREFIX "xtal" }, .num_parents = 1, }, }; @@ -241,7 +243,7 @@ static struct clk_regmap gxl_hdmi_pll_dco = { .hw.init = &(struct clk_init_data){ .name = "hdmi_pll_dco", .ops = &meson_clk_pll_ro_ops, - .parent_names = (const char *[]){ "xtal" }, + .parent_names = (const char *[]){ IN_PREFIX "xtal" }, .num_parents = 1, /* * Display directly handle hdmi pll registers ATM, we need @@ -378,7 +380,7 @@ static struct clk_regmap gxbb_sys_pll_dco = { .hw.init = &(struct clk_init_data){ .name = "sys_pll_dco", .ops = &meson_clk_pll_ro_ops, - .parent_names = (const char *[]){ "xtal" }, + .parent_names = (const char *[]){ IN_PREFIX "xtal" }, .num_parents = 1, }, }; @@ -439,7 +441,7 @@ static struct clk_regmap gxbb_gp0_pll_dco = { .hw.init = &(struct clk_init_data){ .name = "gp0_pll_dco", .ops = &meson_clk_pll_ops, - .parent_names = (const char *[]){ "xtal" }, + .parent_names = (const char *[]){ IN_PREFIX "xtal" }, .num_parents = 1, }, }; @@ -491,7 +493,7 @@ static struct clk_regmap gxl_gp0_pll_dco = { .hw.init = &(struct clk_init_data){ .name = "gp0_pll_dco", .ops = &meson_clk_pll_ops, - .parent_names = (const char *[]){ "xtal" }, + .parent_names = (const char *[]){ IN_PREFIX "xtal" }, .num_parents = 1, }, }; @@ -789,7 +791,7 @@ static struct clk_regmap gxbb_mpll2 = { static u32 mux_table_clk81[] = { 0, 2, 3, 4, 5, 6, 7 }; static const char * const clk81_parent_names[] = { - "xtal", "fclk_div7", "mpll1", "mpll2", "fclk_div4", + IN_PREFIX "xtal", "fclk_div7", "mpll1", "mpll2", "fclk_div4", "fclk_div3", "fclk_div5" }; @@ -852,7 +854,7 @@ static struct clk_regmap gxbb_sar_adc_clk_sel = { .name = "sar_adc_clk_sel", .ops = &clk_regmap_mux_ops, /* NOTE: The datasheet doesn't list the parents for bit 10 */ - .parent_names = (const char *[]){ "xtal", "clk81", }, + .parent_names = (const char *[]){ IN_PREFIX "xtal", "clk81", }, .num_parents = 2, }, }; @@ -891,7 +893,7 @@ static struct clk_regmap gxbb_sar_adc_clk = { */ static const char * const gxbb_mali_0_1_parent_names[] = { - "xtal", "gp0_pll", "mpll2", "mpll1", "fclk_div7", + IN_PREFIX "xtal", "gp0_pll", "mpll2", "mpll1", "fclk_div7", "fclk_div4", "fclk_div3", "fclk_div5" }; @@ -1153,7 +1155,7 @@ static struct clk_regmap gxbb_32k_clk = { }; static const char * const gxbb_32k_clk_parent_names[] = { - "xtal", "cts_slow_oscin", "fclk_div3", "fclk_div5" + IN_PREFIX "xtal", "cts_slow_oscin", "fclk_div3", "fclk_div5" }; static struct clk_regmap gxbb_32k_clk_sel = { @@ -1172,7 +1174,7 @@ static struct clk_regmap gxbb_32k_clk_sel = { }; static const char * const gxbb_sd_emmc_clk0_parent_names[] = { - "xtal", "fclk_div2", "fclk_div3", "fclk_div5", "fclk_div7", + IN_PREFIX "xtal", "fclk_div2", "fclk_div3", "fclk_div5", "fclk_div7", /* * Following these parent clocks, we should also have had mpll2, mpll3 @@ -2138,7 +2140,7 @@ static struct clk_regmap gxbb_hdmi_tx = { /* HDMI Clocks */ static const char * const gxbb_hdmi_parent_names[] = { - "xtal", "fclk_div4", "fclk_div3", "fclk_div5" + IN_PREFIX "xtal", "fclk_div4", "fclk_div3", "fclk_div5" }; static struct clk_regmap gxbb_hdmi_sel = { @@ -2285,7 +2287,7 @@ static struct clk_regmap gxbb_vdec_hevc = { static u32 mux_table_gen_clk[] = { 0, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, }; static const char * const gen_clk_parent_names[] = { - "xtal", "vdec_1", "vdec_hevc", "mpll0", "mpll1", "mpll2", + IN_PREFIX "xtal", "vdec_1", "vdec_hevc", "mpll0", "mpll1", "mpll2", "fclk_div4", "fclk_div3", "fclk_div5", "fclk_div7", "gp0_pll", }; @@ -3085,6 +3087,7 @@ static const struct of_device_id clkc_match_table[] = { static int gxbb_clkc_probe(struct platform_device *pdev) { const struct clkc_data *clkc_data; + struct clk_hw *input; struct regmap *map; int ret, i; struct device *dev = &pdev->dev; @@ -3100,6 +3103,14 @@ static int gxbb_clkc_probe(struct platform_device *pdev) return PTR_ERR(map); } + input = meson_clk_hw_register_input(dev, "xtal", IN_PREFIX "xtal", 0); + if (IS_ERR(input)) { + ret = PTR_ERR(input); + if (ret != -EPROBE_DEFER) + dev_err(dev, "failed to get input clock"); + return ret; + } + /* Populate regmap for the common regmap backed clocks */ for (i = 0; i < ARRAY_SIZE(gx_clk_regmaps); i++) gx_clk_regmaps[i]->map = map;