[PATCH v2 2/2] omap4: SRAM start address correction

2010-07-11 Thread Vikram Pandita
On OMAP4 there is no need to have SRAM_BOOTLOADER_SZ provision

Hence put this macro under CONFIG_ARCH_OMAP2PLUS check

Signed-off-by: Vikram Pandita vikram.pand...@ti.com
Reviewed-by: Santosh Shilimkar santosh.shilim...@ti.com
---
 arch/arm/plat-omap/sram.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/arm/plat-omap/sram.c b/arch/arm/plat-omap/sram.c
index 2eb5a27..a72b391 100644
--- a/arch/arm/plat-omap/sram.c
+++ b/arch/arm/plat-omap/sram.c
@@ -53,7 +53,7 @@
 #define OMAP4_SRAM_PUB_PA  (OMAP4_SRAM_PA + 0x4000)
 #define OMAP4_SRAM_PUB_VA  (OMAP4_SRAM_VA + 0x4000)
 
-#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
+#if defined(CONFIG_ARCH_OMAP2PLUS)
 #define SRAM_BOOTLOADER_SZ 0x00
 #else
 #define SRAM_BOOTLOADER_SZ 0x80
-- 
1.6.6.1

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


[PATCH v2 1/2] omap: sram: fix is_sram_locked check

2010-07-11 Thread Vikram Pandita
For OMAP24xx/34xx/44xx: omap_type() returns the correct type:
 OMAP2_DEVICE_TYPE_TEST
 OMAP2_DEVICE_TYPE_EMU
 OMAP2_DEVICE_TYPE_SEC
 OMAP2_DEVICE_TYPE_GP
 OMAP2_DEVICE_TYPE_BAD

In current implementation there are two problems:
Problem 1:
For 34xx, the current if check will never return true.

Problem 2:
For 24xx the correct type check should be with omap_type() function
Verified by checking the TRM 24xx for CONTROL_STATUS register bits

Signed-off-by: Vikram Pandita vikram.pand...@ti.com
Acked-by: Santosh Shilimkar santosh.shilim...@ti.com
---

Not fixing the omap_type() check for OMAP4 since Santosh suggests there is
a clean 44xx register definition change coming that would fix the issue

 arch/arm/plat-omap/sram.c |7 +--
 1 files changed, 1 insertions(+), 6 deletions(-)

diff --git a/arch/arm/plat-omap/sram.c b/arch/arm/plat-omap/sram.c
index 226b2e8..2eb5a27 100644
--- a/arch/arm/plat-omap/sram.c
+++ b/arch/arm/plat-omap/sram.c
@@ -93,16 +93,11 @@ extern unsigned long omapfb_reserve_sram(unsigned long 
sram_pstart,
  */
 static int is_sram_locked(void)
 {
-   int type = 0;
-
if (cpu_is_omap44xx())
/* Not yet supported */
return 0;
 
-   if (cpu_is_omap242x())
-   type = omap_rev()  OMAP2_DEVICETYPE_MASK;
-
-   if (type == GP_DEVICE) {
+   if (OMAP2_DEVICE_TYPE_GP == omap_type()) {
/* RAMFW: R/W access to all initiators for all qualifier sets */
if (cpu_is_omap242x()) {
__raw_writel(0xFF, OMAP24XX_VA_REQINFOPERM0); /* all 
q-vects */
-- 
1.6.6.1

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


[PATCH v2] omap4: fix omap_type() function

2010-07-11 Thread Vikram Pandita
Following patch added the omap_type() functionality for omap4
737daa03: omap4: Fix omap_type() for omap4

However the omap_type() function would not work as:
1) the base address for CONTROL_STATUS register is wrong
So insted of using omap_ctrl_readl that has a different base offset,
use a correct offset using omap_readl

2) Not yet supported check for omap4 needs to be removed

Verified on OMAP4 SDP board

Signed-off-by: Vikram Pandita vikram.pand...@ti.com
Cc: Shilimkar, Santosh santosh.shilim...@ti.com
---

V1: had broken mmc support
V2: No mmc break; use omap_readl to get to the right register

 arch/arm/mach-omap2/id.c  |2 +-
 arch/arm/plat-omap/sram.c |4 
 2 files changed, 1 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index 37b8a1a..6d47f91 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -58,7 +58,7 @@ int omap_type(void)
} else if (cpu_is_omap34xx()) {
val = omap_ctrl_readl(OMAP343X_CONTROL_STATUS);
} else if (cpu_is_omap44xx()) {
-   val = omap_ctrl_readl(OMAP44XX_CONTROL_STATUS);
+   val = omap_readl(OMAP443X_SCM_BASE + OMAP44XX_CONTROL_STATUS);
} else {
pr_err(Cannot detect omap type!\n);
goto out;
diff --git a/arch/arm/plat-omap/sram.c b/arch/arm/plat-omap/sram.c
index a72b391..98c86ff 100644
--- a/arch/arm/plat-omap/sram.c
+++ b/arch/arm/plat-omap/sram.c
@@ -93,10 +93,6 @@ extern unsigned long omapfb_reserve_sram(unsigned long 
sram_pstart,
  */
 static int is_sram_locked(void)
 {
-   if (cpu_is_omap44xx())
-   /* Not yet supported */
-   return 0;
-
if (OMAP2_DEVICE_TYPE_GP == omap_type()) {
/* RAMFW: R/W access to all initiators for all qualifier sets */
if (cpu_is_omap242x()) {
-- 
1.6.6.1

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


[PATCH]omap:dmtimer:no null check for kzalloc

2010-07-11 Thread Tarun Kanti DebBarma
This patch incorporates null pointer check associated with memory allocation
for omap_dm_timer_plat_info using kzalloc()

Tested on OMAP4430 SDP.

Signed-off-by: Tarun Kanti Debbarma tarun.ka...@ti.com
--- 
 arch/arm/mach-omap2/dmtimers.c |   20 ++--
 1 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/dmtimers.c b/arch/arm/mach-omap2/dmtimers.c
index 772be63..a7e9ac5 100644
--- a/arch/arm/mach-omap2/dmtimers.c
+++ b/arch/arm/mach-omap2/dmtimers.c
@@ -248,7 +248,12 @@ void __init omap2_dm_timer_early_init(void)
 
pdata = kzalloc(sizeof(struct omap_dm_timer_plat_info),
GFP_KERNEL);
-
+   if (!pdata) {
+   pr_err(%s: \
+   No memory for omap_dm_timer_plat_info\n,
+   __func__);
+   return -ENOMEM;
+   }
pdata-omap_dm_clk_enable = omap2_dm_timer_enable;
pdata-omap_dm_clk_disable = omap2_dm_timer_disable;
pdata-omap_dm_set_source_clk = omap2_dm_timer_set_clk;
@@ -346,6 +351,12 @@ int __init omap2_dm_timer_init(void)
 
pdata = kzalloc(sizeof(struct omap_dm_timer_plat_info),
GFP_KERNEL);
+   if (!pdata) {
+   pr_err(%s: \
+   No memory for omap_dm_timer_plat_info\n,
+   __func__);
+   return -ENOMEM;
+   }
pdata-omap_dm_clk_enable = omap2_dm_timer_enable;
pdata-omap_dm_clk_disable = omap2_dm_timer_disable;
pdata-omap_dm_set_source_clk = omap2_dm_timer_set_clk;
@@ -397,7 +408,12 @@ fail:
break;
pdata = kzalloc(sizeof(struct omap_dm_timer_plat_info),
GFP_KERNEL);
-
+   if (!pdata) {
+   pr_err(%s: \
+   No memory for omap_dm_timer_plat_info\n,
+   __func__);
+   return -ENOMEM;
+   }
pdata-omap_dm_clk_enable = omap2_dm_timer_enable;
pdata-omap_dm_clk_disable = omap2_dm_timer_disable;
pdata-omap_dm_set_source_clk = omap2_dm_timer_set_clk;
--
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:dmtimer:no null check for kzalloc

2010-07-11 Thread Artem Bityutskiy
On Mon, 2010-07-12 at 03:39 +0530, Tarun Kanti DebBarma wrote:
 +   if (!pdata) {
 +   pr_err(%s: \
 +   No memory for omap_dm_timer_plat_info\n,
 +   __func__);
 +   return -ENOMEM;
 +   }

do not use concatenation ('\'), this is probably not what you want.

-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)

--
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 1/3 v3] mm: iommu: An API to unify IOMMU, CPU and device memory management

2010-07-11 Thread FUJITA Tomonori
On Thu, 08 Jul 2010 16:59:52 -0700
Zach Pfeffer zpfef...@codeaurora.org wrote:

 The problem I'm trying to solve boils down to this: map a set of
 contiguous physical buffers to an aligned IOMMU address. I need to
 allocate the set of physical buffers in a particular way: use 1 MB
 contiguous physical memory, then 64 KB, then 4 KB, etc. and I need to
 align the IOMMU address in a particular way.

Sounds like the DMA API already supports what you want.

You can set segment_boundary_mask in struct device_dma_parameters if
you want to align the IOMMU address. See IOMMU implementations that
support dma_get_seg_boundary() properly.
--
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:dmtimer:no null check for kzalloc

2010-07-11 Thread DebBarma, Tarun Kanti
 -Original Message-
 From: Artem Bityutskiy [mailto:dedeki...@gmail.com]
 Sent: Sunday, July 11, 2010 11:33 PM
 To: DebBarma, Tarun Kanti
 Cc: olbp...@list.ti.com - OMAP Linux Baseport Development Team (May
 contain non-TIers); linux-omap@vger.kernel.org
 Subject: Re: [PATCH]omap:dmtimer:no null check for kzalloc
 
 On Mon, 2010-07-12 at 03:39 +0530, Tarun Kanti DebBarma wrote:
  +   if (!pdata) {
  +   pr_err(%s: \
  +   No memory for
 omap_dm_timer_plat_info\n,
  +   __func__);
  +   return -ENOMEM;
  +   }
 
 do not use concatenation ('\'), this is probably not what you want.

Oops! Thanks for pointing this out. I will change.
 
 --
 Best Regards,
 Artem Bityutskiy (Артём Битюцкий)

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


[PATCHv2]omap:dmtimer:no null check for kzalloc

2010-07-11 Thread Tarun Kanti DebBarma
This patch incorporates null pointer check associated with memory allocation
for omap_dm_timer_plat_info using kzalloc()

version 2 change list:
(i) removed concatenate (\) in pr_err()
(ii) changed return type of omap2_dm_timer_early_init() from void to int
in order to support return -ENOMEM
(iii) made other related changes with regard to return type.

Tested on OMAP4430 SDP.

Signed-off-by: Tarun Kanti Debbarma tarun.ka...@ti.com
---
 arch/arm/mach-omap2/dmtimers.c |   26 +-
 arch/arm/mach-omap2/dmtimers.h |2 +-
 2 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-omap2/dmtimers.c b/arch/arm/mach-omap2/dmtimers.c
index 772be63..1540627 100644
--- a/arch/arm/mach-omap2/dmtimers.c
+++ b/arch/arm/mach-omap2/dmtimers.c
@@ -192,7 +192,7 @@ void __init omap2_dm_timer_setup_clksrc(void)
is_initialized = 1;
 }
 
-void __init omap2_dm_timer_early_init(void)
+int __init omap2_dm_timer_early_init(void)
 {
int i = 0;
 
@@ -219,7 +219,7 @@ void __init omap2_dm_timer_early_init(void)
break;
default:
/* Error should never enter here */
-   return;
+   return -EINVAL;
}
 
pdata-io_base = ioremap(base, SZ_8K);
@@ -248,7 +248,12 @@ void __init omap2_dm_timer_early_init(void)
 
pdata = kzalloc(sizeof(struct omap_dm_timer_plat_info),
GFP_KERNEL);
-
+   if (!pdata) {
+   pr_err(%s:
+   No memory for omap_dm_timer_plat_info\n,
+   __func__);
+   return -ENOMEM;
+   }
pdata-omap_dm_clk_enable = omap2_dm_timer_enable;
pdata-omap_dm_clk_disable = omap2_dm_timer_disable;
pdata-omap_dm_set_source_clk = omap2_dm_timer_set_clk;
@@ -271,7 +276,7 @@ void __init omap2_dm_timer_early_init(void)
omap2_dm_timer_setup_clksrc();
early_platform_driver_register_all(earlytimer);
early_platform_driver_probe(earlytimer, NO_EARLY_TIMERS, 0);
-   return;
+   return 0;
 }
 
 int __init omap2_dm_timer_init(void)
@@ -346,6 +351,12 @@ int __init omap2_dm_timer_init(void)
 
pdata = kzalloc(sizeof(struct omap_dm_timer_plat_info),
GFP_KERNEL);
+   if (!pdata) {
+   pr_err(%s:
+   No memory for omap_dm_timer_plat_info\n,
+   __func__);
+   return -ENOMEM;
+   }
pdata-omap_dm_clk_enable = omap2_dm_timer_enable;
pdata-omap_dm_clk_disable = omap2_dm_timer_disable;
pdata-omap_dm_set_source_clk = omap2_dm_timer_set_clk;
@@ -397,7 +408,12 @@ fail:
break;
pdata = kzalloc(sizeof(struct omap_dm_timer_plat_info),
GFP_KERNEL);
-
+   if (!pdata) {
+   pr_err(%s:
+   No memory for omap_dm_timer_plat_info\n,
+   __func__);
+   return -ENOMEM;
+   }
pdata-omap_dm_clk_enable = omap2_dm_timer_enable;
pdata-omap_dm_clk_disable = omap2_dm_timer_disable;
pdata-omap_dm_set_source_clk = omap2_dm_timer_set_clk;
diff --git a/arch/arm/mach-omap2/dmtimers.h b/arch/arm/mach-omap2/dmtimers.h
index 2309e4a..afb2d36 100644
--- a/arch/arm/mach-omap2/dmtimers.h
+++ b/arch/arm/mach-omap2/dmtimers.h
@@ -52,6 +52,6 @@
 #define OMAP44XX_GPTIMER11_BASE 0x48088000
 #define OMAP44XX_GPTIMER12_BASE 0x4a32
 
-void __init omap2_dm_timer_early_init(void);
+int __init omap2_dm_timer_early_init(void);
 
 #endif
--
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] usb: musb: Offmode fix for idle path

2010-07-11 Thread Kalliguddi, Hema
 Hello,

-Original Message-
From: Sergei Shtylyov [mailto:sshtyl...@mvista.com] 
Sent: Thursday, July 08, 2010 6:58 PM
To: Kalliguddi, Hema
Cc: linux-...@vger.kernel.org; linux-omap@vger.kernel.org; 
Mankad, Maulik Ojas; Felipe Balbi; Tony Lindgren; Kevin Hilman
Subject: Re: [PATCH] usb: musb: Offmode fix for idle path

Hello.

Hema HK wrote:

 With OMAP coreoff support usb was not functional as context 
was getting
 lost after wakeup from coreoff. And also usb was blocking 
the coreoff 

USB is an acronym.

Agree I will change it accordingly.

 after loading the gadget driver even with no cable connected 
sometimes.

 Added the conext save/restore api in the platform layer which will

API is an acronym.

Agree.

 be called in the idle and wakeup path.

 Changed the usb sysconfig settings as per the usbotg functional spec.

Do you mean the OTG supplement to USB 2.0 spec. or something else?

No it is TI OMAP USBOTG functional specifications.

 When the device is not used, configure in force idle and 
force standby mode.
 When it is being used, configure in smart standby and smart 
idle mode.
 So while attempting to coreoff the usb is configured to 
force standby and 
 force idle mode, after wakeup configured in smart idle and 
smart standby.

 Since clock used for musb is auto gated, there is no need to 
specifically
 enable/disable the clock. Removed enable/disable clock in 
suspend resume api.

I'm not sure it's auto-gated on all platforms...

Might be. need to check this. 

Blackfin guys,
Please comment...


 Signed-off-by: Hema HK hem...@ti.com
 Signed-off-by: Maulik Mankad x0082...@ti.com

 Cc: Felipe Balbi felipe.ba...@nokia.com
 Cc: Tony Lindgren t...@atomide.com
 Cc: Kevin Hilman khil...@deeprootsystems.com

 Index: linux-omap-pm/arch/arm/mach-omap2/usb-musb.c
 ===
 --- linux-omap-pm.orig/arch/arm/mach-omap2/usb-musb.c
 +++ linux-omap-pm/arch/arm/mach-omap2/usb-musb.c
 @@ -177,6 +177,21 @@ void __init usb_musb_init(struct omap_mu
  usb_musb_pm_init();
  }
  
 +void musb_context_save_restore(int save)
 +{
 +struct device *dev = musb_device.dev;
 +struct device_driver *drv = dev-driver;

Need an empty line here.

OK.
 +if (dev-driver) {

   You've just assigned that to 'drv' -- why not use it?

I will do that.

 Index: linux-omap-pm/arch/arm/plat-omap/include/plat/usb.h
 ===
 --- linux-omap-pm.orig/arch/arm/plat-omap/include/plat/usb.h
 +++ linux-omap-pm/arch/arm/plat-omap/include/plat/usb.h
 @@ -82,6 +82,8 @@ extern void usb_ohci_init(const struct o
  /* This is needed for OMAP3 errata 1.164: enabled autoidle 
can prevent sleep */
  extern void usb_musb_disable_autoidle(void);
  
 +/* For saving and restoring the musb context during off/wakeup*/
 +extern void musb_context_save_restore(int save);
  #endif
  
  void omap_usb_init(struct omap_usb_config *pdata);
 Index: linux-omap-pm/drivers/usb/musb/musb_core.c
 ===
 --- linux-omap-pm.orig/drivers/usb/musb/musb_core.c
 +++ linux-omap-pm/drivers/usb/musb/musb_core.c
 @@ -2430,11 +2430,6 @@ static int musb_suspend(struct device *d
  }
  
  musb_save_context(musb);
 -
 -if (musb-set_clock)
 -musb-set_clock(musb-clock, 0);
 -else
 -clk_disable(musb-clock);
  spin_unlock_irqrestore(musb-lock, flags);
  return 0;
  }
 @@ -2446,12 +2441,6 @@ static int musb_resume_noirq(struct devi
  
  if (!musb-clock)
  return 0;
 -
 -if (musb-set_clock)
 -musb-set_clock(musb-clock, 1);
 -else
 -clk_enable(musb-clock);
 -

OK, maybe for OMAP the clock is auto-gated but what about 
the other platforms?


For OMAP it is autogated. 

Blackfin guys comments please?

  musb_restore_context(musb);
  
  /* for static cmos like DaVinci, register values were preserved
 Index: linux-omap-pm/drivers/usb/musb/omap2430.c
 ===
 --- linux-omap-pm.orig/drivers/usb/musb/omap2430.c
 +++ linux-omap-pm/drivers/usb/musb/omap2430.c
 @@ -257,15 +257,39 @@ int __init musb_platform_init(struct mus
  void musb_platform_save_context(struct musb *musb,
  struct musb_context_registers *musb_context)
  {
 -musb_context-otg_sysconfig = musb_readl(musb-mregs, 
OTG_SYSCONFIG);
 -musb_context-otg_forcestandby = 
musb_readl(musb-mregs, OTG_FORCESTDBY);
 +/*
 + * As per the specification, configure it to forced standby
 + * and  force idle mode when no activity on usb.
 + */
 +void __iomem *musb_base = musb-mregs;

Need an empty line here.

OK. 
 +musb_writel(musb_base, OTG_FORCESTDBY, 0);
 +musb_writel(musb_base, OTG_SYSCONFIG, musb_readl(musb_base,
 +OTG_SYSCONFIG)  ~(NOSTDBY | 
SMARTSTDBY));
 +
 +musb_writel(musb_base,