RE: [PATCH 01/11] OMAP4: PRCM: add OMAP4-specific accessor/mutatorfunctions

2010-12-10 Thread Santosh Shilimkar
> -Original Message-
> From: Paul Walmsley [mailto:p...@pwsan.com]
> Sent: Saturday, December 11, 2010 7:26 AM
> To: Santosh Shilimkar
> Cc: linux-omap@vger.kernel.org; linux-arm-ker...@lists.infradead.org;
> Rajendra Nayak; Benoit Cousson
> Subject: RE: [PATCH 01/11] OMAP4: PRCM: add OMAP4-specific
> accessor/mutatorfunctions
>
> On Wed, 8 Dec 2010, Santosh Shilimkar wrote:
>
> > One more possible road block of removing the direct register access
> > from PM code is DEVICE PRM module. Even with this clean-up for DEVCIE
> > PRM related registers. I guess we still need to use the lowest level
> > APIs.
>
> To clarify my comments, I'm not talking about replacing omap4_prm_*()
with
> omap4_prminst_*() for the device PRM cases.  I agree that is not
> desirable.  What I'd like to see is for the middle-level PM code, such
as
> pm*.c, to call functions that describe what they are actually trying to
do
> at a higher level, rather than writing to registers directly.
>
> I'll take the PRM_VOLTSETUP* registers as a rough example.  This may be
a
> bad example since we probably don't write to this directly from pm*.c
any
> more, but the basic idea is, rather than writing some mystery value to a
> register from the pm*.c code, we should write something like:
>
> int omap4_prm_regulator_set_ramp_up_duration(u32 ns, u8 starting_pwrst);
>
> which would then take care of computing the prescaler and count values
> appropriately given the current sys_clk and writing them to the register
> or returning an error if something is wrong.
>
> The long-term goal is to be able to reuse as much PM code as possible
> between all of the different OMAP2+ platforms.
>
Thanks for clarification. We are fully aligned here.

Regards,
Santosh
--
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


RE: [PATCH/RFC 2/2] OMAP: PM: implement context loss count APIs

2010-12-10 Thread Vishwanath Sripathy
Kevin,

> -Original Message-
> From: Kevin Hilman [mailto:khil...@deeprootsystems.com]
> Sent: Saturday, December 11, 2010 6:14 AM
> To: Vishwanath Sripathy
> Cc: linux-omap@vger.kernel.org; Paul Walmsely
> Subject: Re: [PATCH/RFC 2/2] OMAP: PM: implement context loss count
> APIs
>
> Vishwanath Sripathy  writes:
>
> > Kevin,
> [...]
>
> >> @@ -288,20 +290,19 @@ unsigned long
> omap_pm_cpu_get_freq(void)
> >>
> >>  int omap_pm_get_dev_context_loss_count(struct device *dev)
> >>  {
> >> +  struct platform_device *pdev = to_platform_device(dev);
> >> +  int count;
> >> +
> >>if (!dev) {
> >>WARN_ON(1);
> >>return -EINVAL;
> >>};
> >>
> >> -  pr_debug("OMAP PM: returning context loss count for dev %s\n",
> >> -   dev_name(dev));
> >> +  count = omap_device_get_context_loss_count(pdev);
> >> +  pr_debug("OMAP PM: context loss count for dev %s = %d\n",
> >> +   dev_name(dev), count);
> >
> > Shouldn't this implementation be part of omap-pm.c where all the
> OMAP PM
> > functions are to be implemented?
>
> Where is omap-pm.c?
It's not present and needs to be added. This file is anyway required for
adding device latency constraints as well.

Vishwa
>
> Kevin
--
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


Re: [PATCH 5/5 v5] usb: musb: Using runtime pm APIs for musb.

2010-12-10 Thread Kalliguddi, Hema
On Fri, Dec 10, 2010 at 8:08 PM, Felipe Balbi  wrote:
> hi,
>
> On Fri, Dec 10, 2010 at 08:05:39PM +0530, Hema HK wrote:
>>
>> Calling runtime pm APIs pm_runtime_put_sync() and pm_runtime_get_sync()
>> for enabling/disabling the clocks, sysconfig settings.
>>
>> enable clock, configure no-idle/standby when active and configure force
>> idle/standby
>> and disable clock when idled. This is taken care by the runtime framework
>> when
>> driver calls the pm_runtime_get_sync and pm_runtime_put_sync APIs.
>> Need to configure MUSB into force standby and force idle mode when usb not
>> used
>>
>> Signed-off-by: Hema HK 
>> Cc: Felipe Balbi 
>> Cc: Tony Lindgren 
>> Cc: Kevin Hilman 
>> Cc: Cousson, Benoit 
>> Cc: Paul Walmsley 
>> ---
>>
>> drivers/usb/musb/musb_core.h |    2 -
>> drivers/usb/musb/omap2430.c  |   80
>> +++
>> 2 files changed, 23 insertions(+), 59 deletions(-)
>
> Now I see you removed the runtime_resume and runtime_suspend calls from
> musb_core. Won't we loose context in that case ?
>
We need context save/restore  when .suspend/.resume are called. That
is done anyway in the musb_suspend/
musb_resume_noirq APIs.  Moreover we are calling runtime pm with
musb_omap2430 dev pointer, so
musb runtime_suspend/resume call backs will not be called.

Regards,
Hema
> --
> balbi
>
--
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


Re: [PATCH 8/8] arm: omap: add minimal support for RM-680

2010-12-10 Thread Tony Lindgren
* Jamie Iles  [101209 09:29]:
> On Thu, Dec 09, 2010 at 07:11:28PM +0200, Aaro Koskinen wrote:
> > 
> > Check the following commits in linux-omap tree:
> > 
> > http://git.kernel.org/?p=linux/kernel/git/tmlind/linux-omap-2.6.git;a=commit;h=5403187f83c12c6f4c03547e0cc05bac0310be7b
> > 
> > and
> > 
> > http://git.kernel.org/?p=linux/kernel/git/tmlind/linux-omap-2.6.git;a=commit;h=7203f8a48bb63015ebe58a6f2a38aec1cb208b9d
> Thanks for the pointer! It looks a bit confusing to my eyes but I guess it's 
> better than lots of ifdeffery.

Queuing these for the next merge window.

Tony
--
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 v3 3/5] OMAP4: hwmod data: add mailbox data

2010-12-10 Thread Omar Ramirez Luna
From: Benoit Cousson 

Mailbox hwmod data for omap4.

Signed-off-by: Benoit Cousson 
Signed-off-by: Omar Ramirez Luna 
---
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c |   68 
 1 files changed, 68 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c 
b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index ae14bd5..9c6db0e 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -1380,6 +1380,71 @@ static struct omap_hwmod omap44xx_gpio6_hwmod = {
.slaves_cnt = ARRAY_SIZE(omap44xx_gpio6_slaves),
.omap_chip  = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
+
+/*
+ * 'mailbox' class
+ * mailbox module allowing communication between the on-chip processors
+ * using a queued mailbox-interrupt mechanism.
+ */
+
+static struct omap_hwmod_class_sysconfig omap44xx_mailbox_sysc = {
+   .rev_offs   = 0x,
+   .sysc_offs  = 0x0010,
+   .sysc_flags = (SYSC_HAS_RESET_STATUS | SYSC_HAS_SIDLEMODE |
+  SYSC_HAS_SOFTRESET),
+   .idlemodes  = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
+   .sysc_fields= &omap_hwmod_sysc_type2,
+};
+
+static struct omap_hwmod_class omap44xx_mailbox_hwmod_class = {
+   .name = "mailbox",
+   .sysc = &omap44xx_mailbox_sysc,
+};
+
+/* mailbox */
+static struct omap_hwmod omap44xx_mailbox_hwmod;
+static struct omap_hwmod_irq_info omap44xx_mailbox_irqs[] = {
+   { .name = "mbox", .irq = 26 + OMAP44XX_IRQ_GIC_START, },
+};
+
+static struct omap_hwmod_addr_space omap44xx_mailbox_addrs[] = {
+   {
+   .pa_start   = 0x4a0f4000,
+   .pa_end = 0x4a0f41ff,
+   .flags  = ADDR_TYPE_RT,
+   },
+};
+
+/* l4_cfg -> mailbox */
+static struct omap_hwmod_ocp_if omap44xx_l4_cfg__mailbox = {
+   .master = &omap44xx_l4_cfg_hwmod,
+   .slave  = &omap44xx_mailbox_hwmod,
+   .clk= "l4_div_ck",
+   .addr   = omap44xx_mailbox_addrs,
+   .addr_cnt   = ARRAY_SIZE(omap44xx_mailbox_addrs),
+   .user   = OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+/* mailbox slave ports */
+static struct omap_hwmod_ocp_if *omap44xx_mailbox_slaves[] = {
+   &omap44xx_l4_cfg__mailbox,
+};
+
+static struct omap_hwmod omap44xx_mailbox_hwmod = {
+   .name   = "mailbox",
+   .class  = &omap44xx_mailbox_hwmod_class,
+   .mpu_irqs   = omap44xx_mailbox_irqs,
+   .mpu_irqs_cnt   = ARRAY_SIZE(omap44xx_mailbox_irqs),
+   .prcm   = {
+   .omap4 = {
+   .clkctrl_reg = OMAP4430_CM_L4CFG_MAILBOX_CLKCTRL,
+   },
+   },
+   .slaves = omap44xx_mailbox_slaves,
+   .slaves_cnt = ARRAY_SIZE(omap44xx_mailbox_slaves),
+   .omap_chip  = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
+};
+
 static __initdata struct omap_hwmod *omap44xx_hwmods[] = {
/* dmm class */
&omap44xx_dmm_hwmod,
@@ -1422,6 +1487,9 @@ static __initdata struct omap_hwmod *omap44xx_hwmods[] = {
&omap44xx_uart2_hwmod,
&omap44xx_uart3_hwmod,
&omap44xx_uart4_hwmod,
+
+   /* mailbox class */
+   &omap44xx_mailbox_hwmod,
NULL,
 };
 
-- 
1.7.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 v3 5/5] OMAP: mailbox: add omap_device latency information

2010-12-10 Thread Omar Ramirez Luna
From: Felipe Contreras 

So that we can enable the main clock.

Signed-off-by: Felipe Contreras 
Signed-off-by: Omar Ramirez Luna 
---
 arch/arm/mach-omap2/devices.c |   10 +-
 arch/arm/mach-omap2/mailbox.c |   18 ++
 2 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 3bb7724..9478cb3 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -142,6 +142,14 @@ static inline void omap_init_camera(void)
 #endif
 
 #if defined(CONFIG_OMAP_MBOX_FWK) || defined(CONFIG_OMAP_MBOX_FWK_MODULE)
+static struct omap_device_pm_latency mbox_latencies[] = {
+   [0] = {
+   .activate_func = omap_device_enable_clocks,
+   .deactivate_func = omap_device_enable_clocks,
+   .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
+   },
+};
+
 static inline void omap_init_mbox(void)
 {
struct omap_hwmod *oh;
@@ -155,7 +163,7 @@ static inline void omap_init_mbox(void)
 
od = omap_device_build("omap-mailbox", -1, oh,
NULL, 0,
-   NULL, 0,
+   mbox_latencies, ARRAY_SIZE(mbox_latencies),
0);
if (!od) {
pr_err("%s: could not build device\n", __func__);
diff --git a/arch/arm/mach-omap2/mailbox.c b/arch/arm/mach-omap2/mailbox.c
index 40ddeca..6dd59b3 100644
--- a/arch/arm/mach-omap2/mailbox.c
+++ b/arch/arm/mach-omap2/mailbox.c
@@ -14,6 +14,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -52,6 +53,7 @@
 #define OMAP4_MBOX_NR_REGS (OMAP4_MBOX_REG_SIZE / sizeof(u32))
 
 static void __iomem *mbox_base;
+static struct platform_device *mbox_pdev;
 
 struct omap_mbox2_fifo {
unsigned long msg;
@@ -70,8 +72,6 @@ struct omap_mbox2_priv {
unsigned long irqdisable;
 };
 
-static struct clk *mbox_ick_handle;
-
 static void omap2_mbox_enable_irq(struct omap_mbox *mbox,
  omap_mbox_type_t irq);
 
@@ -91,13 +91,7 @@ static int omap2_mbox_startup(struct omap_mbox *mbox)
u32 l;
unsigned long timeout;
 
-   mbox_ick_handle = clk_get(NULL, "mailboxes_ick");
-   if (IS_ERR(mbox_ick_handle)) {
-   printk(KERN_ERR "Could not get mailboxes_ick: %ld\n",
-   PTR_ERR(mbox_ick_handle));
-   return PTR_ERR(mbox_ick_handle);
-   }
-   clk_enable(mbox_ick_handle);
+   pm_runtime_get_sync(&mbox_pdev->dev);
 
if (cpu_is_omap44xx()) {
mbox_write_reg(OMAP4_SOFTRESET, MAILBOX_SYSCONFIG);
@@ -143,9 +137,7 @@ static int omap2_mbox_startup(struct omap_mbox *mbox)
 
 static void omap2_mbox_shutdown(struct omap_mbox *mbox)
 {
-   clk_disable(mbox_ick_handle);
-   clk_put(mbox_ick_handle);
-   mbox_ick_handle = NULL;
+   pm_runtime_put_sync(&mbox_pdev->dev);
 }
 
 /* Mailbox FIFO handle functions */
@@ -427,6 +419,8 @@ static int __devinit omap2_mbox_probe(struct 
platform_device *pdev)
if (!mbox_base)
return -ENOMEM;
 
+   mbox_pdev = pdev;
+
ret = omap_mbox_register(&pdev->dev, list);
if (ret) {
iounmap(mbox_base);
-- 
1.7.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 v3 4/5] OMAP: mailbox: build device using omap_device/omap_hwmod

2010-12-10 Thread Omar Ramirez Luna
From: Felipe Contreras 

Remove static platform_device and resource data within
omap mailbox driver; use the one defined in the hwmod
database along with omap_device framework for device
build and registration.

Signed-off-by: Felipe Contreras 
Signed-off-by: Omar Ramirez Luna 
---
 arch/arm/mach-omap2/devices.c |  100 ++--
 1 files changed, 15 insertions(+), 85 deletions(-)

diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index b5cafd3..3bb7724 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -142,95 +142,25 @@ static inline void omap_init_camera(void)
 #endif
 
 #if defined(CONFIG_OMAP_MBOX_FWK) || defined(CONFIG_OMAP_MBOX_FWK_MODULE)
-
-#define MBOX_REG_SIZE   0x120
-
-#ifdef CONFIG_ARCH_OMAP2
-static struct resource omap2_mbox_resources[] = {
-   {
-   .start  = OMAP24XX_MAILBOX_BASE,
-   .end= OMAP24XX_MAILBOX_BASE + MBOX_REG_SIZE - 1,
-   .flags  = IORESOURCE_MEM,
-   },
-   {
-   .start  = INT_24XX_MAIL_U0_MPU,
-   .flags  = IORESOURCE_IRQ,
-   .name   = "dsp",
-   },
-   {
-   .start  = INT_24XX_MAIL_U3_MPU,
-   .flags  = IORESOURCE_IRQ,
-   .name   = "iva",
-   },
-};
-static int omap2_mbox_resources_sz = ARRAY_SIZE(omap2_mbox_resources);
-#else
-#define omap2_mbox_resources   NULL
-#define omap2_mbox_resources_sz0
-#endif
-
-#ifdef CONFIG_ARCH_OMAP3
-static struct resource omap3_mbox_resources[] = {
-   {
-   .start  = OMAP34XX_MAILBOX_BASE,
-   .end= OMAP34XX_MAILBOX_BASE + MBOX_REG_SIZE - 1,
-   .flags  = IORESOURCE_MEM,
-   },
-   {
-   .start  = INT_24XX_MAIL_U0_MPU,
-   .flags  = IORESOURCE_IRQ,
-   .name   = "dsp",
-   },
-};
-static int omap3_mbox_resources_sz = ARRAY_SIZE(omap3_mbox_resources);
-#else
-#define omap3_mbox_resources   NULL
-#define omap3_mbox_resources_sz0
-#endif
-
-#ifdef CONFIG_ARCH_OMAP4
-
-#define OMAP4_MBOX_REG_SIZE0x130
-static struct resource omap4_mbox_resources[] = {
-   {
-   .start  = OMAP44XX_MAILBOX_BASE,
-   .end= OMAP44XX_MAILBOX_BASE +
-   OMAP4_MBOX_REG_SIZE - 1,
-   .flags  = IORESOURCE_MEM,
-   },
-   {
-   .start  = OMAP44XX_IRQ_MAIL_U0,
-   .flags  = IORESOURCE_IRQ,
-   .name   = "mbox",
-   },
-};
-static int omap4_mbox_resources_sz = ARRAY_SIZE(omap4_mbox_resources);
-#else
-#define omap4_mbox_resources   NULL
-#define omap4_mbox_resources_sz0
-#endif
-
-static struct platform_device mbox_device = {
-   .name   = "omap-mailbox",
-   .id = -1,
-};
-
 static inline void omap_init_mbox(void)
 {
-   if (cpu_is_omap24xx()) {
-   mbox_device.resource = omap2_mbox_resources;
-   mbox_device.num_resources = omap2_mbox_resources_sz;
-   } else if (cpu_is_omap34xx()) {
-   mbox_device.resource = omap3_mbox_resources;
-   mbox_device.num_resources = omap3_mbox_resources_sz;
-   } else if (cpu_is_omap44xx()) {
-   mbox_device.resource = omap4_mbox_resources;
-   mbox_device.num_resources = omap4_mbox_resources_sz;
-   } else {
-   pr_err("%s: platform not supported\n", __func__);
+   struct omap_hwmod *oh;
+   struct omap_device *od;
+
+   oh = omap_hwmod_lookup("mailbox");
+   if (!oh) {
+   pr_err("%s: unable to find hwmod\n", __func__);
+   return;
+   }
+
+   od = omap_device_build("omap-mailbox", -1, oh,
+   NULL, 0,
+   NULL, 0,
+   0);
+   if (!od) {
+   pr_err("%s: could not build device\n", __func__);
return;
}
-   platform_device_register(&mbox_device);
 }
 #else
 static inline void omap_init_mbox(void) { }
-- 
1.7.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 v3 1/5] OMAP2: hwmod data: add mailbox data

2010-12-10 Thread Omar Ramirez Luna
Mailbox hwmod data for omap2430 and 2420.

Signed-off-by: Omar Ramirez Luna 
---
 arch/arm/mach-omap2/omap_hwmod_2420_data.c |   73 
 arch/arm/mach-omap2/omap_hwmod_2430_data.c |   72 +++
 2 files changed, 145 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod_2420_data.c 
b/arch/arm/mach-omap2/omap_hwmod_2420_data.c
index ce5d890..64f8f8b 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2420_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2420_data.c
@@ -778,6 +778,76 @@ static struct omap_hwmod omap2420_gpio4_hwmod = {
.slaves_cnt = ARRAY_SIZE(omap2420_gpio4_slaves),
.class  = &omap242x_gpio_hwmod_class,
.dev_attr   = &gpio_dev_attr,
+   .omap_chip  = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
+};
+
+/*
+ * 'mailbox' class
+ * mailbox module allowing communication between the on-chip processors
+ * using a queued mailbox-interrupt mechanism.
+ */
+
+static struct omap_hwmod_class_sysconfig omap2420_mailbox_sysc = {
+   .rev_offs   = 0x000,
+   .sysc_offs  = 0x010,
+   .syss_offs  = 0x014,
+   .sysc_flags = (SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_SIDLEMODE |
+   SYSC_HAS_SOFTRESET | SYSC_HAS_AUTOIDLE),
+   .idlemodes  = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
+   .sysc_fields= &omap_hwmod_sysc_type1,
+};
+
+static struct omap_hwmod_class omap2420_mailbox_hwmod_class = {
+   .name = "mailbox",
+   .sysc = &omap2420_mailbox_sysc,
+};
+
+/* mailbox */
+static struct omap_hwmod omap2420_mailbox_hwmod;
+static struct omap_hwmod_irq_info omap2420_mailbox_irqs[] = {
+   { .name = "dsp", .irq = 26, },
+   { .name = "iva", .irq = 34, },
+};
+
+static struct omap_hwmod_addr_space omap2420_mailbox_addrs[] = {
+   {
+   .pa_start   = 0x48094000,
+   .pa_end = 0x480941ff,
+   .flags  = ADDR_TYPE_RT,
+   },
+};
+
+/* l4_core -> mailbox */
+static struct omap_hwmod_ocp_if omap2420_l4_core__mailbox = {
+   .master = &omap2420_l4_core_hwmod,
+   .slave  = &omap2420_mailbox_hwmod,
+   .clk= "mailboxes_ick",
+   .addr   = omap2420_mailbox_addrs,
+   .addr_cnt   = ARRAY_SIZE(omap2420_mailbox_addrs),
+   .user   = OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+/* mailbox slave ports */
+static struct omap_hwmod_ocp_if *omap2420_mailbox_slaves[] = {
+   &omap2420_l4_core__mailbox,
+};
+
+static struct omap_hwmod omap2420_mailbox_hwmod = {
+   .name   = "mailbox",
+   .class  = &omap2420_mailbox_hwmod_class,
+   .mpu_irqs   = omap2420_mailbox_irqs,
+   .mpu_irqs_cnt   = ARRAY_SIZE(omap2420_mailbox_irqs),
+   .prcm   = {
+   .omap2 = {
+   .prcm_reg_id = 1,
+   .module_bit = OMAP24XX_EN_MAILBOXES_SHIFT,
+   .module_offs = CORE_MOD,
+   .idlest_reg_id = 1,
+   .idlest_idle_bit = OMAP24XX_ST_MAILBOXES_SHIFT,
+   },
+   },
+   .slaves = omap2420_mailbox_slaves,
+   .slaves_cnt = ARRAY_SIZE(omap2420_mailbox_slaves),
.omap_chip  = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
 };
 
@@ -799,6 +869,9 @@ static __initdata struct omap_hwmod *omap2420_hwmods[] = {
&omap2420_gpio2_hwmod,
&omap2420_gpio3_hwmod,
&omap2420_gpio4_hwmod,
+
+   /* mailbox class */
+   &omap2420_mailbox_hwmod,
NULL,
 };
 
diff --git a/arch/arm/mach-omap2/omap_hwmod_2430_data.c 
b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
index 0f87736..939af19 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
@@ -839,6 +839,75 @@ static struct omap_hwmod omap2430_gpio5_hwmod = {
.slaves_cnt = ARRAY_SIZE(omap2430_gpio5_slaves),
.class  = &omap243x_gpio_hwmod_class,
.dev_attr   = &gpio_dev_attr,
+   .omap_chip  = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
+};
+
+/*
+ * 'mailbox' class
+ * mailbox module allowing communication between the on-chip processors
+ * using a queued mailbox-interrupt mechanism.
+ */
+
+static struct omap_hwmod_class_sysconfig omap2430_mailbox_sysc = {
+   .rev_offs   = 0x000,
+   .sysc_offs  = 0x010,
+   .syss_offs  = 0x014,
+   .sysc_flags = (SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_SIDLEMODE |
+   SYSC_HAS_SOFTRESET | SYSC_HAS_AUTOIDLE),
+   .idlemodes  = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
+   .sysc_fields= &omap_hwmod_sysc_type1,
+};
+
+static struct omap_hwmod_class omap2430_mailbox_hwmod_class = {
+   .name = "mailbox",
+   .sysc = &omap2430_mailbox_sysc,
+};
+
+/* mailbox */
+static struct omap_hwmod omap2430_mailbox_hwmod;
+static struct omap_hwmod_irq_info omap2430_mailbox_irqs[] = {
+   { .name = "dsp", .irq = 26, },
+};

[PATCH v3 0/5] omap: mailbox: hwmod support

2010-12-10 Thread Omar Ramirez Luna
Tested on 3430, based of pm-core branch. It may require rebase once
the mailbox git pull is made.

http://www.mail-archive.com/linux-omap@vger.kernel.org/msg39719.html

** v3 **
- Taken mailbox hwmod as is from Benoit original branch.
- Put back numbers for irq, addresses instead of considering them
  as magic numbers.
- Follow the declaration layout for omap4 hwmods.
- Using pm_runtime to enable the clocks.

TBD: Cleanup, once omap_device_get_rt_va can be called by drivers
using pdev and the proper omap_device_reset API is submitted.

** v2 **
- Added omap4 hwmod support.
- Moved "mailbox_ick" from hwmod to hwmod_if (omap 2/3)
- Declared sysc classes for omap 2/3

** v1 **
1. omap: mailbox: initial hwmod support for omap3
Changes were made to:
- Rebase to latest code.
- Detect the hwmod by filling prcm union for omap2, without
  this it was unable to build the hwmod at runtime.
- Replace magic number for defines.
- Use ioremap again instead of relying on the one made by hwmod,
  as noted in http://patchwork.kernel.org/patch/101661/

2. omap: mailbox: initial hwmod support for omap2
Was only compiled tested!! Unfortunately I don't have the HW for it.

Benoit Cousson (1):
  OMAP4: hwmod data: add mailbox data

Felipe Contreras (3):
  OMAP3: hwmod data: add mailbox data
  OMAP: mailbox: build device using omap_device/omap_hwmod
  OMAP: mailbox: add omap_device latency information

omar ramirez (1):
  OMAP2: hwmod data: add mailbox data

 arch/arm/mach-omap2/devices.c  |  102 ++--
 arch/arm/mach-omap2/mailbox.c  |   18 ++---
 arch/arm/mach-omap2/omap_hwmod_2420_data.c |   73 
 arch/arm/mach-omap2/omap_hwmod_2430_data.c |   72 +++
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |   71 +++
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c |   68 ++
 6 files changed, 310 insertions(+), 94 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 v3 2/5] OMAP3: hwmod data: add mailbox data

2010-12-10 Thread Omar Ramirez Luna
From: Felipe Contreras 

Mailbox hwmod data for omap3.

Signed-off-by: Felipe Contreras 
Signed-off-by: Omar Ramirez Luna 
---
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |   71 
 1 files changed, 71 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c 
b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
index 8eb81b4..9ce347e 100644
--- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
@@ -1089,6 +1089,74 @@ static struct omap_hwmod omap3xxx_gpio6_hwmod = {
.slaves_cnt = ARRAY_SIZE(omap3xxx_gpio6_slaves),
.class  = &omap3xxx_gpio_hwmod_class,
.dev_attr   = &gpio_dev_attr,
+   .omap_chip  = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
+};
+
+/*
+ * 'mailbox' class
+ * mailbox module allowing communication between the on-chip processors
+ * using a queued mailbox-interrupt mechanism.
+ */
+
+static struct omap_hwmod_class_sysconfig omap3xxx_mailbox_sysc = {
+   .rev_offs   = 0x000,
+   .sysc_offs  = 0x010,
+   .syss_offs  = 0x014,
+   .sysc_flags = (SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_SIDLEMODE |
+   SYSC_HAS_SOFTRESET | SYSC_HAS_AUTOIDLE),
+   .idlemodes  = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
+   .sysc_fields= &omap_hwmod_sysc_type1,
+};
+
+static struct omap_hwmod_class omap3xxx_mailbox_hwmod_class = {
+   .name = "mailbox",
+   .sysc = &omap3xxx_mailbox_sysc,
+};
+
+static struct omap_hwmod omap3xxx_mailbox_hwmod;
+static struct omap_hwmod_irq_info omap3xxx_mailbox_irqs[] = {
+   { .name = "dsp", .irq = 26, },
+};
+
+static struct omap_hwmod_addr_space omap3xxx_mailbox_addrs[] = {
+   {
+   .pa_start   = 0x48094000,
+   .pa_end = 0x480941ff,
+   .flags  = ADDR_TYPE_RT,
+   },
+};
+
+/* l4_core -> mailbox */
+static struct omap_hwmod_ocp_if omap3xxx_l4_core__mailbox = {
+   .master = &omap3xxx_l4_core_hwmod,
+   .slave  = &omap3xxx_mailbox_hwmod,
+   .clk= "mailboxes_ick",
+   .addr   = omap3xxx_mailbox_addrs,
+   .addr_cnt   = ARRAY_SIZE(omap3xxx_mailbox_addrs),
+   .user   = OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+/* mailbox slave ports */
+static struct omap_hwmod_ocp_if *omap3xxx_mailbox_slaves[] = {
+   &omap3xxx_l4_core__mailbox,
+};
+
+static struct omap_hwmod omap3xxx_mailbox_hwmod = {
+   .name   = "mailbox",
+   .class  = &omap3xxx_mailbox_hwmod_class,
+   .mpu_irqs   = omap3xxx_mailbox_irqs,
+   .mpu_irqs_cnt   = ARRAY_SIZE(omap3xxx_mailbox_irqs),
+   .prcm   = {
+   .omap2 = {
+   .prcm_reg_id = 1,
+   .module_bit = OMAP3430_EN_MAILBOXES_SHIFT,
+   .module_offs = CORE_MOD,
+   .idlest_reg_id = 1,
+   .idlest_idle_bit = OMAP3430_ST_MAILBOXES_SHIFT,
+   },
+   },
+   .slaves = omap3xxx_mailbox_slaves,
+   .slaves_cnt = ARRAY_SIZE(omap3xxx_mailbox_slaves),
.omap_chip  = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
 };
 
@@ -1115,6 +1183,9 @@ static __initdata struct omap_hwmod *omap3xxx_hwmods[] = {
&omap3xxx_gpio4_hwmod,
&omap3xxx_gpio5_hwmod,
&omap3xxx_gpio6_hwmod,
+
+   /* mailbox class */
+   &omap3xxx_mailbox_hwmod,
NULL,
 };
 
-- 
1.7.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


RE: [PATCH 01/11] OMAP4: PRCM: add OMAP4-specific accessor/mutatorfunctions

2010-12-10 Thread Paul Walmsley
On Wed, 8 Dec 2010, Santosh Shilimkar wrote:

> One more possible road block of removing the direct register access
> from PM code is DEVICE PRM module. Even with this clean-up for DEVCIE
> PRM related registers. I guess we still need to use the lowest level
> APIs.

To clarify my comments, I'm not talking about replacing omap4_prm_*() with 
omap4_prminst_*() for the device PRM cases.  I agree that is not 
desirable.  What I'd like to see is for the middle-level PM code, such as 
pm*.c, to call functions that describe what they are actually trying to do 
at a higher level, rather than writing to registers directly.

I'll take the PRM_VOLTSETUP* registers as a rough example.  This may be a 
bad example since we probably don't write to this directly from pm*.c any 
more, but the basic idea is, rather than writing some mystery value to a 
register from the pm*.c code, we should write something like:

int omap4_prm_regulator_set_ramp_up_duration(u32 ns, u8 starting_pwrst);

which would then take care of computing the prescaler and count values 
appropriately given the current sys_clk and writing them to the register 
or returning an error if something is wrong.

The long-term goal is to be able to reuse as much PM code as possible 
between all of the different OMAP2+ platforms.


- Paul
--
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


RE: [PATCH v2 3/6] TI816X: Update common OMAP machine specific sources

2010-12-10 Thread Pedanekar, Hemant
Tony Lindgren wrote on Saturday, December 11, 2010 7:21 AM:

> * Pedanekar, Hemant  [101210 16:58]:
>> Tony Lindgren wrote on Monday, December 06, 2010 10:23 PM:
>> 
>> [...]
 Similarly, we will also need to add TI816X specific hwmods.
 
 4) TI816X series shares similarity with OMAP4 too - e.g., various IPs are
 same, CM module is closer to OMAP4 than OMAP3. Thus, regaring (1) above,
 I could use OMAP4 code instead of adding new "else if". Of course, again,
 there are above mentioned differences too.
>>> 
>>> We really want to use same code for the shared modules so using feature
>>> based detection is the way to go.
>>> 
>> Tony,
>> 
>> Just wanted to confirm: so you are suggesting we do not have any
>> cpu_is_ti81xx() check in the code - is that correct?
> 
> We can have that, but we should avoid it where possible.
> And ideally cpu_is_ti81xx() would be just something like:
> 
> #define cpu_is_ti81xx()   \\
>   cpu_is_omap34xx() && omap_has_aaa() && omap_has_bbb()
> 
> Regards,
> 
> Tony

Thanks. I will send the patches early next week.

-
Hemant

--
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


Re: [PATCH v2 3/6] TI816X: Update common OMAP machine specific sources

2010-12-10 Thread Tony Lindgren
* Pedanekar, Hemant  [101210 16:58]:
> Tony Lindgren wrote on Monday, December 06, 2010 10:23 PM:
> 
> [...]
> >> Similarly, we will also need to add TI816X specific hwmods.
> >> 
> >> 4) TI816X series shares similarity with OMAP4 too - e.g., various IPs are
> >> same, CM module is closer to OMAP4 than OMAP3. Thus, regaring (1) above, I
> >> could use OMAP4 code instead of adding new "else if". Of course, again,
> >> there are above mentioned differences too.
> > 
> > We really want to use same code for the shared modules so
> > using feature
> > based detection is the way to go.
> > 
> Tony,
> 
> Just wanted to confirm: so you are suggesting we do not have any
> cpu_is_ti81xx() check in the code - is that correct? 

We can have that, but we should avoid it where possible.
And ideally cpu_is_ti81xx() would be just something like:

#define cpu_is_ti81xx() \\
cpu_is_omap34xx() && omap_has_aaa() && omap_has_bbb()

Regards,

Tony
--
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


Re: [PATCH 05/11] OMAP2+: clockdomains: split the clkdm hwsup enable/disable function

2010-12-10 Thread Paul Walmsley
On Wed, 8 Dec 2010, Paul Walmsley wrote:

> On Wed, 8 Dec 2010, Kevin Hilman wrote:
> 
> > Paul Walmsley  writes:
> >
> > > - * _omap2_clkdm_set_hwsup - set the hwsup idle transition bit
> > > +/**
> > > + * _enable_hwsup - set the hwsup idle transition bit
> > > + * @clkdm: struct clockdomain *
> > > + *
> > > + * XXX fix doco
> > 
> > hmm, 'doco' must be a new lingo I haven't learned yet.
> 
> Thanks, will fix these.

Here's the revised patch.


- Paul


>From 017fc0cc53bedbbaf65e7cded483b2c753f1cc0e Mon Sep 17 00:00:00 2001
From: Paul Walmsley 
Date: Wed, 8 Dec 2010 17:09:02 -0700
Subject: [PATCH] OMAP2+: clockdomains: split the clkdm hwsup enable/disable 
function

Split _omap2_clkdm_set_hwsup() into _disable_hwsup() and _enable_hwsup().

While here, also document that the autodeps are deprecated and that they
should be removed at the earliest opportunity.

The documentation has been fixed for _{enable,disable}_hwsup(), thanks
to Kevin Hilman  for pointing out that those
functions still had placeholder documentation in an earlier patch revision.

Signed-off-by: Paul Walmsley 
Cc: Kevin Hilman 
---
 arch/arm/mach-omap2/clockdomain.c |   75 +++--
 1 files changed, 55 insertions(+), 20 deletions(-)

diff --git a/arch/arm/mach-omap2/clockdomain.c 
b/arch/arm/mach-omap2/clockdomain.c
index da74f71..8e3276b 100644
--- a/arch/arm/mach-omap2/clockdomain.c
+++ b/arch/arm/mach-omap2/clockdomain.c
@@ -140,6 +140,9 @@ static struct clkdm_dep *_clkdm_deps_lookup(struct 
clockdomain *clkdm,
  * clockdomain is in hardware-supervised mode. Meant to be called
  * once at clockdomain layer initialization, since these should remain
  * fixed for a particular architecture.  No return value.
+ *
+ * XXX autodeps are deprecated and should be removed at the earliest
+ * opportunity
  */
 static void _autodep_lookup(struct clkdm_autodep *autodep)
 {
@@ -167,6 +170,9 @@ static void _autodep_lookup(struct clkdm_autodep *autodep)
  * Add the "autodep" sleep & wakeup dependencies to clockdomain 'clkdm'
  * in hardware-supervised mode.  Meant to be called from clock framework
  * when a clock inside clockdomain 'clkdm' is enabled. No return value.
+ *
+ * XXX autodeps are deprecated and should be removed at the earliest
+ * opportunity
  */
 static void _clkdm_add_autodeps(struct clockdomain *clkdm)
 {
@@ -198,6 +204,9 @@ static void _clkdm_add_autodeps(struct clockdomain *clkdm)
  * Remove the "autodep" sleep & wakeup dependencies from clockdomain 'clkdm'
  * in hardware-supervised mode.  Meant to be called from clock framework
  * when a clock inside clockdomain 'clkdm' is disabled.  No return value.
+ *
+ * XXX autodeps are deprecated and should be removed at the earliest
+ * opportunity
  */
 static void _clkdm_del_autodeps(struct clockdomain *clkdm)
 {
@@ -222,28 +231,54 @@ static void _clkdm_del_autodeps(struct clockdomain *clkdm)
}
 }
 
-/*
- * _omap2_clkdm_set_hwsup - set the hwsup idle transition bit
+/**
+ * _enable_hwsup - place a clockdomain into hardware-supervised idle
  * @clkdm: struct clockdomain *
- * @enable: int 0 to disable, 1 to enable
  *
- * Internal helper for actually switching the bit that controls hwsup
- * idle transitions for clkdm.
+ * Place the clockdomain into hardware-supervised idle mode.  No return
+ * value.
+ *
+ * XXX Should this return an error if the clockdomain does not support
+ * hardware-supervised idle mode?
+ */
+static void _enable_hwsup(struct clockdomain *clkdm)
+{
+   u32 bits, v;
+
+   if (cpu_is_omap24xx())
+   bits = OMAP24XX_CLKSTCTRL_ENABLE_AUTO;
+   else if (cpu_is_omap34xx() || cpu_is_omap44xx())
+   bits = OMAP34XX_CLKSTCTRL_ENABLE_AUTO;
+   else
+   BUG();
+
+   bits = bits << __ffs(clkdm->clktrctrl_mask);
+
+   v = __raw_readl(clkdm->clkstctrl_reg);
+   v &= ~(clkdm->clktrctrl_mask);
+   v |= bits;
+   __raw_writel(v, clkdm->clkstctrl_reg);
+
+}
+
+/**
+ * _disable_hwsup - place a clockdomain into software-supervised idle
+ * @clkdm: struct clockdomain *
+ *
+ * Place the clockdomain @clkdm into software-supervised idle mode.
+ * No return value.
+ *
+ * XXX Should this return an error if the clockdomain does not support
+ * software-supervised idle mode?
  */
-static void _omap2_clkdm_set_hwsup(struct clockdomain *clkdm, int enable)
+static void _disable_hwsup(struct clockdomain *clkdm)
 {
u32 bits, v;
 
if (cpu_is_omap24xx()) {
-   if (enable)
-   bits = OMAP24XX_CLKSTCTRL_ENABLE_AUTO;
-   else
-   bits = OMAP24XX_CLKSTCTRL_DISABLE_AUTO;
+   bits = OMAP24XX_CLKSTCTRL_DISABLE_AUTO;
} else if (cpu_is_omap34xx() || cpu_is_omap44xx()) {
-   if (enable)
-   bits = OMAP34XX_CLKSTCTRL_ENABLE_AUTO;
-   else
-   bits = OMAP34XX_CLKSTCTRL_DISABLE_AUTO;
+   bits = OMAP34XX_CLKSTCTRL_DISABLE_AUTO;

RE: [PATCH v2 3/6] TI816X: Update common OMAP machine specific sources

2010-12-10 Thread Pedanekar, Hemant
Tony Lindgren wrote on Monday, December 06, 2010 10:23 PM:

[...]
>> Similarly, we will also need to add TI816X specific hwmods.
>> 
>> 4) TI816X series shares similarity with OMAP4 too - e.g., various IPs are
>> same, CM module is closer to OMAP4 than OMAP3. Thus, regaring (1) above, I
>> could use OMAP4 code instead of adding new "else if". Of course, again,
>> there are above mentioned differences too.
> 
> We really want to use same code for the shared modules so
> using feature
> based detection is the way to go.
> 
Tony,

Just wanted to confirm: so you are suggesting we do not have any
cpu_is_ti81xx() check in the code - is that correct? 

Thanks
-
Hemant

--
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


Re: [PATCH/RFC 2/2] OMAP: PM: implement context loss count APIs

2010-12-10 Thread Kevin Hilman
Vishwanath Sripathy  writes:

> Kevin,
[...]

>> @@ -288,20 +290,19 @@ unsigned long omap_pm_cpu_get_freq(void)
>>
>>  int omap_pm_get_dev_context_loss_count(struct device *dev)
>>  {
>> +struct platform_device *pdev = to_platform_device(dev);
>> +int count;
>> +
>>  if (!dev) {
>>  WARN_ON(1);
>>  return -EINVAL;
>>  };
>>
>> -pr_debug("OMAP PM: returning context loss count for dev %s\n",
>> - dev_name(dev));
>> +count = omap_device_get_context_loss_count(pdev);
>> +pr_debug("OMAP PM: context loss count for dev %s = %d\n",
>> + dev_name(dev), count);
>
> Shouldn't this implementation be part of omap-pm.c where all the OMAP PM
> functions are to be implemented? 

Where is omap-pm.c?

Kevin

--
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


Re: [PATCH v2 4/8] OMAP4: clock data: Add missing fields in iva_hsd_byp_clk_mux_ck

2010-12-10 Thread Paul Walmsley
On Thu, 9 Dec 2010, Benoit Cousson wrote:

> From: Jonathan Bergsagel 
> 
> Add register address, mask and link to the clksel structure that
> were missing in the IVA DPLL mux clock node.
> 
> Signed-off-by: Jonathan Bergsagel 
> Signed-off-by: Benoit Cousson 

This patch results in a checkpatch warning:

---

WARNING: please, no space before tabs
#23: FILE: arch/arm/mach-omap2/clock44xx_data.c:639:
+^I.clksel ^I= iva_hsd_byp_clk_mux_sel,$

total: 0 errors, 1 warnings, 0 checks, 13 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

---

I've fixed it in the copy in my local branch, but next time, please run 
checkpatch.pl and fix any problems before submitting.

regards,

- Paul
--
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: omap_device: use pdev as parameter to get rt_va

2010-12-10 Thread Omar Ramirez Luna
Make the parameter received by omap_device_get_mpu_rt_va
consistent with the functions meant to be called by drivers.

Also move its header declaration to appear in the set of
functions to be used by drivers, as per the comment there.

Signed-off-by: Omar Ramirez Luna 
Acked-by: Kevin Hilman 
---
 arch/arm/plat-omap/include/plat/omap_device.h |3 +--
 arch/arm/plat-omap/omap_device.c  |8 ++--
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/arch/arm/plat-omap/include/plat/omap_device.h 
b/arch/arm/plat-omap/include/plat/omap_device.h
index 28e2d1a..1877c1a 100644
--- a/arch/arm/plat-omap/include/plat/omap_device.h
+++ b/arch/arm/plat-omap/include/plat/omap_device.h
@@ -80,6 +80,7 @@ struct omap_device {
 int omap_device_enable(struct platform_device *pdev);
 int omap_device_idle(struct platform_device *pdev);
 int omap_device_shutdown(struct platform_device *pdev);
+void __iomem *omap_device_get_rt_va(struct platform_device *pdev);
 
 /* Core code interface */
 
@@ -101,8 +102,6 @@ struct omap_device *omap_device_build_ss(const char 
*pdev_name, int pdev_id,
 int omap_device_register(struct omap_device *od);
 int omap_early_device_register(struct omap_device *od);
 
-void __iomem *omap_device_get_rt_va(struct omap_device *od);
-
 /* OMAP PM interface */
 int omap_device_align_pm_lat(struct platform_device *pdev,
 u32 new_wakeup_lat_limit);
diff --git a/arch/arm/plat-omap/omap_device.c b/arch/arm/plat-omap/omap_device.c
index abe933c..9d11195 100644
--- a/arch/arm/plat-omap/omap_device.c
+++ b/arch/arm/plat-omap/omap_device.c
@@ -681,7 +681,7 @@ struct powerdomain *omap_device_get_pwrdm(struct 
omap_device *od)
 
 /**
  * omap_device_get_mpu_rt_va - return the MPU's virtual addr for the hwmod base
- * @od: struct omap_device *
+ * @pdev: struct platform_device *
  *
  * Return the MPU's virtual address for the base of the hwmod, from
  * the ioremap() that the hwmod code does.  Only valid if there is one
@@ -690,8 +690,12 @@ struct powerdomain *omap_device_get_pwrdm(struct 
omap_device *od)
  * otherwise, passes along the return value from
  * omap_hwmod_get_mpu_rt_va().
  */
-void __iomem *omap_device_get_rt_va(struct omap_device *od)
+void __iomem *omap_device_get_rt_va(struct platform_device *pdev)
 {
+   struct omap_device *od;
+
+   od = _find_by_pdev(pdev);
+
if (od->hwmods_cnt != 1)
return NULL;
 
-- 
1.7.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


Re: Corrupted LCML messages using DSP Bridge on Gumstix

2010-12-10 Thread argon design
> I think the following list is the right list:
> https://gforge.ti.com/gf/project/omapandroid/mailman/?action=ListThreads&mailman_id=22
>
> Regards,
> Nishanth Menon

Thanks for the advice, discussion moved to omapandroid-discussion

Peter
--
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


Re: [PATCH 2/9 v3] usb: musb: Remove board_data parameter from musb_platform_init()

2010-12-10 Thread Sergei Shtylyov

Hello.

Greg KH wrote:


Removed the board_data parameter being passed to musb_platform_init function
as board data can be extracted from device structure which is already member of
musb structure.



Signed-off-by: Hema HK 
Cc: Felipe Balbi 
Cc: Tony Lindgren 
Cc: Kevin Hilman 
Cc: Cousson, Benoit 
Cc: Paul Walmsley 



For the davinci changes:



Acked-by: Kevin Hilman 



Kevin

---
drivers/usb/musb/blackfin.c  |2 +-
drivers/usb/musb/davinci.c   |2 +-
drivers/usb/musb/musb_core.c |2 +-
drivers/usb/musb/musb_core.h |2 +-
drivers/usb/musb/omap2430.c  |6 --
drivers/usb/musb/tusb6010.c  |2 +-
6 files changed, 9 insertions(+), 7 deletions(-)



   Grr. This misses changes to da8xx.c and am35x.c -- which breaks
the compilation for them!
   Greg, could you drop it from your usb-next branch? Or should we
send a patch adding these glue layers?



I can't drop patches from a git branch, sorry, it doesn't work that way
anymore.


   That's why I really prefer quilt to git. :-)


greg k-h


WBR, Sergei
--
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


Re: [RESEND] [PATCH 1/2] OMAP1: allow reserving memory for camera

2010-12-10 Thread Janusz Krzysztofik
Friday 10 December 2010 18:03:56 Russell King - ARM Linux napisał(a):
> On Fri, Dec 10, 2010 at 12:03:07PM +0100, Janusz Krzysztofik wrote:
> >  void __init omap1_camera_init(void *info)
> >  {
> > struct platform_device *dev = &omap1_camera_device;
> > +   dma_addr_t paddr = omap1_camera_phys_mempool_base;
> > +   dma_addr_t size = omap1_camera_phys_mempool_size;
> > int ret;
> >
> > dev->dev.platform_data = info;
> >
> > +   if (paddr) {
> > +   if (dma_declare_coherent_memory(&dev->dev, paddr, paddr, size,
> > +   DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE))
>
> Although this works, you're ending up with SDRAM being mapped via
> ioremap, which uses MT_DEVICE - so what is SDRAM ends up being
> mapped as if it were a device.
>
> For OMAP1, which is ARMv5 or lower, device memory becomes 'uncacheable,
> unbufferable' which is luckily what is used for the DMA coherent
> memory on those platforms - so no technical problem here.
>
> However, on ARMv6 and later, ioremapped memory is device memory, which
> has different ordering wrt normal memory mappings, and may appear on
> different busses on the CPU's interface.  So, this is something I don't
> encourage as it's unclear that the hardware will work.
>
> Essentially, dma_declare_coherent_memory() on ARM with main SDRAM should
> be viewed as a 'it might work, it might not, and it might stop working
> in the future' kind of interface.  In other words, there is no guarantee
> that this kind of thing will be supported in the future.

I was affraid of an unswer of this kind. I'm not capable of comming out with 
any better, alternative solutions. Any hints other than giving up with that 
old videobuf-contig, coherent memory based interface? Or can we agree on 
that 'luckily uncacheable, unbufferable, SDRAM based DMA coherent memory' 
solution for now?

Thanks,
Janusz
--
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


Re: Corrupted LCML messages using DSP Bridge on Gumstix

2010-12-10 Thread Nishanth Menon

argon design had written, on 12/10/2010 02:34 PM, the following:

BACKGROUND
I am running the RLS25.INC2.6 Zoom release configured for board_overo
on a Overo Water Gumstix module (contains a 3530 chip).


[...]


Thanks (and many apologies if I haven't picked the right mailing list!),

I think the following list is the right list:
https://gforge.ti.com/gf/project/omapandroid/mailman/?action=ListThreads&mailman_id=22

Regards,
Nishanth Menon
--
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


Corrupted LCML messages using DSP Bridge on Gumstix

2010-12-10 Thread argon design
BACKGROUND
I am running the RLS25.INC2.6 Zoom release configured for board_overo
on a Overo Water Gumstix module (contains a 3530 chip).

I have got the RLS25.12 binaries from TI's website
(https://gforge.ti.com/gf/project/openmax/frs/) and these work fine
for decoding video (via pvplayer_engine_test).

Now I am trying to use some third party video codecs (from Ittiam) but
some of the messages sent over DSP bridge seem to get corrupted.

The library uses the LCML (I believe this stands for Linux Common
Multimedia layer?) QueueBuffer function to pass an output buffer.
On the ARM side (inside the dsp/bridge kernel driver) I can see non
zero values being passed in for the address and length of the buffer,
but on the DSP side the error messages suggest that the received
values are 0.
This happens for the first output buffer.
Later messages do seem to get passed correctly so it feels as if it is
basically working but there is some oddness in the message passing
code.

I get the same results if I use the baseimage.dof and usn.dll64P from
the RLS25.14M3 TI binaries.

QUESTIONS
1) Is it valid to try to use DSP Bridge from RLS25.INC2.6 for the 3530
chip?  (I understand that the INC2 releases are meant for the 3630 but
I don't know of any reason why they wouldn't also work for 3530)
2) Which version of the TI binaries go with RLS25.INC2.6?
3) Has anyone any idea why the output buffer messages are getting corrupted?

I'm not really looking for debugging help (unless someone knows a
really revealing experiment that only involves code change on the ARM
side) but I am just hoping that someone may have seen a similar
problem before.
I'm new to the whole DSP bridge area so I am sure I have just made a
really stupid mistake somewhere but I can't think where,

Thanks (and many apologies if I haven't picked the right mailing list!),

Peter
--
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


Re: [PATCH 2/9 v3] usb: musb: Remove board_data parameter from musb_platform_init()

2010-12-10 Thread Greg KH
On Fri, Dec 10, 2010 at 10:30:50PM +0300, Sergei Shtylyov wrote:
> Hello.
> 
> Kevin Hilman wrote:
> 
> >>Removed the board_data parameter being passed to musb_platform_init function
> >>as board data can be extracted from device structure which is already 
> >>member of
> >>musb structure.
> 
> >>Signed-off-by: Hema HK 
> >>Cc: Felipe Balbi 
> >>Cc: Tony Lindgren 
> >>Cc: Kevin Hilman 
> >>Cc: Cousson, Benoit 
> >>Cc: Paul Walmsley 
> 
> >For the davinci changes:
> 
> >Acked-by: Kevin Hilman 
> 
> >Kevin
> 
> >>---
> >> drivers/usb/musb/blackfin.c  |2 +-
> >> drivers/usb/musb/davinci.c   |2 +-
> >> drivers/usb/musb/musb_core.c |2 +-
> >> drivers/usb/musb/musb_core.h |2 +-
> >> drivers/usb/musb/omap2430.c  |6 --
> >> drivers/usb/musb/tusb6010.c  |2 +-
> >> 6 files changed, 9 insertions(+), 7 deletions(-)
> 
>Grr. This misses changes to da8xx.c and am35x.c -- which breaks
> the compilation for them!
>Greg, could you drop it from your usb-next branch? Or should we
> send a patch adding these glue layers?

I can't drop patches from a git branch, sorry, it doesn't work that way
anymore.

greg k-h
--
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] tools, perf: Documentation for the power events API

2010-12-10 Thread jean . pihet
From: Jean Pihet 

Provides documentation for the following:
- the new power trace API,
- the old (legacy) power trace API,
- the DEPRECATED Kconfig option usage..

Signed-off-by: Jean Pihet 
---
 Documentation/trace/events-power.txt |   90 ++
 1 files changed, 90 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/trace/events-power.txt

diff --git a/Documentation/trace/events-power.txt 
b/Documentation/trace/events-power.txt
new file mode 100644
index 000..8a50653
--- /dev/null
+++ b/Documentation/trace/events-power.txt
@@ -0,0 +1,90 @@
+
+   Subsystem Trace Points: power
+
+The power tracing system captures events related to power transitions
+within the kernel. Broadly speaking there are three major subheadings:
+
+  o Power state switch which reports events related to suspend (S-states),
+ cpuidle (C-states) and cpufreq (P-states)
+  o System clock related changes
+  o Power domains related changes and transitions
+
+This document describes what each of the tracepoints is and why they
+might be useful.
+
+Cf. include/trace/events/power.h for the events definitions.
+
+1. Power state switch events
+
+
+1.1 New trace API
+-
+
+A 'cpu' event class gathers the CPU-related events: cpuidle and
+cpufreq.
+
+cpu_idle   "state=%lu cpu_id=%lu"
+cpu_frequency  "state=%lu cpu_id=%lu"
+
+A suspend event is used to indicate the system going in and out of the
+suspend mode:
+
+machine_suspend"state=%lu"
+
+
+Note: the value of '-1' or '4294967295' for state means an exit from the 
current state,
+i.e. trace_cpu_idle(4, smp_processor_id()) means that the system
+enters the idle state 4, while trace_cpu_idle(PWR_EVENT_EXIT, 
smp_processor_id())
+means that the system exits the previous idle state.
+
+The event which has 'state=4294967295' in the trace is very important to the 
user
+space tools which are using it to detect the end of the current state, and so 
to
+correctly draw the states diagrams and to calculate accurate statistics etc.
+
+1.2 DEPRECATED trace API
+
+
+A new Kconfig option CONFIG_EVENT_POWER_TRACING_DEPRECATED with the default 
value of
+'y' has been created. This allows the legacy trace power API to be used 
conjointly
+with the new trace API.
+The Kconfig option, the old trace API (in include/trace/events/power.h) and the
+old trace points will disappear in a future release (namely 2.6.41).
+
+power_start"type=%lu state=%lu cpu_id=%lu"
+power_frequency"type=%lu state=%lu cpu_id=%lu"
+power_end  "cpu_id=%lu"
+
+The 'type' parameter takes one of those macros:
+ . POWER_NONE  = 0,
+ . POWER_CSTATE= 1,/* C-State */
+ . POWER_PSTATE= 2,/* Fequency change or DVFS */
+
+The 'state' parameter is set depending on the type:
+ . Target C-state for type=POWER_CSTATE,
+ . Target frequency for type=POWER_PSTATE,
+
+power_end is used to indicate the exit of a state, corresponding to the latest
+power_start event.
+
+2. Clocks events
+
+The clock events are used for clock enable/disable and for
+clock rate change.
+
+clock_enable   "%s state=%lu cpu_id=%lu"
+clock_disable  "%s state=%lu cpu_id=%lu"
+clock_set_rate "%s state=%lu cpu_id=%lu"
+
+The first parameter gives the clock name (e.g. "gpio1_iclk").
+The second parameter is '1' for enable, '0' for disable, the target
+clock rate for set_rate.
+
+3. Power domains events
+===
+The power domain events are used for power domains transitions
+
+power_domain_target"%s state=%lu cpu_id=%lu"
+
+The first parameter gives the power domain name (e.g. "mpu_pwrdm").
+The second parameter is the power domain target state.
+
-- 
1.7.2.3

--
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] perf: add calls to suspend trace point

2010-12-10 Thread jean . pihet
From: Jean Pihet 

Uses the machine_suspend trace point, called from the
generic kernel suspend_enter function.

Signed-off-by: Jean Pihet 
CC: Thomas Renninger 
---
 kernel/power/suspend.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
index ecf7705..0650596 100644
--- a/kernel/power/suspend.c
+++ b/kernel/power/suspend.c
@@ -22,6 +22,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "power.h"
 
@@ -164,7 +165,9 @@ static int suspend_enter(suspend_state_t state)
error = sysdev_suspend(PMSG_SUSPEND);
if (!error) {
if (!suspend_test(TEST_CORE) && pm_check_wakeup_events()) {
+   trace_machine_suspend(state);
error = suspend_ops->enter(state);
+   trace_machine_suspend(PWR_EVENT_EXIT);
events_check_enabled = false;
}
sysdev_resume();
-- 
1.7.2.3

--
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] perf: add OMAP support for the new power events

2010-12-10 Thread jean . pihet
From: Jean Pihet 

The patch adds the new power management trace points for
the OMAP architecture.

The trace points are for:
- default idle handler. Since the cpuidle framework is
  instrumented in the generic way there is no need to
  add trace points in the OMAP specific cpuidle handler;
- cpufreq (DVFS),
- clocks changes (enable, disable, set_rate),
- change of power domains next power states.

Signed-off-by: Jean Pihet 
---
 arch/arm/mach-omap2/pm34xx.c  |7 +++
 arch/arm/mach-omap2/powerdomain.c |3 +++
 arch/arm/plat-omap/clock.c|   13 ++---
 3 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index 0ec8a04..0ee0b0e 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -29,6 +29,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -506,8 +507,14 @@ static void omap3_pm_idle(void)
if (omap_irq_pending() || need_resched())
goto out;
 
+   trace_power_start(POWER_CSTATE, 1, smp_processor_id());
+   trace_cpu_idle(1, smp_processor_id());
+
omap_sram_idle();
 
+   trace_power_end(smp_processor_id());
+   trace_cpu_idle(PWR_EVENT_EXIT, smp_processor_id());
+
 out:
local_fiq_enable();
local_irq_enable();
diff --git a/arch/arm/mach-omap2/powerdomain.c 
b/arch/arm/mach-omap2/powerdomain.c
index 6527ec3..73cbe9a 100644
--- a/arch/arm/mach-omap2/powerdomain.c
+++ b/arch/arm/mach-omap2/powerdomain.c
@@ -23,6 +23,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -440,6 +441,8 @@ int pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 
pwrst)
pr_debug("powerdomain: setting next powerstate for %s to %0x\n",
 pwrdm->name, pwrst);
 
+   trace_power_domain_target(pwrdm->name, pwrst, smp_processor_id());
+
prm_rmw_mod_reg_bits(OMAP_POWERSTATE_MASK,
 (pwrst << OMAP_POWERSTATE_SHIFT),
 pwrdm->prcm_offs, pwrstctrl_reg_offs);
diff --git a/arch/arm/plat-omap/clock.c b/arch/arm/plat-omap/clock.c
index fc62fb5..7cbb09b 100644
--- a/arch/arm/plat-omap/clock.c
+++ b/arch/arm/plat-omap/clock.c
@@ -21,6 +21,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -43,8 +44,10 @@ int clk_enable(struct clk *clk)
return -EINVAL;
 
spin_lock_irqsave(&clockfw_lock, flags);
-   if (arch_clock->clk_enable)
+   if (arch_clock->clk_enable) {
+   trace_clock_enable(clk->name, 1, smp_processor_id());
ret = arch_clock->clk_enable(clk);
+   }
spin_unlock_irqrestore(&clockfw_lock, flags);
 
return ret;
@@ -66,8 +69,10 @@ void clk_disable(struct clk *clk)
goto out;
}
 
-   if (arch_clock->clk_disable)
+   if (arch_clock->clk_disable) {
+   trace_clock_disable(clk->name, 0, smp_processor_id());
arch_clock->clk_disable(clk);
+   }
 
 out:
spin_unlock_irqrestore(&clockfw_lock, flags);
@@ -120,8 +125,10 @@ int clk_set_rate(struct clk *clk, unsigned long rate)
return ret;
 
spin_lock_irqsave(&clockfw_lock, flags);
-   if (arch_clock->clk_set_rate)
+   if (arch_clock->clk_set_rate) {
+   trace_clock_set_rate(clk->name, rate, smp_processor_id());
ret = arch_clock->clk_set_rate(clk, rate);
+   }
if (ret == 0) {
if (clk->recalc)
clk->rate = clk->recalc(clk);
-- 
1.7.2.3

--
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] perf, tools: new power trace API

2010-12-10 Thread jean . pihet
From: Jean Pihet 

Provides:
. calls to machine_suspend trace point,
. OMAP support,
. API Documentation

Applies on top of Thomas's 8 latest power trace API patches, cf.
http://marc.info/?l=linux-kernel&m=129130827309354&w=2

Jean Pihet (3):
  perf: add calls to suspend trace point
  perf: add OMAP support for the new power events
  tools, perf: Documentation for the power events API

 Documentation/trace/events-power.txt |   90 ++
 arch/arm/mach-omap2/pm34xx.c |7 +++
 arch/arm/mach-omap2/powerdomain.c|3 +
 arch/arm/plat-omap/clock.c   |   13 -
 kernel/power/suspend.c   |3 +
 5 files changed, 113 insertions(+), 3 deletions(-)
 create mode 100644 Documentation/trace/events-power.txt

-- 
1.7.2.3

--
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


Re: [PATCH 2/9 v3] usb: musb: Remove board_data parameter from musb_platform_init()

2010-12-10 Thread Sergei Shtylyov

Hello.

Kevin Hilman wrote:


Removed the board_data parameter being passed to musb_platform_init function
as board data can be extracted from device structure which is already member of
musb structure.



Signed-off-by: Hema HK 
Cc: Felipe Balbi 
Cc: Tony Lindgren 
Cc: Kevin Hilman 
Cc: Cousson, Benoit 
Cc: Paul Walmsley 



For the davinci changes:



Acked-by: Kevin Hilman 



Kevin



---
 drivers/usb/musb/blackfin.c  |2 +-
 drivers/usb/musb/davinci.c   |2 +-
 drivers/usb/musb/musb_core.c |2 +-
 drivers/usb/musb/musb_core.h |2 +-
 drivers/usb/musb/omap2430.c  |6 --
 drivers/usb/musb/tusb6010.c  |2 +-
 6 files changed, 9 insertions(+), 7 deletions(-)


   Grr. This misses changes to da8xx.c and am35x.c -- which breaks the 
compilation for them!
   Greg, could you drop it from your usb-next branch? Or should we send a patch 
adding these glue layers?


WBR. Sergei

--
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


Re: [PATCH 2/4] omap1: Add initcall checks for omap1 and booted board

2010-12-10 Thread Tony Lindgren
* Janusz Krzysztofik  [101210 08:03]:
> Saturday 04 December 2010 22:36:55 Tony Lindgren napisał(a):
> > Otherwise multi-omap1 configurations will fail.
> 
> Tested on Amstrad Delta with omap1_defconfig.
> 
> > Signed-off-by: Tony Lindgren 
> 
> Tested-by: Janusz Krzysztofik 

Thanks, will merge these too.

Regards,

Tony
--
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


Re: [PATCH] OMAP: device: make rt_va easily avaialable to drivers

2010-12-10 Thread Ramirez Luna, Omar
On Thu, Dec 9, 2010 at 11:16 AM, Kevin Hilman
 wrote:
> Omar Ramirez Luna  writes:
>
>> Patch "OMAP: hwmod/device: add omap_{device, hwmod}_get_mpu_rt_va"[1],
>> introduces omap_device_get_rt_va which is meant to be called
>> by drivers to retrieve the _mpu_rt_va, however this function
>> receives a pointer to an omap_device; since there is no
>> practical way for a driver to get this parameter without
>> fiddling with pdev and container_of macro, and omap_device code
>> already does this, it is better for it to handle this case.
>>
>> Also moved header declaration to appear in the set of
>> functions to be used by drivers, as per the comment there.
>>
>> [1] http://marc.info/?l=linux-omap&m=127808467703366&w=2
>>
>> Signed-off-by: Omar Ramirez Luna 
>
> Looks right, since all the other driver-accessible functions take a
> platform_device pointer, not an omap_device pointer.
>
> Acked-by: Kevin Hilman 
>
> However, I thing the subject/shortlog should be clearer.  IMO, this
> patch makes the API more consistent rather than making it easier.
> Also, subject prefix should be preferrably 'OMAP: omap_device:'.

I saw few patches following the convention "OMAP: device" that's why I
followed that one, I will change the subject/changelog according to
your suggestions.

Thanks,

Omar
--
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


Re: [PATCH] staging: tidspbridge: remove file handling functions for loader

2010-12-10 Thread Ramirez Luna, Omar
On Wed, Dec 8, 2010 at 5:49 PM, Greg KH  wrote:
>> BTW, I don't expect this pushed through staging yet, I need to include
>> it to my branch first and then I'll send a pull request with the pile
>> of patches. Sorry for the misunderstanding and thanks for the review.
>
> Well, don't send me patches you don't want me to apply without a big "DO
> NOT APPLY" in them, otherwise I might try to :)

Will do.

> Then mess with the firmware symlink in userspace, don't have the driver
> have to worry about it.

Ok, agree.

> That would be good.  Again, you can put whatever firmware image you want
> in that location if you wish to use different ones.  That is for
> userspace to do, not have the kernel worry about.

Agree.

Regards,

Omar
--
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


[PATCHv4 5/5] OMAP4: Smartreflex framework extensions

2010-12-10 Thread Thara Gopinath
This patch extends the smartreflex framework to support
OMAP4. The changes are minor like compiling smartreflex Kconfig
option for OMAP4 also, and a couple of OMAP4 checks in
the smartreflex framework.

The change in sr_device.c where new logic has to be introduced
for reading the efuse registers is due to the fact that in OMAP4
the efuse registers are 24 bit aligned. A __raw_readl will
fail for non-32 bit aligned address and hence the 8-bit read
and shift.

Signed-off-by: Thara Gopinath 
---
 arch/arm/mach-omap2/smartreflex.c |8 ++--
 arch/arm/mach-omap2/sr_device.c   |   17 -
 arch/arm/plat-omap/Kconfig|2 +-
 3 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-omap2/smartreflex.c 
b/arch/arm/mach-omap2/smartreflex.c
index 52a05b3..77ecebf 100644
--- a/arch/arm/mach-omap2/smartreflex.c
+++ b/arch/arm/mach-omap2/smartreflex.c
@@ -153,7 +153,11 @@ static void sr_set_clk_length(struct omap_sr *sr)
struct clk *sys_ck;
u32 sys_clk_speed;
 
-   sys_ck = clk_get(NULL, "sys_ck");
+   if (cpu_is_omap34xx())
+   sys_ck = clk_get(NULL, "sys_ck");
+   else
+   sys_ck = clk_get(NULL, "sys_clkin_ck");
+
if (IS_ERR(sys_ck)) {
dev_err(&sr->pdev->dev, "%s: unable to get sys clk\n",
__func__);
@@ -193,7 +197,7 @@ static void sr_set_regfields(struct omap_sr *sr)
 * file or pmic specific data structure. In that case these structure
 * fields will have to be populated using the pdata or pmic structure.
 */
-   if (cpu_is_omap34xx()) {
+   if (cpu_is_omap34xx() || cpu_is_omap44xx()) {
sr->err_weight = OMAP3430_SR_ERRWEIGHT;
sr->err_maxlimit = OMAP3430_SR_ERRMAXLIMIT;
sr->accum_data = OMAP3430_SR_ACCUMDATA;
diff --git a/arch/arm/mach-omap2/sr_device.c b/arch/arm/mach-omap2/sr_device.c
index 9a3538f..786d685 100644
--- a/arch/arm/mach-omap2/sr_device.c
+++ b/arch/arm/mach-omap2/sr_device.c
@@ -20,6 +20,7 @@
 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -51,7 +52,21 @@ static void __init sr_set_nvalues(struct omap_volt_data 
*volt_data,
GFP_KERNEL);
 
for (i = 0; i < count; i++) {
-   u32 v = omap_ctrl_readl(volt_data[i].sr_efuse_offs);
+   u32 v;
+   /*
+* In OMAP4 the efuse registers are 24 bit aligned.
+* A __raw_readl will fail for non-32 bit aligned address
+* and hence the 8-bit read and shift.
+*/
+   if (cpu_is_omap44xx()) {
+   u16 offset = volt_data[i].sr_efuse_offs;
+
+   v = omap_ctrl_readb(offset) |
+   omap_ctrl_readb(offset + 1) << 8 |
+   omap_ctrl_readb(offset + 2) << 16;
+   } else {
+v = omap_ctrl_readl(volt_data[i].sr_efuse_offs);
+   }
 
nvalue_table[i].efuse_offs = volt_data[i].sr_efuse_offs;
nvalue_table[i].nvalue = v;
diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig
index 4029e6a..88ff484 100644
--- a/arch/arm/plat-omap/Kconfig
+++ b/arch/arm/plat-omap/Kconfig
@@ -37,7 +37,7 @@ config OMAP_DEBUG_LEDS
 
 config OMAP_SMARTREFLEX
bool "SmartReflex support"
-   depends on ARCH_OMAP3 && PM
+   depends on (ARCH_OMAP3 || ARCH_OMAP4) && PM
help
  Say Y if you want to enable SmartReflex.
 
-- 
1.7.0.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


[PATCHv4 2/5] OMAP4: Adding voltage driver support

2010-12-10 Thread Thara Gopinath
OMAP4 has three scalable voltage domains vdd_mpu, vdd_iva
and vdd_core. This patch adds the voltage tables and other
configurable voltage processor and voltage controller
settings to control these three scalable domains in OMAP4.

Signed-off-by: Thara Gopinath 
---
This patch has 9 checkpatch.pl above 80-chars warnings for
the definitions of omap44xx_vdd_mpu_volt_data, omap44xx_vdd_iva_volt_data
and omap44xx_vdd_core_volt_data.
IMHO splitting of the entries in these structures affects
readability and looks very ugly. Hence they are left as is.

 arch/arm/mach-omap2/Makefile  |2 +-
 arch/arm/mach-omap2/control.h |   12 ++
 arch/arm/mach-omap2/voltage.c |  249 +
 arch/arm/plat-omap/include/plat/voltage.h |   12 ++
 4 files changed, 274 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 59585d9..d76bedc 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -62,7 +62,7 @@ obj-$(CONFIG_ARCH_OMAP2)  += pm24xx.o
 obj-$(CONFIG_ARCH_OMAP2)   += sleep24xx.o pm_bus.o
 obj-$(CONFIG_ARCH_OMAP3)   += pm34xx.o sleep34xx.o voltage.o \
   cpuidle34xx.o pm_bus.o
-obj-$(CONFIG_ARCH_OMAP4)   += pm44xx.o pm_bus.o
+obj-$(CONFIG_ARCH_OMAP4)   += pm44xx.o voltage.o pm_bus.o
 obj-$(CONFIG_PM_DEBUG) += pm-debug.o
 obj-$(CONFIG_OMAP_SMARTREFLEX)  += sr_device.o smartreflex.o
 obj-$(CONFIG_OMAP_SMARTREFLEX_CLASS3)  += smartreflex-class3.o
diff --git a/arch/arm/mach-omap2/control.h b/arch/arm/mach-omap2/control.h
index fef6bcc..8ed6d5d 100644
--- a/arch/arm/mach-omap2/control.h
+++ b/arch/arm/mach-omap2/control.h
@@ -181,6 +181,18 @@
 #define OMAP3630_CONTROL_FUSE_OPP50_VDD2(OMAP2_CONTROL_GENERAL + 
0x0128)
 #define OMAP3630_CONTROL_FUSE_OPP100_VDD2   (OMAP2_CONTROL_GENERAL + 
0x012C)
 
+/* OMAP44xx control efuse offsets */
+#define OMAP44XX_CONTROL_FUSE_IVA_OPP500x22C
+#define OMAP44XX_CONTROL_FUSE_IVA_OPP100   0x22F
+#define OMAP44XX_CONTROL_FUSE_IVA_OPPTURBO 0x232
+#define OMAP44XX_CONTROL_FUSE_IVA_OPPNITRO 0x235
+#define OMAP44XX_CONTROL_FUSE_MPU_OPP500x240
+#define OMAP44XX_CONTROL_FUSE_MPU_OPP100   0x243
+#define OMAP44XX_CONTROL_FUSE_MPU_OPPTURBO 0x246
+#define OMAP44XX_CONTROL_FUSE_MPU_OPPNITRO 0x249
+#define OMAP44XX_CONTROL_FUSE_CORE_OPP50   0x254
+#define OMAP44XX_CONTROL_FUSE_CORE_OPP100  0x257
+
 /* AM35XX only CONTROL_GENERAL register offsets */
 #define AM35XX_CONTROL_MSUSPENDMUX_6(OMAP2_CONTROL_GENERAL + 0x0038)
 #define AM35XX_CONTROL_DEVCONF2 (OMAP2_CONTROL_GENERAL + 0x0310)
diff --git a/arch/arm/mach-omap2/voltage.c b/arch/arm/mach-omap2/voltage.c
index 1f84939..6e91748 100644
--- a/arch/arm/mach-omap2/voltage.c
+++ b/arch/arm/mach-omap2/voltage.c
@@ -29,6 +29,8 @@
 #include 
 
 #include "prm-regbits-34xx.h"
+#include "prm-regbits-44xx.h"
+#include "prm44xx.h"
 #include "control.h"
 
 #define VP_IDLE_TIMEOUT200
@@ -188,6 +190,51 @@ static struct omap_vdd_info omap3_vdd_info[] = {
 
 #define OMAP3_NR_SCALABLE_VDD ARRAY_SIZE(omap3_vdd_info)
 
+/* OMAP4 VDD sturctures */
+static struct omap_vdd_info omap4_vdd_info[] = {
+   {
+   .vp_offs = {
+   .vpconfig = OMAP4_PRM_VP_MPU_CONFIG_OFFSET,
+   .vstepmin = OMAP4_PRM_VP_MPU_VSTEPMIN_OFFSET,
+   .vstepmax = OMAP4_PRM_VP_MPU_VSTEPMAX_OFFSET,
+   .vlimitto = OMAP4_PRM_VP_MPU_VLIMITTO_OFFSET,
+   .vstatus = OMAP4_PRM_VP_MPU_STATUS_OFFSET,
+   .voltage = OMAP4_PRM_VP_MPU_VOLTAGE_OFFSET,
+   },
+   .voltdm = {
+   .name = "mpu",
+   },
+   },
+   {
+   .vp_offs = {
+   .vpconfig = OMAP4_PRM_VP_IVA_CONFIG_OFFSET,
+   .vstepmin = OMAP4_PRM_VP_IVA_VSTEPMIN_OFFSET,
+   .vstepmax = OMAP4_PRM_VP_IVA_VSTEPMAX_OFFSET,
+   .vlimitto = OMAP4_PRM_VP_IVA_VLIMITTO_OFFSET,
+   .vstatus = OMAP4_PRM_VP_IVA_STATUS_OFFSET,
+   .voltage = OMAP4_PRM_VP_IVA_VOLTAGE_OFFSET,
+   },
+   .voltdm = {
+   .name = "iva",
+   },
+   },
+   {
+   .vp_offs = {
+   .vpconfig = OMAP4_PRM_VP_CORE_CONFIG_OFFSET,
+   .vstepmin = OMAP4_PRM_VP_CORE_VSTEPMIN_OFFSET,
+   .vstepmax = OMAP4_PRM_VP_CORE_VSTEPMAX_OFFSET,
+   .vlimitto = OMAP4_PRM_VP_CORE_VLIMITTO_OFFSET,
+   .vstatus = OMAP4_PRM_VP_CORE_STATUS_OFFSET,
+   .voltage = OMAP4_PRM_VP_CORE_VOLTAGE_OFFSET,
+   },
+   .voltdm = {
+   

[PATCHv4 4/5] OMAP4: hwmod: Add inital data for smartreflex modules.

2010-12-10 Thread Thara Gopinath
From: Benoit Cousson 

This patch adds the hwmod details for OMAP4 smartreflex modules.

Signed-off-by: Benoit Cousson 
---
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c |  167 
 1 files changed, 167 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c 
b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index 7274db4..4445158 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -811,6 +811,169 @@ static struct omap_hwmod omap44xx_uart4_hwmod = {
.omap_chip  = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
+/*
+ * 'smartreflex' class
+ * smartreflex module (monitor silicon performance and outputs a measure of
+ * performance error)
+ */
+
+/* The IP is not compliant to type1 / type2 scheme */
+static struct omap_hwmod_sysc_fields omap_hwmod_sysc_type_smartreflex = {
+   .sidle_shift= 24,
+   .enwkup_shift   = 26,
+};
+
+static struct omap_hwmod_class_sysconfig omap44xx_smartreflex_sysc = {
+   .sysc_offs  = 0x0038,
+   .sysc_flags = (SYSC_HAS_ENAWAKEUP | SYSC_HAS_SIDLEMODE),
+   .idlemodes  = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
+   .sysc_fields= &omap_hwmod_sysc_type_smartreflex,
+};
+
+static struct omap_hwmod_class omap44xx_smartreflex_hwmod_class = {
+   .name = "smartreflex",
+   .sysc = &omap44xx_smartreflex_sysc,
+   .rev  = 2,
+};
+
+/* smartreflex_core */
+static struct omap_hwmod omap44xx_smartreflex_core_hwmod;
+static struct omap_hwmod_irq_info omap44xx_smartreflex_core_irqs[] = {
+   { .irq = 19 + OMAP44XX_IRQ_GIC_START },
+};
+
+static struct omap_hwmod_addr_space omap44xx_smartreflex_core_addrs[] = {
+   {
+   .pa_start   = 0x4a0dd000,
+   .pa_end = 0x4a0dd03f,
+   .flags  = ADDR_TYPE_RT
+   },
+};
+
+/* l4_cfg -> smartreflex_core */
+static struct omap_hwmod_ocp_if omap44xx_l4_cfg__smartreflex_core = {
+   .master = &omap44xx_l4_cfg_hwmod,
+   .slave  = &omap44xx_smartreflex_core_hwmod,
+   .clk= "l4_div_ck",
+   .addr   = omap44xx_smartreflex_core_addrs,
+   .addr_cnt   = ARRAY_SIZE(omap44xx_smartreflex_core_addrs),
+   .user   = OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+/* smartreflex_core slave ports */
+static struct omap_hwmod_ocp_if *omap44xx_smartreflex_core_slaves[] = {
+   &omap44xx_l4_cfg__smartreflex_core,
+};
+
+static struct omap_hwmod omap44xx_smartreflex_core_hwmod = {
+   .name   = "smartreflex_core",
+   .class  = &omap44xx_smartreflex_hwmod_class,
+   .mpu_irqs   = omap44xx_smartreflex_core_irqs,
+   .mpu_irqs_cnt   = ARRAY_SIZE(omap44xx_smartreflex_core_irqs),
+   .main_clk   = "smartreflex_core_fck",
+   .vdd_name   = "core",
+   .prcm = {
+   .omap4 = {
+   .clkctrl_reg = OMAP4430_CM_ALWON_SR_CORE_CLKCTRL,
+   },
+   },
+   .slaves = omap44xx_smartreflex_core_slaves,
+   .slaves_cnt = ARRAY_SIZE(omap44xx_smartreflex_core_slaves),
+   .omap_chip  = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
+};
+
+/* smartreflex_iva */
+static struct omap_hwmod omap44xx_smartreflex_iva_hwmod;
+static struct omap_hwmod_irq_info omap44xx_smartreflex_iva_irqs[] = {
+   { .irq = 102 + OMAP44XX_IRQ_GIC_START },
+};
+
+static struct omap_hwmod_addr_space omap44xx_smartreflex_iva_addrs[] = {
+   {
+   .pa_start   = 0x4a0db000,
+   .pa_end = 0x4a0db03f,
+   .flags  = ADDR_TYPE_RT
+   },
+};
+
+/* l4_cfg -> smartreflex_iva */
+static struct omap_hwmod_ocp_if omap44xx_l4_cfg__smartreflex_iva = {
+   .master = &omap44xx_l4_cfg_hwmod,
+   .slave  = &omap44xx_smartreflex_iva_hwmod,
+   .clk= "l4_div_ck",
+   .addr   = omap44xx_smartreflex_iva_addrs,
+   .addr_cnt   = ARRAY_SIZE(omap44xx_smartreflex_iva_addrs),
+   .user   = OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+/* smartreflex_iva slave ports */
+static struct omap_hwmod_ocp_if *omap44xx_smartreflex_iva_slaves[] = {
+   &omap44xx_l4_cfg__smartreflex_iva,
+};
+
+static struct omap_hwmod omap44xx_smartreflex_iva_hwmod = {
+   .name   = "smartreflex_iva",
+   .class  = &omap44xx_smartreflex_hwmod_class,
+   .mpu_irqs   = omap44xx_smartreflex_iva_irqs,
+   .mpu_irqs_cnt   = ARRAY_SIZE(omap44xx_smartreflex_iva_irqs),
+   .main_clk   = "smartreflex_iva_fck",
+   .vdd_name   = "iva",
+   .prcm = {
+   .omap4 = {
+   .clkctrl_reg = OMAP4430_CM_ALWON_SR_IVA_CLKCTRL,
+   },
+   },
+   .slaves = omap44xx_smartreflex_iva_slaves,
+   .slaves_cnt = ARRAY_SIZE(omap44xx_smartreflex_iva_slaves),
+   .omap_chip  = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
+};
+
+/* smartreflex_mpu 

[PATCHv4 1/5] OMAP4: Register voltage PMIC parameters with the voltage layer

2010-12-10 Thread Thara Gopinath
TWL6030 is the power IC used along with OMAP4 in OMAP4 SDPs,
blaze boards and panda boards. This patch registers the OMAP4
PMIC specific information with the voltage layer.
This also involves implementing a different formula for
voltage to vsel and vsel to voltage calculations from
TWL4030.

Signed-off-by: Thara Gopinath 
---
 arch/arm/mach-omap2/omap_twl.c |  166 
 arch/arm/mach-omap2/pm.c   |1 +
 arch/arm/mach-omap2/pm.h   |5 +
 3 files changed, 172 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_twl.c b/arch/arm/mach-omap2/omap_twl.c
index b8f0874..15f8c6c 100644
--- a/arch/arm/mach-omap2/omap_twl.c
+++ b/arch/arm/mach-omap2/omap_twl.c
@@ -16,6 +16,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -37,6 +38,28 @@
 #define OMAP3630_VP2_VLIMITTO_VDDMIN   0x18
 #define OMAP3630_VP2_VLIMITTO_VDDMAX   0x30
 
+#define OMAP4_SRI2C_SLAVE_ADDR 0x12
+#define OMAP4_VDD_MPU_SR_VOLT_REG  0x55
+#define OMAP4_VDD_IVA_SR_VOLT_REG  0x5B
+#define OMAP4_VDD_CORE_SR_VOLT_REG 0x61
+
+#define OMAP4_VP_CONFIG_ERROROFFSET0x00
+#define OMAP4_VP_VSTEPMIN_VSTEPMIN 0x01
+#define OMAP4_VP_VSTEPMAX_VSTEPMAX 0x04
+#define OMAP4_VP_VLIMITTO_TIMEOUT_US   200
+
+#define OMAP4_VP_MPU_VLIMITTO_VDDMIN   0xA
+#define OMAP4_VP_MPU_VLIMITTO_VDDMAX   0x39
+#define OMAP4_VP_IVA_VLIMITTO_VDDMIN   0xA
+#define OMAP4_VP_IVA_VLIMITTO_VDDMAX   0x2D
+#define OMAP4_VP_CORE_VLIMITTO_VDDMIN  0xA
+#define OMAP4_VP_CORE_VLIMITTO_VDDMAX  0x28
+
+static bool is_offset_valid;
+static u8 smps_offset;
+
+#define REG_SMPS_OFFSET 0xE0
+
 unsigned long twl4030_vsel_to_uv(const u8 vsel)
 {
return (((vsel * 125) + 6000)) * 100;
@@ -47,6 +70,70 @@ u8 twl4030_uv_to_vsel(unsigned long uv)
return DIV_ROUND_UP(uv - 60, 12500);
 }
 
+unsigned long twl6030_vsel_to_uv(const u8 vsel)
+{
+   /*
+* In TWL6030 depending on the value of SMPS_OFFSET
+* efuse register the voltage range supported in
+* standard mode can be either between 0.6V - 1.3V or
+* 0.7V - 1.4V. In TWL6030 ES1.0 SMPS_OFFSET efuse
+* is programmed to all 0's where as starting from
+* TWL6030 ES1.1 the efuse is programmed to 1
+*/
+   if (!is_offset_valid) {
+   twl_i2c_read_u8(TWL6030_MODULE_ID0, &smps_offset,
+   REG_SMPS_OFFSET);
+   is_offset_valid = true;
+   }
+
+   /*
+* There is no specific formula for voltage to vsel
+* conversion above 1.3V. There are special hardcoded
+* values for voltages above 1.3V. Currently we are
+* hardcoding only for 1.35 V which is used for 1GH OPP for
+* OMAP4430.
+*/
+   if (vsel == 0x3A)
+   return 135;
+
+   if (smps_offset & 0x8)
+   return vsel - 1) * 125) + 7000)) * 100;
+   else
+   return vsel - 1) * 125) + 6000)) * 100;
+}
+
+u8 twl6030_uv_to_vsel(unsigned long uv)
+{
+   /*
+* In TWL6030 depending on the value of SMPS_OFFSET
+* efuse register the voltage range supported in
+* standard mode can be either between 0.6V - 1.3V or
+* 0.7V - 1.4V. In TWL6030 ES1.0 SMPS_OFFSET efuse
+* is programmed to all 0's where as starting from
+* TWL6030 ES1.1 the efuse is programmed to 1
+*/
+   if (!is_offset_valid) {
+   twl_i2c_read_u8(TWL6030_MODULE_ID0, &smps_offset,
+   REG_SMPS_OFFSET);
+   is_offset_valid = true;
+   }
+
+   /*
+* There is no specific formula for voltage to vsel
+* conversion above 1.3V. There are special hardcoded
+* values for voltages above 1.3V. Currently we are
+* hardcoding only for 1.35 V which is used for 1GH OPP for
+* OMAP4430.
+*/
+   if (uv == 135)
+   return 0x3A;
+
+   if (smps_offset & 0x8)
+   return DIV_ROUND_UP(uv - 70, 12500) + 1;
+   else
+   return DIV_ROUND_UP(uv - 60, 12500) + 1;
+}
+
 static struct omap_volt_pmic_info omap3_mpu_volt_info = {
.slew_rate  = 4000,
.step_size  = 12500,
@@ -87,6 +174,85 @@ static struct omap_volt_pmic_info omap3_core_volt_info = {
.uv_to_vsel = twl4030_uv_to_vsel,
 };
 
+static struct omap_volt_pmic_info omap4_mpu_volt_info = {
+   .slew_rate  = 4000,
+   .step_size  = 12500,
+   .on_volt= 135,
+   .onlp_volt  = 135,
+   .ret_volt   = 837500,
+   .off_volt   = 60,
+   .volt_setup_time= 0,
+   .vp_erroroffset = OMAP4_VP_CONFIG_ERROROFFSET,
+   .vp_vstepmin= OMAP4_VP_VSTEPMIN_VSTEPMIN,
+   .vp_vstepmax= OMAP4_VP_VSTEPMAX_VSTEPMAX,
+   .vp_vddmin  = OMAP4_VP_MP

[PATCHv4 0/5] OMAP4: Smartreflex and Voltage layer support

2010-12-10 Thread Thara Gopinath
This patch series adds support for OMAP4 support in the
smartreflex and voltage layer. The series involves extensions
to voltage layer and smartreflex layer for supporting OMAP4.

This series in based against kernel.org  2.6.37-rc3 and is
dependent on the "OMAP3: Adding Smartreflex and Voltage driver support"
series.

All these patches are also available at
http://dev.omapzoom.org/?p=thara/omap-dvfs.git;a=summary
head: pm-sr

This patch series has been tested on OMAP4430 SDP with omap2plus_defconfig
with the following menuconfig options enabled
System type -> TI OMAP Implementations -> Smartreflex Support
System type -> TI OMAP Implementations ->
Class 3 mode of Smartreflex Implementation


Benoit Cousson (1):
  OMAP4: hwmod: Add inital data for smartreflex modules.

Thara Gopinath (4):
  OMAP4: Register voltage PMIC parameters with the voltage layer
  OMAP4: Adding voltage driver support
  OMAP4: PM: Program correct init voltages for scalable VDDs
  OMAP4: Smartreflex framework extensions

 arch/arm/mach-omap2/Makefile   |2 +-
 arch/arm/mach-omap2/control.h  |   12 ++
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c |  167 +++
 arch/arm/mach-omap2/omap_twl.c |  166 ++
 arch/arm/mach-omap2/pm.c   |   12 ++
 arch/arm/mach-omap2/pm.h   |5 +
 arch/arm/mach-omap2/smartreflex.c  |8 +-
 arch/arm/mach-omap2/sr_device.c|   17 ++-
 arch/arm/mach-omap2/voltage.c  |  249 
 arch/arm/plat-omap/Kconfig |2 +-
 arch/arm/plat-omap/include/plat/voltage.h  |   12 ++
 11 files changed, 647 insertions(+), 5 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


[PATCHv4 3/5] OMAP4: PM: Program correct init voltages for scalable VDDs

2010-12-10 Thread Thara Gopinath
By default the system boots up at nominal voltage for every
voltage domain in the system. This patch puts vdd_mpu, vdd_iva
and vdd_core to the correct boot up voltage as per the opp tables
specified. This patch implements this by matching the rate of
the main clock of the voltage domain with the opp table and
picking up the correct voltage.

Signed-off-by: Thara Gopinath 
---
 arch/arm/mach-omap2/pm.c |   11 +++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c
index 9727c02..7473aae 100644
--- a/arch/arm/mach-omap2/pm.c
+++ b/arch/arm/mach-omap2/pm.c
@@ -210,6 +210,16 @@ static void __init omap3_init_voltages(void)
omap2_set_init_voltage("core", "l3_ick", l3_dev);
 }
 
+static void __init omap4_init_voltages(void)
+{
+   if (!cpu_is_omap44xx())
+   return;
+
+   omap2_set_init_voltage("mpu", "dpll_mpu_ck", mpu_dev);
+   omap2_set_init_voltage("core", "l3_div_ck", l3_dev);
+   omap2_set_init_voltage("iva", "dpll_iva_m5x2_ck", iva_dev);
+}
+
 static int __init omap2_common_pm_init(void)
 {
omap2_init_processor_devices();
@@ -230,6 +240,7 @@ static int __init omap2_common_pm_late_init(void)
 
/* Initialize the voltages */
omap3_init_voltages();
+   omap4_init_voltages();
 
/* Smartreflex device init */
omap_devinit_smartreflex();
-- 
1.7.0.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


[PATCHv5 06/10] OMAP3: PM: Adding smartreflex class3 driver

2010-12-10 Thread Thara Gopinath
Smartreflex Class3 implementation continuously monitors
silicon performance  and instructs the Voltage Processors
to increase or decrease the voltage.
This patch adds smartreflex class 3 driver. This driver hooks
up with the generic smartreflex driver smartreflex.c to abstract
out class specific implementations out of the generic driver.

Class3 driver is chosen as the default class driver for smartreflex.
If any other class driver needs to be implemented, the init of that
driver should be called from the board file. That way the new class driver
will over-ride the Class3 driver.

Signed-off-by: Thara Gopinath 
---
 arch/arm/mach-omap2/Makefile |1 +
 arch/arm/mach-omap2/smartreflex-class3.c |   59 ++
 arch/arm/plat-omap/Kconfig   |9 +
 3 files changed, 69 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-omap2/smartreflex-class3.c

diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 07205db..ee53602 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -63,6 +63,7 @@ obj-$(CONFIG_ARCH_OMAP3)  += pm34xx.o sleep34xx.o 
voltage.o \
 obj-$(CONFIG_ARCH_OMAP4)   += pm44xx.o pm_bus.o
 obj-$(CONFIG_PM_DEBUG) += pm-debug.o
 obj-$(CONFIG_OMAP_SMARTREFLEX)  += sr_device.o smartreflex.o
+obj-$(CONFIG_OMAP_SMARTREFLEX_CLASS3)  += smartreflex-class3.o
 
 AFLAGS_sleep24xx.o :=-Wa,-march=armv6
 AFLAGS_sleep34xx.o :=-Wa,-march=armv7-a
diff --git a/arch/arm/mach-omap2/smartreflex-class3.c 
b/arch/arm/mach-omap2/smartreflex-class3.c
new file mode 100644
index 000..60e7055
--- /dev/null
+++ b/arch/arm/mach-omap2/smartreflex-class3.c
@@ -0,0 +1,59 @@
+/*
+ * Smart reflex Class 3 specific implementations
+ *
+ * Author: Thara Gopinath   
+ *
+ * Copyright (C) 2010 Texas Instruments, Inc.
+ * Thara Gopinath 
+ *
+ * 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.
+ */
+
+#include 
+
+static int sr_class3_enable(struct voltagedomain *voltdm)
+{
+   unsigned long volt = omap_voltage_get_nom_volt(voltdm);
+
+   if (!volt) {
+   pr_warning("%s: Curr voltage unknown. Cannot enable sr_%s\n",
+   __func__, voltdm->name);
+   return -ENODATA;
+   }
+
+   omap_vp_enable(voltdm);
+   return sr_enable(voltdm, volt);
+}
+
+static int sr_class3_disable(struct voltagedomain *voltdm, int is_volt_reset)
+{
+   omap_vp_disable(voltdm);
+   sr_disable(voltdm);
+   if (is_volt_reset)
+   omap_voltage_reset(voltdm);
+
+   return 0;
+}
+
+static int sr_class3_configure(struct voltagedomain *voltdm)
+{
+   return sr_configure_errgen(voltdm);
+}
+
+/* SR class3 structure */
+static struct omap_sr_class_data class3_data = {
+   .enable = sr_class3_enable,
+   .disable = sr_class3_disable,
+   .configure = sr_class3_configure,
+   .class_type = SR_CLASS3,
+};
+
+/* Smartreflex Class3 init API to be called from board file */
+static int __init sr_class3_init(void)
+{
+   pr_info("SmartReflex Class3 initialized\n");
+   return sr_register_class(&class3_data);
+}
+late_initcall(sr_class3_init);
diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig
index 95ceca0..4029e6a 100644
--- a/arch/arm/plat-omap/Kconfig
+++ b/arch/arm/plat-omap/Kconfig
@@ -57,6 +57,15 @@ config OMAP_SMARTREFLEX
  by default during system init via the enable_on_init flag
  which an be passed as platform data to the smartreflex driver.
 
+config OMAP_SMARTREFLEX_CLASS3
+   bool "Class 3 mode of Smartreflex Implementation"
+   depends on OMAP_SMARTREFLEX && TWL4030_CORE
+   help
+ Say Y to enable Class 3 implementation of Smartreflex
+
+ Class 3 implementation of Smartreflex employs continuous hardware
+ voltage calibration.
+
 config OMAP_RESET_CLOCKS
bool "Reset unused clocks during boot"
depends on ARCH_OMAP
-- 
1.7.0.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


[PATCHv5 04/10] OMAP3: PM: Adding smartreflex device file.

2010-12-10 Thread Thara Gopinath
This patch adds support for device registration of various
smartreflex module present in the system. This patch introduces
the platform data for smartreflex devices which include
the efused n-target vaules, a parameter to indicate
whether smartreflex autocompensation needs to be
enabled on init or not. An API
omap_enable_smartreflex_on_init is provided for the
board files to enable smartreflex autocompensation during
system boot up.

Signed-off-by: Thara Gopinath 
---
 arch/arm/mach-omap2/Makefile|2 +-
 arch/arm/mach-omap2/pm.c|3 +
 arch/arm/mach-omap2/pm.h|   12 
 arch/arm/mach-omap2/sr_device.c |  131 +++
 4 files changed, 147 insertions(+), 1 deletions(-)
 create mode 100644 arch/arm/mach-omap2/sr_device.c

diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index a14e98d..07205db 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -62,7 +62,7 @@ obj-$(CONFIG_ARCH_OMAP3)  += pm34xx.o sleep34xx.o 
voltage.o \
   cpuidle34xx.o pm_bus.o
 obj-$(CONFIG_ARCH_OMAP4)   += pm44xx.o pm_bus.o
 obj-$(CONFIG_PM_DEBUG) += pm-debug.o
-obj-$(CONFIG_OMAP_SMARTREFLEX)  += smartreflex.o
+obj-$(CONFIG_OMAP_SMARTREFLEX)  += sr_device.o smartreflex.o
 
 AFLAGS_sleep24xx.o :=-Wa,-march=armv6
 AFLAGS_sleep34xx.o :=-Wa,-march=armv7-a
diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c
index 1648a14..7c64533 100644
--- a/arch/arm/mach-omap2/pm.c
+++ b/arch/arm/mach-omap2/pm.c
@@ -22,6 +22,8 @@
 #include 
 #include 
 
+#include "pm.h"
+
 static struct omap_device_pm_latency *pm_lats;
 
 static struct device *mpu_dev;
@@ -149,6 +151,7 @@ postcore_initcall(omap2_common_pm_init);
 static int __init omap2_common_pm_late_init(void)
 {
omap_voltage_late_init();
+   omap_devinit_smartreflex();
 
return 0;
 }
diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h
index a43e069..b19d46e 100644
--- a/arch/arm/mach-omap2/pm.h
+++ b/arch/arm/mach-omap2/pm.h
@@ -11,6 +11,7 @@
 #ifndef __ARCH_ARM_MACH_OMAP2_PM_H
 #define __ARCH_ARM_MACH_OMAP2_PM_H
 
+#include 
 #include 
 
 extern void *omap3_secure_ram_storage;
@@ -99,4 +100,15 @@ extern unsigned int save_secure_ram_context_sz;
 extern unsigned int omap24xx_cpu_suspend_sz;
 extern unsigned int omap34xx_cpu_suspend_sz;
 
+#ifdef CONFIG_OMAP_SMARTREFLEX
+extern int omap_devinit_smartreflex(void);
+extern void omap_enable_smartreflex_on_init(void);
+#else
+static inline int omap_devinit_smartreflex(void)
+{
+   return -EINVAL;
+}
+
+static inline void omap_enable_smartreflex_on_init(void) {}
+#endif
 #endif
diff --git a/arch/arm/mach-omap2/sr_device.c b/arch/arm/mach-omap2/sr_device.c
new file mode 100644
index 000..9a3538f
--- /dev/null
+++ b/arch/arm/mach-omap2/sr_device.c
@@ -0,0 +1,131 @@
+/*
+ * OMAP3/OMAP4 smartreflex device file
+ *
+ * Author: Thara Gopinath  
+ *
+ * Based originally on code from smartreflex.c
+ * Copyright (C) 2010 Texas Instruments, Inc.
+ * Thara Gopinath 
+ *
+ * Copyright (C) 2008 Nokia Corporation
+ * Kalle Jokiniemi
+ *
+ * Copyright (C) 2007 Texas Instruments, Inc.
+ * Lesly A M 
+ *
+ * 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.
+ */
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include "control.h"
+
+static bool sr_enable_on_init;
+
+static struct omap_device_pm_latency omap_sr_latency[] = {
+   {
+   .deactivate_func = omap_device_idle_hwmods,
+   .activate_func   = omap_device_enable_hwmods,
+   .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST
+   },
+};
+
+/* 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)
+{
+   struct omap_sr_nvalue_table *nvalue_table;
+   int i, count = 0;
+
+   while (volt_data[count].volt_nominal)
+   count++;
+
+   nvalue_table = kzalloc(sizeof(struct omap_sr_nvalue_table)*count,
+   GFP_KERNEL);
+
+   for (i = 0; i < count; i++) {
+   u32 v = omap_ctrl_readl(volt_data[i].sr_efuse_offs);
+
+   nvalue_table[i].efuse_offs = volt_data[i].sr_efuse_offs;
+   nvalue_table[i].nvalue = v;
+   }
+
+   sr_data->nvalue_table = nvalue_table;
+   sr_data->nvalue_count = count;
+}
+
+static int sr_dev_init(struct omap_hwmod *oh, void *user)
+{
+   struct omap_sr_data *sr_data;
+   struct omap_device *od;
+   struct omap_volt_data *volt_data;
+   char *name = "smartreflex";
+   static int i;
+
+   sr_data = kzalloc(sizeof(struct omap_sr_data), GFP_KERNEL);
+   if (!sr_data) {
+  

[PATCHv5 07/10] OMAP3: PM: Adding T2 enabling of smartreflex support

2010-12-10 Thread Thara Gopinath
This patch adds support in the twl4030 driver to enable smartreflex.
The smartreflex bit on twl4030 needs to be enabled by default irrespective
of whether smartreflex module is enabled on the OMAP side or not.
This is because without this bit enabled the voltage scaling through
vp forceupdate does not function properly.

Signed-off-by: Thara Gopinath 
---
 drivers/mfd/twl-core.c  |   13 +
 include/linux/i2c/twl.h |   11 +++
 2 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c
index 35275ba..b895ceb 100644
--- a/drivers/mfd/twl-core.c
+++ b/drivers/mfd/twl-core.c
@@ -1046,6 +1046,7 @@ twl_probe(struct i2c_client *client, const struct 
i2c_device_id *id)
/* Disable TWL4030/TWL5030 I2C Pull-up on I2C1 and I2C4(SR) interface.
 * Program I2C_SCL_CTRL_PU(bit 0)=0, I2C_SDA_CTRL_PU (bit 2)=0,
 * SR_I2C_SCL_CTRL_PU(bit 4)=0 and SR_I2C_SDA_CTRL_PU(bit 6)=0.
+* Also enable the smartreflex I2S bit.
 */
 
if (twl_class_is_4030()) {
@@ -1053,6 +1054,18 @@ twl_probe(struct i2c_client *client, const struct 
i2c_device_id *id)
temp &= ~(SR_I2C_SDA_CTRL_PU | SR_I2C_SCL_CTRL_PU | \
I2C_SDA_CTRL_PU | I2C_SCL_CTRL_PU);
twl_i2c_write_u8(TWL4030_MODULE_INTBR, temp, REG_GPPUPDCTR1);
+
+   /* The smartreflex bit on twl4030 needs to be enabled by
+* default irrespective of whether smartreflex module is
+* enabled on the OMAP side or not. This is because without
+* this bit enabled the voltage scaling through
+* vp forceupdate does not function properly.
+*/
+   twl_i2c_read_u8(TWL4030_MODULE_PM_RECEIVER, &temp,
+   TWL4030_PM_RECEIVER_DCDC_GLOBAL_CFG);
+   temp |= SMARTREFLEX_ENABLE;
+   twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, temp,
+   TWL4030_PM_RECEIVER_DCDC_GLOBAL_CFG);
}
 
status = add_children(pdata, id->driver_data);
diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
index c760991..d392f06 100644
--- a/include/linux/i2c/twl.h
+++ b/include/linux/i2c/twl.h
@@ -434,6 +434,17 @@ static inline int twl6030_mmc_card_detect(struct device 
*dev, int slot)
 
 /*--*/
 
+/*
+ * PM Receiver module register offsets (use TWL4030_MODULE_PM_RECEIVER)
+ */
+
+#define TWL4030_PM_RECEIVER_DCDC_GLOBAL_CFG0x06
+
+/* Smartreflex I2S bus enable/ vmode enable bit */
+#define SMARTREFLEX_ENABLE BIT(3)
+
+/*--*/
+
 /* Power bus message definitions */
 
 /* The TWL4030/5030 splits its power-management resources (the various
-- 
1.7.0.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


[PATCHv5 08/10] OMAP3: PM: Register TWL4030 pmic info with the voltage driver.

2010-12-10 Thread Thara Gopinath
This patch registers the TWL4030 PMIC specific informtion
with the voltage driver. Failing this patch the voltage driver
is unware of the formula to use for vsel to voltage and vice versa
conversion and lot of other PMIC dependent parameters.

This file is based on the arch/arm/plat-omap opp_twl_tpl.c file
by Paul Walmsley. The original file is replaced by this file.

Signed-off-by: Thara Gopinath 
---
There was a review comment on v4 of this patch to remove such
a file all-together and move the code to drivers/mfd/twl-core.c.
But the number of voltage parameters to be passed from PMIC side
for each vdd is huge and drivers/mfd/twl-core.c looked ugly
with all these code and #ifdefs for OMAP.

 arch/arm/mach-omap2/Makefile   |2 +
 arch/arm/mach-omap2/omap_twl.c |  111 
 arch/arm/mach-omap2/pm.c   |4 ++
 arch/arm/mach-omap2/pm.h   |   10 
 4 files changed, 127 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-omap2/omap_twl.c

diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index ee53602..59585d9 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -20,6 +20,8 @@ obj-$(CONFIG_ARCH_OMAP4) += $(prcm-common) prm44xx.o 
$(hwmod-common)
 
 obj-$(CONFIG_OMAP_MCBSP) += mcbsp.o
 
+obj-$(CONFIG_TWL4030_CORE) += omap_twl.o
+
 # SMP support ONLY available for OMAP4
 obj-$(CONFIG_SMP)  += omap-smp.o omap-headsmp.o
 obj-$(CONFIG_LOCAL_TIMERS) += timer-mpu.o
diff --git a/arch/arm/mach-omap2/omap_twl.c b/arch/arm/mach-omap2/omap_twl.c
new file mode 100644
index 000..b8f0874
--- /dev/null
+++ b/arch/arm/mach-omap2/omap_twl.c
@@ -0,0 +1,111 @@
+/**
+ * OMAP and TWL PMIC specific intializations.
+ *
+ * Copyright (C) 2010 Texas Instruments Incorporated.
+ * Thara Gopinath
+ * Copyright (C) 2009 Texas Instruments Incorporated.
+ * Nishanth Menon
+ * Copyright (C) 2009 Nokia Corporation
+ * Paul Walmsley
+ *
+ * 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.
+ */
+
+#include 
+#include 
+#include 
+
+#include 
+
+#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_VP1_VLIMITTO_VDDMIN   0x14
+#define OMAP3430_VP1_VLIMITTO_VDDMAX   0x42
+#define OMAP3430_VP2_VLIMITTO_VDDMIN   0x18
+#define OMAP3430_VP2_VLIMITTO_VDDMAX   0x2c
+
+#define OMAP3630_VP1_VLIMITTO_VDDMIN   0x18
+#define OMAP3630_VP1_VLIMITTO_VDDMAX   0x3c
+#define OMAP3630_VP2_VLIMITTO_VDDMIN   0x18
+#define OMAP3630_VP2_VLIMITTO_VDDMAX   0x30
+
+unsigned long twl4030_vsel_to_uv(const u8 vsel)
+{
+   return (((vsel * 125) + 6000)) * 100;
+}
+
+u8 twl4030_uv_to_vsel(unsigned long uv)
+{
+   return DIV_ROUND_UP(uv - 60, 12500);
+}
+
+static struct omap_volt_pmic_info omap3_mpu_volt_info = {
+   .slew_rate  = 4000,
+   .step_size  = 12500,
+   .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_VP1_VLIMITTO_VDDMIN,
+   .vp_vddmax  = OMAP3430_VP1_VLIMITTO_VDDMAX,
+   .vp_timeout_us  = OMAP3_VP_VLIMITTO_TIMEOUT_US,
+   .i2c_slave_addr = OMAP3_SRI2C_SLAVE_ADDR,
+   .pmic_reg   = OMAP3_VDD_MPU_SR_CONTROL_REG,
+   .vsel_to_uv = twl4030_vsel_to_uv,
+   .uv_to_vsel = twl4030_uv_to_vsel,
+};
+
+static struct omap_volt_pmic_info omap3_core_volt_info = {
+   .slew_rate  = 4000,
+   .step_size  = 12500,
+   .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 = twl4030_vsel_to_uv,
+   .uv_to_vsel  

[PATCHv5 01/10] OMAP3: PM: Adding voltage driver support.

2010-12-10 Thread Thara Gopinath
This patch adds voltage driver support for OMAP3. The driver
allows  configuring the voltage controller and voltage
processors during init and exports APIs to enable/disable
voltage processors, scale voltage and reset voltage.
The driver maintains the global voltage table on a per
VDD basis which contains the various voltages supported by the
VDD along with per voltage dependent data like smartreflex
efuse offset, errminlimit and voltage processor errorgain.
The driver also allows the voltage parameters dependent on the
PMIC to be passed from the PMIC file through an API.
The driver allows scaling of VDD voltages either through
"vc bypass method" or through "vp forceupdate method" the
choice being configurable through the board file.

This patch contains code originally in linux omap pm branch
smartreflex driver.  Major contributors to this driver are
Lesly A M, Rajendra Nayak, Kalle Jokiniemi, Paul Walmsley,
Nishant Menon, Kevin Hilman. The separation of PMIC parameters
into a separate structure which can be populated from
the PMIC file is based on the work of Lun Chang from Motorola
in an internal tree.

Signed-off-by: Thara Gopinath 
---
This patch has 14 checkpatch.pl above 80-chars warnings for
the definitions of omap34xx_vddmpu_volt_data, omap36xx_vddmpu_volt_data,
omap34xx_vddcore_volt_data and omap36xx_vddcore_volt_data structures.
IMHO splitting of the entries in these structures affects
readability and looks very ugly. Hence they are left as is.

 arch/arm/mach-omap2/Makefile  |3 +-
 arch/arm/mach-omap2/control.h |   17 +
 arch/arm/mach-omap2/pm.c  |8 +
 arch/arm/mach-omap2/voltage.c | 1176 +
 arch/arm/plat-omap/include/plat/voltage.h |  134 
 5 files changed, 1337 insertions(+), 1 deletions(-)
 create mode 100644 arch/arm/mach-omap2/voltage.c
 create mode 100644 arch/arm/plat-omap/include/plat/voltage.h

diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index ea217f5..8559f87 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -58,7 +58,8 @@ endif
 ifeq ($(CONFIG_PM),y)
 obj-$(CONFIG_ARCH_OMAP2)   += pm24xx.o
 obj-$(CONFIG_ARCH_OMAP2)   += sleep24xx.o pm_bus.o
-obj-$(CONFIG_ARCH_OMAP3)   += pm34xx.o sleep34xx.o cpuidle34xx.o 
pm_bus.o
+obj-$(CONFIG_ARCH_OMAP3)   += pm34xx.o sleep34xx.o voltage.o \
+  cpuidle34xx.o pm_bus.o
 obj-$(CONFIG_ARCH_OMAP4)   += pm44xx.o pm_bus.o
 obj-$(CONFIG_PM_DEBUG) += pm-debug.o
 
diff --git a/arch/arm/mach-omap2/control.h b/arch/arm/mach-omap2/control.h
index b6c6b7c..fef6bcc 100644
--- a/arch/arm/mach-omap2/control.h
+++ b/arch/arm/mach-omap2/control.h
@@ -148,6 +148,15 @@
 #define OMAP343X_CONTROL_TEST_KEY_11   (OMAP2_CONTROL_GENERAL + 0x00f4)
 #define OMAP343X_CONTROL_TEST_KEY_12   (OMAP2_CONTROL_GENERAL + 0x00f8)
 #define OMAP343X_CONTROL_TEST_KEY_13   (OMAP2_CONTROL_GENERAL + 0x00fc)
+#define OMAP343X_CONTROL_FUSE_OPP1_VDD1 (OMAP2_CONTROL_GENERAL + 0x0110)
+#define OMAP343X_CONTROL_FUSE_OPP2_VDD1 (OMAP2_CONTROL_GENERAL + 0x0114)
+#define OMAP343X_CONTROL_FUSE_OPP3_VDD1 (OMAP2_CONTROL_GENERAL + 0x0118)
+#define OMAP343X_CONTROL_FUSE_OPP4_VDD1 (OMAP2_CONTROL_GENERAL + 0x011c)
+#define OMAP343X_CONTROL_FUSE_OPP5_VDD1 (OMAP2_CONTROL_GENERAL + 0x0120)
+#define OMAP343X_CONTROL_FUSE_OPP1_VDD2 (OMAP2_CONTROL_GENERAL + 0x0124)
+#define OMAP343X_CONTROL_FUSE_OPP2_VDD2 (OMAP2_CONTROL_GENERAL + 0x0128)
+#define OMAP343X_CONTROL_FUSE_OPP3_VDD2 (OMAP2_CONTROL_GENERAL + 0x012c)
+#define OMAP343X_CONTROL_FUSE_SR(OMAP2_CONTROL_GENERAL + 0x0130)
 #define OMAP343X_CONTROL_IVA2_BOOTADDR (OMAP2_CONTROL_GENERAL + 0x0190)
 #define OMAP343X_CONTROL_IVA2_BOOTMOD  (OMAP2_CONTROL_GENERAL + 0x0194)
 #define OMAP343X_CONTROL_DEBOBS(i) (OMAP2_CONTROL_GENERAL + 0x01B0 \
@@ -164,6 +173,14 @@
 #define OMAP343X_CONTROL_SRAMLDO5  (OMAP2_CONTROL_GENERAL + 0x02C0)
 #define OMAP343X_CONTROL_CSI   (OMAP2_CONTROL_GENERAL + 0x02C4)
 
+/* OMAP3630 only CONTROL_GENERAL register offsets */
+#define OMAP3630_CONTROL_FUSE_OPP1G_VDD1(OMAP2_CONTROL_GENERAL + 
0x0110)
+#define OMAP3630_CONTROL_FUSE_OPP50_VDD1(OMAP2_CONTROL_GENERAL + 
0x0114)
+#define OMAP3630_CONTROL_FUSE_OPP100_VDD1   (OMAP2_CONTROL_GENERAL + 
0x0118)
+#define OMAP3630_CONTROL_FUSE_OPP120_VDD1   (OMAP2_CONTROL_GENERAL + 
0x0120)
+#define OMAP3630_CONTROL_FUSE_OPP50_VDD2(OMAP2_CONTROL_GENERAL + 
0x0128)
+#define OMAP3630_CONTROL_FUSE_OPP100_VDD2   (OMAP2_CONTROL_GENERAL + 
0x012C)
+
 /* AM35XX only CONTROL_GENERAL register offsets */
 #define AM35XX_CONTROL_MSUSPENDMUX_6(OMAP2_CONTROL_GENERAL + 0x0038)
 #define AM35XX_CONTROL_DEVCONF2 (OMAP2_CONTROL_GENERAL + 0x0310)
diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c
index 6ec2ee1..1648a14 100644
--- a/arch/arm/mach-omap2/pm.c
+++ b/arch/arm/mach-omap2

[PATCHv5 03/10] OMAP3: PM: Adding smartreflex driver support.

2010-12-10 Thread Thara Gopinath
SmartReflex modules do adaptive voltage control for real-time
voltage adjustments. With Smartreflex the power supply voltage
can be adapted to the silicon performance(manufacturing process,
temperature induced performance, age induced performance etc).

There are differnet classes of smartreflex implementation.
Class-0: Manufacturing Test Calibration
Class-1: Boot-Time Software Calibration
Class-2: Continuous Software Calibration
Class-3: Continuous Hardware Calibration
Class-4: Fully Integrated Power Management

OMAP3 has two smartreflex modules one associated with VDD MPU and the
other associated with VDD CORE.
This patch adds support for  smartreflex driver. The driver is designed
for Class-1 , Class-2 and Class-3 support and is  a platform driver.
Smartreflex driver can be enabled through a Kconfig option
"SmartReflex support" under "System type"->"TI OMAP implementations" menu.

Smartreflex autocompensation feature can be enabled runtime through
a debug fs option.
To enable smartreflex autocompensation feature
echo 1 > /debug/voltage/vdd_/smartreflex/autocomp
To disable smartreflex autocompensation feature
echo 0 > /debug/voltage/vdd_/smartreflex/autocomp

where X can be mpu, core , iva etc.

This patch contains code originally in linux omap pm branch.
Major contributors to this driver are
Lesly A M, Rajendra Nayak, Kalle Jokiniemi, Paul Walmsley,
Nishant Menon, Kevin Hilman.

Signed-off-by: Thara Gopinath 
---
 arch/arm/mach-omap2/Makefile  |1 +
 arch/arm/mach-omap2/smartreflex.c |  983 +
 arch/arm/plat-omap/Kconfig|   22 +
 arch/arm/plat-omap/include/plat/smartreflex.h |  245 ++
 4 files changed, 1251 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-omap2/smartreflex.c
 create mode 100644 arch/arm/plat-omap/include/plat/smartreflex.h

diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 8559f87..a14e98d 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -62,6 +62,7 @@ obj-$(CONFIG_ARCH_OMAP3)  += pm34xx.o sleep34xx.o 
voltage.o \
   cpuidle34xx.o pm_bus.o
 obj-$(CONFIG_ARCH_OMAP4)   += pm44xx.o pm_bus.o
 obj-$(CONFIG_PM_DEBUG) += pm-debug.o
+obj-$(CONFIG_OMAP_SMARTREFLEX)  += smartreflex.o
 
 AFLAGS_sleep24xx.o :=-Wa,-march=armv6
 AFLAGS_sleep34xx.o :=-Wa,-march=armv7-a
diff --git a/arch/arm/mach-omap2/smartreflex.c 
b/arch/arm/mach-omap2/smartreflex.c
new file mode 100644
index 000..eee23d0
--- /dev/null
+++ b/arch/arm/mach-omap2/smartreflex.c
@@ -0,0 +1,983 @@
+/*
+ * OMAP SmartReflex Voltage Control
+ *
+ * Author: Thara Gopinath  
+ *
+ * Copyright (C) 2010 Texas Instruments, Inc.
+ * Thara Gopinath 
+ *
+ * Copyright (C) 2008 Nokia Corporation
+ * Kalle Jokiniemi
+ *
+ * Copyright (C) 2007 Texas Instruments, Inc.
+ * Lesly A M 
+ *
+ * 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.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include "pm.h"
+
+#define SMARTREFLEX_NAME_LEN   16
+#define SR_DISABLE_TIMEOUT 200
+
+struct omap_sr {
+   int srid;
+   int ip_type;
+   int nvalue_count;
+   boolautocomp_active;
+   u32 clk_length;
+   u32 err_weight;
+   u32 err_minlimit;
+   u32 err_maxlimit;
+   u32 accum_data;
+   u32 senn_avgweight;
+   u32 senp_avgweight;
+   u32 senp_mod;
+   u32 senn_mod;
+   unsigned intirq;
+   void __iomem*base;
+   struct platform_device  *pdev;
+   struct list_headnode;
+   struct omap_sr_nvalue_table *nvalue_table;
+   struct voltagedomain*voltdm;
+};
+
+/* sr_list contains all the instances of smartreflex module */
+static LIST_HEAD(sr_list);
+
+static struct omap_sr_class_data *sr_class;
+static struct omap_sr_pmic_data *sr_pmic_data;
+
+static inline void sr_write_reg(struct omap_sr *sr, unsigned offset, u32 value)
+{
+   __raw_writel(value, (sr->base + offset));
+}
+
+static inline void sr_modify_reg(struct omap_sr *sr, unsigned offset, u32 mask,
+   u32 value)
+{
+   u32 reg_val;
+   u32 errconfig_offs = 0, errconfig_mask = 0;
+
+   reg_val = __raw_readl(sr->base +

[PATCHv5 10/10] OMAP3: PM: Program correct init voltages for VDD1 and VDD2

2010-12-10 Thread Thara Gopinath
By default the system boots up at nominal voltage for every
voltage domain in the system. This patch puts VDD1 and VDD2
to the correct boot up voltage as per the opp tables specified.
This patch implements this by matching the rate of the main clock
of the voltage domain with the opp table and picking up the correct
voltage.

Signed-off-by: Thara Gopinath 
---
 arch/arm/mach-omap2/pm.c |   76 ++
 1 files changed, 76 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c
index 6c161a3..819cf42 100644
--- a/arch/arm/mach-omap2/pm.c
+++ b/arch/arm/mach-omap2/pm.c
@@ -13,6 +13,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -139,6 +140,76 @@ err:
return ret;
 }
 
+/*
+ * This API is to be called during init to put the various voltage
+ * domains to the voltage as per the opp table. Typically we boot up
+ * at the nominal voltage. So this function finds out the rate of
+ * the clock associated with the voltage domain, finds out the correct
+ * opp entry and puts the voltage domain to the voltage specifies
+ * in the opp entry
+ */
+static int __init omap2_set_init_voltage(char *vdd_name, char *clk_name,
+   struct device *dev)
+{
+   struct voltagedomain *voltdm;
+   struct clk *clk;
+   struct opp *opp;
+   unsigned long freq, bootup_volt;
+
+   if (!vdd_name || !clk_name || !dev) {
+   printk(KERN_ERR "%s: Invalid parameters!\n", __func__);
+   goto exit;
+   }
+
+   voltdm = omap_voltage_domain_lookup(vdd_name);
+   if (IS_ERR(voltdm)) {
+   printk(KERN_ERR "%s: Unable to get vdd pointer for vdd_%s\n",
+   __func__, vdd_name);
+   goto exit;
+   }
+
+   clk =  clk_get(NULL, clk_name);
+   if (IS_ERR(clk)) {
+   printk(KERN_ERR "%s: unable to get clk %s\n",
+   __func__, clk_name);
+   goto exit;
+   }
+
+   freq = clk->rate;
+   clk_put(clk);
+
+   opp = opp_find_freq_ceil(dev, &freq);
+   if (IS_ERR(opp)) {
+   printk(KERN_ERR "%s: unable to find boot up OPP for vdd_%s\n",
+   __func__, vdd_name);
+   goto exit;
+   }
+
+   bootup_volt = opp_get_voltage(opp);
+   if (!bootup_volt) {
+   printk(KERN_ERR "%s: unable to find voltage corresponding"
+   "to the bootup OPP for vdd_%s\n", __func__, vdd_name);
+   goto exit;
+   }
+
+   omap_voltage_scale_vdd(voltdm, bootup_volt);
+   return 0;
+
+exit:
+   printk(KERN_ERR "%s: Unable to put vdd_%s to its init voltage\n\n",
+   __func__, vdd_name);
+   return -EINVAL;
+}
+
+static void __init omap3_init_voltages(void)
+{
+   if (!cpu_is_omap34xx())
+   return;
+
+   omap2_set_init_voltage("mpu", "dpll1_ck", mpu_dev);
+   omap2_set_init_voltage("core", "l3_ick", l3_dev);
+}
+
 static int __init omap2_common_pm_init(void)
 {
omap2_init_processor_devices();
@@ -152,8 +223,13 @@ static int __init omap2_common_pm_late_init(void)
 {
/* Init the OMAP TWL parameters */
omap3_twl_init();
+
/* Init the voltage layer */
omap_voltage_late_init();
+
+   /* Initialize the voltages */
+   omap3_init_voltages();
+
/* Smartreflex device init */
omap_devinit_smartreflex();
 
-- 
1.7.0.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


[PATCHv5 09/10] OMAP3: PM: Adding debug support to Voltage and Smartreflex drivers

2010-12-10 Thread Thara Gopinath
This patch adds debug support to the voltage and smartreflex drivers.
This means a whole bunch of voltage processor and smartreflex
parameters are now visible through the pm debugfs.
The voltage parameters can be viewed at
/debug/voltage/vdd_/
and the smartreflex parameters can be viewed at
/debug/voltage/vdd_/smartreflex/

Also smartreflex n-target values are now exposed out at
/debug/voltage/vdd_/smartreflex/nvalue/

This is a read-write interface which means user has the
flexibility to change the n-target values for any opp.

Signed-off-by: Thara Gopinath 
---
 arch/arm/mach-omap2/smartreflex.c |   46 -
 arch/arm/mach-omap2/voltage.c |   66 +
 2 files changed, 110 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/smartreflex.c 
b/arch/arm/mach-omap2/smartreflex.c
index eee23d0..52a05b3 100644
--- a/arch/arm/mach-omap2/smartreflex.c
+++ b/arch/arm/mach-omap2/smartreflex.c
@@ -31,6 +31,7 @@
 #include "pm.h"
 
 #define SMARTREFLEX_NAME_LEN   16
+#define NVALUE_NAME_LEN40
 #define SR_DISABLE_TIMEOUT 200
 
 struct omap_sr {
@@ -817,8 +818,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;
-   struct dentry *vdd_dbg_dir, *dbg_dir;
-   int ret = 0;
+   struct dentry *vdd_dbg_dir, *dbg_dir, *nvalue_dir;
+   struct omap_volt_data *volt_data;
+   int i, ret = 0;
 
if (!sr_info) {
dev_err(&pdev->dev, "%s: unable to allocate sr_info\n",
@@ -897,6 +899,46 @@ static int __init omap_sr_probe(struct platform_device 
*pdev)
 
(void) debugfs_create_file("autocomp", S_IRUGO | S_IWUGO, dbg_dir,
(void *)sr_info, &pm_sr_fops);
+   (void) debugfs_create_x32("errweight", S_IRUGO, dbg_dir,
+   &sr_info->err_weight);
+   (void) debugfs_create_x32("errmaxlimit", S_IRUGO, dbg_dir,
+   &sr_info->err_maxlimit);
+   (void) debugfs_create_x32("errminlimit", S_IRUGO, dbg_dir,
+   &sr_info->err_minlimit);
+
+   nvalue_dir = debugfs_create_dir("nvalue", dbg_dir);
+   if (IS_ERR(nvalue_dir)) {
+   dev_err(&pdev->dev, "%s: Unable to create debugfs directory"
+   "for n-values\n", __func__);
+   return PTR_ERR(nvalue_dir);
+   }
+
+   omap_voltage_get_volttable(sr_info->voltdm, &volt_data);
+   if (!volt_data) {
+   dev_warn(&pdev->dev, "%s: No Voltage table for the"
+   " corresponding vdd vdd_%s. Cannot create debugfs"
+   "entries for n-values\n",
+   __func__, sr_info->voltdm->name);
+   return -ENODATA;
+   }
+
+   for (i = 0; i < sr_info->nvalue_count; i++) {
+   char *name;
+   char volt_name[32];
+
+   name = kzalloc(NVALUE_NAME_LEN + 1, GFP_KERNEL);
+   if (!name) {
+   dev_err(&pdev->dev, "%s: Unable to allocate memory"
+   " for n-value directory name\n",  __func__);
+   return -ENOMEM;
+   }
+
+   strcpy(name, "volt_");
+   sprintf(volt_name, "%d", volt_data[i].volt_nominal);
+   strcat(name, volt_name);
+   (void) debugfs_create_x32(name, S_IRUGO | S_IWUGO, nvalue_dir,
+   &(sr_info->nvalue_table[i].nvalue));
+   }
 
return ret;
 
diff --git a/arch/arm/mach-omap2/voltage.c b/arch/arm/mach-omap2/voltage.c
index 4ecdc68..1f84939 100644
--- a/arch/arm/mach-omap2/voltage.c
+++ b/arch/arm/mach-omap2/voltage.c
@@ -238,6 +238,47 @@ static struct dentry *voltage_dir;
 static void (*vc_init) (struct omap_vdd_info *vdd);
 static void (*vdd_data_configure) (struct omap_vdd_info *vdd);
 
+/* Voltage debugfs support */
+static int vp_volt_debug_get(void *data, u64 *val)
+{
+   struct omap_vdd_info *vdd = (struct omap_vdd_info *) data;
+   u8 vsel;
+
+   if (!vdd) {
+   pr_warning("Wrong paramater passed\n");
+   return -EINVAL;
+   }
+
+   vsel = prm_read_mod_reg(vdd->vp_reg.prm_mod, vdd->vp_offs.voltage);
+   pr_notice("curr_vsel = %x\n", vsel);
+
+   if (!vdd->pmic_info->vsel_to_uv) {
+   pr_warning("PMIC function to convert vsel to voltage"
+   "in uV not registerd\n");
+   return -EINVAL;
+   }
+
+   *val = vdd->pmic_info->vsel_to_uv(vsel);
+   return 0;
+}
+
+static int nom_volt_debug_get(void *data, u64 *val)
+{
+   struct omap_vdd_info *vdd = (struct omap_vdd_info *) data;
+
+   if (!vdd) {
+   pr_warning("Wrong paramater passed\n");
+   return -EINVAL;
+   }
+
+  

[PATCHv5 00/10] OMAP: Adding Smartreflex and Voltage driver support

2010-12-10 Thread Thara Gopinath
This patch series introduces smartreflex and voltage driver support
for OMAP3430 and OMAP3630. SmartReflex modules do adaptive voltage
control for real-time voltage adjustments.

Originally all the functionalities introduced in this patch
were present in arch/arm/mach-omap2/smartreflex.c file in Kevin's
pm tree. This patch series does a major rewrite of this file
and introduces a separate voltage driver. Major contributors
to the original driver are

Eduardo Valentin (1):
  OMAP3: PM: SmartReflex: Fix scheduled while atomic problem

Kalle Jokiniemi (1):
  OMAP3: PM: SmartReflex driver integration

Kevin Hilman (2):
  temp: SR: IO_ADDRESS conversion
  OMAP: SR: OPP interfaces removed from OMAP PM layer

Nishanth Menon (1):
  omap3: pm: sr: replace get_opp with freq_to_opp

Paul Walmsley (2):
  OMAP SR: use opp_find_opp_by_opp_id()
  OMAP SR: use OPP API for OPP ID, remove direct access

Phil Carmody (2):
  OMAP3: PM: Don't do unnecessary searches in omap_sr_vdd*_autocomp_store
  OMAP3: PM: Early exit on invalid parameters

Rajendra Nayak (9):
  OMAP3: SR: Fix init voltage on OPP change
  OMAP3: SR: Update VDD1/2 voltages at boot
  OMAP3: SR: Use sysclk for SR CLKLENGTH calc
  OMAP3: SR: Reset voltage level on SR disable
  OMAP3: SR: Replace printk's with pr_* calls
  OMAP3: SR: Remove redundant defines
  OMAP3: SR: Fix SR driver to check for omap-pm return values
  OMAP3: PM: Put optimal SMPS stabilization delay
  OMAP3: SR: Wait for VP idle before a VP disable

Roger Quadros (4):
  OMAP3: PM: Fix Smartreflex when used with PM_NOOP layer
  OMAP3: PM: Make Smartreflex driver independent of SRF
  OMAP3: PM: Do not Enable SmartReflex if OPP tables not defined
  OMAP3: PM: Smartreflex: Fix VDD2 OPP determining logic

Romit Dasgupta (1):
  omap: pm: SR: use enum for OPP types

Teerth Reddy (1):
  OMAP3: SR: Replace SR_PASS/FAIL,SR_TRUE/FALSE

Tero Kristo (1):
  Smartreflex: Avoid unnecessary spam

This patch series is against kernel.org 2.6.37-rc3  with the following
additional patches applied in the below mentioned order.
https://patchwork.kernel.org/patch/394802/
https://patchwork.kernel.org/patch/394792/
https://patchwork.kernel.org/patch/394782/
https://patchwork.kernel.org/patch/396612/
https://patchwork.kernel.org/patch/370931/

The entire series with the dependencies are available at
http://dev.omapzoom.org/?p=thara/omap-dvfs.git;a=summary
head: pm-sr

This patch series has been tested on OMAP3430 SDP with omap2plus_defconfig
with the following menuconfig options enabled.
System type -> TI OMAP Implementations -> Smartreflex Support
System type -> TI OMAP Implementations ->
Class 3 mode of Smartreflex Implementation

Major Changes in v5

- Rebased to k.org 2.6.37-rc3
- Rebased to Nishant Menon's latest opp patches
- Voltage pmic info structure extended to include a
vast set of PMIC dependent parameters.
- Smartreflex software n-target values support
removed from the kernel. Instead n-target
values are exposed as debugfs entries which can
be written into by the user if needed.
- Introduced a new file arch/arm/mach-omap2/omap_twl.c
for specifying OMAP and TWL related info for
the voltage layer.
- Remove default enabling of smartreflex autocompensation
during boot on OMAP3430 ES3.1 chips. Instead
an API is provided that can be called from
board files in case autocompensation needs
to be enabled during boot up itself.
- Other review comments on v4


Thara Gopinath (10):
  OMAP3: PM: Adding voltage driver support for OMAP3
  OMAP: Introduce voltage domain information in the hwmod structures
  OMAP3: PM: Adding smartreflex driver support.
  OMAP3: PM: Adding smartreflex device file.
  OMAP3: PM: Adding smartreflex hwmod data
  OMAP3: PM: Adding smartreflex class3 driver
  OMAP3: PM: Adding T2 enabling of smartreflex support
  OMAP3: PM: Register TWL4030 pmic info with the voltage driver.
  OMAP3: PM: Adding debug support to Voltage and Smartreflex drivers
  OMAP3: PM: Program correct init voltages for VDD1 and VDD2

 arch/arm/mach-omap2/Makefile  |7 +-
 arch/arm/mach-omap2/control.h |   17 +
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c|  174 
 arch/arm/mach-omap2/omap_twl.c|  111 +++
 arch/arm/mach-omap2/pm.c  |   91 ++
 arch/arm/mach-omap2/pm.h  |   22 +
 arch/arm/mach-omap2/smartreflex-class3.c  |   59 ++
 arch/arm/mach-omap2/smartreflex.c | 1025 
 arch/arm/mach-omap2/sr_device.c   |  131 +++
 arch/arm/mach-omap2/voltage.c | 1242 +
 arch

[PATCHv5 02/10] OMAP: Introduce voltage domain information in the hwmod structures

2010-12-10 Thread Thara Gopinath
This patch extends the device hwmod structure to contain
info about the voltage domain to which the device belongs to.
This is needed to support a device based DVFS where the
device knows which voltage domain it belongs to.

Signed-off-by: Thara Gopinath 
---
 arch/arm/plat-omap/include/plat/omap_hwmod.h |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/arch/arm/plat-omap/include/plat/omap_hwmod.h 
b/arch/arm/plat-omap/include/plat/omap_hwmod.h
index 7eaa8ed..9567aee 100644
--- a/arch/arm/plat-omap/include/plat/omap_hwmod.h
+++ b/arch/arm/plat-omap/include/plat/omap_hwmod.h
@@ -34,6 +34,7 @@
 #include 
 #include 
 #include 
+#include 
 
 struct omap_device;
 
@@ -436,6 +437,8 @@ struct omap_hwmod_class {
  * @main_clk: main clock: OMAP clock name
  * @_clk: pointer to the main struct clk (filled in at runtime)
  * @opt_clks: other device clocks that drivers can request (0..*)
+ * @vdd_name: voltage domain name
+ * @voltdm: pointer to voltage domain (filled in at runtime)
  * @masters: ptr to array of OCP ifs that this hwmod can initiate on
  * @slaves: ptr to array of OCP ifs that this hwmod can respond on
  * @dev_attr: arbitrary device attributes that can be passed to the driver
@@ -479,6 +482,8 @@ struct omap_hwmod {
const char  *main_clk;
struct clk  *_clk;
struct omap_hwmod_opt_clk   *opt_clks;
+   char*vdd_name;
+   struct voltagedomain*voltdm;
struct omap_hwmod_ocp_if**masters; /* connect to *_IA */
struct omap_hwmod_ocp_if**slaves;  /* connect to *_TA */
void*dev_attr;
-- 
1.7.0.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


[PATCHv5 05/10] OMAP3: PM: Adding smartreflex hwmod data

2010-12-10 Thread Thara Gopinath
This patch adds the smartreflex hwmod data for OMAP3430
and OMAP3630.

Signed-off-by: Thara Gopinath 
---
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |  174 
 1 files changed, 174 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c 
b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
index cb97ecf..4ff9244 100644
--- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
@@ -18,6 +18,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "omap_hwmod_common_data.h"
 
@@ -39,6 +40,8 @@ static struct omap_hwmod omap3xxx_l3_main_hwmod;
 static struct omap_hwmod omap3xxx_l4_core_hwmod;
 static struct omap_hwmod omap3xxx_l4_per_hwmod;
 static struct omap_hwmod omap3xxx_wd_timer2_hwmod;
+static struct omap_hwmod omap34xx_sr1_hwmod;
+static struct omap_hwmod omap34xx_sr2_hwmod;
 
 /* L3 -> L4_CORE interface */
 static struct omap_hwmod_ocp_if omap3xxx_l3_main__l4_core = {
@@ -169,9 +172,47 @@ static struct omap_hwmod_ocp_if omap3_l4_per__uart4 = {
.user   = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
+/* L4 CORE -> SR1 interface */
+static struct omap_hwmod_addr_space omap3_sr1_addr_space[] = {
+   {
+   .pa_start   = OMAP34XX_SR1_BASE,
+   .pa_end = OMAP34XX_SR1_BASE + SZ_1K - 1,
+   .flags  = ADDR_TYPE_RT,
+   },
+};
+
+static struct omap_hwmod_ocp_if omap3_l4_core__sr1 = {
+   .master = &omap3xxx_l4_core_hwmod,
+   .slave  = &omap34xx_sr1_hwmod,
+   .clk= "sr_l4_ick",
+   .addr   = omap3_sr1_addr_space,
+   .addr_cnt   = ARRAY_SIZE(omap3_sr1_addr_space),
+   .user   = OCP_USER_MPU,
+};
+
+/* L4 CORE -> SR1 interface */
+static struct omap_hwmod_addr_space omap3_sr2_addr_space[] = {
+   {
+   .pa_start   = OMAP34XX_SR2_BASE,
+   .pa_end = OMAP34XX_SR2_BASE + SZ_1K - 1,
+   .flags  = ADDR_TYPE_RT,
+   },
+};
+
+static struct omap_hwmod_ocp_if omap3_l4_core__sr2 = {
+   .master = &omap3xxx_l4_core_hwmod,
+   .slave  = &omap34xx_sr2_hwmod,
+   .clk= "sr_l4_ick",
+   .addr   = omap3_sr2_addr_space,
+   .addr_cnt   = ARRAY_SIZE(omap3_sr2_addr_space),
+   .user   = OCP_USER_MPU,
+};
+
 /* Slave interfaces on the L4_CORE interconnect */
 static struct omap_hwmod_ocp_if *omap3xxx_l4_core_slaves[] = {
&omap3xxx_l3_main__l4_core,
+   &omap3_l4_core__sr1,
+   &omap3_l4_core__sr2,
 };
 
 /* Master interfaces on the L4_CORE interconnect */
@@ -509,6 +550,135 @@ static struct omap_hwmod omap3xxx_uart4_hwmod = {
.omap_chip  = OMAP_CHIP_INIT(CHIP_IS_OMAP3630ES1),
 };
 
+/* SR common */
+static struct omap_hwmod_sysc_fields omap34xx_sr_sysc_fields = {
+   .clkact_shift   = 20,
+};
+
+static struct omap_hwmod_class_sysconfig omap34xx_sr_sysc = {
+   .sysc_offs  = 0x24,
+   .sysc_flags = (SYSC_HAS_CLOCKACTIVITY | SYSC_NO_CACHE),
+   .clockact   = CLOCKACT_TEST_ICLK,
+   .sysc_fields= &omap34xx_sr_sysc_fields,
+};
+
+static struct omap_hwmod_class omap34xx_smartreflex_hwmod_class = {
+   .name = "smartreflex",
+   .sysc = &omap34xx_sr_sysc,
+   .rev  = 1,
+};
+
+static struct omap_hwmod_sysc_fields omap36xx_sr_sysc_fields = {
+   .sidle_shift= 24,
+   .enwkup_shift   = 26
+};
+
+static struct omap_hwmod_class_sysconfig omap36xx_sr_sysc = {
+   .sysc_offs  = 0x38,
+   .idlemodes  = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
+   .sysc_flags = (SYSC_HAS_SIDLEMODE | SYSC_HAS_ENAWAKEUP |
+   SYSC_NO_CACHE),
+   .sysc_fields= &omap36xx_sr_sysc_fields,
+};
+
+static struct omap_hwmod_class omap36xx_smartreflex_hwmod_class = {
+   .name = "smartreflex",
+   .sysc = &omap36xx_sr_sysc,
+   .rev  = 2,
+};
+
+/* SR1 */
+static struct omap_hwmod_ocp_if *omap3_sr1_slaves[] = {
+   &omap3_l4_core__sr1,
+};
+
+static struct omap_hwmod omap34xx_sr1_hwmod = {
+   .name   = "sr1_hwmod",
+   .class  = &omap34xx_smartreflex_hwmod_class,
+   .main_clk   = "sr1_fck",
+   .vdd_name   = "mpu",
+   .prcm   = {
+   .omap2 = {
+   .prcm_reg_id = 1,
+   .module_bit = OMAP3430_EN_SR1_SHIFT,
+   .module_offs = WKUP_MOD,
+   .idlest_reg_id = 1,
+   .idlest_idle_bit = OMAP3430_EN_SR1_SHIFT,
+   },
+   },
+   .slaves = omap3_sr1_slaves,
+   .slaves_cnt = ARRAY_SIZE(omap3_sr1_slaves),
+   .omap_chip  = OMAP_CHIP_INIT(CHIP_IS_OMAP3430ES2 |
+   CHIP_IS_OMAP3430ES3_0 |
+   CHIP_IS_OMAP3430ES3_1),
+   .flags  = HWMOD_SET_DEFAULT_CLOCKACT,
+};
+
+static struct 

Re: [PATCH 1/3] omap1: Use asm_irq_flags for entry-macro.S

2010-12-10 Thread Tony Lindgren
* Janusz Krzysztofik  [101210 08:06]:
> Wednesday 08 December 2010 02:47:28 Tony Lindgren napisał(a):
> > Initialize asm_irq_flags in omap_init_irq and use it in
> > get_irqnr_and_base to detect between omap7xx and omap15xx/16xx.
> >
> > Note that both INT_1510_IH2_IRQ and INT_1510_IH2_IRQ are defined
> > as 0, so use INT_1510_IH2_IRQ for both of them.
> 
> Tested on Amstrad Delta.
> 
> > Signed-off-by: Tony Lindgren 
> 
> Tested-by: Janusz Krzysztofik 

Thanks, merging these into omap-for-linus.

Regards,

Tony
--
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


Re: [PATCH 12/11] omap1: Fix gpio mpuio bank to work for multi-omap for 7xx/15xx/16xx

2010-12-10 Thread Tony Lindgren
* Janusz Krzysztofik  [101210 08:05]:
> > We need to divide the 15xx/16xx offset by 2 for 7xx. Use bank->stride
> > for that. This allows us to get rid of the duplicate defines for the
> > MPUIO registers.
> >
> > Note that this will cause omap-keypad.c driver to not work on 7xx.
> > However, the right fix there is to move over to gpio-keys instead as
> > suggested by Cory Maccarrone  and
> > Janusz Krzysztofik .
> >
> > Cc: Cory Maccarrone 
> > Cc: Janusz Krzysztofik 
> > Signed-off-by: Tony Lindgren 
> 
> Acked-by: Janusz Krzysztofik 

Thanks, will now merge the gpio into omap-for-linus for the next
merge window.

Tony
--
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


Re: [RESEND] [PATCH 1/2] OMAP1: allow reserving memory for camera

2010-12-10 Thread Russell King - ARM Linux
On Fri, Dec 10, 2010 at 12:03:07PM +0100, Janusz Krzysztofik wrote:
>  void __init omap1_camera_init(void *info)
>  {
>   struct platform_device *dev = &omap1_camera_device;
> + dma_addr_t paddr = omap1_camera_phys_mempool_base;
> + dma_addr_t size = omap1_camera_phys_mempool_size;
>   int ret;
>  
>   dev->dev.platform_data = info;
>  
> + if (paddr) {
> + if (dma_declare_coherent_memory(&dev->dev, paddr, paddr, size,
> + DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE))

Although this works, you're ending up with SDRAM being mapped via
ioremap, which uses MT_DEVICE - so what is SDRAM ends up being
mapped as if it were a device.

For OMAP1, which is ARMv5 or lower, device memory becomes 'uncacheable,
unbufferable' which is luckily what is used for the DMA coherent
memory on those platforms - so no technical problem here.

However, on ARMv6 and later, ioremapped memory is device memory, which
has different ordering wrt normal memory mappings, and may appear on
different busses on the CPU's interface.  So, this is something I don't
encourage as it's unclear that the hardware will work.

Essentially, dma_declare_coherent_memory() on ARM with main SDRAM should
be viewed as a 'it might work, it might not, and it might stop working
in the future' kind of interface.  In other words, there is no guarantee
that this kind of thing will be supported in the future.
--
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


Re: [PATCH v4] usb: musb: Adding names for IRQs in resource structure

2010-12-10 Thread Sergei Shtylyov

Hello.

Felipe Balbi wrote:


Index: linux-omap-pm/arch/arm/mach-davinci/usb.c
===
--- linux-omap-pm.orig/arch/arm/mach-davinci/usb.c
+++ linux-omap-pm/arch/arm/mach-davinci/usb.c
@@ -64,10 +64,12 @@ static struct resource usb_resources[] =
{
.start = IRQ_USBINT,
.flags = IORESOURCE_IRQ,
+ .name = "mc"
},
{
/* placeholder for the dedicated CPPI IRQ */
.flags = IORESOURCE_IRQ,
+ .name = "dma"
},
};



Argh! This failed to also modify da8xx_usb20_resources[]... :-(


I think when I posted these patch, da8xx support was not there in 
mainline.



No, it was added long ago, before the glue layer itself.



I will send patch to add this.



I will care about this myself now.



Thanks, send me the patch and I'll put to the same branch.


  I was thinking about pushing this thru the DaVinci tree. Well, I'll 
post to both lists and let you figure out who will apply it... :-)



If Kevin picks it up, fine by me :-)


   Hm, I thought this patch has already been applied but it's only in Greg's 
usb-next branch yet. I guess it's too late to update it now, so a separate patch 
should still be created? However, it's not a hot fix now as I thought, and 
doesn't apply to linux-davinci.git...


WBR, Sergei
--
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


Re: [RFC] add BUG_ON_MAPPABLE_NULL macro

2010-12-10 Thread Ohad Ben-Cohen
On Wed, Dec 8, 2010 at 2:10 AM, Andrew Morton  wrote:
> Every time someone sends me a patch with text after the "---", I decide
> it was good changelog material and I promote it to above the "---".
> How's about you save us the effort :)

sure :)

>> +/**
>> + * BUG_ON_MAPPABLE_NULL() - BUG_ON(condition) only if address 0 is mappable
>> + * @condition:       condition to check, should contain a NULL check
>> + *
>> + * In general, NULL dereference Oopses are not desirable, since they take 
>> down
>> + * the system with them and make the user extremely unhappy. So as a general
>> + * rule drivers should avoid dereferencing NULL pointers by doing a simple
>
> s/drivers/code/

definitely.

>> + * check (when appropriate), and just return an error rather than crash.
>> + * This way the system, despite having reduced functionality, will just keep
>> + * running rather than immediately reboot.
>> + *
>> + * _Critical_ kernel code, OTOH, that should not (/cannot) keep running when
>> + * given an unexpected NULL pointer, should just crash. On some 
>> architectures,
>> + * a NULL dereference will always reliably produce an Oops. On others, where
>> + * the zero address can be mmapped, an Oops is not guaranteed. Relying on
>> + * NULL dereference Oopses to happen on these architectures might lead to
>> + * data corruptions (system will keep running despite a critical bug and
>> + * the results will be horribly undefined). In addition, these situations
>> + * can also have security implications - we have seen several privilege
>> + * escalation exploits with which an attacker gained full control over the
>> + * system due to NULL dereference bugs.
>
> yup.
>
>> + * This macro will BUG_ON if @condition is true on architectures where the 
>> zero
>> + * address can be mapped. On other architectures, where the zero address
>> + * can never be mapped, this macro is compiled out. It only makes sense to
>> + * use this macro if @condition contains a NULL check, in order to optimize 
>> that
>> + * check out on architectures where the zero address can never be mapped.
>> + * On such architectures, those checks are not necessary, since the code
>> + * itself will reliably reproduce an Oops as soon as the NULL address will
>> + * be dereferenced.
>> + *
>> + * As with BUG_ON, use this macro only if @condition cannot be tolerated.
>> + * If proceeding with degraded functionality is an option, it's much
>> + * better to just simply check for @condition and return some error code 
>> rather
>> + * than crash the system.
>> + */
>> +#define BUG_ON_MAPPABLE_NULL(cond) do { \
>> +     if (arch_mmap_check(0, 1, MAP_FIXED) == 0) \
>> +             BUG_ON(cond); \
>> +} while (0)
>
> - arch_mmap_check() didn't have any documentation.  Please fix?

Sure.

>
> - arch_mmap_check() is a pretty poor identifier (identifiers which
>  include the word "check" are usually poor ones).  Maybe
>  arch_address_accessible()?

Maybe arch_address_mappable() might be more accurate (an address might
be accessible but not mappable due to some other arch-specific usage)
?

But, do you think it makes sense to rename arch_mmap_check() without
adding any functional benefit to it ?

arch_mmap_check is already defined today for ARM, IA64, MN10300, S390
and SPARC, and used by get_unmapped_area() [mmap.c], and this patch
adds a second usage of it.

To rename it, the patch will have to touch all of those architectures,
and usually, patches that carry stylistic changes in areas which they
don't add any functional benefit to, are considered pretty annoying...

> - I worry about arch_mmap_check().  Is it expected that it will
>  perform a runtime check, like probe_kernel_address()?  Spell out the
>  expectations, please.

Yes, arch_mmap_check does perform a runtime check: get_unmapped_area()
calls it with its addr, len and flags parameters.

But, since BUG_ON_MAPPABLE_NULL() calls it with constant values, I
expect arch_mmap_check() to be compiled out (tested on ARM and
X86_64).

> - BUG_ON_MAPPABLE_NULL() will evaluate arch_mmap_check() even if
>  CONFIG_BUG=n.  Seems bad, depending on what those unspelled-out
>  expectations are!

Definitely. I'll add:

#define BUG_ON_MAPPABLE_NULL(condition)  do { if (condition) ; } while(0)

in case CONFIG_BUG=n.

>
> - BUG_ON_MAPPABLE_NULL() is a mouthful.  I can't immedaitely think of
>  anythinjg nicer :(

Heartily agree...

> - Is BUG_ON_MAPPABLE_NULL() really the interface you want?  Or do we
>  just want an interface which checks a pointer for nearly-nullness?

I guess we can start with BUG_ON_MAPPABLE_NULL(), since this is what
people commonly check today, and we will now be able to optimize those
checks out when they are unnecessary.

Thanks a lot,
Ohad.

>
>
>
--
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


Re: [RFC/PATCH v6 03/12] media: Entities, pads and links

2010-12-10 Thread Sakari Ailus
Hi Mark and others!

Mark Brown wrote:
> On Tue, Dec 07, 2010 at 07:11:39PM +0100, Hans Verkuil wrote:
> 
>> Ah, now I understand what you mean. Would 'activated' be better than 
>> 'active'?
> 
> Better, yes, though it still sounds a bit like something should be
> actively (IYSWIM) happening.   In the absence of better ideas I could go
> with this.

Activated, to me, sounds like that it has happened as a consequence of
something, and primarily not as a result of a user request.

This flag is also set using MEDIA_IOC_SETUP_LINK ioctl and setting the
flags field would be something like this:

media_link_desc.flags |= MEDIA_LINK_ACTIVATED;

I'd prefer ACTIVE over ACTIVATED, since this may also be set (and is
mostly set) by the user.

But reading this discussion, ACTIVE has not received unanimous approval
either... :\

>> Or perhaps just say: the link 'is on' or the link 'is switched on'?
> 
>> So: ...LINK_SWITCHED_ON (sorry, forgot what the prefix is).
> 
>> Actually, I think 'switched on' is a pretty good description of what is 
>> going on
>> in the hardware.
> 
> I prefer activated, this makes me think of power.  Bear in mind that for
> most audio the power is a big portion of the control - either the audio
> is analogue or it looks like it.

What would you think about "ENABLED"? It's simple, quite generic and
thus doesn't explicitly suggest what is the exact effect it has on the
level of the underlying device.

I don't completely like it myself since it would be best to have an
adjective (like "active") but there's none for the word enable, so it
bears the same issues than "activated".

Cheers,

-- 
Sakari Ailus
sakari.ai...@maxwell.research.nokia.com
--
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


Re: [PATCHv2 0/4] staging: tidspbridge - misc fixes

2010-12-10 Thread Guzman Lugo, Fernando
On Fri, Dec 10, 2010 at 5:34 AM, Nishanth Menon  wrote:
> Fernando Guzman Lugo wrote, on 12/09/2010 09:55 PM:
>>
>> * V2
>>  - rebase to the latest
>>  - remove patches no needed at this moment
>>
>> This set of patches fix some issues found in lastest tree.
>>
>> Fernando Guzman Lugo (4):
>>   staging: tidspbridge - use GTP7 for DSP stack dump
>>   staging: tidspbridge - fix timeout in dsp_gpt_wait_overflow
>>   staging: tidspbridge - remove disabling twl when printing DSP stack
>>   staging: tidspbridge - change mmufault tasklet to a workqueue
>>
>>  drivers/staging/tidspbridge/core/_deh.h            |    2 +-
>>  drivers/staging/tidspbridge/core/dsp-clock.c       |   17 ---
>>  drivers/staging/tidspbridge/core/ue_deh.c          |   55
>> +++
>>  .../staging/tidspbridge/include/dspbridge/clk.h    |    4 +-
>>  4 files changed, 46 insertions(+), 32 deletions(-)
>>
> Suggest looping in Linux-omap as well.

Yes, it was weird linux-omap was not showed by get_maintainer.pl script :(.

Regards,
Fernando.

>
> --
> Regards,
> Nishanth Menon
>
--
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


Re: [PATCH 1/3] omap1: Use asm_irq_flags for entry-macro.S

2010-12-10 Thread Janusz Krzysztofik
Wednesday 08 December 2010 02:47:28 Tony Lindgren napisał(a):
> Initialize asm_irq_flags in omap_init_irq and use it in
> get_irqnr_and_base to detect between omap7xx and omap15xx/16xx.
>
> Note that both INT_1510_IH2_IRQ and INT_1510_IH2_IRQ are defined
> as 0, so use INT_1510_IH2_IRQ for both of them.

Tested on Amstrad Delta.

> Signed-off-by: Tony Lindgren 

Tested-by: Janusz Krzysztofik 

> diff --git a/arch/arm/mach-omap1/include/mach/entry-macro.S
> b/arch/arm/mach-omap1/include/mach/entry-macro.S index df9060e..c9be6d4
> 100644
> --- a/arch/arm/mach-omap1/include/mach/entry-macro.S
> +++ b/arch/arm/mach-omap1/include/mach/entry-macro.S
> @@ -14,18 +14,17 @@
>  #include 
>  #include 
>
> -#if (defined(CONFIG_ARCH_OMAP730)||defined(CONFIG_ARCH_OMAP850)) && \
> - (defined(CONFIG_ARCH_OMAP15XX) || defined(CONFIG_ARCH_OMAP16XX))
> -#error "FIXME: OMAP7XX doesn't support multiple-OMAP"
> -#elif defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850)
> -#define INT_IH2_IRQ  INT_7XX_IH2_IRQ
> -#elif defined(CONFIG_ARCH_OMAP15XX)
> -#define INT_IH2_IRQ  INT_1510_IH2_IRQ
> -#elif defined(CONFIG_ARCH_OMAP16XX)
> -#define INT_IH2_IRQ  INT_1610_IH2_IRQ
> -#else
> -#warning "IH2 IRQ defaulted"
> -#define INT_IH2_IRQ  INT_1510_IH2_IRQ
> +/*
> + * We use __glue to avoid errors with multiple definitions of
> + * .globl omap_irq_flags as it's included from entry-armv.S but not
> + * from entry-common.S.
> + */
> +#ifdef __glue
> + .pushsection .data
> + .globl  omap_irq_flags
> +omap_irq_flags:
> + .word   0
> + .popsection
>  #endif
>
>   .macro  disable_fiq
> @@ -47,9 +46,11 @@
>   beq 1510f
>
>   ldr \irqnr, [\base, #IRQ_SIR_FIQ_REG_OFFSET]
> + ldr \tmp, =omap_irq_flags   @ irq flags address
> + ldr \tmp, [\tmp, #0]@ irq flags value
>   cmp \irqnr, #0
>   ldreq   \irqnr, [\base, #IRQ_SIR_IRQ_REG_OFFSET]
> - cmpeq   \irqnr, #INT_IH2_IRQ
> + cmpeq   \irqnr, \tmp
>   ldreq   \base, =OMAP1_IO_ADDRESS(OMAP_IH2_BASE)
>   ldreq   \irqnr, [\base, #IRQ_SIR_IRQ_REG_OFFSET]
>   addeqs  \irqnr, \irqnr, #32
> diff --git a/arch/arm/mach-omap1/irq.c b/arch/arm/mach-omap1/irq.c
> index db913c3..6bddbc8 100644
> --- a/arch/arm/mach-omap1/irq.c
> +++ b/arch/arm/mach-omap1/irq.c
> @@ -176,26 +176,31 @@ static struct irq_chip omap_irq_chip = {
>
>  void __init omap_init_irq(void)
>  {
> + extern unsigned int omap_irq_flags;
>   int i, j;
>
>  #if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850)
>   if (cpu_is_omap7xx()) {
> + omap_irq_flags = INT_7XX_IH2_IRQ;
>   irq_banks = omap7xx_irq_banks;
>   irq_bank_count = ARRAY_SIZE(omap7xx_irq_banks);
>   }
>  #endif
>  #ifdef CONFIG_ARCH_OMAP15XX
>   if (cpu_is_omap1510()) {
> + omap_irq_flags = INT_1510_IH2_IRQ;
>   irq_banks = omap1510_irq_banks;
>   irq_bank_count = ARRAY_SIZE(omap1510_irq_banks);
>   }
>   if (cpu_is_omap310()) {
> + omap_irq_flags = INT_1510_IH2_IRQ;
>   irq_banks = omap310_irq_banks;
>   irq_bank_count = ARRAY_SIZE(omap310_irq_banks);
>   }
>  #endif
>  #if defined(CONFIG_ARCH_OMAP16XX)
>   if (cpu_is_omap16xx()) {
> + omap_irq_flags = INT_1510_IH2_IRQ;
>   irq_banks = omap1610_irq_banks;
>   irq_bank_count = ARRAY_SIZE(omap1610_irq_banks);
>   }
> diff --git a/arch/arm/plat-omap/include/plat/irqs.h
> b/arch/arm/plat-omap/include/plat/irqs.h index 65e20a6..2910de9 100644
> --- a/arch/arm/plat-omap/include/plat/irqs.h
> +++ b/arch/arm/plat-omap/include/plat/irqs.h
> @@ -77,7 +77,7 @@
>  /*
>   * OMAP-1610 specific IRQ numbers for interrupt handler 1
>   */
> -#define INT_1610_IH2_IRQ 0
> +#define INT_1610_IH2_IRQ INT_1510_IH2_IRQ
>  #define INT_1610_IH2_FIQ 2
>  #define INT_1610_McBSP2_TX   4
>  #define INT_1610_McBSP2_RX   5
> --
> 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


--
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


Re: [PATCH 12/11] omap1: Fix gpio mpuio bank to work for multi-omap for 7xx/15xx/16xx

2010-12-10 Thread Janusz Krzysztofik
Wednesday 08 December 2010 00:23:16 Tony Lindgren napisał(a):
> * Tony Lindgren  [101204 13:16]:
> > * Varadarajan, Charulatha  [101202 06:08]:
> > > On Thu, Dec 2, 2010 at 15:28, Kevin Hilman  
wrote:
> > > > Tony, you can also add
> > > >
> > > > Acked-by: Kevin Hilman 
> >
> > OK, updated. Also made one more GPIO patch to allow us to deal
> > with the 7xx vs 15xx/16xx MPUIO registers.
>
> Turns out that broke drivers/mtd/nand/ams-delta.c as it directly uses
> multiple lines in parallel. So let's use 15xx/16xx offsets instead
> and divide them by two.
>
> Regards,
>
> Tony
>
>
> From: Tony Lindgren 
> Date: Sat, 4 Dec 2010 12:39:43 -0800
> Subject: [PATCH] omap1: Fix gpio mpuio bank to work for multi-omap for
> 7xx/15xx/16xx
>
> We need to divide the 15xx/16xx offset by 2 for 7xx. Use bank->stride
> for that. This allows us to get rid of the duplicate defines for the
> MPUIO registers.
>
> Note that this will cause omap-keypad.c driver to not work on 7xx.
> However, the right fix there is to move over to gpio-keys instead as
> suggested by Cory Maccarrone  and
> Janusz Krzysztofik .
>
> Cc: Cory Maccarrone 
> Cc: Janusz Krzysztofik 
> Signed-off-by: Tony Lindgren 

Acked-by: Janusz Krzysztofik 

> diff --git a/arch/arm/mach-omap1/gpio15xx.c
> b/arch/arm/mach-omap1/gpio15xx.c index dbd8168..04c4b04 100644
> --- a/arch/arm/mach-omap1/gpio15xx.c
> +++ b/arch/arm/mach-omap1/gpio15xx.c
> @@ -38,6 +38,7 @@ static struct __initdata omap_gpio_platform_data
> omap15xx_mpu_gpio_config = { .virtual_irq_start   = IH_MPUIO_BASE,
>   .bank_type  = METHOD_MPUIO,
>   .bank_width = 16,
> + .bank_stride= 1,
>  };
>
>  static struct __initdata platform_device omap15xx_mpu_gpio = {
> diff --git a/arch/arm/mach-omap1/gpio16xx.c
> b/arch/arm/mach-omap1/gpio16xx.c index 8d4d0a0..5dd0d4c 100644
> --- a/arch/arm/mach-omap1/gpio16xx.c
> +++ b/arch/arm/mach-omap1/gpio16xx.c
> @@ -41,6 +41,7 @@ static struct __initdata omap_gpio_platform_data
> omap16xx_mpu_gpio_config = { .virtual_irq_start   = IH_MPUIO_BASE,
>   .bank_type  = METHOD_MPUIO,
>   .bank_width = 16,
> + .bank_stride= 1,
>  };
>
>  static struct __initdata platform_device omap16xx_mpu_gpio = {
> diff --git a/arch/arm/mach-omap1/gpio7xx.c b/arch/arm/mach-omap1/gpio7xx.c
> index 94bccd4..1204c8b 100644
> --- a/arch/arm/mach-omap1/gpio7xx.c
> +++ b/arch/arm/mach-omap1/gpio7xx.c
> @@ -43,6 +43,7 @@ static struct __initdata omap_gpio_platform_data
> omap7xx_mpu_gpio_config = { .virtual_irq_start= IH_MPUIO_BASE,
>   .bank_type  = METHOD_MPUIO,
>   .bank_width = 32,
> + .bank_stride= 2,
>  };
>
>  static struct __initdata platform_device omap7xx_mpu_gpio = {
> diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c
> index 59afe77..de93251 100644
> --- a/arch/arm/plat-omap/gpio.c
> +++ b/arch/arm/plat-omap/gpio.c
> @@ -159,6 +159,7 @@ struct gpio_bank {
>   u32 dbck_enable_mask;
>   struct device *dev;
>   bool dbck_flag;
> + int stride;
>  };
>
>  #ifdef CONFIG_ARCH_OMAP3
> @@ -267,7 +268,7 @@ static void _set_gpio_direction(struct gpio_bank *bank,
> int gpio, int is_input) switch (bank->method) {
>  #ifdef CONFIG_ARCH_OMAP1
>   case METHOD_MPUIO:
> - reg += OMAP_MPUIO_IO_CNTL;
> + reg += OMAP_MPUIO_IO_CNTL / bank->stride;
>   break;
>  #endif
>  #ifdef CONFIG_ARCH_OMAP15XX
> @@ -315,7 +316,7 @@ static void _set_gpio_dataout(struct gpio_bank *bank,
> int gpio, int enable) switch (bank->method) {
>  #ifdef CONFIG_ARCH_OMAP1
>   case METHOD_MPUIO:
> - reg += OMAP_MPUIO_OUTPUT;
> + reg += OMAP_MPUIO_OUTPUT / bank->stride;
>   l = __raw_readl(reg);
>   if (enable)
>   l |= 1 << gpio;
> @@ -387,7 +388,7 @@ static int _get_gpio_datain(struct gpio_bank *bank, int
> gpio) switch (bank->method) {
>  #ifdef CONFIG_ARCH_OMAP1
>   case METHOD_MPUIO:
> - reg += OMAP_MPUIO_INPUT_LATCH;
> + reg += OMAP_MPUIO_INPUT_LATCH / bank->stride;
>   break;
>  #endif
>  #ifdef CONFIG_ARCH_OMAP15XX
> @@ -433,7 +434,7 @@ static int _get_gpio_dataout(struct gpio_bank *bank,
> int gpio) switch (bank->method) {
>  #ifdef CONFIG_ARCH_OMAP1
>   case METHOD_MPUIO:
> - reg += OMAP_MPUIO_OUTPUT;
> + reg += OMAP_MPUIO_OUTPUT / bank->stride;
>   break;
>  #endif
>  #ifdef CONFIG_ARCH_OMAP15XX
> @@ -620,7 +621,7 @@ static void _toggle_gpio_edge_triggering(struct
> gpio_bank *bank, int gpio)
>
>   switch (bank->method) {
>   case METHOD_MPUIO:
> - reg += OMAP_MPUIO_GPIO_INT_EDGE;
> + reg += OMAP_MPUIO_GPIO_INT_EDGE / bank->stride;
>   break;
>  #ifdef CONFIG_ARCH_OMAP15XX
>   case METHOD_GPIO_1510:
> @@ -654,7 +655,7 @@ static int _set_gpio_triggering(struct gpio_bank *bank,
> int gpio, int trig

Re: [PATCH 2/4] omap1: Add initcall checks for omap1 and booted board

2010-12-10 Thread Janusz Krzysztofik
Saturday 04 December 2010 22:36:55 Tony Lindgren napisał(a):
> Otherwise multi-omap1 configurations will fail.

Tested on Amstrad Delta with omap1_defconfig.

> Signed-off-by: Tony Lindgren 

Tested-by: Janusz Krzysztofik 

> ---
>  arch/arm/mach-omap1/board-ams-delta.c |3 +++
>  arch/arm/mach-omap1/board-voiceblue.c |6 ++
>  arch/arm/mach-omap1/devices.c |3 +++
>  arch/arm/mach-omap1/lcd_dma.c |3 +++
>  arch/arm/mach-omap1/leds.c|3 +++
>  arch/arm/mach-omap1/mcbsp.c   |3 +++
>  arch/arm/mach-omap1/pm.c  |3 +++
>  arch/arm/mach-omap1/pm_bus.c  |3 +++
>  arch/arm/mach-omap1/serial.c  |3 +++
>  9 files changed, 30 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/mach-omap1/board-ams-delta.c
> b/arch/arm/mach-omap1/board-ams-delta.c index ce4d69c..e143950 100644
> --- a/arch/arm/mach-omap1/board-ams-delta.c
> +++ b/arch/arm/mach-omap1/board-ams-delta.c
> @@ -338,6 +338,9 @@ static int __init ams_delta_modem_init(void)
>  {
>   int err;
>
> + if (!machine_is_ams_delta())
> + return -ENODEV;
> +
>   omap_cfg_reg(M14_1510_GPIO2);
>   ams_delta_modem_ports[0].irq =
>   gpio_to_irq(AMS_DELTA_GPIO_PIN_MODEM_IRQ);
> diff --git a/arch/arm/mach-omap1/board-voiceblue.c
> b/arch/arm/mach-omap1/board-voiceblue.c index 789f5ba..815a69c 100644
> --- a/arch/arm/mach-omap1/board-voiceblue.c
> +++ b/arch/arm/mach-omap1/board-voiceblue.c
> @@ -83,6 +83,9 @@ static struct platform_device serial_device = {
>
>  static int __init ext_uart_init(void)
>  {
> + if (!machine_is_voiceblue())
> + return -ENODEV;
> +
>   return platform_device_register(&serial_device);
>  }
>  arch_initcall(ext_uart_init);
> @@ -235,6 +238,9 @@ static struct notifier_block panic_block = {
>
>  static int __init voiceblue_setup(void)
>  {
> + if (!machine_is_voiceblue())
> + return -ENODEV;
> +
>   /* Setup panic notifier */
>   atomic_notifier_chain_register(&panic_notifier_list, &panic_block);
>
> diff --git a/arch/arm/mach-omap1/devices.c b/arch/arm/mach-omap1/devices.c
> index 86ad38a..b0f4c23 100644
> --- a/arch/arm/mach-omap1/devices.c
> +++ b/arch/arm/mach-omap1/devices.c
> @@ -288,6 +288,9 @@ static inline void omap_init_audio(void) {}
>   */
>  static int __init omap1_init_devices(void)
>  {
> + if (!cpu_class_is_omap1())
> + return -ENODEV;
> +
>   /* please keep these calls, and their implementations above,
>* in alphabetical order so they're easier to sort through.
>*/
> diff --git a/arch/arm/mach-omap1/lcd_dma.c b/arch/arm/mach-omap1/lcd_dma.c
> index 3be11af..c9088d8 100644
> --- a/arch/arm/mach-omap1/lcd_dma.c
> +++ b/arch/arm/mach-omap1/lcd_dma.c
> @@ -424,6 +424,9 @@ static int __init omap_init_lcd_dma(void)
>  {
>   int r;
>
> + if (!cpu_class_is_omap1())
> + return -ENODEV;
> +
>   if (cpu_is_omap16xx()) {
>   u16 w;
>
> diff --git a/arch/arm/mach-omap1/leds.c b/arch/arm/mach-omap1/leds.c
> index 277f356..22eb11d 100644
> --- a/arch/arm/mach-omap1/leds.c
> +++ b/arch/arm/mach-omap1/leds.c
> @@ -17,6 +17,9 @@
>  static int __init
>  omap_leds_init(void)
>  {
> + if (!cpu_class_is_omap1())
> + return -ENODEV;
> +
>   if (machine_is_omap_innovator())
>   leds_event = innovator_leds_event;
>
> diff --git a/arch/arm/mach-omap1/mcbsp.c b/arch/arm/mach-omap1/mcbsp.c
> index 372ea71..8209736 100644
> --- a/arch/arm/mach-omap1/mcbsp.c
> +++ b/arch/arm/mach-omap1/mcbsp.c
> @@ -176,6 +176,9 @@ static struct omap_mcbsp_platform_data
> omap16xx_mcbsp_pdata[] = {
>
>  static int __init omap1_mcbsp_init(void)
>  {
> + if (!cpu_class_is_omap1())
> + return -ENODEV;
> +
>   if (cpu_is_omap7xx()) {
>   omap_mcbsp_count = OMAP7XX_MCBSP_PDATA_SZ;
>   omap_mcbsp_cache_size = OMAP7XX_MCBSP_REG_NUM * sizeof(u16);
> diff --git a/arch/arm/mach-omap1/pm.c b/arch/arm/mach-omap1/pm.c
> index b1d3f9f..0cca23a 100644
> --- a/arch/arm/mach-omap1/pm.c
> +++ b/arch/arm/mach-omap1/pm.c
> @@ -661,6 +661,9 @@ static int __init omap_pm_init(void)
>   int error;
>  #endif
>
> + if (!cpu_class_is_omap1())
> + return -ENODEV;
> +
>   printk("Power Management for TI OMAP.\n");
>
>   /*
> diff --git a/arch/arm/mach-omap1/pm_bus.c b/arch/arm/mach-omap1/pm_bus.c
> index 8b66392..3266447 100644
> --- a/arch/arm/mach-omap1/pm_bus.c
> +++ b/arch/arm/mach-omap1/pm_bus.c
> @@ -73,6 +73,9 @@ static int __init omap1_pm_runtime_init(void)
>   const struct dev_pm_ops *pm;
>   struct dev_pm_ops *omap_pm;
>
> + if (!cpu_class_is_omap1())
> + return -ENODEV;
> +
>   pm = platform_bus_get_pm_ops();
>   if (!pm) {
>   pr_err("%s: unable to get dev_pm_ops from platform_bus\n",
> diff --git a/arch/arm/mach-omap1/serial.c b/arch/arm/mach-omap1/serial.c
> index 9e1c4d4..550ca9d 100

Re: [PATCH 0/5] OMAP4: hwmod data fixes and update

2010-12-10 Thread Cousson, Benoit

On 12/10/2010 1:36 AM, Kevin Hilman wrote:

Benoit Cousson  writes:


[...]


As with the other series, I tried to pull this into my pm-core for
testing with all the other PM stuff we have baking for 2.6.38.

Unfortunately, this series has conflicts with Paul's
pwrdm_prcm_[ab]_2.6.38 branches.

Could you rebase this on Paul's pwrdm_prcm_b_2.6.38 branch?


- for_2.6.38/clock is now rebased on top of pwrdm_prcm_b_2.6.38
- for_2.6.38/hwmod_data is rebased on top of for_2.6.38/clock

Regards,
Benoit
--
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


Re: [PATCH 5/5 v5] usb: musb: Using runtime pm APIs for musb.

2010-12-10 Thread Felipe Balbi

hi,

On Fri, Dec 10, 2010 at 08:05:39PM +0530, Hema HK wrote:

Calling runtime pm APIs pm_runtime_put_sync() and pm_runtime_get_sync()
for enabling/disabling the clocks, sysconfig settings.

enable clock, configure no-idle/standby when active and configure force 
idle/standby
and disable clock when idled. This is taken care by the runtime framework when
driver calls the pm_runtime_get_sync and pm_runtime_put_sync APIs.
Need to configure MUSB into force standby and force idle mode when usb not used

Signed-off-by: Hema HK 
Cc: Felipe Balbi 
Cc: Tony Lindgren 
Cc: Kevin Hilman 
Cc: Cousson, Benoit 
Cc: Paul Walmsley 
---

drivers/usb/musb/musb_core.h |2 -
drivers/usb/musb/omap2430.c  |   80 +++
2 files changed, 23 insertions(+), 59 deletions(-)


Now I see you removed the runtime_resume and runtime_suspend calls from
musb_core. Won't we loose context in that case ?

--
balbi
--
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/5 v5] OMAP2+: musb: HWMOD adaptation for musb.

2010-12-10 Thread Hema HK
Using omap_device_build API instead of platform_device_register for 
OMAP2430,OMAP34xx and OMAP4430 musb device registration.
The device specific resources defined in centralized
database will be used. 

Signed-off-by: Hema HK 
Cc: Felipe Balbi 
Cc: Tony Lindgren 
Cc: Kevin Hilman 
Cc: Cousson, Benoit 
Cc: Paul Walmsley 
---
 arch/arm/mach-omap2/usb-musb.c |   76 +
 1 file changed, 55 insertions(+), 21 deletions(-)

Index: usb/arch/arm/mach-omap2/usb-musb.c
===
--- usb.orig/arch/arm/mach-omap2/usb-musb.c
+++ usb/arch/arm/mach-omap2/usb-musb.c
@@ -31,9 +31,12 @@
 #include 
 #include 
 #include "control.h"
+#include 
 
 #if defined(CONFIG_USB_MUSB_OMAP2PLUS) || defined (CONFIG_USB_MUSB_AM35X)
 
+static const char name[] = "musb-omap2430";
+
 static void am35x_musb_reset(void)
 {
u32 regval;
@@ -170,7 +173,7 @@ static struct musb_hdrc_platform_data mu
 static u64 musb_dmamask = DMA_BIT_MASK(32);
 
 static struct platform_device musb_device = {
-   .name   = "musb-omap2430",
+   .name   = "musb-am35x",
.id = -1,
.dev = {
.dma_mask   = &musb_dmamask,
@@ -181,26 +184,23 @@ static struct platform_device musb_devic
.resource   = musb_resources,
 };
 
+static struct omap_device_pm_latency omap_musb_latency[] = {
+   {
+   .deactivate_func = omap_device_idle_hwmods,
+   .activate_func   = omap_device_enable_hwmods,
+   .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
+   },
+};
+
 void __init usb_musb_init(struct omap_musb_board_data *board_data)
 {
-   if (cpu_is_omap243x()) {
-   musb_resources[0].start = OMAP243X_HS_BASE;
-   } else if (cpu_is_omap3517() || cpu_is_omap3505()) {
-   musb_device.name = "musb-am35x";
-   musb_resources[0].start = AM35XX_IPSS_USBOTGSS_BASE;
-   musb_resources[1].start = INT_35XX_USBOTG_IRQ;
-   board_data->set_phy_power = am35x_musb_phy_power;
-   board_data->clear_irq = am35x_musb_clear_irq;
-   board_data->set_mode = am35x_musb_set_mode;
-   board_data->reset = am35x_musb_reset;
-   } else if (cpu_is_omap34xx()) {
-   musb_resources[0].start = OMAP34XX_HSUSB_OTG_BASE;
-   } else if (cpu_is_omap44xx()) {
-   musb_resources[0].start = OMAP44XX_HSUSB_OTG_BASE;
-   musb_resources[1].start = OMAP44XX_IRQ_HS_USB_MC_N;
-   musb_resources[2].start = OMAP44XX_IRQ_HS_USB_DMA_N;
-   }
-   musb_resources[0].end = musb_resources[0].start + SZ_4K - 1;
+   struct omap_hwmod *oh;
+   struct omap_device *od;
+   struct platform_device *pdev;
+   struct device   *dev;
+   int bus_id = -1;
+   const char *oh_name = "usb_otg_hs";
+   struct musb_hdrc_platform_data *pdata;
 
/*
 * REVISIT: This line can be removed once all the platforms using
@@ -212,8 +212,42 @@ void __init usb_musb_init(struct omap_mu
musb_plat.mode = board_data->mode;
musb_plat.extvbus = board_data->extvbus;
 
-   if (platform_device_register(&musb_device) < 0)
-   printk(KERN_ERR "Unable to register HS-USB (MUSB) device\n");
+   if (cpu_is_omap3517() || cpu_is_omap3505()) {
+   musb_resources[0].start = AM35XX_IPSS_USBOTGSS_BASE;
+   musb_resources[1].start = INT_35XX_USBOTG_IRQ;
+   board_data->set_phy_power = am35x_musb_phy_power;
+   board_data->clear_irq = am35x_musb_clear_irq;
+   board_data->set_mode = am35x_musb_set_mode;
+   board_data->reset = am35x_musb_reset;
+   musb_resources[0].end = musb_resources[0].start + SZ_4K - 1;
+
+   if (platform_device_register(&musb_device) < 0)
+   printk(KERN_ERR "Unable to register HS-USB \
+   (MUSB) device\n");
+   } else {
+   oh = omap_hwmod_lookup(oh_name);
+   if (!oh) {
+   pr_err("Could not look up %s\n", oh_name);
+   return;
+   }
+
+   pdata = &musb_plat;
+   od = omap_device_build(name, bus_id, oh, pdata,
+  sizeof(*pdata), omap_musb_latency,
+  ARRAY_SIZE(omap_musb_latency), false);
+   if (IS_ERR(od)) {
+   pr_err("Could not build omap_device for %s %s\n",
+   name, oh_name);
+   return;
+   }
+
+   pdev = &od->pdev;
+   dev = &pdev->dev;
+   get_device(dev);
+   dev->dma_mask = &musb_dmamask;
+   dev->coherent_dma_mask = musb_dmamask;
+   put_device(dev);
+   }
 }
 
 #else
--
To 

[PATCH 5/5 v5] usb: musb: Using runtime pm APIs for musb.

2010-12-10 Thread Hema HK
Calling runtime pm APIs pm_runtime_put_sync() and pm_runtime_get_sync()
for enabling/disabling the clocks, sysconfig settings.

enable clock, configure no-idle/standby when active and configure force 
idle/standby
and disable clock when idled. This is taken care by the runtime framework when 
driver calls the pm_runtime_get_sync and pm_runtime_put_sync APIs.
Need to configure MUSB into force standby and force idle mode when usb not used

Signed-off-by: Hema HK 
Cc: Felipe Balbi 
Cc: Tony Lindgren 
Cc: Kevin Hilman 
Cc: Cousson, Benoit 
Cc: Paul Walmsley 
---

 drivers/usb/musb/musb_core.h |2 -
 drivers/usb/musb/omap2430.c  |   80 +++
 2 files changed, 23 insertions(+), 59 deletions(-)

Index: usb/drivers/usb/musb/omap2430.c
===
--- usb.orig/drivers/usb/musb/omap2430.c
+++ usb/drivers/usb/musb/omap2430.c
@@ -33,6 +33,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include "musb_core.h"
 #include "omap2430.h"
@@ -40,7 +42,6 @@
 struct omap2430_glue {
struct device   *dev;
struct platform_device  *musb;
-   struct clk  *clk;
 };
 #define glue_to_musb(g)platform_get_drvdata(g->musb)
 
@@ -216,20 +217,12 @@ static inline void omap2430_low_level_ex
l = musb_readl(musb->mregs, OTG_FORCESTDBY);
l |= ENABLEFORCE;   /* enable MSTANDBY */
musb_writel(musb->mregs, OTG_FORCESTDBY, l);
-
-   l = musb_readl(musb->mregs, OTG_SYSCONFIG);
-   l |= ENABLEWAKEUP;  /* enable wakeup */
-   musb_writel(musb->mregs, OTG_SYSCONFIG, l);
 }
 
 static inline void omap2430_low_level_init(struct musb *musb)
 {
u32 l;
 
-   l = musb_readl(musb->mregs, OTG_SYSCONFIG);
-   l &= ~ENABLEWAKEUP; /* disable wakeup */
-   musb_writel(musb->mregs, OTG_SYSCONFIG, l);
-
l = musb_readl(musb->mregs, OTG_FORCESTDBY);
l &= ~ENABLEFORCE;  /* disable MSTANDBY */
musb_writel(musb->mregs, OTG_FORCESTDBY, l);
@@ -307,21 +300,6 @@ static int omap2430_musb_init(struct mus
 
omap2430_low_level_init(musb);
 
-   l = musb_readl(musb->mregs, OTG_SYSCONFIG);
-   l &= ~ENABLEWAKEUP; /* disable wakeup */
-   l &= ~NOSTDBY;  /* remove possible nostdby */
-   l |= SMARTSTDBY;/* enable smart standby */
-   l &= ~AUTOIDLE; /* disable auto idle */
-   l &= ~NOIDLE;   /* remove possible noidle */
-   l |= SMARTIDLE; /* enable smart idle */
-   /*
-* MUSB AUTOIDLE don't work in 3430.
-* Workaround by Richard Woodruff/TI
-*/
-   if (!cpu_is_omap3430())
-   l |= AUTOIDLE;  /* enable auto idle */
-   musb_writel(musb->mregs, OTG_SYSCONFIG, l);
-
l = musb_readl(musb->mregs, OTG_INTERFSEL);
 
if (data->interface_type == MUSB_INTERFACE_UTMI) {
@@ -384,7 +362,7 @@ static int __init omap2430_probe(struct 
struct musb_hdrc_platform_data  *pdata = pdev->dev.platform_data;
struct platform_device  *musb;
struct omap2430_glue*glue;
-   struct clk  *clk;
+   int status = 0;
 
int ret = -ENOMEM;
 
@@ -400,26 +378,12 @@ static int __init omap2430_probe(struct 
goto err1;
}
 
-   clk = clk_get(&pdev->dev, "ick");
-   if (IS_ERR(clk)) {
-   dev_err(&pdev->dev, "failed to get clock\n");
-   ret = PTR_ERR(clk);
-   goto err2;
-   }
-
-   ret = clk_enable(clk);
-   if (ret) {
-   dev_err(&pdev->dev, "failed to enable clock\n");
-   goto err3;
-   }
-
musb->dev.parent= &pdev->dev;
musb->dev.dma_mask  = &omap2430_dmamask;
musb->dev.coherent_dma_mask = omap2430_dmamask;
 
glue->dev   = &pdev->dev;
glue->musb  = musb;
-   glue->clk   = clk;
 
pdata->platform_ops = &omap2430_ops;
 
@@ -429,28 +393,30 @@ static int __init omap2430_probe(struct 
pdev->num_resources);
if (ret) {
dev_err(&pdev->dev, "failed to add resources\n");
-   goto err4;
+   goto err2;
}
 
ret = platform_device_add_data(musb, pdata, sizeof(*pdata));
if (ret) {
dev_err(&pdev->dev, "failed to add platform_data\n");
-   goto err4;
+   goto err2;
}
 
ret = platform_device_add(musb);
if (ret) {
dev_err(&pdev->dev, "failed to register musb device\n");
-   goto err4;
+   goto err2;
}
 
-   return 0;
+   pm_runtime_enable(&pdev->dev);
+   if (pm_runtime_get_sync(&pdev->dev)) {
+   dev_err(&pdev->

[PATCH 1/5 v5] OMAP2430: hwmod data: Add USBOTG

2010-12-10 Thread Hema HK
OMAP2430 hwmod data structures are populated with base address, L3 and L4
interface clocks, IRQs and sysconfig register details.

As per OMAP USBOTG specification, need to configure the USBOTG
to smart idle/standby or no idle/standby during data transfer and
force idle/standby when not in use to support retention and off-mode.
By setting HWMOD_SWSUP_SIDLE and HWMOD_SWSUP_MSTANDBY flags, framework
will take care of configuring to no idle/standby when module is enabled
and force idle/standby when suspended.

Signed-off-by: Hema HK 
Cc: Felipe Balbi 
Cc: Tony Lindgren 
Cc: Kevin Hilman 
Cc: Cousson, Benoit 
Cc: Paul Walmsley 
---
 arch/arm/mach-omap2/omap_hwmod_2430_data.c |   97 +
 1 file changed, 97 insertions(+)

Index: usb/arch/arm/mach-omap2/omap_hwmod_2430_data.c
===
--- usb.orig/arch/arm/mach-omap2/omap_hwmod_2430_data.c
+++ usb/arch/arm/mach-omap2/omap_hwmod_2430_data.c
@@ -77,6 +77,15 @@ static struct omap_hwmod omap2430_l4_wku
 static struct omap_hwmod omap2430_uart1_hwmod;
 static struct omap_hwmod omap2430_uart2_hwmod;
 static struct omap_hwmod omap2430_uart3_hwmod;
+static struct omap_hwmod omap2430_usbhsotg_hwmod;
+
+/* l3_core -> usbhsotg  interface */
+static struct omap_hwmod_ocp_if omap2430_usbhsotg__l3 = {
+   .master = &omap2430_usbhsotg_hwmod,
+   .slave  = &omap2430_l3_main_hwmod,
+   .clk= "core_l3_ck",
+   .user   = OCP_USER_MPU,
+};
 
 /* L4_CORE -> L4_WKUP interface */
 static struct omap_hwmod_ocp_if omap2430_l4_core__l4_wkup = {
@@ -139,6 +148,35 @@ static struct omap_hwmod_ocp_if omap2_l4
.user   = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
+/*
+* usbhsotg interface data
+*/
+static struct omap_hwmod_addr_space omap2430_usbhsotg_addrs[] = {
+   {
+   .pa_start   = OMAP243X_HS_BASE,
+   .pa_end = OMAP243X_HS_BASE + SZ_4K - 1,
+   .flags  = ADDR_TYPE_RT
+   },
+};
+
+/*  l4_core ->usbhsotg  interface */
+static struct omap_hwmod_ocp_if omap2430_l4_core__usbhsotg = {
+   .master = &omap2430_l4_core_hwmod,
+   .slave  = &omap2430_usbhsotg_hwmod,
+   .clk= "usb_l4_ick",
+   .addr   = omap2430_usbhsotg_addrs,
+   .addr_cnt   = ARRAY_SIZE(omap2430_usbhsotg_addrs),
+   .user   = OCP_USER_MPU,
+};
+
+static struct omap_hwmod_ocp_if *omap2430_usbhsotg_masters[] = {
+   &omap2430_usbhsotg__l3,
+};
+
+static struct omap_hwmod_ocp_if *omap2430_usbhsotg_slaves[] = {
+   &omap2430_l4_core__usbhsotg,
+};
+
 /* Slave interfaces on the L4_CORE interconnect */
 static struct omap_hwmod_ocp_if *omap2430_l4_core_slaves[] = {
&omap2430_l3_main__l4_core,
@@ -418,6 +456,62 @@ static struct omap_hwmod omap2430_uart3_
.omap_chip  = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
 };
 
+/*
+ * usbhsotg
+ */
+static struct omap_hwmod_class_sysconfig omap2430_usbhsotg_sysc = {
+   .rev_offs   = 0x0400,
+   .sysc_offs  = 0x0404,
+   .syss_offs  = 0x0408,
+   .sysc_flags = (SYSC_HAS_SIDLEMODE | SYSC_HAS_MIDLEMODE|
+ SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET |
+ SYSC_HAS_AUTOIDLE),
+   .idlemodes  = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
+ MSTANDBY_FORCE | MSTANDBY_NO | MSTANDBY_SMART),
+   .sysc_fields= &omap_hwmod_sysc_type1,
+};
+
+static struct omap_hwmod_class usbotg_class = {
+   .name = "usbotg",
+   .sysc = &omap2430_usbhsotg_sysc,
+};
+
+/* usb_otg_hs */
+static struct omap_hwmod_irq_info omap2430_usbhsotg_mpu_irqs[] = {
+
+   { .name = "mc", .irq = 92 },
+   { .name = "dma", .irq = 93 },
+};
+
+static struct omap_hwmod omap2430_usbhsotg_hwmod = {
+   .name   = "usb_otg_hs",
+   .mpu_irqs   = omap2430_usbhsotg_mpu_irqs,
+   .mpu_irqs_cnt   = ARRAY_SIZE(omap2430_usbhsotg_mpu_irqs),
+   .main_clk   = "usbhs_ick",
+   .prcm   = {
+   .omap2 = {
+   .prcm_reg_id = 1,
+   .module_bit = OMAP2430_EN_USBHS_MASK,
+   .module_offs = CORE_MOD,
+   .idlest_reg_id = 1,
+   .idlest_idle_bit = OMAP2430_ST_USBHS_SHIFT,
+   },
+   },
+   .masters= omap2430_usbhsotg_masters,
+   .masters_cnt= ARRAY_SIZE(omap2430_usbhsotg_masters),
+   .slaves = omap2430_usbhsotg_slaves,
+   .slaves_cnt = ARRAY_SIZE(omap2430_usbhsotg_slaves),
+   .class  = &usbotg_class,
+   /*
+* Erratum ID: i479  idle_req / idle_ack mechanism potentially
+* broken when autoidle is enabled
+* workaround is to disable the autoidle bit at module level.
+*/
+   .flags  = HWMOD_NO_OCP_AUTOIDLE | HWMOD_SWSUP_SIDLE
+   | HWMOD_SWSUP_MST

[PATCH 2/5 v5] OMAP3xxx: hwmod data: Add USBOTG

2010-12-10 Thread Hema HK
OMAP3 hwmod data structures are populated for USBOTG with base address,
L3 and L4 interface clocks, IRQs and sysconfig register details.

As per OMAP USBOTG specification, need to configure the USBOTG
to smart idle/standby or no idle/standby during data transfer and
force idle/standby when not in use to support retention and offmode.
By setting HWMOD_SWSUP_SIDLE and HWMOD_SWSUP_MSTANDBY flags, framework
will take care of configuring to no idle/standby when module is enabled
and force idle/standby when idled.

Signed-off-by: Hema HK 
Cc: Felipe Balbi 
Cc: Tony Lindgren 
Cc: Kevin Hilman 
Cc: Cousson, Benoit 
Cc: Paul Walmsley 
---
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |  100 +
 1 file changed, 100 insertions(+)

Index: usb/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
===
--- usb.orig/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+++ usb/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
@@ -89,6 +89,15 @@ static struct omap_hwmod omap3xxx_uart1_
 static struct omap_hwmod omap3xxx_uart2_hwmod;
 static struct omap_hwmod omap3xxx_uart3_hwmod;
 static struct omap_hwmod omap3xxx_uart4_hwmod;
+static struct omap_hwmod omap3xxx_usbhsotg_hwmod;
+
+/* l3_core -> usbhsotg interface */
+static struct omap_hwmod_ocp_if omap3xxx_usbhsotg__l3 = {
+   .master = &omap3xxx_usbhsotg_hwmod,
+   .slave  = &omap3xxx_l3_main_hwmod,
+   .clk= "core_l3_ick",
+   .user   = OCP_USER_MPU,
+};
 
 /* L4_CORE -> L4_WKUP interface */
 static struct omap_hwmod_ocp_if omap3xxx_l4_core__l4_wkup = {
@@ -169,6 +178,36 @@ static struct omap_hwmod_ocp_if omap3_l4
.user   = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
+/*
+* usbhsotg interface data
+*/
+
+static struct omap_hwmod_addr_space omap3xxx_usbhsotg_addrs[] = {
+   {
+   .pa_start   = OMAP34XX_HSUSB_OTG_BASE,
+   .pa_end = OMAP34XX_HSUSB_OTG_BASE + SZ_4K - 1,
+   .flags  = ADDR_TYPE_RT
+   },
+};
+
+/* l4_core -> usbhsotg  */
+static struct omap_hwmod_ocp_if omap3xxx_l4_core__usbhsotg = {
+   .master = &omap3xxx_l4_core_hwmod,
+   .slave  = &omap3xxx_usbhsotg_hwmod,
+   .clk= "l4_ick",
+   .addr   = omap3xxx_usbhsotg_addrs,
+   .addr_cnt   = ARRAY_SIZE(omap3xxx_usbhsotg_addrs),
+   .user   = OCP_USER_MPU,
+};
+
+static struct omap_hwmod_ocp_if *omap3xxx_usbhsotg_masters[] = {
+   &omap3xxx_usbhsotg__l3,
+};
+
+static struct omap_hwmod_ocp_if *omap3xxx_usbhsotg_slaves[] = {
+   &omap3xxx_l4_core__usbhsotg,
+};
+
 /* Slave interfaces on the L4_CORE interconnect */
 static struct omap_hwmod_ocp_if *omap3xxx_l4_core_slaves[] = {
&omap3xxx_l3_main__l4_core,
@@ -509,6 +548,64 @@ static struct omap_hwmod omap3xxx_uart4_
.omap_chip  = OMAP_CHIP_INIT(CHIP_IS_OMAP3630ES1),
 };
 
+/*
+ * usbhsotg
+ */
+static struct omap_hwmod_class_sysconfig omap3xxx_usbhsotg_sysc = {
+   .rev_offs   = 0x0400,
+   .sysc_offs  = 0x0404,
+   .syss_offs  = 0x0408,
+   .sysc_flags = (SYSC_HAS_SIDLEMODE | SYSC_HAS_MIDLEMODE|
+ SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET |
+ SYSC_HAS_AUTOIDLE),
+   .idlemodes  = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
+ MSTANDBY_FORCE | MSTANDBY_NO | MSTANDBY_SMART),
+   .sysc_fields= &omap_hwmod_sysc_type1,
+};
+
+static struct omap_hwmod_class usbotg_class = {
+   .name = "usbotg",
+   .sysc = &omap3xxx_usbhsotg_sysc,
+};
+
+/* usb_otg_hs */
+static struct omap_hwmod_irq_info omap3xxx_usbhsotg_mpu_irqs[] = {
+
+   { .name = "mc", .irq = 92 },
+   { .name = "dma", .irq = 93 },
+};
+
+static struct omap_hwmod omap3xxx_usbhsotg_hwmod = {
+   .name   = "usb_otg_hs",
+   .mpu_irqs   = omap3xxx_usbhsotg_mpu_irqs,
+   .mpu_irqs_cnt   = ARRAY_SIZE(omap3xxx_usbhsotg_mpu_irqs),
+   .main_clk   = "hsotgusb_ick",
+   .prcm   = {
+   .omap2 = {
+   .prcm_reg_id = 1,
+   .module_bit = OMAP3430_EN_HSOTGUSB_SHIFT,
+   .module_offs = CORE_MOD,
+   .idlest_reg_id = 1,
+   .idlest_idle_bit = OMAP3430ES2_ST_HSOTGUSB_IDLE_SHIFT,
+   .idlest_stdby_bit = OMAP3430ES2_ST_HSOTGUSB_STDBY_SHIFT
+   },
+   },
+   .masters= omap3xxx_usbhsotg_masters,
+   .masters_cnt= ARRAY_SIZE(omap3xxx_usbhsotg_masters),
+   .slaves = omap3xxx_usbhsotg_slaves,
+   .slaves_cnt = ARRAY_SIZE(omap3xxx_usbhsotg_slaves),
+   .class  = &usbotg_class,
+
+   /*
+* Erratum ID: i479  idle_req / idle_ack mechanism potentially
+* broken when autoidle is enabled
+* workaround is to disable the autoidle bit at module level.
+*/
+   

[PATCH 3/5 v5] OMAP4430: hwmod data: Adding USBOTG

2010-12-10 Thread Hema HK
From: Cousson, Benoit 

OMAP4 hwmod data structures are populated with base address, L3 and L4
interface clocks, IRQs and sysconfig register details.

As per OMAP USBOTG specification, need to configure the USBOTG
to smart idle/standby or no idle/standby during data transfer and
force idle/standby when not in use to support retention and offmode.
By setting HWMOD_SWSUP_SIDLE and HWMOD_SWSUP_MSTANDBY flags,framework
will take care of configuring to no idle/standby when module is enabled
and force idle/standby when idled.

Signed-off-by: Cousson, Benoit 
Signed-off-by: Hema HK 
Cc: Felipe Balbi 
Cc: Tony Lindgren 
Cc: Kevin Hilman 
Cc: Cousson, Benoit 
Cc: Paul Walmsley 
---
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c |   94 +
 1 file changed, 94 insertions(+)

Index: usb/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
===
--- usb.orig/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ usb/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -47,6 +47,7 @@ static struct omap_hwmod omap44xx_l4_per
 static struct omap_hwmod omap44xx_l4_wkup_hwmod;
 static struct omap_hwmod omap44xx_mpu_hwmod;
 static struct omap_hwmod omap44xx_mpu_private_hwmod;
+static struct omap_hwmod omap44xx_usb_otg_hs_hwmod;
 
 /*
  * Interconnects omap_hwmod structures
@@ -223,10 +224,19 @@ static struct omap_hwmod_ocp_if omap44xx
.user   = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
+/* usb_otg_hs -> l3_main_2 */
+static struct omap_hwmod_ocp_if omap44xx_usb_otg_hs__l3_main_2 = {
+   .master = &omap44xx_usb_otg_hs_hwmod,
+   .slave  = &omap44xx_l3_main_2_hwmod,
+   .clk= "l3_div_ck",
+   .user   = OCP_USER_MPU | OCP_USER_SDMA,
+};
+
 /* l3_main_2 slave ports */
 static struct omap_hwmod_ocp_if *omap44xx_l3_main_2_slaves[] = {
&omap44xx_l3_main_1__l3_main_2,
&omap44xx_l4_cfg__l3_main_2,
+   &omap44xx_usb_otg_hs__l3_main_2,
 };
 
 static struct omap_hwmod omap44xx_l3_main_2_hwmod = {
@@ -811,6 +821,87 @@ static struct omap_hwmod omap44xx_uart4_
.omap_chip  = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
+/*
+ * 'usb_otg_hs' class
+ * high-speed on-the-go universal serial bus (usb_otg_hs) controller
+ */
+
+static struct omap_hwmod_class_sysconfig omap44xx_usb_otg_hs_sysc = {
+   .rev_offs   = 0x0400,
+   .sysc_offs  = 0x0404,
+   .syss_offs  = 0x0408,
+   .sysc_flags = (SYSC_HAS_SIDLEMODE | SYSC_HAS_MIDLEMODE|
+ SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET |
+ SYSC_HAS_AUTOIDLE),
+   .idlemodes  = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
+ MSTANDBY_FORCE | MSTANDBY_NO | MSTANDBY_SMART),
+   .sysc_fields= &omap_hwmod_sysc_type1,
+};
+
+static struct omap_hwmod_class omap44xx_usb_otg_hs_hwmod_class = {
+   .name = "usb_otg_hs",
+   .sysc = &omap44xx_usb_otg_hs_sysc,
+};
+
+/* usb_otg_hs */
+static struct omap_hwmod_irq_info omap44xx_usb_otg_hs_irqs[] = {
+   { .name = "mc", .irq = 92 + OMAP44XX_IRQ_GIC_START },
+   { .name = "dma", .irq = 93 + OMAP44XX_IRQ_GIC_START },
+};
+
+/* usb_otg_hs master ports */
+static struct omap_hwmod_ocp_if *omap44xx_usb_otg_hs_masters[] = {
+   &omap44xx_usb_otg_hs__l3_main_2,
+};
+
+static struct omap_hwmod_addr_space omap44xx_usb_otg_hs_addrs[] = {
+   {
+   .pa_start   = OMAP44XX_HSUSB_OTG_BASE,
+   .pa_end = OMAP44XX_HSUSB_OTG_BASE + SZ_4K - 1,
+   .flags  = ADDR_TYPE_RT
+   },
+};
+
+/* l4_cfg -> usb_otg_hs */
+static struct omap_hwmod_ocp_if omap44xx_l4_cfg__usb_otg_hs = {
+   .master = &omap44xx_l4_cfg_hwmod,
+   .slave  = &omap44xx_usb_otg_hs_hwmod,
+   .clk= "l4_div_ck",
+   .addr   = omap44xx_usb_otg_hs_addrs,
+   .addr_cnt   = ARRAY_SIZE(omap44xx_usb_otg_hs_addrs),
+   .user   = OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+/* usb_otg_hs slave ports */
+static struct omap_hwmod_ocp_if *omap44xx_usb_otg_hs_slaves[] = {
+   &omap44xx_l4_cfg__usb_otg_hs,
+};
+
+static struct omap_hwmod_opt_clk usb_otg_hs_opt_clks[] = {
+   { .role = "xclk", .clk = "otg_60m_gfclk_ck" },
+};
+
+static struct omap_hwmod omap44xx_usb_otg_hs_hwmod = {
+   .name   = "usb_otg_hs",
+   .class  = &omap44xx_usb_otg_hs_hwmod_class,
+   .mpu_irqs   = omap44xx_usb_otg_hs_irqs,
+   .mpu_irqs_cnt   = ARRAY_SIZE(omap44xx_usb_otg_hs_irqs),
+   .main_clk   = "usb_otg_hs_ick",
+   .prcm = {
+   .omap4 = {
+   .clkctrl_reg = OMAP4430_CM_L3INIT_USB_OTG_CLKCTRL,
+   },
+   },
+   .opt_clks   = usb_otg_hs_opt_clks,
+   .opt_clks_cnt = ARRAY_SIZE(usb_otg_hs_opt_clks),
+   .slaves = omap44xx_usb_otg_hs_slaves,
+   .slaves_cnt = ARRAY_SIZE(omap44xx_usb_otg_hs_slaves),
+   .masters= 

Subject: [PATCH 0/5 v5]usb: musb: hwmod and runtime pm support for musb

2010-12-10 Thread Hema HK
This patch series makes OMAP2PLUS musb module implemented
in HWMOD FW way. It also implements musb driver to
use the runtime pm apis.

As per the OMAP usbotg specification[1] musb sysconfig register
has to be set to force idle and force standby when not used
and set smart idle/standby or no idle/standby during operation.
otherwise core-off will be prevented by musb.

[1]: http://focus.ti.com/pdfs/wtbu/SWPU223D_Final_EPDF_06_07_2010.pdf

This patch series is based on V2.6.37-rc4 + [2]+[3]+[4]

[2] http://www.listware.net/201011/linux-usb/
65625-patch-resend-v3-usb-musb-do-not-use-dma-for-control-transfers.html

[3] Felipe's musb-reorg patch series.
http://gitorious.org/usb/usb/commits/musb-hw

[4] usb: otg: TWL6030: OMAP4430: musb & transceiver driver support
for OMAP4 posted by me.

with this patch series tested musb functionality like testusb, masstorage
OMAP4430SDP, OMAP3630 zoom3, OMAP3430 SDP

Power management tests like retention and offmode validation tests are not
done with these patches.
There will be another set of patches submitted with PM on musb.

Version History:
---
Version V5:

Fixed review comments from Felipe.


Version V4:

Rebased the changes based on the re-orgnized patches submitted by Felipe.
Fixed review comments received for V3.
Dropped the idlepath  power management patch with this series.

Some of the links for V3 review comments:

https://patchwork.kernel.org/patch/199482/
http://www.mail-archive.com/linux-omap@vger.kernel.org/msg35488.html
http://www.mail-archive.com/linux-omap@vger.kernel.org/msg33201.html
http://www.mail-archive.com/linux-omap@vger.kernel.org/msg35387.html

Version V3

Added the patch for adding the hwmod database for OMAP2430.
Re-arranged the patches in such a way that first migrate the musb driver
to use the runtime PM apis and then added a patch to support offmode in idle 
path.
Calling the runtime PM apis before disbaling the interupts in the idle path.
Added the #ifdef CONFIG_PM_RUNTIME  check in the musb core driver for calling 
the runtime PM APIs as non-omap platforms may not have the runtime pm enabled
and clk_enable/disable should be called for them.

Optimized the context save restore of musb registers only if the next state is
going to offmode and previous state was offmode.

Some of the links for V2 review comments

http://www.mail-archive.com/linux-omap@vger.kernel.org/msg34068.html
http://www.mail-archive.com/linux-omap@vger.kernel.org/msg32024.html
http://www.spinics.net/lists/linux-usb/msg35562.html
http://www.spinics.net/lists/linux-usb/msg35720.html

Vesrion v2:

Fixed review comments.
Removed the omap_hwmod.h inclusion from musb.h file which was 
breaking the non-omap platform build.
Using the runtime pm apis in the idle path(interrupts disabled).
Added the omap4 hwmod data base.

Version v1:
initial version of the patch series.

Some of the links for v1


http://www.spinics.net/lists/linux-usb/msg34570.html
http://www.spinics.net/lists/linux-omap/msg34568.html
http://www.spinics.net/lists/linux-usb/msg34544.html
http://www.spinics.net/lists/linux-usb/msg34540.html
http://www.spinics.net/lists/linux-usb/msg34589.html
http://www.spinics.net/lists/linux-usb/msg34554.html
http://www.mail-archive.com/linux-omap@vger.kernel.org/msg32973.html

Signed-off-by: Hema HK 
Cc: Felipe Balbi 
Cc: Tony Lindgren 
Cc: Kevin Hilman 
Cc: Cousson, Benoit 
Cc: Paul Walmsley 
---

Cousson, Benoit (1):
   OMAP4430: hwmod data: Adding USBOTG

Hema HK (4):
  OMAP2430: hwmod data: Add USBOTG
  OMAP3xxx: hwmod data: Add USBOTG
  OMAP2+: musb: HWMOD adaptation for musb.
  usb: musb: Using runtime pm APIs for musb.

  arch/arm/mach-omap2/omap_hwmod_2430_data.c |   97 +++
  arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |  100 
  arch/arm/mach-omap2/omap_hwmod_44xx_data.c |   94 ++
  arch/arm/mach-omap2/usb-musb.c |   66 ++
  drivers/usb/musb/musb_core.h   |2 +-
  drivers/usb/musb/omap2430.c|   77 +
  6 files changed, 362 insertions(+), 74 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


Re: [PATCH v4] usb: musb: Adding names for IRQs in resource structure

2010-12-10 Thread Felipe Balbi

Hi,

On Fri, Dec 10, 2010 at 04:35:14PM +0300, Sergei Shtylyov wrote:

Index: linux-omap-pm/arch/arm/mach-davinci/usb.c
===
--- linux-omap-pm.orig/arch/arm/mach-davinci/usb.c
+++ linux-omap-pm/arch/arm/mach-davinci/usb.c
@@ -64,10 +64,12 @@ static struct resource usb_resources[] =
{
.start = IRQ_USBINT,
.flags = IORESOURCE_IRQ,
+ .name = "mc"
},
{
/* placeholder for the dedicated CPPI IRQ */
.flags = IORESOURCE_IRQ,
+ .name = "dma"
},
};



Argh! This failed to also modify da8xx_usb20_resources[]... :-(



I think when I posted these patch, da8xx support was not there in mainline.



No, it was added long ago, before the glue layer itself.



I will send patch to add this.



I will care about this myself now.



Thanks, send me the patch and I'll put to the same branch.


  I was thinking about pushing this thru the DaVinci tree. Well, I'll 
post to both lists and let you figure out who will apply it... :-)


If Kevin picks it up, fine by me :-)

--
balbi
--
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


Re: [PATCH v4] usb: musb: Adding names for IRQs in resource structure

2010-12-10 Thread Sergei Shtylyov

Hello.

On 10-12-2010 16:20, Felipe Balbi wrote:


The resource data is getting automatically populated from a set of data
generated from TI's hardware database for the OMAP platform, While we
could hack in some exceptions to that tool to generate resources
in a specific order, it seems less fragile to use the resource name
instead.That way, no matter what order the resources are generated, the
driver still work.



Modified the OMAP,Blackfin and Davinci architecture files to add the name
of the IRQs
in the resource structures and musb driver to use the get_irq_byname()
api to
get the device and dma irq numbers instead of using the index.



Signed-off-by: Hema HK
Cc: Felipe Balbi
Cc: Tony Lindgren
Cc: Kevin Hilman
Cc: Cousson, Benoit
Cc: Paul Walmsley
Cc: Mike Frysinger
---



For the davinci changes:



Acked-by: Kevin Hilman



Kevin



[...]



Index: linux-omap-pm/arch/arm/mach-davinci/usb.c
===
--- linux-omap-pm.orig/arch/arm/mach-davinci/usb.c
+++ linux-omap-pm/arch/arm/mach-davinci/usb.c
@@ -64,10 +64,12 @@ static struct resource usb_resources[] =
{
.start = IRQ_USBINT,
.flags = IORESOURCE_IRQ,
+ .name = "mc"
},
{
/* placeholder for the dedicated CPPI IRQ */
.flags = IORESOURCE_IRQ,
+ .name = "dma"
},
};



Argh! This failed to also modify da8xx_usb20_resources[]... :-(



I think when I posted these patch, da8xx support was not there in mainline.



No, it was added long ago, before the glue layer itself.



I will send patch to add this.



I will care about this myself now.



Thanks, send me the patch and I'll put to the same branch.


   I was thinking about pushing this thru the DaVinci tree. Well, I'll post 
to both lists and let you figure out who will apply it... :-)


WBR, Sergei
--
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


Re: [PATCH 5/5 v4] usb: musb: Using runtime pm APIs for musb.

2010-12-10 Thread Kalliguddi, Hema
On Fri, Dec 10, 2010 at 6:29 PM, Felipe Balbi  wrote:
> Hi,
>
> On Fri, Dec 10, 2010 at 06:23:46PM +0530, Hema HK wrote:
>>
>> @@ -429,28 +392,29 @@ static int __init omap2430_probe(struct
>>                        pdev->num_resources);
>>        if (ret) {
>>                dev_err(&pdev->dev, "failed to add resources\n");
>> -               goto err4;
>> +               goto err2;
>>        }
>>
>>        ret = platform_device_add_data(musb, pdata, sizeof(*pdata));
>>        if (ret) {
>>                dev_err(&pdev->dev, "failed to add platform_data\n");
>> -               goto err4;
>> +               goto err2;
>>        }
>>
>>        ret = platform_device_add(musb);
>>        if (ret) {
>>                dev_err(&pdev->dev, "failed to register musb device\n");
>> -               goto err4;
>> +               goto err2;
>>        }
>>
>> -       return 0;
>> +       pm_runtime_enable(&pdev->dev);
>> +       if (pm_runtime_get_sync(dev)) {
>> +               dev_err(dev, "pm_runtime_get_sync FAILED");
>> +               goto err2;
>> +       }
>
> don't you have to pm_runtime_disable() if get_sync fails ?

Yes. That is require. Otherwise next time driver load will through warning.
Thanks for pointing this out.
>
>> @@ -468,8 +432,7 @@ static int __exit omap2430_remove(struct
>>
>>        platform_device_del(glue->musb);
>>        platform_device_put(glue->musb);
>> -       clk_disable(glue->clk);
>> -       clk_put(glue->clk);
>> +       pm_runtime_put_sync(&pdev->dev);
>
> same here, don't you need to pm_runtime_disable() ??
Yes.

Regards,
Hema
>
> --
> balbi
>
--
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


Re: [PATCH 6/8 V3] usb: otg: TWL6030: Add twl6030_usb file for compilation

2010-12-10 Thread Sergei Shtylyov

Hello.

On 10-12-2010 15:40, Hema HK wrote:


Add the twl6030_usb transceiver file for compilation.



Signed-off-by: Hema HK
Cc: Felipe Balbi



Index: usb/drivers/usb/otg/Makefile
===
--- usb.orig/drivers/usb/otg/Makefile
+++ usb/drivers/usb/otg/Makefile
@@ -12,6 +12,7 @@ obj-$(CONFIG_USB_OTG_UTILS)   += otg.o
  obj-$(CONFIG_USB_GPIO_VBUS)   += gpio_vbus.o
  obj-$(CONFIG_ISP1301_OMAP)+= isp1301_omap.o
  obj-$(CONFIG_TWL4030_USB) += twl4030-usb.o
+obj-$(CONFIG_TWL6030_USB)  += twl6030-usb.o


   Why not do it in the patch 3, along with adding the Kconfig entry?! Or 
even in patch 2, along with the driver itself? Why "smear" these simple things 
it over N patches?!


WBR, Sergei
--
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


Re: [PATCH 4/5 v4] OMAP2+: musb: HWMOD adaptation for musb.

2010-12-10 Thread Kalliguddi, Hema
On Fri, Dec 10, 2010 at 6:32 PM, Felipe Balbi  wrote:
> Hi,
>
> On Fri, Dec 10, 2010 at 06:23:10PM +0530, Hema HK wrote:
>>
>> @@ -212,8 +228,28 @@ void __init usb_musb_init(struct omap_mu
>>        musb_plat.mode = board_data->mode;
>>        musb_plat.extvbus = board_data->extvbus;
>>
>> -       if (platform_device_register(&musb_device) < 0)
>> -               printk(KERN_ERR "Unable to register HS-USB (MUSB)
>> device\n");
>> +       if (cpu_is_omap3517() || cpu_is_omap3505()) {
>> +
>> +               if (platform_device_register(&musb_device) < 0)
>> +                       printk(KERN_ERR "Unable to register HS-USB \
>> +                                       (MUSB) device\n");
>> +       } else {
>
> you can amend these two branches to the previous one. move the
> platform_device_register() to the previous if (cpu_is_omap3517() ||
> cpu_is_omap3505()) check. similarly with the code below.

Yes... Can be done.

Regards,
Hema
>
>> +               pdata = &musb_plat;
>> +               od = omap_device_build(name, bus_id, oh, pdata,
>> +                                      sizeof(*pdata), omap_musb_latency,
>> +                                      ARRAY_SIZE(omap_musb_latency),
>> false);
>> +               if (IS_ERR(od)) {
>> +                       pr_err("Could not build omap_device for %s %s\n",
>> +                                                       name, oh_name);
>> +                       return;
>> +               }
>> +               pdev = &od->pdev;
>> +               dev = &pdev->dev;
>> +               get_device(dev);
>> +               dev->dma_mask = &musb_dmamask;
>> +               dev->coherent_dma_mask = musb_dmamask;
>> +               put_device(dev);
>> +       }
>> }
>>
>> #else
>
> --
> balbi
>
--
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


Re: [PATCH 3/8 V3] usb: otg: Kconfig: Add Kconfig option for TWL6030 transceiver.

2010-12-10 Thread Sergei Shtylyov

Hello.

On 10-12-2010 15:38, Hema HK wrote:


Added the TWL6030-usb transceiver option in the Kconfig



Signed-off-by: Hema HK
Cc: Felipe Balbi
Cc: David Brownell

[...]


Index: usb/drivers/usb/otg/Kconfig
===
--- usb.orig/drivers/usb/otg/Kconfig
+++ usb/drivers/usb/otg/Kconfig
@@ -59,6 +59,18 @@ config TWL4030_USB
  This transceiver supports high and full speed devices plus,
  in host mode, low speed.

+config TWL6030_USB
+   tristate "TWL6030 USB Transceiver Driver"
+   depends on TWL4030_CORE
+   select USB_OTG_UTILS
+   help
+ Enable this to support the USB OTG transceiver on TWL6030
+ family chips. This TWL6030 transceiver has the VBUS and ID GND
+ and OTG SRP events capabilities. For all other transceiver 
functionality
+ UTMI PHY is embedded in OMAP4430. The internal PHY configurations APIs
+ are hooked to this driver through platform_data structure.
+ The definition of internal PHY APIs are in the mach-omap2 layer.
+


   Why not do it in the patch 2, together with the driver itself? And where 
are you adding the driver to drivers/usb/otg/Makefile?


WBR, Sergei
--
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


Re: [PATCH v4] usb: musb: Adding names for IRQs in resource structure

2010-12-10 Thread Felipe Balbi

On Fri, Dec 10, 2010 at 03:56:27PM +0300, Sergei Shtylyov wrote:

Hello.

On 10-12-2010 7:46, Kalliguddi, Hema wrote:


The resource data is getting automatically populated from a set of data
generated from TI's hardware database for the OMAP platform, While we
could hack in some exceptions to that tool to generate resources
in a specific order, it seems less fragile to use the resource name
instead.That way, no matter what order the resources are generated, the
driver still work.



Modified the OMAP,Blackfin and Davinci architecture files to add the name
of the IRQs
in the resource structures and musb driver to use the get_irq_byname()
api to
get the device and dma irq numbers instead of using the index.



Signed-off-by: Hema HK
Cc: Felipe Balbi
Cc: Tony Lindgren
Cc: Kevin Hilman
Cc: Cousson, Benoit
Cc: Paul Walmsley
Cc: Mike Frysinger
---



For the davinci changes:



Acked-by: Kevin Hilman



Kevin



[...]



Index: linux-omap-pm/arch/arm/mach-davinci/usb.c
===
--- linux-omap-pm.orig/arch/arm/mach-davinci/usb.c
+++ linux-omap-pm/arch/arm/mach-davinci/usb.c
@@ -64,10 +64,12 @@ static struct resource usb_resources[] =
   {
   .start  = IRQ_USBINT,
   .flags  = IORESOURCE_IRQ,
+   .name   = "mc"
   },
   {
   /* placeholder for the dedicated CPPI IRQ */
   .flags  = IORESOURCE_IRQ,
+   .name   = "dma"
   },
 };



  Argh! This failed to also modify da8xx_usb20_resources[]... :-(



I think when I posted these patch, da8xx support was not there in mainline.


  No, it was added long ago, before the glue layer itself.


I will send patch to add this.


  I will care about this myself now.


Thanks, send me the patch and I'll put to the same branch.

--
balbi
--
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


Re: [PATCH v4] usb: musb: Adding names for IRQs in resource structure

2010-12-10 Thread Kalliguddi, Hema
On Fri, Dec 10, 2010 at 6:26 PM, Sergei Shtylyov  wrote:
> Hello.
>
> On 10-12-2010 7:46, Kalliguddi, Hema wrote:
>
> The resource data is getting automatically populated from a set of data
> generated from TI's hardware database for the OMAP platform, While we
> could hack in some exceptions to that tool to generate resources
> in a specific order, it seems less fragile to use the resource name
> instead.That way, no matter what order the resources are generated, the
> driver still work.
>
> Modified the OMAP,Blackfin and Davinci architecture files to add the
> name
> of the IRQs
> in the resource structures and musb driver to use the get_irq_byname()
> api to
> get the device and dma irq numbers instead of using the index.
>
> Signed-off-by: Hema HK
> Cc: Felipe Balbi
> Cc: Tony Lindgren
> Cc: Kevin Hilman
> Cc: Cousson, Benoit
> Cc: Paul Walmsley
> Cc: Mike Frysinger
> ---
>
 For the davinci changes:
>
 Acked-by: Kevin Hilman
>
 Kevin
>
>>> [...]
>
> Index: linux-omap-pm/arch/arm/mach-davinci/usb.c
> ===
> --- linux-omap-pm.orig/arch/arm/mach-davinci/usb.c
> +++ linux-omap-pm/arch/arm/mach-davinci/usb.c
> @@ -64,10 +64,12 @@ static struct resource usb_resources[] =
>        {
>                .start          = IRQ_USBINT,
>                .flags          = IORESOURCE_IRQ,
> +               .name           = "mc"
>        },
>        {
>                /* placeholder for the dedicated CPPI IRQ */
>                .flags          = IORESOURCE_IRQ,
> +               .name           = "dma"
>        },
>  };
>
>>>   Argh! This failed to also modify da8xx_usb20_resources[]... :-(
>
>> I think when I posted these patch, da8xx support was not there in
>> mainline.
>
>   No, it was added long ago, before the glue layer itself.
>
>> I will send patch to add this.
>
>   I will care about this myself now.
Thanks.
Hema
>
>> Regards,
>> Hema
>
> WBR, Sergei
>
--
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


Re: [PATCH 0/8 V3] usb: otg: TWL6030: OMAP4430: musb & transceiver driver support for OMAP4

2010-12-10 Thread Felipe Balbi

On Fri, Dec 10, 2010 at 05:54:34PM +0530, Hema HK wrote:

This patch series has the support for TWL6030-usb
transceiver driver and changes in the musb driver to make it functional
with OMAP4430.

OMAP4 musb support UTMI and ULPI transceiver interfaces.

In UTMI mode, the transceiver functionality is split between
the TWL6030 PMIC chip and OMAP4 embedded PHY.
The TWL6030 transceiver driver code is under otg folder and
internal UTMI PHY specific code changes are defined under
mach-omap2 directory and functions are passed through platform_data
structure.

This patch series is based on V2.6.37-rc4 + [1]+[2]

[1] http://www.listware.net/201011/linux-usb/
65625-patch-resend-v3-usb-musb-do-not-use-dma-for-control-transfers.html

[2] Felipe's musb-reorg patch series.
http://gitorious.org/usb/usb/commits/musb-hw

Tested musb device and host mode functionality with OMAP4430SDP
and OMAP3630 ZOOM3.

Limitation: In OTG and Host only mode, when the device is connected
during boot will not be detected.
Need connect the device only after the boot. Or disconnect and connect
it back if it connected during boot.
Fix for this will be submitted later.

Version History:
---
Version3 changes:
- Rearranged the patches to avoid the git bisect failure.

Version 2 changes:
- Removed the dependency on the atomic notifier patches from Arnaud.
- Fixed review comments from Felipe and Sergei.
- Modified the vbus_set function to set timeout when musb is not configured
as A device.


This series is applied but I still have to test, so I could still drop
heh.

--
balbi
--
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


Re: [PATCH 4/5 v4] OMAP2+: musb: HWMOD adaptation for musb.

2010-12-10 Thread Felipe Balbi

Hi,

On Fri, Dec 10, 2010 at 06:23:10PM +0530, Hema HK wrote:

@@ -212,8 +228,28 @@ void __init usb_musb_init(struct omap_mu
musb_plat.mode = board_data->mode;
musb_plat.extvbus = board_data->extvbus;

-   if (platform_device_register(&musb_device) < 0)
-   printk(KERN_ERR "Unable to register HS-USB (MUSB) device\n");
+   if (cpu_is_omap3517() || cpu_is_omap3505()) {
+
+   if (platform_device_register(&musb_device) < 0)
+   printk(KERN_ERR "Unable to register HS-USB \
+   (MUSB) device\n");
+   } else {


you can amend these two branches to the previous one. move the
platform_device_register() to the previous if (cpu_is_omap3517() ||
cpu_is_omap3505()) check. similarly with the code below.


+   pdata = &musb_plat;
+   od = omap_device_build(name, bus_id, oh, pdata,
+  sizeof(*pdata), omap_musb_latency,
+  ARRAY_SIZE(omap_musb_latency), false);
+   if (IS_ERR(od)) {
+   pr_err("Could not build omap_device for %s %s\n",
+   name, oh_name);
+   return;
+   }
+   pdev = &od->pdev;
+   dev = &pdev->dev;
+   get_device(dev);
+   dev->dma_mask = &musb_dmamask;
+   dev->coherent_dma_mask = musb_dmamask;
+   put_device(dev);
+   }
}

#else


--
balbi
--
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


Re: [PATCH 5/5 v4] usb: musb: Using runtime pm APIs for musb.

2010-12-10 Thread Felipe Balbi

Hi,

On Fri, Dec 10, 2010 at 06:23:46PM +0530, Hema HK wrote:

@@ -429,28 +392,29 @@ static int __init omap2430_probe(struct
pdev->num_resources);
if (ret) {
dev_err(&pdev->dev, "failed to add resources\n");
-   goto err4;
+   goto err2;
}

ret = platform_device_add_data(musb, pdata, sizeof(*pdata));
if (ret) {
dev_err(&pdev->dev, "failed to add platform_data\n");
-   goto err4;
+   goto err2;
}

ret = platform_device_add(musb);
if (ret) {
dev_err(&pdev->dev, "failed to register musb device\n");
-   goto err4;
+   goto err2;
}

-   return 0;
+   pm_runtime_enable(&pdev->dev);
+   if (pm_runtime_get_sync(dev)) {
+   dev_err(dev, "pm_runtime_get_sync FAILED");
+   goto err2;
+   }


don't you have to pm_runtime_disable() if get_sync fails ?


@@ -468,8 +432,7 @@ static int __exit omap2430_remove(struct

platform_device_del(glue->musb);
platform_device_put(glue->musb);
-   clk_disable(glue->clk);
-   clk_put(glue->clk);
+   pm_runtime_put_sync(&pdev->dev);


same here, don't you need to pm_runtime_disable() ??

--
balbi
--
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


Re: [PATCH v4] usb: musb: Adding names for IRQs in resource structure

2010-12-10 Thread Sergei Shtylyov

Hello.

On 10-12-2010 7:46, Kalliguddi, Hema wrote:


The resource data is getting automatically populated from a set of data
generated from TI's hardware database for the OMAP platform, While we
could hack in some exceptions to that tool to generate resources
in a specific order, it seems less fragile to use the resource name
instead.That way, no matter what order the resources are generated, the
driver still work.



Modified the OMAP,Blackfin and Davinci architecture files to add the name
of the IRQs
in the resource structures and musb driver to use the get_irq_byname()
api to
get the device and dma irq numbers instead of using the index.



Signed-off-by: Hema HK
Cc: Felipe Balbi
Cc: Tony Lindgren
Cc: Kevin Hilman
Cc: Cousson, Benoit
Cc: Paul Walmsley
Cc: Mike Frysinger
---



For the davinci changes:



Acked-by: Kevin Hilman



Kevin



[...]



Index: linux-omap-pm/arch/arm/mach-davinci/usb.c
===
--- linux-omap-pm.orig/arch/arm/mach-davinci/usb.c
+++ linux-omap-pm/arch/arm/mach-davinci/usb.c
@@ -64,10 +64,12 @@ static struct resource usb_resources[] =
{
.start  = IRQ_USBINT,
.flags  = IORESOURCE_IRQ,
+   .name   = "mc"
},
{
/* placeholder for the dedicated CPPI IRQ */
.flags  = IORESOURCE_IRQ,
+   .name   = "dma"
},
  };



   Argh! This failed to also modify da8xx_usb20_resources[]... :-(



I think when I posted these patch, da8xx support was not there in mainline.


   No, it was added long ago, before the glue layer itself.


I will send patch to add this.


   I will care about this myself now.


Regards,
Hema


WBR, Sergei
--
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


Re: [PATCH 7/8 V2] usb: musb: Adding musb support for OMAP4430

2010-12-10 Thread Felipe Balbi

On Fri, Dec 10, 2010 at 02:51:34PM +0200, Felipe Balbi wrote:

On Fri, Dec 10, 2010 at 06:10:51PM +0530, Hema HK wrote:

@@ -214,9 +235,62 @@ static inline void omap2430_low_level_in
musb_writel(musb->mregs, OTG_FORCESTDBY, l);
}

+/* blocking notifier support */
+static int musb_otg_notifications(struct notifier_block *nb,
+   unsigned long event, void *unused)
+{
+   struct musb *musb = container_of(nb, struct musb, nb);
+   struct device *dev = musb->controller;
+   struct musb_hdrc_platform_data *pdata = dev->platform_data;
+   struct omap_musb_board_data *data = pdata->board_data;
+
+   switch (event) {
+   case USB_EVENT_ID:
+   DBG(4, "ID GND\n");
+
+   if (is_otg_enabled(musb)) {
+   if (musb->gadget_driver) {


This breaks compilation:

drivers/usb/musb/omap2430.c: In function 'musb_otg_notifications':
drivers/usb/musb/omap2430.c:252: error: 'struct musb' has no member
named 'gadget_driver'
make[2]: *** [drivers/usb/musb/omap2430.o] Error 1
make[2]: *** Waiting for unfinished jobs
make[1]: *** [drivers/usb/musb] Error 2
make: *** [drivers] Error 2

you need to ifdef that.


fixed it already. Pushed to musb-hw branch.

--
balbi
--
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 5/5 v4] usb: musb: Using runtime pm APIs for musb.

2010-12-10 Thread Hema HK
Calling runtime pm APIs pm_runtime_put_sync() and pm_runtime_get_sync()
for enabling/disabling the clocks, sysconfig settings.

enable clock, configure no-idle/standby when active and configure force 
idle/standby
and disable clock when idled. This is taken care by the runtime framework when 
driver calls the pm_runtime_get_sync and pm_runtime_put_sync APIs.
Need to configure MUSB into force standby and force idle mode when usb not used

Signed-off-by: Hema HK 
Cc: Felipe Balbi 
Cc: Tony Lindgren 
Cc: Kevin Hilman 
Cc: Cousson, Benoit 
Cc: Paul Walmsley 
---

 drivers/usb/musb/musb_core.h |2 -
 drivers/usb/musb/omap2430.c  |   77 ++-
 2 files changed, 20 insertions(+), 59 deletions(-)

Index: usb/drivers/usb/musb/omap2430.c
===
--- usb.orig/drivers/usb/musb/omap2430.c
+++ usb/drivers/usb/musb/omap2430.c
@@ -33,6 +33,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "musb_core.h"
 #include "omap2430.h"
@@ -40,7 +41,6 @@
 struct omap2430_glue {
struct device   *dev;
struct platform_device  *musb;
-   struct clk  *clk;
 };
 #define glue_to_musb(g)platform_get_drvdata(g->musb)
 
@@ -216,20 +216,12 @@ static inline void omap2430_low_level_ex
l = musb_readl(musb->mregs, OTG_FORCESTDBY);
l |= ENABLEFORCE;   /* enable MSTANDBY */
musb_writel(musb->mregs, OTG_FORCESTDBY, l);
-
-   l = musb_readl(musb->mregs, OTG_SYSCONFIG);
-   l |= ENABLEWAKEUP;  /* enable wakeup */
-   musb_writel(musb->mregs, OTG_SYSCONFIG, l);
 }
 
 static inline void omap2430_low_level_init(struct musb *musb)
 {
u32 l;
 
-   l = musb_readl(musb->mregs, OTG_SYSCONFIG);
-   l &= ~ENABLEWAKEUP; /* disable wakeup */
-   musb_writel(musb->mregs, OTG_SYSCONFIG, l);
-
l = musb_readl(musb->mregs, OTG_FORCESTDBY);
l &= ~ENABLEFORCE;  /* disable MSTANDBY */
musb_writel(musb->mregs, OTG_FORCESTDBY, l);
@@ -307,21 +299,6 @@ static int omap2430_musb_init(struct mus
 
omap2430_low_level_init(musb);
 
-   l = musb_readl(musb->mregs, OTG_SYSCONFIG);
-   l &= ~ENABLEWAKEUP; /* disable wakeup */
-   l &= ~NOSTDBY;  /* remove possible nostdby */
-   l |= SMARTSTDBY;/* enable smart standby */
-   l &= ~AUTOIDLE; /* disable auto idle */
-   l &= ~NOIDLE;   /* remove possible noidle */
-   l |= SMARTIDLE; /* enable smart idle */
-   /*
-* MUSB AUTOIDLE don't work in 3430.
-* Workaround by Richard Woodruff/TI
-*/
-   if (!cpu_is_omap3430())
-   l |= AUTOIDLE;  /* enable auto idle */
-   musb_writel(musb->mregs, OTG_SYSCONFIG, l);
-
l = musb_readl(musb->mregs, OTG_INTERFSEL);
 
if (data->interface_type == MUSB_INTERFACE_UTMI) {
@@ -384,7 +361,7 @@ static int __init omap2430_probe(struct 
struct musb_hdrc_platform_data  *pdata = pdev->dev.platform_data;
struct platform_device  *musb;
struct omap2430_glue*glue;
-   struct clk  *clk;
+   int status = 0;
 
int ret = -ENOMEM;
 
@@ -400,26 +377,12 @@ static int __init omap2430_probe(struct 
goto err1;
}
 
-   clk = clk_get(&pdev->dev, "ick");
-   if (IS_ERR(clk)) {
-   dev_err(&pdev->dev, "failed to get clock\n");
-   ret = PTR_ERR(clk);
-   goto err2;
-   }
-
-   ret = clk_enable(clk);
-   if (ret) {
-   dev_err(&pdev->dev, "failed to enable clock\n");
-   goto err3;
-   }
-
musb->dev.parent= &pdev->dev;
musb->dev.dma_mask  = &omap2430_dmamask;
musb->dev.coherent_dma_mask = omap2430_dmamask;
 
glue->dev   = &pdev->dev;
glue->musb  = musb;
-   glue->clk   = clk;
 
pdata->platform_ops = &omap2430_ops;
 
@@ -429,28 +392,29 @@ static int __init omap2430_probe(struct 
pdev->num_resources);
if (ret) {
dev_err(&pdev->dev, "failed to add resources\n");
-   goto err4;
+   goto err2;
}
 
ret = platform_device_add_data(musb, pdata, sizeof(*pdata));
if (ret) {
dev_err(&pdev->dev, "failed to add platform_data\n");
-   goto err4;
+   goto err2;
}
 
ret = platform_device_add(musb);
if (ret) {
dev_err(&pdev->dev, "failed to register musb device\n");
-   goto err4;
+   goto err2;
}
 
-   return 0;
+   pm_runtime_enable(&pdev->dev);
+   if (pm_runtime_get_sync(dev)) {
+   dev_err(dev, "pm_runtime_get_sync

[PATCH 4/5 v4] OMAP2+: musb: HWMOD adaptation for musb.

2010-12-10 Thread Hema HK
Using omap_device_build API instead of platform_device_register for 
OMAP2430,OMAP34xx and OMAP4430 musb device registration.
The device specific resources defined in centralized
database will be used. 

Signed-off-by: Hema HK 
Cc: Felipe Balbi 
Cc: Tony Lindgren 
Cc: Kevin Hilman 
Cc: Cousson, Benoit 
Cc: Paul Walmsley 
---
 arch/arm/mach-omap2/usb-musb.c |   66 +++--
 1 file changed, 51 insertions(+), 15 deletions(-)

Index: usb/arch/arm/mach-omap2/usb-musb.c
===
--- usb.orig/arch/arm/mach-omap2/usb-musb.c
+++ usb/arch/arm/mach-omap2/usb-musb.c
@@ -31,9 +31,12 @@
 #include 
 #include 
 #include "control.h"
+#include 
 
 #if defined(CONFIG_USB_MUSB_OMAP2PLUS) || defined (CONFIG_USB_MUSB_AM35X)
 
+static const char name[] = "musb-omap2430";
+
 static void am35x_musb_reset(void)
 {
u32 regval;
@@ -170,7 +173,7 @@ static struct musb_hdrc_platform_data mu
 static u64 musb_dmamask = DMA_BIT_MASK(32);
 
 static struct platform_device musb_device = {
-   .name   = "musb-omap2430",
+   .name   = "musb-am35x",
.id = -1,
.dev = {
.dma_mask   = &musb_dmamask,
@@ -181,27 +184,40 @@ static struct platform_device musb_devic
.resource   = musb_resources,
 };
 
+static struct omap_device_pm_latency omap_musb_latency[] = {
+   {
+   .deactivate_func = omap_device_idle_hwmods,
+   .activate_func   = omap_device_enable_hwmods,
+   .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
+   },
+};
+
 void __init usb_musb_init(struct omap_musb_board_data *board_data)
 {
-   if (cpu_is_omap243x()) {
-   musb_resources[0].start = OMAP243X_HS_BASE;
-   } else if (cpu_is_omap3517() || cpu_is_omap3505()) {
-   musb_device.name = "musb-am35x";
+   struct omap_hwmod *oh;
+   struct omap_device *od;
+   struct platform_device *pdev;
+   struct device   *dev;
+   int bus_id = -1;
+   const char *oh_name = "usb_otg_hs";
+   struct musb_hdrc_platform_data *pdata;
+
+   if (cpu_is_omap3517() || cpu_is_omap3505()) {
musb_resources[0].start = AM35XX_IPSS_USBOTGSS_BASE;
musb_resources[1].start = INT_35XX_USBOTG_IRQ;
board_data->set_phy_power = am35x_musb_phy_power;
board_data->clear_irq = am35x_musb_clear_irq;
board_data->set_mode = am35x_musb_set_mode;
board_data->reset = am35x_musb_reset;
-   } else if (cpu_is_omap34xx()) {
-   musb_resources[0].start = OMAP34XX_HSUSB_OTG_BASE;
-   } else if (cpu_is_omap44xx()) {
-   musb_resources[0].start = OMAP44XX_HSUSB_OTG_BASE;
-   musb_resources[1].start = OMAP44XX_IRQ_HS_USB_MC_N;
-   musb_resources[2].start = OMAP44XX_IRQ_HS_USB_DMA_N;
-   }
-   musb_resources[0].end = musb_resources[0].start + SZ_4K - 1;
+   musb_resources[0].end = musb_resources[0].start + SZ_4K - 1;
+   } else {
 
+   oh = omap_hwmod_lookup(oh_name);
+   if (!oh) {
+   pr_err("Could not look up %s\n", oh_name);
+   return;
+   }
+   }
/*
 * REVISIT: This line can be removed once all the platforms using
 * musb_core.c have been converted to use use clkdev.
@@ -212,8 +228,28 @@ void __init usb_musb_init(struct omap_mu
musb_plat.mode = board_data->mode;
musb_plat.extvbus = board_data->extvbus;
 
-   if (platform_device_register(&musb_device) < 0)
-   printk(KERN_ERR "Unable to register HS-USB (MUSB) device\n");
+   if (cpu_is_omap3517() || cpu_is_omap3505()) {
+
+   if (platform_device_register(&musb_device) < 0)
+   printk(KERN_ERR "Unable to register HS-USB \
+   (MUSB) device\n");
+   } else {
+   pdata = &musb_plat;
+   od = omap_device_build(name, bus_id, oh, pdata,
+  sizeof(*pdata), omap_musb_latency,
+  ARRAY_SIZE(omap_musb_latency), false);
+   if (IS_ERR(od)) {
+   pr_err("Could not build omap_device for %s %s\n",
+   name, oh_name);
+   return;
+   }
+   pdev = &od->pdev;
+   dev = &pdev->dev;
+   get_device(dev);
+   dev->dma_mask = &musb_dmamask;
+   dev->coherent_dma_mask = musb_dmamask;
+   put_device(dev);
+   }
 }
 
 #else
--
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/5 v4] OMAP4430: hwmod data: Adding USBOTG

2010-12-10 Thread Hema HK
From: Cousson, Benoit 

OMAP4 hwmod data structures are populated with base address, L3 and L4
interface clocks, IRQs and sysconfig register details.

As per OMAP USBOTG specification, need to configure the USBOTG
to smart idle/standby or no idle/standby during data transfer and
force idle/standby when not in use to support retention and offmode.
By setting HWMOD_SWSUP_SIDLE and HWMOD_SWSUP_MSTANDBY flags,framework
will take care of configuring to no idle/standby when module is enabled
and force idle/standby when idled.

Signed-off-by: Cousson, Benoit 
Signed-off-by: Hema HK 
Cc: Felipe Balbi 
Cc: Tony Lindgren 
Cc: Kevin Hilman 
Cc: Cousson, Benoit 
Cc: Paul Walmsley 
---
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c |   94 +
 1 file changed, 94 insertions(+)

Index: usb/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
===
--- usb.orig/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ usb/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -47,6 +47,7 @@ static struct omap_hwmod omap44xx_l4_per
 static struct omap_hwmod omap44xx_l4_wkup_hwmod;
 static struct omap_hwmod omap44xx_mpu_hwmod;
 static struct omap_hwmod omap44xx_mpu_private_hwmod;
+static struct omap_hwmod omap44xx_usb_otg_hs_hwmod;
 
 /*
  * Interconnects omap_hwmod structures
@@ -223,10 +224,19 @@ static struct omap_hwmod_ocp_if omap44xx
.user   = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
+/* usb_otg_hs -> l3_main_2 */
+static struct omap_hwmod_ocp_if omap44xx_usb_otg_hs__l3_main_2 = {
+   .master = &omap44xx_usb_otg_hs_hwmod,
+   .slave  = &omap44xx_l3_main_2_hwmod,
+   .clk= "l3_div_ck",
+   .user   = OCP_USER_MPU | OCP_USER_SDMA,
+};
+
 /* l3_main_2 slave ports */
 static struct omap_hwmod_ocp_if *omap44xx_l3_main_2_slaves[] = {
&omap44xx_l3_main_1__l3_main_2,
&omap44xx_l4_cfg__l3_main_2,
+   &omap44xx_usb_otg_hs__l3_main_2,
 };
 
 static struct omap_hwmod omap44xx_l3_main_2_hwmod = {
@@ -811,6 +821,87 @@ static struct omap_hwmod omap44xx_uart4_
.omap_chip  = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
+/*
+ * 'usb_otg_hs' class
+ * high-speed on-the-go universal serial bus (usb_otg_hs) controller
+ */
+
+static struct omap_hwmod_class_sysconfig omap44xx_usb_otg_hs_sysc = {
+   .rev_offs   = 0x0400,
+   .sysc_offs  = 0x0404,
+   .syss_offs  = 0x0408,
+   .sysc_flags = (SYSC_HAS_SIDLEMODE | SYSC_HAS_MIDLEMODE|
+ SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET |
+ SYSC_HAS_AUTOIDLE),
+   .idlemodes  = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
+ MSTANDBY_FORCE | MSTANDBY_NO | MSTANDBY_SMART),
+   .sysc_fields= &omap_hwmod_sysc_type1,
+};
+
+static struct omap_hwmod_class omap44xx_usb_otg_hs_hwmod_class = {
+   .name = "usb_otg_hs",
+   .sysc = &omap44xx_usb_otg_hs_sysc,
+};
+
+/* usb_otg_hs */
+static struct omap_hwmod_irq_info omap44xx_usb_otg_hs_irqs[] = {
+   { .name = "mc", .irq = 92 + OMAP44XX_IRQ_GIC_START },
+   { .name = "dma", .irq = 93 + OMAP44XX_IRQ_GIC_START },
+};
+
+/* usb_otg_hs master ports */
+static struct omap_hwmod_ocp_if *omap44xx_usb_otg_hs_masters[] = {
+   &omap44xx_usb_otg_hs__l3_main_2,
+};
+
+static struct omap_hwmod_addr_space omap44xx_usb_otg_hs_addrs[] = {
+   {
+   .pa_start   = OMAP44XX_HSUSB_OTG_BASE,
+   .pa_end = OMAP44XX_HSUSB_OTG_BASE + SZ_4K - 1,
+   .flags  = ADDR_TYPE_RT
+   },
+};
+
+/* l4_cfg -> usb_otg_hs */
+static struct omap_hwmod_ocp_if omap44xx_l4_cfg__usb_otg_hs = {
+   .master = &omap44xx_l4_cfg_hwmod,
+   .slave  = &omap44xx_usb_otg_hs_hwmod,
+   .clk= "l4_div_ck",
+   .addr   = omap44xx_usb_otg_hs_addrs,
+   .addr_cnt   = ARRAY_SIZE(omap44xx_usb_otg_hs_addrs),
+   .user   = OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+/* usb_otg_hs slave ports */
+static struct omap_hwmod_ocp_if *omap44xx_usb_otg_hs_slaves[] = {
+   &omap44xx_l4_cfg__usb_otg_hs,
+};
+
+static struct omap_hwmod_opt_clk usb_otg_hs_opt_clks[] = {
+   { .role = "xclk", .clk = "otg_60m_gfclk_ck" },
+};
+
+static struct omap_hwmod omap44xx_usb_otg_hs_hwmod = {
+   .name   = "usb_otg_hs",
+   .class  = &omap44xx_usb_otg_hs_hwmod_class,
+   .mpu_irqs   = omap44xx_usb_otg_hs_irqs,
+   .mpu_irqs_cnt   = ARRAY_SIZE(omap44xx_usb_otg_hs_irqs),
+   .main_clk   = "usb_otg_hs_ick",
+   .prcm = {
+   .omap4 = {
+   .clkctrl_reg = OMAP4430_CM_L3INIT_USB_OTG_CLKCTRL,
+   },
+   },
+   .opt_clks   = usb_otg_hs_opt_clks,
+   .opt_clks_cnt = ARRAY_SIZE(usb_otg_hs_opt_clks),
+   .slaves = omap44xx_usb_otg_hs_slaves,
+   .slaves_cnt = ARRAY_SIZE(omap44xx_usb_otg_hs_slaves),
+   .masters= 

[PATCH 2/5 v4] OMAP3xxx: hwmod data: Add USBOTG

2010-12-10 Thread Hema HK
OMAP3 hwmod data structures are populated for USBOTG with base address,
L3 and L4 interface clocks, IRQs and sysconfig register details.

As per OMAP USBOTG specification, need to configure the USBOTG
to smart idle/standby or no idle/standby during data transfer and
force idle/standby when not in use to support retention and offmode.
By setting HWMOD_SWSUP_SIDLE and HWMOD_SWSUP_MSTANDBY flags, framework
will take care of configuring to no idle/standby when module is enabled
and force idle/standby when idled.

Signed-off-by: Hema HK 
Cc: Felipe Balbi 
Cc: Tony Lindgren 
Cc: Kevin Hilman 
Cc: Cousson, Benoit 
Cc: Paul Walmsley 
---
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |  100 +
 1 file changed, 100 insertions(+)

Index: usb/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
===
--- usb.orig/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+++ usb/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
@@ -89,6 +89,15 @@ static struct omap_hwmod omap3xxx_uart1_
 static struct omap_hwmod omap3xxx_uart2_hwmod;
 static struct omap_hwmod omap3xxx_uart3_hwmod;
 static struct omap_hwmod omap3xxx_uart4_hwmod;
+static struct omap_hwmod omap3xxx_usbhsotg_hwmod;
+
+/* l3_core -> usbhsotg interface */
+static struct omap_hwmod_ocp_if omap3xxx_usbhsotg__l3 = {
+   .master = &omap3xxx_usbhsotg_hwmod,
+   .slave  = &omap3xxx_l3_main_hwmod,
+   .clk= "core_l3_ick",
+   .user   = OCP_USER_MPU,
+};
 
 /* L4_CORE -> L4_WKUP interface */
 static struct omap_hwmod_ocp_if omap3xxx_l4_core__l4_wkup = {
@@ -169,6 +178,36 @@ static struct omap_hwmod_ocp_if omap3_l4
.user   = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
+/*
+* usbhsotg interface data
+*/
+
+static struct omap_hwmod_addr_space omap3xxx_usbhsotg_addrs[] = {
+   {
+   .pa_start   = OMAP34XX_HSUSB_OTG_BASE,
+   .pa_end = OMAP34XX_HSUSB_OTG_BASE + SZ_4K - 1,
+   .flags  = ADDR_TYPE_RT
+   },
+};
+
+/* l4_core -> usbhsotg  */
+static struct omap_hwmod_ocp_if omap3xxx_l4_core__usbhsotg = {
+   .master = &omap3xxx_l4_core_hwmod,
+   .slave  = &omap3xxx_usbhsotg_hwmod,
+   .clk= "l4_ick",
+   .addr   = omap3xxx_usbhsotg_addrs,
+   .addr_cnt   = ARRAY_SIZE(omap3xxx_usbhsotg_addrs),
+   .user   = OCP_USER_MPU,
+};
+
+static struct omap_hwmod_ocp_if *omap3xxx_usbhsotg_masters[] = {
+   &omap3xxx_usbhsotg__l3,
+};
+
+static struct omap_hwmod_ocp_if *omap3xxx_usbhsotg_slaves[] = {
+   &omap3xxx_l4_core__usbhsotg,
+};
+
 /* Slave interfaces on the L4_CORE interconnect */
 static struct omap_hwmod_ocp_if *omap3xxx_l4_core_slaves[] = {
&omap3xxx_l3_main__l4_core,
@@ -509,6 +548,64 @@ static struct omap_hwmod omap3xxx_uart4_
.omap_chip  = OMAP_CHIP_INIT(CHIP_IS_OMAP3630ES1),
 };
 
+/*
+ * usbhsotg
+ */
+static struct omap_hwmod_class_sysconfig omap3xxx_usbhsotg_sysc = {
+   .rev_offs   = 0x0400,
+   .sysc_offs  = 0x0404,
+   .syss_offs  = 0x0408,
+   .sysc_flags = (SYSC_HAS_SIDLEMODE | SYSC_HAS_MIDLEMODE|
+ SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET |
+ SYSC_HAS_AUTOIDLE),
+   .idlemodes  = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
+ MSTANDBY_FORCE | MSTANDBY_NO | MSTANDBY_SMART),
+   .sysc_fields= &omap_hwmod_sysc_type1,
+};
+
+static struct omap_hwmod_class usbotg_class = {
+   .name = "usbotg",
+   .sysc = &omap3xxx_usbhsotg_sysc,
+};
+
+/* usb_otg_hs */
+static struct omap_hwmod_irq_info omap3xxx_usbhsotg_mpu_irqs[] = {
+
+   { .name = "mc", .irq = 92 },
+   { .name = "dma", .irq = 93 },
+};
+
+static struct omap_hwmod omap3xxx_usbhsotg_hwmod = {
+   .name   = "usb_otg_hs",
+   .mpu_irqs   = omap3xxx_usbhsotg_mpu_irqs,
+   .mpu_irqs_cnt   = ARRAY_SIZE(omap3xxx_usbhsotg_mpu_irqs),
+   .main_clk   = "hsotgusb_ick",
+   .prcm   = {
+   .omap2 = {
+   .prcm_reg_id = 1,
+   .module_bit = OMAP3430_EN_HSOTGUSB_SHIFT,
+   .module_offs = CORE_MOD,
+   .idlest_reg_id = 1,
+   .idlest_idle_bit = OMAP3430ES2_ST_HSOTGUSB_IDLE_SHIFT,
+   .idlest_stdby_bit = OMAP3430ES2_ST_HSOTGUSB_STDBY_SHIFT
+   },
+   },
+   .masters= omap3xxx_usbhsotg_masters,
+   .masters_cnt= ARRAY_SIZE(omap3xxx_usbhsotg_masters),
+   .slaves = omap3xxx_usbhsotg_slaves,
+   .slaves_cnt = ARRAY_SIZE(omap3xxx_usbhsotg_slaves),
+   .class  = &usbotg_class,
+
+   /*
+* Erratum ID: i479  idle_req / idle_ack mechanism potentially
+* broken when autoidle is enabled
+* workaround is to disable the autoidle bit at module level.
+*/
+   

[PATCH 1/5 v4] OMAP2430: hwmod data: Add USBOTG

2010-12-10 Thread Hema HK
OMAP2430 hwmod data structures are populated with base address, L3 and L4
interface clocks, IRQs and sysconfig register details.

As per OMAP USBOTG specification, need to configure the USBOTG
to smart idle/standby or no idle/standby during data transfer and
force idle/standby when not in use to support retention and off-mode.
By setting HWMOD_SWSUP_SIDLE and HWMOD_SWSUP_MSTANDBY flags, framework
will take care of configuring to no idle/standby when module is enabled
and force idle/standby when suspended.

Signed-off-by: Hema HK 
Cc: Felipe Balbi 
Cc: Tony Lindgren 
Cc: Kevin Hilman 
Cc: Cousson, Benoit 
Cc: Paul Walmsley 
---
 arch/arm/mach-omap2/omap_hwmod_2430_data.c |   97 +
 1 file changed, 97 insertions(+)

Index: usb/arch/arm/mach-omap2/omap_hwmod_2430_data.c
===
--- usb.orig/arch/arm/mach-omap2/omap_hwmod_2430_data.c
+++ usb/arch/arm/mach-omap2/omap_hwmod_2430_data.c
@@ -77,6 +77,15 @@ static struct omap_hwmod omap2430_l4_wku
 static struct omap_hwmod omap2430_uart1_hwmod;
 static struct omap_hwmod omap2430_uart2_hwmod;
 static struct omap_hwmod omap2430_uart3_hwmod;
+static struct omap_hwmod omap2430_usbhsotg_hwmod;
+
+/* l3_core -> usbhsotg  interface */
+static struct omap_hwmod_ocp_if omap2430_usbhsotg__l3 = {
+   .master = &omap2430_usbhsotg_hwmod,
+   .slave  = &omap2430_l3_main_hwmod,
+   .clk= "core_l3_ck",
+   .user   = OCP_USER_MPU,
+};
 
 /* L4_CORE -> L4_WKUP interface */
 static struct omap_hwmod_ocp_if omap2430_l4_core__l4_wkup = {
@@ -139,6 +148,35 @@ static struct omap_hwmod_ocp_if omap2_l4
.user   = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
+/*
+* usbhsotg interface data
+*/
+static struct omap_hwmod_addr_space omap2430_usbhsotg_addrs[] = {
+   {
+   .pa_start   = OMAP243X_HS_BASE,
+   .pa_end = OMAP243X_HS_BASE + SZ_4K - 1,
+   .flags  = ADDR_TYPE_RT
+   },
+};
+
+/*  l4_core ->usbhsotg  interface */
+static struct omap_hwmod_ocp_if omap2430_l4_core__usbhsotg = {
+   .master = &omap2430_l4_core_hwmod,
+   .slave  = &omap2430_usbhsotg_hwmod,
+   .clk= "usb_l4_ick",
+   .addr   = omap2430_usbhsotg_addrs,
+   .addr_cnt   = ARRAY_SIZE(omap2430_usbhsotg_addrs),
+   .user   = OCP_USER_MPU,
+};
+
+static struct omap_hwmod_ocp_if *omap2430_usbhsotg_masters[] = {
+   &omap2430_usbhsotg__l3,
+};
+
+static struct omap_hwmod_ocp_if *omap2430_usbhsotg_slaves[] = {
+   &omap2430_l4_core__usbhsotg,
+};
+
 /* Slave interfaces on the L4_CORE interconnect */
 static struct omap_hwmod_ocp_if *omap2430_l4_core_slaves[] = {
&omap2430_l3_main__l4_core,
@@ -418,6 +456,62 @@ static struct omap_hwmod omap2430_uart3_
.omap_chip  = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
 };
 
+/*
+ * usbhsotg
+ */
+static struct omap_hwmod_class_sysconfig omap2430_usbhsotg_sysc = {
+   .rev_offs   = 0x0400,
+   .sysc_offs  = 0x0404,
+   .syss_offs  = 0x0408,
+   .sysc_flags = (SYSC_HAS_SIDLEMODE | SYSC_HAS_MIDLEMODE|
+ SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET |
+ SYSC_HAS_AUTOIDLE),
+   .idlemodes  = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
+ MSTANDBY_FORCE | MSTANDBY_NO | MSTANDBY_SMART),
+   .sysc_fields= &omap_hwmod_sysc_type1,
+};
+
+static struct omap_hwmod_class usbotg_class = {
+   .name = "usbotg",
+   .sysc = &omap2430_usbhsotg_sysc,
+};
+
+/* usb_otg_hs */
+static struct omap_hwmod_irq_info omap2430_usbhsotg_mpu_irqs[] = {
+
+   { .name = "mc", .irq = 92 },
+   { .name = "dma", .irq = 93 },
+};
+
+static struct omap_hwmod omap2430_usbhsotg_hwmod = {
+   .name   = "usb_otg_hs",
+   .mpu_irqs   = omap2430_usbhsotg_mpu_irqs,
+   .mpu_irqs_cnt   = ARRAY_SIZE(omap2430_usbhsotg_mpu_irqs),
+   .main_clk   = "usbhs_ick",
+   .prcm   = {
+   .omap2 = {
+   .prcm_reg_id = 1,
+   .module_bit = OMAP2430_EN_USBHS_MASK,
+   .module_offs = CORE_MOD,
+   .idlest_reg_id = 1,
+   .idlest_idle_bit = OMAP2430_ST_USBHS_SHIFT,
+   },
+   },
+   .masters= omap2430_usbhsotg_masters,
+   .masters_cnt= ARRAY_SIZE(omap2430_usbhsotg_masters),
+   .slaves = omap2430_usbhsotg_slaves,
+   .slaves_cnt = ARRAY_SIZE(omap2430_usbhsotg_slaves),
+   .class  = &usbotg_class,
+   /*
+* Erratum ID: i479  idle_req / idle_ack mechanism potentially
+* broken when autoidle is enabled
+* workaround is to disable the autoidle bit at module level.
+*/
+   .flags  = HWMOD_NO_OCP_AUTOIDLE | HWMOD_SWSUP_SIDLE
+   | HWMOD_SWSUP_MST

Subject: [PATCH 0/5 v4]usb: musb: hwmod and runtime pm support for musb

2010-12-10 Thread Hema HK
This patch series makes OMAP2PLUS musb module implemented
in HWMOD FW way. It also implements musb driver to
use the runtime pm apis.

As per the OMAP usbotg specification[1] musb sysconfig register
has to be set to force idle and force standby when not used
and set smart idle/standby or no idle/standby during operation.
otherwise core-off will be prevented by musb.

[1]: http://focus.ti.com/pdfs/wtbu/SWPU223D_Final_EPDF_06_07_2010.pdf

This patch series is based on V2.6.37-rc4 + [2]+[3]+[4]

[2] http://www.listware.net/201011/linux-usb/
65625-patch-resend-v3-usb-musb-do-not-use-dma-for-control-transfers.html

[3] Felipe's musb-reorg patch series.
http://gitorious.org/usb/usb/commits/musb-hw

[4] usb: otg: TWL6030: OMAP4430: musb & transceiver driver support
for OMAP4 posted by me.

with this patch series tested musb functionality like testusb, masstorage
OMAP4430SDP, OMAP3630 zoom3, OMAP3430 SDP

Power management tests like retention and offmode validation tests are not
done with these patches.
There will be another set of patches submitted with PM on musb.

Version History:
---
Version V4:

Rebased the changes based on the re-orgnized patches submitted by Felipe.
Fixed review comments received for V3.
Dropped the idlepath  power management patch with this series.

Some of the links for V3 review comments:

https://patchwork.kernel.org/patch/199482/
http://www.mail-archive.com/linux-omap@vger.kernel.org/msg35488.html
http://www.mail-archive.com/linux-omap@vger.kernel.org/msg33201.html
http://www.mail-archive.com/linux-omap@vger.kernel.org/msg35387.html

Version V3

Added the patch for adding the hwmod database for OMAP2430.
Re-arranged the patches in such a way that first migrate the musb driver
to use the runtime PM apis and then added a patch to support offmode in idle 
path.
Calling the runtime PM apis before disbaling the interupts in the idle path.
Added the #ifdef CONFIG_PM_RUNTIME  check in the musb core driver for calling 
the runtime PM APIs as non-omap platforms may not have the runtime pm enabled
and clk_enable/disable should be called for them.

Optimized the context save restore of musb registers only if the next state is
going to offmode and previous state was offmode.

Some of the links for V2 review comments

http://www.mail-archive.com/linux-omap@vger.kernel.org/msg34068.html
http://www.mail-archive.com/linux-omap@vger.kernel.org/msg32024.html
http://www.spinics.net/lists/linux-usb/msg35562.html
http://www.spinics.net/lists/linux-usb/msg35720.html

Vesrion v2:

Fixed review comments.
Removed the omap_hwmod.h inclusion from musb.h file which was 
breaking the non-omap platform build.
Using the runtime pm apis in the idle path(interrupts disabled).
Added the omap4 hwmod data base.

Version v1:
initial version of the patch series.

Some of the links for v1


http://www.spinics.net/lists/linux-usb/msg34570.html
http://www.spinics.net/lists/linux-omap/msg34568.html
http://www.spinics.net/lists/linux-usb/msg34544.html
http://www.spinics.net/lists/linux-usb/msg34540.html
http://www.spinics.net/lists/linux-usb/msg34589.html
http://www.spinics.net/lists/linux-usb/msg34554.html
http://www.mail-archive.com/linux-omap@vger.kernel.org/msg32973.html

Cousson, Benoit (1):
   OMAP4430: hwmod data: Adding USBOTG

Hema HK (4):
  OMAP2430: hwmod data: Add USBOTG
  OMAP3xxx: hwmod data: Add USBOTG
  OMAP2+: musb: HWMOD adaptation for musb.
  usb: musb: Using runtime pm APIs for musb.

  arch/arm/mach-omap2/omap_hwmod_2430_data.c |   97 +++
  arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |  100 
  arch/arm/mach-omap2/omap_hwmod_44xx_data.c |   94 ++
  arch/arm/mach-omap2/usb-musb.c |   66 ++
  drivers/usb/musb/musb_core.h   |2 +-
  drivers/usb/musb/omap2430.c|   77 +
  6 files changed, 362 insertions(+), 74 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


Re: [PATCH 7/8 V2] usb: musb: Adding musb support for OMAP4430

2010-12-10 Thread Felipe Balbi

On Fri, Dec 10, 2010 at 06:10:51PM +0530, Hema HK wrote:

@@ -214,9 +235,62 @@ static inline void omap2430_low_level_in
musb_writel(musb->mregs, OTG_FORCESTDBY, l);
}

+/* blocking notifier support */
+static int musb_otg_notifications(struct notifier_block *nb,
+   unsigned long event, void *unused)
+{
+   struct musb *musb = container_of(nb, struct musb, nb);
+   struct device *dev = musb->controller;
+   struct musb_hdrc_platform_data *pdata = dev->platform_data;
+   struct omap_musb_board_data *data = pdata->board_data;
+
+   switch (event) {
+   case USB_EVENT_ID:
+   DBG(4, "ID GND\n");
+
+   if (is_otg_enabled(musb)) {
+   if (musb->gadget_driver) {


This breaks compilation:

drivers/usb/musb/omap2430.c: In function 'musb_otg_notifications':
drivers/usb/musb/omap2430.c:252: error: 'struct musb' has no member
named 'gadget_driver'
make[2]: *** [drivers/usb/musb/omap2430.o] Error 1
make[2]: *** Waiting for unfinished jobs
make[1]: *** [drivers/usb/musb] Error 2
make: *** [drivers] Error 2

you need to ifdef that.

--
balbi
--
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 8/8 V2] arm: OMAP4430: musb: Configure musb to OTG mode

2010-12-10 Thread Hema HK
Enabling the musb OTG mode for SDP and PANDA boards.

Signed-off-by: Hema HK 
Cc: Felipe Balbi 
Cc: Tony Lindgren 
---
 arch/arm/mach-omap2/board-4430sdp.c|2 +-
 arch/arm/mach-omap2/board-omap4panda.c |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Index: usb/arch/arm/mach-omap2/board-4430sdp.c
===
--- usb.orig/arch/arm/mach-omap2/board-4430sdp.c
+++ usb/arch/arm/mach-omap2/board-4430sdp.c
@@ -238,7 +238,7 @@ static const struct ehci_hcd_omap_platfo
 
 static struct omap_musb_board_data musb_board_data = {
.interface_type = MUSB_INTERFACE_UTMI,
-   .mode   = MUSB_PERIPHERAL,
+   .mode   = MUSB_OTG,
.power  = 100,
 };
 
Index: usb/arch/arm/mach-omap2/board-omap4panda.c
===
--- usb.orig/arch/arm/mach-omap2/board-omap4panda.c
+++ usb/arch/arm/mach-omap2/board-omap4panda.c
@@ -133,7 +133,7 @@ error1:
 
 static struct omap_musb_board_data musb_board_data = {
.interface_type = MUSB_INTERFACE_UTMI,
-   .mode   = MUSB_PERIPHERAL,
+   .mode   = MUSB_OTG,
.power  = 100,
 };
 
--
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 7/8 V2] usb: musb: Adding musb support for OMAP4430

2010-12-10 Thread Hema HK
OMAP4430 supports UTMI and ULPI types of transceiver interface.

In UTMI mode: The PHY is embedded within OMAP4430. The transceiver functionality
is split between the twl6030 PMIC chip and OMAP4430. The VBUS, ID pin 
sensing and OTG SRP generation part is integrated in TWL6030 and UTMI PHY
functionality is embedded within the OMAP4430.

There is no direct interactions between the MUSB controller and TWL6030
chip to communicate the session-valid, session-end and ID-GND events.
It has to be done through a software by setting/resetting bits in
one of the control module register of OMAP4430 which in turn toggles
the appropriate signals to MUSB controller.

musb driver is register for blocking notifications from the transceiver
driver to get the event notifications for connect/disconnect and ID-GND.
Based on these events call the transceiver init/shutdown function to
configure the transceiver to toggle the VBUS valid, session end and ID_GND
signals to musb and power on/off the internal PHY.

For ID_GND event notifications, toggle the ID_GND signal and then wait for
musb to be configured as "A" device, and then call the transceiver function
to set the VBUS.

In OTG mode and musb as a host, When the Micro A connector used, VBUS is turned 
on
and session bit set. When the device is connected, enumeration goes through.
When the device disconnected from the other end of the connector(ID is still 
grounded),
link will detect the disconnect and end the session. When the device is 
connected back,
there are no events generated in the TWL6030-usb, and link is already down.
So the device is not detected. Removed the session bit disable code which
will recognize the connect of the device.

Limitation: In OTG host mode, if device is connected during boot, it does not 
get 
detected. If disconnect and connect it back or connect after boot only it works.
Fix for this, I will submit seperate patch later.

Signed-off-by: Hema HK 
Cc: Felipe Balbi 

---
 drivers/usb/musb/musb_core.h |1 
 drivers/usb/musb/omap2430.c  |  105 ++-
 2 files changed, 96 insertions(+), 10 deletions(-)

Index: usb/drivers/usb/musb/musb_core.h
===
--- usb.orig/drivers/usb/musb/musb_core.h
+++ usb/drivers/usb/musb/musb_core.h
@@ -411,6 +411,7 @@ struct musb {
 
struct timer_list   otg_timer;
 #endif
+   struct notifier_block   nb;
 
struct dma_controller   *dma_controller;
 
Index: usb/drivers/usb/musb/omap2430.c
===
--- usb.orig/drivers/usb/musb/omap2430.c
+++ usb/drivers/usb/musb/omap2430.c
@@ -57,12 +57,8 @@ static void musb_do_idle(unsigned long _
 
spin_lock_irqsave(&musb->lock, flags);
 
-   devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
-
switch (musb->xceiv->state) {
case OTG_STATE_A_WAIT_BCON:
-   devctl &= ~MUSB_DEVCTL_SESSION;
-   musb_writeb(musb->mregs, MUSB_DEVCTL, devctl);
 
devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
if (devctl & MUSB_DEVCTL_BDEVICE) {
@@ -142,6 +138,8 @@ static void omap2430_musb_try_idle(struc
 static void omap2430_musb_set_vbus(struct musb *musb, int is_on)
 {
u8  devctl;
+   unsigned long timeout = jiffies + msecs_to_jiffies(1000);
+   int ret = 1;
/* HDRC controls CPEN, but beware current surges during device
 * connect.  They can trigger transient overcurrent conditions
 * that must be ignored.
@@ -150,12 +148,35 @@ static void omap2430_musb_set_vbus(struc
devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
 
if (is_on) {
-   musb->is_active = 1;
-   musb->xceiv->default_a = 1;
-   musb->xceiv->state = OTG_STATE_A_WAIT_VRISE;
-   devctl |= MUSB_DEVCTL_SESSION;
+   if (musb->xceiv->state == OTG_STATE_A_IDLE) {
+   /* start the session */
+   devctl |= MUSB_DEVCTL_SESSION;
+   musb_writeb(musb->mregs, MUSB_DEVCTL, devctl);
+   /*
+* Wait for the musb to set as A device to enable the
+* VBUS
+*/
+   while (musb_readb(musb->mregs, MUSB_DEVCTL) & 0x80) {
+
+   cpu_relax();
+
+   if (time_after(jiffies, timeout)) {
+   dev_err(musb->controller,
+   "configured as A device timeout");
+   ret = -EINVAL;
+   break;
+   }
+   }
 
-   MUSB_HST_MODE(musb);
+   if (ret && musb->xceiv->set_vbus)
+   otg_set_vbus(musb->xceiv, 1);
+   } else {
+  

[PATCH 6/8 V3] usb: otg: TWL6030: Add twl6030_usb file for compilation

2010-12-10 Thread Hema HK
Add the twl6030_usb transceiver file for compilation.

Signed-off-by: Hema HK 
Cc: Felipe Balbi 

Index: usb/drivers/usb/otg/Makefile
===
--- usb.orig/drivers/usb/otg/Makefile
+++ usb/drivers/usb/otg/Makefile
@@ -12,6 +12,7 @@ obj-$(CONFIG_USB_OTG_UTILS)   += otg.o
 obj-$(CONFIG_USB_GPIO_VBUS)+= gpio_vbus.o
 obj-$(CONFIG_ISP1301_OMAP) += isp1301_omap.o
 obj-$(CONFIG_TWL4030_USB)  += twl4030-usb.o
+obj-$(CONFIG_TWL6030_USB)  += twl6030-usb.o
 obj-$(CONFIG_USB_LANGWELL_OTG) += langwell_otg.o
 obj-$(CONFIG_NOP_USB_XCEIV)+= nop-usb-xceiv.o
 obj-$(CONFIG_USB_ULPI) += ulpi.o
--
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 5/8 V3] mfd: TWL6030: OMAP4: Registering the TWL6030-usb device

2010-12-10 Thread Hema HK
Registering the twl6030-usb transceiver device as a child to twl6030 core.
Removed the NOP transceiver init call from board file.

Populated twl4030_usb_data platform data structure with the function
pointers for OMAP4430 internal PHY operation to be used by twl630-usb driver.

Signed-off-by: Hema HK 
Cc: Samuel Ortiz 
Cc: Felipe Balbi 
Cc: Tony Lindgren 
---
 arch/arm/mach-omap2/board-4430sdp.c|   11 ++--
 arch/arm/mach-omap2/board-omap4panda.c |8 ++
 drivers/mfd/twl-core.c |   44 +
 include/linux/i2c/twl.h|7 +
 4 files changed, 62 insertions(+), 8 deletions(-)

Index: usb/arch/arm/mach-omap2/board-4430sdp.c
===
--- usb.orig/arch/arm/mach-omap2/board-4430sdp.c
+++ usb/arch/arm/mach-omap2/board-4430sdp.c
@@ -242,6 +242,13 @@ static struct omap_musb_board_data musb_
.power  = 100,
 };
 
+static struct twl4030_usb_data omap4_usbphy_data = {
+   .phy_init   = omap4430_phy_init,
+   .phy_exit   = omap4430_phy_exit,
+   .phy_power  = omap4430_phy_power,
+   .phy_set_clock  = omap4430_phy_set_clk,
+};
+
 static struct omap2_hsmmc_info mmc[] = {
{
.mmc= 1,
@@ -461,6 +468,7 @@ static struct twl4030_platform_data sdp4
.vaux1  = &sdp4430_vaux1,
.vaux2  = &sdp4430_vaux2,
.vaux3  = &sdp4430_vaux3,
+   .usb= &omap4_usbphy_data
 };
 
 static struct i2c_board_info __initdata sdp4430_i2c_boardinfo[] = {
@@ -533,9 +541,6 @@ static void __init omap_4430sdp_init(voi
gpio_direction_output(OMAP4SDP_MDM_PWR_EN_GPIO, 1);
}
usb_ehci_init(&ehci_pdata);
-
-   /* OMAP4 SDP uses internal transceiver so register nop transceiver */
-   usb_nop_xceiv_register();
usb_musb_init(&musb_board_data);
 
status = omap_ethernet_init();
Index: usb/drivers/mfd/twl-core.c
===
--- usb.orig/drivers/mfd/twl-core.c
+++ usb/drivers/mfd/twl-core.c
@@ -95,7 +95,8 @@
 #define twl_has_rtc()  false
 #endif
 
-#if defined(CONFIG_TWL4030_USB) || defined(CONFIG_TWL4030_USB_MODULE)
+#if defined(CONFIG_TWL4030_USB) || defined(CONFIG_TWL4030_USB_MODULE) ||\
+   defined(CONFIG_TWL6030_USB) || defined(CONFIG_TWL6030_USB_MODULE)
 #define twl_has_usb()  true
 #else
 #define twl_has_usb()  false
@@ -682,6 +683,43 @@ add_children(struct twl4030_platform_dat
usb3v1.dev = child;
}
}
+   if (twl_has_usb() && pdata->usb && twl_class_is_6030()) {
+
+   static struct regulator_consumer_supply usb3v3 = {
+   .supply =   "vusb",
+   };
+
+   if (twl_has_regulator()) {
+   /* this is a template that gets copied */
+   struct regulator_init_data usb_fixed = {
+   .constraints.valid_modes_mask =
+   REGULATOR_MODE_NORMAL
+   | REGULATOR_MODE_STANDBY,
+   .constraints.valid_ops_mask =
+   REGULATOR_CHANGE_MODE
+   | REGULATOR_CHANGE_STATUS,
+   };
+
+   child = add_regulator_linked(TWL6030_REG_VUSB,
+ &usb_fixed, &usb3v3, 1);
+   if (IS_ERR(child))
+   return PTR_ERR(child);
+   }
+
+   child = add_child(0, "twl6030_usb",
+   pdata->usb, sizeof(*pdata->usb),
+   true,
+   /* irq1 = VBUS_PRES, irq0 = USB ID */
+   pdata->irq_base + USBOTG_INTR_OFFSET,
+   pdata->irq_base + USB_PRES_INTR_OFFSET);
+
+   if (IS_ERR(child))
+   return PTR_ERR(child);
+   /* we need to connect regulators to this transceiver */
+   if (twl_has_regulator() && child)
+   usb3v3.dev = child;
+
+   }
 
if (twl_has_watchdog()) {
child = add_child(0, "twl4030_wdt", NULL, 0, false, 0, 0);
@@ -815,10 +853,6 @@ add_children(struct twl4030_platform_dat
if (IS_ERR(child))
return PTR_ERR(child);
 
-   child = add_regulator(TWL6030_REG_VUSB, pdata->vusb);
-   if (IS_ERR(child))
-   return PTR_ERR(child);
-
child = add_regulator(TWL6030_REG_VAUX1_6030, pdata->vaux1);
if (IS_ERR(child))
return PTR_ERR(child);
Index: usb/include/linux/i2c/twl.h
===
--- usb.orig/include/linux/i2c/twl.h
+++ usb/in

[PATCH 3/8 V3] usb: otg: Kconfig: Add Kconfig option for TWL6030 transceiver.

2010-12-10 Thread Hema HK
Added the TWL6030-usb transceiver option in the Kconfig

Signed-off-by: Hema HK 
Cc: Felipe Balbi 
Cc: David Brownell 
---
 drivers/usb/otg/Kconfig |   12 
 1 file changed, 12 insertions(+)

Index: usb/drivers/usb/otg/Kconfig
===
--- usb.orig/drivers/usb/otg/Kconfig
+++ usb/drivers/usb/otg/Kconfig
@@ -59,6 +59,18 @@ config TWL4030_USB
  This transceiver supports high and full speed devices plus,
  in host mode, low speed.
 
+config TWL6030_USB
+   tristate "TWL6030 USB Transceiver Driver"
+   depends on TWL4030_CORE
+   select USB_OTG_UTILS
+   help
+ Enable this to support the USB OTG transceiver on TWL6030
+ family chips. This TWL6030 transceiver has the VBUS and ID GND
+ and OTG SRP events capabilities. For all other transceiver 
functionality
+ UTMI PHY is embedded in OMAP4430. The internal PHY configurations APIs
+ are hooked to this driver through platform_data structure.
+ The definition of internal PHY APIs are in the mach-omap2 layer.
+
 config NOP_USB_XCEIV
tristate "NOP USB Transceiver Driver"
select USB_OTG_UTILS
--
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/8 V3] usb: musb: TWL6030: Selecting TWL6030_USB transceiver

2010-12-10 Thread Hema HK
Selecting the twl6030-usb for OMAP4430SDP and OMAP4PANDA boards and
adding OMAP4 internal phy code for compilation

Signed-off-by: Hema HK 
Cc: Felipe Balbi 
Cc: Tony Lindgren 
---
 arch/arm/mach-omap2/Makefile |6 --
 drivers/usb/musb/Kconfig |1 +
 2 files changed, 5 insertions(+), 2 deletions(-)

Index: usb/arch/arm/mach-omap2/Makefile
===
--- usb.orig/arch/arm/mach-omap2/Makefile
+++ usb/arch/arm/mach-omap2/Makefile
@@ -168,9 +168,11 @@ obj-$(CONFIG_MACH_IGEP0030)+= board-ig
 obj-$(CONFIG_MACH_OMAP3_TOUCHBOOK) += board-omap3touchbook.o \
   hsmmc.o
 obj-$(CONFIG_MACH_OMAP_4430SDP)+= board-4430sdp.o \
-  hsmmc.o
+  hsmmc.o \
+  omap_phy_internal.o
 obj-$(CONFIG_MACH_OMAP4_PANDA) += board-omap4panda.o \
-  hsmmc.o
+  hsmmc.o \
+  omap_phy_internal.o
 
 obj-$(CONFIG_MACH_OMAP3517EVM) += board-am3517evm.o
 
Index: usb/drivers/usb/musb/Kconfig
===
--- usb.orig/drivers/usb/musb/Kconfig
+++ usb/drivers/usb/musb/Kconfig
@@ -12,6 +12,7 @@ config USB_MUSB_HDRC
depends on (ARM || (BF54x && !BF544) || (BF52x && !BF522 && !BF523))
select NOP_USB_XCEIV if (ARCH_DAVINCI || MACH_OMAP3EVM || BLACKFIN)
select TWL4030_USB if MACH_OMAP_3430SDP
+   select TWL6030_USB if MACH_OMAP_4430SDP || MACH_OMAP4_PANDA
select USB_OTG_UTILS
tristate 'Inventra Highspeed Dual Role Controller (TI, ADI, ...)'
help
--
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/8 V3] usb: otg: Adding twl6030-usb transceiver driver for OMAP4430

2010-12-10 Thread Hema HK
Adding the twl6030-usb transceiver support for OMAP4 musb driver.

OMAP4 supports 2 types of transceiver interface.

1. UTMI: The PHY is embedded within OMAP4. The transceiver functionality
is split between the twl6030 PMIC chip and OMAP4430. The VBUS, ID pin 
sensing and OTG SRP generation part is integrated in TWL6030 and UTMI PHY
functionality is embedded within the OMAP4430.

There is no direct interactions between the MUSB controller and TWL6030
chip to communicate the session-valid, session-end and ID-GND events.
It has to be done through a software by setting/resetting bits in
one of the control module register of OMAP4430 which in turn toggles
the appropriate signals to MUSB controller.

The internal transceiver has functional clocks and
powerdown bits to powerdown the PHY for power saving.

Since there is no option available for having 2 transceiver drivers
for one USB controller, internal PHY specific APIs are passed through
plaform_data function pointers to use in the twl6030-usb transceiver
driver.

2. ULPI interface is provided for off-chip transceivers.

Signed-off-by: Hema HK 
Cc: Felipe Balbi 
Cc: Tony Lindgren 
Cc: David Brownell 
---
 arch/arm/mach-omap2/omap_phy_internal.c |  149 +
 arch/arm/plat-omap/include/plat/usb.h   |5 
 drivers/usb/otg/twl6030-usb.c   |  493 
 3 files changed, 647 insertions(+)

Index: usb/arch/arm/mach-omap2/omap_phy_internal.c
===
--- /dev/null
+++ usb/arch/arm/mach-omap2/omap_phy_internal.c
@@ -0,0 +1,149 @@
+/*
+  * This file configures the internal USB PHY in OMAP4430. Used
+  * with TWL6030 transceiver and MUSB on OMAP4430.
+  *
+  * Copyright (C) 2010 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; either version 2 of the License, or
+  * (at your option) any later version.
+  *
+  * Author: Hema HK 
+  *
+  * This program is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  * GNU General Public License for more details.
+  *
+  * You should have received a copy of the GNU General Public License
+  * along with this program; if not, write to the Free Software
+  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+  *
+  */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+/* OMAP control module register for UTMI PHY */
+#define CONTROL_DEV_CONF   0x300
+#define PHY_PD 0x1
+
+#define USBOTGHS_CONTROL   0x33c
+#defineAVALID  BIT(0)
+#defineBVALID  BIT(1)
+#defineVBUSVALID   BIT(2)
+#defineSESSEND BIT(3)
+#defineIDDIG   BIT(4)
+
+static struct clk *phyclk, *clk48m, *clk32k;
+static void __iomem *ctrl_base;
+
+int omap4430_phy_init(struct device *dev)
+{
+   ctrl_base = ioremap(OMAP443X_SCM_BASE, SZ_1K);
+   if (!ctrl_base) {
+   dev_err(dev, "control module ioremap failed\n");
+   return -ENOMEM;
+   }
+   /* Power down the phy */
+   __raw_writel(PHY_PD, ctrl_base + CONTROL_DEV_CONF);
+   phyclk = clk_get(dev, "ocp2scp_usb_phy_ick");
+
+   if (IS_ERR(phyclk)) {
+   dev_err(dev, "cannot clk_get ocp2scp_usb_phy_ick\n");
+   iounmap(ctrl_base);
+   return PTR_ERR(phyclk);
+   }
+
+   clk48m = clk_get(dev, "ocp2scp_usb_phy_phy_48m");
+   if (IS_ERR(clk48m)) {
+   dev_err(dev, "cannot clk_get ocp2scp_usb_phy_phy_48m\n");
+   clk_put(phyclk);
+   iounmap(ctrl_base);
+   return PTR_ERR(clk48m);
+   }
+
+   clk32k = clk_get(dev, "usb_phy_cm_clk32k");
+   if (IS_ERR(clk32k)) {
+   dev_err(dev, "cannot clk_get usb_phy_cm_clk32k\n");
+   clk_put(phyclk);
+   clk_put(clk48m);
+   iounmap(ctrl_base);
+   return PTR_ERR(clk32k);
+   }
+   return 0;
+}
+
+int omap4430_phy_set_clk(struct device *dev, int on)
+{
+   static int state;
+
+   if (on && !state) {
+   /* Enable the phy clocks */
+   clk_enable(phyclk);
+   clk_enable(clk48m);
+   clk_enable(clk32k);
+   state = 1;
+   } else if (state) {
+   /* Disable the phy clocks */
+   clk_disable(phyclk);
+   clk_disable(clk48m);
+   clk_disable(clk32k);
+   state = 0;
+   }
+   return 0;
+}
+
+int omap4430_phy_power(struct device *dev, int ID, int on)
+{
+   if (on) {
+   /* 

[PATCH 1/8 V3] mfd: TWL6030: USBOTG VBUS event generation on

2010-12-10 Thread Hema HK
With TWL6030-usb, VBUS SESS_VLD and SESS_END events are not generated
as expected. When these interrupts are enabled, charger VBUS detection
interrupt does not get generated. So USBOTG has to be dependent on charger
VBUS interrupts.
So added one bit for USBOTG and changed the handler to call the 
USBOTG handler whenever there is a charger VBUS interrpt.

VBUS SESS_VLD and SESS_END event generation issue is under debug with
HW team. This fix might not be required once after fixing the issue.

Signed-off-by: Balaji TK 
Signed-off-by: Hema HK 
Cc: Felipe Balbi 
Cc: Samuel Ortiz 
---
 drivers/mfd/twl6030-irq.c |9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

Index: usb/drivers/mfd/twl6030-irq.c
===
--- usb.orig/drivers/mfd/twl6030-irq.c
+++ usb/drivers/mfd/twl6030-irq.c
@@ -74,7 +74,7 @@ static int twl6030_interrupt_mapping[24]
USBOTG_INTR_OFFSET, /* Bit 16   ID_WKUP */
USBOTG_INTR_OFFSET, /* Bit 17   VBUS_WKUP   */
USBOTG_INTR_OFFSET, /* Bit 18   ID  */
-   USBOTG_INTR_OFFSET, /* Bit 19   VBUS*/
+   USB_PRES_INTR_OFFSET,   /* Bit 19   VBUS*/
CHARGER_INTR_OFFSET,/* Bit 20   CHRG_CTRL   */
CHARGER_INTR_OFFSET,/* Bit 21   EXT_CHRG*/
CHARGER_INTR_OFFSET,/* Bit 22   INT_CHRG*/
@@ -128,6 +128,13 @@ static int twl6030_irq_thread(void *data
 
sts.bytes[3] = 0; /* Only 24 bits are valid*/
 
+   /*
+* Since VBUS status bit is not reliable for VBUS disconnect
+* use CHARGER VBUS detection status bit instead.
+*/
+   if (sts.bytes[2] & 0x10)
+   sts.bytes[2] |= 0x08;
+
for (i = 0; sts.int_sts; sts.int_sts >>= 1, i++) {
local_irq_disable();
if (sts.int_sts & 0x1) {
--
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/8 V3] usb: otg: TWL6030: OMAP4430: musb & transceiver driver support for OMAP4

2010-12-10 Thread Hema HK
This patch series has the support for TWL6030-usb
transceiver driver and changes in the musb driver to make it functional
with OMAP4430.

OMAP4 musb support UTMI and ULPI transceiver interfaces.

In UTMI mode, the transceiver functionality is split between
the TWL6030 PMIC chip and OMAP4 embedded PHY.
The TWL6030 transceiver driver code is under otg folder and
internal UTMI PHY specific code changes are defined under
mach-omap2 directory and functions are passed through platform_data
structure.

This patch series is based on V2.6.37-rc4 + [1]+[2] 

[1] http://www.listware.net/201011/linux-usb/
65625-patch-resend-v3-usb-musb-do-not-use-dma-for-control-transfers.html

[2] Felipe's musb-reorg patch series.
http://gitorious.org/usb/usb/commits/musb-hw

Tested musb device and host mode functionality with OMAP4430SDP
and OMAP3630 ZOOM3.

Limitation: In OTG and Host only mode, when the device is connected
during boot will not be detected.
Need connect the device only after the boot. Or disconnect and connect
it back if it connected during boot.
Fix for this will be submitted later.

Version History:
---
Version3 changes:
- Rearranged the patches to avoid the git bisect failure.

Version 2 changes:
- Removed the dependency on the atomic notifier patches from Arnaud.
- Fixed review comments from Felipe and Sergei.
- Modified the vbus_set function to set timeout when musb is not configured
as A device.


Cc: Felipe Balbi 
Cc: Tony Lindgren 
Cc: David Brownell 
Cc: Samuel Ortiz 
---

Hema HK (8):
  mfd: TWL6030: USBOTG VBUS event generation on charger VBUS events.
  usb: otg: Adding twl6030-usb transceiver driver for OMAP4430.
  usb: otg: Kconfig: Add Kconfig option for TWL6030 transceiver.
  usb: musb: TWL6030: Selecting TWL6030_USB transceiver for OMAP4
  mfd: TWL6030: OMAP4: Registering the TWL6030-usb device
  usb: otg: TWL6030: Add twl6030_usb file for compilation
  usb: musb: Adding musb support for OMAP4430
  arm: OMAP4430: musb: Enable musb device initialization for OMAP4430

  arch/arm/mach-omap2/Makefile|6 +-
  arch/arm/mach-omap2/board-4430sdp.c |   13 +-
  arch/arm/mach-omap2/board-omap4panda.c  |   10 +-
  arch/arm/mach-omap2/omap_phy_internal.c |  149 ++
  arch/arm/plat-omap/include/plat/usb.h   |5 +
  drivers/mfd/twl-core.c  |   44 +++-
  drivers/mfd/twl6030-irq.c   |9 +-
  drivers/usb/musb/Kconfig|1 +
  drivers/usb/musb/musb_core.h|1 +
  drivers/usb/musb/omap2430.c |  107 ++-
  drivers/usb/otg/Kconfig |   12 +
  drivers/usb/otg/Makefile|1 +
  drivers/usb/otg/twl6030-usb.c   |  493 +++
  include/linux/i2c/twl.h |7 +
  14 files changed, 834 insertions(+), 24 deletions(-)
  create mode 100644 arch/arm/mach-omap2/omap_phy_internal.c
  create mode 100644 drivers/usb/otg/twl6030-usb.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


Re: [PATCH 3/7 V2] usb: otg: Kconfig: Add Kconfig option for TWL6030 transceiver.

2010-12-10 Thread Kalliguddi, Hema
On Fri, Dec 10, 2010 at 5:13 PM, Felipe Balbi  wrote:
> On Fri, Dec 10, 2010 at 04:56:40PM +0530, Kalliguddi, Hema wrote:
>>
>> On Fri, Dec 10, 2010 at 2:11 PM, Felipe Balbi  wrote:
>>>
>>> On Fri, Dec 10, 2010 at 12:34:35PM +0530, Hema HK wrote:

 Added the TWL6030-usb transceiver option in the Kconfig

 Signed-off-by: Hema HK 
 Cc: Felipe Balbi 
 Cc: David Brownell 
 ---
 drivers/usb/otg/Kconfig |   12 
 1 file changed, 12 insertions(+)

 Index: usb/drivers/usb/otg/Kconfig
 ===
 --- usb.orig/drivers/usb/otg/Kconfig
 +++ usb/drivers/usb/otg/Kconfig
 @@ -59,6 +59,18 @@ config TWL4030_USB
          This transceiver supports high and full speed devices plus,
          in host mode, low speed.

 +config TWL6030_USB
 +       tristate "TWL6030 USB Transceiver Driver"
 +       depends on TWL4030_CORE
 +       select USB_OTG_UTILS
 +       help
 +         Enable this to support the USB OTG transceiver on TWL6030
 +         family chips. This TWL6030 transceiver has the VBUS and ID GND
 +         and OTG SRP events capabilities. For all other transceiver
 functionality
 +         UTMI PHY is embedded in OMAP4430. The internal PHY
 configurations APIs
 +         are hooked to this driver through platform_data structure.
 +         The definition of internal PHY APIs are in the mach-omap2
 layer.
 +
>>>
>>> When compiling with this patch:
>>>
>>> drivers/usb/otg/twl6030-usb.c: In function 'twl6030_set_phy_clk':
>>> drivers/usb/otg/twl6030-usb.c:145: error: 'struct twl4030_usb_data' has
>>> no member named 'phy_set_clock'
>>> drivers/usb/otg/twl6030-usb.c: In function 'twl6030_phy_init':
>>> drivers/usb/otg/twl6030-usb.c:166: error: 'struct twl4030_usb_data' has
>>> no member named 'phy_power'
>>> drivers/usb/otg/twl6030-usb.c:168: error: 'struct twl4030_usb_data' has
>>> no member named 'phy_power'
>>> drivers/usb/otg/twl6030-usb.c: In function 'twl6030_phy_shutdown':
>>> drivers/usb/otg/twl6030-usb.c:182: error: 'struct twl4030_usb_data' has
>>> no member named 'phy_power'
>>> drivers/usb/otg/twl6030-usb.c: In function 'twl6030_usb_probe':
>>> drivers/usb/otg/twl6030-usb.c:440: error: 'struct twl4030_usb_data' has
>>> no member named 'phy_init'
>>> drivers/usb/otg/twl6030-usb.c: In function 'twl6030_usb_remove':
>>> drivers/usb/otg/twl6030-usb.c:462: error: 'struct twl4030_usb_data' has
>>> no member named 'phy_exit'
>>> make[2]: *** [drivers/usb/otg/twl6030-usb.o] Error 1
>>> make[1]: *** [drivers/usb/otg] Error 2
>>> make[1]: *** Waiting for unfinished jobs
>>> make: *** [drivers] Error 2
>>> make: *** Waiting for unfinished jobs
>>>
>>> please fix ASAP or we will loose the merge window.
>>
>> With this patch twl6030_usb file still not added for build, I am
>> wondering how are
>> you getting How are you getting build error?
>
> This is *the* patch that adds it to Kbuild :-) the previous patch
> already added Makefile change.
>
Agree. Got confused with omap_phy_internal.c file.
I am fixing it. I will send you the patches.
Regards,
Hema
> --
> balbi
>
--
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


Re: [PATCH 3/7 V2] usb: otg: Kconfig: Add Kconfig option for TWL6030 transceiver.

2010-12-10 Thread Felipe Balbi

On Fri, Dec 10, 2010 at 04:56:40PM +0530, Kalliguddi, Hema wrote:

On Fri, Dec 10, 2010 at 2:11 PM, Felipe Balbi  wrote:

On Fri, Dec 10, 2010 at 12:34:35PM +0530, Hema HK wrote:


Added the TWL6030-usb transceiver option in the Kconfig

Signed-off-by: Hema HK 
Cc: Felipe Balbi 
Cc: David Brownell 
---
drivers/usb/otg/Kconfig |   12 
1 file changed, 12 insertions(+)

Index: usb/drivers/usb/otg/Kconfig
===
--- usb.orig/drivers/usb/otg/Kconfig
+++ usb/drivers/usb/otg/Kconfig
@@ -59,6 +59,18 @@ config TWL4030_USB
         This transceiver supports high and full speed devices plus,
         in host mode, low speed.

+config TWL6030_USB
+       tristate "TWL6030 USB Transceiver Driver"
+       depends on TWL4030_CORE
+       select USB_OTG_UTILS
+       help
+         Enable this to support the USB OTG transceiver on TWL6030
+         family chips. This TWL6030 transceiver has the VBUS and ID GND
+         and OTG SRP events capabilities. For all other transceiver
functionality
+         UTMI PHY is embedded in OMAP4430. The internal PHY
configurations APIs
+         are hooked to this driver through platform_data structure.
+         The definition of internal PHY APIs are in the mach-omap2 layer.
+


When compiling with this patch:

drivers/usb/otg/twl6030-usb.c: In function 'twl6030_set_phy_clk':
drivers/usb/otg/twl6030-usb.c:145: error: 'struct twl4030_usb_data' has
no member named 'phy_set_clock'
drivers/usb/otg/twl6030-usb.c: In function 'twl6030_phy_init':
drivers/usb/otg/twl6030-usb.c:166: error: 'struct twl4030_usb_data' has
no member named 'phy_power'
drivers/usb/otg/twl6030-usb.c:168: error: 'struct twl4030_usb_data' has
no member named 'phy_power'
drivers/usb/otg/twl6030-usb.c: In function 'twl6030_phy_shutdown':
drivers/usb/otg/twl6030-usb.c:182: error: 'struct twl4030_usb_data' has
no member named 'phy_power'
drivers/usb/otg/twl6030-usb.c: In function 'twl6030_usb_probe':
drivers/usb/otg/twl6030-usb.c:440: error: 'struct twl4030_usb_data' has
no member named 'phy_init'
drivers/usb/otg/twl6030-usb.c: In function 'twl6030_usb_remove':
drivers/usb/otg/twl6030-usb.c:462: error: 'struct twl4030_usb_data' has
no member named 'phy_exit'
make[2]: *** [drivers/usb/otg/twl6030-usb.o] Error 1
make[1]: *** [drivers/usb/otg] Error 2
make[1]: *** Waiting for unfinished jobs
make: *** [drivers] Error 2
make: *** Waiting for unfinished jobs

please fix ASAP or we will loose the merge window.


With this patch twl6030_usb file still not added for build, I am
wondering how are
you getting How are you getting build error?


This is *the* patch that adds it to Kbuild :-) the previous patch
already added Makefile change.

--
balbi
--
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


Re: [PATCH 4/7 V2] mfd: TWL6030: OMAP4: Registering the TWL6030-usb device

2010-12-10 Thread Kalliguddi, Hema
On Fri, Dec 10, 2010 at 4:00 PM, Felipe Balbi  wrote:
> Hi,
>
> On Fri, Dec 10, 2010 at 12:34:50PM +0530, Hema HK wrote:
>>
>> Registering the twl6030-usb transceiver device as a child to twl6030 core.
>> Removed the NOP transceiver init call from board file.
>>
>> Populated twl4030_usb_data platform data structure with the function
>> pointers for OMAP4430 internal PHY operation to be used by twl630-usb
>> driver.
>>
>>
>
> one blank line only.
OK. I will fix it
>
>> Index: usb/include/linux/i2c/twl.h
>> ===
>> --- usb.orig/include/linux/i2c/twl.h
>> +++ usb/include/linux/i2c/twl.h
>> @@ -593,6 +593,13 @@ enum twl4030_usb_mode {
>>
>> struct twl4030_usb_data {
>>        enum twl4030_usb_mode   usb_mode;
>> +
>> +       int             (*phy_init)(struct device *dev);
>> +       int             (*phy_exit)(struct device *dev);
>> +       /* Power on/off the PHY */
>> +       int             (*phy_power)(struct device *dev, int iD, int on);
>> +       /* enable/disable  phy clocks */
>> +       int             (*phy_set_clock)(struct device *dev, int on);
>> };
>
> This hunk should come either before or together with patch:
>
Agree this patch should be before 4th patch.

> usb: otg: Adding twl6030-usb transceiver driver for
>
>> struct twl4030_ins {
>> Index: usb/arch/arm/mach-omap2/board-omap4panda.c
>> ===
>> --- usb.orig/arch/arm/mach-omap2/board-omap4panda.c
>> +++ usb/arch/arm/mach-omap2/board-omap4panda.c
>> @@ -137,6 +137,13 @@ static struct omap_musb_board_data musb_
>>        .power                  = 100,
>> };
>>
>> +static struct twl4030_usb_data omap4_usbphy_data = {
>> +       .phy_init       = omap4430_phy_init,
>> +       .phy_exit       = omap4430_phy_exit,
>> +       .phy_power      = omap4430_phy_power,
>> +       .phy_set_clock  = omap4430_phy_set_clk,
>> +};
>> +
>> static struct omap2_hsmmc_info mmc[] = {
>>        {
>>                .mmc            = 1,
>> @@ -345,6 +352,7 @@ static struct twl4030_platform_data omap
>>        .vaux1          = &omap4_panda_vaux1,
>>        .vaux2          = &omap4_panda_vaux2,
>>        .vaux3          = &omap4_panda_vaux3,
>> +       .usb            = &omap4_usbphy_data,
>> };
>>
>> static struct i2c_board_info __initdata omap4_panda_i2c_boardinfo[] = {
>
> This hunk should come before adding the Kconfig entries for twl6030-usb.
Agree. I will correct it submit in sometime.

Regards,
Hema
>
> --
> balbi
>
--
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


Re: [PATCHv2 0/4] staging: tidspbridge - misc fixes

2010-12-10 Thread Nishanth Menon

Fernando Guzman Lugo wrote, on 12/09/2010 09:55 PM:

* V2
  - rebase to the latest
  - remove patches no needed at this moment

This set of patches fix some issues found in lastest tree.

Fernando Guzman Lugo (4):
   staging: tidspbridge - use GTP7 for DSP stack dump
   staging: tidspbridge - fix timeout in dsp_gpt_wait_overflow
   staging: tidspbridge - remove disabling twl when printing DSP stack
   staging: tidspbridge - change mmufault tasklet to a workqueue

  drivers/staging/tidspbridge/core/_deh.h|2 +-
  drivers/staging/tidspbridge/core/dsp-clock.c   |   17 ---
  drivers/staging/tidspbridge/core/ue_deh.c  |   55 +++
  .../staging/tidspbridge/include/dspbridge/clk.h|4 +-
  4 files changed, 46 insertions(+), 32 deletions(-)


Suggest looping in Linux-omap as well.

--
Regards,
Nishanth Menon
--
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   >