From: Mike Turquette <mturquette@linaro.org>
Cc: mark.rutland@arm.com, devicetree@vger.kernel.org,
pawel.moll@arm.com, ijc+devicetree@hellion.org.uk,
broonie@linaro.org, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org, rob.herring@calxeda.com,
Laxman Dewangan <ldewangan@nvidia.com>,
rob@landley.net, grant.likely@linaro.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] clk: palmas: add clock driver for palmas
Date: Fri, 04 Oct 2013 12:35:17 -0700 [thread overview]
Message-ID: <20131004193517.4343.96145@quantum> (raw)
In-Reply-To: <1380803407-15196-1-git-send-email-ldewangan@nvidia.com>
Quoting Laxman Dewangan (2013-10-03 05:30:07)
> +static struct clk_ops palmas_clks_ops = {
> + .prepare = palmas_clks_prepare,
> + .unprepare = palmas_clks_unprepare,
> + .is_enabled = palmas_clks_is_enabled,
Use .is_prepared if a call to clk_prepare for your clock will start
generating a signal. No need for .is_enabled since you do not define
your own .enable & .disable callbacks.
> +};
> +
> +static struct clk_init_data palmas_clks_hw_init[PALMAS_CLOCK32K_NR] = {
> + [PALMAS_CLOCK32KG] = {
> + .name = "clk32k_kg",
> + .ops = &palmas_clks_ops,
> + .flags = CLK_IS_ROOT | CLK_IGNORE_UNUSED,
> + },
> + [PALMAS_CLOCK32KG_AUDIO] = {
> + .name = "clk32k_kg_audio",
> + .ops = &palmas_clks_ops,
> + .flags = CLK_IS_ROOT | CLK_IGNORE_UNUSED,
> + },
> +};
> +
> +static int palmas_clks_get_clk_data(struct platform_device *pdev,
> + struct palmas_clks *palmas_clks)
> +{
> + struct device_node *node = pdev->dev.of_node;
> + struct device_node *child;
> + struct palmas_clock_info *cinfo;
> + unsigned int prop;
> + int ret;
> + int i;
> +
> + for (i = 0; i < PALMAS_CLOCK32K_NR; ++i) {
> + child = of_get_child_by_name(node,
> + palmas_clk32k_descs[i].clk_name);
> + if (!child)
> + continue;
> +
> + cinfo = &palmas_clks->clk_info[i];
> + cinfo->boot_enable = of_property_read_bool(child,
> + "ti,clock-boot-enable");
> + ret = of_property_read_u32(child, "ti,external-sleep-control",
> + &prop);
> + if (!ret) {
> + switch (prop) {
> + case 1:
> + prop = PALMAS_EXT_CONTROL_ENABLE1;
> + break;
> + case 2:
> + prop = PALMAS_EXT_CONTROL_ENABLE2;
> + break;
> + case 3:
> + prop = PALMAS_EXT_CONTROL_NSLEEP;
> + break;
> + default:
> + WARN_ON(1);
> + dev_warn(&pdev->dev,
> + "%s: Invalid ext control option: %u\n",
> + child->name, prop);
> + prop = 0;
> + break;
> + }
> + cinfo->ext_control_pin = prop;
> + }
> + }
> +
> + return 0;
> +}
> +
> +static int palmas_clks_init_configure(struct palmas_clock_info *cinfo)
> +{
> + struct palmas_clks *palmas_clks = cinfo->palmas_clk;
> + int ret;
> + unsigned int val = 0;
> + unsigned int mask;
> +
> + if (cinfo->boot_enable || cinfo->ext_control_pin)
> + val |= cinfo->clk_desc->enable_mask;
So if the ti,clock-boot-enable property exists then a clock signal will
be generated by palmas but the Linux clock tree representation won't
know it. This is bad.
Better to call clk_get and clk_prepare_enable here instead of cheating
and directly writing to the register.
Regards,
Mike
prev parent reply other threads:[~2013-10-04 19:35 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-03 12:30 [PATCH] clk: palmas: add clock driver for palmas Laxman Dewangan
2013-10-04 16:41 ` Mark Brown
2013-10-04 19:35 ` Mike Turquette
2013-10-04 20:52 ` Mark Brown
2013-10-04 19:35 ` Mike Turquette [this message]
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=20131004193517.4343.96145@quantum \
--to=mturquette@linaro.org \
--cc=broonie@linaro.org \
--cc=devicetree@vger.kernel.org \
--cc=grant.likely@linaro.org \
--cc=ijc+devicetree@hellion.org.uk \
--cc=ldewangan@nvidia.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=pawel.moll@arm.com \
--cc=rob.herring@calxeda.com \
--cc=rob@landley.net \
/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).