From: avinashphilip@ti.com (Philip Avinash)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 2/3] arm: davinci: clock node support for ECAP & EHRPWM
Date: Mon, 25 Mar 2013 13:19:48 +0530 [thread overview]
Message-ID: <1364197789-16783-3-git-send-email-avinashphilip@ti.com> (raw)
In-Reply-To: <1364197789-16783-1-git-send-email-avinashphilip@ti.com>
Add clock node support for ECAP and EHRPWM modules.
Also adds TBCLK for EHRWPM TBCLK to comply with pwm-tiehrpwm
driver.
Signed-off-by: Philip Avinash <avinashphilip@ti.com>
---
Changes Since v2:
- Add prefix of ehrpwm to tblck_enable and tblck_disable functions
- Make functions as static.
Changes Since v1:
- TBCLK make it as actual clock with enable/disable feature.
arch/arm/mach-davinci/da850.c | 46 ++++++++++++++++++++++++++++
arch/arm/mach-davinci/include/mach/da8xx.h | 1 +
2 files changed, 47 insertions(+)
diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c
index 0c4a26d..2a2f60c 100644
--- a/arch/arm/mach-davinci/da850.c
+++ b/arch/arm/mach-davinci/da850.c
@@ -383,6 +383,49 @@ static struct clk dsp_clk = {
.flags = PSC_LRST | PSC_FORCE,
};
+static struct clk ehrpwm_clk = {
+ .name = "ehrpwm",
+ .parent = &pll0_sysclk2,
+ .lpsc = DA8XX_LPSC1_PWM,
+ .gpsc = 1,
+ .flags = DA850_CLK_ASYNC3,
+};
+
+#define DA8XX_EHRPWM_TBCLKSYNC BIT(12)
+
+static void ehrpwm_tblck_enable(struct clk *clk)
+{
+ u32 val;
+
+ val = readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP1_REG));
+ val |= DA8XX_EHRPWM_TBCLKSYNC;
+ writel(val, DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP1_REG));
+}
+
+static void ehrpwm_tblck_disable(struct clk *clk)
+{
+ u32 val;
+
+ val = readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP1_REG));
+ val &= ~DA8XX_EHRPWM_TBCLKSYNC;
+ writel(val, DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP1_REG));
+}
+
+static struct clk ehrpwm_tbclk = {
+ .name = "ehrpwm_tbclk",
+ .parent = &ehrpwm_clk,
+ .clk_enable = ehrpwm_tblck_enable,
+ .clk_disable = ehrpwm_tblck_disable,
+};
+
+static struct clk ecap_clk = {
+ .name = "ecap",
+ .parent = &pll0_sysclk2,
+ .lpsc = DA8XX_LPSC1_ECAP,
+ .gpsc = 1,
+ .flags = DA850_CLK_ASYNC3,
+};
+
static struct clk_lookup da850_clks[] = {
CLK(NULL, "ref", &ref_clk),
CLK(NULL, "pll0", &pll0_clk),
@@ -430,6 +473,9 @@ static struct clk_lookup da850_clks[] = {
CLK("vpif", NULL, &vpif_clk),
CLK("ahci", NULL, &sata_clk),
CLK("davinci-rproc.0", NULL, &dsp_clk),
+ CLK("ehrpwm", "fck", &ehrpwm_clk),
+ CLK("ehrpwm", "tbclk", &ehrpwm_tbclk),
+ CLK("ecap", "fck", &ecap_clk),
CLK(NULL, NULL, NULL),
};
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
next prev parent reply other threads:[~2013-03-25 7:49 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-25 7:49 [PATCH v3 0/3] Platform support for EHRPWM & ECAP devices in DAVINCI Philip Avinash
2013-03-25 7:49 ` Philip Avinash [this message]
2013-04-02 8:16 ` [PATCH v3 2/3] arm: davinci: clock node support for ECAP & EHRPWM Sekhar Nori
2013-03-25 7:49 ` [PATCH v3 3/3] ARM: davinci: da850: add EHRPWM & ECAP DT node Philip Avinash
2013-04-02 8:33 ` Sekhar Nori
2013-04-08 9:09 ` Philip, Avinash
2013-04-08 13:09 ` Sekhar Nori
2013-04-09 8:42 ` Philip, Avinash
2013-04-09 11:35 ` Sekhar Nori
2013-04-10 5:30 ` Philip, Avinash
2013-04-10 5:55 ` Sekhar Nori
2013-04-10 6:07 ` Philip, Avinash
2013-03-25 8:14 ` [PATCH v3 0/3] Platform support for EHRPWM & ECAP devices in DAVINCI Sekhar Nori
2013-03-25 8:30 ` Philip, Avinash
2013-03-25 9:37 ` [PATCH v3 1/3] ARM: davinci: clk framework support for enable/disable functionality Philip Avinash
2013-04-01 11:35 ` Sekhar Nori
2013-04-03 3:58 ` Philip, Avinash
2013-04-02 8:35 ` [PATCH v3 0/3] Platform support for EHRPWM & ECAP devices in DAVINCI Sekhar Nori
2013-04-04 4:39 ` Philip, Avinash
2013-04-04 5:49 ` Sekhar Nori
2013-04-04 6:38 ` Philip, Avinash
2013-04-04 10:10 ` Philip, Avinash
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=1364197789-16783-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).