devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding@gmail.com>
To: Franklin S Cooper Jr <fcooper@ti.com>
Cc: robh+dt@kernel.org, tony@atomide.com, linux@arm.linux.org.uk,
	paul@pwsan.com, t-kristo@ti.com, mturquette@baylibre.com,
	sboyd@codeaurora.org, linux-pwm@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-clk@vger.kernel.org, vigneshr@ti.com, nsekhar@ti.com
Subject: Re: [PATCH v8 6/9] pwms: pwm-ti*: Get the clock from the PWMSS parent when using old bindings
Date: Fri, 10 Jun 2016 14:48:10 +0200	[thread overview]
Message-ID: <20160610124810.GE27142@ulmo.ba.sec> (raw)
In-Reply-To: <1462291015-1919-7-git-send-email-fcooper@ti.com>

[-- Attachment #1: Type: text/plain, Size: 2463 bytes --]

On Tue, May 03, 2016 at 10:56:52AM -0500, Franklin S Cooper Jr wrote:
> When using the old eCAP and ePWM bindings for AM335x and AM437x the clock
> can be retrieved from the PWMSS parent. Newer bindings will insure that
> this clock is provided via device tree.
> 
> Therefore, update this driver to support the newer and older bindings. In
> the case of the older binding being used give a warning.
> 
> Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
> ---
>  drivers/pwm/pwm-tiecap.c   | 7 +++++++
>  drivers/pwm/pwm-tiehrpwm.c | 7 +++++++
>  2 files changed, 14 insertions(+)
> 
> diff --git a/drivers/pwm/pwm-tiecap.c b/drivers/pwm/pwm-tiecap.c
> index 616af76..a0833c8 100644
> --- a/drivers/pwm/pwm-tiecap.c
> +++ b/drivers/pwm/pwm-tiecap.c
> @@ -195,6 +195,7 @@ static const struct pwm_ops ecap_pwm_ops = {
>  };
>  
>  static const struct of_device_id ecap_of_match[] = {
> +	{ .compatible	= "ti,am3352-ecap" },
>  	{ .compatible	= "ti,am33xx-ecap" },
>  	{},
>  };
> @@ -213,6 +214,12 @@ static int ecap_pwm_probe(struct platform_device *pdev)
>  		return -ENOMEM;
>  
>  	clk = devm_clk_get(&pdev->dev, "fck");
> +
> +	if (IS_ERR(clk) && of_device_is_compatible(pdev->dev.of_node, "ti,am33xx-ecap")) {
> +		dev_warn(&pdev->dev, "Binding is obsolete.\n");
> +		clk = devm_clk_get(pdev->dev.parent, "fck");
> +	}

I rewrote this slightly for readability:

	struct device_node *np = pdev->dev.of_node;

	if (IS_ERR(clk)) {
		if (of_device_is_compatible(np, "ti,am33xx-ecap")) {
			...
		}
	}

>  	if (IS_ERR(clk)) {
>  		dev_err(&pdev->dev, "failed to get clock\n");
>  		return PTR_ERR(clk);
> diff --git a/drivers/pwm/pwm-tiehrpwm.c b/drivers/pwm/pwm-tiehrpwm.c
> index 6a41e66..cee29a2 100644
> --- a/drivers/pwm/pwm-tiehrpwm.c
> +++ b/drivers/pwm/pwm-tiehrpwm.c
> @@ -426,6 +426,7 @@ static const struct pwm_ops ehrpwm_pwm_ops = {
>  };
>  
>  static const struct of_device_id ehrpwm_of_match[] = {
> +	{ .compatible	= "ti,am3352-ehrpwm" },
>  	{ .compatible	= "ti,am33xx-ehrpwm" },
>  	{},
>  };
> @@ -444,6 +445,12 @@ static int ehrpwm_pwm_probe(struct platform_device *pdev)
>  		return -ENOMEM;
>  
>  	clk = devm_clk_get(&pdev->dev, "fck");
> +
> +	if (IS_ERR(clk) && of_device_is_compatible(pdev->dev.of_node, "ti,am33xx-ecap")) {
> +		dev_warn(&pdev->dev, "Binding is obsolete.\n");
> +		clk = devm_clk_get(pdev->dev.parent, "fck");
> +	}
> +

Same here.

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2016-06-10 12:48 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-03 15:56 [PATCH v8 0/9] ARM: dts: DRA7: Add dt nodes for PWMSS Franklin S Cooper Jr
2016-05-03 15:56 ` [PATCH v8 1/9] clk: ti: am335x/am4372: Add tbclk to pwm node Franklin S Cooper Jr
2016-07-11 22:20   ` Michael Turquette
2016-07-12 13:45     ` Franklin S Cooper Jr.
2016-05-03 15:56 ` [PATCH v8 2/9] ARM: dts: am437x: Add missing compatibles to PWM binding documents Franklin S Cooper Jr
2016-05-03 15:56 ` [PATCH v8 3/9] pwm: pwm-tiehrpwm: Update dt binding document to use generic node name Franklin S Cooper Jr
2016-07-11  9:55   ` Thierry Reding
2016-05-03 15:56 ` [PATCH v8 4/9] pwm: pwm-tiecap: Update dt binding document to use proper unit address Franklin S Cooper Jr
2016-05-04 13:47   ` Rob Herring
2016-07-11  9:56   ` Thierry Reding
2016-07-11 10:06     ` Thierry Reding
2016-07-11 10:33       ` Thierry Reding
2016-05-03 15:56 ` [PATCH v8 5/9] ARM: dts: am437x/am33xx/da850: Add new ECAP and EPWM bindings Franklin S Cooper Jr
2016-06-10 10:34   ` Tony Lindgren
2016-06-10 12:01     ` Tony Lindgren
2016-06-10 12:40       ` Thierry Reding
2016-06-10 13:01         ` Tony Lindgren
2016-05-03 15:56 ` [PATCH v8 6/9] pwms: pwm-ti*: Get the clock from the PWMSS parent when using old bindings Franklin S Cooper Jr
2016-06-10 12:48   ` Thierry Reding [this message]
2016-05-03 15:56 ` [PATCH v8 7/9] ARM: dts: am437x/am33xx: Remove hwmod entries for ECAP and EPWM nodes Franklin S Cooper Jr
2016-05-03 15:56 ` [PATCH v8 8/9] ARM: AM335x/AM437x: hwmod: Remove eQEP, ePWM and eCAP hwmod entries Franklin S Cooper Jr
2016-06-10 12:03   ` Tony Lindgren
2016-05-03 15:56 ` [PATCH v8 9/9] ARM: dts: DRA7: Add dt nodes for PWMSS Franklin S Cooper Jr
2016-06-03 19:00 ` [PATCH v8 0/9] " Franklin Cooper Jr.

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=20160610124810.GE27142@ulmo.ba.sec \
    --to=thierry.reding@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=fcooper@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=mturquette@baylibre.com \
    --cc=nsekhar@ti.com \
    --cc=paul@pwsan.com \
    --cc=robh+dt@kernel.org \
    --cc=sboyd@codeaurora.org \
    --cc=t-kristo@ti.com \
    --cc=tony@atomide.com \
    --cc=vigneshr@ti.com \
    /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).