Skip to contentSkip to conversation

SDTI fixes

PATCH In review Jouni Hogander 2 participants 4 messages Jan 9, 2009

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

cover SDTI fixes

These patches fixes the problem with sdti-console, where it stops to work after PM is initialized.

arch/arm/mach-omap2/clockdomains.h |    6 +++-
arch/arm/mach-omap2/pm34xx.c       |   12 +++++++--
drivers/misc/sti/sdti.c            |   48 ++++++++++++++++++++++++++++---------
3 files changed, 52 insertions(+), 14 deletions(-)
#1 lore raw

PATCH 1/2 SDTI: Fix sdti to use right clocks from clockfw

SDTI uses pclk and pclkx2 instead of emu_per_alwon_ck. This patch fixes sdti to use those clocks.

---
 drivers/misc/sti/sdti.c |   47 +++++++++++++++++++++++++++++++++++++----------
 1 files changed, 37 insertions(+), 10 deletions(-)
drivers/misc/sti/sdti.c +37 -10
index 92ce57b..8c27504 100644
@@ -34,7 +34,7 @@
 #define SDTI_SYSCONFIG_SOFTRESET	(1 << 1)
 #define SDTI_SYSCONFIG_AUTOIDLE		(1 << 0)
 
-static struct clk *sdti_ck;
+static struct clk *sdti_fck, *sdti_ick;
 void __iomem *sti_base, *sti_channel_base;
 static DEFINE_SPINLOCK(sdti_lock);
 
@@ -70,14 +70,30 @@ static void omap_sdti_reset(void)
 static int __init omap_sdti_init(void)
 {
 	char buf[64];
-	int i;
+	int i, ret = 0;
 
-	sdti_ck = clk_get(NULL, "emu_per_alwon_ck");
-	if (IS_ERR(sdti_ck)) {
-		printk(KERN_ERR "Cannot get clk emu_per_alwon_ck\n");
-		return PTR_ERR(sdti_ck);
+	sdti_fck = clk_get(NULL, "pclk_fck");
+	if (IS_ERR(sdti_fck)) {
+		printk(KERN_ERR "Cannot get clk pclk_fck\n");
+		ret = PTR_ERR(sdti_fck);
+		goto err0;
+	}
+	sdti_ick = clk_get(NULL, "pclkx2_fck");
+	if (IS_ERR(sdti_ick)) {
+		printk(KERN_ERR "Cannot get clk pclkx2_fck\n");
+		ret = PTR_ERR(sdti_ick);
+		goto err1;
+	}
+	ret = clk_enable(sdti_fck);
+	if (ret) {
+		printk(KERN_ERR "Cannot enable sdti_fck\n");
+		goto err2;
+	}
+	ret = clk_enable(sdti_ick);
+	if (ret) {
+		printk(KERN_ERR "Cannot enable sdti_ick\n");
+		goto err3;
 	}
-	clk_enable(sdti_ck);
 
 	omap_sdti_reset();
 	sti_writel(0xC5ACCE55, SDTI_LOCK_ACCESS);
@@ -107,14 +123,25 @@ static int __init omap_sdti_init(void)
 	printk(KERN_INFO "%s", buf);
 	sti_channel_write_trace(strlen(buf), 0xc3, buf, 239);
 
-	return 0;
+	return ret;
+
+err3:
+	clk_disable(sdti_fck);
+err2:
+	clk_put(sdti_ick);
+err1:
+	clk_put(sdti_fck);
+err0:
+	return ret;
 }
 
 static void omap_sdti_exit(void)
 {
 	sti_writel(0, SDTI_WINCTRL);
-	clk_disable(sdti_ck);
-	clk_put(sdti_ck);
+	clk_disable(sdti_fck);
+	clk_disable(sdti_ick);
+	clk_put(sdti_fck);
+	clk_put(sdti_ick);
 }
 
 static int __devinit omap_sdti_probe(struct platform_device *pdev)
Signature · 1 line
1.6.0.1
#2 lore raw

PATCH 2/2 OMAP3: PM: Emu_pwrdm is switched off by hardware even when sdti is in use

In reply to Jouni Hogander

Using sdti doesn't keep emu_pwrdm on if hardware supervised pwrdm transitions are used. This causes sdti stop to work when power management is initialized and hardware supervised pwrdm control is enabled. This patch disables hardware supervised pwrdm control for emu_pwrdm. Now emu_pwrdm is switched off on boot by software when it is not used.

---
 arch/arm/mach-omap2/clockdomains.h |    6 +++++-
 arch/arm/mach-omap2/pm34xx.c       |   11 ++++++++++-
 2 files changed, 15 insertions(+), 2 deletions(-)
arch/arm/mach-omap2/clockdomains.h +5 -1
index bafa650..3d4eaca 100644
@@ -251,10 +251,14 @@ static struct clockdomain per_clkdm = {
 	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
 };
 
+/*
+ * Disable hw supervised mode for emu_clkdm, because emu_pwrdm is
+ * switched of even if sdti is in use
+ */
 static struct clockdomain emu_clkdm = {
 	.name		= "emu_clkdm",
 	.pwrdm		= { .name = "emu_pwrdm" },
-	.flags		= CLKDM_CAN_ENABLE_AUTO | CLKDM_CAN_SWSUP,
+	.flags		= /* CLKDM_CAN_ENABLE_AUTO |  */CLKDM_CAN_SWSUP,
 	.clktrctrl_mask = OMAP3430_CLKTRCTRL_EMU_MASK,
 	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
 };
arch/arm/mach-omap2/pm34xx.c +10 -1
index 1d54e96..43aac5f 100644
@@ -605,9 +605,18 @@ static int __init pwrdms_setup(struct powerdomain *pwrdm)
 	return set_pwrdm_state(pwrst->pwrdm, pwrst->next_state);
 }
 
+/*
+ * Enable hw supervised mode for all clockdomains if it's
+ * supported. Initiate sleep transition for other clockdomains, if
+ * they are not used
+ */
 static int __init clkdms_setup(struct clockdomain *clkdm)
 {
-	omap2_clkdm_allow_idle(clkdm);
+	if (clkdm->flags & CLKDM_CAN_ENABLE_AUTO)
+		omap2_clkdm_allow_idle(clkdm);
+	else if (clkdm->flags & CLKDM_CAN_FORCE_SLEEP &&
+		 atomic_read(&clkdm->usecount) == 0)
+		omap2_clkdm_sleep(clkdm);
 	return 0;
 }
 
Signature · 1 line
1.6.0.1
maintainer
#3 lore raw
In reply to Jouni Hogander
Quoted 2 lines · Jouni Hogander

These patches fixes the problem with sdti-console, where it stops to work after PM is initialized.

Pushing to l-o tree.

Tony

Quoted 8 lines
arch/arm/mach-omap2/clockdomains.h |    6 +++-
arch/arm/mach-omap2/pm34xx.c       |   12 +++++++--
drivers/misc/sti/sdti.c            |   48 ++++++++++++++++++++++++++++---------
3 files changed, 52 insertions(+), 14 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html