linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Franklin S Cooper Jr <fcooper@ti.com>
To: thierry.reding@gmail.com, 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
Cc: Franklin S Cooper Jr <fcooper@ti.com>
Subject: [PATCH v8 6/9] pwms: pwm-ti*: Get the clock from the PWMSS parent when using old bindings
Date: Tue,  3 May 2016 10:56:52 -0500	[thread overview]
Message-ID: <1462291015-1919-7-git-send-email-fcooper@ti.com> (raw)
In-Reply-To: <1462291015-1919-1-git-send-email-fcooper@ti.com>

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");
+	}
+
 	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");
+	}
+
 	if (IS_ERR(clk)) {
 		dev_err(&pdev->dev, "failed to get clock\n");
 		return PTR_ERR(clk);
-- 
2.7.0

  parent reply	other threads:[~2016-05-03 15:57 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 ` Franklin S Cooper Jr [this message]
2016-06-10 12:48   ` [PATCH v8 6/9] pwms: pwm-ti*: Get the clock from the PWMSS parent when using old bindings Thierry Reding
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=1462291015-1919-7-git-send-email-fcooper@ti.com \
    --to=fcooper@ti.com \
    --cc=devicetree@vger.kernel.org \
    --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=thierry.reding@gmail.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).