devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
To: Bai Ping <ping.bai-3arQi8VN3Tc@public.gmane.org>
Cc: shawnguo-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	mturquette-rdvid1DuHRBWk0Htik3J/w@public.gmane.org,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	mark.rutland-5wv7dgnIgG8@public.gmane.org,
	linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
	kernel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org,
	fabio.estevam-3arQi8VN3Tc@public.gmane.org,
	daniel.lezcano-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
	tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org,
	p.zabel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org,
	linux-clk-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	jacky.baip-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Subject: Re: [PATCH v2 04/12] driver: clk: imx: Add clock driver for imx6sll
Date: Mon, 9 Jan 2017 16:37:53 -0800	[thread overview]
Message-ID: <20170110003753.GM17126@codeaurora.org> (raw)
In-Reply-To: <1482832070-22668-5-git-send-email-ping.bai-3arQi8VN3Tc@public.gmane.org>

On 12/27, Bai Ping wrote:
> diff --git a/drivers/clk/imx/clk-imx6sll.c b/drivers/clk/imx/clk-imx6sll.c
> new file mode 100644
> index 0000000..73758fe1
> --- /dev/null
> +++ b/drivers/clk/imx/clk-imx6sll.c
> @@ -0,0 +1,369 @@
> +/*
> + * Copyright (C) 2016 Freescale Semiconductor, Inc.
> + *
> + * The code contained herein is licensed under the GNU General Public
> + * License. You may obtain a copy of the GNU General Public License
> + * Version 2 or later at the following locations:
> + *
> + * http://www.opensource.org/licenses/gpl-license.html
> + * http://www.gnu.org/copyleft/gpl.html
> + */
> +
> +#include <dt-bindings/clock/imx6sll-clock.h>
> +#include <linux/clk.h>
> +#include <linux/clkdev.h>

Is this used?

> +#include <linux/err.h>
> +#include <linux/init.h>
> +#include <linux/io.h>
> +#include <linux/of.h>
> +#include <linux/of_address.h>
> +#include <linux/of_irq.h>

Is this used?

> +#include <linux/types.h>
> +
> +#include "clk.h"
> +
> +#define CCM_ANALOG_PLL_BYPASS		(0x1 << 16)
> +#define BM_CCM_CCDR_MMDC_CH0_MASK	(0x2 << 16)
> +#define CCDR	0x4
> +#define xPLL_CLR(offset)		 (offset + 0x8)
> +
> +static const char *pll_bypass_src_sels[] = { "osc", "dummy", };

All these should be const char * const unless something is wrong.

> +static const char *pll1_bypass_sels[] = { "pll1", "pll1_bypass_src", };
> +static const char *pll2_bypass_sels[] = { "pll2", "pll2_bypass_src", };
> +static const char *pll3_bypass_sels[] = { "pll3", "pll3_bypass_src", };
> +static const char *pll4_bypass_sels[] = { "pll4", "pll4_bypass_src", };
> +static const char *pll5_bypass_sels[] = { "pll5", "pll5_bypass_src", };
> +static const char *pll6_bypass_sels[] = { "pll6", "pll6_bypass_src", };
[...]
> +	clks[IMX6SLL_CLK_USDHC3]	= imx_clk_gate2("usdhc3",	"usdhc3_podf",	 base + 0x80,	6);
> +
> +	/* mask handshake of mmdc */
> +	writel_relaxed(BM_CCM_CCDR_MMDC_CH0_MASK, base + CCDR);
> +
> +	for (i = 0; i < ARRAY_SIZE(clks); i++)
> +		if (IS_ERR(clks[i]))
> +			pr_err("i.MX6SLL clk %d: register failed with %ld\n", i, PTR_ERR(clks[i]));
> +
> +	clk_data.clks = clks;
> +	clk_data.clk_num = ARRAY_SIZE(clks);
> +	of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
> +
> +	/* set perclk to from OSC */
> +	clk_set_parent(clks[IMX6SLL_CLK_PERCLK_SEL], clks[IMX6SLL_CLK_OSC]);

Can this be done with assigned-clocks in DT?

> +
> +	for (i = 0; i < ARRAY_SIZE(clks_init_on); i++)
> +		clk_prepare_enable(clks[clks_init_on[i]]);

Critical clocks?

> +
> +	if (IS_ENABLED(CONFIG_USB_MXS_PHY)) {
> +		clk_prepare_enable(clks[IMX6SLL_CLK_USBPHY1_GATE]);
> +		clk_prepare_enable(clks[IMX6SLL_CLK_USBPHY2_GATE]);

The phy driver can't enable these?

> +	}
> +
> +	/* Lower the AHB clock rate before changing the clock source. */
> +	clk_set_rate(clks[IMX6SLL_CLK_AHB], 99000000);
> +
> +	/* Change periph_pre clock to pll2_bus to adjust AXI rate to 264MHz */
> +	clk_set_parent(clks[IMX6SLL_CLK_PERIPH_CLK2_SEL], clks[IMX6SLL_CLK_PLL3_USB_OTG]);
> +	clk_set_parent(clks[IMX6SLL_CLK_PERIPH], clks[IMX6SLL_CLK_PERIPH_CLK2]);
> +	clk_set_parent(clks[IMX6SLL_CLK_PERIPH_PRE], clks[IMX6SLL_CLK_PLL2_BUS]);
> +	clk_set_parent(clks[IMX6SLL_CLK_PERIPH], clks[IMX6SLL_CLK_PERIPH_PRE]);
> +
> +	clk_set_rate(clks[IMX6SLL_CLK_AHB], 132000000);

assigned-clocks for rates now? Or perhaps we shouldn't be
exposing these as clks if they have some sort of complicated rate
sequence switch that we can't guarantee with the clk_ops we have
today.

> +}
> +
> +CLK_OF_DECLARE(imx6sll, "fsl,imx6sll-ccm", imx6sll_clocks_init);
> +

Please drop this extra newline.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2017-01-10  0:37 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-27  9:47 [PATCH v2 00/12] Add basic code support for imx6sll Bai Ping
2016-12-27  9:47 ` [PATCH v2 01/12] ARM: imx: Add basic msl " Bai Ping
2016-12-27  9:47 ` [PATCH v2 02/12] driver: clocksource: add gpt timer " Bai Ping
2017-01-09 10:30   ` Daniel Lezcano
2016-12-27  9:47 ` [PATCH v2 03/12] Document: dt: binding: imx: update clock doc " Bai Ping
2017-01-03 17:48   ` Rob Herring
2016-12-27  9:47 ` [PATCH v2 04/12] driver: clk: imx: Add clock driver " Bai Ping
     [not found]   ` <1482832070-22668-5-git-send-email-ping.bai-3arQi8VN3Tc@public.gmane.org>
2017-01-03 17:49     ` Rob Herring
2017-01-10  0:37     ` Stephen Boyd [this message]
     [not found]       ` <20170110003753.GM17126-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2017-01-10  3:18         ` Jacky Bai
2017-01-12 22:05           ` Stephen Boyd
2017-01-13  3:04             ` Jacky Bai
2017-01-21  1:00               ` Stephen Boyd
2017-01-22  2:14                 ` Jacky Bai
2016-12-27  9:47 ` [PATCH v2 05/12] Document: dt: binding: imx: update pinctrl doc " Bai Ping
2016-12-27 12:59   ` Linus Walleij
2017-01-09  2:32     ` Jacky Bai
     [not found]       ` <AM3PR04MB5304992095753B761E66A9A87640-f56W/S9L6NRDGcFijYBXZgfhPeD8jYilXA4E9RH9d+qIuWR1G4zioA@public.gmane.org>
2017-01-11 14:33         ` Linus Walleij
2017-01-12  2:57           ` Jacky Bai
2017-01-13 15:22             ` Linus Walleij
2017-01-17  6:35               ` Jacky Bai
2017-01-18 12:24                 ` Linus Walleij
2017-01-23  6:04                   ` Shawn Guo
2017-01-23  7:17                     ` Jacky Bai
2017-01-26 14:05                       ` Linus Walleij
2017-02-16  7:51     ` Dong Aisheng
2017-02-24  9:02       ` Dong Aisheng
2017-03-14 13:54       ` Linus Walleij
2017-03-15 14:05         ` Dong Aisheng
2016-12-27  9:47 ` [PATCH v2 06/12] driver: pinctrl: imx: Add pinctrl driver support " Bai Ping
2016-12-27 13:01   ` Linus Walleij
2017-01-03  1:00     ` Jacky Bai
2016-12-27  9:47 ` [PATCH v2 07/12] ARM: dts: imx: Add basic dtsi " Bai Ping
2016-12-27  9:47 ` [PATCH v2 08/12] ARM: dts: imx: Add imx6sll EVK board dts support Bai Ping
2016-12-27  9:47 ` [PATCH v2 09/12] ARM: debug: Add low level debug support for imx6sll Bai Ping
2016-12-27  9:47 ` [PATCH v2 10/12] ARM: imx: Add suspend/resume " Bai Ping
2016-12-27  9:47 ` [PATCH v2 11/12] ARM: imx: correct i.mx6sll dram io low power mode Bai Ping
2016-12-27  9:47 ` [PATCH v2 12/12] ARM: configs: enable imx6sll support in defconfig Bai Ping
2017-01-23  6:10 ` [PATCH v2 00/12] Add basic code support for imx6sll Shawn Guo
2017-01-23  7:18   ` Jacky Bai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170110003753.GM17126@codeaurora.org \
    --to=sboyd-sgv2jx0feol9jmxxk+q4oq@public.gmane.org \
    --cc=daniel.lezcano-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=fabio.estevam-3arQi8VN3Tc@public.gmane.org \
    --cc=jacky.baip-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=kernel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org \
    --cc=linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-clk-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-gpio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
    --cc=mturquette-rdvid1DuHRBWk0Htik3J/w@public.gmane.org \
    --cc=p.zabel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org \
    --cc=ping.bai-3arQi8VN3Tc@public.gmane.org \
    --cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=shawnguo-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).