linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: avinashphilip@ti.com (Philip Avinash)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/3] ARM: davinci: da850: Enable EHRPWM TBCLK from CFG_CHIP1
Date: Thu, 14 Mar 2013 16:07:32 +0530	[thread overview]
Message-ID: <1363257453-24747-3-git-send-email-avinashphilip@ti.com> (raw)
In-Reply-To: <1363257453-24747-1-git-send-email-avinashphilip@ti.com>

da850 platforms require TBCLK synchronization in CFG_CHIP1 register for
TBCLK enable in EHRPWM modules. Enabling of TBCLK is done only if EHRPWM
DT node status is set to "okay" DT blob.
Also adds macro definitions for DA8XX_EHRPWM_TBCLKSYNC and
DA8XX_CFGCHIP1_REG.

Signed-off-by: Philip Avinash <avinashphilip@ti.com>
---
:100644 100644 6b7a0a2... 72466ab... M	arch/arm/mach-davinci/da8xx-dt.c
:100644 100644 de439b7... be77ce2... M	arch/arm/mach-davinci/include/mach/da8xx.h
 arch/arm/mach-davinci/da8xx-dt.c           |   15 +++++++++++++++
 arch/arm/mach-davinci/include/mach/da8xx.h |    1 +
 2 files changed, 16 insertions(+)

diff --git a/arch/arm/mach-davinci/da8xx-dt.c b/arch/arm/mach-davinci/da8xx-dt.c
index 6b7a0a2..72466ab 100644
--- a/arch/arm/mach-davinci/da8xx-dt.c
+++ b/arch/arm/mach-davinci/da8xx-dt.c
@@ -19,6 +19,7 @@
 #include <mach/da8xx.h>
 
 #define DA8XX_NUM_UARTS	3
+#define DA8XX_EHRPWM_TBCLKSYNC	BIT(12)
 
 void __init da8xx_uart_clk_enable(void)
 {
@@ -47,10 +48,24 @@ struct of_dev_auxdata da850_auxdata_lookup[] __initdata = {
 
 static void __init da850_init_machine(void)
 {
+	struct device_node *ehrpwm_np;
+	const char *ehrpwm_compat = "ti,da850-ehrpwm";
+	void __iomem *cfg_chip1_base;
+
+	cfg_chip1_base = DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP1_REG);
+
 	of_platform_populate(NULL, of_default_bus_match_table,
 			     da850_auxdata_lookup, NULL);
 
 	da8xx_uart_clk_enable();
+
+	for_each_compatible_node(ehrpwm_np, NULL, ehrpwm_compat)
+		if (of_device_is_available(ehrpwm_np)) {
+			/* Enable TBCLK synchronization for EHRWPM modules */
+			writel(readl(cfg_chip1_base) | DA8XX_EHRPWM_TBCLKSYNC,
+					cfg_chip1_base);
+			break;
+		}
 }
 
 static const char *da850_boards_compat[] __initdata = {
diff --git a/arch/arm/mach-davinci/include/mach/da8xx.h b/arch/arm/mach-davinci/include/mach/da8xx.h
index de439b7..be77ce2 100644
--- a/arch/arm/mach-davinci/include/mach/da8xx.h
+++ b/arch/arm/mach-davinci/include/mach/da8xx.h
@@ -55,6 +55,7 @@ extern unsigned int da850_max_speed;
 #define DA8XX_SYSCFG0_VIRT(x)	(da8xx_syscfg0_base + (x))
 #define DA8XX_JTAG_ID_REG	0x18
 #define DA8XX_CFGCHIP0_REG	0x17c
+#define DA8XX_CFGCHIP1_REG	0x180
 #define DA8XX_CFGCHIP2_REG	0x184
 #define DA8XX_CFGCHIP3_REG	0x188
 
-- 
1.7.9.5

  parent reply	other threads:[~2013-03-14 10:37 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-14 10:37 [PATCH 0/3] Platform support for EHRPWM & ECAP devices in Davinci Philip Avinash
2013-03-14 10:37 ` [PATCH 1/3] arm: davinci: clock node support for ECAP & EHRPWM Philip Avinash
2013-03-14 12:36   ` Sekhar Nori
2013-03-14 10:37 ` Philip Avinash [this message]
2013-03-14 13:01   ` [PATCH 2/3] ARM: davinci: da850: Enable EHRPWM TBCLK from CFG_CHIP1 Sekhar Nori
2013-03-15  4:57     ` Philip, Avinash
2013-03-15  5:08       ` Sekhar Nori
2013-03-15  5:21         ` Philip, Avinash
2013-03-15  5:43           ` Sekhar Nori
2013-03-14 10:37 ` [PATCH 3/3] ARM: davinci: da850: add EHRPWM & ECAP DT node Philip Avinash
2013-03-14 15:49   ` Peter Korsgaard

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=1363257453-24747-3-git-send-email-avinashphilip@ti.com \
    --to=avinashphilip@ti.com \
    --cc=linux-arm-kernel@lists.infradead.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).