[PATCHv2] mfd: twl4030: Fix mismatch in mutex lock-unlock

2011-07-11 Thread Sanjeev Premi
A mutex is locked on entry into twl4030_madc_conversion().
Immediate return on some error conditions leaves the
mutex locked.

This patch ensures that mutex is always unlocked before
leaving the function.

Signed-off-by: Sanjeev Premi pr...@ti.com
Cc: Keerthy j-keer...@ti.com
Cc: Samuel Ortiz sa...@linux.intel.com
---

 Compile tested only.

 Changes since v1:
   None. Repost after adding Samuel Ortiz to cc: and
   removed lm-sensors list from to: list.

 drivers/mfd/twl4030-madc.c |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/mfd/twl4030-madc.c b/drivers/mfd/twl4030-madc.c
index 3941ddc..b5d598c 100644
--- a/drivers/mfd/twl4030-madc.c
+++ b/drivers/mfd/twl4030-madc.c
@@ -530,13 +530,13 @@ int twl4030_madc_conversion(struct twl4030_madc_request 
*req)
if (ret) {
dev_err(twl4030_madc-dev,
unable to write sel register 0x%X\n, method-sel + 1);
-   return ret;
+   goto out;
}
ret = twl_i2c_write_u8(TWL4030_MODULE_MADC, ch_lsb, method-sel);
if (ret) {
dev_err(twl4030_madc-dev,
unable to write sel register 0x%X\n, method-sel + 1);
-   return ret;
+   goto out;
}
/* Select averaging for all channels if do_avg is set */
if (req-do_avg) {
@@ -546,7 +546,7 @@ int twl4030_madc_conversion(struct twl4030_madc_request 
*req)
dev_err(twl4030_madc-dev,
unable to write avg register 0x%X\n,
method-avg + 1);
-   return ret;
+   goto out;
}
ret = twl_i2c_write_u8(TWL4030_MODULE_MADC,
   ch_lsb, method-avg);
@@ -554,7 +554,7 @@ int twl4030_madc_conversion(struct twl4030_madc_request 
*req)
dev_err(twl4030_madc-dev,
unable to write sel reg 0x%X\n,
method-sel + 1);
-   return ret;
+   goto out;
}
}
if (req-type == TWL4030_MADC_IRQ_ONESHOT  req-func_cb != NULL) {
-- 
1.7.2.2

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


[PATCH] mfd: twl4030: Fix mismatch in mutex lock-unlock

2011-07-08 Thread Sanjeev Premi
A mutex is locked on entry into twl4030_madc_conversion().
Immediate return on some error conditions leaves the
mutex locked.

This patch ensures that mutex is always unlocked before
leaving the function.

Signed-off-by: Sanjeev Premi pr...@ti.com
Cc: Keerthy j-keer...@ti.com
---

 Compile tested only.


 drivers/mfd/twl4030-madc.c |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/mfd/twl4030-madc.c b/drivers/mfd/twl4030-madc.c
index 3941ddc..b5d598c 100644
--- a/drivers/mfd/twl4030-madc.c
+++ b/drivers/mfd/twl4030-madc.c
@@ -530,13 +530,13 @@ int twl4030_madc_conversion(struct twl4030_madc_request 
*req)
if (ret) {
dev_err(twl4030_madc-dev,
unable to write sel register 0x%X\n, method-sel + 1);
-   return ret;
+   goto out;
}
ret = twl_i2c_write_u8(TWL4030_MODULE_MADC, ch_lsb, method-sel);
if (ret) {
dev_err(twl4030_madc-dev,
unable to write sel register 0x%X\n, method-sel + 1);
-   return ret;
+   goto out;
}
/* Select averaging for all channels if do_avg is set */
if (req-do_avg) {
@@ -546,7 +546,7 @@ int twl4030_madc_conversion(struct twl4030_madc_request 
*req)
dev_err(twl4030_madc-dev,
unable to write avg register 0x%X\n,
method-avg + 1);
-   return ret;
+   goto out;
}
ret = twl_i2c_write_u8(TWL4030_MODULE_MADC,
   ch_lsb, method-avg);
@@ -554,7 +554,7 @@ int twl4030_madc_conversion(struct twl4030_madc_request 
*req)
dev_err(twl4030_madc-dev,
unable to write sel reg 0x%X\n,
method-sel + 1);
-   return ret;
+   goto out;
}
}
if (req-type == TWL4030_MADC_IRQ_ONESHOT  req-func_cb != NULL) {
-- 
1.7.2.2

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


[PATCHv2] omap3: beagle: Use GPTIMER1 for clockevents

2011-06-27 Thread Sanjeev Premi
From: Hrishikesh Bhandiwad hrishikes...@ti.com

Present current selection of the GPTIMER on Beagleboard
was result of a hardware issue in early versions of the
Beagleboards (Ax and B1 thru B4). [1][2]

Its been long since the hardware issue has been fixed.
This patch uses GPTIMER 1 for all newer board revisions
incl. Beagleboard XM.

Also, the clock source for GPTIMER12 is much less frequency
stable than clock sources for GPTIMER1. Using GPTIMER12 can
result in major time skew over a fairly short interval.

 [1] http://thread.gmane.org/gmane.comp.hardware.beagleboard.general/91
 [2] Errata #7 at http://elinux.org/BeagleBoard#Errata

Signed-off-by: Sanjeev Premi pr...@ti.com
Reviewed-by: Paul Walmsley p...@pwsan.com
Cc: Hrishikesh Bhandiwad hrishikes...@ti.com
Cc: Thomas Weber we...@corscience.de
Cc: Jason Lam l...@ema-tech.com
Cc: Gregoire Gentil grego...@gentil.com
---

 Changes since v1:
   * Updated description with details from Paul Walmsley.
   * Changed author to Hrishikesh.
   * Expanded cc: to include original authors for other
 boards that are still using GPTIMER12.

 arch/arm/mach-omap2/board-omap3beagle.c |5 -
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-omap2/board-omap3beagle.c 
b/arch/arm/mach-omap2/board-omap3beagle.c
index 4b113b2..edc1596 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -509,7 +509,10 @@ static void __init omap3_beagle_init_irq(void)
 {
omap_init_irq();
 #ifdef CONFIG_OMAP_32K_TIMER
-   omap2_gp_clockevent_set_gptimer(12);
+   if (omap3_beagle_version == OMAP3BEAGLE_BOARD_AXBX)
+   omap2_gp_clockevent_set_gptimer(12);
+   else
+   omap2_gp_clockevent_set_gptimer(1);
 #endif
 }
 
-- 
1.7.2.2

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


[PATCH] omap3: beagle: Use GPTIMERi 1 for clockevents

2011-06-24 Thread Sanjeev Premi
The current selection of the GPTIMER on was result of
a hardware issue in early versions of the Beagleboards
(Ax and B1 thru B4). [1] [2]

Its been long since the hardware issue has been fixed.
This patch uses GPTIMER 1 for all newer board revisions
incl. Beagleboard XM.

 [1] http://thread.gmane.org/gmane.comp.hardware.beagleboard.general/91
 [2] Errata #7 at http://elinux.org/BeagleBoard#Errata

Signed-off-by: Sanjeev Premi pr...@ti.com
Cc: Paul Walmsley p...@pwsan.com
---

  * The patch has been boot tested with Beagleboard-XM.
Verified that GPTIMER1 is indeed being used.

  * Browsing through the code, it appears that similar
change could be applied for these boards:
 - devkit8000
 - omap3stalker
 - omap3touchbook
However, I don't have access to any of these;
or information on their revisions.
I can update this patch based on confirmations.

 arch/arm/mach-omap2/board-omap3beagle.c |5 -
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-omap2/board-omap3beagle.c 
b/arch/arm/mach-omap2/board-omap3beagle.c
index 4b113b2..edc1596 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -509,7 +509,10 @@ static void __init omap3_beagle_init_irq(void)
 {
omap_init_irq();
 #ifdef CONFIG_OMAP_32K_TIMER
-   omap2_gp_clockevent_set_gptimer(12);
+   if (omap3_beagle_version == OMAP3BEAGLE_BOARD_AXBX)
+   omap2_gp_clockevent_set_gptimer(12);
+   else
+   omap2_gp_clockevent_set_gptimer(1);
 #endif
 }
 
-- 
1.7.2.2

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


[PATCH 0/2] omap2+: pm: Fix code syntax and BogoMIPS

2011-06-24 Thread Sanjeev Premi
Current implementation was using goto to get to a basic
if..else structure - but wasn't too obvious on first few
reads.

Once the code was restructured, the relation between the
calls to cpufreq_scale() and cpufreq_notify_transition()
became obvious. And small trip to drivers/cpufreq/cpufreq.c
revealed double adjustment of the jiffies.

Though the patches may seem unrelated, but as described here
first led to second. Hence, submitting them together.

The BogoMIPS calculation has been tested on OMAP3EVM.

Before
==

[root@OMAP3EVM cpufreq]# cat scaling_available_frequencies
30 60 80 100
[root@OMAP3EVM cpufreq]# cat /proc/cpuinfo
Processor   : ARMv7 Processor rev 2 (v7l)
BogoMIPS: 298.32
Features: swp half thumb fastmult vfp edsp thumbee neon vfpv3
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x3
CPU part: 0xc08
CPU revision: 2

Hardware: OMAP3 EVM
Revision: 0020
Serial  : 
[root@OMAP3EVM cpufreq]#
[root@OMAP3EVM cpufreq]#
[root@OMAP3EVM cpufreq]# echo 80  scaling_setspeed
[root@OMAP3EVM cpufreq]#
[root@OMAP3EVM cpufreq]#
[root@OMAP3EVM cpufreq]# cat /proc/cpuinfo
Processor   : ARMv7 Processor rev 2 (v7l)
BogoMIPS: 2125.51
Features: swp half thumb fastmult vfp edsp thumbee neon vfpv3
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x3
CPU part: 0xc08
CPU revision: 2

Hardware: OMAP3 EVM
Revision: 0020
Serial  : 
[root@OMAP3EVM cpufreq]#

After
=

[root@OMAP3EVM cpufreq]# cat scaling_available_frequencies
30 60 80 100
[root@OMAP3EVM cpufreq]# cat /proc/cpuinfo
Processor   : ARMv7 Processor rev 2 (v7l)
BogoMIPS: 597.64
Features: swp half thumb fastmult vfp edsp thumbee neon vfpv3
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x3
CPU part: 0xc08
CPU revision: 2

Hardware: OMAP3 EVM
Revision: 0020
Serial  : 
[root@OMAP3EVM cpufreq]# echo 30  scaling_setspeed
[root@OMAP3EVM cpufreq]# cat /proc/cpuinfo
Processor   : ARMv7 Processor rev 2 (v7l)
BogoMIPS: 298.32
Features: swp half thumb fastmult vfp edsp thumbee neon vfpv3
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x3
CPU part: 0xc08
CPU revision: 2

Hardware: OMAP3 EVM
Revision: 0020
Serial  : 
[root@OMAP3EVM cpufreq]# echo 60  scaling_setspeed
[root@OMAP3EVM cpufreq]# cat /proc/cpuinfo
Processor   : ARMv7 Processor rev 2 (v7l)
BogoMIPS: 597.64
Features: swp half thumb fastmult vfp edsp thumbee neon vfpv3
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x3
CPU part: 0xc08
CPU revision: 2

Hardware: OMAP3 EVM
Revision: 0020
Serial  : 
[root@OMAP3EVM cpufreq]# echo 80  scaling_setspeed
[root@OMAP3EVM cpufreq]# cat /proc/cpuinfo
Processor   : ARMv7 Processor rev 2 (v7l)
BogoMIPS: 796.19
Features: swp half thumb fastmult vfp edsp thumbee neon vfpv3
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x3
CPU part: 0xc08
CPU revision: 2

Hardware: OMAP3 EVM
Revision: 0020
Serial  : 
[root@OMAP3EVM cpufreq]#

PS: 800MHz and 1GHZ were enabled via out of tree patch - to be submitted soon.


I don't have an OMAP4 board handy. Confirmation that BogoMIPS
calculations are right on the platform will help.

The patchset applied on the 
40d1020 : rebuild PM from branches

Sanjeev Premi (2):
  omap2+: pm: Use if...else instead of goto
  omap2+: pm: cpufreq: Fix loops_per_jiffy calculation

 arch/arm/mach-omap2/omap2plus-cpufreq.c |   51 --
 1 files changed, 14 insertions(+), 37 deletions(-)

-- 
1.7.2.2

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


[PATCHv2] omap2+: pm: cpufreq: Fix loops_per_jiffy calculation

2011-06-24 Thread Sanjeev Premi
Currently, loops_per_jiffy is being calculated twice for
non-SMP processors.
 - Before calling cpufreq_notify_transition()
 - From within cpufreq_notify_transition()

Double adjustment leads to incorrect value being assigned to
loops_per_jiffy. This manifests as incorrect BogoMIPS in
cat /proc/cpuinfo.

The value of loops_per_jiffy needs to be calculated only
when CONFIG_SMP is true. It is the core change included
in this patch.

The patch also leverages the definition of for_each_cpu()
with and without CONFIG_SMP to consolidate the mechanism
to call cpufreq_notify_transition().

Signed-off-by: Sanjeev Premi pr...@ti.com
---
 Changes since v1:
   * loops_per_jiffy are updated when CONFIG_SMP is true.
   * leverage definition of for_each_cpu()

 Tested on OMAP3EVM with and without CONFIG_SMP.
 Since the log is rather long, will be posting the log in
 a follow-up mail.

 arch/arm/mach-omap2/omap2plus-cpufreq.c |   27 +++
 1 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/arch/arm/mach-omap2/omap2plus-cpufreq.c 
b/arch/arm/mach-omap2/omap2plus-cpufreq.c
index 346519e..0263cae 100644
--- a/arch/arm/mach-omap2/omap2plus-cpufreq.c
+++ b/arch/arm/mach-omap2/omap2plus-cpufreq.c
@@ -97,12 +97,8 @@ static int omap_target(struct cpufreq_policy *policy,
return ret;

/* Notify transitions */
-   if (is_smp()) {
-   for_each_cpu(i, policy-cpus) {
-   freqs.cpu = i;
-   cpufreq_notify_transition(freqs, CPUFREQ_PRECHANGE);
-   }
-   } else {
+   for_each_cpu(i, policy-cpus) {
+   freqs.cpu = i;
cpufreq_notify_transition(freqs, CPUFREQ_PRECHANGE);
}

@@ -114,13 +110,20 @@ static int omap_target(struct cpufreq_policy *policy,

freqs.new = omap_getspeed(policy-cpu);

+#ifdef CONFIG_SMP
+   /* Adjust jiffies before transition */
+   for_each_cpu(i, policy-cpus) {
+   unsigned long lpj = per_cpu(cpu_data, i).loops_per_jiffy;
+
+   per_cpu(cpu_data, i).loops_per_jiffy = cpufreq_scale(lpj,
+   freqs.old,
+   freqs.new);
+   }
+#endif
+
/* Notify transitions */
-   if (is_smp()) {
-   for_each_cpu(i, policy-cpus) {
-   freqs.cpu = i;
-   cpufreq_notify_transition(freqs, CPUFREQ_POSTCHANGE);
-   }
-   } else {
+   for_each_cpu(i, policy-cpus) {
+   freqs.cpu = i;
cpufreq_notify_transition(freqs, CPUFREQ_POSTCHANGE);
}

--
1.7.2.2

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


[RFC] omap3: pm: Downgrade WARN for no wakeup source

2011-06-08 Thread Sanjeev Premi
When multiple wakeup sources are defined in a system,
there is a small window, when more than one source
can trigger wakeup interrupt.

In the current implementation, the do-while() loop
can handle all wakeup sources that are recorded when
probing the status register in prcm_interrupt_handler().

When the ISR executes due to next queued wakeup, it
there is nothing to be handled and value of c is 0.

The comment in the code, attributing this behavior to
race with IVA2 along with WARN (and associated text)
makes this condition appear as an error condition -
while it isn't.

Though the problem was found in kernel version 2.6.32
running on AM3703 (no IVA2), it is still relevant.

This patch also fixes the comment that attributes current
behavior to race with interrupt handler on IVA2.

Signed-off-by: Sanjeev Premi pr...@ti.com
---
Quoting specific instances, on entry into the ISR, the
PM_WKST_WKUP read either 0x00010101 or 0x00010001

Where,
 Bit 0  : ST_GPT1 - GPTIMER wakeup occurred
 Bit 8  : ST_IO_EN- IO pad wakeup occurred
 Bit 16 : ST_IO_CHAIN - The I/O wake-up scheme is enabled

This time value of c is 2 (or 3), but then on next
and immediate entry, value of c is 0 leading to WARN().

Another approach I considered was to keep track of the
number of wakeup sources handled in previous execution
of ISR, but it fails when status register indicates 3
wakeup sources.

Downgrading the WARN seemed to be the simplest solution.

 arch/arm/mach-omap2/pm34xx.c |9 +
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index c155c9d..d24942b 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -289,11 +289,12 @@ static irqreturn_t prcm_interrupt_handler (int irq, void 
*dev_id)
c = _prcm_int_handle_wakeup();
 
/*
-* Is the MPU PRCM interrupt handler racing with the
-* IVA2 PRCM interrupt handler ?
+* If multiple wakeup events get handled in certain
+* execution through this do-while, value of c will
+* be returned as 0.
 */
-   WARN(c == 0, prcm: WARNING: PRCM indicated MPU wakeup 
-but no wakeup sources are marked\n);
+   if (c == 0)
+   pr_debug (prcm: no more wakeup event to 
handle) ;
} else {
/* XXX we need to expand our PRCM interrupt handler */
WARN(1, prcm: WARNING: PRCM interrupt received, but 
-- 
1.7.2.2

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


[PATCH] OMAP3: pm: Boot message is not an error, remove it

2011-05-18 Thread Sanjeev Premi
It shows up on the console despite using silent
in the bootargs.

Signed-off-by: Sanjeev Premi pr...@ti.com
Cc: jhnik...@gmail.com
---

 v2: Changed the subject.
 Removed the print altogether

 v1: Convert printk to pr_info

 arch/arm/mach-omap2/pm34xx.c |2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index 343027f..ba6c524 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -901,8 +901,6 @@ static int __init omap3_pm_init(void)
 
pm_errata_configure();
 
-   printk(KERN_ERR Power Management for TI OMAP3.\n);
-
/* XXX prcm_setup_regs needs to be before enabling hw
 * supervised mode for powerdomains */
prcm_setup_regs();
-- 
1.7.2.2

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


[PATCH] omap3: boot message is not an error

2011-05-17 Thread Sanjeev Premi
With current level, it shows up on the console
despite using 'silent' in bootargs.

Signed-off-by: Sanjeev Premi pr...@ti.com
---

 1) Couldn't find better text on commit message.
Any suggestions?

 2) Though pm34xx.x is changed, the change itself
is no related to power management. Hence, did
annotate pm:

 arch/arm/mach-omap2/pm34xx.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index 343027f..7584ba8 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -901,7 +901,7 @@ static int __init omap3_pm_init(void)
 
pm_errata_configure();
 
-   printk(KERN_ERR Power Management for TI OMAP3.\n);
+   pr_info (Power Management for TI OMAP3.\n);
 
/* XXX prcm_setup_regs needs to be before enabling hw
 * supervised mode for powerdomains */
-- 
1.7.2.2

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


[PATCH] omap:pm: Fix boot-time errors with debugfs disabled

2011-05-12 Thread Sanjeev Premi
There is an implicit assumption in current implementation that
debugfs is always enabled.

When debugfs is disabled, these errors are noticed during boot:
  omap_voltage_late_init: Unable to create voltage debugfs main dir
  vdd_debugfs_init: Unable to create debugfs directory for vdd_mpu
  vdd_debugfs_init: Unable to create debugfs directory for vdd_core

This patch fixes these errors by enclosing code related to debugfs
in #ifdef CONFIG_DEBUG_FS..#endif.

Boot tested on OMAP3EVM.

Signed-off-by: Sanjeev Premi pr...@ti.com
---
 Patch was created and tested on the pm branch at commit:
   d695569 : rebuild PM from branches

 I am still finding my way around new code sructure. Haven't
 been able to verify if smartreflex and voltage layer are
 properly initialized. Though I do understand that smartreflex
 won't work without debugfs.

 arch/arm/mach-omap2/smartreflex.c |   15 +++
 arch/arm/mach-omap2/voltage.c |8 
 2 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/smartreflex.c 
b/arch/arm/mach-omap2/smartreflex.c
index 2ce2fb7..b757632 100644
--- a/arch/arm/mach-omap2/smartreflex.c
+++ b/arch/arm/mach-omap2/smartreflex.c
@@ -54,7 +54,9 @@ struct omap_sr {
struct list_headnode;
struct omap_sr_nvalue_table *nvalue_table;
struct voltagedomain*voltdm;
+#ifdef CONFIG_DEBUG_FS
struct dentry   *dbg_dir;
+#endif
 };
 
 /* sr_list contains all the instances of smartreflex module */
@@ -826,7 +828,9 @@ static int __init omap_sr_probe(struct platform_device 
*pdev)
struct omap_sr *sr_info = kzalloc(sizeof(struct omap_sr), GFP_KERNEL);
struct omap_sr_data *pdata = pdev-dev.platform_data;
struct resource *mem, *irq;
+#ifdef CONFIG_DEBUG_FS
struct dentry *vdd_dbg_dir, *nvalue_dir;
+#endif
struct omap_volt_data *volt_data;
int i, ret = 0;
 
@@ -903,6 +907,7 @@ static int __init omap_sr_probe(struct platform_device 
*pdev)
 * If the voltage domain debugfs directory is not created, do
 * not try to create rest of the debugfs entries.
 */
+#ifdef CONFIG_DEBUG_FS
vdd_dbg_dir = omap_voltage_get_dbgdir(sr_info-voltdm);
if (!vdd_dbg_dir) {
ret = -EINVAL;
@@ -952,14 +957,22 @@ static int __init omap_sr_probe(struct platform_device 
*pdev)
(void) debugfs_create_x32(name, S_IRUGO | S_IWUSR, nvalue_dir,
(sr_info-nvalue_table[i].nvalue));
}
+#else
+   omap_voltage_get_volttable(sr_info-voltdm, volt_data);
+   if (!volt_data) {
+   ret = -ENODATA;
+   }
+#endif /* CONFIG_DEBUG_FS */
 
return ret;
 
+#ifdef CONFIG_DEBUG_FS
 err_debugfs:
debugfs_remove_recursive(sr_info-dbg_dir);
 err_iounmap:
list_del(sr_info-node);
iounmap(sr_info-base);
+#endif
 err_release_region:
release_mem_region(mem-start, resource_size(mem));
 err_free_devinfo:
@@ -988,8 +1001,10 @@ static int __devexit omap_sr_remove(struct 
platform_device *pdev)
 
if (sr_info-autocomp_active)
sr_stop_vddautocomp(sr_info);
+#ifdef CONFIG_DEBUG_FS
if (sr_info-dbg_dir)
debugfs_remove_recursive(sr_info-dbg_dir);
+#endif
 
list_del(sr_info-node);
iounmap(sr_info-base);
diff --git a/arch/arm/mach-omap2/voltage.c b/arch/arm/mach-omap2/voltage.c
index 9ef3789..6153211 100644
--- a/arch/arm/mach-omap2/voltage.c
+++ b/arch/arm/mach-omap2/voltage.c
@@ -250,6 +250,7 @@ static void __init vp_init(struct omap_vdd_info *vdd)
vdd-write_reg(vp_val, prm_mod_offs, vdd-vp_data-vlimitto);
 }
 
+#ifdef CONFIG_DEBUG_FS
 static void __init vdd_debugfs_init(struct omap_vdd_info *vdd)
 {
char *name;
@@ -297,6 +298,7 @@ static void __init vdd_debugfs_init(struct omap_vdd_info 
*vdd)
vdd-debug_dir, (void *) vdd,
nom_volt_debug_fops);
 }
+#endif
 
 /* Voltage scale and accessory APIs */
 static int _pre_volt_scale(struct omap_vdd_info *vdd,
@@ -980,6 +982,7 @@ int omap_voltage_register_pmic(struct voltagedomain *voltdm,
  * add any debug entry for a particular voltage domain. Returns NULL
  * in case of error.
  */
+#ifdef CONFIG_DEBUG_FS
 struct dentry *omap_voltage_get_dbgdir(struct voltagedomain *voltdm)
 {
struct omap_vdd_info *vdd;
@@ -993,6 +996,7 @@ struct dentry *omap_voltage_get_dbgdir(struct voltagedomain 
*voltdm)
 
return vdd-debug_dir;
 }
+#endif
 
 /**
  * omap_change_voltscale_method() - API to change the voltage scaling method.
@@ -1078,16 +1082,20 @@ int __init omap_voltage_late_init(void)
return -EINVAL;
}
 
+#ifdef CONFIG_DEBUG_FS
voltage_dir = debugfs_create_dir(voltage, NULL);
if (IS_ERR(voltage_dir))
pr_err(%s: Unable to create voltage debugfs main dir\n,
__func__);
+#endif
for (i

[PATCH] ASoC: omap-mcbsp: Remove restrictive checks for cpu type

2011-05-11 Thread Sanjeev Premi
Current checks for cpu type were too restrictive leading
to failures for other silicons in same family.

The problem was found while testing audio playback on
AM37x and AM35x processors. But should exist on OMAP36xx
as well.

Signed-off-by: Sanjeev Premi pr...@ti.com
cc: Mark Brown broo...@opensource.wolfsonmicro.com
cc: Liam Girdwood l...@ti.com
cc: Jarkko Nikula jhnik...@gmail.com
---

 Changes in v4:
   Reposting after validating that patch still applies cleanly on
   linux-omap master [46966f1]

   Changed the subject as suggested by Jarkko. Since the subject
   has changed, i have omitted v4.

 Changes in v3::
   None. Reposting[1] after subscribing to alsa-devel list

 Changes in v2:
   1) Added one more check to the changes.
   2) Updated commit message to use plurals.


 [1] http://marc.info/?l=linux-omapm=130026430110592w=2


 sound/soc/omap/omap-mcbsp.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c
index 2175f09..a88a0bf 100644
--- a/sound/soc/omap/omap-mcbsp.c
+++ b/sound/soc/omap/omap-mcbsp.c
@@ -146,7 +146,7 @@ static int omap_mcbsp_dai_startup(struct snd_pcm_substream 
*substream,
 * 2 channels (stereo): size is 128 / 2 = 64 frames (2 * 64 words)
 * 4 channels: size is 128 / 4 = 32 frames (4 * 32 words)
 */
-   if (cpu_is_omap343x() || cpu_is_omap44xx()) {
+   if (cpu_is_omap34xx() || cpu_is_omap44xx()) {
/*
* Rule for the buffer size. We should not allow
* smaller buffer than the FIFO size to avoid underruns
@@ -258,7 +258,7 @@ static int omap_mcbsp_dai_hw_params(struct 
snd_pcm_substream *substream,
default:
return -EINVAL;
}
-   if (cpu_is_omap343x()) {
+   if (cpu_is_omap34xx()) {
dma_data-set_threshold = omap_mcbsp_set_threshold;
/* TODO: Currently, MODE_ELEMENT == MODE_FRAME */
if (omap_mcbsp_get_dma_op_mode(bus_id) ==
-- 
1.7.2.2

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


[PATCHv3] omap3: alsa-soc: Remove restrictive checks for cpu type

2011-04-12 Thread Sanjeev Premi
Current checks for cpu type were too restrictive leading
to failures for other silicons in same family.

The problem was found while testing audio playback on
AM37x and AM35x processors. But should exist on OMAP36xx
as well.

Signed-off-by: Sanjeev Premi pr...@ti.com
---
 Changes in v3::
   None. Reposting[1] after subscribing to alsa-devel list

 Changes in v2:
   1) Added one more check to the changes.
   2) Updated commit message to use plurals.


 [1] http://marc.info/?l=linux-omapm=130026430110592w=2

 sound/soc/omap/omap-mcbsp.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c
index 2175f09..a88a0bf 100644
--- a/sound/soc/omap/omap-mcbsp.c
+++ b/sound/soc/omap/omap-mcbsp.c
@@ -146,7 +146,7 @@ static int omap_mcbsp_dai_startup(struct snd_pcm_substream 
*substream,
 * 2 channels (stereo): size is 128 / 2 = 64 frames (2 * 64 words)
 * 4 channels: size is 128 / 4 = 32 frames (4 * 32 words)
 */
-   if (cpu_is_omap343x() || cpu_is_omap44xx()) {
+   if (cpu_is_omap34xx() || cpu_is_omap44xx()) {
/*
* Rule for the buffer size. We should not allow
* smaller buffer than the FIFO size to avoid underruns
@@ -258,7 +258,7 @@ static int omap_mcbsp_dai_hw_params(struct 
snd_pcm_substream *substream,
default:
return -EINVAL;
}
-   if (cpu_is_omap343x()) {
+   if (cpu_is_omap34xx()) {
dma_data-set_threshold = omap_mcbsp_set_threshold;
/* TODO: Currently, MODE_ELEMENT == MODE_FRAME */
if (omap_mcbsp_get_dma_op_mode(bus_id) ==
-- 
1.7.2.2

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


[PATCH 1/2] omap3: voltage: remove unnecessary param passing

2011-03-17 Thread Sanjeev Premi
It is not necessary to pass the params prm_mod and
prm_irqst_mod to omap_voltage_early_init().

Signed-off-by: Sanjeev Premi pr...@ti.com
---
 arch/arm/mach-omap2/voltage.c |   18 ++
 arch/arm/mach-omap2/voltage.h |3 +--
 arch/arm/mach-omap2/voltagedomains3xxx_data.c |5 +
 arch/arm/mach-omap2/voltagedomains44xx_data.c |6 +-
 4 files changed, 17 insertions(+), 15 deletions(-)

diff --git a/arch/arm/mach-omap2/voltage.c b/arch/arm/mach-omap2/voltage.c
index c6facf7..ce3098a 100644
--- a/arch/arm/mach-omap2/voltage.c
+++ b/arch/arm/mach-omap2/voltage.c
@@ -1096,12 +1096,22 @@ int __init omap_voltage_late_init(void)
 }
 
 /* XXX document */
-int __init omap_voltage_early_init(s16 prm_mod, s16 prm_irqst_ocp_mod,
-  struct omap_vdd_info *omap_vdd_array[],
+int __init omap_voltage_early_init(struct omap_vdd_info *omap_vdd_array[],
   u8 omap_vdd_count)
 {
-   prm_mod_offs = prm_mod;
-   prm_irqst_ocp_mod_offs = prm_irqst_ocp_mod;
+   if (cpu_is_omap44xx()) {
+   prm_mod_offs = OMAP4430_PRM_DEVICE_INST;
+   prm_irqst_ocp_mod_offs = OMAP4430_PRM_OCP_SOCKET_INST;
+   } else if (cpu_is_omap34xx()) {
+   prm_mod_offs = OMAP3430_GR_MOD;
+   prm_irqst_ocp_mod_offs = OCP_MOD;
+   } else {
+   /* TODO:
+* What should be done for OMAP24xx?
+* Would we even reach here?
+*/
+   }
+
vdd_info = omap_vdd_array;
nr_scalable_vdd = omap_vdd_count;
return 0;
diff --git a/arch/arm/mach-omap2/voltage.h b/arch/arm/mach-omap2/voltage.h
index e9f5408..b56530e 100644
--- a/arch/arm/mach-omap2/voltage.h
+++ b/arch/arm/mach-omap2/voltage.h
@@ -151,8 +151,7 @@ struct omap_volt_data *omap_voltage_get_voltdata(struct 
voltagedomain *voltdm,
unsigned long volt);
 unsigned long omap_voltage_get_nom_volt(struct voltagedomain *voltdm);
 struct dentry *omap_voltage_get_dbgdir(struct voltagedomain *voltdm);
-int __init omap_voltage_early_init(s16 prm_mod, s16 prm_irqst_mod,
-  struct omap_vdd_info *omap_vdd_array[],
+int __init omap_voltage_early_init(struct omap_vdd_info *omap_vdd_array[],
   u8 omap_vdd_count);
 #ifdef CONFIG_PM
 int omap_voltage_register_pmic(struct voltagedomain *voltdm,
diff --git a/arch/arm/mach-omap2/voltagedomains3xxx_data.c 
b/arch/arm/mach-omap2/voltagedomains3xxx_data.c
index def230f..6f6999d 100644
--- a/arch/arm/mach-omap2/voltagedomains3xxx_data.c
+++ b/arch/arm/mach-omap2/voltagedomains3xxx_data.c
@@ -70,8 +70,6 @@ static struct omap_vdd_info *omap3_vdd_info[] = {
 /* OMAP3 specific voltage init functions */
 static int __init omap3xxx_voltage_early_init(void)
 {
-   s16 prm_mod = OMAP3430_GR_MOD;
-   s16 prm_irqst_ocp_mod = OCP_MOD;
 
if (!cpu_is_omap34xx())
return 0;
@@ -88,8 +86,7 @@ static int __init omap3xxx_voltage_early_init(void)
omap3_vdd2_info.volt_data = omap34xx_vddcore_volt_data;
}
 
-   return omap_voltage_early_init(prm_mod, prm_irqst_ocp_mod,
-  omap3_vdd_info,
+   return omap_voltage_early_init(omap3_vdd_info,
   ARRAY_SIZE(omap3_vdd_info));
 };
 core_initcall(omap3xxx_voltage_early_init);
diff --git a/arch/arm/mach-omap2/voltagedomains44xx_data.c 
b/arch/arm/mach-omap2/voltagedomains44xx_data.c
index cb64996..208a67d 100644
--- a/arch/arm/mach-omap2/voltagedomains44xx_data.c
+++ b/arch/arm/mach-omap2/voltagedomains44xx_data.c
@@ -81,9 +81,6 @@ static struct omap_vdd_info *omap4_vdd_info[] = {
 /* OMAP4 specific voltage init functions */
 static int __init omap44xx_voltage_early_init(void)
 {
-   s16 prm_mod = OMAP4430_PRM_DEVICE_INST;
-   s16 prm_irqst_ocp_mod = OMAP4430_PRM_OCP_SOCKET_INST;
-
if (!cpu_is_omap44xx())
return 0;
 
@@ -95,8 +92,7 @@ static int __init omap44xx_voltage_early_init(void)
omap4_vdd_iva_info.volt_data = omap44xx_vdd_iva_volt_data;
omap4_vdd_core_info.volt_data = omap44xx_vdd_core_volt_data;
 
-   return omap_voltage_early_init(prm_mod, prm_irqst_ocp_mod,
-  omap4_vdd_info,
+   return omap_voltage_early_init(omap4_vdd_info,
   ARRAY_SIZE(omap4_vdd_info));
 };
 core_initcall(omap44xx_voltage_early_init);
-- 
1.7.2.2

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


[PATCH 2/2] omap3: voltage: fix variable type and name

2011-03-17 Thread Sanjeev Premi
In all usages, variables prm_mod_offs and prm_irqst_ocp_mod_offs
are expected to be u16 but have been declared as s16.

In addition, renamed prm_irqst_ocp_mod_offs to ocp_sysreg_prm_offs
for better association with the TRM. Original name perhaps came
from the current usage of this offset to reach PRM_IRQSTATUS_MPU
offset.

Signed-off-by: Sanjeev Premi pr...@ti.com
---
 arch/arm/mach-omap2/voltage.c |   18 +-
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/arch/arm/mach-omap2/voltage.c b/arch/arm/mach-omap2/voltage.c
index ce3098a..c686eca 100644
--- a/arch/arm/mach-omap2/voltage.c
+++ b/arch/arm/mach-omap2/voltage.c
@@ -51,8 +51,8 @@ static struct omap_vdd_info **vdd_info;
 static int nr_scalable_vdd;
 
 /* XXX document */
-static s16 prm_mod_offs;
-static s16 prm_irqst_ocp_mod_offs;
+static u16 prm_mod_offs;
+static u16 ocp_sysreg_prm_offs;
 
 static struct dentry *voltage_dir;
 
@@ -447,8 +447,8 @@ static int vp_forceupdate_scale_voltage(struct 
omap_vdd_info *vdd,
 */
while (timeout++  VP_TRANXDONE_TIMEOUT) {
vdd-write_reg(vdd-vp_data-prm_irqst_data-tranxdone_status,
-  prm_irqst_ocp_mod_offs, prm_irqst_reg);
-   if (!(vdd-read_reg(prm_irqst_ocp_mod_offs, prm_irqst_reg) 
+  ocp_sysreg_prm_offs, prm_irqst_reg);
+   if (!(vdd-read_reg(ocp_sysreg_prm_offs, prm_irqst_reg) 
  vdd-vp_data-prm_irqst_data-tranxdone_status))
break;
udelay(1);
@@ -481,7 +481,7 @@ static int vp_forceupdate_scale_voltage(struct 
omap_vdd_info *vdd,
 * Depends on SMPSWAITTIMEMIN/MAX and voltage change
 */
timeout = 0;
-   omap_test_timeout((vdd-read_reg(prm_irqst_ocp_mod_offs, prm_irqst_reg) 

+   omap_test_timeout((vdd-read_reg(ocp_sysreg_prm_offs, prm_irqst_reg) 
   vdd-vp_data-prm_irqst_data-tranxdone_status),
  VP_TRANXDONE_TIMEOUT, timeout);
if (timeout = VP_TRANXDONE_TIMEOUT)
@@ -498,8 +498,8 @@ static int vp_forceupdate_scale_voltage(struct 
omap_vdd_info *vdd,
timeout = 0;
while (timeout++  VP_TRANXDONE_TIMEOUT) {
vdd-write_reg(vdd-vp_data-prm_irqst_data-tranxdone_status,
-  prm_irqst_ocp_mod_offs, prm_irqst_reg);
-   if (!(vdd-read_reg(prm_irqst_ocp_mod_offs, prm_irqst_reg) 
+  ocp_sysreg_prm_offs, prm_irqst_reg);
+   if (!(vdd-read_reg(ocp_sysreg_prm_offs, prm_irqst_reg) 
  vdd-vp_data-prm_irqst_data-tranxdone_status))
break;
udelay(1);
@@ -1101,10 +1101,10 @@ int __init omap_voltage_early_init(struct omap_vdd_info 
*omap_vdd_array[],
 {
if (cpu_is_omap44xx()) {
prm_mod_offs = OMAP4430_PRM_DEVICE_INST;
-   prm_irqst_ocp_mod_offs = OMAP4430_PRM_OCP_SOCKET_INST;
+   ocp_sysreg_prm_offs = OMAP4430_PRM_OCP_SOCKET_INST;
} else if (cpu_is_omap34xx()) {
prm_mod_offs = OMAP3430_GR_MOD;
-   prm_irqst_ocp_mod_offs = OCP_MOD;
+   ocp_sysreg_prm_offs = OCP_MOD;
} else {
/* TODO:
 * What should be done for OMAP24xx?
-- 
1.7.2.2

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


[RFCv2 0/2] Support TPS65023 with AM35x

2011-03-16 Thread Sanjeev Premi
This is a revised set of patches for getting the
current AM3517 with TPS65023 working.

The patch may not apply cleanly on the latest
master; but should be able to give clear list
of changes (and hacks) that were necessary to
make the combination work.

Since, there is a parallel effort for clean-up
of voltage layer, attempt to rebase against new
baseline would only delay the intended feedback.

Sanjeev Premi (2):
  OMAP3: Add support for TPS65023 (AM35x only)
  AM35x: voltage: Basic initialization

 arch/arm/mach-omap2/Makefile|3 +-
 arch/arm/mach-omap2/pm.c|1 +
 arch/arm/mach-omap2/pm.h|9 +++
 arch/arm/mach-omap2/pmic_tps65023.c |   82 ++
 arch/arm/mach-omap2/voltage.c   |  110 ++-
 5 files changed, 203 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/mach-omap2/pmic_tps65023.c

-- 
1.7.2.2

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


[RFCv2 1/2] OMAP3: Add support for TPS65023 (AM35x only)

2011-03-16 Thread Sanjeev Premi
This patch adds support for TPS65023 used with
OMAP3 devices. The PMIC is currently hooked to
AM35x devices, but can easily be extended for
other OMAP3 devices.

Signed-off-by: Sanjeev Premi pr...@ti.com
---
 arch/arm/mach-omap2/Makefile|3 +-
 arch/arm/mach-omap2/pm.c|1 +
 arch/arm/mach-omap2/pm.h|9 
 arch/arm/mach-omap2/pmic_tps65023.c |   82 +++
 4 files changed, 94 insertions(+), 1 deletions(-)
 create mode 100644 arch/arm/mach-omap2/pmic_tps65023.c

diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index ac2155d..33d7bc2 100755
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -19,7 +19,8 @@ obj-$(CONFIG_ARCH_TI81XX) += $(omap-2-3-common) 
$(hwmod-common)
 
 obj-$(CONFIG_OMAP_MCBSP) += mcbsp.o
 
-obj-$(CONFIG_TWL4030_CORE) += omap_twl.o
+obj-$(CONFIG_TWL4030_CORE) += omap_twl.o
+obj-$(CONFIG_REGULATOR_TPS65023)   += pmic_tps65023.o
 
 # SMP support ONLY available for OMAP4
 obj-$(CONFIG_SMP)  += omap-smp.o omap-headsmp.o
diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c
index a0f9f61..6d3d4c3 100644
--- a/arch/arm/mach-omap2/pm.c
+++ b/arch/arm/mach-omap2/pm.c
@@ -366,6 +366,7 @@ static int __init omap2_common_pm_late_init(void)
/* Init the OMAP TWL parameters */
omap3_twl_init();
omap4_twl_init();
+   omap3_tps65023_init();
 
/* Init the voltage layer */
omap_voltage_late_init();
diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h
index c98be66..fc575ed 100644
--- a/arch/arm/mach-omap2/pm.h
+++ b/arch/arm/mach-omap2/pm.h
@@ -139,6 +139,15 @@ static inline int omap4_twl_init(void)
 }
 #endif
 
+#ifdef CONFIG_REGULATOR_TPS65023
+extern int omap3_tps65023_init(void);
+#else
+static inline int omap3_tps65023_init(void)
+{
+   return -EINVAL;
+}
+#endif
+
 #ifndef CONFIG_SUSPEND
 #define omap_pm_ops NULL
 #endif
diff --git a/arch/arm/mach-omap2/pmic_tps65023.c 
b/arch/arm/mach-omap2/pmic_tps65023.c
new file mode 100644
index 000..b4d185d
--- /dev/null
+++ b/arch/arm/mach-omap2/pmic_tps65023.c
@@ -0,0 +1,82 @@
+/**
+ * Implements support for TPS65023
+ *
+ * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation version 2.
+ *
+ * This program is distributed as is WITHOUT ANY WARRANTY of any
+ * kind, whether express or implied; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include linux/err.h
+#include linux/io.h
+#include linux/kernel.h
+#include linux/i2c/twl.h
+
+#include plat/voltage.h
+
+#include pm.h
+
+#defineTPS65023_VDCDC1_MIN 80  /* 0.8V */
+#defineTPS65023_VDCDC1_STEP25000   /* 0.025V   */
+
+
+/*
+ * Get voltage corresponding to specified vsel value using this formula:
+ * Vout = 0.8V + (25mV x Vsel)
+ */
+static unsigned long tps65023_vsel_to_uv(const u8 vsel)
+{
+   return (TPS65023_VDCDC1_MIN + (TPS65023_VDCDC1_STEP * vsel));
+}
+
+/*
+ * Get vsel value corresponding to specified voltage using this formula:
+ * Vsel = (Vout - 0.8V)/ 25mV
+ */
+static u8 tps65023_uv_to_vsel(unsigned long uv)
+{
+   return DIV_ROUND_UP(uv - TPS65023_VDCDC1_MIN, TPS65023_VDCDC1_STEP);
+}
+
+/*
+ * TPS65023 is currently supported only for AM35x devices.
+ * Therefore, implementation below is specific to this device pair.
+ */
+
+/**
+ * Voltage information related to the MPU voltage domain of the
+ * AM35x processors - in relation to the TPS65023.
+ */
+static struct omap_volt_pmic_info tps65023_am35xx_mpu_volt_info = {
+   .step_size  = 25000,
+   .on_volt= 120,
+   .vsel_to_uv = tps65023_vsel_to_uv,
+   .uv_to_vsel = tps65023_uv_to_vsel,
+};
+
+int __init omap3_tps65023_init(void)
+{
+   struct voltagedomain *voltdm;
+
+   if (!cpu_is_omap34xx())
+   return -ENODEV;
+
+   if (cpu_is_omap3505() || cpu_is_omap3517()) {
+   voltdm = omap_voltage_domain_lookup(mpu);
+   omap_voltage_register_pmic(voltdm, 
tps65023_am35xx_mpu_volt_info);
+   voltdm = omap_voltage_domain_lookup(core);
+   omap_voltage_register_pmic(voltdm, 
tps65023_am35xx_mpu_volt_info);
+   } else {
+   /* TODO:
+* Support for other devices that support TPS65023
+*/
+   }
+
+   return 0;
+}
-- 
1.7.2.2

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


[RFCv2 2/2] AM35x: voltage: Basic initialization

2011-03-16 Thread Sanjeev Premi
This patch adds the basic initialization of voltage layer
for AM35x. Since AM35x doesn't support voltage scaling,
Many functions emply fucntions have been defined to plug
into existing voltage layer.

Signed-off-by: Sanjeev Premi pr...@ti.com
---
 arch/arm/mach-omap2/voltage.c |  110 -
 1 files changed, 109 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-omap2/voltage.c b/arch/arm/mach-omap2/voltage.c
index 2017dc0..a82a55f 100644
--- a/arch/arm/mach-omap2/voltage.c
+++ b/arch/arm/mach-omap2/voltage.c
@@ -260,6 +260,40 @@ static struct omap_vdd_info omap3_vdd_info[] = {
 
 #define OMAP3_NR_SCALABLE_VDD ARRAY_SIZE(omap3_vdd_info)
 
+/*
+ * AM35x VDD structures
+ *
+ * In AM35x there neither scalable voltage domain nor any hook-up with
+ * voltage controller/processor. However, when trying to re-use the hwmod
+ * database for OMAP3, definition of core voltage domain is necessary.
+ * Else, changes in hwmod data structures grow spirally.
+ *
+ * As a workaround, core voltage domain is defined below. The definition
+ * doesn't lead to any side-effects.
+ */
+static struct omap_vdd_info am3517_vdd_info[] = {
+{
+   .dep_vdd_info   = NULL,
+   .nr_dep_vdd = 0,
+   .vp_enabled = false,
+
+.voltdm = {
+.name = mpu,
+},
+},
+{
+   .dep_vdd_info   = NULL,
+   .nr_dep_vdd = 0,
+   .vp_enabled = false,
+
+.voltdm = {
+.name = core,
+},
+},
+};
+
+#define AM3517_NR_SCALABLE_VDD ARRAY_SIZE(am3517_vdd_info)
+
 /* OMAP4 VDD sturctures */
 static struct omap_vdd_info omap4_vdd_info[] = {
{
@@ -374,6 +408,15 @@ static struct omap_volt_data omap44xx_vdd_core_volt_data[] 
= {
VOLT_DATA_DEFINE(0, 0, 0, 0),
 };
 
+/* AM35x
+ *
+ * Fields related to SmartReflex and Voltage Processor are set to 0.
+ */
+static struct omap_volt_data am35xx_vdd_volt_data[] = {
+   VOLT_DATA_DEFINE(OMAP3430_VDD_MPU_OPP3_UV, 0x0, 0x0, 0x0),
+   VOLT_DATA_DEFINE(0, 0, 0, 0),
+};
+
 /* OMAP 3430 MPU Core VDD dependency table */
 static struct omap_vdd_dep_volt omap34xx_vdd1_vdd2_data[] = {
{.main_vdd_volt = 975000, .dep_vdd_volt = 105},
@@ -399,6 +442,12 @@ static void (*vp_init) (struct omap_vdd_info *vdd);
 
 static int (*vdd_data_configure) (struct omap_vdd_info *vdd);
 
+static int volt_scale_nop (struct omap_vdd_info *vdd,
+   unsigned long target_volt)
+{
+   return 0;
+}
+
 static u32 omap3_voltage_read_reg(u16 mod, u8 offset)
 {
return omap2_prm_read_mod_reg(mod, offset);
@@ -1019,6 +1068,45 @@ static int __init omap3_vdd_data_configure(struct 
omap_vdd_info *vdd)
return 0;
 }
 
+/**
+ *Setup VDD related information for AM35x processors
+ */
+static int __init am3517_vdd_data_configure(struct omap_vdd_info *vdd)
+{
+   if (!vdd-pmic_info) {
+   pr_err(%s: PMIC info requried to configure vdd_%s not
+   populated.Hence cannot initialize vdd_%s\n,
+   __func__, vdd-voltdm.name, vdd-voltdm.name);
+   return -EINVAL;
+   }
+
+   if (!strcmp(vdd-voltdm.name, mpu) ||
+   !strcmp(vdd-voltdm.name, core)) {
+   vdd-volt_data = am35xx_vdd_volt_data;
+   } else {
+   pr_warning(%s: vdd_%s does not exist in AM35x\n,
+   __func__, vdd-voltdm.name);
+   return -EINVAL;
+   }
+
+   /* Generic voltage parameters */
+   vdd-curr_volt  = OMAP3430_VDD_MPU_OPP3_UV;
+   vdd-ocp_mod= OCP_MOD;
+   vdd-prm_irqst_reg  = OMAP3_PRM_IRQSTATUS_MPU_OFFSET;
+   vdd-read_reg   = omap3_voltage_read_reg;
+   vdd-write_reg  = omap3_voltage_write_reg;
+   vdd-volt_scale = volt_scale_nop;
+
+   /* Init the plist */
+   spin_lock_init(vdd-user_lock);
+   plist_head_init(vdd-user_list, vdd-user_lock);
+
+   /* Init the DVFS mutex */
+   mutex_init(vdd-scaling_mutex);
+
+   return 0;
+}
+
 /* OMAP4 specific voltage init functions */
 static void __init omap4_vc_init(struct omap_vdd_info *vdd)
 {
@@ -1908,13 +1996,33 @@ int __init omap_voltage_late_init(void)
 }
 
 /**
+ * AM35x - Empty initialization of voltage controller
+ */
+static void __init am3517_vc_init(struct omap_vdd_info *vdd)
+{
+}
+
+/**
+ * AM35x - Empty initialization of voltage processor
+ */
+static void __init am3517_vp_init(struct omap_vdd_info *vdd)
+{
+}
+
+/**
  * omap_voltage_early_init()- Volatage driver early init
  */
 static int __init omap_voltage_early_init(void)
 {
int i;
 
-   if (cpu_is_omap34xx()) {
+   if (cpu_is_omap3505() || cpu_is_omap3517()) {
+   vdd_info= am3517_vdd_info;
+   nr_scalable_vdd = AM3517_NR_SCALABLE_VDD

[PATCHv2] omap3: alsa-soc: Remove restrictive checks for cpu type

2011-03-16 Thread Sanjeev Premi
Current checks for cpu type were too restrictive leading
to failures for other silicons in same family.

The problem was found while testing audio playback on
AM37x and AM35x processors. But should exist on OMAP36xx
as well.

Signed-off-by: Sanjeev Premi pr...@ti.com
---
 Changes in this version:
 1) Added one more check to the changes.
 2) Updated commit message to use plurals.

 sound/soc/omap/omap-mcbsp.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c
index 2175f09..a88a0bf 100644
--- a/sound/soc/omap/omap-mcbsp.c
+++ b/sound/soc/omap/omap-mcbsp.c
@@ -146,7 +146,7 @@ static int omap_mcbsp_dai_startup(struct snd_pcm_substream 
*substream,
 * 2 channels (stereo): size is 128 / 2 = 64 frames (2 * 64 words)
 * 4 channels: size is 128 / 4 = 32 frames (4 * 32 words)
 */
-   if (cpu_is_omap343x() || cpu_is_omap44xx()) {
+   if (cpu_is_omap34xx() || cpu_is_omap44xx()) {
/*
* Rule for the buffer size. We should not allow
* smaller buffer than the FIFO size to avoid underruns
@@ -258,7 +258,7 @@ static int omap_mcbsp_dai_hw_params(struct 
snd_pcm_substream *substream,
default:
return -EINVAL;
}
-   if (cpu_is_omap343x()) {
+   if (cpu_is_omap34xx()) {
dma_data-set_threshold = omap_mcbsp_set_threshold;
/* TODO: Currently, MODE_ELEMENT == MODE_FRAME */
if (omap_mcbsp_get_dma_op_mode(bus_id) ==
-- 
1.7.2.2

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


[PATCH] omap3: alsa-soc: Remove restrictive check for cpu type

2011-03-14 Thread Sanjeev Premi
Current check for cpu type is too restrictive leading to
failures for other silicons in same family.

The problem was found while testing audio playback on
AM37x and AM35x processors. But should exist on OMAP36xx
as well.

Signed-off-by: Sanjeev Premi pr...@ti.com
---
 sound/soc/omap/omap-mcbsp.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c
index 2175f09..84d434a 100644
--- a/sound/soc/omap/omap-mcbsp.c
+++ b/sound/soc/omap/omap-mcbsp.c
@@ -146,7 +146,7 @@ static int omap_mcbsp_dai_startup(struct snd_pcm_substream 
*substream,
 * 2 channels (stereo): size is 128 / 2 = 64 frames (2 * 64 words)
 * 4 channels: size is 128 / 4 = 32 frames (4 * 32 words)
 */
-   if (cpu_is_omap343x() || cpu_is_omap44xx()) {
+   if (cpu_is_omap34xx() || cpu_is_omap44xx()) {
/*
* Rule for the buffer size. We should not allow
* smaller buffer than the FIFO size to avoid underruns
-- 
1.7.2.2

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


[RFC] AM35x: Workaround to use generic OMAP3 hwmods

2011-02-25 Thread Sanjeev Premi
This patch implements workaround to reuse the hwmods
defined for OMAP3. Else, the master-slave dependency
cascades into duplicating all of the hwmods.

Without this workaround, the AM3517 EVM fails to boot
due to kernel panic while initializing the SR hwmods.

Until real solution is implemented, this workaround
can be considered.

Signed-off-by: Sanjeev Premi pr...@ti.com
---
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |   66 +++-
 1 files changed, 65 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c 
b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
index 800eda4..c8854eb 100644
--- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
@@ -1670,7 +1670,71 @@ static __initdata struct omap_hwmod *omap3xxx_hwmods[] = 
{
NULL,
 };
 
+/**
+ * HWMODs specific to AM35x processors
+ * Though they are quite similar to OMAP34xx definitions,
+ * having separate array makes customization easy.
+ */
+static __initdata struct omap_hwmod *am35xx_hwmods[] = {
+   omap3xxx_l3_main_hwmod,
+   omap3xxx_l4_core_hwmod,
+   omap3xxx_l4_per_hwmod,
+   omap3xxx_l4_wkup_hwmod,
+   omap3xxx_mpu_hwmod,
+   omap3xxx_wd_timer2_hwmod,
+   omap3xxx_uart1_hwmod,
+   omap3xxx_uart2_hwmod,
+   omap3xxx_uart3_hwmod,
+   omap3xxx_uart4_hwmod,
+   omap3xxx_i2c1_hwmod,
+   omap3xxx_i2c2_hwmod,
+   omap3xxx_i2c3_hwmod,
+
+   /* gpio class */
+   omap3xxx_gpio1_hwmod,
+   omap3xxx_gpio2_hwmod,
+   omap3xxx_gpio3_hwmod,
+   omap3xxx_gpio4_hwmod,
+   omap3xxx_gpio5_hwmod,
+   omap3xxx_gpio6_hwmod,
+
+   /* dma_system class*/
+   omap3xxx_dma_system_hwmod,
+
+   /* mcspi class */
+   omap34xx_mcspi1,
+   omap34xx_mcspi2,
+   omap34xx_mcspi3,
+   omap34xx_mcspi4,
+   NULL,
+};
+
 int __init omap3xxx_hwmod_init(void)
 {
-   return omap_hwmod_init(omap3xxx_hwmods);
+   if (cpu_is_omap3505() || cpu_is_omap3517()) {
+
+   /* TODO: Find better way to get this done.
+*
+* AM35xx doesn't support smartreflex. This requires:
+* 1) Removing related hwmods from the initialization list.
+*(done).
+* 2) Removing omap3_l4_core__sr1 and omap3_l4_core__sr2
+*from omap3xxx_l4_core_slaves.
+*This, however, has cascading effect on all hwmods,
+*due to master-slave relations between these hwmods.
+*
+* Instead of duplicating contents of this file, updating
+* the structure to restrict slave count to 1; and setting
+* address of omap3_l4_core__sr1  omap3_l4_core__sr2 to
+* NULL should be a reasonable workaround.
+*/
+   omap3xxx_l4_core_slaves[1] = NULL;
+   omap3xxx_l4_core_slaves[2] = NULL;
+
+   omap3xxx_l4_core_hwmod.slaves_cnt = 1;
+
+   return omap_hwmod_init(am35xx_hwmods);
+   } else {
+   return omap_hwmod_init(omap3xxx_hwmods);
+   }
 }
-- 
1.7.2.2

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


[PATCH] omap2plus: Remove auto selection on PMICs

2011-02-23 Thread Sanjeev Premi
The current implementation almost assumes that only
TWL4030/TWL5030/TWl6030 are (or can be) used with the
OMAP processors. This is, however, not true.

This patch removes the automatic selection of the PMIC
from Kconfig. Current defaults are chosen in default
configuration omap2plus_defconfig and can easily be
added to configuration for any board, there should be
no compile/run-time impact.

Signed-off-by: Sanjeev Premi pr...@ti.com
---
Compiled omap2plus-defconfig and boot tested on
OMAP3EVM Rev G.

 arch/arm/mach-omap2/Kconfig |3 ---
 drivers/mfd/Kconfig |4 ++--
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index ae7f47d..9c4f903 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -16,9 +16,6 @@ config ARCH_OMAP2PLUS_TYPICAL
select I2C
select I2C_OMAP
select MFD_SUPPORT
-   select MENELAUS if ARCH_OMAP2
-   select TWL4030_CORE if ARCH_OMAP3 || ARCH_OMAP4
-   select TWL4030_POWER if ARCH_OMAP3 || ARCH_OMAP4
help
  Compile a kernel suitable for booting most boards
 
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index fd01836..67dcee4 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -155,7 +155,7 @@ config MENELAUS
 
 config TWL4030_CORE
bool Texas Instruments TWL4030/TWL5030/TWL6030/TPS659x0 Support
-   depends on I2C=y  GENERIC_HARDIRQS
+   depends on I2C=y  GENERIC_HARDIRQS  (ARCH_OMAP3 || ARCH_OMAP4)
help
  Say yes here if you have TWL4030 / TWL6030 family chip on your board.
  This core driver provides register access and IRQ handling
@@ -169,7 +169,7 @@ config TWL4030_CORE
 
 config TWL4030_POWER
bool Support power resources on TWL4030 family chips
-   depends on TWL4030_CORE  ARM
+   depends on TWL4030_CORE  (ARCH_OMAP3 || ARCH_OMAP4)
help
  Say yes here if you want to use the power resources on the
  TWL4030 family chips.  Most of these resources are regulators,
-- 
1.7.2.2

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


[RFC 0/3] Support TPS65023 with AM35xx

2011-02-23 Thread Sanjeev Premi
Intent of this series is to solicit feedback on
on adding basic support for AM3517 and TPS65023.

This is definitely not the complete support, but
wanted to get early comments while i continue to
work.

Sanjeev Premi (3):
  omap: voltage: Allow custom vp_init() implementation
  am35xx: voltage: Add basic initialization
  am35xx: pm: Hook-up with TPS65023

 arch/arm/mach-omap2/am3517_tps.c |   96 ++
 arch/arm/mach-omap2/voltage.c|   51 +++-
 2 files changed, 145 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/mach-omap2/am3517_tps.c

-- 
1.7.2.2

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


[RFC 2/3] am35xx: voltage: Add basic initialization

2011-02-23 Thread Sanjeev Premi
This patch adds basic initialization in
the voltage layer for AM35xx processors.

In absence of AVS, functions vp_init() and
vc_init() are empty.

Signed-off-by: Sanjeev Premi pr...@ti.com
---
 arch/arm/mach-omap2/voltage.c |   45 -
 1 files changed, 44 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-omap2/voltage.c b/arch/arm/mach-omap2/voltage.c
index bbc36e7..63dac11 100644
--- a/arch/arm/mach-omap2/voltage.c
+++ b/arch/arm/mach-omap2/voltage.c
@@ -194,6 +194,30 @@ static struct omap_vdd_info omap3_vdd_info[] = {
 
 #define OMAP3_NR_SCALABLE_VDD ARRAY_SIZE(omap3_vdd_info)
 
+/*
+ * AM3517 VDD structures
+ * TODO: The values in vp_offs are just a copy of OMAP3 for now.
+ *   Assignments need to be looked again; but appears that
+ *   they won't ever be used.
+ */
+static struct omap_vdd_info am3517_vdd_info[] = {
+{
+.vp_offs = {
+.vpconfig   = OMAP3_PRM_VP1_CONFIG_OFFSET,
+.vstepmin   = OMAP3_PRM_VP1_VSTEPMIN_OFFSET,
+.vstepmax   = OMAP3_PRM_VP1_VSTEPMAX_OFFSET,
+.vlimitto   = OMAP3_PRM_VP1_VLIMITTO_OFFSET,
+.vstatus= OMAP3_PRM_VP1_STATUS_OFFSET,
+.voltage= OMAP3_PRM_VP1_VOLTAGE_OFFSET,
+},
+.voltdm = {
+.name = mpu,
+},
+},
+};
+
+#define AM3517_NR_SCALABLE_VDD 0
+
 /* OMAP4 VDD sturctures */
 static struct omap_vdd_info omap4_vdd_info[] = {
{
@@ -1551,11 +1575,30 @@ int __init omap_voltage_late_init(void)
 }
 
 /**
+ * AM35xx - dummy initialization of voltage controller
+ */
+static void __init am3517_vc_init(struct omap_vdd_info *vdd)
+{
+}
+/**
+ * AM35xx - dummy initialization of voltage processor
+ */
+static void __init am3517_vp_init(struct omap_vdd_info *vdd)
+{
+}
+
+/**
  * omap_voltage_early_init()- Volatage driver early init
  */
 static int __init omap_voltage_early_init(void)
 {
-   if (cpu_is_omap34xx()) {
+   if (cpu_is_omap3505() || cpu_is_omap3517()) {
+   vdd_info= am3517_vdd_info;
+   nr_scalable_vdd = AM3517_NR_SCALABLE_VDD;
+   vc_init = am3517_vc_init;
+   vp_init = am3517_vp_init;
+   vdd_data_configure = omap3_vdd_data_configure;
+   } else if (cpu_is_omap34xx()) {
vdd_info = omap3_vdd_info;
nr_scalable_vdd = OMAP3_NR_SCALABLE_VDD;
vc_init = omap3_vc_init;
-- 
1.7.2.2

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


[RFC 3/3] am35xx: pm: Hook-up with TPS65023

2011-02-23 Thread Sanjeev Premi
Add glue logic to hook-up AM35x processors
with TPS65023.

Signed-off-by: Sanjeev Premi pr...@ti.com
---
 arch/arm/mach-omap2/am3517_tps.c |   96 ++
 1 files changed, 96 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-omap2/am3517_tps.c

diff --git a/arch/arm/mach-omap2/am3517_tps.c b/arch/arm/mach-omap2/am3517_tps.c
new file mode 100644
index 000..cddd7eb
--- /dev/null
+++ b/arch/arm/mach-omap2/am3517_tps.c
@@ -0,0 +1,96 @@
+/**
+ * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ * Based on omap_twl.c
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as 
+ * published by the Free Software Foundation version 2.
+ *
+ * This program is distributed as is WITHOUT ANY WARRANTY of any
+ * kind, whether express or implied; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include linux/err.h
+#include linux/io.h
+#include linux/kernel.h
+#include linux/i2c/twl.h
+
+#include plat/voltage.h
+
+#include pm.h
+
+/*
+ * TODO: Copy of OMAP3 definitions to get thru compilation.
+ *   May not be needed in final implementation. Need to
+ *   relook at the the need again.
+ */
+#define OMAP3_SRI2C_SLAVE_ADDR 0x12
+#define OMAP3_VDD_MPU_SR_CONTROL_REG   0x00
+#define OMAP3_VDD_CORE_SR_CONTROL_REG  0x01
+#define OMAP3_VP_CONFIG_ERROROFFSET0x00
+#define OMAP3_VP_VSTEPMIN_VSTEPMIN 0x1
+#define OMAP3_VP_VSTEPMAX_VSTEPMAX 0x04
+#define OMAP3_VP_VLIMITTO_TIMEOUT_US   200
+
+#define OMAP3430_VP2_VLIMITTO_VDDMIN 0x18
+#define OMAP3430_VP2_VLIMITTO_VDDMAX 0x2c
+
+/**
+ * TBD: Update the formula below.
+ *  Needs to be derived from a table.
+ */
+static unsigned long tps65023_vsel_to_uv(const u8 vsel)
+{
+   return (((vsel * 250) + 6000)) * 100;
+}
+
+/**
+ * TBD: Update the formula below.
+ *  Needs to be derived from a table.
+ */
+static u8 tps65023_uv_to_vsel(unsigned long uv)
+{
+   return DIV_ROUND_UP(uv - 60, 25000);
+}
+
+/**
+ * TBD: Just a copy of OMAP3 PMIC info.
+ *  Many fields below don't make much sense for AM3517,
+ *  but keeping them as is for now.
+ */
+static struct omap_volt_pmic_info am3517_volt_info = {
+   .slew_rate  = 4000,
+   .step_size  = 25000,
+   .on_volt= 120,
+   .onlp_volt  = 100,
+   .ret_volt   = 975000,
+   .off_volt   = 60,
+   .volt_setup_time= 0xfff,
+   .vp_erroroffset = OMAP3_VP_CONFIG_ERROROFFSET,
+   .vp_vstepmin= OMAP3_VP_VSTEPMIN_VSTEPMIN,
+   .vp_vstepmax= OMAP3_VP_VSTEPMAX_VSTEPMAX,
+   .vp_vddmin  = OMAP3430_VP2_VLIMITTO_VDDMIN,
+   .vp_vddmax  = OMAP3430_VP2_VLIMITTO_VDDMAX,
+   .vp_timeout_us  = OMAP3_VP_VLIMITTO_TIMEOUT_US,
+   .i2c_slave_addr = OMAP3_SRI2C_SLAVE_ADDR,
+   .pmic_reg   = OMAP3_VDD_CORE_SR_CONTROL_REG,
+   .vsel_to_uv = tps65023_vsel_to_uv,
+   .uv_to_vsel = tps65023_uv_to_vsel,
+};
+
+int __init am3517_tps_init(void)
+{
+   struct voltagedomain *voltdm;
+
+   if (!cpu_is_omap3505()  !cpu_is_omap3517())
+   return -ENODEV;
+
+   voltdm = omap_voltage_domain_lookup(mpu);
+   omap_voltage_register_pmic(voltdm, am3517_volt_info);
+
+   return 0;
+}
+
-- 
1.7.2.2

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


[RFC 1/3] omap: voltage: Allow custom vp_init() implementation

2011-02-23 Thread Sanjeev Premi
Current implementation expects AVS to be available
on the processor - by default. May not be true.

This patch allows the vp_init() to be implemented
per processor (or family) - same as vc_init().

Signed-off-by: Sanjeev Premi pr...@ti.com
---
 arch/arm/mach-omap2/voltage.c |6 +-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-omap2/voltage.c b/arch/arm/mach-omap2/voltage.c
index 12be525..bbc36e7 100644
--- a/arch/arm/mach-omap2/voltage.c
+++ b/arch/arm/mach-omap2/voltage.c
@@ -312,6 +312,8 @@ static struct dentry *voltage_dir;
 
 /* Init function pointers */
 static void (*vc_init) (struct omap_vdd_info *vdd);
+static void (*vp_init) (struct omap_vdd_info *vdd);
+
 static int (*vdd_data_configure) (struct omap_vdd_info *vdd);
 
 static u32 omap3_voltage_read_reg(u16 mod, u8 offset)
@@ -416,7 +418,7 @@ static void vp_latch_vsel(struct omap_vdd_info *vdd)
 }
 
 /* Generic voltage init functions */
-static void __init vp_init(struct omap_vdd_info *vdd)
+static void __init omap_vp_init(struct omap_vdd_info *vdd)
 {
u32 vp_val;
u16 mod;
@@ -1557,11 +1559,13 @@ static int __init omap_voltage_early_init(void)
vdd_info = omap3_vdd_info;
nr_scalable_vdd = OMAP3_NR_SCALABLE_VDD;
vc_init = omap3_vc_init;
+   vp_init = omap_vp_init;
vdd_data_configure = omap3_vdd_data_configure;
} else if (cpu_is_omap44xx()) {
vdd_info = omap4_vdd_info;
nr_scalable_vdd = OMAP4_NR_SCALABLE_VDD;
vc_init = omap4_vc_init;
+   vp_init = omap_vp_init;
vdd_data_configure = omap4_vdd_data_configure;
} else {
pr_warning(%s: voltage driver support not added\n, __func__);
-- 
1.7.2.2

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


[RFC] omap3: Allow dynamic (de)selection of HWMODs

2011-02-22 Thread Sanjeev Premi
OMAP35xx, AM35xx, AM37xx families hve multiple
variants that differ from each other based on
features and peripherals.

This patch defines a simple framework to keep
the HWMOD database to be a generic superset and
then allow runtime selection and deselection of
HWMODs corresponding to detected silicon variant.

It eliminates the need to define CHIP_IS_xxx for
each variant.

Continuation of ongoing discussion[1] but this
time with actual code.

 [1] http://marc.info/?l=linux-omapm=129838265800443w=2

Signed-off-by: Sanjeev Premi pr...@ti.com
---
This patch contains changes to add CHIP_IS_AM3505
from my work-in-progress branch... but essence of
this proposal is to do away with need to define
this and additional bits.

Please ignore this change during review.

 arch/arm/mach-omap2/id.c |4 +-
 arch/arm/mach-omap2/omap_hwmod.c |3 +
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c   |   92 +-
 arch/arm/plat-omap/include/plat/cpu.h|1 +
 arch/arm/plat-omap/include/plat/omap_hwmod.h |2 +
 5 files changed, 98 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index 5f9086c..99bd54f 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -263,11 +263,9 @@ static void __init omap3_check_revision(void)
 *
 * Set the device to be OMAP3505 here. Actual device
 * is identified later based on the features.
-*
-* REVISIT: AM3505/AM3517 should have their own CHIP_IS
 */
omap_revision = OMAP3505_REV(rev);
-   omap_chip.oc |= CHIP_IS_OMAP3430ES3_1;
+   omap_chip.oc |= CHIP_IS_OMAP3430ES3_1 | CHIP_IS_AM3505;
break;
case 0xb891:
/* Handle 36xx devices */
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index e282e35..62d19b6 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -1362,6 +1362,9 @@ static int _setup(struct omap_hwmod *oh, void *data)
int i, r;
u8 postsetup_state;
 
+   if (!oh-select)
+   return 0;
+
/* Set iclk autoidle mode */
if (oh-slaves_cnt  0) {
for (i = 0; i  oh-slaves_cnt; i++) {
diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c 
b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
index 800eda4..e7d0906 100644
--- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
@@ -105,6 +105,7 @@ static struct omap_hwmod omap3xxx_l3_main_hwmod = {
.slaves_cnt = ARRAY_SIZE(omap3xxx_l3_main_slaves),
.omap_chip  = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
.flags  = HWMOD_NO_IDLEST,
+   .select = true,
 };
 
 static struct omap_hwmod omap3xxx_l4_wkup_hwmod;
@@ -333,6 +334,7 @@ static struct omap_hwmod omap3xxx_l4_core_hwmod = {
.slaves_cnt = ARRAY_SIZE(omap3xxx_l4_core_slaves),
.omap_chip  = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
.flags  = HWMOD_NO_IDLEST,
+   .select = true,
 };
 
 /* Slave interfaces on the L4_PER interconnect */
@@ -356,6 +358,7 @@ static struct omap_hwmod omap3xxx_l4_per_hwmod = {
.slaves_cnt = ARRAY_SIZE(omap3xxx_l4_per_slaves),
.omap_chip  = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
.flags  = HWMOD_NO_IDLEST,
+   .select = true,
 };
 
 /* Slave interfaces on the L4_WKUP interconnect */
@@ -377,6 +380,7 @@ static struct omap_hwmod omap3xxx_l4_wkup_hwmod = {
.slaves_cnt = ARRAY_SIZE(omap3xxx_l4_wkup_slaves),
.omap_chip  = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
.flags  = HWMOD_NO_IDLEST,
+   .select = true,
 };
 
 /* Master interfaces on the MPU device */
@@ -392,6 +396,7 @@ static struct omap_hwmod omap3xxx_mpu_hwmod = {
.masters= omap3xxx_mpu_masters,
.masters_cnt= ARRAY_SIZE(omap3xxx_mpu_masters),
.omap_chip  = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
+   .select = true,
 };
 
 /*
@@ -419,7 +424,8 @@ static struct omap_hwmod omap3xxx_iva_hwmod = {
.class  = iva_hwmod_class,
.masters= omap3xxx_iva_masters,
.masters_cnt= ARRAY_SIZE(omap3xxx_iva_masters),
-   .omap_chip  = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
+   .omap_chip  = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
+   .select = true,
 };
 
 /* l4_wkup - wd_timer2 */
@@ -496,6 +502,7 @@ static struct omap_hwmod omap3xxx_wd_timer2_hwmod = {
.slaves = omap3xxx_wd_timer2_slaves,
.slaves_cnt = ARRAY_SIZE(omap3xxx_wd_timer2_slaves),
.omap_chip  = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
+   .select = true,
 };
 
 /* UART common */
@@ -551,6 +558,7 @@ static struct omap_hwmod omap3xxx_uart1_hwmod = {
.slaves_cnt = ARRAY_SIZE

[PATCH 0/2] omap3: minor clean-up in flash related code

2011-02-15 Thread Sanjeev Premi
Changes include:
 - fixing typos
 - using pr_err() instead of printk

Sanjeev Premi (2):
  omap3: fix minor typos
  omap3: flash: use pr_err instead of printk

 arch/arm/mach-omap2/board-flash.c |   19 ---
 1 files changed, 8 insertions(+), 11 deletions(-)

-- 
1.7.2.2

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


[PATCH 1/2] omap3: fix minor typos

2011-02-15 Thread Sanjeev Premi
This patch fixes typos that were remaining after
the file and functions were renamed.

Signed-off-by: Sanjeev Premi pr...@ti.com
---
 arch/arm/mach-omap2/board-flash.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/board-flash.c 
b/arch/arm/mach-omap2/board-flash.c
index fd38c05..ce61200 100644
--- a/arch/arm/mach-omap2/board-flash.c
+++ b/arch/arm/mach-omap2/board-flash.c
@@ -1,5 +1,5 @@
 /*
- * board-sdp-flash.c
+ * board-flash.c
  * Modified from mach-omap2/board-3430sdp-flash.c
  *
  * Copyright (C) 2009 Nokia Corporation
@@ -189,7 +189,7 @@ unmap:
 }
 
 /**
- * sdp3430_flash_init - Identify devices connected to GPMC and register.
+ * board_flash_init - Identify devices connected to GPMC and register.
  *
  * @return - void.
  */
-- 
1.7.2.2

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


[PATCH 2/2] omap3: flash: use pr_err instead of printk

2011-02-15 Thread Sanjeev Premi
Change all occurences of printf() to pr_err().
Includes minor formatting changes as result of
this change.

Signed-off-by: Sanjeev Premi pr...@ti.com
---
 arch/arm/mach-omap2/board-flash.c |   15 ++-
 1 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/arch/arm/mach-omap2/board-flash.c 
b/arch/arm/mach-omap2/board-flash.c
index ce61200..86d1020 100644
--- a/arch/arm/mach-omap2/board-flash.c
+++ b/arch/arm/mach-omap2/board-flash.c
@@ -73,11 +73,11 @@ __init board_nor_init(struct mtd_partition *nor_parts, u8 
nr_parts, u8 cs)
+ FLASH_SIZE_SDPV1 - 1;
}
if (err  0) {
-   printk(KERN_ERR NOR: Can't request GPMC CS\n);
+   pr_err(NOR: Can't request GPMC CS\n);
return;
}
if (platform_device_register(board_nor_device)  0)
-   printk(KERN_ERR Unable to register NOR device\n);
+   pr_err(Unable to register NOR device\n);
 }
 
 #if defined(CONFIG_MTD_ONENAND_OMAP2) || \
@@ -208,7 +208,7 @@ void board_flash_init(struct flash_partitions 
partition_info[],
 */
idx = get_gpmc0_type();
if (idx = MAX_SUPPORTED_GPMC_CONFIG) {
-   printk(KERN_ERR %s: Invalid chip select: %d\n, __func__, cs);
+   pr_err(%s: Invalid chip select: %d\n, __func__, cs);
return;
}
config_sel = (unsigned char *)(chip_sel_board[idx]);
@@ -232,22 +232,19 @@ void board_flash_init(struct flash_partitions 
partition_info[],
}
 
if (norcs  GPMC_CS_NUM)
-   printk(KERN_INFO NOR: Unable to find configuration 
-   in GPMC\n);
+   pr_err(NOR: Unable to find configuration in GPMC\n);
else
board_nor_init(partition_info[0].parts,
partition_info[0].nr_parts, norcs);
 
if (onenandcs  GPMC_CS_NUM)
-   printk(KERN_INFO OneNAND: Unable to find configuration 
-   in GPMC\n);
+   pr_err(OneNAND: Unable to find configuration in GPMC\n);
else
board_onenand_init(partition_info[1].parts,
partition_info[1].nr_parts, onenandcs);
 
if (nandcs  GPMC_CS_NUM)
-   printk(KERN_INFO NAND: Unable to find configuration 
-   in GPMC\n);
+   pr_err(NAND: Unable to find configuration in GPMC\n);
else
board_nand_init(partition_info[2].parts,
partition_info[2].nr_parts, nandcs);
-- 
1.7.2.2

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


[PATCH] omap3: fix compile-time warnings

2011-02-11 Thread Sanjeev Premi
This patch fixes these warnings when building kernel for OMAP3EVM
only.

  CC  arch/arm/mach-omap2/clockdomains2xxx_3xxx_data.o
arch/arm/mach-omap2/clockdomains2xxx_3xxx_data.c:95: warning:
 'dsp_24xx_wkdeps' defined but not used
arch/arm/mach-omap2/clockdomains2xxx_3xxx_data.c:119: warning:
 'mpu_24xx_wkdeps' defined but not used
arch/arm/mach-omap2/clockdomains2xxx_3xxx_data.c:147: warning:
 'core_24xx_wkdeps' defined but not used

The problem should be noticed when building for other OMAP3
platforms (only) as well.

Signed-off-by: Sanjeev Premi pr...@ti.com
---
 arch/arm/mach-omap2/clockdomains2xxx_3xxx_data.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/clockdomains2xxx_3xxx_data.c 
b/arch/arm/mach-omap2/clockdomains2xxx_3xxx_data.c
index e6f0d18..8134bb3 100644
--- a/arch/arm/mach-omap2/clockdomains2xxx_3xxx_data.c
+++ b/arch/arm/mach-omap2/clockdomains2xxx_3xxx_data.c
@@ -89,6 +89,8 @@ static struct clkdm_dep gfx_sgx_wkdeps[] = {
 
 /* 24XX-specific possible dependencies */
 
+#ifdef CONFIG_ARCH_OMAP2
+
 /* Wakeup dependency source arrays */
 
 /* 2420/2430 PM_WKDEP_DSP: CORE, MPU, WKUP */
@@ -168,6 +170,7 @@ static struct clkdm_dep core_24xx_wkdeps[] = {
{ NULL },
 };
 
+#endif /* CONFIG_ARCH_OMAP2 */
 
 /* 2430-specific possible wakeup dependencies */
 
-- 
1.7.2.2

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


[PATCH 0/1] omap3: pm: CM_AUTOIDLE_PLL isn't restored on wakeup from off state

2011-02-10 Thread Sanjeev Premi
The value of AUTO_PERIPH_DPLL is being lost after resuming from
the off state. More details on problem and cause in PATCH 1/1.

The problem was found recently in 2.6.32 kernel version and exists
on the latest pm branch at:
commit 448e9a675e2cfb173fc47083058cf254ccc114a0
Merge: c1e460d f11bdd3
Author: Kevin Hilman khil...@ti.com
Date:   Fri Jan 28 14:38:47 2011 -0800

rebuild PM from branches

The shell script below was used to validate the patch on 2.6.32 for
over 8hrs on OMAP3EVM. The same script has been running after the
patch for past 1 hour on the same EVM.

 test.sh 

#!/bin/sh

if [ ! -d /dbg ]; then
mkdir /dbg
fi

mount -t debugfs debugfs /dbg

echo 1  /dbg/pm_debug/enable_off_mode
echo 1  /dbg/pm_debug/sleep_while_idle
echo 5  /dbg/pm_debug/wakeup_timer_seconds

while :
do
before=`devmem 0x48004D30`
echo mem  /sys/power/state
after=`devmem 0x48004D30`

sleep 2
echo 
echo CM_AUTOIDLE_PLL: before=$before after=$after
echo 
sleep 1
done

 Before 

[root@OMAP3EVM /]# ./test.sh
[   48.089172] PM: Syncing filesystems ... done.
[   48.110656] Freezing user space processes ... (elapsed 0.01 seconds) done.
[   48.135009] Freezing remaining freezable tasks ... (elapsed 0.02 seconds) 
done.
[   48.175598] [ cut here ]
[snip]...removing warning text. Not related to current context...[/snip]
[   48.421356] ---[ end trace 16d570308536c978 ]---
[   48.532165] PM: suspend of devices complete after 361.805 msecs
[snip]...removed more verbose text...[/snip]
[   55.311767] PM: resume of devices complete after 501.922 msecs
[   55.321807] Restarting tasks ... done.

CM_AUTOIDLE_PLL: before=0x0009 after=0x0001

[   59.374603] PM: Syncing filesystems ... done.
[   59.380798] Freezing user space processes ... (elapsed 0.01 seconds) done.
[snip]...removed more verbose text...[/snip]
[   65.085968] PM: resume of devices complete after 501.953 msecs
[   65.095642] Restarting tasks ... done.

CM_AUTOIDLE_PLL: before=0x0001 after=0x0001

[   69.148101] PM: Syncing filesystems ... done.
[   69.154235] Freezing user space processes ... (elapsed 0.01 seconds) done.
[snip]...removed more verbose text...[/snip]
[   74.860839] PM: resume of devices complete after 501.922 msecs
[   74.870544] Restarting tasks ... done.

CM_AUTOIDLE_PLL: before=0x0001 after=0x0001

 After 

[root@OMAP3EVM /]# ./test.sh
[   60.737579] PM: Syncing filesystems ... done.
[   60.758941] Freezing user space processes ... (elapsed 0.01 seconds) done.
[   60.783233] Freezing remaining freezable tasks ... (elapsed 0.02 seconds) 
done.
[   60.819396] omap_device: omap_i2c.1: new worst case activate latency 0: 
152587
[   60.831573] [ cut here ]
[   60.836547] WARNING: at arch/arm/plat-omap/omap-pm-noop.c:326 
omap_pm_get_dev_context_loss_count+0x64/0xb8()
[snip]...removing warning text. Not related to current context...[/snip]
[   61.077392] ---[ end trace 79ed0d21d6b0de0a ]---
[   61.187927] omap_device: omap_i2c.1: new worst case deactivate latency 0: 
61035
[   61.196136] PM: suspend of devices complete after 377.311 msecs
[   61.204650] PM: late suspend of devices complete after 2.258 msecs
[   61.211639] PM: Resume timer in 5.000 secs (163840 ticks at 32768 ticks/sec.)
[   61.219299] omap_device: omap_uart.2: new worst case deactivate latency 0: 
91552
[   66.214691] Successfully put all powerdomains to target state
[   66.222106] PM: early resume of devices complete after 1.220 msecs
[   66.730926] PM: resume of devices complete after 501.983 msecs
[   66.740997] Restarting tasks ... done.
[   66.782165] omap_device: omap_uart.0: new worst case activate latency 0: 
61035

CM_AUTOIDLE_PLL: before=0x0009 after=0x0009

[   70.794433] PM: Syncing filesystems ... done.
[   70.800598] Freezing user space processes ... (elapsed 0.01 seconds) done.
[snip]...removed more verbose text...[/snip]
[   76.505432] PM: resume of devices complete after 501.892 msecs
[   76.515197] Restarting tasks ... done.

CM_AUTOIDLE_PLL: before=0x0009 after=0x0009

[   80.567687] PM: Syncing filesystems ... done.
[   80.573822] Freezing user space processes ... (elapsed 0.01 seconds) done.
[snip]...removed more verbose text...[/snip]
[   86.272399] PM: resume of devices complete after 501.953 msecs
[   86.282165] Restarting tasks ... done.


Sanjeev Premi (1):
  omap3: Save and restore CM_AUTOIDLE_PLL across off mode

 arch/arm/mach-omap2/cm2xxx_3xxx.c |   13 +
 arch/arm/mach-omap2/pm34xx.c  |   25 -
 2 files changed, 37 insertions(+), 1 deletions(-)

-- 
1.7.2.2

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


[PATCH 1/1] omap3: Save and restore CM_AUTOIDLE_PLL across off mode

2011-02-10 Thread Sanjeev Premi
As per commit bb33cc58, ROM code is expected to restore
context related to CORE domain. As part of this change,
CM_AUTOIDLE_PLL is neither saved nor restored.

This results in loosing the value of AUTO_PERIPH_DPLL.

The concern of setting the AUTOIDLE flag before the DPLL
is locked seems valid. Hence, the restoration of this
register is delayed until after the context of PER
domain is restored.

The patch has been verified on OMAP3EVM by checking value
of CM_AUTOIDLE_PLL register across the suspend/resume
sequence (using devmem) with flags sleep_while_idle and
enable_off_mode set to 1.

Signed-off-by: Sanjeev Premi pr...@ti.com
---
 arch/arm/mach-omap2/cm2xxx_3xxx.c |   13 +
 arch/arm/mach-omap2/pm34xx.c  |   25 -
 2 files changed, 37 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-omap2/cm2xxx_3xxx.c 
b/arch/arm/mach-omap2/cm2xxx_3xxx.c
index 96954aa..a775d8a 100644
--- a/arch/arm/mach-omap2/cm2xxx_3xxx.c
+++ b/arch/arm/mach-omap2/cm2xxx_3xxx.c
@@ -178,6 +178,7 @@ struct omap3_cm_regs {
u32 per_cm_clksel;
u32 emu_cm_clksel;
u32 emu_cm_clkstctrl;
+   u32 pll_cm_autoidle;
u32 pll_cm_autoidle2;
u32 pll_cm_clksel4;
u32 pll_cm_clksel5;
@@ -250,6 +251,8 @@ void omap3_cm_save_context(void)
omap2_cm_read_mod_reg(OMAP3430_EMU_MOD, CM_CLKSEL1);
cm_context.emu_cm_clkstctrl =
omap2_cm_read_mod_reg(OMAP3430_EMU_MOD, OMAP2_CM_CLKSTCTRL);
+   cm_context.pll_cm_autoidle =
+omap2_cm_read_mod_reg(PLL_MOD, CM_AUTOIDLE);
cm_context.pll_cm_autoidle2 =
omap2_cm_read_mod_reg(PLL_MOD, CM_AUTOIDLE2);
cm_context.pll_cm_clksel4 =
@@ -468,4 +471,14 @@ void omap3_cm_restore_context(void)
omap2_cm_write_mod_reg(cm_context.cm_clkout_ctrl, OMAP3430_CCR_MOD,
   OMAP3_CM_CLKOUT_CTRL_OFFSET);
 }
+
+
+/**
+ * Returns the value corresponding to CM_AUTOIDLE_PLL from the most recent
+ * context saved before entering the OFF mode.
+ */
+u32 stored_cm_autoidle_pll(void)
+{
+   return cm_context.pll_cm_autoidle;
+}
 #endif
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index 8bb85fb..25bd230 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -91,6 +91,8 @@ static struct powerdomain *mpu_pwrdm, *neon_pwrdm;
 static struct powerdomain *core_pwrdm, *per_pwrdm;
 static struct powerdomain *cam_pwrdm;
 
+extern u32 stored_cm_autoidle_pll(void);
+
 static inline void omap3_per_save_context(void)
 {
omap_gpio_save_context();
@@ -163,6 +165,25 @@ static void omap3_core_restore_context(void)
omap_dma_global_context_restore();
 }
 
+/**
+ * Restore the contents of CM_AUTOIDLE_PLL register.
+ *
+ * The implementation below restores AUTO_CORE_DPLL as 'good' redundancy.
+ */
+static void pll_mod_restore_autoidle(void)
+{
+   u32 ctx = stored_cm_autoidle_pll();
+   u32 val = omap2_cm_read_mod_reg(PLL_MOD, CM_AUTOIDLE);
+
+   if (ctx  OMAP3430_AUTO_CORE_DPLL_MASK)
+   val |= ctx  OMAP3430_AUTO_CORE_DPLL_MASK;
+
+   if (ctx  OMAP3430_AUTO_PERIPH_DPLL_MASK)
+   val |= ctx  OMAP3430_AUTO_PERIPH_DPLL_MASK;
+
+   omap2_cm_write_mod_reg(val, PLL_MOD, CM_AUTOIDLE);
+}
+
 /*
  * FIXME: This function should be called before entering off-mode after
  * OMAP3 secure services have been accessed. Currently it is only called
@@ -488,8 +509,10 @@ void omap_sram_idle(void)
if (per_next_state  PWRDM_POWER_ON) {
per_prev_state = pwrdm_read_prev_pwrst(per_pwrdm);
omap2_gpio_resume_after_idle();
-   if (per_prev_state == PWRDM_POWER_OFF)
+   if (per_prev_state == PWRDM_POWER_OFF) {
omap3_per_restore_context();
+   pll_mod_restore_autoidle();
+   }
omap_uart_resume_idle(2);
omap_uart_resume_idle(3);
}
-- 
1.7.2.2

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


[PATCHv5] omap3: Add basic support for 720MHz part

2011-02-09 Thread Sanjeev Premi
This patch adds support for speed enhanced variant of OMAP35x
processors. These parts allow ARM and IVA running at 720MHz
and 520MHz respectively.

These parts can be detected at runtime by reading contents of
PRODID.SKUID[3:0] at 0x4830A20C [1].

This patch specifically does following:
 * Add new OPP to omap34xx_opp_def_list[] - disabled by default.
 * Detect devices capable of running at new OPP.
 * Enable new OPP only if device supports it.
 * Check for presence of IVA before attempting to enable the
   corresponding OPP.

  [1] http://focus.ti.com/lit/ug/spruff1d/spruff1d.pdf

It appears from discussions (on this patch) that a variant of
OMAP3430 supports this OPP but lacks runtime detection. This
OPP can be enabled for these device by either:
 1) Setting the bit corresponding to OMAP3_HAS_720MHZ
in 'omap3_features'. (Refer changes to id.c)
 2) Removing check for omap3_has_720mhz() before enabling
the OPP. (Refer changes to opp3xxx_data.c)
 3) Calling opp_enable() for 720MHz/VDD1 and 520MHz/VDD2 in
the board file. (Refer changes to opp3xxx_data.c).
This should, ideally, be done before omap3_opp_init() is
called during device_initcall().

CAUTION: This should be done for identified parts only.
 Else, the device could be damaged permanently.

Signed-off-by: Sanjeev Premi pr...@ti.com
Reviewed-by: G, Manjunath Kondaiah manj...@ti.com
---

Since v4:
  Updated the commit text addressing comments from
  Kevin Hilman (khil...@ti.com).

Since v3:
1) Minor changes to comments and braces.
   
Since v2:
1) pr_xxx() - dev_xxx() functions - suggested by 
   Manjunath (manj...@ti.com)
2) Add check for presense of IVA - earlier planned to
   be in a separate patch; but we multiple discussions
   on optimizations.
3) Do look-up for hwmod corresponding for iva only if
   iva is present. Should save multiple strcmp()s in
   _lookup().

Since v1:
1) Using opp_enable() to enable the OPP after the OPP
   table has been initialized.
2) Starting at 3 levels of indent, the statements had
   be broken into multiple lines for most of the code.
   So, opted to create a new static that enables the
   OPPs corresponding to 720MHz.
3) I have only build tested this patch - will be able
   to confirm working tomorrow. With any further change,
   if needed. (However, functionally nothing has changed.)


 arch/arm/mach-omap2/control.h |6 +++
 arch/arm/mach-omap2/id.c  |5 +++
 arch/arm/mach-omap2/opp3xxx_data.c|   63 -
 arch/arm/plat-omap/include/plat/cpu.h |2 +
 4 files changed, 75 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-omap2/control.h b/arch/arm/mach-omap2/control.h
index f0629ae..c338466 100644
--- a/arch/arm/mach-omap2/control.h
+++ b/arch/arm/mach-omap2/control.h
@@ -365,6 +365,12 @@
 #defineFEAT_NEON   0
 #defineFEAT_NEON_NONE  1
 
+/* Product ID register */
+#define OMAP3_PRODID   0x020C
+
+/* Mask to extract SKU ID from Product ID */
+#define OMAP3_SKUID_MASK   0x0f
+#defineOMAP3_SKUID_720MHZ  0x08
 
 #ifndef __ASSEMBLY__
 #ifdef CONFIG_ARCH_OMAP2PLUS
diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index 5f9086c..8c4500f 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -191,6 +191,10 @@ static void __init omap3_check_features(void)
if (!cpu_is_omap3505()  !cpu_is_omap3517())
omap3_features |= OMAP3_HAS_IO_WAKEUP;
 
+   status = (OMAP3_SKUID_MASK  read_tap_reg(OMAP3_PRODID));
+   if (status  OMAP3_SKUID_720MHZ)
+   omap3_features |= OMAP3_HAS_720MHZ;
+
/*
 * TODO: Get additional info (where applicable)
 *   e.g. Size of L2 cache.
@@ -445,6 +449,7 @@ static void __init omap3_cpuinfo(void)
OMAP3_SHOW_FEATURE(neon);
OMAP3_SHOW_FEATURE(isp);
OMAP3_SHOW_FEATURE(192mhz_clk);
+   OMAP3_SHOW_FEATURE(720mhz);
 
printk()\n);
 }
diff --git a/arch/arm/mach-omap2/opp3xxx_data.c 
b/arch/arm/mach-omap2/opp3xxx_data.c
index 0486fce..cba17f7 100644
--- a/arch/arm/mach-omap2/opp3xxx_data.c
+++ b/arch/arm/mach-omap2/opp3xxx_data.c
@@ -17,8 +17,10 @@
  * GNU General Public License for more details.
  */
 #include linux/module.h
+#include linux/opp.h
 
 #include plat/cpu.h
+#include plat/omap_device.h
 
 #include omap_opp_data.h
 
@@ -33,6 +35,8 @@ static struct omap_opp_def __initdata omap34xx_opp_def_list[] 
= {
OPP_INITIALIZER(mpu, true, 55000, 127),
/* MPU OPP5 */
OPP_INITIALIZER(mpu, true, 6, 135),
+   /* MPU OPP6 */
+   OPP_INITIALIZER(mpu, false, 72000, 135),
 
/*
 * L3 OPP1 - 41.5 MHz is disabled because: The voltage for that OPP is
@@ -58,6 +62,8 @@ static struct omap_opp_def __initdata omap34xx_opp_def_list[] 
= {
OPP_INITIALIZER(iva, true, 4, 127),
/* DSP OPP5

[PATCHv5] omap3: Add basic support for 720MHz part

2011-01-27 Thread Sanjeev Premi
This patch adds support for speed enhanced variant of OMAP35x
processors. These parts allow ARM and IVA running at 720MHz
and 520MHz respectively.

These parts can be detected at runtime by reading contents of
PRODID.SKUID[3:0] at 0x4830A20C [1].

This patch specifically does following:
 * Add new OPP to omap34xx_opp_def_list[] - disabled by default.
 * Detect devices capable of running at new OPP.
 * Enable new OPP only if device supports it.
 * Check for presence of IVA before attempting to enable the
   corresponding OPP.

  [1] http://focus.ti.com/lit/ug/spruff1d/spruff1d.pdf

It appears from discussions (on this patch) that a variant of
OMAP3430 supports this OPP but lacks runtime detection. This
OPP can be enabled for these device by either:
 1) Setting the bit corresponding to OMAP3_HAS_720MHZ
in 'omap3_features'. (Refer changes to id.c)
 2) Removing check for omap3_has_720mhz() before enabling
the OPP. (Refer changes to opp3xxx_data.c)
 3) Calling opp_enable() for 720MHz/VDD1 and 520MHz/VDD2 in
the board file. (Refer changes to opp3xxx_data.c).
This should, ideally, be done before omap3_opp_init() is
called during device_initcall().

CAUTION: This should be done for identified parts only.
 Else, the device could be damaged permanently.

Signed-off-by: Sanjeev Premi pr...@ti.com
Reviewed-by: G, Manjunath Kondaiah manj...@ti.com
---

Since v4:
  Updated the commit text addressing comments from
  Kevin Hilman (khil...@ti.com).

Since v3:
1) Minor changes to comments and braces.
   
Since v2:
1) pr_xxx() - dev_xxx() functions - suggested by 
   Manjunath (manj...@ti.com)
2) Add check for presense of IVA - earlier planned to
   be in a separate patch; but we multiple discussions
   on optimizations.
3) Do look-up for hwmod corresponding for iva only if
   iva is present. Should save multiple strcmp()s in
   _lookup().

Since v1:
1) Using opp_enable() to enable the OPP after the OPP
   table has been initialized.
2) Starting at 3 levels of indent, the statements had
   be broken into multiple lines for most of the code.
   So, opted to create a new static that enables the
   OPPs corresponding to 720MHz.
3) I have only build tested this patch - will be able
   to confirm working tomorrow. With any further change,
   if needed. (However, functionally nothing has changed.)


 arch/arm/mach-omap2/control.h |6 +++
 arch/arm/mach-omap2/id.c  |5 +++
 arch/arm/mach-omap2/opp3xxx_data.c|   63 -
 arch/arm/plat-omap/include/plat/cpu.h |2 +
 4 files changed, 75 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-omap2/control.h b/arch/arm/mach-omap2/control.h
index f0629ae..c338466 100644
--- a/arch/arm/mach-omap2/control.h
+++ b/arch/arm/mach-omap2/control.h
@@ -365,6 +365,12 @@
 #defineFEAT_NEON   0
 #defineFEAT_NEON_NONE  1
 
+/* Product ID register */
+#define OMAP3_PRODID   0x020C
+
+/* Mask to extract SKU ID from Product ID */
+#define OMAP3_SKUID_MASK   0x0f
+#defineOMAP3_SKUID_720MHZ  0x08
 
 #ifndef __ASSEMBLY__
 #ifdef CONFIG_ARCH_OMAP2PLUS
diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index 5f9086c..8c4500f 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -191,6 +191,10 @@ static void __init omap3_check_features(void)
if (!cpu_is_omap3505()  !cpu_is_omap3517())
omap3_features |= OMAP3_HAS_IO_WAKEUP;
 
+   status = (OMAP3_SKUID_MASK  read_tap_reg(OMAP3_PRODID));
+   if (status  OMAP3_SKUID_720MHZ)
+   omap3_features |= OMAP3_HAS_720MHZ;
+
/*
 * TODO: Get additional info (where applicable)
 *   e.g. Size of L2 cache.
@@ -445,6 +449,7 @@ static void __init omap3_cpuinfo(void)
OMAP3_SHOW_FEATURE(neon);
OMAP3_SHOW_FEATURE(isp);
OMAP3_SHOW_FEATURE(192mhz_clk);
+   OMAP3_SHOW_FEATURE(720mhz);
 
printk()\n);
 }
diff --git a/arch/arm/mach-omap2/opp3xxx_data.c 
b/arch/arm/mach-omap2/opp3xxx_data.c
index 0486fce..cba17f7 100644
--- a/arch/arm/mach-omap2/opp3xxx_data.c
+++ b/arch/arm/mach-omap2/opp3xxx_data.c
@@ -17,8 +17,10 @@
  * GNU General Public License for more details.
  */
 #include linux/module.h
+#include linux/opp.h
 
 #include plat/cpu.h
+#include plat/omap_device.h
 
 #include omap_opp_data.h
 
@@ -33,6 +35,8 @@ static struct omap_opp_def __initdata omap34xx_opp_def_list[] 
= {
OPP_INITIALIZER(mpu, true, 55000, 127),
/* MPU OPP5 */
OPP_INITIALIZER(mpu, true, 6, 135),
+   /* MPU OPP6 */
+   OPP_INITIALIZER(mpu, false, 72000, 135),
 
/*
 * L3 OPP1 - 41.5 MHz is disabled because: The voltage for that OPP is
@@ -58,6 +62,8 @@ static struct omap_opp_def __initdata omap34xx_opp_def_list[] 
= {
OPP_INITIALIZER(iva, true, 4, 127),
/* DSP OPP5

[PATCHv4] omap3: Add basic support for 720MHz part

2011-01-20 Thread Sanjeev Premi
This patch adds support for new speed enhanced parts with ARM
and IVA running at 720MHz and 520MHz respectively. These parts
can be probed at run-time by reading PRODID.SKUID[3:0] at
0x4830A20C [1].

This patch specifically does following:
 * Detect devices capable of 720MHz.
 * Add new OPP
 * Ensure that OPP is conditionally enabled.
 * Check for presence of IVA before attempting to enable
   the corresponding OPP.

  [1] http://focus.ti.com/lit/ug/spruff1d/spruff1d.pdf

Signed-off-by: Sanjeev Premi pr...@ti.com
---
Since v3:
1) Minor changes to comments and braces.
   
Since v2:
1) pr_xxx() - dev_xxx() functions - suggested by 
   Manjunath (manj...@ti.com)
2) Add check for presense of IVA - earlier planned to
   be in a separate patch; but we multiple discussions
   on optimizations.
3) Do look-up for hwmod corresponding for iva only if
   iva is present. Should save multiple strcmp()s in
   _lookup().

Since v1:
1) Using opp_enable() to enable the OPP after the OPP
   table has been initialized.
2) Starting at 3 levels of indent, the statements had
   be broken into multiple lines for most of the code.
   So, opted to create a new static that enables the
   OPPs corresponding to 720MHz.
3) I have only build tested this patch - will be able
   to confirm working tomorrow. With any further change,
   if needed. (However, functionally nothing has changed.)


 arch/arm/mach-omap2/control.h |6 +++
 arch/arm/mach-omap2/id.c  |5 +++
 arch/arm/mach-omap2/opp3xxx_data.c|   63 -
 arch/arm/plat-omap/include/plat/cpu.h |2 +
 4 files changed, 75 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-omap2/control.h b/arch/arm/mach-omap2/control.h
index f0629ae..c338466 100644
--- a/arch/arm/mach-omap2/control.h
+++ b/arch/arm/mach-omap2/control.h
@@ -365,6 +365,12 @@
 #defineFEAT_NEON   0
 #defineFEAT_NEON_NONE  1
 
+/* Product ID register */
+#define OMAP3_PRODID   0x020C
+
+/* Mask to extract SKU ID from Product ID */
+#define OMAP3_SKUID_MASK   0x0f
+#defineOMAP3_SKUID_720MHZ  0x08
 
 #ifndef __ASSEMBLY__
 #ifdef CONFIG_ARCH_OMAP2PLUS
diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index 5f9086c..8c4500f 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -191,6 +191,10 @@ static void __init omap3_check_features(void)
if (!cpu_is_omap3505()  !cpu_is_omap3517())
omap3_features |= OMAP3_HAS_IO_WAKEUP;
 
+   status = (OMAP3_SKUID_MASK  read_tap_reg(OMAP3_PRODID));
+   if (status  OMAP3_SKUID_720MHZ)
+   omap3_features |= OMAP3_HAS_720MHZ;
+
/*
 * TODO: Get additional info (where applicable)
 *   e.g. Size of L2 cache.
@@ -445,6 +449,7 @@ static void __init omap3_cpuinfo(void)
OMAP3_SHOW_FEATURE(neon);
OMAP3_SHOW_FEATURE(isp);
OMAP3_SHOW_FEATURE(192mhz_clk);
+   OMAP3_SHOW_FEATURE(720mhz);
 
printk()\n);
 }
diff --git a/arch/arm/mach-omap2/opp3xxx_data.c 
b/arch/arm/mach-omap2/opp3xxx_data.c
index 0486fce..cba17f7 100644
--- a/arch/arm/mach-omap2/opp3xxx_data.c
+++ b/arch/arm/mach-omap2/opp3xxx_data.c
@@ -17,8 +17,10 @@
  * GNU General Public License for more details.
  */
 #include linux/module.h
+#include linux/opp.h
 
 #include plat/cpu.h
+#include plat/omap_device.h
 
 #include omap_opp_data.h
 
@@ -33,6 +35,8 @@ static struct omap_opp_def __initdata omap34xx_opp_def_list[] 
= {
OPP_INITIALIZER(mpu, true, 55000, 127),
/* MPU OPP5 */
OPP_INITIALIZER(mpu, true, 6, 135),
+   /* MPU OPP6 */
+   OPP_INITIALIZER(mpu, false, 72000, 135),
 
/*
 * L3 OPP1 - 41.5 MHz is disabled because: The voltage for that OPP is
@@ -58,6 +62,8 @@ static struct omap_opp_def __initdata omap34xx_opp_def_list[] 
= {
OPP_INITIALIZER(iva, true, 4, 127),
/* DSP OPP5 */
OPP_INITIALIZER(iva, true, 43000, 135),
+   /* DSP OPP6 */
+   OPP_INITIALIZER(iva, false, 52000, 135),
 };
 
 static struct omap_opp_def __initdata omap36xx_opp_def_list[] = {
@@ -85,6 +91,57 @@ static struct omap_opp_def __initdata 
omap36xx_opp_def_list[] = {
OPP_INITIALIZER(iva, false, 8, 1375000),
 };
 
+
+/**
+ * omap3_opp_enable_720Mhz() - Enable the OPP corresponding to 720MHz
+ *
+ * This function would be executed only if the silicon is capable of
+ * running at the 720MHz.
+ */
+static int __init omap3_opp_enable_720Mhz(void)
+{
+   int r = -ENODEV;
+   struct omap_hwmod *oh_mpu = omap_hwmod_lookup(mpu);
+   struct omap_hwmod *oh_iva;
+   struct platform_device *pdev;
+
+   if (!oh_mpu || !oh_mpu-od) {
+   goto err;
+   } else {
+   pdev = oh_mpu-od-pdev;
+
+   r = opp_enable(pdev-dev, 72000);
+   if (r  0

[PATCH] omap3: Add basic support for 720MHz part

2011-01-17 Thread Sanjeev Premi
This patch adds support for new speed enhanced parts with ARM
and IVA running at 720MHz and 520MHz respectively. These parts
can be probed at run-time by reading PRODID.SKUID[3:0] at
0x4830A20C [1].

This patch specifically does following:
 * Detect devices capable of 720MHz.
 * Add new OPP
 * Ensure that OPP is conditionally enabled.
 * Check for presence of IVA before attempting to enable
   the corresponding OPP.

  [1] http://focus.ti.com/lit/ug/spruff1d/spruff1d.pdf

Signed-off-by: Sanjeev Premi pr...@ti.com
---
Since v2:
1) pr_xxx() - dev_xxx() functions - suggested by 
   Manjunath (manj...@ti.com)
2) Add check for presense of IVA - earlier planned to
   be in a separate patch; but we multiple discussions
   on optimizations.
3) Do look-up for hwmod corresponding for iva only if
   iva is present. Should save multiple strcmp()s in
   _lookup().

Since v1:
1) Using opp_enable() to enable the OPP after the OPP
   table has been initialized.
2) Starting at 3 levels of indent, the statements had
   be broken into multiple lines for most of the code.
   So, opted to create a new static that enables the
   OPPs corresponding to 720MHz.
3) I have only build tested this patch - will be able
   to confirm working tomorrow. With any further change,
   if needed. (However, functionally nothing has changed.)


 arch/arm/mach-omap2/control.h |7 
 arch/arm/mach-omap2/id.c  |   10 +
 arch/arm/mach-omap2/opp3xxx_data.c|   63 -
 arch/arm/plat-omap/include/plat/cpu.h |2 +
 4 files changed, 81 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-omap2/control.h b/arch/arm/mach-omap2/control.h
index f0629ae..eebc045 100644
--- a/arch/arm/mach-omap2/control.h
+++ b/arch/arm/mach-omap2/control.h
@@ -365,6 +365,13 @@
 #defineFEAT_NEON   0
 #defineFEAT_NEON_NONE  1
 
+/*
+ * Product ID register
+ */
+#define OMAP3_PRODID   0x020C
+
+#define OMAP3_SKUID_MASK   0x0f
+#defineOMAP3_SKUID_720MHZ  0x08
 
 #ifndef __ASSEMBLY__
 #ifdef CONFIG_ARCH_OMAP2PLUS
diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index 5f9086c..53fbe01 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -195,6 +195,15 @@ static void __init omap3_check_features(void)
 * TODO: Get additional info (where applicable)
 *   e.g. Size of L2 cache.
 */
+
+   /*
+* Does it support 720MHz?
+*/
+   status = (OMAP3_SKUID_MASK  read_tap_reg(OMAP3_PRODID));
+
+   if (status  OMAP3_SKUID_720MHZ) {
+   omap3_features |= OMAP3_HAS_720MHZ;
+   }
 }
 
 static void __init omap3_check_revision(void)
@@ -445,6 +454,7 @@ static void __init omap3_cpuinfo(void)
OMAP3_SHOW_FEATURE(neon);
OMAP3_SHOW_FEATURE(isp);
OMAP3_SHOW_FEATURE(192mhz_clk);
+   OMAP3_SHOW_FEATURE(720mhz);
 
printk()\n);
 }
diff --git a/arch/arm/mach-omap2/opp3xxx_data.c 
b/arch/arm/mach-omap2/opp3xxx_data.c
index 0486fce..cba17f7 100644
--- a/arch/arm/mach-omap2/opp3xxx_data.c
+++ b/arch/arm/mach-omap2/opp3xxx_data.c
@@ -17,8 +17,10 @@
  * GNU General Public License for more details.
  */
 #include linux/module.h
+#include linux/opp.h
 
 #include plat/cpu.h
+#include plat/omap_device.h
 
 #include omap_opp_data.h
 
@@ -33,6 +35,8 @@ static struct omap_opp_def __initdata omap34xx_opp_def_list[] 
= {
OPP_INITIALIZER(mpu, true, 55000, 127),
/* MPU OPP5 */
OPP_INITIALIZER(mpu, true, 6, 135),
+   /* MPU OPP6 */
+   OPP_INITIALIZER(mpu, false, 72000, 135),
 
/*
 * L3 OPP1 - 41.5 MHz is disabled because: The voltage for that OPP is
@@ -58,6 +62,8 @@ static struct omap_opp_def __initdata omap34xx_opp_def_list[] 
= {
OPP_INITIALIZER(iva, true, 4, 127),
/* DSP OPP5 */
OPP_INITIALIZER(iva, true, 43000, 135),
+   /* DSP OPP6 */
+   OPP_INITIALIZER(iva, false, 52000, 135),
 };
 
 static struct omap_opp_def __initdata omap36xx_opp_def_list[] = {
@@ -85,6 +91,57 @@ static struct omap_opp_def __initdata 
omap36xx_opp_def_list[] = {
OPP_INITIALIZER(iva, false, 8, 1375000),
 };
 
+
+/**
+ * omap3_opp_enable_720Mhz() - Enable the OPP corresponding to 720MHz
+ *
+ * This function would be executed only if the silicon is capable of
+ * running at the 720MHz.
+ */
+static int __init omap3_opp_enable_720Mhz(void)
+{
+   int r = -ENODEV;
+   struct omap_hwmod *oh_mpu = omap_hwmod_lookup(mpu);
+   struct omap_hwmod *oh_iva;
+   struct platform_device *pdev;
+
+   if (!oh_mpu || !oh_mpu-od) {
+   goto err;
+   } else {
+   pdev = oh_mpu-od-pdev;
+
+   r = opp_enable(pdev-dev, 72000);
+   if (r  0) {
+   dev_err(pdev-dev,
+   opp_enable() failed

[PATCHv2] omap3: Add basic support for 720MHz part

2011-01-12 Thread Sanjeev Premi
This patch adds support for new speed enhanced parts with ARM
and IVA running at 720MHz and 520MHz respectively. These parts
can be probed at run-time by reading PRODID.SKUID[3:0] at
0x4830A20C [1].

This patch specifically doe following:
 * Detect devices capable of 720MHz.
 * Add new OPP
 * Ensure that OPP is conditionally enabled.

  [1] http://focus.ti.com/lit/ug/spruff1d/spruff1d.pdf

Signed-off-by: Sanjeev Premi pr...@ti.com
---
Since last revision:
1) Using opp_enable() to enable the OPP after the OPP
   table has been initialized.
2) Starting at 3 levels of indent, the statements had
   be broken into multiple lines for most of the code.
   So, opted to create a new static that enables the
   OPPs corresponding to 720MHz.
3) I have only build tested this patch - will be able
   to confirm working tomorrow. With any further change,
   if needed. (However, functionally nothing has changed.)

 arch/arm/mach-omap2/control.h |7 
 arch/arm/mach-omap2/id.c  |   10 ++
 arch/arm/mach-omap2/opp3xxx_data.c|   53 -
 arch/arm/plat-omap/include/plat/cpu.h |2 +
 4 files changed, 71 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-omap2/control.h b/arch/arm/mach-omap2/control.h
index f0629ae..eebc045 100644
--- a/arch/arm/mach-omap2/control.h
+++ b/arch/arm/mach-omap2/control.h
@@ -365,6 +365,13 @@
 #defineFEAT_NEON   0
 #defineFEAT_NEON_NONE  1
 
+/*
+ * Product ID register
+ */
+#define OMAP3_PRODID   0x020C
+
+#define OMAP3_SKUID_MASK   0x0f
+#defineOMAP3_SKUID_720MHZ  0x08
 
 #ifndef __ASSEMBLY__
 #ifdef CONFIG_ARCH_OMAP2PLUS
diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index 5f9086c..53fbe01 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -195,6 +195,15 @@ static void __init omap3_check_features(void)
 * TODO: Get additional info (where applicable)
 *   e.g. Size of L2 cache.
 */
+
+   /*
+* Does it support 720MHz?
+*/
+   status = (OMAP3_SKUID_MASK  read_tap_reg(OMAP3_PRODID));
+
+   if (status  OMAP3_SKUID_720MHZ) {
+   omap3_features |= OMAP3_HAS_720MHZ;
+   }
 }
 
 static void __init omap3_check_revision(void)
@@ -445,6 +454,7 @@ static void __init omap3_cpuinfo(void)
OMAP3_SHOW_FEATURE(neon);
OMAP3_SHOW_FEATURE(isp);
OMAP3_SHOW_FEATURE(192mhz_clk);
+   OMAP3_SHOW_FEATURE(720mhz);
 
printk()\n);
 }
diff --git a/arch/arm/mach-omap2/opp3xxx_data.c 
b/arch/arm/mach-omap2/opp3xxx_data.c
index 0486fce..9405c3f 100644
--- a/arch/arm/mach-omap2/opp3xxx_data.c
+++ b/arch/arm/mach-omap2/opp3xxx_data.c
@@ -17,8 +17,10 @@
  * GNU General Public License for more details.
  */
 #include linux/module.h
+#include linux/opp.h
 
 #include plat/cpu.h
+#include plat/omap_device.h
 
 #include omap_opp_data.h
 
@@ -33,6 +35,8 @@ static struct omap_opp_def __initdata omap34xx_opp_def_list[] 
= {
OPP_INITIALIZER(mpu, true, 55000, 127),
/* MPU OPP5 */
OPP_INITIALIZER(mpu, true, 6, 135),
+   /* MPU OPP6 */
+   OPP_INITIALIZER(mpu, false, 72000, 135),
 
/*
 * L3 OPP1 - 41.5 MHz is disabled because: The voltage for that OPP is
@@ -58,6 +62,8 @@ static struct omap_opp_def __initdata omap34xx_opp_def_list[] 
= {
OPP_INITIALIZER(iva, true, 4, 127),
/* DSP OPP5 */
OPP_INITIALIZER(iva, true, 43000, 135),
+   /* DSP OPP6 */
+   OPP_INITIALIZER(iva, false, 52000, 135),
 };
 
 static struct omap_opp_def __initdata omap36xx_opp_def_list[] = {
@@ -85,6 +91,46 @@ static struct omap_opp_def __initdata 
omap36xx_opp_def_list[] = {
OPP_INITIALIZER(iva, false, 8, 1375000),
 };
 
+
+/**
+ * omap3_opp_enable_720Mhz() - Enable the OPP corresponding to 720MHz
+ *
+ * This function would be executed only if the silicon is capable of
+ * running at the 720MHz.
+ */
+static int __init omap3_opp_enable_720Mhz(void)
+{
+   int r = -ENODEV;
+   struct omap_hwmod *oh_mpu = omap_hwmod_lookup(mpu);
+   struct omap_hwmod *oh_iva = omap_hwmod_lookup(iva);
+
+   if (!oh_mpu || !oh_mpu-od) {
+   goto err;
+   } else {
+   r = opp_enable((oh_mpu-od-pdev.dev), 72000);
+   if (r  0) {
+   pr_err(%s: Unable to enable OPP for mpu., __func__);
+   goto err;
+   }
+   }
+
+   if (!oh_iva || !oh_iva-od) {
+   r = -ENODEV;
+   goto err;
+   } else {
+   r = opp_enable((oh_iva-od-pdev.dev), 52000);
+   if (r  0) {
+   pr_err(%s: Unable to enable OPP for iva., __func__);
+   goto err;
+   }
+   }
+
+   pr_info(Enabled OPP corresponding to 720MHz\n);
+
+err

[PATCH] omap3: Add basic support for 720MHz part

2011-01-07 Thread Sanjeev Premi
This patch adds support for new speed enhanced parts with ARM
and IVA running at 720MHz and 520MHz respectively. These parts
can be probed at run-time by reading PRODID.SKUID[3:0] at
0x4830A20C [1].

This patch specifically does following:
 * Detect devices capable of 720MHz.
 * Add new OPP
 * Ensure that OPP is conditionally enabled.

The patch was tested on OMAP3EVM.

On 720MHz capable device:
# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
72

On other devices:
# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
60

  [1] http://focus.ti.com/lit/ug/spruff1d/spruff1d.pdf

Signed-off-by: Sanjeev Premi pr...@ti.com
---
 arch/arm/mach-omap2/control.h |7 +++
 arch/arm/mach-omap2/id.c  |   10 ++
 arch/arm/mach-omap2/opp3xxx_data.c|   19 ++-
 arch/arm/plat-omap/include/plat/cpu.h |2 ++
 4 files changed, 37 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-omap2/control.h b/arch/arm/mach-omap2/control.h
index f0629ae..eebc045 100644
--- a/arch/arm/mach-omap2/control.h
+++ b/arch/arm/mach-omap2/control.h
@@ -365,6 +365,13 @@
 #defineFEAT_NEON   0
 #defineFEAT_NEON_NONE  1
 
+/*
+ * Product ID register
+ */
+#define OMAP3_PRODID   0x020C
+
+#define OMAP3_SKUID_MASK   0x0f
+#defineOMAP3_SKUID_720MHZ  0x08
 
 #ifndef __ASSEMBLY__
 #ifdef CONFIG_ARCH_OMAP2PLUS
diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index 5f9086c..53fbe01 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -195,6 +195,15 @@ static void __init omap3_check_features(void)
 * TODO: Get additional info (where applicable)
 *   e.g. Size of L2 cache.
 */
+
+   /*
+* Does it support 720MHz?
+*/
+   status = (OMAP3_SKUID_MASK  read_tap_reg(OMAP3_PRODID));
+
+   if (status  OMAP3_SKUID_720MHZ) {
+   omap3_features |= OMAP3_HAS_720MHZ;
+   }
 }
 
 static void __init omap3_check_revision(void)
@@ -445,6 +454,7 @@ static void __init omap3_cpuinfo(void)
OMAP3_SHOW_FEATURE(neon);
OMAP3_SHOW_FEATURE(isp);
OMAP3_SHOW_FEATURE(192mhz_clk);
+   OMAP3_SHOW_FEATURE(720mhz);
 
printk()\n);
 }
diff --git a/arch/arm/mach-omap2/opp3xxx_data.c 
b/arch/arm/mach-omap2/opp3xxx_data.c
index 0486fce..01582b7 100644
--- a/arch/arm/mach-omap2/opp3xxx_data.c
+++ b/arch/arm/mach-omap2/opp3xxx_data.c
@@ -22,6 +22,9 @@
 
 #include omap_opp_data.h
 
+#define INDEX_MPU_720MHZ   5
+#define INDEX_IVA_720MHZ   14
+
 static struct omap_opp_def __initdata omap34xx_opp_def_list[] = {
/* MPU OPP1 */
OPP_INITIALIZER(mpu, true, 12500, 975000),
@@ -33,6 +36,8 @@ static struct omap_opp_def __initdata omap34xx_opp_def_list[] 
= {
OPP_INITIALIZER(mpu, true, 55000, 127),
/* MPU OPP5 */
OPP_INITIALIZER(mpu, true, 6, 135),
+   /* MPU OPP6 */
+   OPP_INITIALIZER(mpu, false, 72000, 135),
 
/*
 * L3 OPP1 - 41.5 MHz is disabled because: The voltage for that OPP is
@@ -58,6 +63,8 @@ static struct omap_opp_def __initdata omap34xx_opp_def_list[] 
= {
OPP_INITIALIZER(iva, true, 4, 127),
/* DSP OPP5 */
OPP_INITIALIZER(iva, true, 43000, 135),
+   /* DSP OPP6 */
+   OPP_INITIALIZER(iva, false, 52000, 135),
 };
 
 static struct omap_opp_def __initdata omap36xx_opp_def_list[] = {
@@ -98,9 +105,19 @@ static int __init omap3_opp_init(void)
if (cpu_is_omap3630())
r = omap_init_opp_table(omap36xx_opp_def_list,
ARRAY_SIZE(omap36xx_opp_def_list));
-   else
+   else {
+   if (omap3_has_720mhz()) {
+   pr_info(Enabled OPP corresponding to 720MHz\n);
+
+   omap34xx_opp_def_list[INDEX_MPU_720MHZ]
+   .default_available = true;
+   omap34xx_opp_def_list[INDEX_IVA_720MHZ]
+   .default_available = true;
+   }
+
r = omap_init_opp_table(omap34xx_opp_def_list,
ARRAY_SIZE(omap34xx_opp_def_list));
+   }
 
return r;
 }
diff --git a/arch/arm/plat-omap/include/plat/cpu.h 
b/arch/arm/plat-omap/include/plat/cpu.h
index 3fd8b40..5c77987 100644
--- a/arch/arm/plat-omap/include/plat/cpu.h
+++ b/arch/arm/plat-omap/include/plat/cpu.h
@@ -455,6 +455,7 @@ extern u32 omap3_features;
 #define OMAP3_HAS_ISP  BIT(4)
 #define OMAP3_HAS_192MHZ_CLK   BIT(5)
 #define OMAP3_HAS_IO_WAKEUPBIT(6)
+#define OMAP3_HAS_720MHZ   BIT(7)
 
 #define OMAP3_HAS_FEATURE(feat,flag)   \
 static inline unsigned int omap3_has_ ##feat(void) \
@@ -469,5 +470,6 @@ OMAP3_HAS_FEATURE(neon, NEON)
 OMAP3_HAS_FEATURE(isp, ISP)
 OMAP3_HAS_FEATURE(192mhz_clk

[RFC] omap3: Enable SmartReflex calculations for 720MHz

2011-01-07 Thread Sanjeev Premi
The eFuse registers do not contain the nValue to be used
with 720MHz (OPP6). This patch implements procedure to
calculate the nValue(OPP6) based on the nValue(OPP5).

  [1] SPRUFF1D-June 2009 section 1.5.2.1.1

This is first attempt to fit this mechanism into new
smartreflex framework. Do note a FIXME which is added
to illustrate the calculations; and express need for
a mechanism to get nValues for each OPP.

Signed-off-by: Sanjeev Premi pr...@ti.com
---
 arch/arm/mach-omap2/sr_device.c   |   54 +
 arch/arm/mach-omap2/voltage.c |1 +
 arch/arm/plat-omap/include/plat/voltage.h |1 +
 3 files changed, 56 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/sr_device.c b/arch/arm/mach-omap2/sr_device.c
index 786d685..43640a3 100644
--- a/arch/arm/mach-omap2/sr_device.c
+++ b/arch/arm/mach-omap2/sr_device.c
@@ -38,6 +38,51 @@ static struct omap_device_pm_latency omap_sr_latency[] = {
},
 };
 
+static void swcalc_opp6_RG(u32 rFuse, u32 gainFuse, u32 deltaNT,
+   u32* rAdj, u32* gainAdj)
+{
+   u32 nAdj;
+   u32 g, r;
+
+   nAdj = ((1  (gainFuse + 8))/rFuse) + deltaNT;
+
+   for (g = 0; g  GAIN_MAXLIMIT; g++) {
+   r = (1  (g + 8)) / nAdj;
+   if (r  256) {
+   *rAdj = r;
+   *gainAdj = g;
+   }
+   }
+}
+
+#define SWCALC_OPP6_DELTA_NNT  379
+#define SWCALC_OPP6_DELTA_PNT  227
+#define GAIN_MAXLIMIT  16
+
+static u32 swcalc_opp6_nvalue(u32 opp5_nvalue)
+{
+   u32 opp6_nvalue;
+   u32 opp5_senPgain, opp5_senNgain, opp5_senPRN, opp5_senNRN;
+   u32 opp6_senPgain, opp6_senNgain, opp6_senPRN, opp6_senNRN;
+
+   opp5_senPgain = (opp5_nvalue  0x00f0)  0x14;
+   opp5_senNgain = (opp5_nvalue  0x000f)  0x10;
+
+   opp5_senPRN = (opp5_nvalue  0xff00)  0x8;
+   opp5_senNRN = (opp5_nvalue  0x00ff);
+
+   swcalc_opp6_RG(opp5_senNRN, opp5_senNgain, SWCALC_OPP6_DELTA_NNT,
+   opp6_senNRN, opp6_senNgain);
+
+   swcalc_opp6_RG(opp5_senPRN, opp5_senPgain, SWCALC_OPP6_DELTA_PNT,
+   opp6_senPRN, opp6_senPgain);
+
+   opp6_nvalue = (opp6_senPgain  0x14) | (opp6_senNgain  0x10) |
+   (opp6_senPRN  0x8) | opp6_senNRN;
+
+   return opp6_nvalue;
+}
+
 /* Read EFUSE values from control registers for OMAP3430 */
 static void __init sr_set_nvalues(struct omap_volt_data *volt_data,
struct omap_sr_data *sr_data)
@@ -72,6 +117,15 @@ static void __init sr_set_nvalues(struct omap_volt_data 
*volt_data,
nvalue_table[i].nvalue = v;
}
 
+   /*
+* FIXME: This is a temporary hack. Need to identify better
+*mechanism to find nvalues corresponding to an OPP.
+*/
+   if (cpu_is_omap34xx()  omap3_has_720mhz()) {
+   nvalue_table[count-1].nvalue = swcalc_opp6_nvalue(
+   nvalue_table[count-2].nvalue);
+   }
+
sr_data-nvalue_table = nvalue_table;
sr_data-nvalue_count = count;
 }
diff --git a/arch/arm/mach-omap2/voltage.c b/arch/arm/mach-omap2/voltage.c
index ed6079c..f23b6d7 100644
--- a/arch/arm/mach-omap2/voltage.c
+++ b/arch/arm/mach-omap2/voltage.c
@@ -258,6 +258,7 @@ static struct omap_volt_data omap34xx_vddmpu_volt_data[] = {
VOLT_DATA_DEFINE(OMAP3430_VDD_MPU_OPP3_UV, 
OMAP343X_CONTROL_FUSE_OPP3_VDD1, 0xf9, 0x18),
VOLT_DATA_DEFINE(OMAP3430_VDD_MPU_OPP4_UV, 
OMAP343X_CONTROL_FUSE_OPP4_VDD1, 0xf9, 0x18),
VOLT_DATA_DEFINE(OMAP3430_VDD_MPU_OPP5_UV, 
OMAP343X_CONTROL_FUSE_OPP5_VDD1, 0xf9, 0x18),
+   VOLT_DATA_DEFINE(OMAP3430_VDD_MPU_OPP6_UV, 
OMAP343X_CONTROL_FUSE_OPP5_VDD1, 0xf9, 0x18),
VOLT_DATA_DEFINE(0, 0, 0, 0),
 };
 
diff --git a/arch/arm/plat-omap/include/plat/voltage.h 
b/arch/arm/plat-omap/include/plat/voltage.h
index 0ff1233..f3f87a6 100644
--- a/arch/arm/plat-omap/include/plat/voltage.h
+++ b/arch/arm/plat-omap/include/plat/voltage.h
@@ -31,6 +31,7 @@
 #define OMAP3430_VDD_MPU_OPP3_UV   120
 #define OMAP3430_VDD_MPU_OPP4_UV   127
 #define OMAP3430_VDD_MPU_OPP5_UV   135
+#define OMAP3430_VDD_MPU_OPP6_UV135
 
 #define OMAP3430_VDD_CORE_OPP1_UV  975000
 #define OMAP3430_VDD_CORE_OPP2_UV  105
-- 
1.7.2.2

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


[PATCHv2 0/1] omap2/3: Update revision identification

2010-09-24 Thread Sanjeev Premi
This patch unifies the definition of revision bits that
are were using different base (nibble) since revision bits
for OMAP3630 were defined.

The changes are:
1) Common definition of revision bits starting at lower
   nibble.
2) Generic CLASS has been defined for each processor in
   the OMAP family.
3) Revision bits are ORed with processor class to complete
   the identification.

This patch version addresses all comments and suggetions
by Tony[1] and adds support to identify AM3505/17 ES1.1.

  [1] http://marc.info/?l=linux-omapm=128526100030661w=2

The patch has been tested against these processors:
 * OMAP3630 ES1.1
 * OMAP3530 ES3.1
 * AM3517 ES1.0
 * AM3517 ES1.1

Sanjeev Premi (1):
  omap2/3: Update revision identification

 arch/arm/mach-omap2/id.c  |   72 ++---
 arch/arm/plat-omap/include/plat/cpu.h |   36 
 2 files changed, 66 insertions(+), 42 deletions(-)

-- 
1.7.2.2

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


[PATCHv2 1/1] omap2/3: Update revision identification

2010-09-24 Thread Sanjeev Premi
The existing definitions for cpu revision used
upper nibble in the bits[15:08]. With OMAP3630,
definitions use lower nibble.

This patch unifies the definitions to start
at lower nibble.

  [1] http://marc.info/?t=12816173915r=1w=2

Signed-off-by: Sanjeev Premi pr...@ti.com
---
 arch/arm/mach-omap2/id.c  |   72 ++---
 arch/arm/plat-omap/include/plat/cpu.h |   36 
 2 files changed, 66 insertions(+), 42 deletions(-)

diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index 9a879f9..196f3ee 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -361,30 +361,54 @@ static void __init omap3_cpuinfo(void)
strcpy(cpu_name, OMAP3503);
}
 
-   switch (rev) {
-   case OMAP_REVBITS_00:
-   strcpy(cpu_rev, 1.0);
-   break;
-   case OMAP_REVBITS_01:
-   strcpy(cpu_rev, 1.1);
-   break;
-   case OMAP_REVBITS_02:
-   strcpy(cpu_rev, 1.2);
-   break;
-   case OMAP_REVBITS_10:
-   strcpy(cpu_rev, 2.0);
-   break;
-   case OMAP_REVBITS_20:
-   strcpy(cpu_rev, 2.1);
-   break;
-   case OMAP_REVBITS_30:
-   strcpy(cpu_rev, 3.0);
-   break;
-   case OMAP_REVBITS_40:
-   /* FALLTHROUGH */
-   default:
-   /* Use the latest known revision as default */
-   strcpy(cpu_rev, 3.1);
+   if (cpu_is_omap3630()) {
+   switch (rev) {
+   case OMAP_REVBITS_00:
+   strcpy(cpu_rev, 1.0);
+   break;
+   case OMAP_REVBITS_01:
+   strcpy(cpu_rev, 1.1);
+   break;
+   case OMAP_REVBITS_02:
+   /* FALLTHROUGH */
+   default:
+   /* Use the latest known revision as default */
+   strcpy(cpu_rev, 1.2);
+   }
+   } else if (cpu_is_omap3505() || cpu_is_omap3517()) {
+   switch (rev) {
+   case OMAP_REVBITS_00:
+   strcpy(cpu_rev, 1.0);
+   break;
+   case OMAP_REVBITS_01:
+   /* FALLTHROUGH */
+   default:
+   /* Use the latest known revision as default */
+   strcpy(cpu_rev, 1.1);
+   }
+   } else {
+   switch (rev) {
+   case OMAP_REVBITS_00:
+   strcpy(cpu_rev, 1.0);
+   break;
+   case OMAP_REVBITS_01:
+   strcpy(cpu_rev, 2.0);
+   break;
+   case OMAP_REVBITS_02:
+   strcpy(cpu_rev, 2.1);
+   break;
+   case OMAP_REVBITS_03:
+   strcpy(cpu_rev, 3.0);
+   break;
+   case OMAP_REVBITS_04:
+   strcpy(cpu_rev, 3.1);
+   break;
+   case OMAP_REVBITS_05:
+   /* FALLTHROUGH */
+   default:
+   /* Use the latest known revision as default */
+   strcpy(cpu_rev, 3.1.2);
+   }
}
 
/* Print verbose information */
diff --git a/arch/arm/plat-omap/include/plat/cpu.h 
b/arch/arm/plat-omap/include/plat/cpu.h
index 2e2ae53..6e23c9e 100644
--- a/arch/arm/plat-omap/include/plat/cpu.h
+++ b/arch/arm/plat-omap/include/plat/cpu.h
@@ -68,10 +68,9 @@ unsigned int omap_rev(void);
 #define OMAP_REVBITS_000x00
 #define OMAP_REVBITS_010x01
 #define OMAP_REVBITS_020x02
-#define OMAP_REVBITS_100x10
-#define OMAP_REVBITS_200x20
-#define OMAP_REVBITS_300x30
-#define OMAP_REVBITS_400x40
+#define OMAP_REVBITS_030x03
+#define OMAP_REVBITS_040x04
+#define OMAP_REVBITS_050x05
 
 /*
  * Get the CPU revision for OMAP devices
@@ -363,23 +362,24 @@ IS_OMAP_TYPE(3517, 0x3517)
 
 /* Various silicon revisions for omap2 */
 #define OMAP242X_CLASS 0x24200024
-#define OMAP2420_REV_ES1_0 0x24200024
-#define OMAP2420_REV_ES2_0 0x24201024
+#define OMAP2420_REV_ES1_0 OMAP242X_CLASS
+#define OMAP2420_REV_ES2_0 (OMAP242X_CLASS | (OMAP_REVBITS_01  8))
 
 #define OMAP243X_CLASS 0x24300024
-#define OMAP2430_REV_ES1_0 0x24300024
+#define OMAP2430_REV_ES1_0 OMAP243X_CLASS
 
 #define OMAP343X_CLASS 0x34300034
-#define OMAP3430_REV_ES1_0 0x34300034
-#define OMAP3430_REV_ES2_0 0x34301034
-#define OMAP3430_REV_ES2_1 0x34302034
-#define OMAP3430_REV_ES3_0 0x34303034
-#define OMAP3430_REV_ES3_1 0x34304034
-#define OMAP3430_REV_ES3_1_2   0x34305034
-
-#define OMAP3630_REV_ES1_0 0x36300034
-#define

[PATCH] omap: OMAP_IOMMU not visible in menuconfig

2010-09-08 Thread Sanjeev Premi
The menu option to select CONFIG_OMAP_IOMMU
was not visible in the menuconfig due to missing
description.

Signed-off-by: Sanjeev Premi pr...@ti.com
---
 arch/arm/plat-omap/Kconfig |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig
index e39a417..2a114a9 100644
--- a/arch/arm/plat-omap/Kconfig
+++ b/arch/arm/plat-omap/Kconfig
@@ -98,7 +98,7 @@ config OMAP_MBOX_KFIFO_SIZE
  module parameter).
 
 config OMAP_IOMMU
-   tristate
+   tristate OMAP IOMMU support
 
 config OMAP_IOMMU_DEBUG
tristate Export OMAP IOMMU internals in DebugFS
-- 
1.6.2.4

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


[PATCH 0/1] omap: fix section mismatch errors

2010-08-16 Thread Sanjeev Premi
Multiple section mismatches are observed with the latest
master. While attempting to fix the ones listed below, I
came across more instances.

The patch in this series fixes all these issues.

Though most of the changes are straight-forward, but for
these (for now annotated as ___refdata):

1) arch/arm/plat-omap/cpu-omap.c
   Variable omap_driver may be required beyond __init
   lifetime.
 
2) drivers/mfd/twl-core.c
   Variable twl_driver is used both in __init and __exit
   context.

There are few more similar errors in some of the modules
would submit them separately.


WARNING: vmlinux.o(.text+0x187c0): Section mismatch in reference from the 
function zoom_twl_gpio_setup() to the (unknown reference) .init.data:(unknown)
The function zoom_twl_gpio_setup() references
the (unknown reference) __initdata (unknown).
This is often because zoom_twl_gpio_setup lacks a __initdata
annotation or the annotation of (unknown) is wrong.

WARNING: vmlinux.o(.text+0x189b0): Section mismatch in reference from the 
function cm_t35_twl_gpio_setup() to the (unknown reference) .init.data:(unknown)
The function cm_t35_twl_gpio_setup() references
the (unknown reference) __initdata (unknown).
This is often because cm_t35_twl_gpio_setup lacks a __initdata
annotation or the annotation of (unknown) is wrong.

WARNING: vmlinux.o(.data+0x19e38): Section mismatch in reference from the 
variable h4_config to the (unknown reference) .init.data:(unknown)
The variable h4_config references
the (unknown reference) __initdata (unknown)
If the reference is valid then annotate the
variable with __init* or __refdata (see linux/init.h) or name the variable:
*_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console,

WARNING: vmlinux.o(.data+0x1a670): Section mismatch in reference from the 
variable sdp2430_config to the (unknown reference) .init.data:(unknown)
The variable sdp2430_config references
the (unknown reference) __initdata (unknown)
If the reference is valid then annotate the
variable with __init* or __refdata (see linux/init.h) or name the variable:
*_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console,

WARNING: vmlinux.o(.data+0x1ac50): Section mismatch in reference from the 
variable apollon_config to the (unknown reference) .init.data:(unknown)
The variable apollon_config references
the (unknown reference) __initdata (unknown)
If the reference is valid then annotate the
variable with __init* or __refdata (see linux/init.h) or name the variable:
*_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console,

WARNING: vmlinux.o(.data+0x2e378): Section mismatch in reference from the 
variable omap_driver to the function .init.text:omap_cpu_init()
The variable omap_driver references
the function __init omap_cpu_init()
If the reference is valid then annotate the
variable with __init* or __refdata (see linux/init.h) or name the variable:
*_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console,

WARNING: vmlinux.o(.data+0x1b9dcc): Section mismatch in reference from the 
variable twl_driver to the function .init.text:twl_probe()
The variable twl_driver references
the function __init twl_probe()
If the reference is valid then annotate the
variable with __init* or __refdata (see linux/init.h) or name the variable:
*_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console,

Sanjeev Premi (1):
  omap: fix section mismatch errors

 arch/arm/mach-omap2/board-2430sdp.c  |2 +-
 arch/arm/mach-omap2/board-apollon.c  |2 +-
 arch/arm/mach-omap2/board-cm-t35.c   |8 
 arch/arm/mach-omap2/board-h4.c   |2 +-
 arch/arm/mach-omap2/board-zoom-peripherals.c |   18 +-
 arch/arm/plat-omap/cpu-omap.c|2 +-
 drivers/mfd/twl-core.c   |2 +-
 7 files changed, 18 insertions(+), 18 deletions(-)

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


[PATCH 1/1] omap: fix section mismatch errors

2010-08-16 Thread Sanjeev Premi
This patch fixes miltiple section mismatch errors
observed with the latest master.

Signed-off-by: Sanjeev Premi pr...@ti.com
---
 arch/arm/mach-omap2/board-2430sdp.c  |2 +-
 arch/arm/mach-omap2/board-apollon.c  |2 +-
 arch/arm/mach-omap2/board-cm-t35.c   |8 
 arch/arm/mach-omap2/board-h4.c   |2 +-
 arch/arm/mach-omap2/board-zoom-peripherals.c |   18 +-
 arch/arm/plat-omap/cpu-omap.c|2 +-
 drivers/mfd/twl-core.c   |2 +-
 7 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/arch/arm/mach-omap2/board-2430sdp.c 
b/arch/arm/mach-omap2/board-2430sdp.c
index 8538e41..bca0236 100644
--- a/arch/arm/mach-omap2/board-2430sdp.c
+++ b/arch/arm/mach-omap2/board-2430sdp.c
@@ -134,7 +134,7 @@ static inline void board_smc91x_init(void)
 
 #endif
 
-static struct omap_board_config_kernel sdp2430_config[] = {
+static struct omap_board_config_kernel sdp2430_config[] __initdata = {
{OMAP_TAG_LCD, sdp2430_lcd_config},
 };
 
diff --git a/arch/arm/mach-omap2/board-apollon.c 
b/arch/arm/mach-omap2/board-apollon.c
index c6421a7..1401108 100644
--- a/arch/arm/mach-omap2/board-apollon.c
+++ b/arch/arm/mach-omap2/board-apollon.c
@@ -270,7 +270,7 @@ static struct omap_lcd_config apollon_lcd_config __initdata 
= {
.ctrl_name  = internal,
 };
 
-static struct omap_board_config_kernel apollon_config[] = {
+static struct omap_board_config_kernel apollon_config[] __initdata = {
{ OMAP_TAG_LCD, apollon_lcd_config },
 };
 
diff --git a/arch/arm/mach-omap2/board-cm-t35.c 
b/arch/arm/mach-omap2/board-cm-t35.c
index e10bc10..fc04062 100644
--- a/arch/arm/mach-omap2/board-cm-t35.c
+++ b/arch/arm/mach-omap2/board-cm-t35.c
@@ -606,7 +606,7 @@ static struct ehci_hcd_omap_platform_data ehci_pdata 
__initdata = {
.reset_gpio_port[2]  = -EINVAL
 };
 
-static int cm_t35_twl_gpio_setup(struct device *dev, unsigned gpio,
+static int __init cm_t35_twl_gpio_setup(struct device *dev, unsigned gpio,
 unsigned ngpio)
 {
int wlan_rst = gpio + 2;
@@ -640,14 +640,14 @@ static int cm_t35_twl_gpio_setup(struct device *dev, 
unsigned gpio,
return 0;
 }
 
-static struct twl4030_gpio_platform_data cm_t35_gpio_data = {
+static struct twl4030_gpio_platform_data cm_t35_gpio_data __initdata = {
.gpio_base  = OMAP_MAX_GPIO_LINES,
.irq_base   = TWL4030_GPIO_IRQ_BASE,
.irq_end= TWL4030_GPIO_IRQ_END,
.setup  = cm_t35_twl_gpio_setup,
 };
 
-static struct twl4030_platform_data cm_t35_twldata = {
+static struct twl4030_platform_data cm_t35_twldata __initdata = {
.irq_base   = TWL4030_IRQ_BASE,
.irq_end= TWL4030_IRQ_END,
 
@@ -661,7 +661,7 @@ static struct twl4030_platform_data cm_t35_twldata = {
.vpll2  = cm_t35_vpll2,
 };
 
-static struct i2c_board_info __initdata cm_t35_i2c_boardinfo[] = {
+static struct i2c_board_info __initdata cm_t35_i2c_boardinfo[] __initdata = {
{
I2C_BOARD_INFO(tps65930, 0x48),
.flags  = I2C_CLIENT_WAKE,
diff --git a/arch/arm/mach-omap2/board-h4.c b/arch/arm/mach-omap2/board-h4.c
index e09bd68..7b6f9c1 100644
--- a/arch/arm/mach-omap2/board-h4.c
+++ b/arch/arm/mach-omap2/board-h4.c
@@ -283,7 +283,7 @@ static struct omap_usb_config h4_usb_config __initdata = {
.hmc_mode   = 0x00, /* 0:dev|otg 1:disable 2:disable */
 };
 
-static struct omap_board_config_kernel h4_config[] = {
+static struct omap_board_config_kernel h4_config[] __initdata = {
{ OMAP_TAG_LCD, h4_lcd_config },
 };
 
diff --git a/arch/arm/mach-omap2/board-zoom-peripherals.c 
b/arch/arm/mach-omap2/board-zoom-peripherals.c
index 6b39849..d0f8057 100644
--- a/arch/arm/mach-omap2/board-zoom-peripherals.c
+++ b/arch/arm/mach-omap2/board-zoom-peripherals.c
@@ -171,7 +171,7 @@ static struct omap2_hsmmc_info mmc[] __initdata = {
{}  /* Terminator */
 };
 
-static int zoom_twl_gpio_setup(struct device *dev,
+static int __init zoom_twl_gpio_setup(struct device *dev,
unsigned gpio, unsigned ngpio)
 {
/* gpio + 0 is mmc0_cd (input/IRQ) */
@@ -209,27 +209,27 @@ static struct twl4030_usb_data zoom_usb_data = {
.usb_mode   = T2_USB_MODE_ULPI,
 };
 
-static struct twl4030_gpio_platform_data zoom_gpio_data = {
+static struct twl4030_gpio_platform_data zoom_gpio_data __initdata = {
.gpio_base  = OMAP_MAX_GPIO_LINES,
.irq_base   = TWL4030_GPIO_IRQ_BASE,
.irq_end= TWL4030_GPIO_IRQ_END,
.setup  = zoom_twl_gpio_setup,
 };
 
-static struct twl4030_madc_platform_data zoom_madc_data = {
+static struct twl4030_madc_platform_data zoom_madc_data __initdata = {
.irq_line   = 1,
 };
 
-static struct twl4030_codec_audio_data zoom_audio_data = {
+static struct twl4030_codec_audio_data zoom_audio_data

[PATCH 1/1] omap2/3: Update revision identification

2010-08-16 Thread Sanjeev Premi
The existing definitions for cpu revision used
upper nibble in the bits[15:08]. With OMAP3630,
definitions use lower nibble.

This patch unifies the definitions to start
at lower nibble.

  [1] http://marc.info/?t=12816173915r=1w=2

Signed-off-by: Sanjeev Premi pr...@ti.com
---
 arch/arm/mach-omap2/id.c  |   22 +++-
 arch/arm/plat-omap/include/plat/cpu.h |   36 
 2 files changed, 30 insertions(+), 28 deletions(-)

diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index 9a879f9..06f0d0f 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -366,21 +366,23 @@ static void __init omap3_cpuinfo(void)
strcpy(cpu_rev, 1.0);
break;
case OMAP_REVBITS_01:
-   strcpy(cpu_rev, 1.1);
+   if (cpu_is_omap3630()) {
+   strcpy(cpu_rev, 1.1);
+   } else {
+   strcpy(cpu_rev, 2.0);
+   }
break;
case OMAP_REVBITS_02:
-   strcpy(cpu_rev, 1.2);
-   break;
-   case OMAP_REVBITS_10:
-   strcpy(cpu_rev, 2.0);
-   break;
-   case OMAP_REVBITS_20:
-   strcpy(cpu_rev, 2.1);
+   if (cpu_is_omap3630()) {
+   strcpy(cpu_rev, 1.2);
+   } else {
+   strcpy(cpu_rev, 2.1);
+   }
break;
-   case OMAP_REVBITS_30:
+   case OMAP_REVBITS_03:
strcpy(cpu_rev, 3.0);
break;
-   case OMAP_REVBITS_40:
+   case OMAP_REVBITS_04:
/* FALLTHROUGH */
default:
/* Use the latest known revision as default */
diff --git a/arch/arm/plat-omap/include/plat/cpu.h 
b/arch/arm/plat-omap/include/plat/cpu.h
index 2e2ae53..46e16b7 100644
--- a/arch/arm/plat-omap/include/plat/cpu.h
+++ b/arch/arm/plat-omap/include/plat/cpu.h
@@ -68,10 +68,9 @@ unsigned int omap_rev(void);
 #define OMAP_REVBITS_000x00
 #define OMAP_REVBITS_010x01
 #define OMAP_REVBITS_020x02
-#define OMAP_REVBITS_100x10
-#define OMAP_REVBITS_200x20
-#define OMAP_REVBITS_300x30
-#define OMAP_REVBITS_400x40
+#define OMAP_REVBITS_030x03
+#define OMAP_REVBITS_040x04
+#define OMAP_REVBITS_050x05
 
 /*
  * Get the CPU revision for OMAP devices
@@ -363,23 +362,24 @@ IS_OMAP_TYPE(3517, 0x3517)
 
 /* Various silicon revisions for omap2 */
 #define OMAP242X_CLASS 0x24200024
-#define OMAP2420_REV_ES1_0 0x24200024
-#define OMAP2420_REV_ES2_0 0x24201024
+#define OMAP2420_REV_ES1_0 (OMAP242X_CLASS)
+#define OMAP2420_REV_ES2_0 (OMAP242X_CLASS | (OMAP_REVBITS_01  8))
 
 #define OMAP243X_CLASS 0x24300024
-#define OMAP2430_REV_ES1_0 0x24300024
+#define OMAP2430_REV_ES1_0 (OMAP243X_CLASS)
 
 #define OMAP343X_CLASS 0x34300034
-#define OMAP3430_REV_ES1_0 0x34300034
-#define OMAP3430_REV_ES2_0 0x34301034
-#define OMAP3430_REV_ES2_1 0x34302034
-#define OMAP3430_REV_ES3_0 0x34303034
-#define OMAP3430_REV_ES3_1 0x34304034
-#define OMAP3430_REV_ES3_1_2   0x34305034
-
-#define OMAP3630_REV_ES1_0 0x36300034
-#define OMAP3630_REV_ES1_1 0x36300134
-#define OMAP3630_REV_ES1_2 0x36300234
+#define OMAP3430_REV_ES1_0 (OMAP343X_CLASS)
+#define OMAP3430_REV_ES2_0 (OMAP343X_CLASS | (OMAP_REVBITS_01  8))
+#define OMAP3430_REV_ES2_1 (OMAP343X_CLASS | (OMAP_REVBITS_02  8))
+#define OMAP3430_REV_ES3_0 (OMAP343X_CLASS | (OMAP_REVBITS_03  8))
+#define OMAP3430_REV_ES3_1 (OMAP343X_CLASS | (OMAP_REVBITS_04  8))
+#define OMAP3430_REV_ES3_1_2   (OMAP343X_CLASS | (OMAP_REVBITS_05  8))
+
+#define OMAP363X_CLASS 0x3634
+#define OMAP3630_REV_ES1_0 (OMAP363X_CLASS)
+#define OMAP3630_REV_ES1_1 (OMAP363X_CLASS | (OMAP_REVBITS_01  8))
+#define OMAP3630_REV_ES1_2 (OMAP363X_CLASS | (OMAP_REVBITS_02  8))
 
 #define OMAP35XX_CLASS 0x3534
 #define OMAP3503_REV(v)(OMAP35XX_CLASS | (0x3503  16) | (v 
 8))
@@ -390,7 +390,7 @@ IS_OMAP_TYPE(3517, 0x3517)
 #define OMAP3517_REV(v)(OMAP35XX_CLASS | (0x3517  16) | (v 
 8))
 
 #define OMAP443X_CLASS 0x44300044
-#define OMAP4430_REV_ES1_0 0x44300044
+#define OMAP4430_REV_ES1_0 (OMAP443X_CLASS)
 
 /*
  * omap_chip bits
-- 
1.6.6.1

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


[PATCHv2] omap2: fix assorted compiler warnings

2010-08-10 Thread Sanjeev Premi
This patch fixes these compiler warnings:

  CC  arch/arm/mach-omap2/mux.o
arch/arm/mach-omap2/mux.c: In function 'omap_mux_init_gpio':
arch/arm/mach-omap2/mux.c:90: warning: 'gpio_mux' may be used uninitial
ized in this function

  CC  arch/arm/plat-omap/gpio.o
arch/arm/plat-omap/gpio.c: In function 'omap2_gpio_resume_after_idle':
arch/arm/plat-omap/gpio.c:2152: warning: 'l' may be used uninitialized
in this function
arch/arm/plat-omap/gpio.c: In function 'omap2_gpio_prepare_for_idle':
arch/arm/plat-omap/gpio.c:2085: warning: 'l2' may be used uninitialized
in this function
arch/arm/plat-omap/gpio.c:2085: warning: 'l1' may be used uninitialized
in this function

  CC  arch/arm/mach-omap2/board-omap4panda.o
arch/arm/mach-omap2/board-omap4panda.c: In function 'omap4_panda_init':
arch/arm/mach-omap2/board-omap4panda.c:277: warning: unused variable 's
tatus'

Signed-off-by: Sanjeev Premi pr...@ti.com
---
 arch/arm/mach-omap2/board-omap4panda.c |2 --
 arch/arm/mach-omap2/mux.c  |2 +-
 arch/arm/plat-omap/gpio.c  |4 ++--
 3 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-omap2/board-omap4panda.c 
b/arch/arm/mach-omap2/board-omap4panda.c
index c03d1d5..96f5bbb 100644
--- a/arch/arm/mach-omap2/board-omap4panda.c
+++ b/arch/arm/mach-omap2/board-omap4panda.c
@@ -274,8 +274,6 @@ static int __init omap4_panda_i2c_init(void)
 }
 static void __init omap4_panda_init(void)
 {
-   int status;
-
omap4_panda_i2c_init();
omap_serial_init();
omap4_twl6030_hsmmc_init(mmc);
diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c
index ab403b2..6c2f8f0 100644
--- a/arch/arm/mach-omap2/mux.c
+++ b/arch/arm/mach-omap2/mux.c
@@ -87,7 +87,7 @@ static char *omap_mux_options;
 int __init omap_mux_init_gpio(int gpio, int val)
 {
struct omap_mux_entry *e;
-   struct omap_mux *gpio_mux;
+   struct omap_mux *gpio_mux = NULL;
u16 old_mode;
u16 mux_mode;
int found = 0;
diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c
index 9b7e354..ba3b9ab 100644
--- a/arch/arm/plat-omap/gpio.c
+++ b/arch/arm/plat-omap/gpio.c
@@ -2082,7 +2082,7 @@ void omap2_gpio_prepare_for_idle(int power_state)
 
for (i = min; i  gpio_bank_count; i++) {
struct gpio_bank *bank = gpio_bank[i];
-   u32 l1, l2;
+   u32 l1 = 0, l2 = 0;
 
if (bank-dbck_enable_mask)
clk_disable(bank-dbck);
@@ -2149,7 +2149,7 @@ void omap2_gpio_resume_after_idle(void)
min = 1;
for (i = min; i  gpio_bank_count; i++) {
struct gpio_bank *bank = gpio_bank[i];
-   u32 l, gen, gen0, gen1;
+   u32 l = 0, gen, gen0, gen1;
 
if (bank-dbck_enable_mask)
clk_enable(bank-dbck);
-- 
1.6.6.1

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


[PATCH] omap3: Remove non-existent config option

2010-07-22 Thread Sanjeev Premi
From: Yogesh Marathe yogesh_mara...@ti.com

The definition of iva2 device in iommu_device
is wrapped inside CONFIG_MPU_BRIDGE_IOMMU, but
this option is not defined in KConfig.

This patch removes the wrapper and makes iva2
available as another iommu_device.

Signed-off-by: Yogesh Marathe yogesh_mara...@ti.com
Signed-off-by: Sanjeev Premi pr...@ti.com
---
 arch/arm/mach-omap2/omap-iommu.c |2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/omap-iommu.c b/arch/arm/mach-omap2/omap-iommu.c
index f5a1aad..bb8c01d 100644
--- a/arch/arm/mach-omap2/omap-iommu.c
+++ b/arch/arm/mach-omap2/omap-iommu.c
@@ -35,7 +35,6 @@ static struct iommu_device omap3_devices[] = {
.clk_name = cam_ick,
},
},
-#if defined(CONFIG_MPU_BRIDGE_IOMMU)
{
.base = 0x5d00,
.irq = 28,
@@ -45,7 +44,6 @@ static struct iommu_device omap3_devices[] = {
.clk_name = iva2_ck,
},
},
-#endif
 };
 #define NR_OMAP3_IOMMU_DEVICES ARRAY_SIZE(omap3_devices)
 static struct platform_device *omap3_iommu_pdev[NR_OMAP3_IOMMU_DEVICES];
-- 
1.6.6.1

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


[PATCH] omap: Add macros to evaluate cpu revision

2010-07-21 Thread Sanjeev Premi
This patch adds macros to evaluate the cpu revision.
These macros increase readability by reducing the
repetitive code when multiple silicon and their
revisions have to be tested.

Example usage would be:
  if (cpu_rev_eq(omap34xx, ES_1_0))

Signed-off-by: Sanjeev Premi pr...@ti.com
---
 arch/arm/plat-omap/include/plat/cpu.h |   32 
 1 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/arch/arm/plat-omap/include/plat/cpu.h 
b/arch/arm/plat-omap/include/plat/cpu.h
index aa2f4f0..14b1a44 100644
--- a/arch/arm/plat-omap/include/plat/cpu.h
+++ b/arch/arm/plat-omap/include/plat/cpu.h
@@ -70,6 +70,7 @@ unsigned int omap_rev(void);
 #define OMAP_REVBITS_200x20
 #define OMAP_REVBITS_300x30
 #define OMAP_REVBITS_400x40
+#define OMAP_REVBITS_500x50
 
 /*
  * Get the CPU revision for OMAP devices
@@ -460,4 +461,35 @@ OMAP3_HAS_FEATURE(isp, ISP)
 OMAP3_HAS_FEATURE(192mhz_clk, 192MHZ_CLK)
 OMAP3_HAS_FEATURE(io_wakeup, IO_WAKEUP)
 
+/*
+ * Map revision bits to silicon specific revisions
+ */
+#define ES_1_0 OMAP_REVBITS_00
+#define ES_2_0 OMAP_REVBITS_10
+#define ES_2_1 OMAP_REVBITS_20
+#define ES_3_0 OMAP_REVBITS_30
+#define ES_3_1 OMAP_REVBITS_40
+#define ES_3_1_2   OMAP_REVBITS_50
+
+/*
+ * Macros to evaluate CPU revision
+ */
+#define cpu_rev_lt(cpu,rev)\
+   ((cpu_is_omap ##cpu()  (GET_OMAP_REVISION()  (rev))) ? 1 : 0)
+
+#define cpu_rev_le(cpu,rev)\
+   ((cpu_is_omap ##cpu()  (GET_OMAP_REVISION() = (rev))) ? 1 : 0)
+
+#define cpu_rev_eq(cpu,rev)\
+   ((cpu_is_omap ##cpu()  (GET_OMAP_REVISION() == (rev))) ? 1 : 0)
+
+#define cpu_rev_ne(cpu,rev)\
+   ((cpu_is_omap ##cpu()  (GET_OMAP_REVISION() != (rev))) ? 1 : 0)
+
+#define cpu_rev_ge(cpu,rev)\
+   ((cpu_is_omap ##cpu()  (GET_OMAP_REVISION() = (rev))) ? 1 : 0)
+
+#define cpu_rev_gt(cpu,rev)\
+   ((cpu_is_omap ##cpu()  (GET_OMAP_REVISION()  (rev))) ? 1 : 0)
+
 #endif
-- 
1.6.6.1

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


[PATCH] omap2: fix assorted compiler warnings

2010-07-13 Thread Sanjeev Premi
This patch fixes these compiler warnings:

  CC  arch/arm/mach-omap2/mux.o
arch/arm/mach-omap2/mux.c: In function 'omap_mux_init_gpio':
arch/arm/mach-omap2/mux.c:90: warning: 'gpio_mux' may be used uninitial
ized in this function

  CC  arch/arm/plat-omap/gpio.o
arch/arm/plat-omap/gpio.c: In function 'omap2_gpio_resume_after_idle':
arch/arm/plat-omap/gpio.c:2152: warning: 'l' may be used uninitialized
in this function
arch/arm/plat-omap/gpio.c: In function 'omap2_gpio_prepare_for_idle':
arch/arm/plat-omap/gpio.c:2085: warning: 'l2' may be used uninitialized
in this function
arch/arm/plat-omap/gpio.c:2085: warning: 'l1' may be used uninitialized
in this function

  CC  arch/arm/mach-omap2/board-omap4panda.o
arch/arm/mach-omap2/board-omap4panda.c: In function 'omap4_panda_init':
arch/arm/mach-omap2/board-omap4panda.c:277: warning: unused variable 's
tatus'

Signed-off-by: Sanjeev Premi pr...@ti.com
---
 arch/arm/mach-omap2/board-omap4panda.c |2 --
 arch/arm/mach-omap2/mux.c  |2 +-
 arch/arm/plat-omap/gpio.c  |4 ++--
 3 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-omap2/board-omap4panda.c 
b/arch/arm/mach-omap2/board-omap4panda.c
index c03d1d5..96f5bbb 100644
--- a/arch/arm/mach-omap2/board-omap4panda.c
+++ b/arch/arm/mach-omap2/board-omap4panda.c
@@ -274,8 +274,6 @@ static int __init omap4_panda_i2c_init(void)
 }
 static void __init omap4_panda_init(void)
 {
-   int status;
-
omap4_panda_i2c_init();
omap_serial_init();
omap4_twl6030_hsmmc_init(mmc);
diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c
index ab403b2..2ffacc1 100644
--- a/arch/arm/mach-omap2/mux.c
+++ b/arch/arm/mach-omap2/mux.c
@@ -87,7 +87,7 @@ static char *omap_mux_options;
 int __init omap_mux_init_gpio(int gpio, int val)
 {
struct omap_mux_entry *e;
-   struct omap_mux *gpio_mux;
+   struct omap_mux *gpio_mux=NULL;
u16 old_mode;
u16 mux_mode;
int found = 0;
diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c
index 9b7e354..831e6bc 100644
--- a/arch/arm/plat-omap/gpio.c
+++ b/arch/arm/plat-omap/gpio.c
@@ -2082,7 +2082,7 @@ void omap2_gpio_prepare_for_idle(int power_state)
 
for (i = min; i  gpio_bank_count; i++) {
struct gpio_bank *bank = gpio_bank[i];
-   u32 l1, l2;
+   u32 l1=0, l2=0;
 
if (bank-dbck_enable_mask)
clk_disable(bank-dbck);
@@ -2149,7 +2149,7 @@ void omap2_gpio_resume_after_idle(void)
min = 1;
for (i = min; i  gpio_bank_count; i++) {
struct gpio_bank *bank = gpio_bank[i];
-   u32 l, gen, gen0, gen1;
+   u32 l=0, gen, gen0, gen1;
 
if (bank-dbck_enable_mask)
clk_enable(bank-dbck);
-- 
1.6.6.1

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


[PATCHv1 0/1] omap3: pm: Delink OPP layer from cpufreq

2010-05-31 Thread Sanjeev Premi
The OPP layer is currently contained in CONFIG_CPU_FREQ.
When the ARM frequency is set via bootarg 'mpurate' the
OPP layer is required to:
  - verify that specified mpurate is valid and available
in the OPP table.
  - get voltage corresponding to specified frequency.

This is initial attempt to make OPP layer available without
cpufreq. Since, this is initial version, i am making changes
in board-omap3evm.c only. same change will be required in
other board files as well. Will do so in next version of
the patch.

I have also updated the OPP tables for OMAP3430 to include
support for 720MHz. It will be a separate patch when I submit
it next.

  [1] http://marc.info/?l=linux-omapm=127495955603835w=2


Sanjeev Premi (1):
  omap3: pm: Delink opp layer and cpufreq

 arch/arm/mach-omap2/Makefile  |6 +-
 arch/arm/mach-omap2/board-omap3evm.c  |2 +-
 arch/arm/mach-omap2/cpufreq34xx.c |  164 
 arch/arm/mach-omap2/omap3-opp.h   |   20 
 arch/arm/mach-omap2/opp34xx_data.c|  166 +
 arch/arm/mach-omap2/pm34xx.c  |1 -
 arch/arm/plat-omap/Makefile   |7 +-
 arch/arm/plat-omap/cpu-omap.c |   47 +
 arch/arm/plat-omap/include/plat/opp.h |   82 +---
 arch/arm/plat-omap/opp.c  |   46 -
 10 files changed, 225 insertions(+), 316 deletions(-)
 delete mode 100644 arch/arm/mach-omap2/cpufreq34xx.c
 delete mode 100644 arch/arm/mach-omap2/omap3-opp.h
 create mode 100644 arch/arm/mach-omap2/opp34xx_data.c

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


[PATCHv1 1/1] omap3: pm: Delink opp layer and cpufreq

2010-05-31 Thread Sanjeev Premi
The OPP layer was contained in the CONFIG_CPU_FREQ.
This patch removes this containment relation.

Signed-off-by: Sanjeev Premi pr...@ti.com
---
 arch/arm/mach-omap2/Makefile  |6 +-
 arch/arm/mach-omap2/board-omap3evm.c  |2 +-
 arch/arm/mach-omap2/cpufreq34xx.c |  164 
 arch/arm/mach-omap2/omap3-opp.h   |   20 
 arch/arm/mach-omap2/opp34xx_data.c|  166 +
 arch/arm/mach-omap2/pm34xx.c  |1 -
 arch/arm/plat-omap/Makefile   |7 +-
 arch/arm/plat-omap/cpu-omap.c |   47 +
 arch/arm/plat-omap/include/plat/opp.h |   82 +---
 arch/arm/plat-omap/opp.c  |   46 -
 10 files changed, 225 insertions(+), 316 deletions(-)
 delete mode 100644 arch/arm/mach-omap2/cpufreq34xx.c
 delete mode 100644 arch/arm/mach-omap2/omap3-opp.h
 create mode 100644 arch/arm/mach-omap2/opp34xx_data.c

diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index ac08f99..4e51a99 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -55,10 +55,8 @@ AFLAGS_sleep34xx.o   :=-Wa,-march=armv7-a
 
 endif
 
-# CPU Frequency
-ifeq ($(CONFIG_CPU_FREQ),y)
-obj-$(CONFIG_ARCH_OMAP3)   += cpufreq34xx.o
-endif
+# OPP definitions for OMAP3
+obj-$(CONFIG_ARCH_OMAP3)   += opp34xx_data.o
 
 # PRCM
 obj-$(CONFIG_ARCH_OMAP2)   += cm.o
diff --git a/arch/arm/mach-omap2/board-omap3evm.c 
b/arch/arm/mach-omap2/board-omap3evm.c
index 0a3f5b6..cb97c5d 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -50,11 +50,11 @@
 #include plat/common.h
 #include plat/mcspi.h
 #include plat/display.h
+#include plat/opp.h
 
 #include mux.h
 #include sdram-micron-mt46h32m32lf-6.h
 #include hsmmc.h
-#include omap3-opp.h
 
 #define GPMC_CS0_BASE  0x60
 #define GPMC_CS_SIZE   0x30
diff --git a/arch/arm/mach-omap2/cpufreq34xx.c 
b/arch/arm/mach-omap2/cpufreq34xx.c
deleted file mode 100644
index 8747dd6..000
--- a/arch/arm/mach-omap2/cpufreq34xx.c
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * arch/arm/mach-omap2/cpufreq34xx.c
- * OMAP3 resource init/change_level/validate_level functions
- *
- * Copyright (C) 2009 - 2010 Texas Instruments Incorporated.
- * Nishanth Menon
- * Copyright (C) 2009 - 2010 Deep Root Systems, LLC.
- * Kevin Hilman
- * Copyright (C) 2010 Nokia Corporation.
- *  Eduardo Valentin
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- * History:
- *
- */
-
-#include linux/module.h
-#include linux/err.h
-
-#include plat/opp.h
-#include plat/cpu.h
-#include omap3-opp.h
-
-static struct omap_opp_def __initdata omap34xx_mpu_rate_table[] = {
-   /* OPP1 */
-   OMAP_OPP_DEF(true, 12500, 975000),
-   /* OPP2 */
-   OMAP_OPP_DEF(true, 25000, 1075000),
-   /* OPP3 */
-   OMAP_OPP_DEF(true, 5, 120),
-   /* OPP4 */
-   OMAP_OPP_DEF(true, 55000, 127),
-   /* OPP5 */
-   OMAP_OPP_DEF(true, 6, 135),
-   /* Terminator */
-   OMAP_OPP_DEF(0, 0, 0)
-};
-
-static struct omap_opp_def __initdata omap34xx_l3_rate_table[] = {
-   /*
-* OPP1 - 41.5 MHz is disabled because: The voltage for that OPP is
-* almost the same than the one at 83MHz thus providing very little
-* gain for the power point of view. In term of energy it will even
-* increase the consumption due to the very negative performance
-* impact that frequency will do to the MPU and the whole system in
-* general.
-*/
-   OMAP_OPP_DEF(false, 4150, 975000),
-   /* OPP2 */
-   OMAP_OPP_DEF(true, 8300, 105),
-   /* OPP3 */
-   OMAP_OPP_DEF(true, 16600, 115),
-   /* Terminator */
-   OMAP_OPP_DEF(0, 0, 0)
-};
-
-static struct omap_opp_def __initdata omap34xx_dsp_rate_table[] = {
-   /* OPP1 */
-   OMAP_OPP_DEF(true, 9000, 975000),
-   /* OPP2 */
-   OMAP_OPP_DEF(true, 18000, 1075000),
-   /* OPP3 */
-   OMAP_OPP_DEF(true, 36000, 120),
-   /* OPP4 */
-   OMAP_OPP_DEF(true, 4, 127),
-   /* OPP5 */
-   OMAP_OPP_DEF(true, 43000, 135),
-   /* Terminator */
-   OMAP_OPP_DEF(0, 0, 0)
-};
-
-static struct omap_opp_def __initdata omap36xx_mpu_rate_table[] = {
-   /* OPP1 - OPP50 */
-   OMAP_OPP_DEF(true,  3, 93),
-   /* OPP2 - OPP100 */
-   OMAP_OPP_DEF(true,  6, 110),
-   /* OPP3 - OPP-Turbo */
-   OMAP_OPP_DEF(false, 8, 126),
-   /* OPP4 - OPP-SB

[PATCH] omap3: Increase limit on bootarg 'mpurate'

2010-05-27 Thread Sanjeev Premi
The value of mpurate is currently expected to be less
than 1000 when specified in MHz.

This patch raises this limit to 2000 to support 1GHz
capable processors. The new limit should be reasonable
for quite some time.

Signed-off-by: Sanjeev Premi pr...@ti.com
---
 arch/arm/plat-omap/clock.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/arch/arm/plat-omap/clock.c b/arch/arm/plat-omap/clock.c
index 5261a09..7ea757e 100644
--- a/arch/arm/plat-omap/clock.c
+++ b/arch/arm/plat-omap/clock.c
@@ -175,6 +175,7 @@ EXPORT_SYMBOL(clk_get_parent);
 
 int __initdata mpurate;
 
+
 /*
  * By default we use the rate set by the bootloader.
  * You can override this with mpurate= cmdline option.
@@ -186,7 +187,7 @@ static int __init omap_clk_setup(char *str)
if (!mpurate)
return 1;
 
-   if (mpurate  1000)
+   if (mpurate  2000)
mpurate *= 100;
 
return 1;
-- 
1.6.6.1

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


[PATCHv2] omap3: Increase limit on bootarg 'mpurate'

2010-05-27 Thread Sanjeev Premi
The value of mpurate is currently expected to be less
than 1000 when specified in MHz.

This patch raises this limit to 2000 to support 1GHz
capable processors. The new limit should be reasonable
for quite some time.

Signed-off-by: Sanjeev Premi pr...@ti.com
---
v2: Removed a newline introduced in earlier patch
---
 arch/arm/plat-omap/clock.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/arm/plat-omap/clock.c b/arch/arm/plat-omap/clock.c
index 5261a09..4fd1e15 100644
--- a/arch/arm/plat-omap/clock.c
+++ b/arch/arm/plat-omap/clock.c
@@ -186,7 +186,7 @@ static int __init omap_clk_setup(char *str)
if (!mpurate)
return 1;
 
-   if (mpurate  1000)
+   if (mpurate  2000)
mpurate *= 100;
 
return 1;
-- 
1.6.6.1

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


[PATCH] omap: Macros for comapring si revisions

2010-03-24 Thread Sanjeev Premi
Fresh attempt to compare the silicon revision
bits independent of the silicon id.

Currently, omap_revision is compared as whole.
But, it doesn't represent multiple processors.

This patch only contains the basic set of macros
for discussion before I make changes in rest of
the code.

Sample usage:
/* Check for revision of processor(s) */
if (cpu_rev_eq(3430, ES_3_1)
 cpu_rev_ge(3630, ES_1_0) ) {
...
}

/* Check for revision in class of processors */
if (class_rev_eq(34, ES_3_1)) {
...
}

Since last patch[1], the real change is to make macros/
functions more parameterized.

  [1] http://marc.info/?l=linux-omapm=126322767404669w=2

Signed-off-by: Sanjeev Premi pr...@ti.com
---
 arch/arm/plat-omap/include/plat/cpu.h |  150 +
 1 files changed, 150 insertions(+), 0 deletions(-)

diff --git a/arch/arm/plat-omap/include/plat/cpu.h 
b/arch/arm/plat-omap/include/plat/cpu.h
index 7514174..00507d1 100644
--- a/arch/arm/plat-omap/include/plat/cpu.h
+++ b/arch/arm/plat-omap/include/plat/cpu.h
@@ -72,6 +72,11 @@ unsigned int omap_rev(void);
 #define OMAP_REVBITS_400x40
 
 /*
+ * Get the CPU Id for OMAP devices
+ */
+#define GET_OMAP_ID()  ((omap_rev()  16)  0x)
+
+/*
  * Get the CPU revision for OMAP devices
  */
 #define GET_OMAP_REVISION()((omap_rev()  8)  0xff)
@@ -458,4 +463,149 @@ OMAP3_HAS_FEATURE(neon, NEON)
 OMAP3_HAS_FEATURE(isp, ISP)
 OMAP3_HAS_FEATURE(192mhz_clk, 192MHZ_CLK)
 
+
+/*
+ * Mapping revision to silicon classes
+ */
+#define OMAP34XX_ES_1_0OMAP_REVBITS_00
+#define OMAP34XX_ES_2_0OMAP_REVBITS_10
+#define OMAP34XX_ES_2_1OMAP_REVBITS_20
+#define OMAP34XX_ES_3_0OMAP_REVBITS_30
+#define OMAP34XX_ES_3_1OMAP_REVBITS_40
+
+/*
+ * Mapping revision to individual silicons
+ */
+#define OMAP3430_ES_1_0OMAP_REVBITS_00
+#define OMAP3430_ES_2_0OMAP_REVBITS_10
+#define OMAP3430_ES_2_1OMAP_REVBITS_20
+#define OMAP3430_ES_3_0OMAP_REVBITS_30
+#define OMAP3430_ES_3_1OMAP_REVBITS_40
+
+
+/*
+ * Inline functions to compare revision for specific silicons
+ */
+static inline bool is_omap_rev_lt (u16 id, u16 rev)
+{
+   if (((GET_OMAP_ID()) == id) 
+   ((GET_OMAP_REVISION())  rev))
+   return true;
+   else
+   return false;
+}
+
+static inline bool is_omap_rev_le (u16 id, u16 rev)
+{
+   if (((GET_OMAP_ID()) == id) 
+   ((GET_OMAP_REVISION()) = rev))
+   return true;
+   else
+   return false;
+}
+
+static inline bool is_omap_rev_eq (u16 id, u16 rev)
+{
+   if (((GET_OMAP_ID()) == id) 
+   ((GET_OMAP_REVISION()) == rev))
+   return true;
+   else
+   return false;
+}
+
+static inline bool is_omap_rev_ne (u16 id, u16 rev)
+{
+   if (((GET_OMAP_ID()) == id) 
+   ((GET_OMAP_REVISION()) != rev))
+   return true;
+   else
+   return false;
+}
+
+static inline bool is_omap_rev_gt (u16 id, u16 rev)
+{
+   if (((GET_OMAP_ID()) == id) 
+   ((GET_OMAP_REVISION())  rev))
+   return true;
+   else
+   return false;
+}
+
+static inline bool is_omap_rev_ge (u16 id, u16 rev)
+{
+   if (((GET_OMAP_ID()) == id) 
+   ((GET_OMAP_REVISION()) = rev))
+   return true;
+   else
+   return false;
+}
+
+#define cpu_rev_lt(id, rev)is_omap_rev_lt(0x##id, OMAP##id##_##rev)
+#define cpu_rev_le(id, rev)is_omap_rev_le(0x##id, OMAP##id##_##rev)
+#define cpu_rev_eq(id, rev)is_omap_rev_eq(0x##id, OMAP##id##_##rev)
+#define cpu_rev_ne(id, rev)is_omap_rev_ne(0x##id, OMAP##id##_##rev)
+#define cpu_rev_gt(id, rev)is_omap_rev_gt(0x##id, OMAP##id##_##rev)
+#define cpu_rev_ge(id, rev)is_omap_rev_ge(0x##id, OMAP##id##_##rev)
+
+
+/*
+ * Inline functions to compare revision for class of silicons
+ */
+static inline bool is_class_rev_lt (u16 c, u16 rev)
+{
+   if (((GET_OMAP_CLASS) == c)  ((GET_OMAP_REVISION())  rev))
+   return true;
+   else
+   return false;
+
+return true;
+}
+
+static inline bool is_class_rev_le (u16 c, u16 rev)
+{
+   if (((GET_OMAP_CLASS) == c)  ((GET_OMAP_REVISION()) = rev))
+   return true;
+   else
+   return false;
+
+return true;
+}
+
+static inline bool is_class_rev_eq (u16 c, u16 rev)
+{
+   if (((GET_OMAP_CLASS) == c)  ((GET_OMAP_REVISION()) == rev))
+   return true;
+   else
+   return false;
+
+return true;
+}
+
+static inline bool is_class_rev_gt (u16 c, u16 rev)
+{
+   if (((GET_OMAP_CLASS) == c)  ((GET_OMAP_REVISION())  rev))
+   return true;
+   else
+   return false;
+
+return true;
+}
+
+static

[RFC] omap3: Fix incorrect restore pointer

2010-03-19 Thread Sanjeev Premi
Due to check for absolute omap_rev() values against
ES3.0 and ES3.1, the restore pointer for OMAP3630 is
incorrectly assigned.

The problem may be observed with OMAP3430 ES3.1.1
as well.

Submitting this as RFC because I have only compiled
with changes. Haven't yet tried on EVM. Will submit
formal patch after testing.

Signed-off-by: Sanjeev Premi pr...@ti.com
---
 arch/arm/mach-omap2/control.c |7 +--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/control.c b/arch/arm/mach-omap2/control.c
index 43f8a33..575593b 100644
--- a/arch/arm/mach-omap2/control.c
+++ b/arch/arm/mach-omap2/control.c
@@ -213,13 +213,16 @@ void omap3_save_scratchpad_contents(void)
 
/* Populate the Scratchpad contents */
scratchpad_contents.boot_config_ptr = 0x0;
-   if (omap_rev() != OMAP3430_REV_ES3_0 
-   omap_rev() != OMAP3430_REV_ES3_1)
+
+   if (!cpu_is_omap3630() 
+   (cpu_is_34xx() 
+   (omap_rev()  OMAP3430_REV_ES3_0)))
scratchpad_contents.public_restore_ptr =
virt_to_phys(get_restore_pointer());
else
scratchpad_contents.public_restore_ptr =
virt_to_phys(get_es3_restore_pointer());
+
if (omap_type() == OMAP2_DEVICE_TYPE_GP)
scratchpad_contents.secure_ram_restore_ptr = 0x0;
else
-- 
1.6.6.1

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


[PATCH] OMAP3EVM: PM: Update defconfig

2010-02-17 Thread Sanjeev Premi
This patch updates the omap3_evm_defconfig to
select CONFIG_PM_DEBUG and CONFIG_DEBUG_FS.

Signed-off-by: Sanjeev Premi pr...@ti.com
---
 arch/arm/configs/omap3_evm_defconfig |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/configs/omap3_evm_defconfig 
b/arch/arm/configs/omap3_evm_defconfig
index 86cc4be..b938507 100644
--- a/arch/arm/configs/omap3_evm_defconfig
+++ b/arch/arm/configs/omap3_evm_defconfig
@@ -333,7 +333,7 @@ CONFIG_BINFMT_MISC=y
 # Power management options
 #
 CONFIG_PM=y
-# CONFIG_PM_DEBUG is not set
+CONFIG_PM_DEBUG=y
 CONFIG_PM_SLEEP=y
 CONFIG_SUSPEND=y
 CONFIG_SUSPEND_FREEZER=y
@@ -1339,7 +1339,7 @@ CONFIG_ENABLE_MUST_CHECK=y
 CONFIG_FRAME_WARN=1024
 CONFIG_MAGIC_SYSRQ=y
 # CONFIG_UNUSED_SYMBOLS is not set
-# CONFIG_DEBUG_FS is not set
+CONFIG_DEBUG_FS=y
 # CONFIG_HEADERS_CHECK is not set
 CONFIG_DEBUG_KERNEL=y
 # CONFIG_DEBUG_SHIRQ is not set
-- 
1.6.6.1

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


[PATCHv2] OMAP3EVM: PM: Update defconfig

2010-02-17 Thread Sanjeev Premi
This patch updates the omap3_evm_defconfig to
select these options:
  * CONFIG_PM_DEBUG
  * CONFIG_DEBUG_FS
  * CONFIG_OMAP_SMARTREFLEX

Signed-off-by: Sanjeev Premi pr...@ti.com
---

 Found that SmartReflex was disabled as well. Didn't
 feel need for a different patch for same.


 arch/arm/configs/omap3_evm_defconfig |6 --
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/arm/configs/omap3_evm_defconfig 
b/arch/arm/configs/omap3_evm_defconfig
index 86cc4be..e2ad859 100644
--- a/arch/arm/configs/omap3_evm_defconfig
+++ b/arch/arm/configs/omap3_evm_defconfig
@@ -187,6 +187,8 @@ CONFIG_ARCH_OMAP3=y
 #
 # OMAP Feature Selections
 #
+CONFIG_OMAP_SMARTREFLEX=y
+# CONFIG_OMAP_SMARTREFLEX_TESTING is not set
 # CONFIG_OMAP_DEBUG_POWERDOMAIN is not set
 # CONFIG_OMAP_DEBUG_CLOCKDOMAIN is not set
 CONFIG_OMAP_RESET_CLOCKS=y
@@ -333,7 +335,7 @@ CONFIG_BINFMT_MISC=y
 # Power management options
 #
 CONFIG_PM=y
-# CONFIG_PM_DEBUG is not set
+CONFIG_PM_DEBUG=y
 CONFIG_PM_SLEEP=y
 CONFIG_SUSPEND=y
 CONFIG_SUSPEND_FREEZER=y
@@ -1339,7 +1341,7 @@ CONFIG_ENABLE_MUST_CHECK=y
 CONFIG_FRAME_WARN=1024
 CONFIG_MAGIC_SYSRQ=y
 # CONFIG_UNUSED_SYMBOLS is not set
-# CONFIG_DEBUG_FS is not set
+CONFIG_DEBUG_FS=y
 # CONFIG_HEADERS_CHECK is not set
 CONFIG_DEBUG_KERNEL=y
 # CONFIG_DEBUG_SHIRQ is not set
-- 
1.6.6.1

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


[PATCH 1/3] omap3evm: Add mux settings for keypad

2010-02-05 Thread Sanjeev Premi
This patch sets SYS_NIRQ for keypad input. It also
sets the same as a wakeup event from OFF mode.

Signed-off-by: Sanjeev Premi pr...@ti.com
---
 arch/arm/mach-omap2/board-omap3evm.c |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/board-omap3evm.c 
b/arch/arm/mach-omap2/board-omap3evm.c
index fde27cf..19363bd 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -424,6 +424,10 @@ static struct ehci_hcd_omap_platform_data ehci_pdata 
__initconst = {
 
 #ifdef CONFIG_OMAP_MUX
 static struct omap_board_mux board_mux[] __initdata = {
+   OMAP3_MUX(SYS_NIRQ, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP |
+   OMAP_PIN_OFF_INPUT_PULLUP |
+   OMAP_PIN_OFF_WAKEUPENABLE),
+
{ .reg_offset = OMAP_MUX_TERMINATOR },
 };
 #else
-- 
1.6.2.2

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


[PATCH 2/3] omap3evm: Fixes after moving to matrix_keypad

2010-02-05 Thread Sanjeev Premi
The keypad was not working properly after migrating
to matrix_keypad.

Swapped the row, col fields of the KEY() macro in
the keymap definition to get it working again.

Signed-off-by: Sanjeev Premi pr...@ti.com
---
 arch/arm/mach-omap2/board-omap3evm.c |   27 +++
 1 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/arch/arm/mach-omap2/board-omap3evm.c 
b/arch/arm/mach-omap2/board-omap3evm.c
index 19363bd..c8e1208 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -258,20 +258,23 @@ static struct twl4030_usb_data omap3evm_usb_data = {
 
 static int board_keymap[] = {
KEY(0, 0, KEY_LEFT),
-   KEY(0, 1, KEY_RIGHT),
-   KEY(0, 2, KEY_A),
-   KEY(0, 3, KEY_B),
-   KEY(1, 0, KEY_DOWN),
+   KEY(0, 1, KEY_DOWN),
+   KEY(0, 2, KEY_ENTER),
+   KEY(0, 3, KEY_M),
+
+   KEY(1, 0, KEY_RIGHT),
KEY(1, 1, KEY_UP),
-   KEY(1, 2, KEY_E),
-   KEY(1, 3, KEY_F),
-   KEY(2, 0, KEY_ENTER),
-   KEY(2, 1, KEY_I),
+   KEY(1, 2, KEY_I),
+   KEY(1, 3, KEY_N),
+
+   KEY(2, 0, KEY_A),
+   KEY(2, 1, KEY_E),
KEY(2, 2, KEY_J),
-   KEY(2, 3, KEY_K),
-   KEY(3, 0, KEY_M),
-   KEY(3, 1, KEY_N),
-   KEY(3, 2, KEY_O),
+   KEY(2, 3, KEY_O),
+
+   KEY(3, 0, KEY_B),
+   KEY(3, 1, KEY_F),
+   KEY(3, 2, KEY_K),
KEY(3, 3, KEY_P)
 };
 
-- 
1.6.2.2

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


[PATCH 3/3] omap3evm: Configure GPIO175 for touchscreen PEN_IRQ

2010-02-05 Thread Sanjeev Premi
GPIO175 is used for PEN_IRQ on the EVM. This patch
sets the mux settings for the same.

Signed-off-by: Sanjeev Premi pr...@ti.com
---
 arch/arm/mach-omap2/board-omap3evm.c |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-omap2/board-omap3evm.c 
b/arch/arm/mach-omap2/board-omap3evm.c
index c8e1208..00bfe9b 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -430,7 +430,9 @@ static struct omap_board_mux board_mux[] __initdata = {
OMAP3_MUX(SYS_NIRQ, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP |
OMAP_PIN_OFF_INPUT_PULLUP |
OMAP_PIN_OFF_WAKEUPENABLE),
-
+   OMAP3_MUX(MCSPI1_CS1, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP |
+   OMAP_PIN_OFF_INPUT_PULLUP |
+   OMAP_PIN_OFF_WAKEUPENABLE),
{ .reg_offset = OMAP_MUX_TERMINATOR },
 };
 #else
-- 
1.6.2.2

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


[PATCH 1/3] omap3evm: Add mux settings for keypad

2010-02-04 Thread Sanjeev Premi
This patch sets SYS_NIRQ for keypad input. It also
sets the same as a wakeup event from OFF mode.

Signed-off-by: Sanjeev Premi pr...@ti.com
---
 arch/arm/mach-omap2/board-omap3evm.c |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/board-omap3evm.c 
b/arch/arm/mach-omap2/board-omap3evm.c
index 346c448..8be10cf 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -424,6 +424,10 @@ static struct ehci_hcd_omap_platform_data ehci_pdata 
__initconst = {
 
 #ifdef CONFIG_OMAP_MUX
 static struct omap_board_mux board_mux[] __initdata = {
+   OMAP3_MUX(SYS_NIRQ, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP |
+   OMAP_PIN_OFF_INPUT_PULLUP |
+   OMAP_PIN_OFF_WAKEUPENABLE),
+
{ .reg_offset = OMAP_MUX_TERMINATOR },
 };
 #else
-- 
1.6.2.2

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


[PATCH 2/3] omap3evm: Fixes after moving to matrix_keypad

2010-02-04 Thread Sanjeev Premi
The keypad was not working properly after migrating
to matrix_keypad.

Swapped the row, col fields of the KEY() macro in
the keymap definition to get it working again.

Signed-off-by: Sanjeev Premi pr...@ti.com
---
 arch/arm/mach-omap2/board-omap3evm.c |   27 +++
 1 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/arch/arm/mach-omap2/board-omap3evm.c 
b/arch/arm/mach-omap2/board-omap3evm.c
index 8be10cf..0b3b65a 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -258,20 +258,23 @@ static struct twl4030_usb_data omap3evm_usb_data = {
 
 static int board_keymap[] = {
KEY(0, 0, KEY_LEFT),
-   KEY(0, 1, KEY_RIGHT),
-   KEY(0, 2, KEY_A),
-   KEY(0, 3, KEY_B),
-   KEY(1, 0, KEY_DOWN),
+   KEY(0, 1, KEY_DOWN),
+   KEY(0, 2, KEY_ENTER),
+   KEY(0, 3, KEY_M),
+
+   KEY(1, 0, KEY_RIGHT),
KEY(1, 1, KEY_UP),
-   KEY(1, 2, KEY_E),
-   KEY(1, 3, KEY_F),
-   KEY(2, 0, KEY_ENTER),
-   KEY(2, 1, KEY_I),
+   KEY(1, 2, KEY_I),
+   KEY(1, 3, KEY_N),
+
+   KEY(2, 0, KEY_A),
+   KEY(2, 1, KEY_E),
KEY(2, 2, KEY_J),
-   KEY(2, 3, KEY_K),
-   KEY(3, 0, KEY_M),
-   KEY(3, 1, KEY_N),
-   KEY(3, 2, KEY_O),
+   KEY(2, 3, KEY_O),
+
+   KEY(3, 0, KEY_B),
+   KEY(3, 1, KEY_F),
+   KEY(3, 2, KEY_K),
KEY(3, 3, KEY_P)
 };
 
-- 
1.6.2.2

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


[PATCH 3/3] omap3evm: Configure GPIO175 for touchscreen PEN_IRQ

2010-02-04 Thread Sanjeev Premi
GPIO175 is used for PEN_IRQ on the EVM. This patch
sets the mux settings for the same.

Signed-off-by: Sanjeev Premi pr...@ti.com
---
 arch/arm/mach-omap2/board-omap3evm.c |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-omap2/board-omap3evm.c 
b/arch/arm/mach-omap2/board-omap3evm.c
index 0b3b65a..4f60d60 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -430,7 +430,9 @@ static struct omap_board_mux board_mux[] __initdata = {
OMAP3_MUX(SYS_NIRQ, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP |
OMAP_PIN_OFF_INPUT_PULLUP |
OMAP_PIN_OFF_WAKEUPENABLE),
-
+   OMAP3_MUX(MCSPI1_CS1, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP |
+   OMAP_PIN_OFF_INPUT_PULLUP |
+   OMAP_PIN_OFF_WAKEUPENABLE),
{ .reg_offset = OMAP_MUX_TERMINATOR },
 };
 #else
-- 
1.6.2.2

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


[PATCH 1/3] twl4030: keypad: Add suspend-resume functions

2010-02-04 Thread Sanjeev Premi
This patch adds suspend, resume functions to the
TWL4030 keypad driver when CONFIG_PM is selected.

Signed-off-by: Sanjeev Premi pr...@ti.com
---
 drivers/input/keyboard/twl4030_keypad.c |   18 ++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/drivers/input/keyboard/twl4030_keypad.c 
b/drivers/input/keyboard/twl4030_keypad.c
index 21d6184..af0651d 100644
--- a/drivers/input/keyboard/twl4030_keypad.c
+++ b/drivers/input/keyboard/twl4030_keypad.c
@@ -439,6 +439,22 @@ static int __devexit twl4030_kp_remove(struct 
platform_device *pdev)
return 0;
 }
 
+#ifdef CONFIG_PM
+static int twl4030_kp_suspend(struct platform_device *pdev, pm_message_t state)
+{
+   return 0;
+}
+
+static int twl4030_kp_resume(struct platform_device *pdev)
+{
+   return 0;
+}
+#else
+#define twl4030_kp_suspend NULL
+#define twl4030_kp_resume  NULL
+#endif
+
+
 /*
  * NOTE: twl4030 are multi-function devices connected via I2C.
  * So this device is a child of an I2C parent, thus it needs to
@@ -448,6 +464,8 @@ static int __devexit twl4030_kp_remove(struct 
platform_device *pdev)
 static struct platform_driver twl4030_kp_driver = {
.probe  = twl4030_kp_probe,
.remove = __devexit_p(twl4030_kp_remove),
+   .suspend= twl4030_kp_suspend,
+   .resume = twl4030_kp_resume,
.driver = {
.name   = twl4030_keypad,
.owner  = THIS_MODULE,
-- 
1.6.2.2

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


[PATCH 2/3] twl4030: keypad: Hooks for board specific suspend-resume

2010-02-04 Thread Sanjeev Premi
This patch adds hooks to support board specific
implementation during the suspend and resume operations.

The TWL4030 can be connected to multiple boards. Without
these hooks, board specific macros will be required in a
generic driver.

Signed-off-by: Sanjeev Premi pr...@ti.com
---
 drivers/input/keyboard/twl4030_keypad.c |   10 ++
 include/linux/i2c/twl.h |   12 
 2 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/drivers/input/keyboard/twl4030_keypad.c 
b/drivers/input/keyboard/twl4030_keypad.c
index af0651d..9950d7e 100644
--- a/drivers/input/keyboard/twl4030_keypad.c
+++ b/drivers/input/keyboard/twl4030_keypad.c
@@ -442,11 +442,21 @@ static int __devexit twl4030_kp_remove(struct 
platform_device *pdev)
 #ifdef CONFIG_PM
 static int twl4030_kp_suspend(struct platform_device *pdev, pm_message_t state)
 {
+   struct twl4030_keypad_data *pdata = pdev-dev.platform_data;
+
+   if (pdata-on_suspend)
+   pdata-on_suspend(pdata-pm_state);
+
return 0;
 }
 
 static int twl4030_kp_resume(struct platform_device *pdev)
 {
+   struct twl4030_keypad_data *pdata = pdev-dev.platform_data;
+
+   if (pdata-on_resume)
+   pdata-on_resume(pdata-pm_state);
+
return 0;
 }
 #else
diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
index bf1c5be..eefabf2 100644
--- a/include/linux/i2c/twl.h
+++ b/include/linux/i2c/twl.h
@@ -487,6 +487,18 @@ struct twl4030_keypad_data {
unsigned rows;
unsigned cols;
bool rep;
+#ifdef CONFIG_PM
+   /*
+* Board specific information required during suspend, resume.
+* E.g. configuration as wake-up source.
+*/
+   void *pm_state;
+   /*
+* Hooks for board specific execution during suspend, resume.
+*/
+   void (*on_suspend)(void *pstate);
+   void (*on_resume)(void *pstate);
+#endif
 };
 
 enum twl4030_usb_mode {
-- 
1.6.2.2

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


[PATCH 0/3] twl4030: keypad: Support for suspend-resume

2010-02-04 Thread Sanjeev Premi
This set adds suspend-resume functionality to the TWL4030
keypad driver. It also adds the capability to wakeup from
the OFF mode.

These 2 patches don't depend upon the code in pm branch. And
have been tested on linux-omap/master (c6348aa):
  twl4030: keypad: Add suspend-resume functions
  twl4030: keypad: Hooks for board specific suspend-resume

The complete set has been tested on linux-omap/pm (c6348aa).

All testing done on OMAP3EVM.

Sanjeev Premi (3):
  twl4030: keypad: Add suspend-resume functions
  twl4030: keypad: Hooks for board specific suspend-resume
  OMAP3: PM: Wakeup from TWL4030 keypad with OFF mode

 arch/arm/mach-omap2/board-omap3evm.c|   86 +++
 drivers/input/keyboard/twl4030_keypad.c |   28 ++
 include/linux/i2c/twl.h |   12 
 3 files changed, 126 insertions(+), 0 deletions(-)
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCHv2] omap3: Check return values for clk_get()

2010-01-28 Thread Sanjeev Premi
This patch checks if clk_get() returned success for
the clocks used in function omap2_clk_arch_init().

This version incorporates review comments from
Kevin Hilman and Paul Walmsley.

Signed-off-by: Sanjeev Premi pr...@ti.com
---
 arch/arm/mach-omap2/clock34xx.c |   16 
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/clock34xx.c b/arch/arm/mach-omap2/clock34xx.c
index 1f1b5a6..ad09f04 100644
--- a/arch/arm/mach-omap2/clock34xx.c
+++ b/arch/arm/mach-omap2/clock34xx.c
@@ -21,6 +21,7 @@
 #include linux/delay.h
 #include linux/clk.h
 #include linux/io.h
+#include linux/err.h
 
 #include plat/cpu.h
 #include plat/clock.h
@@ -184,6 +185,7 @@ static int __init omap3xxx_clk_arch_init(void)
 {
struct clk *osc_sys_ck, *dpll1_ck, *arm_fck, *core_ck;
unsigned long osc_sys_rate;
+   bool err = 0 ;
 
if (!cpu_is_omap34xx())
return 0;
@@ -193,9 +195,23 @@ static int __init omap3xxx_clk_arch_init(void)
 
/* XXX test these for success */
dpll1_ck = clk_get(NULL, dpll1_ck);
+   if (WARN(IS_ERR(dpll1_ck), Failed to get dpll1_ck.\n))
+   err = 1;
+
arm_fck = clk_get(NULL, arm_fck);
+   if (WARN(IS_ERR(arm_fck), Failed to get arm_fck.\n))
+   err = 1;
+
core_ck = clk_get(NULL, core_ck);
+   if (WARN(IS_ERR(core_ck), Failed to get core_ck.\n))
+   err = 1;
+
osc_sys_ck = clk_get(NULL, osc_sys_ck);
+   if (WARN(IS_ERR(osc_sys_ck), Failed to get osc_sys_ck.\n))
+   err = 1;
+
+   if (err)
+   return -ENOENT;
 
/* REVISIT: not yet ready for 343x */
if (clk_set_rate(dpll1_ck, mpurate))
-- 
1.6.2.2

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


[PATCHv3 0/1] Common mechanism to identify Si revision

2010-01-08 Thread Sanjeev Premi
Current implementation of identifying silicon revision
uses whole number returned by omap_rev() - which includes
cpu id and class as well.

As new silicons are added in 35x, 36x and 44x series,
many 'greater than' comparisons are automatically true;
but 'less than/ equal to' comparisons are no always right.

Also, there could be a problem when revisions of newer
silicons arrive.

This patch uses only revision bits to identify silicon
revision - independent of silicon being used.

This version came after long period as i was trying ways
to include the verbose cpuid in either function name or
signature. But final outcome was bit messy and aborting
it (for now).

  [1] http://marc.info/?l=linux-omapm=125476176410106w=2
  [2] http://marc.info/?l=linux-omapm=125197467922935w=2

Sanjeev Premi (1):
  omap3: Add macros for comparing si revision

 arch/arm/mach-omap2/clock34xx.c   |2 +-
 arch/arm/mach-omap2/clock34xx_data.c  |6 ++-
 arch/arm/mach-omap2/control.c |7 ++--
 arch/arm/mach-omap2/id.c  |   13 +++
 arch/arm/mach-omap2/pm34xx.c  |   35 -
 arch/arm/plat-omap/include/plat/cpu.h |   55 +
 6 files changed, 97 insertions(+), 21 deletions(-)

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


[PATCH 1/1] omap3: Add macros for comparing si revision

2010-01-08 Thread Sanjeev Premi
This patch adds verbose macros for comparing silicon
revision bits. Current mechanism of comparing complete
'omap_revision' does not work/ represent the multiple
processors, and their revisions.

Existing instances of comparison via omap_rev() have
been replaced with new macros.

Signed-off-by: Sanjeev Premi pr...@ti.com
---
 arch/arm/mach-omap2/clock34xx.c   |2 +-
 arch/arm/mach-omap2/clock34xx_data.c  |6 ++-
 arch/arm/mach-omap2/control.c |7 ++--
 arch/arm/mach-omap2/id.c  |   13 +++
 arch/arm/mach-omap2/pm34xx.c  |   35 -
 arch/arm/plat-omap/include/plat/cpu.h |   55 +
 6 files changed, 97 insertions(+), 21 deletions(-)

diff --git a/arch/arm/mach-omap2/clock34xx.c b/arch/arm/mach-omap2/clock34xx.c
index d4217b9..6cef2f1 100644
--- a/arch/arm/mach-omap2/clock34xx.c
+++ b/arch/arm/mach-omap2/clock34xx.c
@@ -154,7 +154,7 @@ int omap3_dpll4_set_rate(struct clk *clk, unsigned long 
rate)
 * on 3430ES1 prevents us from changing DPLL multipliers or dividers
 * on DPLL4.
 */
-   if (omap_rev() == OMAP3430_REV_ES1_0) {
+   if (cpu_is_omap34xx()  omap_rev_is_1_0()) {
printk(KERN_ERR clock: DPLL4 cannot change rate due to 
   silicon 'Limitation 2.5' on 3430ES1.\n);
return -EINVAL;
diff --git a/arch/arm/mach-omap2/clock34xx_data.c 
b/arch/arm/mach-omap2/clock34xx_data.c
index c6031d7..0a00a49 100644
--- a/arch/arm/mach-omap2/clock34xx_data.c
+++ b/arch/arm/mach-omap2/clock34xx_data.c
@@ -3230,7 +3230,7 @@ int __init omap2_clk_init(void)
 * Update this if there are further clock changes between ES2
 * and production parts
 */
-   if (omap_rev() == OMAP3430_REV_ES1_0) {
+   if (cpu_is_omap34xx()  omap_rev_is_1_0()) {
/* No 3430ES1-only rates exist, so no RATE_IN_3430ES1 */
cpu_clkflg |= CK_3430ES1;
} else {
@@ -3282,7 +3282,9 @@ int __init omap2_clk_init(void)
/*
 * Lock DPLL5 and put it in autoidle.
 */
-   if (omap_rev() = OMAP3430_REV_ES2_0)
+   if ((cpu_is_omap34xx()  omap_rev_ge_2_0())
+   || cpu_is_omap3505() || cpu_is_omap3517()
+   || cpu_is_omap3630())
omap3_clk_lock_dpll5();
 
/* Avoid sleeping during omap3_core_dpll_m2_set_rate() */
diff --git a/arch/arm/mach-omap2/control.c b/arch/arm/mach-omap2/control.c
index cdd1f35..55e9b0a 100644
--- a/arch/arm/mach-omap2/control.c
+++ b/arch/arm/mach-omap2/control.c
@@ -209,8 +209,7 @@ void omap3_save_scratchpad_contents(void)
 
/* Populate the Scratchpad contents */
scratchpad_contents.boot_config_ptr = 0x0;
-   if (omap_rev() != OMAP3430_REV_ES3_0 
-   omap_rev() != OMAP3430_REV_ES3_1)
+   if (cpu_is_omap34xx()  omap_rev_le_3_0())
scratchpad_contents.public_restore_ptr =
virt_to_phys(get_restore_pointer());
else
@@ -271,7 +270,9 @@ void omap3_save_scratchpad_contents(void)
 * of AUTO_CNT = 1 prior to any transition to OFF mode.
 */
if ((omap_type() != OMAP2_DEVICE_TYPE_GP)
-(omap_rev() = OMAP3430_REV_ES3_0))
+((cpu_is_omap34xx()  omap_rev_ge_3_0())
+   || cpu_is_omap3505() || cpu_is_omap3517()
+   || cpu_is_omap3630()))
sdrc_block_contents.power = (sdrc_read_reg(SDRC_POWER) 
~(SDRC_POWER_AUTOCOUNT_MASK|
SDRC_POWER_CLKCTRL_MASK)) |
diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index a091b53..2d4c246 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -379,19 +379,18 @@ void __init omap2_check_revision(void)
omap_chip.oc |= CHIP_IS_OMAP2420;
} else if (cpu_is_omap3505() || cpu_is_omap3517()) {
omap_chip.oc = CHIP_IS_OMAP3430 | CHIP_IS_OMAP3430ES3_1;
+   } else if (cpu_is_omap3630()) {
+   omap_chip.oc = CHIP_IS_OMAP3430 | CHIP_IS_OMAP3630ES1;
} else if (cpu_is_omap343x()) {
omap_chip.oc = CHIP_IS_OMAP3430;
-   if (omap_rev() == OMAP3430_REV_ES1_0)
+   if (omap_rev_is_1_0())
omap_chip.oc |= CHIP_IS_OMAP3430ES1;
-   else if (omap_rev() = OMAP3430_REV_ES2_0 
-omap_rev() = OMAP3430_REV_ES2_1)
+   else if (omap_rev_is_2_0() || omap_rev_is_2_1())
omap_chip.oc |= CHIP_IS_OMAP3430ES2;
-   else if (omap_rev() == OMAP3430_REV_ES3_0)
+   else if (omap_rev_is_3_0())
omap_chip.oc |= CHIP_IS_OMAP3430ES3_0;
-   else if (omap_rev() == OMAP3430_REV_ES3_1)
+   else if (omap_rev_is_3_1

[PATCH] omap3: Check return values for clk_get

2010-01-08 Thread Sanjeev Premi
This patch checks if clk_get() returned success for
the clocks used in function omap2_clk_arch_init().

Signed-off-by: Sanjeev Premi pr...@ti.com
---
 arch/arm/mach-omap2/clock34xx.c |   25 +++--
 1 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/clock34xx.c b/arch/arm/mach-omap2/clock34xx.c
index d4217b9..2c2165b 100644
--- a/arch/arm/mach-omap2/clock34xx.c
+++ b/arch/arm/mach-omap2/clock34xx.c
@@ -316,17 +316,38 @@ static int __init omap2_clk_arch_init(void)
 {
struct clk *osc_sys_ck, *dpll1_ck, *arm_fck, *core_ck;
unsigned long osc_sys_rate;
+   short err = 0 ;
 
if (!mpurate)
return -EINVAL;
 
-   /* XXX test these for success */
dpll1_ck = clk_get(NULL, dpll1_ck);
+   if (dpll1_ck == NULL) {
+   err = 1;
+   pr_err(*** Failed to get dpll1_ck.\n);
+   }
+
arm_fck = clk_get(NULL, arm_fck);
+   if (arm_fck == NULL) {
+   err = 1;
+   pr_err(*** Failed to get arm_fck.\n);
+   }
+
core_ck = clk_get(NULL, core_ck);
+   if (core_ck == NULL) {
+   err = 1;
+   pr_err(*** Failed to get core_ck.\n);
+   }
+
osc_sys_ck = clk_get(NULL, osc_sys_ck);
+   if (osc_sys_ck == NULL) {
+   err = 1;
+   pr_err(*** Failed to get osc_sys_ck.\n);
+   }
+
+   if (err)
+   return 1;
 
-   /* REVISIT: not yet ready for 343x */
if (clk_set_rate(dpll1_ck, mpurate))
printk(KERN_ERR *** Unable to set MPU rate\n);
 
-- 
1.6.2.2

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


[PATCH] omap2/3: mtd: fix compile warning

2009-12-29 Thread Sanjeev Premi
This patch fixes following compile warning:

drivers/mtd/nand/omap2.c:508: warning: passing argumen
t 2 of 'omap_nand_dma_transfer' discards qualifiers fr
om pointer target type

Signed-off-by: Sanjeev Premi pr...@ti.com
---
 drivers/mtd/nand/omap2.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c
index 1bb799f..08c193c 100644
--- a/drivers/mtd/nand/omap2.c
+++ b/drivers/mtd/nand/omap2.c
@@ -505,7 +505,7 @@ static void omap_write_buf_dma_pref(struct mtd_info *mtd,
omap_write_buf_pref(mtd, buf, len);
else
/* start transfer in DMA mode */
-   omap_nand_dma_transfer(mtd, buf, len, 0x1);
+   omap_nand_dma_transfer(mtd, (void *)buf, len, 0x1);
 }
 
 /**
-- 
1.6.2.2

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


[PATCH] omap35x: Fix OMAP35XX_REV() macros

2009-12-10 Thread Sanjeev Premi
In original implementation, the revision passed to
these macros contained revision number in lower nibble.

But, later the revision bits (OMAP_REVBITS_XX) were
defined to use omap_revision[15:08] where revision
number is containied in higher nibble.

This patch updates the macros; else incorrect revision
is detected for OMAP35xx devices.

Signed-off-by: Sanjeev Premi pr...@ti.com
---
 arch/arm/plat-omap/include/plat/cpu.h |   12 ++--
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/arm/plat-omap/include/plat/cpu.h 
b/arch/arm/plat-omap/include/plat/cpu.h
index 1a80722..8eaefc0 100644
--- a/arch/arm/plat-omap/include/plat/cpu.h
+++ b/arch/arm/plat-omap/include/plat/cpu.h
@@ -436,12 +436,12 @@ IS_OMAP_TYPE(3517, 0x3517)
 #define OMAP3630_REV_ES1_0 0x36300034
 
 #define OMAP35XX_CLASS 0x3534
-#define OMAP3503_REV(v)(OMAP35XX_CLASS | (0x3503  16) | (v 
 12))
-#define OMAP3515_REV(v)(OMAP35XX_CLASS | (0x3515  16) | (v 
 12))
-#define OMAP3525_REV(v)(OMAP35XX_CLASS | (0x3525  16) | (v 
 12))
-#define OMAP3530_REV(v)(OMAP35XX_CLASS | (0x3530  16) | (v 
 12))
-#define OMAP3505_REV(v)(OMAP35XX_CLASS | (0x3505  16) | (v 
 12))
-#define OMAP3517_REV(v)(OMAP35XX_CLASS | (0x3517  16) | (v 
 12))
+#define OMAP3503_REV(v)(OMAP35XX_CLASS | (0x3503  16) | (v 
 8))
+#define OMAP3515_REV(v)(OMAP35XX_CLASS | (0x3515  16) | (v 
 8))
+#define OMAP3525_REV(v)(OMAP35XX_CLASS | (0x3525  16) | (v 
 8))
+#define OMAP3530_REV(v)(OMAP35XX_CLASS | (0x3530  16) | (v 
 8))
+#define OMAP3505_REV(v)(OMAP35XX_CLASS | (0x3505  16) | (v 
 8))
+#define OMAP3517_REV(v)(OMAP35XX_CLASS | (0x3517  16) | (v 
 8))
 
 #define OMAP443X_CLASS 0x44300034
 
-- 
1.6.2.2

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


[PATCH] AM35xx: Update the macro names

2009-12-09 Thread Sanjeev Premi
Devices AM3505 and AM3517 will be more commonly available.
Also, with more devices planned in this family, it is better
to rename the macros to follow cpu_is_amXXX() naming.

Signed-off-by: Sanjeev Premi pr...@ti.com
---
 arch/arm/mach-omap2/id.c  |4 ++--
 arch/arm/plat-omap/include/plat/cpu.h |4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index 4fad192..9ab97ce 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -233,7 +233,7 @@ void __init omap3_check_revision(void)
case 0xb868:
/* Handle OMAP35xx/AM35xx devices
 *
-* Set the device to be OMAP3505 here. Actual device
+* Set the device to be AM3505/OMAP3505 here. Actual device
 * is identified later based on the features.
 */
omap_revision = OMAP3505_REV(rev);
@@ -263,7 +263,7 @@ void __init omap3_cpuinfo(void)
 */
if (cpu_is_omap3630()) {
strcpy(cpu_name, OMAP3630);
-   } else if (cpu_is_omap3505()) {
+   } else if (cpu_is_am3505()) {
/*
 * AM35xx devices
 */
diff --git a/arch/arm/plat-omap/include/plat/cpu.h 
b/arch/arm/plat-omap/include/plat/cpu.h
index 2e17890..8dd8801 100644
--- a/arch/arm/plat-omap/include/plat/cpu.h
+++ b/arch/arm/plat-omap/include/plat/cpu.h
@@ -399,8 +399,8 @@ IS_OMAP_TYPE(3517, 0x3517)
(omap3_has_sgx()) \
(!omap3_has_iva()))
 # define cpu_is_omap3530() (cpu_is_omap3430())
-# define cpu_is_omap3505() is_omap3505()
-# define cpu_is_omap3517() is_omap3517()
+# define cpu_is_am3505()   is_omap3505()
+# define cpu_is_am3517()   is_omap3517()
 # undef cpu_is_omap3630
 # define cpu_is_omap3630() is_omap363x()
 #endif
-- 
1.6.2.2

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


[PATCH] omap3: Fix macros for 3515 and 3525 inversion

2009-12-09 Thread Sanjeev Premi
From: Sergey Lapin slapi...@gmail.com

The macros for detecting the cpu had same
inversion problem fixed in earlier patch.

 [1] omap3: id code detection 3525 vs 3515

Signed-off-by: Sanjeev Premi pr...@ti.com
---
 arch/arm/plat-omap/include/plat/cpu.h |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/arm/plat-omap/include/plat/cpu.h 
b/arch/arm/plat-omap/include/plat/cpu.h
index 8dd8801..1a80722 100644
--- a/arch/arm/plat-omap/include/plat/cpu.h
+++ b/arch/arm/plat-omap/include/plat/cpu.h
@@ -393,11 +393,11 @@ IS_OMAP_TYPE(3517, 0x3517)
(!omap3_has_iva())\
(!omap3_has_sgx()))
 # define cpu_is_omap3515() (cpu_is_omap3430()\
-   (omap3_has_iva()) \
-   (!omap3_has_sgx()))
+   (!omap3_has_iva())\
+   (omap3_has_sgx()))
 # define cpu_is_omap3525() (cpu_is_omap3430()\
-   (omap3_has_sgx()) \
-   (!omap3_has_iva()))
+   (!omap3_has_sgx())\
+   (omap3_has_iva()))
 # define cpu_is_omap3530() (cpu_is_omap3430())
 # define cpu_is_am3505()   is_omap3505()
 # define cpu_is_am3517()   is_omap3517()
-- 
1.6.2.2

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


[PATCH v2] AM35xx: Update the macro names

2009-12-09 Thread Sanjeev Premi
Devices AM3505 and AM3517 will be more commonly available.
Also, with more devices planned in this family, it is better
to rename the macros to follow cpu_is_amXXX() naming.

Signed-off-by: Sanjeev Premi pr...@ti.com
---
 arch/arm/mach-omap2/id.c  |6 +++---
 arch/arm/plat-omap/include/plat/cpu.h |4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index 4fad192..d1bd8ba 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -233,7 +233,7 @@ void __init omap3_check_revision(void)
case 0xb868:
/* Handle OMAP35xx/AM35xx devices
 *
-* Set the device to be OMAP3505 here. Actual device
+* Set the device to be AM3505/OMAP3505 here. Actual device
 * is identified later based on the features.
 */
omap_revision = OMAP3505_REV(rev);
@@ -263,7 +263,7 @@ void __init omap3_cpuinfo(void)
 */
if (cpu_is_omap3630()) {
strcpy(cpu_name, OMAP3630);
-   } else if (cpu_is_omap3505()) {
+   } else if (cpu_is_am3505()) {
/*
 * AM35xx devices
 */
@@ -352,7 +352,7 @@ void __init omap2_check_revision(void)
} else if (cpu_is_omap242x()) {
/* Currently only supports 2420ES2.1.1 and 2420-all */
omap_chip.oc |= CHIP_IS_OMAP2420;
-   } else if (cpu_is_omap3505() || cpu_is_omap3517()) {
+   } else if (cpu_is_am3505() || cpu_is_am3517()) {
omap_chip.oc = CHIP_IS_OMAP3430 | CHIP_IS_OMAP3430ES3_1;
} else if (cpu_is_omap343x()) {
omap_chip.oc = CHIP_IS_OMAP3430;
diff --git a/arch/arm/plat-omap/include/plat/cpu.h 
b/arch/arm/plat-omap/include/plat/cpu.h
index 2e17890..8dd8801 100644
--- a/arch/arm/plat-omap/include/plat/cpu.h
+++ b/arch/arm/plat-omap/include/plat/cpu.h
@@ -399,8 +399,8 @@ IS_OMAP_TYPE(3517, 0x3517)
(omap3_has_sgx()) \
(!omap3_has_iva()))
 # define cpu_is_omap3530() (cpu_is_omap3430())
-# define cpu_is_omap3505() is_omap3505()
-# define cpu_is_omap3517() is_omap3517()
+# define cpu_is_am3505()   is_omap3505()
+# define cpu_is_am3517()   is_omap3517()
 # undef cpu_is_omap3630
 # define cpu_is_omap3630() is_omap363x()
 #endif
-- 
1.6.2.2

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


[PATCHv2 0/1] omap3: cpuidle: Update statistics for correct state

2009-11-24 Thread Sanjeev Premi
This is a fresh look at the problem [1] discussed earlier.

Generic approach here is same; but the 'valid' flag for the
target state is verified in omap3_enter_idle_bm(). If the
valid flag == 0, we look for next (lower) state with valid
flag == 1.

Have tried to optimize the look-up without loosing readability.

Sanjeev Premi (1):
  omap3: cpuidle: Update statistics for correct state

 arch/arm/mach-omap2/cpuidle34xx.c |   98 ++---
 arch/arm/mach-omap2/pm.h  |1 +
 arch/arm/mach-omap2/pm34xx.c  |4 ++
 3 files changed, 95 insertions(+), 8 deletions(-)

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


[PATCHv2 1/1] omap3: cpuidle: Update statistics for correct state

2009-11-24 Thread Sanjeev Premi
When 'enable_off_mode' is 0, the target power state for MPU
and CORE was locally changed to PWRDM_POWER_RET but, the
statistics are updated for idle state originally selected
by the governor.

This patch 'invalidates' the idle states that lead either of
MPU or Core to PWRDM_POWER_OFF state when 'enable_off_mode'
is '0'. The states are valid once 'enable_off_mode' is set
to '1'.

Added function next_valid_state() to check if current state
is valid; else get the next valid state. It is called from
omap3_enter_idle_bm().

Signed-off-by: Sanjeev Premi pr...@ti.com
---
 arch/arm/mach-omap2/cpuidle34xx.c |   98 ++---
 arch/arm/mach-omap2/pm.h  |1 +
 arch/arm/mach-omap2/pm34xx.c  |4 ++
 3 files changed, 95 insertions(+), 8 deletions(-)

diff --git a/arch/arm/mach-omap2/cpuidle34xx.c 
b/arch/arm/mach-omap2/cpuidle34xx.c
index fdfa1d5..308865c 100644
--- a/arch/arm/mach-omap2/cpuidle34xx.c
+++ b/arch/arm/mach-omap2/cpuidle34xx.c
@@ -45,6 +45,8 @@
 #define OMAP3_STATE_C6 5 /* C6 - MPU OFF + Core RET */
 #define OMAP3_STATE_C7 6 /* C7 - MPU OFF + Core OFF */
 
+#define OMAP3_STATE_MAX OMAP3_STATE_C7
+
 struct omap3_processor_cx {
u8 valid;
u8 type;
@@ -128,13 +130,6 @@ static int omap3_enter_idle(struct cpuidle_device *dev,
local_irq_disable();
local_fiq_disable();
 
-   if (!enable_off_mode) {
-   if (mpu_state  PWRDM_POWER_RET)
-   mpu_state = PWRDM_POWER_RET;
-   if (core_state  PWRDM_POWER_RET)
-   core_state = PWRDM_POWER_RET;
-   }
-
pwrdm_set_next_pwrst(mpu_pd, mpu_state);
pwrdm_set_next_pwrst(core_pd, core_state);
 
@@ -164,6 +159,65 @@ return_sleep_time:
return (u32)timespec_to_ns(ts_idle)/1000;
 }
 
+
+/* next_valid_state - Find next valid c-state
+ * @dev: cpuidle device
+ * @state: Currently selected c-state
+ *
+ * If the current state is valid, it is returned back to the caller.
+ * Else, this function searches for a lower c-state which is still
+ * valid (as defined in omap3_power_states[]).
+ */
+static struct cpuidle_state* next_valid_state(struct cpuidle_device *dev,
+   struct cpuidle_state *curr)
+{
+   struct cpuidle_state *next = NULL;
+   struct omap3_processor_cx *cx;
+
+   cx = (struct omap3_processor_cx *)cpuidle_get_statedata(curr);
+
+   /* Check if current state is valid */
+   if (cx-valid) {
+   next = curr;
+   }
+   else {
+   u8 idx = OMAP3_STATE_MAX;
+
+   /* Reach the current state starting at highest C-state */
+   for (; idx = OMAP3_STATE_C1; idx--) {
+   if (dev-states[idx] == curr) {
+   next = dev-states[idx];
+   break;
+   }
+   }
+
+   /*
+* Should never hit this condition.
+*/
+   BUG_ON(next == NULL);
+
+   /* Drop to next valid state.
+* Start search from the next (lower) state.
+*/
+   idx--;
+   for (; idx = OMAP3_STATE_C1; idx--) {
+   if (((struct omap3_processor_cx *)
+   cpuidle_get_statedata(
+   dev-states[idx]))-valid) {
+   next = dev-states[idx];
+   break;
+   }
+   }
+   /*
+* C1 and C2 are always valid.
+* So, no need to check for 'next==NULL' outside this loop.
+*/
+   }
+
+   return next;
+}
+
+
 /**
  * omap3_enter_idle_bm - Checks for any bus activity
  * @dev: cpuidle device
@@ -176,7 +230,7 @@ return_sleep_time:
 static int omap3_enter_idle_bm(struct cpuidle_device *dev,
   struct cpuidle_state *state)
 {
-   struct cpuidle_state *new_state = state;
+   struct cpuidle_state *new_state= next_valid_state(dev, state);
 
if ((state-flags  CPUIDLE_FLAG_CHECK_BM)  omap3_idle_bm_check()) {
BUG_ON(!dev-safe_state);
@@ -207,6 +261,32 @@ void omap3_pm_init_cpuidle(struct cpuidle_params 
*cpuidle_board_params)
return;
 }
 
+/**
+ * omap3_cpuidle_update_states - Update the cpuidle states.
+ *
+ * Currently, this function toggles the validity of idle states based upon
+ * the flag 'enable_off_mode'. When the flag is set all states are valid.
+ * Else, states leading to OFF state set to be invalid.
+ */
+void omap3_cpuidle_update_states(void)
+{
+   int i;
+
+   for (i = OMAP3_STATE_C1; i  OMAP3_MAX_STATES; i++) {
+   if (enable_off_mode) {
+   omap3_power_states[i].valid = 1;
+   }
+   else {
+   if ((omap3_power_states[i].mpu_state

[PATCH] omap3: sr: Update ON voltage levels based on VSEL

2009-11-23 Thread Sanjeev Premi
The settings for ON voltage level in the registers
PRM_VC_CMD_VAL_0,1 was not updated based on OPP
table.

Once the MPU resumes from OFF mode (during idle OR
suspend) the VDD1 voltage always returns to 1.2V.

This patch programs the value based on current OPP.

Signed-off-by: Sanjeev Premi pr...@ti.com
---
 arch/arm/mach-omap2/smartreflex.c |   19 ++-
 1 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-omap2/smartreflex.c 
b/arch/arm/mach-omap2/smartreflex.c
index be3a1da..4cbbd6f 100644
--- a/arch/arm/mach-omap2/smartreflex.c
+++ b/arch/arm/mach-omap2/smartreflex.c
@@ -313,6 +313,15 @@ static void sr_configure_vp(int srid)
PRM_VP1_CONFIG_TIMEOUTEN |
vsel  OMAP3430_INITVOLTAGE_SHIFT;
 
+   /*
+* Update the 'ON' voltage levels based on the VSEL.
+* (See spruf8c.pdf sec 1.5.3.1)
+*/
+   prm_rmw_mod_reg_bits(OMAP3430_VC_CMD_ON_MASK,
+   (vsel  OMAP3430_VC_CMD_ON_SHIFT),
+   OMAP3430_GR_MOD,
+   OMAP3_PRM_VC_CMD_VAL_0_OFFSET);
+
prm_write_mod_reg(vpconfig, OMAP3430_GR_MOD,
OMAP3_PRM_VP1_CONFIG_OFFSET);
prm_write_mod_reg(PRM_VP1_VSTEPMIN_SMPSWAITTIMEMIN |
@@ -354,6 +363,15 @@ static void sr_configure_vp(int srid)
else
vsel = l3_opps[target_opp_no].vsel;
 
+   /*
+* Update the 'ON' voltage levels based on the VSEL.
+* (See spruf8c.pdf sec 1.5.3.1)
+*/
+   prm_rmw_mod_reg_bits(OMAP3430_VC_CMD_ON_MASK,
+   (vsel  OMAP3430_VC_CMD_ON_SHIFT),
+   OMAP3430_GR_MOD,
+   OMAP3_PRM_VC_CMD_VAL_1_OFFSET);
+
vpconfig = PRM_VP2_CONFIG_ERROROFFSET |
PRM_VP2_CONFIG_ERRORGAIN |
PRM_VP2_CONFIG_TIMEOUTEN |
@@ -391,7 +409,6 @@ static void sr_configure_vp(int srid)
/* Clear force bit */
prm_clear_mod_reg_bits(OMAP3430_FORCEUPDATE, OMAP3430_GR_MOD,
   OMAP3_PRM_VP2_CONFIG_OFFSET);
-
}
 }
 
-- 
1.6.2.2

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


[PATCH] OMAP3: id code detection 3525 vs 3515

2009-11-23 Thread Sanjeev Premi
From: Sergey Lapin sla...@ossfans.org

The runtime detection of OMAP3515 and OMAP3525
was reversed.

Signed-off-by: Sergey Lapin sla...@ossfans.org
Signed-off-by: Sanjeev Premi pr...@ti.com
---
 arch/arm/mach-omap2/id.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index f48a4b2..4fad192 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -277,10 +277,10 @@ void __init omap3_cpuinfo(void)
} else if (omap3_has_iva()  omap3_has_sgx()) {
/* OMAP3430, OMAP3525, OMAP3515, OMAP3503 devices */
strcpy(cpu_name, OMAP3430/3530);
-   } else if (omap3_has_sgx()) {
+   } else if (omap3_has_iva()) {
omap_revision = OMAP3525_REV(rev);
strcpy(cpu_name, OMAP3525);
-   } else if (omap3_has_iva()) {
+   } else if (omap3_has_sgx()) {
omap_revision = OMAP3515_REV(rev);
strcpy(cpu_name, OMAP3515);
} else {
-- 
1.6.2.2

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


[PATCH v2] omap3: Change the default silicon

2009-11-13 Thread Sanjeev Premi
Currently the default silicon - in absence of
identification - is set to OMAP3630 ES1.0.

Though, condition may/should not arise; but
the default should be latest in the most
common silicon variant - currently OMAP3430
ES3.1.

Signed-off-by: Sanjeev Premi pr...@ti.com
---
 arch/arm/mach-omap2/id.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index 1c15112..7098e12 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -243,8 +243,8 @@ void __init omap3_check_revision(void)
}
break;
default:
-   /* Unknown default to latest silicon rev as default*/
-   omap_revision = OMAP3630_REV_ES1_0;
+   /* Unknown. Default to most common among all variants */
+   omap_revision = OMAP3430_REV_ES3_1;
}
 }
 
-- 
1.6.2.2

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


[PATCH 0/4] OMAP3:PM: T2 keypad: Wakeup with support for OFF mode

2009-11-09 Thread Sanjeev Premi
This patch series incrementally adds support for wake-up from
TWL4030 keypad when OFF mode is hot during suspend.

In the process, it extends existing driver to support board
specific implementation during suspend and resume operations.

The patch has been tested on OMAP3EVM and would be good to find
if it works on the 3430SDP as well.

TODO:
  The structire 'omap_keypad_pm_state' is being defined (and
  duplicated) in board specific files - board-omap3evm.c and
  board-3430sdp.c.

  This definition should ideally be in a header file, but
  matrix_keypad.h is not the right one. Also, plat/keypad.h
  is no longer used (inclusion results in warnings for duplicate
  definitions).
  
  Possible alternatives:
  - Cleanup plat/keypad.h - Not sure if it is being used by any
other platform.
  - Create a new header file alongside the board files for TWL4030
keypad. (Much of existing duplication also gets addressed).
  
  Either of these alternatives can be taken as a separate patch.
  OR, as follow-up to last 2 patches in this series. Thoughts?


Sanjeev Premi (4):
  OMAP3: PM: Add suspend-resume to TWL4030 keypad
  OMAP3: PM: T2 keypad: Add board specific suspend-resume functions
  OMAP3: PM: Wakeup from T2 keypad with OFF mode
  OMAP3: PM: Extend T2 wakeup support to 3430SDP

 arch/arm/mach-omap2/board-3430sdp.c |   89 +++
 arch/arm/mach-omap2/board-omap3evm.c|   89 +++
 drivers/input/keyboard/twl4030_keypad.c |   28 ++
 include/linux/i2c/twl4030.h |   12 
 4 files changed, 218 insertions(+), 0 deletions(-)

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


[PATCH 1/4] OMAP3: PM: Add suspend-resume to TWL4030 keypad

2009-11-09 Thread Sanjeev Premi
This patch adds suspend, resume functions to the
TWL4030 keypad driver when CONFIG_PM is selected.

Signed-off-by: Sanjeev Premi pr...@ti.com
---
 drivers/input/keyboard/twl4030_keypad.c |   18 ++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/drivers/input/keyboard/twl4030_keypad.c 
b/drivers/input/keyboard/twl4030_keypad.c
index 9a2977c..01f2ddd 100644
--- a/drivers/input/keyboard/twl4030_keypad.c
+++ b/drivers/input/keyboard/twl4030_keypad.c
@@ -446,6 +446,22 @@ static int __devexit twl4030_kp_remove(struct 
platform_device *pdev)
return 0;
 }
 
+#ifdef CONFIG_PM
+static int twl4030_kp_suspend(struct platform_device *pdev, pm_message_t state)
+{
+   return 0;
+}
+
+static int twl4030_kp_resume(struct platform_device *pdev)
+{
+   return 0;
+}
+#else
+#define twl4030_kp_suspend NULL
+#define twl4030_kp_resume  NULL
+#endif
+
+
 /*
  * NOTE: twl4030 are multi-function devices connected via I2C.
  * So this device is a child of an I2C parent, thus it needs to
@@ -455,6 +471,8 @@ static int __devexit twl4030_kp_remove(struct 
platform_device *pdev)
 static struct platform_driver twl4030_kp_driver = {
.probe  = twl4030_kp_probe,
.remove = __devexit_p(twl4030_kp_remove),
+   .suspend= twl4030_kp_suspend,
+   .resume = twl4030_kp_resume,
.driver = {
.name   = twl4030_keypad,
.owner  = THIS_MODULE,
-- 
1.6.2.2

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


[PATCH 2/4] OMAP3: PM: T2 keypad: Add board specific suspend-resume functions

2009-11-09 Thread Sanjeev Premi
This patch adds hooks to support board specific implementation
during the suspend and resume operations.

The TWL4030 can be connected to multiple boards. Without
these hooks, board specific macros will be required in a
generic driver.

Signed-off-by: Sanjeev Premi pr...@ti.com
---
 drivers/input/keyboard/twl4030_keypad.c |   10 ++
 include/linux/i2c/twl4030.h |   12 
 2 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/drivers/input/keyboard/twl4030_keypad.c 
b/drivers/input/keyboard/twl4030_keypad.c
index 01f2ddd..f58f3cf 100644
--- a/drivers/input/keyboard/twl4030_keypad.c
+++ b/drivers/input/keyboard/twl4030_keypad.c
@@ -449,11 +449,21 @@ static int __devexit twl4030_kp_remove(struct 
platform_device *pdev)
 #ifdef CONFIG_PM
 static int twl4030_kp_suspend(struct platform_device *pdev, pm_message_t state)
 {
+   struct twl4030_keypad_data *pdata = pdev-dev.platform_data;
+
+   if (pdata-on_suspend)
+   pdata-on_suspend(pdata-pm_state);
+
return 0;
 }
 
 static int twl4030_kp_resume(struct platform_device *pdev)
 {
+   struct twl4030_keypad_data *pdata = pdev-dev.platform_data;
+
+   if (pdata-on_resume)
+   pdata-on_resume(pdata-pm_state);
+
return 0;
 }
 #else
diff --git a/include/linux/i2c/twl4030.h b/include/linux/i2c/twl4030.h
index 508824e..dcd633a 100644
--- a/include/linux/i2c/twl4030.h
+++ b/include/linux/i2c/twl4030.h
@@ -360,6 +360,18 @@ struct twl4030_keypad_data {
unsigned rows;
unsigned cols;
bool rep;
+#ifdef CONFIG_PM
+   /*
+* Board specific information required during suspend, resume.
+* E.g. configuration as wake-up source.
+*/
+   void *pm_state;
+   /*
+* Hooks for board specific execution during suspend, resume.
+*/
+   void (*on_suspend)(void *pstate);
+   void (*on_resume)(void *pstate);
+#endif
 };
 
 enum twl4030_usb_mode {
-- 
1.6.2.2

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


[PATCH 3/4] OMAP3: PM: Wakeup from T2 keypad with OFF mode

2009-11-09 Thread Sanjeev Premi
This patch allows wakeup from T2 keypad when
OFF mode is hit during suspend.

Tested on OMAP3EVM.

Signed-off-by: Sanjeev Premi pr...@ti.com
---
 arch/arm/mach-omap2/board-omap3evm.c |   89 ++
 1 files changed, 89 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/board-omap3evm.c 
b/arch/arm/mach-omap2/board-omap3evm.c
index 89b284a..88b48a0 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -39,6 +39,7 @@
 #include plat/mux.h
 #include plat/usb.h
 #include plat/common.h
+#include plat/control.h
 #include plat/mcspi.h
 #include plat/clock.h
 #include plat/omap-pm.h
@@ -46,6 +47,7 @@
 #include sdram-micron-mt46h32m32lf-6.h
 #include mmc-twl4030.h
 #include pm.h
+#include prm-regbits-34xx.h
 #include omap3-opp.h
 
 #define OMAP3_EVM_TS_GPIO  175
@@ -169,6 +171,84 @@ static struct platform_device leds_gpio = {
},
 };
 
+#ifdef CONFIG_PM
+/*
+ * Save the state of keypad
+ *
+ * TODO: This definition should ideally be in a header file, but
+ *   matrix_keypad.h is not the right one. Also, plat/keypad.h
+ *   is no longer used.
+ */
+struct omap_keypad_pm_state {
+   void __iomem *wk_st;
+   void __iomem *wk_en;
+   u32 wk_mask;
+   u32 padconf;
+};
+
+/*
+ * Board specific hook for keypad suspend
+ */
+void omap3_evm_kp_suspend(void *ptr)
+{
+   struct omap_keypad_pm_state *pstate =
+   (struct omap_keypad_pm_state *)ptr;
+
+   if (pstate) {
+   /*
+* Set wake-enable bit
+*/
+   if (pstate-wk_en  pstate-wk_mask) {
+   u32 v = __raw_readl(pstate-wk_en);
+   v |= pstate-wk_mask;
+   __raw_writel(v, pstate-wk_en);
+   }
+   /*
+* Set corresponding IOPAD wakeup-enable
+*/
+   if (cpu_is_omap34xx()  pstate-padconf) {
+   u16 v = omap_ctrl_readw(pstate-padconf);
+   v |= OMAP3_PADCONF_WAKEUPENABLE0;
+   omap_ctrl_writew(v, pstate-padconf);
+   }
+   }
+}
+
+/*
+ * Board specific hook for keypad resume
+ */
+void omap3_evm_kp_resume(void *ptr)
+{
+   struct omap_keypad_pm_state *pstate =
+   (struct omap_keypad_pm_state *)ptr;
+
+   if (pstate) {
+   /*
+* Clear wake-enable bit
+*/
+   if (pstate-wk_en  pstate-wk_mask) {
+   u32 v = __raw_readl(pstate-wk_en);
+   v = ~pstate-wk_mask;
+   __raw_writel(v, pstate-wk_en);
+   }
+   /*
+* Clear corresponding IOPAD wakeup-enable
+*/
+   if (cpu_is_omap34xx()  pstate-padconf) {
+   u16 v = omap_ctrl_readw(pstate-padconf);
+   v = ~OMAP3_PADCONF_WAKEUPENABLE0;
+   omap_ctrl_writew(v, pstate-padconf);
+   }
+   }
+}
+
+static struct omap_keypad_pm_state omap3evm_kp_pm_state = {
+   .wk_st  = OMAP34XX_PRM_REGADDR(WKUP_MOD, PM_WKEN1),
+   .wk_en  = OMAP34XX_PRM_REGADDR(WKUP_MOD, PM_WKST1),
+   .wk_mask= OMAP3430_EN_GPIO1,
+   .padconf= 0x1e0,
+};
+#endif /* CONFIG_PM */
 
 static int omap3evm_twl_gpio_setup(struct device *dev,
unsigned gpio, unsigned ngpio)
@@ -236,6 +316,15 @@ static struct twl4030_keypad_data omap3evm_kp_data = {
.rows   = 4,
.cols   = 4,
.rep= 1,
+#ifdef CONFIG_PM
+   .pm_state   = (void *)omap3evm_kp_pm_state,
+   .on_suspend = omap3_evm_kp_suspend,
+   .on_resume  = omap3_evm_kp_resume,
+#else
+   .pm_state   = NULL,
+   .on_suspend = NULL,
+   .on_resume  = NULL,
+#endif /* CONFIG_PM */
 };
 
 static struct twl4030_madc_platform_data omap3evm_madc_data = {
-- 
1.6.2.2

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


[PATCH 4/4] OMAP3: PM: Extend T2 wakeup support to 3430SDP

2009-11-09 Thread Sanjeev Premi
This extends the wakeup support to the 3430 SDP platform.

Only compile tested.

Signed-off-by: Sanjeev Premi pr...@ti.com
---
 arch/arm/mach-omap2/board-3430sdp.c |   89 +++
 1 files changed, 89 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/board-3430sdp.c 
b/arch/arm/mach-omap2/board-3430sdp.c
index 11f0dc5..b22fd26 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -46,6 +46,7 @@
 #include sdram-qimonda-hyb18m512160af-6.h
 #include mmc-twl4030.h
 #include pm.h
+#include prm-regbits-34xx.h
 #include omap3-opp.h
 
 #define SDP3430_TS_GPIO_IRQ_SDPV1  3
@@ -91,6 +92,85 @@ static struct cpuidle_params omap3_cpuidle_params_table[] = {
{1, 3, 30},
 };
 
+#ifdef CONFIG_PM
+/*
+ * Save the state of keypad
+ *
+ * TODO: This definition should ideally be in a header file, but
+ *   matrix_keypad.h is not the right one. Also, plat/keypad.h
+ *   is no longer used.
+ */
+struct omap_keypad_pm_state {
+   void __iomem *wk_st;
+   void __iomem *wk_en;
+   u32 wk_mask;
+   u32 padconf;
+};
+
+/*
+ * Board specific hook for keypad suspend
+ */
+void sdp3430_kp_suspend(void *ptr)
+{
+   struct omap_keypad_pm_state *pstate =
+   (struct omap_keypad_pm_state *)ptr;
+
+   if (pstate) {
+   /*
+* Set wake-enable bit
+*/
+   if (pstate-wk_en  pstate-wk_mask) {
+   u32 v = __raw_readl(pstate-wk_en);
+   v |= pstate-wk_mask;
+   __raw_writel(v, pstate-wk_en);
+   }
+   /*
+* Set corresponding IOPAD wakeup-enable
+*/
+   if (cpu_is_omap34xx()  pstate-padconf) {
+   u16 v = omap_ctrl_readw(pstate-padconf);
+   v |= OMAP3_PADCONF_WAKEUPENABLE0;
+   omap_ctrl_writew(v, pstate-padconf);
+   }
+   }
+}
+
+/*
+ * Board specific hook for keypad resume
+ */
+void sdp3430_kp_resume(void *ptr)
+{
+   struct omap_keypad_pm_state *pstate =
+   (struct omap_keypad_pm_state *)ptr;
+
+   if (pstate) {
+   /*
+* Clear wake-enable bit
+*/
+   if (pstate-wk_en  pstate-wk_mask) {
+   u32 v = __raw_readl(pstate-wk_en);
+   v = ~pstate-wk_mask;
+   __raw_writel(v, pstate-wk_en);
+   }
+   /*
+* Clear corresponding IOPAD wakeup-enable
+*/
+   if (cpu_is_omap34xx()  pstate-padconf) {
+   u16 v = omap_ctrl_readw(pstate-padconf);
+   v = ~OMAP3_PADCONF_WAKEUPENABLE0;
+   omap_ctrl_writew(v, pstate-padconf);
+   }
+   }
+}
+
+static struct omap_keypad_pm_state omap3evm_kp_pm_state = {
+   .wk_st  = OMAP34XX_PRM_REGADDR(WKUP_MOD, PM_WKEN1),
+   .wk_en  = OMAP34XX_PRM_REGADDR(WKUP_MOD, PM_WKST1),
+   .wk_mask= OMAP3430_EN_GPIO1,
+   .padconf= 0x1e0,
+};
+#endif /* CONFIG_PM */
+
 static int board_keymap[] = {
KEY(0, 0, KEY_LEFT),
KEY(0, 1, KEY_RIGHT),
@@ -135,6 +215,15 @@ static struct twl4030_keypad_data sdp3430_kp_data = {
.rows   = 5,
.cols   = 6,
.rep= 1,
+#ifdef CONFIG_PM
+   .pm_state   = (void *)omap3evm_kp_pm_state,
+   .on_suspend = sdp3430_kp_suspend,
+   .on_resume  = sdp3430_kp_resume,
+#else
+   .pm_state   = NULL,
+   .on_suspend = NULL,
+   .on_resume  = NULL,
+#endif /* CONFIG_PM */
 };
 
 static int ts_gpio;/* Needed for ads7846_get_pendown_state */
-- 
1.6.2.2

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


[PATCH 0/2] omap3evm: enable keypad

2009-11-03 Thread Sanjeev Premi
This patch set enables the keypad in the default
configuration. It also adds it as wake-up source
from suspend.

It has been created and tested against latest
for-next branch.

Sanjeev Premi (2):
  omap3evm: Enable keypad in defconfig
  omap3evm: Add keypad as wakeup source

 arch/arm/configs/omap3_evm_defconfig |   12 +---
 arch/arm/mach-omap2/board-omap3evm.c |   12 
 2 files changed, 21 insertions(+), 3 deletions(-)

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


[PATCH 1/2] omap3evm: Enable keypad in defconfig

2009-11-03 Thread Sanjeev Premi
Enable the TWL4030/TPS65590 keypad in the
default configuration.

Also updated the section with related config
options in .config for easy diff.

Signed-off-by: Sanjeev Premi pr...@ti.com
---
 arch/arm/configs/omap3_evm_defconfig |   12 +---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/arch/arm/configs/omap3_evm_defconfig 
b/arch/arm/configs/omap3_evm_defconfig
index d5ff477..24d8b08 100644
--- a/arch/arm/configs/omap3_evm_defconfig
+++ b/arch/arm/configs/omap3_evm_defconfig
@@ -676,13 +676,19 @@ CONFIG_INPUT_EVDEV=y
 # Input Device Drivers
 #
 CONFIG_INPUT_KEYBOARD=y
+# CONFIG_KEYBOARD_ADP5588 is not set
 # CONFIG_KEYBOARD_ATKBD is not set
-# CONFIG_KEYBOARD_SUNKBD is not set
+# CONFIG_QT2160 is not set
 # CONFIG_KEYBOARD_LKKBD is not set
-# CONFIG_KEYBOARD_XTKBD is not set
+# CONFIG_KEYBOARD_GPIO is not set
+# CONFIG_KEYBOARD_MATRIX is not set
+# CONFIG_KEYBOARD_MAX7359 is not set
 # CONFIG_KEYBOARD_NEWTON is not set
+# CONFIG_KEYBOARD_OPENCORES is not set
 # CONFIG_KEYBOARD_STOWAWAY is not set
-# CONFIG_KEYBOARD_GPIO is not set
+# CONFIG_KEYBOARD_SUNKBD is not set
+CONFIG_KEYBOARD_TWL4030=y
+# CONFIG_KEYBOARD_XTKBD is not set
 # CONFIG_INPUT_MOUSE is not set
 # CONFIG_INPUT_JOYSTICK is not set
 # CONFIG_INPUT_TABLET is not set
-- 
1.6.2.2

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


[PATCH 2/2] omap3evm: Add keypad as wakeup source

2009-11-03 Thread Sanjeev Premi
Add keypad as wakeup source from 'suspend'
state.

Signed-off-by: Sanjeev Premi pr...@ti.com
---
 arch/arm/mach-omap2/board-omap3evm.c |   12 
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/board-omap3evm.c 
b/arch/arm/mach-omap2/board-omap3evm.c
index 660ef8c..6a1a0cd 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -343,6 +343,16 @@ static struct platform_device *omap3_evm_devices[] 
__initdata = {
omap3evm_smc911x_device,
 };
 
+/*
+ * Set wakeup sources for the board
+ */
+static void __init omap3_evm_wakeup_sources(void)
+{
+   pr_info(omap3evm: Adding wakeup sources);
+
+   omap_cfg_reg(AF26_34XX_SYS_NIRQ);
+}
+
 static void __init omap3_evm_init(void)
 {
omap3_evm_i2c_init();
@@ -359,6 +369,8 @@ static void __init omap3_evm_init(void)
 #endif
usb_musb_init();
ads7846_dev_init();
+
+   omap3_evm_wakeup_sources();
 }
 
 static void __init omap3_evm_map_io(void)
-- 
1.6.2.2

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


[PATCH] OMAP3: PM: Remove duplicate code blocks

2009-11-02 Thread Sanjeev Premi
This patch removes code blocks that are repeated
in function prcm_setup_regs().

Signed-off-by: Sanjeev Premi pr...@ti.com
---
 arch/arm/mach-omap2/pm34xx.c |   18 --
 1 files changed, 0 insertions(+), 18 deletions(-)

diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index fd103a1..11cfe59 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -957,24 +957,6 @@ static void __init prcm_setup_regs(void)
/* Clear any pending PRCM interrupts */
prm_write_mod_reg(0, OCP_MOD, OMAP3_PRM_IRQSTATUS_MPU_OFFSET);
 
-   /* Don't attach IVA interrupts */
-   prm_write_mod_reg(0, WKUP_MOD, OMAP3430_PM_IVAGRPSEL);
-   prm_write_mod_reg(0, CORE_MOD, OMAP3430_PM_IVAGRPSEL1);
-   prm_write_mod_reg(0, CORE_MOD, OMAP3430ES2_PM_IVAGRPSEL3);
-   prm_write_mod_reg(0, OMAP3430_PER_MOD, OMAP3430_PM_IVAGRPSEL);
-
-   /* Clear any pending 'reset' flags */
-   prm_write_mod_reg(0x, MPU_MOD, RM_RSTST);
-   prm_write_mod_reg(0x, CORE_MOD, RM_RSTST);
-   prm_write_mod_reg(0x, OMAP3430_PER_MOD, RM_RSTST);
-   prm_write_mod_reg(0x, OMAP3430_EMU_MOD, RM_RSTST);
-   prm_write_mod_reg(0x, OMAP3430_NEON_MOD, RM_RSTST);
-   prm_write_mod_reg(0x, OMAP3430_DSS_MOD, RM_RSTST);
-   prm_write_mod_reg(0x, OMAP3430ES2_USBHOST_MOD, RM_RSTST);
-
-   /* Clear any pending PRCM interrupts */
-   prm_write_mod_reg(0, OCP_MOD, OMAP3_PRM_IRQSTATUS_MPU_OFFSET);
-
omap3_iva_idle();
omap3_d2d_idle();
 }
-- 
1.6.2.2

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


[PATCH] omap3: Change the default silicon

2009-10-29 Thread Sanjeev Premi
Currently the default silicon - in absence of
identification - is set to OMAP3630 ES1.0.

Though, condition may/should not arise; but
the default should be latest in the most
common silicon variant - currently OMAP3430
ES3.1.

Signed-off-by: Sanjeev Premi pr...@ti.com
---
 arch/arm/mach-omap2/id.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index 1c15112..0162623 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -243,8 +243,8 @@ void __init omap3_check_revision(void)
}
break;
default:
-   /* Unknown default to latest silicon rev as default*/
-   omap_revision = OMAP3630_REV_ES1_0;
+   /* Unknown. Default to latest among all variants */
+   omap_revision = OMAP3430_REV_ES3_1;
}
 }
 
-- 
1.6.2.2

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


[PATCH] omap3: Fix macro definitions

2009-10-28 Thread Sanjeev Premi
This fix avoids the compile errors in
specific cases. Found the problem while
creating the v2 patch for AM35xx.

Signed-off-by: Sanjeev Premi pr...@ti.com
---
 arch/arm/plat-omap/include/plat/cpu.h |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/arm/plat-omap/include/plat/cpu.h 
b/arch/arm/plat-omap/include/plat/cpu.h
index 7cb0556..f4f7a2f 100644
--- a/arch/arm/plat-omap/include/plat/cpu.h
+++ b/arch/arm/plat-omap/include/plat/cpu.h
@@ -381,16 +381,16 @@ IS_OMAP_TYPE(3430, 0x3430)
 # undef cpu_is_omap3525
 # undef cpu_is_omap3530
 # define cpu_is_omap3430() is_omap3430()
-# define cpu_is_omap3503   (cpu_is_omap3430()\
+# define cpu_is_omap3503() (cpu_is_omap3430()\
(!omap3_has_iva())\
(!omap3_has_sgx()))
-# define cpu_is_omap3515   (cpu_is_omap3430()\
+# define cpu_is_omap3515() (cpu_is_omap3430()\
(omap3_has_iva()) \
(!omap3_has_sgx()))
-# define cpu_is_omap3525   (cpu_is_omap3430()\
+# define cpu_is_omap3525() (cpu_is_omap3430()\
(omap3_has_sgx()) \
(!omap3_has_iva()))
-# define cpu_is_omap3530   (cpu_is_omap3430())
+# define cpu_is_omap3530() (cpu_is_omap3430())
 # undef cpu_is_omap3630
 # define cpu_is_omap3630() is_omap363x()
 #endif
-- 
1.6.2.2

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


[PATCH v2] AM35xx: Runtime detection of the device

2009-10-28 Thread Sanjeev Premi
Add support to detect AM3505/AM3517 devices at runtime.
Also updates the CPU names printed during boot.

Signed-off-by: Sanjeev Premi pr...@ti.com
---
 arch/arm/mach-omap2/id.c  |   36 +++-
 arch/arm/plat-omap/include/plat/cpu.h |   12 +++
 2 files changed, 42 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index 1c15112..f77dba1 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -242,6 +242,14 @@ void __init omap3_check_revision(void)
omap_revision = OMAP3630_REV_ES1_0;
}
break;
+   case 0xb868:
+   /* Handle OMAP35xx/AM35xx devices
+*
+* Set the device to be OMAP3505 here. Actual device
+* is identified later based on the features.
+*/
+   omap_revision = OMAP3505_REV(rev);
+   break;
default:
/* Unknown default to latest silicon rev as default*/
omap_revision = OMAP3630_REV_ES1_0;
@@ -267,20 +275,36 @@ void __init omap3_cpuinfo(void)
 * and CPU class bits.
 */
if (cpu_is_omap3630())
-   strcpy(cpu_name, 3630);
+   strcpy(cpu_name, OMAP3630);
+   else if (cpu_is_omap3505()) {
+   /*
+* AM35xx devices
+*/
+   if (omap3_has_sgx()) {
+   omap_revision = OMAP3517_REV(rev);
+   strcpy(cpu_name, AM3517);
+   }
+   else {
+   /* Already set in omap3_check_revision() */
+   strcpy(cpu_name, AM3505);
+   }
+   }
+   /*
+* OMAP3430, OMAP3525, OMAP3515, OMAP3503 devices
+*/
else if (omap3_has_iva()  omap3_has_sgx())
-   strcpy(cpu_name, 3430/3530);
+   strcpy(cpu_name, OMAP3430/3530);
else if (omap3_has_sgx()) {
omap_revision = OMAP3525_REV(rev);
-   strcpy(cpu_name, 3525);
+   strcpy(cpu_name, OMAP3525);
}
else if (omap3_has_iva()) {
omap_revision = OMAP3515_REV(rev);
-   strcpy(cpu_name, 3515);
+   strcpy(cpu_name, OMAP3515);
}
else {
omap_revision = OMAP3503_REV(rev);
-   strcpy(cpu_name, 3503);
+   strcpy(cpu_name, OMAP3503);
}
 
switch (rev) {
@@ -307,7 +331,7 @@ void __init omap3_cpuinfo(void)
/*
 * Print verbose information
 */
-   pr_info(OMAP%s ES%s\n, cpu_name, cpu_rev);
+   pr_info(%s ES%s\n, cpu_name, cpu_rev);
 
OMAP3_SHOW_FEATURE(l2cache);
OMAP3_SHOW_FEATURE(iva);
diff --git a/arch/arm/plat-omap/include/plat/cpu.h 
b/arch/arm/plat-omap/include/plat/cpu.h
index f4f7a2f..13f74e6 100644
--- a/arch/arm/plat-omap/include/plat/cpu.h
+++ b/arch/arm/plat-omap/include/plat/cpu.h
@@ -284,6 +284,8 @@ IS_OMAP_SUBCLASS(363x, 0x363)
  * cpu_is_omap2423():  True for OMAP2423
  * cpu_is_omap2430():  True for OMAP2430
  * cpu_is_omap3430():  True for OMAP3430
+ * cpu_is_omap3505():  True for OMAP3505
+ * cpu_is_omap3517():  True for OMAP3517
  */
 #define GET_OMAP_TYPE  ((omap_rev()  16)  0x)
 
@@ -307,6 +309,8 @@ IS_OMAP_TYPE(2422, 0x2422)
 IS_OMAP_TYPE(2423, 0x2423)
 IS_OMAP_TYPE(2430, 0x2430)
 IS_OMAP_TYPE(3430, 0x3430)
+IS_OMAP_TYPE(3505, 0x3505)
+IS_OMAP_TYPE(3517, 0x3517)
 
 #define cpu_is_omap310()   0
 #define cpu_is_omap730()   0
@@ -325,6 +329,8 @@ IS_OMAP_TYPE(3430, 0x3430)
 #define cpu_is_omap3515()  0
 #define cpu_is_omap3525()  0
 #define cpu_is_omap3530()  0
+#define cpu_is_omap3505()  0
+#define cpu_is_omap3517()  0
 #define cpu_is_omap3430()  0
 #define cpu_is_omap3630()  0
 
@@ -380,6 +386,8 @@ IS_OMAP_TYPE(3430, 0x3430)
 # undef cpu_is_omap3515
 # undef cpu_is_omap3525
 # undef cpu_is_omap3530
+# undef cpu_is_omap3505
+# undef cpu_is_omap3517
 # define cpu_is_omap3430() is_omap3430()
 # define cpu_is_omap3503() (cpu_is_omap3430()\
(!omap3_has_iva())\
@@ -391,6 +399,8 @@ IS_OMAP_TYPE(3430, 0x3430)
(omap3_has_sgx()) \
(!omap3_has_iva()))
 # define cpu_is_omap3530() (cpu_is_omap3430())
+# define cpu_is_omap3505() is_omap3505()
+# define cpu_is_omap3517() is_omap3517()
 # undef cpu_is_omap3630
 # define cpu_is_omap3630() is_omap363x()
 #endif
@@ -430,6 +440,8 @@ IS_OMAP_TYPE(3430, 0x3430)
 #define OMAP3515_REV(v)(OMAP35XX_CLASS | (0x3515  16) | (v 
 12))
 #define OMAP3525_REV(v)(OMAP35XX_CLASS | (0x3525  16) | (v 
 12

[PATCH 0/2] Introduce support for AM35xx

2009-10-27 Thread Sanjeev Premi
This patch adds support for the recently announced
AM3505 and AM3517 devices from Texas Instruments.

It also defines the AM3517 EVM board. Detailed
support will follow in subsequent patches.

  [1] http://www.ti.com/sitara 
  [2] http://www.ti.com/arm 
  [3] 
http://tiexpressdsp.com/index.php?title=Applications_Processors_Crossreference 
  [4] http://marc.info/?l=linux-omapm=125615009412281w=2
  
The patches have been created against omap-next branch.

Sanjeev Premi (2):
  AM35xx: Runtime detection of the device
  AM35xx: Define the AM3517EVM board

 arch/arm/mach-omap2/Kconfig   |4 +++
 arch/arm/mach-omap2/id.c  |   43 
 arch/arm/plat-omap/include/plat/cpu.h |   12 +
 3 files changed, 53 insertions(+), 6 deletions(-)

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


[PATCH 1/2] AM35xx: Runtime detection of the device

2009-10-27 Thread Sanjeev Premi
Add support to detect AM3505/AM3517 devices at runtime.
Also updates the CPU names printed during boot.

Signed-off-by: Sanjeev Premi pr...@ti.com
---
 arch/arm/mach-omap2/id.c  |   43 
 arch/arm/plat-omap/include/plat/cpu.h |   12 +
 2 files changed, 49 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index 1c15112..87efb73 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -242,6 +242,21 @@ void __init omap3_check_revision(void)
omap_revision = OMAP3630_REV_ES1_0;
}
break;
+   case 0xb868:
+   /* Handle OMAP35xx/AM35xx devices
+*
+* Set the device to be OMAP3517 here. Actual device
+* is identified later based on the features.
+*/
+   switch (rev) {
+   case 0:
+   omap_revision = OMAP3505_REV(rev);
+   break;
+   default:
+   /* Use the latest known revision as default */
+   omap_revision = OMAP3505_REV(rev);
+   }
+   break;
default:
/* Unknown default to latest silicon rev as default*/
omap_revision = OMAP3630_REV_ES1_0;
@@ -267,20 +282,36 @@ void __init omap3_cpuinfo(void)
 * and CPU class bits.
 */
if (cpu_is_omap3630())
-   strcpy(cpu_name, 3630);
+   strcpy(cpu_name, OMAP3630);
+   else if (omap_rev()  OMAP35XX_CLASS) {
+   /*
+* AM3517, AM3505 devices
+*/
+   if (omap3_has_sgx()) {
+   omap_revision = OMAP3517_REV(rev);
+   strcpy(cpu_name, AM3517);
+   }
+   else {
+   /* Already set in omap3_check_revision() */
+   strcpy(cpu_name, AM3505);
+   }
+   }
+   /*
+* OMAP3430, OMAP3525, OMAP3515, OMAP3503 devices
+*/
else if (omap3_has_iva()  omap3_has_sgx())
-   strcpy(cpu_name, 3430/3530);
+   strcpy(cpu_name, OMAP3430/3530);
else if (omap3_has_sgx()) {
omap_revision = OMAP3525_REV(rev);
-   strcpy(cpu_name, 3525);
+   strcpy(cpu_name, OMAP3525);
}
else if (omap3_has_iva()) {
omap_revision = OMAP3515_REV(rev);
-   strcpy(cpu_name, 3515);
+   strcpy(cpu_name, OMAP3515);
}
else {
omap_revision = OMAP3503_REV(rev);
-   strcpy(cpu_name, 3503);
+   strcpy(cpu_name, OMAP3503);
}
 
switch (rev) {
@@ -307,7 +338,7 @@ void __init omap3_cpuinfo(void)
/*
 * Print verbose information
 */
-   pr_info(OMAP%s ES%s\n, cpu_name, cpu_rev);
+   pr_info(%s ES%s\n, cpu_name, cpu_rev);
 
OMAP3_SHOW_FEATURE(l2cache);
OMAP3_SHOW_FEATURE(iva);
diff --git a/arch/arm/plat-omap/include/plat/cpu.h 
b/arch/arm/plat-omap/include/plat/cpu.h
index 7cb0556..f1cc913 100644
--- a/arch/arm/plat-omap/include/plat/cpu.h
+++ b/arch/arm/plat-omap/include/plat/cpu.h
@@ -284,6 +284,8 @@ IS_OMAP_SUBCLASS(363x, 0x363)
  * cpu_is_omap2423():  True for OMAP2423
  * cpu_is_omap2430():  True for OMAP2430
  * cpu_is_omap3430():  True for OMAP3430
+ * cpu_is_omap3505():  True for OMAP3505
+ * cpu_is_omap3517():  True for OMAP3517
  */
 #define GET_OMAP_TYPE  ((omap_rev()  16)  0x)
 
@@ -307,6 +309,8 @@ IS_OMAP_TYPE(2422, 0x2422)
 IS_OMAP_TYPE(2423, 0x2423)
 IS_OMAP_TYPE(2430, 0x2430)
 IS_OMAP_TYPE(3430, 0x3430)
+IS_OMAP_TYPE(3505, 0x3505)
+IS_OMAP_TYPE(3517, 0x3517)
 
 #define cpu_is_omap310()   0
 #define cpu_is_omap730()   0
@@ -325,6 +329,8 @@ IS_OMAP_TYPE(3430, 0x3430)
 #define cpu_is_omap3515()  0
 #define cpu_is_omap3525()  0
 #define cpu_is_omap3530()  0
+#define cpu_is_omap3505()  0
+#define cpu_is_omap3517()  0
 #define cpu_is_omap3430()  0
 #define cpu_is_omap3630()  0
 
@@ -380,6 +386,8 @@ IS_OMAP_TYPE(3430, 0x3430)
 # undef cpu_is_omap3515
 # undef cpu_is_omap3525
 # undef cpu_is_omap3530
+# undef cpu_is_omap3505
+# undef cpu_is_omap3517
 # define cpu_is_omap3430() is_omap3430()
 # define cpu_is_omap3503   (cpu_is_omap3430()\
(!omap3_has_iva())\
@@ -391,6 +399,8 @@ IS_OMAP_TYPE(3430, 0x3430)
(omap3_has_sgx()) \
(!omap3_has_iva()))
 # define cpu_is_omap3530   (cpu_is_omap3430())
+# define cpu_is_omap3505   is_omap3505()
+# define cpu_is_omap3517   is_omap3517()
 # undef

[PATCH 2/2] AM35xx: Define the AM3517EVM board

2009-10-27 Thread Sanjeev Premi
Add support for the AM3517 EVM board. This EVM
supports AM3505 and AM3517 devices.

Signed-off-by: Sanjeev Premi pr...@ti.com
---
 arch/arm/mach-omap2/Kconfig |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index 8685df5..c904580 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -65,6 +65,10 @@ config MACH_OMAP3EVM
bool OMAP 3530 EVM board
depends on ARCH_OMAP3  ARCH_OMAP34XX
 
+config MACH_OMAP3517EVM
+   bool OMAP3517/ AM3517 EVM board
+   depends on ARCH_OMAP3  ARCH_OMAP34XX
+
 config MACH_OMAP3_PANDORA
bool OMAP3 Pandora
depends on ARCH_OMAP3  ARCH_OMAP34XX
-- 
1.6.2.2

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


[PATCH] OMAP35x: Add support for 720MHz part

2009-10-12 Thread Sanjeev Premi
This patch adds support for ARM running at 720MHz part.

The 720MHz capability can be probed run-time by reading the
PRODID.SKUID[3:0] at 0x4830A20C.

  [1] http://focus.ti.com/lit/ug/spruff1d/spruff1d.pdf

Signed-off-by: Sanjeev Premi pr...@ti.com
---
 arch/arm/mach-omap2/clock34xx.c   |6 ++
 arch/arm/mach-omap2/id.c  |   11 +++
 arch/arm/plat-omap/include/mach/control.h |7 +++
 arch/arm/plat-omap/include/mach/cpu.h |2 ++
 4 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/clock34xx.c b/arch/arm/mach-omap2/clock34xx.c
index 489556e..9b56af3 100644
--- a/arch/arm/mach-omap2/clock34xx.c
+++ b/arch/arm/mach-omap2/clock34xx.c
@@ -1096,6 +1096,12 @@ static int __init omap2_clk_arch_init(void)
if (!mpurate)
return -EINVAL;
 
+   if ((mpurate == 72000)  !omap3_has_720mhz()) {
+   printk(KERN_ERR *** Silicon doesn't support 720MHz\n);
+
+   mpurate = 6;  /* Set to highest supported */
+   }
+
/* REVISIT: not yet ready for 343x */
if (clk_set_rate(dpll1_ck, mpurate))
printk(KERN_ERR *** Unable to set MPU rate\n);
diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index d4d563b..e0b427a 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -79,6 +79,7 @@ EXPORT_SYMBOL(omap_type);
 #define OMAP_TAP_DIE_ID_2  0x0220
 #define OMAP_TAP_DIE_ID_3  0x0224
 
+
 #define read_tap_reg(reg)  __raw_readl(tap_base  + (reg))
 
 struct omap_id {
@@ -180,6 +181,15 @@ void __init omap3_check_features(void)
 * TODO: Get additional info (where applicable)
 *   e.g. Size of L2 cache.
 */
+
+   /*
+* Does it support 720MHz?
+*/
+   status = (OMAP3_SKUID_MASK  read_tap_reg(OMAP3_PRODID));
+
+   if (status  OMAP3_SKUID_720MHZ) {
+   omap3_features |= OMAP3_HAS_720MHZ;
+   }
 }
 
 void __init omap3_check_revision(void)
@@ -296,6 +306,7 @@ void __init omap3_cpuinfo(void)
OMAP3_SHOW_FEATURE(sgx);
OMAP3_SHOW_FEATURE(neon);
OMAP3_SHOW_FEATURE(isp);
+   OMAP3_SHOW_FEATURE(720mhz);
 }
 
 /*
diff --git a/arch/arm/plat-omap/include/mach/control.h 
b/arch/arm/plat-omap/include/mach/control.h
index fdb6300..e886bb6 100644
--- a/arch/arm/plat-omap/include/mach/control.h
+++ b/arch/arm/plat-omap/include/mach/control.h
@@ -238,6 +238,13 @@
 #defineFEAT_NEON   0
 #defineFEAT_NEON_NONE  1
 
+/*
+ * Product ID register
+ */
+#define OMAP3_PRODID   0x020C
+
+#define OMAP3_SKUID_MASK   0x0f
+#defineOMAP3_SKUID_720MHZ  0x08
 
 #ifndef __ASSEMBLY__
 #if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) || \
diff --git a/arch/arm/plat-omap/include/mach/cpu.h 
b/arch/arm/plat-omap/include/mach/cpu.h
index 8d0841b..12b91f7 100644
--- a/arch/arm/plat-omap/include/mach/cpu.h
+++ b/arch/arm/plat-omap/include/mach/cpu.h
@@ -472,6 +472,7 @@ extern u32 omap3_features;
 #define OMAP3_HAS_SGX  BIT(2)
 #define OMAP3_HAS_NEON BIT(3)
 #define OMAP3_HAS_ISP  BIT(4)
+#define OMAP3_HAS_720MHZ   BIT(5)
 
 #define OMAP3_HAS_FEATURE(feat,flag)   \
 static inline unsigned int omap3_has_ ##feat(void) \
@@ -484,5 +485,6 @@ OMAP3_HAS_FEATURE(sgx, SGX)
 OMAP3_HAS_FEATURE(iva, IVA)
 OMAP3_HAS_FEATURE(neon, NEON)
 OMAP3_HAS_FEATURE(isp, ISP)
+OMAP3_HAS_FEATURE(720mhz, 720MHZ)
 
 #endif
-- 
1.6.2.2

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


[PATCHv2 0/1] Runtime detection of OMAP35x variants

2009-10-09 Thread Sanjeev Premi
This patch allows run-time detection of different
variants in the OMAP35x family.

  [1] http://marc.info/?l=linux-omapm=125387617812499w=2
  
This patch was been created against omap3-upstream at:
  21f1a8f : omap: Include bitops from cpu.h

The testing was done on OMAP3EVM boards with these silicon
revisions - ES2.0, ES2.1, ES3.0 and ES3.1.

Correctness against ES1.0 and a variant of ES2.0 was verified
by 'simulation' described in the test summary below:

1) ES 3.1

   Value of IDCODE register in u-boot:
OMAP3_EVM # md 4830a204 4
4830a204: 4b7ae02f  0008 00f0/.zK
 ^^^
   Print during boot-up:
...
Memory policy: ECC disabled, Data cache writeback
OMAP3430/3530 ES3.1
...

2) ES 3.0

   Value of IDCODE register in u-boot:
OMAP3_EVM # md 4830a204 4
4830a204: 3b7ae02f   00f0/.z;
 ^^^
   Print during boot-up:
...
Memory policy: ECC disabled, Data cache writeback
OMAP3430/3530 ES3.0
...

3) ES 2.1

   Value of IDCODE register in u-boot:
OMAP3_EVM # md 4830a204 4
4830a204: 2b7ae02f   00f0/.z+
 ^^^
   Print during boot-up:
...
Memory policy: ECC disabled, Data cache writeback
OMAP3430/3530 ES2.1
...

4) ES 2.0 (simulated)

   The code correctness was verified by 'simulating' an ES 1.0 device
   as shown in the diff below:
 -  idcode = read_tap_reg(OMAP_TAP_IDCODE);
 +  idcode = (u32)0x1b7ae02f;
hawkeye = (idcode  12)  0x;

   Print during boot-up:
...
Memory policy: ECC disabled, Data cache writeback
OMAP3430/3530 ES2.0
...

5) ES 2.0

   Value of IDCODE register in u-boot:
OMAP3_EVM # md 4830a204 4
4830a204: 0b7ae02f   00f0/.z.
 ^^^
   Print during boot-up:
...
Memory policy: ECC disabled, Data cache writeback
OMAP3430/3530 ES2.0
...

6) ES 1.0 (simulated)

   The code correctness was verified by 'simulating' an ES 1.0 device
   as shown in the diff below:

cpuid = read_cpuid(CPUID_ID);
if cpuid  4)  0xfff) == 0xc08)  ((cpuid  0xf) == 0x0)) {
omap_revision = OMAP3430_REV_ES1_0;
return;
}
 +  omap_revision = OMAP3430_REV_ES1_0;
 +  return;

   Print during boot-up:
...
Memory policy: ECC disabled, Data cache writeback
OMAP3430/3530 ES1.0
...

Sanjeev Premi (1):
  Runtime detection of OMAP35x devices

 arch/arm/mach-omap2/id.c  |   65 +++--
 arch/arm/plat-omap/include/mach/cpu.h |   37 +++
 2 files changed, 91 insertions(+), 11 deletions(-)

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


[PATCHv2 1/1] Runtime detection of OMAP35x devices

2009-10-09 Thread Sanjeev Premi
Add runtime check for these OMAP35x variations
based on the detected Si features:
  OMAP3503, OMAP3515, OMAP3525 and OMA3530.

Also, delayed the call to pr_info() into actual
variant is detected in omap3_cpuinfo()

Signed-off-by: Sanjeev Premi pr...@ti.com
---
 arch/arm/mach-omap2/id.c  |   65 +++--
 arch/arm/plat-omap/include/mach/cpu.h |   37 +++
 2 files changed, 91 insertions(+), 11 deletions(-)

diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index 03b80f2..d4d563b 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -187,7 +187,6 @@ void __init omap3_check_revision(void)
u32 cpuid, idcode;
u16 hawkeye;
u8 rev;
-   char *rev_name = ES1.0;
 
/*
 * We cannot access revision registers on ES1.0.
@@ -197,7 +196,7 @@ void __init omap3_check_revision(void)
cpuid = read_cpuid(CPUID_ID);
if cpuid  4)  0xfff) == 0xc08)  ((cpuid  0xf) == 0x0)) {
omap_revision = OMAP3430_REV_ES1_0;
-   goto out;
+   return;
}
 
/*
@@ -212,31 +211,24 @@ void __init omap3_check_revision(void)
 
if (hawkeye == 0xb7ae) {
switch (rev) {
-   case 0:
+   case 0: /* Take care of early samples */
+   case 1:
omap_revision = OMAP3430_REV_ES2_0;
-   rev_name = ES2.0;
break;
case 2:
omap_revision = OMAP3430_REV_ES2_1;
-   rev_name = ES2.1;
break;
case 3:
omap_revision = OMAP3430_REV_ES3_0;
-   rev_name = ES3.0;
break;
case 4:
omap_revision = OMAP3430_REV_ES3_1;
-   rev_name = ES3.1;
break;
default:
/* Use the latest known revision as default */
omap_revision = OMAP3430_REV_ES3_1;
-   rev_name = Unknown revision\n;
}
}
-
-out:
-   pr_info(OMAP%04x %s\n, omap_rev()  16, rev_name);
 }
 
 #define OMAP3_SHOW_FEATURE(feat)   \
@@ -248,6 +240,57 @@ out:
 
 void __init omap3_cpuinfo(void)
 {
+   u8 rev = GET_OMAP_REVISION();
+   char cpu_name[16], cpu_rev[16];
+
+   /* OMAP3430 and OMAP3530 are assumed to be same.
+*
+* OMAP3525, OMAP3515 and OMAP3503 can be detected only based
+* on available features. Upon detection, update the CPU id
+* and CPU class bits.
+*/
+   if (omap3_has_iva()  omap3_has_sgx()) {
+   strcpy(cpu_name, 3430/3530);
+   }
+   else if (omap3_has_sgx()) {
+   omap_revision = OMAP3525_REV(rev);
+   strcpy(cpu_name, 3525);
+   }
+   else if (omap3_has_iva()) {
+   omap_revision = OMAP3515_REV(rev);
+   strcpy(cpu_name, 3515);
+   }
+   else {
+   omap_revision = OMAP3503_REV(rev);
+   strcpy(cpu_name, 3503);
+   }
+
+   switch (rev) {
+   case OMAP_REVBITS_00:
+   strcpy(cpu_rev, 1.0);
+   break;
+   case OMAP_REVBITS_10:
+   strcpy(cpu_rev, 2.0);
+   break;
+   case OMAP_REVBITS_20:
+   strcpy(cpu_rev, 2.1);
+   break;
+   case OMAP_REVBITS_30:
+   strcpy(cpu_rev, 3.0);
+   break;
+   case OMAP_REVBITS_40:
+   strcpy(cpu_rev, 3.1);
+   break;
+   default:
+   /* Use the latest known revision as default */
+   strcpy(cpu_rev, 3.1);
+   }
+
+   /*
+* Print verbose information
+*/
+   pr_info(OMAP%s ES%s\n, cpu_name, cpu_rev);
+
OMAP3_SHOW_FEATURE(l2cache);
OMAP3_SHOW_FEATURE(iva);
OMAP3_SHOW_FEATURE(sgx);
diff --git a/arch/arm/plat-omap/include/mach/cpu.h 
b/arch/arm/plat-omap/include/mach/cpu.h
index 431fec4..8d0841b 100644
--- a/arch/arm/plat-omap/include/mach/cpu.h
+++ b/arch/arm/plat-omap/include/mach/cpu.h
@@ -59,6 +59,23 @@ struct omap_chip_id {
 unsigned int omap_rev(void);
 
 /*
+ * Define CPU revision bits
+ *
+ * Verbose meaning of the revision bits may be different for a silicon
+ * family. This difference can be handled separately.
+ */
+#define OMAP_REVBITS_000x00
+#define OMAP_REVBITS_100x10
+#define OMAP_REVBITS_200x20
+#define OMAP_REVBITS_300x30
+#define OMAP_REVBITS_400x40
+
+/*
+ * Get the CPU revision for OMAP devices
+ */
+#define GET_OMAP_REVISION()((omap_rev()  8)  0xff)
+
+/*
  * Test if multicore OMAP support is needed
  */
 #undef MULTI_OMAP1
@@ -353,7 +370,21 @@ IS_OMAP_TYPE(3430, 0x3430)
 
 #if defined(CONFIG_ARCH_OMAP34XX)
 # undef

[PATCH] Beagle: CONFIG_ISP1301_OMAP redefined in defconfig

2009-10-05 Thread Sanjeev Premi
The symbol CONFIG_ISP1301_OMAP was defined twice in the
defconfig. This was causing the warning:
arch/arm/configs/omap3_beagle_defconfig:972:warning:
 override: reassigning to symbol ISP1301_OMAP

Signed-off-by: Sanjeev Premi pr...@ti.com
---
 arch/arm/configs/omap3_beagle_defconfig |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/arch/arm/configs/omap3_beagle_defconfig 
b/arch/arm/configs/omap3_beagle_defconfig
index 357d402..b3c8cce 100644
--- a/arch/arm/configs/omap3_beagle_defconfig
+++ b/arch/arm/configs/omap3_beagle_defconfig
@@ -969,7 +969,6 @@ CONFIG_USB_ETH_RNDIS=y
 #
 CONFIG_USB_OTG_UTILS=y
 # CONFIG_USB_GPIO_VBUS is not set
-# CONFIG_ISP1301_OMAP is not set
 CONFIG_TWL4030_USB=y
 # CONFIG_NOP_USB_XCEIV is not set
 CONFIG_MMC=y
-- 
1.6.2.2

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


[PATCHv3 0/1] Runtime detection of Si features

2009-10-01 Thread Sanjeev Premi
This version is essentially same patch as [1]; but
refreshed against the tip (2bf0f78). The change in
text corresponding to the closing #endif in cpu.h
required change in the last line of the patch.

  [1] http://patchwork.kernel.org/patch/41989/

Sanjeev Premi (1):
  Runtime detection of Si features

 arch/arm/mach-omap2/id.c  |   52 +++--
 arch/arm/mach-omap2/mmc-twl4030.c |1 +
 arch/arm/plat-omap/include/mach/control.h |   34 +++
 arch/arm/plat-omap/include/mach/cpu.h |   23 +
 4 files changed, 107 insertions(+), 3 deletions(-)

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


  1   2   >