Re: [PATCH v5 0/7] Add TI EMIF SDRAM controller driver

2012-05-03 Thread Shilimkar, Santosh
On Wed, May 2, 2012 at 11:33 PM, Greg KH gre...@linuxfoundation.org wrote:
 On Wed, May 02, 2012 at 12:20:24PM +0530, Santosh Shilimkar wrote:
 Greg,

 On Wednesday 02 May 2012 10:46 AM, Greg KH wrote:
  On Fri, Apr 27, 2012 at 05:54:02PM +0530, Santosh Shilimkar wrote:
  Add a driver for the EMIF SDRAM controller used in Texas Instrument SoCs
 
  EMIF is an SDRAM controller that supports, based on its revision,
  one or more of LPDDR2/DDR2/DDR3 protocols.This driver adds support
  for LPDDR2.
 
  The driver supports the following features:
  - Calculates the DDR AC timing parameters to be set in EMIF
    registers using data from the device data-sheets and based
    on the DDR frequency. If data from data-sheets is not available
    default timing values from the JEDEC spec are used. These
    will be safe, but not necessarily optimal
  - API for changing timings during DVFS or at boot-up
  - Temperature alert configuration and handling of temperature
    alerts, if any for LPDDR2 devices
    * temperature alert is based on periodic polling of MR4 mode
      register in DDR devices automatically performed by hardware
    * timings are de-rated and brought back to nominal when
      temperature raises and falls respectively
  - Cache of calculated register values to avoid re-calculating
    them
 
  The driver will need some minor updates when it is eventually
  integrated with Dynamic Voltage and Frequency Scaling (DVFS).
  This can not be done now as DVFS support is not available in
  the mainline yet.
 
  Discussions with Santosh Shilimkar santosh.shilim...@ti.com
  were immensely helpful in shaping up the interfaces. Vibhore Vardhan
  vvard...@gmail.com did the initial code snippet for thermal
  handling.
 
  Testing:
  - The driver is tested on OMAP4430 SDP.
  - The driver in a slightly adapted form is also tested on OMAP5.
  - Since mainline kernel doesn't have DVFS support yet,
    testing was done using a test module.
  - Temperature alert handling was tested with simulated interrupts
    and faked temperature values as testing all cases in real-life
    scenarios is difficult.
  - Tested the driver as a module
 
  Cc: Greg KH g...@kroah.com
 
  This all looks good to me now, thanks for reworking this.
 
  So, do you want me to take this through my driver tree to get to Linus
  for 3.5, or do you want it to go through somewhere else?
 
  If somewhere else, that's fine with me, consider this an:
      Acked-by: Greg Kroah-Hartman gre...@linuxfoundation.org
 
  If you want me to take it, just let me know, whichever you prefer is
  fine with me.
 
 Can you take this one through your 3.5 driver tree please ?
 Thanks for help.

 Ok, all now applied.

Thanks !!

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 2/5] ARM: OMAP2+: PM: use the power domains registers cache for the power states

2012-05-03 Thread Bedia, Vaibhav
On Tue, May 01, 2012 at 21:07:39, Hunter, Jon wrote:
[...]
   int pwrdm_read_pwrst(struct powerdomain *pwrdm)
   {
  -   int ret = -EINVAL;
  +   int pwrst, ret = -EINVAL;
   
  if (!pwrdm)
  return -EINVAL;
   
  -   if (arch_pwrdm  arch_pwrdm-pwrdm_read_pwrst)
  +   if (!pwrdm_cache_read(pwrdm, PWRDM_CACHE_PWRST, pwrst))
  +   return pwrst;
  +
  +   if (arch_pwrdm  arch_pwrdm-pwrdm_read_pwrst) {
  ret = arch_pwrdm-pwrdm_read_pwrst(pwrdm);
  +   if (ret = 0)
  +   pwrdm_cache_write(pwrdm, PWRDM_CACHE_PWRST, ret);
  +   }
 
 Do we really want to use the cache for the current state? This is
 updated by hardware. In the above it appears that once we have read it
 once we will just return this value until the cache is invalidated.
 Makes me a little nervous.
 

I echo the concern here. If a powerdomain transition occurs when h/w conditions
are met, the cached values will go out of sync and this may lead to unexpected
behavior wherever this API is being used.

As Jon pointed out in another patch, the registers which can be updated by h/w 
should
be handled differently.

Just a wild thought, can PRCM_MPU_IRQ ([4]TRANSITION_EN) be used as a trigger 
to update
the cache if the transition happened under s/w control?

Regards,
Vaibhav
--
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] arm: omap: Use only valid power domain states

2012-05-03 Thread Jean Pihet
Hi Mark,

On Thu, May 3, 2012 at 12:04 AM, Mark A. Greer mgr...@animalcreek.com wrote:
 On Tue, May 01, 2012 at 10:47:35AM +0200, Jean Pihet wrote:
 Hi Mark,

 Hi Jean.  Thanks for the review.

 On Mon, Apr 30, 2012 at 11:25 PM, Mark A. Greer mgr...@animalcreek.com 
 wrote:
  From: Mark A. Greer mgr...@animalcreek.com

  diff --git a/arch/arm/mach-omap2/cpuidle34xx.c 
  b/arch/arm/mach-omap2/cpuidle34xx.c
  index 5358664..2c91711 100644
  --- a/arch/arm/mach-omap2/cpuidle34xx.c
  +++ b/arch/arm/mach-omap2/cpuidle34xx.c
  @@ -175,19 +175,25 @@ static int next_valid_state(struct cpuidle_device 
  *dev,
         struct cpuidle_state_usage *curr_usage = dev-states_usage[index];
         struct cpuidle_state *curr = drv-states[index];
         struct omap3_idle_statedata *cx = cpuidle_get_statedata(curr_usage);
  -       u32 mpu_deepest_state = PWRDM_POWER_RET;
  -       u32 core_deepest_state = PWRDM_POWER_RET;
  +       u32 mpu_deepest_state, mpu_deepest_possible;
  +       u32 core_deepest_state, core_deepest_possible;
         int next_index = -1;
 
  +       mpu_deepest_possible = pwrdm_get_deepest_state(mpu_pd);
  +       mpu_deepest_state = max_t(u32, mpu_deepest_possible, 
  PWRDM_POWER_RET);
 I do not think you need to change the pwrdm API and the cpuidle code for 
 that.
 Instead you should use the pwrst* fields in the power domains data
 files, which allow to specify the allowed states.
 After reading the rest of your patches it seems you are addressing the
 issue in a subsequent patch 'arm: omap3: am35x: Set proper powerdomain
 states'.

 That patch sets the allowable power domain states for the am35x; the intent
 of this patch was to make the code respect what is set in the pwrst* fields.

  diff --git a/arch/arm/mach-omap2/powerdomain.c 
  b/arch/arm/mach-omap2/powerdomain.c
  index 96ad3dbe..9c80c19 100644
  --- a/arch/arm/mach-omap2/powerdomain.c
  +++ b/arch/arm/mach-omap2/powerdomain.c
  @@ -1078,3 +1078,28 @@ bool pwrdm_can_ever_lose_context(struct powerdomain 
  *pwrdm)
 
         return 0;
   }
  +
  +/**
  + * pwrdm_get_deepest_state - Get deepest valid state domain can enter
  + * @pwrdm: struct powerdomain *
  + *
  + * Find and return the deepest valid state a power domain can be in.
  + * Returns the deepest state that @pwrdm can enter.
  + */
  +u32 pwrdm_get_deepest_state(struct powerdomain *pwrdm)
  +{
  +       u32 valid_states, deepest_state;
  +
  +       valid_states = pwrdm-pwrsts;
  +
  +       if (valid_states  PWRSTS_OFF)
  +               deepest_state = PWRDM_POWER_OFF;
  +       else if (valid_states  PWRSTS_RET)
  +               deepest_state = PWRDM_POWER_RET;
  +       else if (valid_states  PWRSTS_INACTIVE)
  +               deepest_state = PWRDM_POWER_INACTIVE;
  +       else
  +               deepest_state = PWRDM_POWER_ON;
  +
  +       return deepest_state;
  +}

 The pwrdm API already performs those checks on pwrst*, cf.
 pwrdm_set_next_pwrst for example.

 Well, sort of.  pwrdm_set_next_pwrst() fails if its an invalid state
 returning -EINVAL.  Very few of the callers actually check to see if
 it failed so they don't try the next-one-up power state.  The net
 result is that the next state doesn't change even though it could
 move to a lower state (just not the one that was asked for).

 Is that acceptable?
No that is not acceptable. In fact the next power state should only be
set using omap_set_pwrdm_state, which falls back to the next valid
power state. Note: my latest patches about the functional power states
is using omap_set_pwrdm_state as the only function to set the power,
logic states.

 Another sort of strange one is omap3_pm_off_mode_enable().  If its
 called with 'enable' set and PWRDM_POWER_OFF isn't a valid state,
 omap_set_pwrdm_state() will return 0 and leave the next state alone.
 When omap3_pm_off_mode_enable() is called again with 'enable' set,
 omap_set_pwrdm_state() will find the lowest valid state = RET.
 So, if you had a device where OFF wasn't valid but RET was and
 its currently ON, when the user enables OFF mode, it stays ON
 and when they disable OFF mode, it moves to RET.

 Is that acceptable?
No. omap_set_pwrdm_state should be fixed in that case.
In fact the enable_off_mode flag is scheduled for removal in favor of
the PM QoS constraints.

 If the things above are acceptable, then I think you're right, we can
 forget this patch.  FYI, the am35x appears to work okay and no invalid
 states are entered (according to /sys/kernel/debug/pm_debug/count)
 without this patch.
I think we should fix the existing code if it has problems, not add
more specific code.

Kevin, what is your take on this?

 Mark

Regards,
Jean
--
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 0/4] OMAPDSS: APPLY: Treat overlay manager timings as shadow registers

2012-05-03 Thread Archit Taneja
An overlay manager's timings (the manager size, and blanking parameters if an
LCD manager) are DISPC shadow registers, and they should hence follow the
correct programming model.

This set makes the timings an extra_info parameter in manager's private data .
The interface drivers now apply the timings in instead of directly writing to
registers.

This change also prevents the need to use display resolution for overlay
checks, hence making some of the APPLY functions less dependent on the display.

Changes since v2:

- Manager timings are represented as extra_info.
- The DISPC related cleanups are removed since they have already been taken.

These patches apply over:

git://gitorious.org/linux-omap-dss2/linux.git dev

Archit Taneja (4):
  OMAPDSS: APPLY: Add manager timings as extra_info in private data
  OMAPDSS: Apply manager timings instead of direct DISPC writes
  OMAPDSS: MANAGER: Create a function to check manager timings
  OMAPDSS: APPLY: Remove display dependency from overlay and manager
checks

 drivers/video/omap2/dss/apply.c   |  142 ++---
 drivers/video/omap2/dss/dpi.c |4 +-
 drivers/video/omap2/dss/dsi.c |5 +-
 drivers/video/omap2/dss/dss.h |9 ++-
 drivers/video/omap2/dss/hdmi.c|2 +-
 drivers/video/omap2/dss/manager.c |   19 +-
 drivers/video/omap2/dss/overlay.c |   20 +++---
 drivers/video/omap2/dss/rfbi.c|4 +-
 drivers/video/omap2/dss/sdi.c |2 +-
 drivers/video/omap2/dss/venc.c|2 +-
 10 files changed, 158 insertions(+), 51 deletions(-)

-- 
1.7.5.4

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


[PATCH v2 1/4] OMAPDSS: APPLY: Add manager timings as extra_info in private data

2012-05-03 Thread Archit Taneja
DISPC manager size and DISPC manager blanking parameters(for LCD managers)
follow the shadow register programming model. Currently, they are programmed
directly by the interface drivers.

To configure manager timings using APPLY, there is a need to introduce extra
info flags for managers, similar to what is done for overlays. This is needed
because timings aren't a part of overlay_manager_info struct configured by a
user of DSS, they are configured internally by the interface or panel drivers.

Add dirty and shadow_dirty extra_info flags for managers, update these flags
at the appropriate places. Rewrite the function extra_info_update_ongoing()
slightly as checking for manager's extra_info flags can simplify the code a bit.

Create function dss_mgr_set_timings() which applies the new manager timings to
extra_info.

Signed-off-by: Archit Taneja arc...@ti.com
---
 drivers/video/omap2/dss/apply.c |   91 +--
 drivers/video/omap2/dss/dss.h   |2 +
 2 files changed, 80 insertions(+), 13 deletions(-)

diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c
index b10b3bc..42c3854 100644
--- a/drivers/video/omap2/dss/apply.c
+++ b/drivers/video/omap2/dss/apply.c
@@ -99,6 +99,11 @@ struct mgr_priv_data {
 
/* If true, a display is enabled using this manager */
bool enabled;
+
+   bool extra_info_dirty;
+   bool shadow_extra_info_dirty;
+
+   struct omap_video_timings timings;
 };
 
 static struct {
@@ -261,6 +266,20 @@ static bool need_isr(void)
if (mp-shadow_info_dirty)
return true;
 
+   /*
+* NOTE: we don't check extra_info flags for disabled
+* managers, once the manager is enabled, the extra_info
+* related manager changes will be taken in by HW.
+*/
+
+   /* to write new values to registers */
+   if (mp-extra_info_dirty)
+   return true;
+
+   /* to set GO bit */
+   if (mp-shadow_extra_info_dirty)
+   return true;
+
list_for_each_entry(ovl, mgr-overlays, list) {
struct ovl_priv_data *op;
 
@@ -305,7 +324,7 @@ static bool need_go(struct omap_overlay_manager *mgr)
 
mp = get_mgr_priv(mgr);
 
-   if (mp-shadow_info_dirty)
+   if (mp-shadow_info_dirty || mp-shadow_extra_info_dirty)
return true;
 
list_for_each_entry(ovl, mgr-overlays, list) {
@@ -320,20 +339,16 @@ static bool need_go(struct omap_overlay_manager *mgr)
 /* returns true if an extra_info field is currently being updated */
 static bool extra_info_update_ongoing(void)
 {
-   const int num_ovls = omap_dss_get_num_overlays();
-   struct ovl_priv_data *op;
-   struct omap_overlay *ovl;
-   struct mgr_priv_data *mp;
+   const int num_mgrs = dss_feat_get_num_mgrs();
int i;
 
-   for (i = 0; i  num_ovls; ++i) {
-   ovl = omap_dss_get_overlay(i);
-   op = get_ovl_priv(ovl);
-
-   if (!ovl-manager)
-   continue;
+   for (i = 0; i  num_mgrs; ++i) {
+   struct omap_overlay_manager *mgr;
+   struct omap_overlay *ovl;
+   struct mgr_priv_data *mp;
 
-   mp = get_mgr_priv(ovl-manager);
+   mgr = omap_dss_get_overlay_manager(i);
+   mp = get_mgr_priv(mgr);
 
if (!mp-enabled)
continue;
@@ -341,8 +356,15 @@ static bool extra_info_update_ongoing(void)
if (!mp-updating)
continue;
 
-   if (op-extra_info_dirty || op-shadow_extra_info_dirty)
+   if (mp-extra_info_dirty || mp-shadow_extra_info_dirty)
return true;
+
+   list_for_each_entry(ovl, mgr-overlays, list) {
+   struct ovl_priv_data *op = get_ovl_priv(ovl);
+
+   if (op-extra_info_dirty || op-shadow_extra_info_dirty)
+   return true;
+   }
}
 
return false;
@@ -601,6 +623,22 @@ static void dss_mgr_write_regs(struct omap_overlay_manager 
*mgr)
}
 }
 
+static void dss_mgr_write_regs_extra(struct omap_overlay_manager *mgr)
+{
+   struct mgr_priv_data *mp = get_mgr_priv(mgr);
+
+   DSSDBGF(%d, mgr-id);
+
+   if (!mp-extra_info_dirty)
+   return;
+
+   dispc_mgr_set_timings(mgr-id, mp-timings);
+
+   mp-extra_info_dirty = false;
+   if (mp-updating)
+   mp-shadow_extra_info_dirty = true;
+}
+
 static void dss_write_regs_common(void)
 {
const int num_mgrs = omap_dss_get_num_overlay_managers();
@@ -654,6 +692,7 @@ static void dss_write_regs(void)
}
 
   

[PATCH v2 2/4] OMAPDSS: Apply manager timings instead of direct DISPC writes

2012-05-03 Thread Archit Taneja
Replace the function dispc_mgr_set_timings() with dss_mgr_set_timings() in the
interface drivers. The latter function ensures that the timing related DISPC
registers are configured according to the shadow register programming model.

Signed-off-by: Archit Taneja arc...@ti.com
---
 drivers/video/omap2/dss/dpi.c  |2 +-
 drivers/video/omap2/dss/dsi.c  |5 ++---
 drivers/video/omap2/dss/hdmi.c |2 +-
 drivers/video/omap2/dss/rfbi.c |4 ++--
 drivers/video/omap2/dss/sdi.c  |2 +-
 drivers/video/omap2/dss/venc.c |2 +-
 6 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/video/omap2/dss/dpi.c b/drivers/video/omap2/dss/dpi.c
index cec1166..5d84ab0 100644
--- a/drivers/video/omap2/dss/dpi.c
+++ b/drivers/video/omap2/dss/dpi.c
@@ -156,7 +156,7 @@ static int dpi_set_mode(struct omap_dss_device *dssdev)
t-pixel_clock = pck;
}
 
-   dispc_mgr_set_timings(dssdev-manager-id, t);
+   dss_mgr_set_timings(dssdev-manager, t);
 
return 0;
 }
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index b6cf03c..db73598 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -4219,13 +4219,12 @@ static int dsi_display_init_dispc(struct 
omap_dss_device *dssdev)
dispc_mgr_enable_stallmode(dssdev-manager-id, true);
dispc_mgr_enable_fifohandcheck(dssdev-manager-id, 1);
 
-   dispc_mgr_set_timings(dssdev-manager-id, timings);
+   dss_mgr_set_timings(dssdev-manager, timings);
} else {
dispc_mgr_enable_stallmode(dssdev-manager-id, false);
dispc_mgr_enable_fifohandcheck(dssdev-manager-id, 0);
 
-   dispc_mgr_set_timings(dssdev-manager-id,
-   dssdev-panel.timings);
+   dss_mgr_set_timings(dssdev-manager, dssdev-panel.timings);
}
 
dispc_mgr_set_lcd_display_type(dssdev-manager-id,
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index 56f6e9c..8d4ff8c 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -376,7 +376,7 @@ static int hdmi_power_on(struct omap_dss_device *dssdev)
dispc_enable_gamma_table(0);
 
/* tv size */
-   dispc_mgr_set_timings(dssdev-manager-id, dssdev-panel.timings);
+   dss_mgr_set_timings(dssdev-manager, dssdev-panel.timings);
 
hdmi.ip_data.ops-video_enable(hdmi.ip_data, 1);
 
diff --git a/drivers/video/omap2/dss/rfbi.c b/drivers/video/omap2/dss/rfbi.c
index a81ffcb..feadfab 100644
--- a/drivers/video/omap2/dss/rfbi.c
+++ b/drivers/video/omap2/dss/rfbi.c
@@ -320,7 +320,7 @@ static void rfbi_transfer_area(struct omap_dss_device 
*dssdev, u16 width,
 
DSSDBG(rfbi_transfer_area %dx%d\n, width, height);
 
-   dispc_mgr_set_timings(dssdev-manager-id, timings);
+   dss_mgr_set_timings(dssdev-manager, timings);
 
dispc_mgr_enable(dssdev-manager-id, true);
 
@@ -804,7 +804,7 @@ int omap_rfbi_prepare_update(struct omap_dss_device *dssdev,
if (*w == 0 || *h == 0)
return -EINVAL;
 
-   dispc_mgr_set_timings(dssdev-manager-id, timings);
+   dss_mgr_set_timings(dssdev-manager, timings);
 
return 0;
 }
diff --git a/drivers/video/omap2/dss/sdi.c b/drivers/video/omap2/dss/sdi.c
index 741b834..67fbe7c 100644
--- a/drivers/video/omap2/dss/sdi.c
+++ b/drivers/video/omap2/dss/sdi.c
@@ -107,7 +107,7 @@ int omapdss_sdi_display_enable(struct omap_dss_device 
*dssdev)
}
 
 
-   dispc_mgr_set_timings(dssdev-manager-id, t);
+   dss_mgr_set_timings(dssdev-manager, t);
 
r = dss_set_clock_div(dss_cinfo);
if (r)
diff --git a/drivers/video/omap2/dss/venc.c b/drivers/video/omap2/dss/venc.c
index 30bbb63..e237464 100644
--- a/drivers/video/omap2/dss/venc.c
+++ b/drivers/video/omap2/dss/venc.c
@@ -444,7 +444,7 @@ static int venc_power_on(struct omap_dss_device *dssdev)
timings = dssdev-panel.timings;
timings.y_res /= 2;
 
-   dispc_mgr_set_timings(dssdev-manager-id, timings);
+   dss_mgr_set_timings(dssdev-manager, timings);
 
r = regulator_enable(venc.vdda_dac_reg);
if (r)
-- 
1.7.5.4

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


[PATCH v2 3/4] OMAPDSS: MANAGER: Create a function to check manager timings

2012-05-03 Thread Archit Taneja
Create a function dss_mgr_check_timings() which wraps around the function
dispc_mgr_timings_ok(). This is mainly a clean up to hide dispc functions
from interface drivers.

dss_mgr_check_timings() is added in the function dss_mgr_check(), it currently
takes the timings maintained in the omap_dss_device struct. This would be later
replaced by the timings stored in the manager's private data.

Signed-off-by: Archit Taneja arc...@ti.com
---
 drivers/video/omap2/dss/dpi.c |2 +-
 drivers/video/omap2/dss/dss.h |2 ++
 drivers/video/omap2/dss/manager.c |   15 +++
 3 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/drivers/video/omap2/dss/dpi.c b/drivers/video/omap2/dss/dpi.c
index 5d84ab0..8127f46 100644
--- a/drivers/video/omap2/dss/dpi.c
+++ b/drivers/video/omap2/dss/dpi.c
@@ -312,7 +312,7 @@ int dpi_check_timings(struct omap_dss_device *dssdev,
unsigned long pck;
struct dispc_clock_info dispc_cinfo;
 
-   if (!dispc_mgr_timings_ok(dssdev-manager-id, timings))
+   if (!dss_mgr_check_timings(dssdev-manager, timings))
return -EINVAL;
 
if (timings-pixel_clock == 0)
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index ca59481..a148712 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -208,6 +208,8 @@ int dss_init_overlay_managers(struct platform_device *pdev);
 void dss_uninit_overlay_managers(struct platform_device *pdev);
 int dss_mgr_simple_check(struct omap_overlay_manager *mgr,
const struct omap_overlay_manager_info *info);
+int dss_mgr_check_timings(struct omap_overlay_manager *mgr,
+   struct omap_video_timings *timings);
 int dss_mgr_check(struct omap_overlay_manager *mgr,
struct omap_dss_device *dssdev,
struct omap_overlay_manager_info *info,
diff --git a/drivers/video/omap2/dss/manager.c 
b/drivers/video/omap2/dss/manager.c
index e736460..264ad7c 100644
--- a/drivers/video/omap2/dss/manager.c
+++ b/drivers/video/omap2/dss/manager.c
@@ -654,6 +654,17 @@ static int dss_mgr_check_zorder(struct 
omap_overlay_manager *mgr,
return 0;
 }
 
+int dss_mgr_check_timings(struct omap_overlay_manager *mgr,
+   struct omap_video_timings *timings)
+{
+   if (!dispc_mgr_timings_ok(mgr-id, timings)) {
+   DSSERR(check_manager: invalid timings\n);
+   return -EINVAL;
+   }
+
+   return 0;
+}
+
 int dss_mgr_check(struct omap_overlay_manager *mgr,
struct omap_dss_device *dssdev,
struct omap_overlay_manager_info *info,
@@ -668,6 +679,10 @@ int dss_mgr_check(struct omap_overlay_manager *mgr,
return r;
}
 
+   r = dss_mgr_check_timings(mgr, dssdev-panel.timings);
+   if (r)
+   return r;
+
list_for_each_entry(ovl, mgr-overlays, list) {
struct omap_overlay_info *oi;
int r;
-- 
1.7.5.4

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


[PATCH v2 4/4] OMAPDSS: APPLY: Remove display dependency from overlay and manager checks

2012-05-03 Thread Archit Taneja
In order to check the validity of overlay and manager info, there was a need to
use the omap_dss_device struct to get the panel resolution. The manager's
private data in APPLY now contains the manager timings. Hence, we don't need to
rely on the display resolution any more.

Create a function dss_mgr_get_timings() which returns the timings in manager's
private data. Remove the need of passing omap_dss_device structs in the
functions which check for overlay and managers.

Have some initial values for manager timings in apply_init(), these would ensure
that manager checks don't fail if an interface driver or a panel driver hasn't
set the manager timings yet.

Signed-off-by: Archit Taneja arc...@ti.com
---
 drivers/video/omap2/dss/apply.c   |   51 +++-
 drivers/video/omap2/dss/dss.h |5 +--
 drivers/video/omap2/dss/manager.c |6 ++--
 drivers/video/omap2/dss/overlay.c |   20 +++---
 4 files changed, 53 insertions(+), 29 deletions(-)

diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c
index 42c3854..052d9a2 100644
--- a/drivers/video/omap2/dss/apply.c
+++ b/drivers/video/omap2/dss/apply.c
@@ -137,10 +137,30 @@ static struct mgr_priv_data *get_mgr_priv(struct 
omap_overlay_manager *mgr)
 void dss_apply_init(void)
 {
const int num_ovls = dss_feat_get_num_ovls();
+   const int num_mgrs = dss_feat_get_num_ovls();
int i;
+   /* Use dummy manager timings during initialization */
+   struct omap_video_timings timings = {
+   .hsw= 1,
+   .hfp= 1,
+   .hbp= 1,
+   .vsw= 1,
+   .vfp= 0,
+   .vbp= 0,
+   .x_res  = dss_feat_get_param_max(FEAT_PARAM_MGR_WIDTH),
+   .y_res  = dss_feat_get_param_max(FEAT_PARAM_MGR_HEIGHT),
+   };
 
spin_lock_init(data_lock);
 
+   for (i = 0; i  num_mgrs; i++) {
+   struct mgr_priv_data *mp;
+
+   mp = dss_data.mgr_priv_data_array[i];
+
+   mp-timings = timings;
+   }
+
for (i = 0; i  num_ovls; ++i) {
struct ovl_priv_data *op;
 
@@ -181,7 +201,7 @@ static bool mgr_manual_update(struct omap_overlay_manager 
*mgr)
 }
 
 static int dss_check_settings_low(struct omap_overlay_manager *mgr,
-   struct omap_dss_device *dssdev, bool applying)
+   bool applying)
 {
struct omap_overlay_info *oi;
struct omap_overlay_manager_info *mi;
@@ -211,26 +231,24 @@ static int dss_check_settings_low(struct 
omap_overlay_manager *mgr,
ois[ovl-id] = oi;
}
 
-   return dss_mgr_check(mgr, dssdev, mi, ois);
+   return dss_mgr_check(mgr, mi, ois);
 }
 
 /*
  * check manager and overlay settings using overlay_info from data-info
  */
-static int dss_check_settings(struct omap_overlay_manager *mgr,
-   struct omap_dss_device *dssdev)
+static int dss_check_settings(struct omap_overlay_manager *mgr)
 {
-   return dss_check_settings_low(mgr, dssdev, false);
+   return dss_check_settings_low(mgr, false);
 }
 
 /*
  * check manager and overlay settings using overlay_info from ovl-info if
  * dirty and from data-info otherwise
  */
-static int dss_check_settings_apply(struct omap_overlay_manager *mgr,
-   struct omap_dss_device *dssdev)
+static int dss_check_settings_apply(struct omap_overlay_manager *mgr)
 {
-   return dss_check_settings_low(mgr, dssdev, true);
+   return dss_check_settings_low(mgr, true);
 }
 
 static bool need_isr(void)
@@ -684,7 +702,7 @@ static void dss_write_regs(void)
if (!mp-enabled || mgr_manual_update(mgr) || mp-busy)
continue;
 
-   r = dss_check_settings(mgr, mgr-device);
+   r = dss_check_settings(mgr);
if (r) {
DSSERR(cannot write registers for manager %s: 
illegal configuration\n, mgr-name);
@@ -751,7 +769,7 @@ void dss_mgr_start_update(struct omap_overlay_manager *mgr)
 
WARN_ON(mp-updating);
 
-   r = dss_check_settings(mgr, mgr-device);
+   r = dss_check_settings(mgr);
if (r) {
DSSERR(cannot start manual update: illegal configuration\n);
spin_unlock_irqrestore(data_lock, flags);
@@ -898,7 +916,7 @@ int omap_dss_mgr_apply(struct omap_overlay_manager *mgr)
 
spin_lock_irqsave(data_lock, flags);
 
-   r = dss_check_settings_apply(mgr, mgr-device);
+   r = dss_check_settings_apply(mgr);
if (r) {
spin_unlock_irqrestore(data_lock, flags);
DSSERR(failed to apply settings: illegal configuration.\n);
@@ -1091,7 +1109,7 @@ int dss_mgr_enable(struct omap_overlay_manager *mgr)
 
mp-enabled = true;
 
-   r = dss_check_settings(mgr, mgr-device);
+   r = dss_check_settings(mgr);
   

Re: [PATCH RESEND] ARM: OMAP3: USB: Fix the EHCI ULPI PHY reset issue

2012-05-03 Thread Raja, Govindraj
On Thu, May 3, 2012 at 6:55 AM, Russ Dill russ.d...@ti.com wrote:
 On Wed, May 2, 2012 at 3:38 AM, Raja, Govindraj govindraj.r...@ti.com wrote:
 On Wed, May 2, 2012 at 2:17 PM, Russ Dill russ.d...@ti.com wrote:
 On Mon, Mar 19, 2012 at 6:34 AM, Raja, Govindraj govindraj.r...@ti.com 
 wrote:
 On Mon, Mar 19, 2012 at 12:12 PM, Keshava Munegowda
 keshava_mgo...@ti.com wrote:
 From: Keshava Munegowda keshava_mgo...@ti.com

 It is observed that the echi ports of 3430 sdp board
 are not working due to the random timing of programming
 the associated GPIOs of the ULPI PHYs of the EHCI for reset.
 If the PHYs are reset at during usbhs core driver, host ports will
 not work because EHCI driver is loaded after the resetting PHYs.
 The PHYs should be in reset state while initializing the EHCI
 controller.
 The code which does the GPIO pins associated with the PHYs
 are programmed to reset is moved from the USB host core driver
 to EHCI driver.

 I tested on beagle xm where gpio nreset is requested from
 board file.
 (Basic enumertaion after gpio nreset seems to work fine,
 Hub and smsc lan chip get detected afetr boot up)


 What base did you test this on top of? my xM is failing USB-wise when
 I apply this on v3.3.3 (with the UART mux fix patch) and where it is
 applied within master (3.4-rc4, again, with the UART mux fix patch).
 Additionally, reverting this patch from 3.4-rc5 causes rc5 to work
 properly.


 Works for me be on 3.4-rc5 Beagle-XM even without reverting the patch

 Logs as in here [1].


 I've compared the boot logs and modified some configuration options
 and command line parameters to make them match, but still no dice. Can
 you send me your .config?

I have uploaded the .config + my binaries (MLO +u-boot +uimage with initramfs)
available here [1]

--
Thanks,
Govindraj.R

[1]:

http://www.sendspace.com/file/g7m58r
--
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 12/13] ARM: OMAP5: Add the build support

2012-05-03 Thread R Sricharan
Adding the build support required for OMAP5 soc
in to omap2+ config.

Signed-off-by: Santosh Shilimkar santosh.shilim...@ti.com
Signed-off-by: R Sricharan r.sricha...@ti.com
---
 arch/arm/configs/omap2plus_defconfig |2 ++
 arch/arm/mach-omap2/Kconfig  |   13 -
 arch/arm/plat-omap/Kconfig   |4 ++--
 3 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/arch/arm/configs/omap2plus_defconfig 
b/arch/arm/configs/omap2plus_defconfig
index d5f00d7..8beba1a 100644
--- a/arch/arm/configs/omap2plus_defconfig
+++ b/arch/arm/configs/omap2plus_defconfig
@@ -234,3 +234,5 @@ CONFIG_CRC_T10DIF=y
 CONFIG_CRC_ITU_T=y
 CONFIG_CRC7=y
 CONFIG_LIBCRC32C=y
+CONFIG_ARCH_OMAP5=y
+CONFIG_MACH_OMAP5_SEVM=y
diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index 8141b76..b50541a 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -9,7 +9,7 @@ config ARCH_OMAP2PLUS_TYPICAL
select REGULATOR
select PM_RUNTIME
select VFP
-   select NEON if ARCH_OMAP3 || ARCH_OMAP4
+   select NEON if ARCH_OMAP3 || ARCH_OMAP4 || ARCH_OMAP5
select SERIAL_OMAP
select SERIAL_OMAP_CONSOLE
select I2C
@@ -55,6 +55,13 @@ config ARCH_OMAP4
select USB_ARCH_HAS_EHCI if USB_SUPPORT
select ARM_CPU_SUSPEND if PM
 
+config ARCH_OMAP5
+   bool TI OMAP5
+   depends on ARCH_OMAP2PLUS
+   select CPU_V7
+   select ARM_GIC
+   select HAVE_SMP
+
 comment OMAP Core Type
depends on ARCH_OMAP2
 
@@ -343,6 +350,10 @@ config MACH_OMAP4_PANDA
select OMAP_PACKAGE_CBS
select REGULATOR_FIXED_VOLTAGE if REGULATOR
 
+config MACH_OMAP5_SEVM
+   bool OMAP5 sevm Board
+   depends on ARCH_OMAP5
+
 config OMAP3_EMU
bool OMAP3 debugging peripherals
depends on ARCH_OMAP3
diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig
index ad95c7a..dcfb506 100644
--- a/arch/arm/plat-omap/Kconfig
+++ b/arch/arm/plat-omap/Kconfig
@@ -29,7 +29,7 @@ config ARCH_OMAP2PLUS
select USE_OF
select PROC_DEVICETREE if PROC_FS
help
- Systems based on OMAP2, OMAP3 or OMAP4
+ Systems based on OMAP2, OMAP3, OMAP4 or OMAP5
 
 endchoice
 
@@ -150,7 +150,7 @@ config OMAP_32K_TIMER
  This timer saves power compared to the OMAP_MPU_TIMER, and has
  support for no tick during idle. The 32KHz timer provides less
  intra-tick resolution than OMAP_MPU_TIMER. The 32KHz timer is
- currently only available for OMAP16XX, 24XX, 34XX and OMAP4.
+ currently only available for OMAP16XX, 24XX, 34XX and OMAP4/5.
 
 config OMAP3_L2_AUX_SECURE_SAVE_RESTORE
bool OMAP3 HS/EMU save and restore for L2 AUX control register
-- 
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 06/13] ARM: OMAP5: gpmc: Update gpmc_init()

2012-05-03 Thread R Sricharan
GPMC module is the same as in OMAP4.
Just update the base address and irq number.

Signed-off-by: R Sricharan r.sricha...@ti.com
---
 arch/arm/mach-omap2/gpmc.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
index 00d5108..2f8f915 100644
--- a/arch/arm/mach-omap2/gpmc.c
+++ b/arch/arm/mach-omap2/gpmc.c
@@ -713,7 +713,8 @@ static int __init gpmc_init(void)
ck = gpmc_fck;
l = OMAP34XX_GPMC_BASE;
gpmc_irq = INT_34XX_GPMC_IRQ;
-   } else if (cpu_is_omap44xx()) {
+   } else if (cpu_is_omap44xx() || cpu_is_omap54xx()) {
+   /* Base address and irq number are same for OMAP4/5 */
ck = gpmc_ck;
l = OMAP44XX_GPMC_BASE;
gpmc_irq = OMAP44XX_IRQ_GPMC;
-- 
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 05/13] TEMP: ARM: OMAP5: Update the base address of the 32k-counter.

2012-05-03 Thread R Sricharan
Not for merge.

Just update the base address of the counter for
OMAP5 soc.

This patch will no longer be needed after rebasing on top of below
series from Vaibhav Hiremath hvaib...@ti.com.

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

Signed-off-by: R Sricharan r.sricha...@ti.com
---
 arch/arm/plat-omap/counter_32k.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/arm/plat-omap/counter_32k.c b/arch/arm/plat-omap/counter_32k.c
index 5068fe5..5a48ec9 100644
--- a/arch/arm/plat-omap/counter_32k.c
+++ b/arch/arm/plat-omap/counter_32k.c
@@ -90,6 +90,8 @@ int __init omap_init_clocksource_32k(void)
pbase = OMAP3430_32KSYNCT_BASE + 0x10;
else if (cpu_is_omap44xx())
pbase = OMAP4430_32KSYNCT_BASE + 0x10;
+   else if (cpu_is_omap54xx())
+   pbase = OMAP54XX_32KSYNCT_BASE + 0x30;
else
return -ENODEV;
 
-- 
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 03/13] TEMP: ARM: OMAP5: Add cpu_is_omap54xx() checks.

2012-05-03 Thread R Sricharan
Not for merge.

Adding the cpu_is_omap54xx checks at relevant places
for that part of code to execute on OMAP5 socs as well.

This patch will no longer be needed once rebased on
top of below series from Kevin Hilman khil...@ti.com

http://www.spinics.net/lists/linux-omap/msg69013.html

Signed-off-by: R Sricharan r.sricha...@ti.com
---
 arch/arm/mach-omap2/omap_hwmod.c |   15 +--
 1 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 7144ae6..4063a8c 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -1221,7 +1221,7 @@ static int _wait_target_ready(struct omap_hwmod *oh)
ret = omap2_cm_wait_module_ready(oh-prcm.omap2.module_offs,
 oh-prcm.omap2.idlest_reg_id,
 
oh-prcm.omap2.idlest_idle_bit);
-   } else if (cpu_is_omap44xx()) {
+   } else if (cpu_is_omap44xx() || cpu_is_omap54xx()) {
if (!oh-clkdm)
return -EINVAL;
 
@@ -1291,13 +1291,16 @@ static int _assert_hardreset(struct omap_hwmod *oh, 
const char *name)
if (cpu_is_omap24xx() || cpu_is_omap34xx())
return omap2_prm_assert_hardreset(oh-prcm.omap2.module_offs,
  ohri.rst_shift);
-   else if (cpu_is_omap44xx())
+   else if (cpu_is_omap44xx() || cpu_is_omap54xx()) {
return omap4_prminst_assert_hardreset(ohri.rst_shift,
  oh-clkdm-pwrdm.ptr-prcm_partition,
  oh-clkdm-pwrdm.ptr-prcm_offs,
  oh-prcm.omap4.rstctrl_offs);
-   else
+   } else {
return -EINVAL;
+   }
+
+   return ret;
 }
 
 /**
@@ -1326,9 +1329,9 @@ static int _deassert_hardreset(struct omap_hwmod *oh, 
const char *name)
ret = omap2_prm_deassert_hardreset(oh-prcm.omap2.module_offs,
   ohri.rst_shift,
   ohri.st_shift);
-   } else if (cpu_is_omap44xx()) {
+   } else if (cpu_is_omap44xx() || cpu_is_omap54xx()) {
if (ohri.st_shift)
-   pr_err(omap_hwmod: %s: %s: hwmod data error: OMAP4 
does not support st_shift\n,
+   pr_err(omap_hwmod: %s: %s: hwmod data error: OMAP4+ 
does not support st_shift\n,
   oh-name, name);
ret = omap4_prminst_deassert_hardreset(ohri.rst_shift,
  oh-clkdm-pwrdm.ptr-prcm_partition,
@@ -1367,7 +1370,7 @@ static int _read_hardreset(struct omap_hwmod *oh, const 
char *name)
if (cpu_is_omap24xx() || cpu_is_omap34xx()) {
return 
omap2_prm_is_hardreset_asserted(oh-prcm.omap2.module_offs,
   ohri.st_shift);
-   } else if (cpu_is_omap44xx()) {
+   } else if (cpu_is_omap44xx() || cpu_is_omap54xx()) {
return omap4_prminst_is_hardreset_asserted(ohri.rst_shift,
  oh-clkdm-pwrdm.ptr-prcm_partition,
  oh-clkdm-pwrdm.ptr-prcm_offs,
-- 
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 04/13] ARM: OMAP5: timer: Add clocksource, clockevent support

2012-05-03 Thread R Sricharan
Adding the Initialisaton for clocksource and clockevent device
on OMAP5 Socs.

Signed-off-by: R Sricharan r.sricha...@ti.com
---
 arch/arm/mach-omap2/common.h |1 +
 arch/arm/mach-omap2/timer.c  |5 +
 2 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/common.h b/arch/arm/mach-omap2/common.h
index 797dda7..88fb577 100644
--- a/arch/arm/mach-omap2/common.h
+++ b/arch/arm/mach-omap2/common.h
@@ -92,6 +92,7 @@ extern struct sys_timer omap2_timer;
 extern struct sys_timer omap3_timer;
 extern struct sys_timer omap3_secure_timer;
 extern struct sys_timer omap4_timer;
+extern struct sys_timer omap5_timer;
 
 void omap2420_init_early(void);
 void omap2430_init_early(void);
diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
index c512bac..3262ad6 100644
--- a/arch/arm/mach-omap2/timer.c
+++ b/arch/arm/mach-omap2/timer.c
@@ -348,6 +348,11 @@ static void __init omap4_timer_init(void)
 OMAP_SYS_TIMER(4)
 #endif
 
+#ifdef CONFIG_ARCH_OMAP5
+OMAP_SYS_TIMER_INIT(5, 1, OMAP4_CLKEV_SOURCE, 2, OMAP4_MPU_SOURCE)
+OMAP_SYS_TIMER(5)
+#endif
+
 /**
  * omap2_dm_timer_set_src - change the timer input clock source
  * @pdev:  timer platform device pointer
-- 
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 11/13] arm/dts: OMAP5: Add omap5 dts files

2012-05-03 Thread R Sricharan
Adding the minimum device tree files required for
OMAP5 to boot.

Signed-off-by: R Sricharan r.sricha...@ti.com
---
 .../devicetree/bindings/arm/omap/omap.txt  |3 +
 arch/arm/boot/dts/omap5-evm.dts|   20 ++
 arch/arm/boot/dts/omap5.dtsi   |  201 
 3 files changed, 224 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/boot/dts/omap5-evm.dts
 create mode 100644 arch/arm/boot/dts/omap5.dtsi

diff --git a/Documentation/devicetree/bindings/arm/omap/omap.txt 
b/Documentation/devicetree/bindings/arm/omap/omap.txt
index e78e8bc..3d450f6 100644
--- a/Documentation/devicetree/bindings/arm/omap/omap.txt
+++ b/Documentation/devicetree/bindings/arm/omap/omap.txt
@@ -47,3 +47,6 @@ Boards:
 
 - AM335X EVM : Software Developement Board for AM335x
   compatible = ti,am335x-evm, ti,am33xx, ti,omap3
+
+- OMAP5 EVM : Evaluation Module
+  compatible = ti,omap5-evm, ti,omap5
diff --git a/arch/arm/boot/dts/omap5-evm.dts b/arch/arm/boot/dts/omap5-evm.dts
new file mode 100644
index 000..200c39a
--- /dev/null
+++ b/arch/arm/boot/dts/omap5-evm.dts
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2012 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 version 2 as
+ * published by the Free Software Foundation.
+ */
+/dts-v1/;
+
+/include/ omap5.dtsi
+
+/ {
+   model = TI OMAP5 EVM board;
+   compatible = ti,omap5-evm, ti,omap5;
+
+   memory {
+   device_type = memory;
+   reg = 0x8000 0x4000; /* 1 GB */
+   };
+};
diff --git a/arch/arm/boot/dts/omap5.dtsi b/arch/arm/boot/dts/omap5.dtsi
new file mode 100644
index 000..b50c28d
--- /dev/null
+++ b/arch/arm/boot/dts/omap5.dtsi
@@ -0,0 +1,201 @@
+/*
+ * Copyright (C) 2012 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 version 2 as
+ * published by the Free Software Foundation.
+ * Based on omap4.dtsi
+ */
+
+/*
+ * Carveout for multimedia usecases
+ * It should be the last 48MB of the first 512MB memory part
+ * In theory, it should not even exist. That zone should be reserved
+ * dynamically during the .reserve callback.
+ */
+/memreserve/ 0x9d00 0x0300;
+
+/include/ skeleton.dtsi
+
+/ {
+   compatible = ti,omap5;
+   interrupt-parent = gic;
+
+   aliases {
+   serial0 = uart1;
+   serial1 = uart2;
+   serial2 = uart3;
+   serial3 = uart4;
+   serial4 = uart5;
+   serial5 = uart6;
+   };
+
+   cpus {
+   cpu@0 {
+   compatible = arm,cortex-a15;
+   };
+   cpu@1 {
+   compatible = arm,cortex-a15;
+   };
+   };
+
+   /*
+* The soc node represents the soc top level view. It is uses for IPs
+* that are not memory mapped in the MPU view or for the MPU itself.
+*/
+   soc {
+   compatible = ti,omap-infra;
+   mpu {
+   compatible = ti,omap5-mpu;
+   ti,hwmods = mpu;
+   };
+   };
+
+   /*
+* XXX: Use a flat representation of the OMAP4 interconnect.
+* The real OMAP interconnect network is quite complex.
+*
+* MPU -+-- MPU_PRIVATE - GIC, L2
+*  |
+*  ++--+
+*  ||  |
+*  ++- EMIF - DDR  |
+*  ||  |
+*  |+ ++
+*  || |
+*  |+- L4_ABE - AESS, MCBSP, TIMERs...
+*  ||
+*  +- L3_MAIN --+- L4_CORE - IPs...
+*   |
+*   +- L4_PER - IPs...
+*   |
+*
+* Since that will not bring real advantage to represent that in DT for
+* the moment, just use a fake OCP bus entry to represent the whole bus
+* hierarchy.
+*/
+   ocp {
+   compatible = ti,omap4-l3-noc, simple-bus;
+   #address-cells = 1;
+   #size-cells = 1;
+   ranges;
+   ti,hwmods = l3_main_1, l3_main_2, l3_main_3;
+
+   gic: interrupt-controller@48211000 {
+   compatible = arm,cortex-a15-gic;
+   interrupt-controller;
+   #interrupt-cells = 3;
+   reg = 0x48211000 0x1000,
+ 0x48212000 0x1000;
+   };
+
+   gpio1: gpio@4ae1 {
+   compatible = ti,omap4-gpio;
+   ti,hwmods = gpio1;
+   

[PATCH 08/13] ARM: OMAP5: Add the WakeupGen IP updates.

2012-05-03 Thread R Sricharan
From: Santosh Shilimkar santosh.shilim...@ti.com

OMAP4 and OMAP5 share same WakeupGen IP with below few udpates on OMAP5.
- Additional 32 interrupt support is added w.r.t OMAP4 design.
- The AUX CORE boot registers are now made accessible from non-secure SW.
- SAR offset are changed and PTMSYNC* registers are removed from SAR.

Patch updates the WakeupGen code accordingly.

Signed-off-by: Santosh Shilimkar santosh.shilim...@ti.com
Signed-off-by: R Sricharan r.sricha...@ti.com
---
 arch/arm/mach-omap2/include/mach/omap-wakeupgen.h |6 +
 arch/arm/mach-omap2/omap-hotplug.c|   24 -
 arch/arm/mach-omap2/omap-smp.c|   19 +++-
 arch/arm/mach-omap2/omap-wakeupgen.c  |  110 +++-
 arch/arm/mach-omap2/omap4-sar-layout.h|   12 ++-
 5 files changed, 135 insertions(+), 36 deletions(-)

diff --git a/arch/arm/mach-omap2/include/mach/omap-wakeupgen.h 
b/arch/arm/mach-omap2/include/mach/omap-wakeupgen.h
index 548de90..4d700bc 100644
--- a/arch/arm/mach-omap2/include/mach/omap-wakeupgen.h
+++ b/arch/arm/mach-omap2/include/mach/omap-wakeupgen.h
@@ -11,15 +11,20 @@
 #ifndef OMAP_ARCH_WAKEUPGEN_H
 #define OMAP_ARCH_WAKEUPGEN_H
 
+/* OMAP4 and OMAP5 has same base address */
+#define OMAP_WKUPGEN_BASE  0x48281000
+
 #define OMAP_WKG_CONTROL_0 0x00
 #define OMAP_WKG_ENB_A_0   0x10
 #define OMAP_WKG_ENB_B_0   0x14
 #define OMAP_WKG_ENB_C_0   0x18
 #define OMAP_WKG_ENB_D_0   0x1c
+#define OMAP_WKG_ENB_E_0   0x20
 #define OMAP_WKG_ENB_A_1   0x410
 #define OMAP_WKG_ENB_B_1   0x414
 #define OMAP_WKG_ENB_C_1   0x418
 #define OMAP_WKG_ENB_D_1   0x41c
+#define OMAP_WKG_ENB_E_1   0x420
 #define OMAP_AUX_CORE_BOOT_0   0x800
 #define OMAP_AUX_CORE_BOOT_1   0x804
 #define OMAP_PTMSYNCREQ_MASK   0xc00
@@ -28,4 +33,5 @@
 #define OMAP_TIMESTAMPCYCLEHI  0xc0c
 
 extern int __init omap_wakeupgen_init(void);
+extern void __iomem *omap_get_wakeupgen_base(void);
 #endif
diff --git a/arch/arm/mach-omap2/omap-hotplug.c 
b/arch/arm/mach-omap2/omap-hotplug.c
index 56c345b..052303c 100644
--- a/arch/arm/mach-omap2/omap-hotplug.c
+++ b/arch/arm/mach-omap2/omap-hotplug.c
@@ -17,8 +17,10 @@
 #include linux/kernel.h
 #include linux/errno.h
 #include linux/smp.h
+#include linux/io.h
 
 #include asm/cacheflush.h
+#include mach/omap-wakeupgen.h
 
 #include common.h
 
@@ -35,7 +37,8 @@ int platform_cpu_kill(unsigned int cpu)
  */
 void __ref platform_cpu_die(unsigned int cpu)
 {
-   unsigned int this_cpu;
+   unsigned int boot_cpu = 0;
+   void __iomem *base = omap_get_wakeupgen_base();
 
flush_cache_all();
dsb();
@@ -43,16 +46,27 @@ void __ref platform_cpu_die(unsigned int cpu)
/*
 * we're ready for shutdown now, so do it
 */
-   if (omap_modify_auxcoreboot0(0x0, 0x200) != 0x0)
-   pr_err(Secure clear status failed\n);
+   if (cpu_is_omap44xx()) {
+   if (omap_modify_auxcoreboot0(0x0, 0x200) != 0x0)
+   pr_err(Secure clear status failed\n);
+   } else {
+   __raw_writel(0, base + OMAP_AUX_CORE_BOOT_0);
+   }
+
 
for (;;) {
/*
 * Enter into low power state
 */
omap4_hotplug_cpu(cpu, PWRDM_POWER_OFF);
-   this_cpu = smp_processor_id();
-   if (omap_read_auxcoreboot0() == this_cpu) {
+
+   if (cpu_is_omap44xx())
+   boot_cpu = omap_read_auxcoreboot0();
+   else
+   boot_cpu =
+   __raw_readl(base + OMAP_AUX_CORE_BOOT_0)  5;
+
+   if (boot_cpu == smp_processor_id()) {
/*
 * OK, proper wakeup, we're done
 */
diff --git a/arch/arm/mach-omap2/omap-smp.c b/arch/arm/mach-omap2/omap-smp.c
index deffbf1..151fd5b 100644
--- a/arch/arm/mach-omap2/omap-smp.c
+++ b/arch/arm/mach-omap2/omap-smp.c
@@ -26,6 +26,8 @@
 
 #include mach/hardware.h
 #include mach/omap-secure.h
+#include mach/omap-wakeupgen.h
+#include asm/cputype.h
 
 #include iomap.h
 #include common.h
@@ -73,6 +75,8 @@ int __cpuinit boot_secondary(unsigned int cpu, struct 
task_struct *idle)
 {
static struct clockdomain *cpu1_clkdm;
static bool booted;
+   void __iomem *base = omap_get_wakeupgen_base();
+
/*
 * Set synchronisation state between this boot processor
 * and the secondary one
@@ -85,7 +89,11 @@ int __cpuinit boot_secondary(unsigned int cpu, struct 
task_struct *idle)
 * the AuxCoreBoot1 register is updated with cpu state
 * A barrier is added to ensure that write buffer is 

[PATCH 13/13] ARM: Kconfig update to support additional GPIOs in OMAP5

2012-05-03 Thread R Sricharan
From: Tarun Kanti DebBarma tarun.ka...@ti.com

OMAP5 has 8 GPIO banks so that there are 32x8 = 256 GPIOs.
In order for the gpiolib to detect and initialize these
additional GPIOs and other TWL GPIOs, ARCH_NR_GPIO is set
to 512 instead of present 256.

Cc: Santosh Shilimkar santosh.shilim...@ti.com
Cc: Cousson, Benoit b-cous...@ti.com
Reported-by: Govindraj.R govindraj.r...@ti.com
Tested-by: Govindraj.R govindraj.r...@ti.com
Signed-off-by: Tarun Kanti DebBarma tarun.ka...@ti.com
---
 arch/arm/Kconfig |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index cf006d4..d649c16 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1602,6 +1602,7 @@ config ARCH_NR_GPIO
default 1024 if ARCH_SHMOBILE || ARCH_TEGRA
default 355 if ARCH_U8500
default 264 if MACH_H4700
+   default 512 if ARCH_OMAP5
default 0
help
  Maximum number of GPIOs in the system.
-- 
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 02/13] ARM: OMAP5: Add minimal support for OMAP5430 SOC

2012-05-03 Thread R Sricharan
OMAP5430 is Texas Instrument's SOC based on ARM Cortex-A15 SMP
architecture. It's a dual core SOC with GIC used for interrupt
handling and with an integrated L2 cache controller.

OMAP5432 is another variant of OMAP5430, with a
memory controller supporting DDR3 and SATA.

Patch includes:
 - The machine specific headers and sources updates.
 - Platform header updates.
 - Minimum initialisation support for serial.
 - IO table init

Signed-off-by: R Sricharan r.sricha...@ti.com
Signed-off-by: Santosh Shilimkar santosh.shilim...@ti.com
---
 arch/arm/mach-omap2/Makefile   |   26 ++
 arch/arm/mach-omap2/clock.c|3 +-
 arch/arm/mach-omap2/cminst44xx.h   |2 +-
 arch/arm/mach-omap2/common.c   |   24 +
 arch/arm/mach-omap2/common.h   |   11 ++
 arch/arm/mach-omap2/include/mach/debug-macro.S |8 ++--
 arch/arm/mach-omap2/io.c   |   44 
 arch/arm/mach-omap2/iomap.h|   27 ++
 arch/arm/mach-omap2/prcm.c |2 +-
 arch/arm/mach-omap2/prm2xxx_3xxx.h |5 ++-
 arch/arm/plat-omap/Makefile|4 +--
 arch/arm/plat-omap/include/plat/clkdev_omap.h  |1 +
 arch/arm/plat-omap/include/plat/clock.h|4 ++-
 arch/arm/plat-omap/include/plat/hardware.h |1 +
 arch/arm/plat-omap/include/plat/multi.h|9 +
 arch/arm/plat-omap/include/plat/omap54xx.h |   32 +
 arch/arm/plat-omap/include/plat/serial.h   |   10 +
 arch/arm/plat-omap/include/plat/uncompress.h   |6 +++
 arch/arm/plat-omap/sram.c  |   11 +-
 19 files changed, 208 insertions(+), 22 deletions(-)
 create mode 100644 arch/arm/plat-omap/include/plat/omap54xx.h

diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 669e2b1..fbb6b3d 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -16,6 +16,7 @@ secure-common = omap-smc.o 
omap-secure.o
 obj-$(CONFIG_ARCH_OMAP2) += $(omap-2-3-common) $(hwmod-common)
 obj-$(CONFIG_ARCH_OMAP3) += $(omap-2-3-common) $(hwmod-common) $(secure-common)
 obj-$(CONFIG_ARCH_OMAP4) += prm44xx.o $(hwmod-common) $(secure-common)
+obj-$(CONFIG_ARCH_OMAP5) += prm44xx.o $(hwmod-common) $(secure-common)
 
 ifneq ($(CONFIG_SND_OMAP_SOC_MCBSP),)
 obj-y += mcbsp.o
@@ -27,8 +28,10 @@ obj-$(CONFIG_TWL4030_CORE) += omap_twl.o
 
 obj-$(CONFIG_SMP)  += omap-smp.o omap-headsmp.o
 obj-$(CONFIG_HOTPLUG_CPU)  += omap-hotplug.o
-obj-$(CONFIG_ARCH_OMAP4)   += omap4-common.o omap-wakeupgen.o
-obj-$(CONFIG_ARCH_OMAP4)   += sleep44xx.o
+omap-4-5-common=  omap4-common.o 
omap-wakeupgen.o \
+  sleep44xx.o  
+obj-$(CONFIG_ARCH_OMAP4)   += $(omap-4-5-common)
+obj-$(CONFIG_ARCH_OMAP5)+= $(omap-4-5-common)
 
 plus_sec := $(call as-instr,.arch_extension sec,+sec)
 AFLAGS_omap-headsmp.o  :=-Wa,-march=armv7-a$(plus_sec)
@@ -68,6 +71,7 @@ obj-$(CONFIG_ARCH_OMAP2)  += sleep24xx.o
 obj-$(CONFIG_ARCH_OMAP3)   += pm34xx.o sleep34xx.o
 obj-$(CONFIG_ARCH_OMAP3)   += cpuidle34xx.o
 obj-$(CONFIG_ARCH_OMAP4)   += pm44xx.o omap-mpuss-lowpower.o
+obj-$(CONFIG_ARCH_OMAP5)   += omap-mpuss-lowpower.o
 obj-$(CONFIG_ARCH_OMAP4)   += cpuidle44xx.o
 obj-$(CONFIG_PM_DEBUG) += pm-debug.o
 obj-$(CONFIG_OMAP_SMARTREFLEX)  += sr_device.o smartreflex.o
@@ -87,9 +91,11 @@ obj-y+= prm_common.o
 obj-$(CONFIG_ARCH_OMAP2)   += prcm.o cm2xxx_3xxx.o prm2xxx_3xxx.o
 obj-$(CONFIG_ARCH_OMAP3)   += prcm.o cm2xxx_3xxx.o prm2xxx_3xxx.o
 obj-$(CONFIG_ARCH_OMAP3)   += vc3xxx_data.o vp3xxx_data.o
-obj-$(CONFIG_ARCH_OMAP4)   += prcm.o cminst44xx.o cm44xx.o
-obj-$(CONFIG_ARCH_OMAP4)   += prcm_mpu44xx.o prminst44xx.o
-obj-$(CONFIG_ARCH_OMAP4)   += vc44xx_data.o vp44xx_data.o prm44xx.o
+omap-prcm-4-5-common   =  prcm.o cminst44xx.o cm44xx.o \
+  prcm_mpu44xx.o prminst44xx.o \
+  vc44xx_data.o vp44xx_data.o
+obj-$(CONFIG_ARCH_OMAP4)   += $(omap-prcm-4-5-common) prm44xx.o
+obj-$(CONFIG_ARCH_OMAP5)+= $(omap-prcm-4-5-common)
 
 # OMAP voltage domains
 voltagedomain-common   := voltage.o vc.o vp.o
@@ -99,6 +105,7 @@ obj-$(CONFIG_ARCH_OMAP3) += 
$(voltagedomain-common)
 obj-$(CONFIG_ARCH_OMAP3)   += voltagedomains3xxx_data.o
 obj-$(CONFIG_ARCH_OMAP4)   += $(voltagedomain-common)
 obj-$(CONFIG_ARCH_OMAP4)   += voltagedomains44xx_data.o
+obj-$(CONFIG_ARCH_OMAP5) 

[PATCH 07/13] ARM: OMAP5: l3: Add l3 error handler support for omap5.

2012-05-03 Thread R Sricharan
The l3 interconnect ip is same for OMAP4 and OMAP5.
So reuse the l3 error handler error code for OMAP5
as well. Also a few targets has been newly added for
OMAP5. So updating the driver for that here.

Signed-off-by: R Sricharan r.sricha...@ti.com
---
 arch/arm/mach-omap2/Makefile  |1 +
 arch/arm/mach-omap2/devices.c |2 +-
 arch/arm/mach-omap2/omap_l3_noc.h |   22 ++
 3 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index fbb6b3d..9f554e3 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -183,6 +183,7 @@ obj-$(CONFIG_OMAP3_EMU) += emu.o
 # L3 interconnect
 obj-$(CONFIG_ARCH_OMAP3)   += omap_l3_smx.o
 obj-$(CONFIG_ARCH_OMAP4)   += omap_l3_noc.o
+obj-$(CONFIG_ARCH_OMAP5)+= omap_l3_noc.o
 
 obj-$(CONFIG_OMAP_MBOX_FWK)+= mailbox_mach.o
 mailbox_mach-objs  := mailbox.o
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index e433603..a1b539a 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -85,7 +85,7 @@ static int __init omap4_l3_init(void)
 * To avoid code running on other OMAPs in
 * multi-omap builds
 */
-   if (!(cpu_is_omap44xx()))
+   if ((!(cpu_is_omap44xx()))  (!cpu_is_omap54xx()))
return -ENODEV;
 
for (i = 0; i  L3_MODULES; i++) {
diff --git a/arch/arm/mach-omap2/omap_l3_noc.h 
b/arch/arm/mach-omap2/omap_l3_noc.h
index 90b5098..a6ce34d 100644
--- a/arch/arm/mach-omap2/omap_l3_noc.h
+++ b/arch/arm/mach-omap2/omap_l3_noc.h
@@ -51,7 +51,9 @@ static u32 l3_targ_inst_clk1[] = {
0x200, /* DMM2 */
0x300, /* ABE */
0x400, /* L4CFG */
-   0x600  /* CLK2 PWR DISC */
+   0x600,  /* CLK2 PWR DISC */
+   0x0,/* Host CLK1 */
+   0x900   /* L4 Wakeup */
 };
 
 static u32 l3_targ_inst_clk2[] = {
@@ -72,11 +74,16 @@ static u32 l3_targ_inst_clk2[] = {
0xE00, /* missing in TRM corresponds to AES2*/
0xC00, /* L4 PER3 */
0xA00, /* L4 PER1*/
-   0xB00 /* L4 PER2*/
+   0xB00, /* L4 PER2*/
+   0x0, /* HOST CLK2 */
+   0x1800, /* CAL */
+   0x1700 /* LLI */
 };
 
 static u32 l3_targ_inst_clk3[] = {
-   0x0100  /* EMUSS */
+   0x0100  /* EMUSS */,
+   0x0300, /* DEBUGSS_CT_TBR */
+   0x0 /* HOST CLK3 */
 };
 
 static struct l3_masters_data {
@@ -110,13 +117,15 @@ static struct l3_masters_data {
{ 0xC8, USBHOSTFS}
 };
 
-static char *l3_targ_inst_name[L3_MODULES][18] = {
+static char *l3_targ_inst_name[L3_MODULES][21] = {
{
DMM1,
DMM2,
ABE,
L4CFG,
CLK2 PWR DISC,
+   HOST CLK1,
+   L4 WAKEUP
},
{
CORTEX M3 ,
@@ -137,9 +146,14 @@ static char *l3_targ_inst_name[L3_MODULES][18] = {
L4 PER3,
L4 PER1,
L4 PER2,
+   HOST CLK2,
+   CAL,
+   LLI
},
{
EMUSS,
+   DEBUG SOURCE,
+   HOST CLK3
},
 };
 
-- 
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 10/13] ARM: OMAP5: board-generic: Add device tree support.

2012-05-03 Thread R Sricharan
Adding the minimal support for OMAP5 soc with device tree.

Signed-off-by: R Sricharan r.sricha...@ti.com
---
 arch/arm/mach-omap2/board-generic.c |   39 +-
 arch/arm/mach-omap2/common.h|2 +
 arch/arm/mach-omap2/irq.c   |   11 +
 arch/arm/mach-omap2/omap4-common.c  |   14 
 4 files changed, 51 insertions(+), 15 deletions(-)

diff --git a/arch/arm/mach-omap2/board-generic.c 
b/arch/arm/mach-omap2/board-generic.c
index 098d183..0dd9e3f 100644
--- a/arch/arm/mach-omap2/board-generic.c
+++ b/arch/arm/mach-omap2/board-generic.c
@@ -20,6 +20,7 @@
 #include mach/hardware.h
 #include asm/hardware/gic.h
 #include asm/mach/arch.h
+#include mach/omap-wakeupgen.h
 
 #include plat/board.h
 #include common.h
@@ -32,17 +33,6 @@
 #define gic_of_initNULL
 #endif
 
-static struct of_device_id irq_match[] __initdata = {
-   { .compatible = ti,omap2-intc, .data = omap_intc_of_init, },
-   { .compatible = arm,cortex-a9-gic, .data = gic_of_init, },
-   { }
-};
-
-static void __init omap_init_irq(void)
-{
-   of_irq_init(irq_match);
-}
-
 static struct of_device_id omap_dt_match_table[] __initdata = {
{ .compatible = simple-bus, },
{ .compatible = ti,omap-infra, },
@@ -66,7 +56,7 @@ DT_MACHINE_START(OMAP242X_DT, Generic OMAP2420 (Flattened 
Device Tree))
.reserve= omap_reserve,
.map_io = omap242x_map_io,
.init_early = omap2420_init_early,
-   .init_irq   = omap_init_irq,
+   .init_irq   = omap_of_init_irq,
.handle_irq = omap2_intc_handle_irq,
.init_machine   = omap_generic_init,
.timer  = omap2_timer,
@@ -85,7 +75,7 @@ DT_MACHINE_START(OMAP243X_DT, Generic OMAP2430 (Flattened 
Device Tree))
.reserve= omap_reserve,
.map_io = omap243x_map_io,
.init_early = omap2430_init_early,
-   .init_irq   = omap_init_irq,
+   .init_irq   = omap_of_init_irq,
.handle_irq = omap2_intc_handle_irq,
.init_machine   = omap_generic_init,
.timer  = omap2_timer,
@@ -120,7 +110,7 @@ DT_MACHINE_START(OMAP3_DT, Generic OMAP3 (Flattened Device 
Tree))
.reserve= omap_reserve,
.map_io = omap3_map_io,
.init_early = omap3430_init_early,
-   .init_irq   = omap_init_irq,
+   .init_irq   = omap_of_init_irq,
.handle_irq = omap3_intc_handle_irq,
.init_machine   = omap3_init,
.timer  = omap3_timer,
@@ -155,7 +145,7 @@ DT_MACHINE_START(OMAP4_DT, Generic OMAP4 (Flattened Device 
Tree))
.reserve= omap_reserve,
.map_io = omap4_map_io,
.init_early = omap4430_init_early,
-   .init_irq   = omap_init_irq,
+   .init_irq   = omap_gic_of_init,
.handle_irq = gic_handle_irq,
.init_machine   = omap4_init,
.timer  = omap4_timer,
@@ -163,3 +153,22 @@ DT_MACHINE_START(OMAP4_DT, Generic OMAP4 (Flattened 
Device Tree))
.restart= omap_prcm_restart,
 MACHINE_END
 #endif
+
+#ifdef CONFIG_ARCH_OMAP5
+static const char *omap5_boards_compat[] __initdata = {
+   ti,omap5,
+   NULL,
+};
+
+DT_MACHINE_START(OMAP5_DT, Generic OMAP5 (Flattened Device Tree))
+   .reserve= omap_reserve,
+   .map_io = omap5_map_io,
+   .init_early = omap5_init_early,
+   .init_irq   = omap_gic_of_init,
+   .handle_irq = gic_handle_irq,
+   .init_machine   = omap_generic_init,
+   .timer  = omap5_timer,
+   .dt_compat  = omap5_boards_compat,
+   .restart= omap_prcm_restart,
+MACHINE_END
+#endif
diff --git a/arch/arm/mach-omap2/common.h b/arch/arm/mach-omap2/common.h
index 0771d22..e66859d 100644
--- a/arch/arm/mach-omap2/common.h
+++ b/arch/arm/mach-omap2/common.h
@@ -185,6 +185,8 @@ void omap3_intc_prepare_idle(void);
 void omap3_intc_resume_idle(void);
 void omap2_intc_handle_irq(struct pt_regs *regs);
 void omap3_intc_handle_irq(struct pt_regs *regs);
+void omap_of_init_irq(void);
+void omap_gic_of_init(void);
 
 #ifdef CONFIG_CACHE_L2X0
 extern void __iomem *omap4_get_l2cache_base(void);
diff --git a/arch/arm/mach-omap2/irq.c b/arch/arm/mach-omap2/irq.c
index 65f0d25..d316c68 100644
--- a/arch/arm/mach-omap2/irq.c
+++ b/arch/arm/mach-omap2/irq.c
@@ -21,6 +21,7 @@
 #include linux/irqdomain.h
 #include linux/of.h
 #include linux/of_address.h
+#include linux/of_irq.h
 
 #include mach/hardware.h
 
@@ -279,6 +280,16 @@ int __init omap_intc_of_init(struct device_node *node,
return 0;
 }
 
+static struct of_device_id irq_match[] __initdata = {
+   { .compatible = ti,omap2-intc, .data = omap_intc_of_init, },
+   { }
+};
+
+void __init omap_of_init_irq(void)
+{
+   of_irq_init(irq_match);
+}
+
 #ifdef CONFIG_ARCH_OMAP3
 static struct omap3_intc_regs intc_context[ARRAY_SIZE(irq_banks)];
 
diff --git 

[PATCH 09/13] ARM: OMAP5: Add SMP support.

2012-05-03 Thread R Sricharan
From: Santosh Shilimkar santosh.shilim...@ti.com

Add OMAP5 SMP boot support using OMAP4 SMP code. The relevant code paths
are runtime checked using cpu id

Signed-off-by: Santosh Shilimkar santosh.shilim...@ti.com
Signed-off-by: R Sricharan r.sricha...@ti.com
---
 arch/arm/mach-omap2/common.h   |1 +
 arch/arm/mach-omap2/omap-headsmp.S |   21 ++
 arch/arm/mach-omap2/omap-smp.c |   41 +--
 3 files changed, 51 insertions(+), 12 deletions(-)

diff --git a/arch/arm/mach-omap2/common.h b/arch/arm/mach-omap2/common.h
index 88fb577..0771d22 100644
--- a/arch/arm/mach-omap2/common.h
+++ b/arch/arm/mach-omap2/common.h
@@ -222,6 +222,7 @@ extern void omap_secondary_startup(void);
 extern u32 omap_modify_auxcoreboot0(u32 set_mask, u32 clear_mask);
 extern void omap_auxcoreboot_addr(u32 cpu_addr);
 extern u32 omap_read_auxcoreboot0(void);
+extern void omap5_secondary_startup(void);
 #endif
 
 #if defined(CONFIG_SMP)  defined(CONFIG_PM)
diff --git a/arch/arm/mach-omap2/omap-headsmp.S 
b/arch/arm/mach-omap2/omap-headsmp.S
index 503ac77..502e313 100644
--- a/arch/arm/mach-omap2/omap-headsmp.S
+++ b/arch/arm/mach-omap2/omap-headsmp.S
@@ -19,6 +19,27 @@
 #include linux/init.h
 
__CPUINIT
+
+/* Physical address needed since MMU not enabled yet on secondary core */
+#define AUX_CORE_BOOT0_PA  0x48281800
+
+/*
+ * OMAP5 specific entry point for secondary CPU to jump from ROM
+ * code.  This routine also provides a holding flag into which
+ * secondary core is held until we're ready for it to initialise.
+ * The primary core will update this flag using a hardware
++ * register AuxCoreBoot0.
+ */
+ENTRY(omap5_secondary_startup)
+wait:  ldr r2, =AUX_CORE_BOOT0_PA  @ read from AuxCoreBoot0
+   ldr r0, [r2]
+   mov r0, r0, lsr #5
+   mrc p15, 0, r4, c0, c0, 5
+   and r4, r4, #0x0f
+   cmp r0, r4
+   bne wait
+   b   secondary_startup
+END(omap5_secondary_startup)
 /*
  * OMAP4 specific entry point for secondary CPU to jump from ROM
  * code.  This routine also provides a holding flag into which
diff --git a/arch/arm/mach-omap2/omap-smp.c b/arch/arm/mach-omap2/omap-smp.c
index 151fd5b..9424bb6 100644
--- a/arch/arm/mach-omap2/omap-smp.c
+++ b/arch/arm/mach-omap2/omap-smp.c
@@ -33,6 +33,10 @@
 #include common.h
 #include clockdomain.h
 
+#define CPU_MASK   0xff00
+#define CPU_CORTEX_A9  0x410FC090
+#define CPU_CORTEX_A15 0x410FC0F0
+
 /* SCU base address */
 static void __iomem *scu_base;
 
@@ -43,6 +47,14 @@ void __iomem *omap4_get_scu_base(void)
return scu_base;
 }
 
+static inline unsigned int get_a15_core_count(void)
+{
+   unsigned int ncores;
+
+   asm volatile(mrc p15, 1, %0, c9, c0, 2\n : =r (ncores));
+   return ((ncores  24)  3) + 1;
+}
+
 void __cpuinit platform_secondary_init(unsigned int cpu)
 {
/*
@@ -133,7 +145,6 @@ int __cpuinit boot_secondary(unsigned int cpu, struct 
task_struct *idle)
 static void __init wakeup_secondary(void)
 {
void __iomem *base = omap_get_wakeupgen_base();
-
/*
 * Write the address of secondary startup routine into the
 * AuxCoreBoot1 where ROM code will jump and start executing
@@ -162,16 +173,21 @@ static void __init wakeup_secondary(void)
  */
 void __init smp_init_cpus(void)
 {
-   unsigned int i, ncores;
-
-   /*
-* Currently we can't call ioremap here because
-* SoC detection won't work until after init_early.
-*/
-   scu_base =  OMAP2_L4_IO_ADDRESS(OMAP44XX_SCU_BASE);
-   BUG_ON(!scu_base);
-
-   ncores = scu_get_core_count(scu_base);
+   unsigned int i = 0, ncores = 1, cpu_id;
+
+   /* Use ARM cpuid check here, as SoC detection will not work so early */
+   cpu_id = read_cpuid(CPUID_ID)  CPU_MASK;
+   if (cpu_id == CPU_CORTEX_A9) {
+   /*
+* Currently we can't call ioremap here because
+* SoC detection won't work until after init_early.
+*/
+   scu_base =  OMAP2_L4_IO_ADDRESS(OMAP44XX_SCU_BASE);
+   BUG_ON(!scu_base);
+   ncores = scu_get_core_count(scu_base);
+   } else if (cpu_id == CPU_CORTEX_A15) {
+   ncores = get_a15_core_count();
+   }
 
/* sanity check */
if (ncores  nr_cpu_ids) {
@@ -193,6 +209,7 @@ void __init platform_smp_prepare_cpus(unsigned int max_cpus)
 * Initialise the SCU and wake up the secondary core using
 * wakeup_secondary().
 */
-   scu_enable(scu_base);
+   if (scu_base)
+   scu_enable(scu_base);
wakeup_secondary();
 }
-- 
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 00/13] ARM: OMAP5: Add minimal OMAP5 SOC support

2012-05-03 Thread R Sricharan
The series adds minimal OMAP5 support.
OMAP5430 has a dual core Cortex-A15 based MPU subsystem with 2MB
L2 cache. The SOC has many compatible blocks with OMAP4 SOCS and
hence large part of the peripherals are re-used.

OMAP5432 is another variant of OMAP5430, with a
memory controller supporting DDR3 and SATA.

Series is generated against the 3.4-rc5. This has been rebased on
top of the OMAP2+ cleanup series [1]

To get the boot working with omap2plus_defconfig,
OMAP5 hwmod/clock/prm/cm database needs to be added.
The data and the integrated tree are available in the
below git repository

OMAP5_DATA:
git://gitorious.org/omap-sw-develoment/linux-omap-dev.git
 omap5_data

OMAP5_INTEGRATED:
git://gitorious.org/omap-sw-develoment/linux-omap-dev.git
 omap5_dt_integrated

The series is boot tested on OMAP5430 ES1.0.
OMAP2/3/4 build and boot is tested as well to avoid any breakage
because of the series.

Patch TEMP: ARM: OMAP5: Add cpu_is_omap54xx() checks is temporary and
can be dropped once rebased against [2]

Patch TEMP: ARM: OMAP5: Update the base address of the 32k-counter is
temporary and can be dropped once rebased against [3]


[1] http://www.spinics.net/lists/linux-omap/msg69233.html
[2] http://www.spinics.net/lists/linux-omap/msg69013.html
[3] http://www.mail-archive.com/linux-omap@vger.kernel.org/msg67166.html

R Sricharan (10):
  ARM: OMAP5: id: Add cpu id for ES versions
  ARM: OMAP5: Add minimal support for OMAP5430 SOC
  TEMP: ARM: OMAP5: Add cpu_is_omap54xx() checks.
  ARM: OMAP5: timer: Add clocksource, clockevent support
  TEMP: ARM: OMAP5: Update the base address of the 32k-counter.
  ARM: OMAP5: gpmc: Update gpmc_init()
  ARM: OMAP5: l3: Add l3 error handler support for omap5.
  ARM: OMAP5: board-generic: Add device tree support.
  arm/dts: OMAP5: Add omap5 dts files
  ARM: OMAP5: Add the build support

Santosh Shilimkar (2):
  ARM: OMAP5: Add the WakeupGen IP updates.
  ARM: OMAP5: Add SMP support.

Tarun Kanti DebBarma (1):
  ARM: Kconfig update to support additional GPIOs in OMAP5

 .../devicetree/bindings/arm/omap/omap.txt  |3 +
 arch/arm/Kconfig   |1 +
 arch/arm/boot/dts/omap5-evm.dts|   20 ++
 arch/arm/boot/dts/omap5.dtsi   |  201 
 arch/arm/configs/omap2plus_defconfig   |2 +
 arch/arm/mach-omap2/Kconfig|   13 ++-
 arch/arm/mach-omap2/Makefile   |   27 ++-
 arch/arm/mach-omap2/board-generic.c|   39 +++--
 arch/arm/mach-omap2/clock.c|3 +-
 arch/arm/mach-omap2/cminst44xx.h   |2 +-
 arch/arm/mach-omap2/common.c   |   24 +++
 arch/arm/mach-omap2/common.h   |   15 ++
 arch/arm/mach-omap2/control.h  |4 +
 arch/arm/mach-omap2/devices.c  |2 +-
 arch/arm/mach-omap2/gpmc.c |3 +-
 arch/arm/mach-omap2/id.c   |   47 +
 arch/arm/mach-omap2/include/mach/debug-macro.S |8 +-
 arch/arm/mach-omap2/include/mach/omap-wakeupgen.h  |6 +
 arch/arm/mach-omap2/io.c   |   44 +
 arch/arm/mach-omap2/iomap.h|   27 +++
 arch/arm/mach-omap2/irq.c  |   11 +
 arch/arm/mach-omap2/omap-headsmp.S |   21 ++
 arch/arm/mach-omap2/omap-hotplug.c |   24 ++-
 arch/arm/mach-omap2/omap-smp.c |   58 +--
 arch/arm/mach-omap2/omap-wakeupgen.c   |  110 ---
 arch/arm/mach-omap2/omap4-common.c |   14 ++
 arch/arm/mach-omap2/omap4-sar-layout.h |   12 +-
 arch/arm/mach-omap2/omap_hwmod.c   |   15 +-
 arch/arm/mach-omap2/omap_l3_noc.h  |   22 ++-
 arch/arm/mach-omap2/prcm.c |2 +-
 arch/arm/mach-omap2/prm2xxx_3xxx.h |5 +-
 arch/arm/mach-omap2/timer.c|5 +
 arch/arm/plat-omap/Kconfig |4 +-
 arch/arm/plat-omap/Makefile|4 +-
 arch/arm/plat-omap/counter_32k.c   |2 +
 arch/arm/plat-omap/include/plat/clkdev_omap.h  |1 +
 arch/arm/plat-omap/include/plat/clock.h|4 +-
 arch/arm/plat-omap/include/plat/cpu.h  |   23 ++-
 arch/arm/plat-omap/include/plat/hardware.h |1 +
 arch/arm/plat-omap/include/plat/multi.h|9 +
 arch/arm/plat-omap/include/plat/omap54xx.h |   32 +++
 arch/arm/plat-omap/include/plat/serial.h   |   10 +
 arch/arm/plat-omap/include/plat/uncompress.h   |6 +
 arch/arm/plat-omap/sram.c  |   11 +-
 44 files changed, 796 insertions(+), 101 deletions(-)
 create mode 100644 arch/arm/boot/dts/omap5-evm.dts
 create mode 100644 arch/arm/boot/dts/omap5.dtsi
 create mode 100644 

[PATCH 01/13] ARM: OMAP5: id: Add cpu id for ES versions

2012-05-03 Thread R Sricharan
Adding the OMAP5 ES1.0, 2.0 and OMAP5432 cpu revision
detection support.

Signed-off-by: R Sricharan r.sricha...@ti.com
Signed-off-by: Santosh Shilimkar santosh.shilim...@ti.com
---
 arch/arm/mach-omap2/control.h |4 +++
 arch/arm/mach-omap2/id.c  |   47 +
 arch/arm/plat-omap/include/plat/cpu.h |   23 ++-
 3 files changed, 72 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/control.h b/arch/arm/mach-omap2/control.h
index a406fd0..9daac6f 100644
--- a/arch/arm/mach-omap2/control.h
+++ b/arch/arm/mach-omap2/control.h
@@ -246,6 +246,10 @@
 /* TI81XX CONTROL_DEVCONF register offsets */
 #define TI81XX_CONTROL_DEVICE_ID   (TI81XX_CONTROL_DEVCONF + 0x000)
 
+/* OMAP54XX CONTROL STATUS register */
+#define OMAP5XXX_CONTROL_STATUS0x134
+#define OMAP5_DEVICETYPE_MASK  (0x7  6)
+
 /*
  * REVISIT: This list of registers is not comprehensive - there are more
  * that should be added.
diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index 0e79b7b..d2ec323 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -50,6 +50,11 @@ int omap_type(void)
val = omap_ctrl_readl(OMAP343X_CONTROL_STATUS);
} else if (cpu_is_omap44xx()) {
val = omap_ctrl_readl(OMAP4_CTRL_MODULE_CORE_STATUS);
+   } else if (cpu_is_omap54xx()) {
+   val = omap_ctrl_readl(OMAP5XXX_CONTROL_STATUS);
+   val = OMAP5_DEVICETYPE_MASK;
+   val = 6;
+   goto out;
} else {
pr_err(Cannot detect omap type!\n);
goto out;
@@ -500,6 +505,48 @@ void __init omap4xxx_check_revision(void)
((omap_rev()  12)  0xf), ((omap_rev()  8)  0xf));
 }
 
+void __init omap5xxx_check_revision(void)
+{
+   u32 idcode;
+   u16 hawkeye;
+   u8 rev;
+
+   idcode = read_tap_reg(OMAP_TAP_IDCODE);
+   hawkeye = (idcode  12)  0x;
+   rev = (idcode  28)  0xff;
+   switch (hawkeye) {
+   case 0xb942:
+   switch (rev) {
+   case 0:
+   omap_revision = OMAP5430_REV_ES1_0;
+   break;
+   case 1:
+   omap_revision = OMAP5430_REV_ES2_0;
+   break;
+   default:
+   omap_revision = OMAP5430_REV_ES1_0;
+   }
+   break;
+
+   case 0xb998:
+   switch (rev) {
+   case 0:
+   omap_revision = OMAP5432_REV_ES1_0;
+   break;
+   default:
+   omap_revision = OMAP5432_REV_ES1_0;
+   }
+   break;
+
+   default:
+   /* Unknown default to latest silicon rev as default*/
+   omap_revision = OMAP5430_REV_ES2_0;
+   }
+
+   pr_info(OMAP%04x ES%d.0\n,
+   omap_rev()  16, ((omap_rev()  12)  0xf));
+}
+
 /*
  * Set up things for map_io and processor detection later on. Gets called
  * pretty much first thing from board init. For multi-omap, this gets
diff --git a/arch/arm/plat-omap/include/plat/cpu.h 
b/arch/arm/plat-omap/include/plat/cpu.h
index dc6a86b..5e57732 100644
--- a/arch/arm/plat-omap/include/plat/cpu.h
+++ b/arch/arm/plat-omap/include/plat/cpu.h
@@ -9,7 +9,7 @@
  *
  * Written by Tony Lindgren tony.lindg...@nokia.com
  *
- * Added OMAP4 specific defines - Santosh Shilimkarsantosh.shilim...@ti.com
+ * Added OMAP4/5 specific defines - Santosh Shilimkarsantosh.shilim...@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
@@ -70,6 +70,7 @@ unsigned int omap_rev(void);
  * cpu_is_omap443x():  True for OMAP4430
  * cpu_is_omap446x():  True for OMAP4460
  * cpu_is_omap447x():  True for OMAP4470
+ * cpu_is_omap543x():  True for OMAP5430, OMAP5432
  */
 #define GET_OMAP_CLASS (omap_rev()  0xff)
 
@@ -121,6 +122,7 @@ IS_OMAP_CLASS(16xx, 0x16)
 IS_OMAP_CLASS(24xx, 0x24)
 IS_OMAP_CLASS(34xx, 0x34)
 IS_OMAP_CLASS(44xx, 0x44)
+IS_OMAP_CLASS(54xx, 0x54)
 IS_AM_CLASS(33xx, 0x33)
 
 IS_TI_CLASS(81xx, 0x81)
@@ -132,6 +134,7 @@ IS_OMAP_SUBCLASS(363x, 0x363)
 IS_OMAP_SUBCLASS(443x, 0x443)
 IS_OMAP_SUBCLASS(446x, 0x446)
 IS_OMAP_SUBCLASS(447x, 0x447)
+IS_OMAP_SUBCLASS(543x, 0x543)
 
 IS_TI_SUBCLASS(816x, 0x816)
 IS_TI_SUBCLASS(814x, 0x814)
@@ -154,6 +157,8 @@ IS_AM_SUBCLASS(335x, 0x335)
 #define cpu_is_omap443x()  0
 #define cpu_is_omap446x()  0
 #define cpu_is_omap447x()  0
+#define cpu_is_omap54xx()  0
+#define cpu_is_omap543x()  0
 
 #if defined(MULTI_OMAP1)
 # if defined(CONFIG_ARCH_OMAP730)
@@ -299,6 +304,7 @@ IS_OMAP_TYPE(3517, 0x3517)
 #define cpu_is_omap3517()  0
 #define cpu_is_omap3430()  0
 #define cpu_is_omap3630()  0
+#define cpu_is_omap5430()   

Re: [PATCH 2/5] ARM: OMAP2+: PM: use the power domains registers cache for the power states

2012-05-03 Thread Jean Pihet
Hi Jon, Vaibhav,

On Thu, May 3, 2012 at 8:38 AM, Bedia, Vaibhav vaibhav.be...@ti.com wrote:
 On Tue, May 01, 2012 at 21:07:39, Hunter, Jon wrote:
 [...]
   int pwrdm_read_pwrst(struct powerdomain *pwrdm)
   {
  -   int ret = -EINVAL;
  +   int pwrst, ret = -EINVAL;
 
      if (!pwrdm)
              return -EINVAL;
 
  -   if (arch_pwrdm  arch_pwrdm-pwrdm_read_pwrst)
  +   if (!pwrdm_cache_read(pwrdm, PWRDM_CACHE_PWRST, pwrst))
  +           return pwrst;
  +
  +   if (arch_pwrdm  arch_pwrdm-pwrdm_read_pwrst) {
              ret = arch_pwrdm-pwrdm_read_pwrst(pwrdm);
  +           if (ret = 0)
  +                   pwrdm_cache_write(pwrdm, PWRDM_CACHE_PWRST, ret);
  +   }

 Do we really want to use the cache for the current state? This is
 updated by hardware. In the above it appears that once we have read it
 once we will just return this value until the cache is invalidated.
 Makes me a little nervous.
I agree with your concerns. The HW can update things in our back and
so there is a risk of having the wrong state reported by the API.
Ideally the registers accesses shall be optimized in the HW itself
(hint for next gen chipsets ;-).

IMO a generic approach on caching is preferred on a hack on the low power code.

The cache implementation is based on the following principles:
1. the registers value are read from the cache if it is 'hot', the
values are read from the registers if the cache has been invalidated
2. the coherency of the cache fields relies on the invalidate of the
fields at the right time during the low power transitions
3. the previous states fields of the cache are invalidated when
clearing the previous power states
4. the current states fields of the cache are invalidated after coming
back from the low power mode, i.e. after the return from the low level
WFI instruction
5. the pwrdm_state_switch function detects the states changes, updates
the last internal state (pwrdm-state) and the states statistics
6. in PM debug any discrepancy between pwrdm-state and the current
state from the API is reported. More checking could be added in PM
debug

So there must be a compromise on which fields are invalidated and
when. I first tried to invalidate the whole cache after every low
power transition, which works fine but does not gain much in
performance. The current invalidate scheme (points 3, 4) is optimized
for performance and has been tested succesfully on OMAP3 (using
cpuidle in RET and OFF).

In any case if the HW asynchronously changes the registers states it
will not always be detected, with or without the cache implementation.
For example if a power domain transitions more than once, only the
last transition -to a different state than pwrdm-state- will be
detected the next time pwrdm_state_switch runs.


 I echo the concern here. If a powerdomain transition occurs when h/w 
 conditions
 are met, the cached values will go out of sync and this may lead to unexpected
 behavior wherever this API is being used.

 As Jon pointed out in another patch, the registers which can be updated by 
 h/w should
 be handled differently.
Agree but if you do not cache the previous and current registers there
is no point in having the cache in place.


 Just a wild thought, can PRCM_MPU_IRQ ([4]TRANSITION_EN) be used as a trigger 
 to update
 the cache if the transition happened under s/w control?
That is a nice suggestion. We need to explore the ways to detect transitions.


 Regards,
 Vaibhav

Thanks for your comments!

Regards,
Jean
--
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-usb-host: include plat/cpu.h

2012-05-03 Thread Felipe Balbi
Hi,

On Wed, May 02, 2012 at 10:36:44AM -0400, Jeff Mahoney wrote:
 omap-usb-host calls cpu_is_omap3430, which is defined in plat/cpu.h.
 
 Reported-by: Guillaume GARDET guillaume.gar...@opensuse.org
 Signed-off-by: Jeff Mahoney je...@suse.com

this looks right to me, though a driver shouldn't be using cpu_is_***
macros. Still, that patch can come later, this is needed now.

Acked-by: Felipe Balbi ba...@ti.com

-- 
balbi


signature.asc
Description: Digital signature


[PATCH-V7 0/3] ARM: OMAP: Make OMAP clocksource source selection runtime

2012-05-03 Thread Vaibhav Hiremath
Current OMAP code supports couple of clocksource options based
on compilation flag (CONFIG_OMAP_32K_TIMER). The 32KHz sync-timer
and a gptimer which can run on 32KHz or system clock (e.g 38.4 MHz)

This patch series cleans up the existing 32k-sync timer implementation,
movind SoC init code to respective files (mach-omap1/timer32k.c and
mach-omap2/timer.c) and uses kernel parameter to override the default
clocksource of counter_32k, also in order to support some OMAP based
derivative SoCs like AM33XX which doesn't have 32K sync-timer hardware IP,
adds hwmod lookup for omap2+ devices, and if lookup fails then
fall back to gp-timer.

if(use_gptimer_clksrc == true)
gptimer clocksource init;
else if (counter_32 init == false)
/* Fallback to gptimer */
gptimer clocksource init(;

With this, we should be able to support multi-omap boot
including devices with/without 32k-sync timer.

This patch-series has been boot tested on AM37xEVM platform, it
would be helpful if somebody help me to validate it on OMAP1/2
platforms.

The patches are also available at (based on linux-omap/master) -
https://github.com/hvaibhav/am335x-linux   32ksync-timer-cleanup

History:

Changes from V6:
http://www.mail-archive.com/linux-omap@vger.kernel.org/msg67623.html
- Changed Patch2/3 descrption to add affected kernel parameter
- Warning Fix: Added missing inline prefix to omap_32k_timer_init()
- Added Acked-by and Tested-by from Kevin Hilman

Changes from V5:
http://www.mail-archive.com/linux-omap@vger.kernel.org/msg67163.html
- 2 of the original patch-series (1/3 and 2/3) has already been
  accepted and queued by Paul, so removing them.
  Also, add 2 new patches,
- OMAP2 timer32k cleanup, check for return values.
- Changed name of system timers, gp timer = gp_timer.
- Moved SoC specific init code to respective files
  (mach-omap1/timer32k.c and mach-omap2/timer.c)

Changes from V4:
http://www.mail-archive.com/linux-omap@vger.kernel.org/msg67019.html
- Fix the possible bug, leftover the cnt addr argument to
  clocksource_mmio_init().

Changes from V3:
http://www.mail-archive.com/linux-omap@vger.kernel.org/msg66462.html
- Fixed all review comments from Kevin H
* Moved counter_32k CR register offset handling to
  counter_32k.c file, so now, calling funtion don't have
  to maintain or add offset to base addr.
* Added comment for function omap_init_clocksource_32k()
* Used resource_size() for calculate size
* Convert WARN_ON to pr_warn

Changes from V2:
http://lists.infradead.org/pipermail/linux-arm-kernel/2012-March/092037.html
- Added early_param support to read clocksource selection
  from user through kernel parameter (clocksource=)
- Converted to ocp_if changes from Paul

Changes from V1:
http://lists.infradead.org/pipermail/linux-arm-kernel/2012-January/081037.html
- Based on Tony's comment, added pbase  size argument to
  omap_init_clocksource_32k(), to avoid cpu_is_xxx() check.
- Added commit description based on discussion on list
  (Thanks to Santosh here)
- Reorder patch sequence


Vaibhav Hiremath (3):
  ARM: OMAP1: FIX: check possible error condition in timer_init
  ARM: OMAP2+: Replace space=underscore in the name field of system
timers
  ARM: OMAP: Make OMAP clocksource source selection using kernel param

 arch/arm/mach-omap1/common.h |   10 ++-
 arch/arm/mach-omap1/time.c   |   16 +
 arch/arm/mach-omap1/timer32k.c   |   28 ++-
 arch/arm/mach-omap2/timer.c  |  118 +++--
 arch/arm/plat-omap/counter_32k.c |   91 ++-
 arch/arm/plat-omap/include/plat/common.h |2 +-
 6 files changed, 167 insertions(+), 98 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-V7 1/3] ARM: OMAP1: FIX: check possible error condition in timer_init

2012-05-03 Thread Vaibhav Hiremath
On OMAP1, omap_32k_timer_init() function always returns true,
irrespective of whether error occurred while initializing 32k sync
counter as a kernel clocksource or not and execution will never
fallback to mpu_timer clocksource init code.

This patch adds check for return value from function
omap_init_clocksource_32k(), and fallback to omap_mpu_timer_init()
in case of failure/error from omap_init_clocksource_32k().

Signed-off-by: Vaibhav Hiremath hvaib...@ti.com
Acked-by: Kevin Hilman khil...@ti.com
Tested-by: Kevin Hilman khil...@ti.com
Cc: Tony Lindgren t...@atomide.com
Cc: Paul Walmsley p...@pwsan.com
Cc: Benoit Cousson b-cous...@ti.com
---
No Functional code change compared to V6 version, only 'inline'
prefix added to the function omap_32k_timer_init(), required to
fix warning (Thanks to Kevin).

 arch/arm/mach-omap1/common.h   |   10 +-
 arch/arm/mach-omap1/time.c |   16 +---
 arch/arm/mach-omap1/timer32k.c |   13 +
 3 files changed, 19 insertions(+), 20 deletions(-)

diff --git a/arch/arm/mach-omap1/common.h b/arch/arm/mach-omap1/common.h
index 8cc616e..cc83251 100644
--- a/arch/arm/mach-omap1/common.h
+++ b/arch/arm/mach-omap1/common.h
@@ -63,7 +63,15 @@ extern void omap1_nand_cmd_ctl(struct mtd_info *mtd, int cmd,
   unsigned int ctrl);

 extern struct sys_timer omap1_timer;
-extern bool omap_32k_timer_init(void);
+
+#ifdef CONFIG_OMAP_32K_TIMER
+extern int omap_32k_timer_init(void);
+#else
+static inline int __init omap_32k_timer_init(void)
+{
+   return -ENODEV;
+}
+#endif

 extern u32 omap_irq_flags;

diff --git a/arch/arm/mach-omap1/time.c b/arch/arm/mach-omap1/time.c
index 4d8dd9a..4062480 100644
--- a/arch/arm/mach-omap1/time.c
+++ b/arch/arm/mach-omap1/time.c
@@ -232,20 +232,6 @@ static inline void omap_mpu_timer_init(void)
 }
 #endif /* CONFIG_OMAP_MPU_TIMER */

-static inline int omap_32k_timer_usable(void)
-{
-   int res = false;
-
-   if (cpu_is_omap730() || cpu_is_omap15xx())
-   return res;
-
-#ifdef CONFIG_OMAP_32K_TIMER
-   res = omap_32k_timer_init();
-#endif
-
-   return res;
-}
-
 /*
  * ---
  * Timer initialization
@@ -253,7 +239,7 @@ static inline int omap_32k_timer_usable(void)
  */
 static void __init omap1_timer_init(void)
 {
-   if (!omap_32k_timer_usable())
+   if (omap_32k_timer_init() != 0)
omap_mpu_timer_init();
 }

diff --git a/arch/arm/mach-omap1/timer32k.c b/arch/arm/mach-omap1/timer32k.c
index 325b9a0..e3613a8 100644
--- a/arch/arm/mach-omap1/timer32k.c
+++ b/arch/arm/mach-omap1/timer32k.c
@@ -182,10 +182,15 @@ static __init void omap_init_32k_timer(void)
  * Timer initialization
  * ---
  */
-bool __init omap_32k_timer_init(void)
+int __init omap_32k_timer_init(void)
 {
-   omap_init_clocksource_32k();
-   omap_init_32k_timer();
+   int ret = -ENODEV;

-   return true;
+   if (cpu_is_omap16xx())
+   ret = omap_init_clocksource_32k();
+
+   if (!ret)
+   omap_init_32k_timer();
+
+   return ret;
 }
--
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


[PATCH-V7 2/3] ARM: OMAP2+: Replace space=underscore in the name field of system timers

2012-05-03 Thread Vaibhav Hiremath
Depending on the bootloader, passing command-line arguments
with spaces may have issues. Some bootloaders doesn't seem
to pass along the quotes, passing only 'gp' part of the string,
which leads to wrong override configuration.

The only affected kernel parameter configuration for OMAP family
is clocksource=, used to override kernel clocksource.

So this patch changes gp timer = gp_timer, for clockevent,
clocksource and timer irq_handler.

Signed-off-by: Vaibhav Hiremath hvaib...@ti.com
Acked-by: Kevin Hilman khil...@ti.com
Tested-by: Kevin Hilman khil...@ti.com
Cc: Santosh Shilimkar santosh.shilim...@ti.com
Cc: Benoit Cousson b-cous...@ti.com
Cc: Tony Lindgren t...@atomide.com
Cc: Paul Walmsley p...@pwsan.com
---
No code change compared to V6 patch series, only
commit description has been updated as per Kevin's comment.

 arch/arm/mach-omap2/timer.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
index ecec873..777f84b 100644
--- a/arch/arm/mach-omap2/timer.c
+++ b/arch/arm/mach-omap2/timer.c
@@ -90,7 +90,7 @@ static irqreturn_t omap2_gp_timer_interrupt(int irq, void 
*dev_id)
 }

 static struct irqaction omap2_gp_timer_irq = {
-   .name   = gp timer,
+   .name   = gp_timer,
.flags  = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
.handler= omap2_gp_timer_interrupt,
 };
@@ -132,7 +132,7 @@ static void omap2_gp_timer_set_mode(enum clock_event_mode 
mode,
 }

 static struct clock_event_device clockevent_gpt = {
-   .name   = gp timer,
+   .name   = gp_timer,
.features   = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
.shift  = 32,
.set_next_event = omap2_gp_timer_set_next_event,
@@ -269,7 +269,7 @@ static cycle_t clocksource_read_cycles(struct clocksource 
*cs)
 }

 static struct clocksource clocksource_gpt = {
-   .name   = gp timer,
+   .name   = gp_timer,
.rating = 300,
.read   = clocksource_read_cycles,
.mask   = CLOCKSOURCE_MASK(32),
--
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


[PATCH-V7 3/3] ARM: OMAP: Make OMAP clocksource source selection using kernel param

2012-05-03 Thread Vaibhav Hiremath
Current OMAP code supports couple of clocksource options based
on compilation flag (CONFIG_OMAP_32K_TIMER). The 32KHz sync-timer
and a gptimer which can run on 32KHz or system clock (e.g 38.4 MHz).
So there can be 3 options -

1. 32KHz sync-timer
2. Sys_clock based (e.g 13/19.2/26/38.4 MHz) gptimer
3. 32KHz based gptimer.

The optional gptimer based clocksource was added so that it can
give the high precision than sync-timer, so expected usage was 2
and not 3.
Unfortunately option 2, clocksource doesn't meet the requirement of
free-running clock as per clocksource need. It stops in low power states
when sys_clock is cut. That makes gptimer based clocksource option
useless for OMAP2/3/4 devices with sys_clock as a clock input.
So, in order to use option 2, deeper idle state MUST be disabled.

Option 3 will still work but it is no better than 32K sync-timer
based clocksource.

We must support both sync timer and gptimer based clocksource as
some OMAP based derivative SoCs like AM33XX does not have the
sync timer.

Considering above, make sync-timer and gptimer clocksource runtime
selectable so that both OMAP and AM continue to use the same code.

And, in order to precisely configure/setup sched_clock for given
clocksource, decision has to be made early enough in boot sequence.

So, the solution is,

Use standard kernel parameter (clocksource=) to override
default 32k_sync-timer, in addition to this, we also use hwmod database
lookup mechanism, through which at run-time we can identify availability
of 32k-sync timer on the device, else fall back to gptimer.

Also, moved low-level SoC specific init code to respective files,
(mach-omap1/timer32k.c and mach-omap2/timer.c)

Signed-off-by: Vaibhav Hiremath hvaib...@ti.com
Signed-off-by: Felipe Balbi ba...@ti.com
Reviewed-by: Santosh Shilimkar santosh.shilim...@ti.com
Acked-by: Kevin Hilman khil...@ti.com
Tested-by: Kevin Hilman khil...@ti.com
Cc: Benoit Cousson b-cous...@ti.com
Cc: Tony Lindgren t...@atomide.com
Cc: Paul Walmsley p...@pwsan.com
Cc: Tarun Kanti DebBarma tarun.ka...@ti.com
Cc: Ming Lei tom.leim...@gmail.com
---
No code change compared to V6 patch series.

 arch/arm/mach-omap1/timer32k.c   |   19 +-
 arch/arm/mach-omap2/timer.c  |  112 --
 arch/arm/plat-omap/counter_32k.c |   91 ++--
 arch/arm/plat-omap/include/plat/common.h |2 +-
 4 files changed, 147 insertions(+), 77 deletions(-)

diff --git a/arch/arm/mach-omap1/timer32k.c b/arch/arm/mach-omap1/timer32k.c
index e3613a8..eae49c3 100644
--- a/arch/arm/mach-omap1/timer32k.c
+++ b/arch/arm/mach-omap1/timer32k.c
@@ -71,6 +71,7 @@

 /* 16xx specific defines */
 #define OMAP1_32K_TIMER_BASE   0xfffb9000
+#define OMAP1_32KSYNC_TIMER_BASE   0xfffbc400
 #define OMAP1_32K_TIMER_CR 0x08
 #define OMAP1_32K_TIMER_TVR0x00
 #define OMAP1_32K_TIMER_TCR0x04
@@ -186,8 +187,22 @@ int __init omap_32k_timer_init(void)
 {
int ret = -ENODEV;

-   if (cpu_is_omap16xx())
-   ret = omap_init_clocksource_32k();
+   if (cpu_is_omap16xx()) {
+   void __iomem *base;
+   struct clk *sync32k_ick;
+
+   base = ioremap(OMAP1_32KSYNC_TIMER_BASE, SZ_1K);
+   if (!base) {
+   pr_err(32k_counter: failed to map base addr\n);
+   return -ENODEV;
+   }
+
+   sync32k_ick = clk_get(NULL, omap_32ksync_ick);
+   if (!IS_ERR(sync32k_ick))
+   clk_enable(sync32k_ick);
+
+   ret = omap_init_clocksource_32k(base);
+   }

if (!ret)
omap_init_32k_timer();
diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
index 777f84b..30824b5 100644
--- a/arch/arm/mach-omap2/timer.c
+++ b/arch/arm/mach-omap2/timer.c
@@ -243,22 +243,8 @@ static void __init omap2_gp_clockevent_init(int gptimer_id,
 }

 /* Clocksource code */
-
-#ifdef CONFIG_OMAP_32K_TIMER
-/*
- * When 32k-timer is enabled, don't use GPTimer for clocksource
- * instead, just leave default clocksource which uses the 32k
- * sync counter.  See clocksource setup in plat-omap/counter_32k.c
- */
-
-static void __init omap2_gp_clocksource_init(int unused, const char *dummy)
-{
-   omap_init_clocksource_32k();
-}
-
-#else
-
 static struct omap_dm_timer clksrc;
+static bool use_gptimer_clksrc;

 /*
  * clocksource
@@ -285,7 +271,46 @@ static u32 notrace dmtimer_read_sched_clock(void)
 }

 /* Setup free-running counter for clocksource */
-static void __init omap2_gp_clocksource_init(int gptimer_id,
+static int __init omap2_sync32k_clocksource_init(void)
+{
+   int ret;
+   struct omap_hwmod *oh;
+   void __iomem *vbase;
+   const char *oh_name = counter_32k;
+
+   /*
+* First check hwmod data is available for sync32k counter
+*/
+   oh = omap_hwmod_lookup(oh_name);
+   if (!oh || oh-slaves_cnt == 

RE: [PATCH-V6 3/3] ARM: OMAP: Make OMAP clocksource source selection using kernel param

2012-05-03 Thread Hiremath, Vaibhav
On Thu, May 03, 2012 at 02:09:59, Hilman, Kevin wrote:
 Vaibhav Hiremath hvaib...@ti.com writes:
 
 
  Signed-off-by: Vaibhav Hiremath hvaib...@ti.com
  Signed-off-by: Felipe Balbi ba...@ti.com
  Reviewed-by: Santosh Shilimkar santosh.shilim...@ti.com
  Cc: Benoit Cousson b-cous...@ti.com
  Cc: Tony Lindgren t...@atomide.com
  Cc: Paul Walmsley p...@pwsan.com
  Cc: Kevin Hilman khil...@ti.com
  Cc: Tarun Kanti DebBarma tarun.ka...@ti.com
  Cc: Ming Lei tom.leim...@gmail.com
 
 Reviewed-by: Kevin Hilman khil...@ti.com
 Tested-by: Kevin Hilman khil...@ti.com
 
 tested on OMAP3530/Overo with default 32k timer and cmdline override for
 GPtimer.
 

Thanks Kevin, I have submitted V7 version of this series with your ack and 
tested-by.

Tony,
Can you queue it for v3.5?

Thanks,
Vaibhav

--
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 01/39] ARM: OMAP2+: gpmc: driver conversion

2012-05-03 Thread Mohammed, Afzal
Hi Jon,

On Tue, May 01, 2012 at 23:23:00, Hunter, Jon wrote:
 Hi Afzal,
 
 Looks good! Some minor comments ...

Thanks

  +#defineGPMC_WAITPIN_IDX0   0x0
  +#defineGPMC_WAITPIN_IDX1   0x1
  +#defineGPMC_WAITPIN_IDX2   0x2
  +#defineGPMC_WAITPIN_IDX3   0x3
  +#defineGPMC_NR_WAITPIN 0x4
 
 How about an enum here? Also OMAP4 only have 3 wait pins and so the
 number is device dependent.

Ok

 
   #define GPMC_MEM_START 0x
   #define GPMC_MEM_END   0x3FFF
   #define BOOT_ROM_SPACE 0x10/* 1MB */
  @@ -64,6 +106,55 @@
   #define ENABLE_PREFETCH(0x1  7)
   #define DMA_MPU_MODE   2
   
  +#defineDRIVER_NAME omap-gpmc
  +
  +#defineGPMC_NR_IRQ 2
 
 Why has this been changed to 2? It was 6 in the previous version. As we
 discussed before the number of IRQs should be detected based upon GPMC
 IP version.

As mentioned in the cover letter,

Additional features that currently boards in mainline does not make
use of like, waitpin interrupt handling, changes to leverage revision
6 IP differences has not been incorporated.

Priority in this series is to convert into a driver, get all boards working
on mainline. Once all boards are working with gpmc driver, these features
which are not required for currently supported boards can be added later.

  +struct gpmc_device {
  +   char*name;
  +   int id;
  +   void*pdata;
  +   unsignedpdata_size;
  +   struct resource *per_res;
  +   unsignedper_res_cnt;
  +   struct resource *gpmc_res;
  +   unsignedgpmc_res_cnt;
  +   boolhave_waitpin;
  +   unsignedwaitpin;
  +   int waitpin_polarity;
 
 I think that it make more sense to have the wait-pin information part of
 the gpmc_cs_data structure for the following reasons ...

Waitpin information is indeed a part of cs as far as boards are concerned,
it is only that it gets propogated to device

 
 1. If a device can use multiple CS, then it could use multiple wait signals.
 2. Eventually, all board information needs to move to device tree. By
 having it in the pdata it will be easier to migrate to device tree.
 
 It may be nice to have have_waitpin be an integer too, that indicates
 if wait is used for both read and write or just one or the other.
 
 Also, any reason why waitpin_polarity is an int? I see you define LOW as
 -1, but I not sure why LOW cannot be 0 as 0 is programmed into the
 register for an active low wait signal.

Only intention is not to alter default waitpin polarity value, i.e. if
any board does make use of it w/o knowledge of Kernel, I don't want to
break it, there may be an argument saying that the board code is buggy,
while if some board does so, it is, but don't want to break working one.

Here unless user explicitly set the flag, it does nothing on polarity

  +   if (idx != ~0x0) {
  +   if (gd-have_waitpin) {
  +   if (gd-waitpin != idx ||
  +   gd-waitpin_polarity != polarity) {
  +   dev_err(gpmc-dev, error: conflict: waitpin %u 
  with polarity %d on device %s.%d\n,
  +   gd-waitpin, gd-waitpin_polarity,
  +   gd-name, gd-id);
  +   return -EBUSY;
  +   }
  +   } else {
  +   gd-have_waitpin = true;
  +   gd-waitpin = idx;
  +   gd-waitpin_polarity = polarity;
  +   }
 
 I am not sure about the above code. What happens if a device has
 multiple CS signals and uses multiple wait signals?
 
 I am also not sure why gpmc_setup_cs_waitpin and gpmc_setup_waitpin
 cannot be combined. I think that it would be a fair assumption to make
 that anyone using the waitpin does so inconjunction with the CS (I think
 that they would have too).
 
 However, if there is a reason for splitting it up this way please
 explain why.

Initially it was done per CS, the problem happened while trying to
convert tusb6010. It had multiple CS, but using same waitpin. Problem
with incorporating this onto CS is we have to sacrifice on wait pin
conflict prevention capability. The code now handles case of wait pin
conflict per device, the code can be extended to have multiple
wait pin per device also. But I prefer to defer it to later, not as
part of this series, as this feature what you asking for is not required
for any of the existing boards. I can add it in this series if there is
a strong opinion in the community for the same in this series.

Policy that is being followed here is first sit, then straighten legs, ;)

  +static int gpmc_setup_cs_nonres(struct gpmc *gpmc,
  +   

Re: Problems with 3.4-rc5

2012-05-03 Thread Tomi Valkeinen
On Wed, 2012-05-02 at 13:46 +0100, Joe Woodward wrote:

   Secondly, I get the following when booted:
   ...
   [4.701232] devtmpfs: mounted
   [4.704772] Freeing init memory: 168K
   [4.827301] omapdss DISPC error: FIFO UNDERFLOW on gfx, disabling
  the overlay
   ...
  
  
  Could you add some dss debug prints? You can add omapdss.debug=1
  debug 
  in the bootargs to get that.
  
  There was a feature called fifo merge added in 3.4, this might lead to 
  underflow, we had tested this using a DVI monitor on beagle but didn't 
  see any underflows.
  
  Are you trying this out on 3.4 for the first time? What was the last 
  kernel revision on which you tested this and didn't see any issues?

Can you try the following changes (separately):


diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index ee30937..aca4eb1 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -1091,13 +1091,8 @@ void dispc_ovl_compute_fifo_thresholds(enum omap_plane 
plane,
 * combined fifo size
 */
 
-   if (dss_has_feature(FEAT_OMAP3_DSI_FIFO_BUG)) {
-   *fifo_low = ovl_fifo_size - burst_size * 2;
-   *fifo_high = total_fifo_size - burst_size;
-   } else {
-   *fifo_low = ovl_fifo_size - burst_size;
-   *fifo_high = total_fifo_size - buf_unit;
-   }
+   *fifo_low = ovl_fifo_size - burst_size;
+   *fifo_high = total_fifo_size - buf_unit;
 }
 
 static void dispc_ovl_set_fir(enum omap_plane plane,

---

diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index ee30937..d63f1a3 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -1077,13 +1077,7 @@ void dispc_ovl_compute_fifo_thresholds(enum omap_plane 
plane,
burst_size = dispc_ovl_get_burst_size(plane);
ovl_fifo_size = dispc_ovl_get_fifo_size(plane);
 
-   if (use_fifomerge) {
-   total_fifo_size = 0;
-   for (i = 0; i  omap_dss_get_num_overlays(); ++i)
-   total_fifo_size += dispc_ovl_get_fifo_size(i);
-   } else {
-   total_fifo_size = ovl_fifo_size;
-   }
+   total_fifo_size = ovl_fifo_size;
 
/*
 * We use the same low threshold for both fifomerge and non-fifomerge

 Tomi



signature.asc
Description: This is a digitally signed message part


RE: [PATCH v4 02/39] ARM: OMAP2+: gpmc: Adapt to HWMOD

2012-05-03 Thread Mohammed, Afzal
Hi Jon,

On Wed, May 02, 2012 at 02:11:48, Hunter, Jon wrote:
  +
  +   pdata-clk_prd = gpmc_get_fclk_period();
 
 Does this need to be done here? May be this should be done in the probe
 function. You could store the handle to the main clk in the pdata.

This is done so that migration of gpmc driver to the drivers folder
would be smooth, remember that this function will still live here.
 
  +   pr_err(error: clk_get on %s\n, oh-main_clk);
  +   return -EINVAL;
  }
   
  clk_enable(gpmc_l3_clk);
 
 I would have thought we should be able to remove the gpmc_init function
 completely by now. Most of the code should be moved to the probe function.
 
 Also now with hwmod in place, we should be able to remove the
 clk_enable/disable functions and use the pm_runtime APIs instead.

There was no plan to add rpm in this series, but now that you have
brought it up, I will adapt the driver to rpm.

Regards
Afzal
--
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 04/39] ARM: OMAP2+: gpmc: Acquire NAND CS value

2012-05-03 Thread Mohammed, Afzal
Hi Jon,

On Wed, May 02, 2012 at 02:46:02, Hunter, Jon wrote:
  Some boards depend on bootloader to update chip select value for NAND.
  It is felt that Kernel should not depend on bootloader to get CS, as
  for a particular board CS is hardwired and is fixed, hence this can
  directly be updated in Kernel. But as CS value for boards that depend
  on this behaviour is not available, educate gpmc driver to acquire
  chip select value for NAND. this ideally should be removed once CS
  for those boards are available.
 
 Do you know how many boards require this? If so which are those boards?

devkit8000, beagle board, omap3touchbook, overo.

Beagle board, found out to be zero.

 Should this code be marked with a FIXME?

Will let Tony decide it.

Regards
Afzal
--
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: Problems with 3.4-rc5

2012-05-03 Thread Joe Woodward
-Original Message-
From: Tomi Valkeinen tomi.valkei...@ti.com
To: Joe Woodward j...@terrafix.co.uk
Cc: Archit Taneja a0393...@ti.com, linux-omap@vger.kernel.org
Date: Thu, 03 May 2012 11:28:41 +0300
Subject: Re: Problems with 3.4-rc5

 On Wed, 2012-05-02 at 13:46 +0100, Joe Woodward wrote:
 
Secondly, I get the following when booted:
...
[4.701232] devtmpfs: mounted
[4.704772] Freeing init memory: 168K
[4.827301] omapdss DISPC error: FIFO UNDERFLOW on gfx,
 disabling
   the overlay
...
   
   
   Could you add some dss debug prints? You can add omapdss.debug=1
   debug 
   in the bootargs to get that.
   
   There was a feature called fifo merge added in 3.4, this might lead
 to 
   underflow, we had tested this using a DVI monitor on beagle but
 didn't 
   see any underflows.
   
   Are you trying this out on 3.4 for the first time? What was the
 last 
   kernel revision on which you tested this and didn't see any issues?
 
 Can you try the following changes (separately):
 
 
 diff --git a/drivers/video/omap2/dss/dispc.c
 b/drivers/video/omap2/dss/dispc.c
 index ee30937..aca4eb1 100644
 --- a/drivers/video/omap2/dss/dispc.c
 +++ b/drivers/video/omap2/dss/dispc.c
 @@ -1091,13 +1091,8 @@ void dispc_ovl_compute_fifo_thresholds(enum
 omap_plane plane,
* combined fifo size
*/
  
 - if (dss_has_feature(FEAT_OMAP3_DSI_FIFO_BUG)) {
 - *fifo_low = ovl_fifo_size - burst_size * 2;
 - *fifo_high = total_fifo_size - burst_size;
 - } else {
 - *fifo_low = ovl_fifo_size - burst_size;
 - *fifo_high = total_fifo_size - buf_unit;
 - }
 + *fifo_low = ovl_fifo_size - burst_size;
 + *fifo_high = total_fifo_size - buf_unit;
  }
  
  static void dispc_ovl_set_fir(enum omap_plane plane,
 
 ---

The above patch fixes the problem (I no longer see any underflows).


 
 diff --git a/drivers/video/omap2/dss/dispc.c
 b/drivers/video/omap2/dss/dispc.c
 index ee30937..d63f1a3 100644
 --- a/drivers/video/omap2/dss/dispc.c
 +++ b/drivers/video/omap2/dss/dispc.c
 @@ -1077,13 +1077,7 @@ void dispc_ovl_compute_fifo_thresholds(enum
 omap_plane plane,
   burst_size = dispc_ovl_get_burst_size(plane);
   ovl_fifo_size = dispc_ovl_get_fifo_size(plane);
  
 - if (use_fifomerge) {
 - total_fifo_size = 0;
 - for (i = 0; i  omap_dss_get_num_overlays(); ++i)
 - total_fifo_size += dispc_ovl_get_fifo_size(i);
 - } else {
 - total_fifo_size = ovl_fifo_size;
 - }
 + total_fifo_size = ovl_fifo_size;
  
   /*
* We use the same low threshold for both fifomerge and non-fifomerge
 

The above patch has no effect (I still see underflows).

Both patches together results in slightly different behaviour, the display is 
still broken- 
it flickers on and off with occassional underflows before breaking completely.

Cheers,
Joe

  Tomi
 


--
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 06/39] ARM: OMAP2+: onenand: return value in init function

2012-05-03 Thread Mohammed, Afzal
Hi Sergei,

On Tue, May 01, 2012 at 22:19:37, Sergei Shtylyov wrote:
  +
  +#if defined(CONFIG_MTD_ONENAND_OMAP2) || \
  +   defined(CONFIG_MTD_ONENAND_OMAP2_MODULE)
 
 You can use IS_ENABLED(CONFIG_MTD_ONENAND_OMAP2) instead these two.

Thanks for educating me.

Regards
Afzal
--
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] pinctrl: Add generic pinctrl-simple driver that supports omap2+ padconf

2012-05-03 Thread Jean-Christophe PLAGNIOL-VILLARD
Hi,

I really like it

I was working on something simillar

but can we split the group management so we can use it on other
bindings

Best Regards,
J.

On 10:24 Wed 02 May , Tony Lindgren wrote:
 Add simple pinctrl driver using device tree data.
 
 Currently this driver only works on omap2+ series of
 processors, where there is either an 8 or 16-bit padconf
 register for each pin. Support for other similar pinmux
 controllers could be added.
 
 Note that this patch does not yet support pinconf_ops
 or GPIO. Further.
 
 Signed-off-by: Tony Lindgren t...@atomide.com
 ---
 Here's this one finally updated to use the common pinctrl bindings.
 That sure cleaned up a bunch of the nasty things in this driver :)
 Nice job Stephen!
 ---
 diff --git a/Documentation/devicetree/bindings/pinctrl/pinctrl-simple.txt 
 b/Documentation/devicetree/bindings/pinctrl/pinctrl-simple.txt
 new file mode 100644
 index 000..7b32263
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/pinctrl/pinctrl-simple.txt
 @@ -0,0 +1,125 @@
 +Generic simple device tree based pinctrl driver
 +
 +Required properties:
 +- compatible :  one of:
 + - pinctrl-simple
 + - ti,omap2420-padconf
 + - ti,omap2430-padconf
 + - ti,omap3-padconf
 + - ti,omap4-padconf
 +- reg : offset and length of the register set for the mux registers
 +- #pinctrl-cells : width of the pinctrl array, currently only 2 is supported
 +- pinctrl-simple,register-width : pinmux register access width
 +- pinctrl-simple,function-mask : mask of allowed pinmux function bits
 +- pinctrl-simple,function-off : function off mode for disabled state
 +- pinctrl-simple,pinconf-mask : mask of allowed pinconf bits
 +
 +This driver uses the common pinctrl bindings as specified in
 +pinctrl-bindings.txt document in this directory. The common bindings are used
 +to specify the client device states using pinctrl-0 and pinctrl-names 
 entries.
 +
 +This driver supports parsing one or more pinctrl functions as the subnodes of
 +the pinctrl driver entry. One or more registers can be specified for each
 +function, see uart2 and uart3 examples below. If you are concerned about boot
 +time, parsing multiple registers in a single function is slightly faster.
 +
 +For setting all static board specific pins, see the pinmux_board_pins example
 +below. If you are concerned about the boot time, set up the static pins in
 +the bootloader, and only set up selected pins as device tree entries.
 +
 +This driver assumes currently that there is one register for each pin. If you
 +have some pins with more complicated configuration, you can set up a separate
 +hardware specific driver for those pins.
 +
 +Example:
 +
 +/* SoC common file, such as omap4.dtsi */
 +omap4_pmx_core: pinmux@4a100040 {
 + compatible = ti,omap4-padconf;
 + reg = 0x4a100040 0x0196;
 + #address-cells = 1;
 + #size-cells = 0;
 + #pinctrl-cells = 2;
 + pinctrl-simple,register-width = 16;
 + pinctrl-simple,function-mask = 0x7;
 + pinctrl-simple,function-off = 0x;
 + pinctrl-simple,pinconf-mask = 0xfff8;
 +};
 +
 +omap4_pmx_wkup: pinmux@4a31e040 {
 + compatible = ti,omap4-padconf;
 + reg = 0x4a31e040 0x0038;
 + #address-cells = 1;
 + #size-cells = 0;
 + #pinctrl-cells = 2;
 + pinctrl-simple,register-width = 16;
 + pinctrl-simple,function-mask = 0x7;
 + pinctrl-simple,function-off = 0x;
 + pinctrl-simple,pinconf-mask = 0xfff8;
 +};
 +
 +
 +/* board specific .dts file, such as omap4-sdp.dts */
 +omap4_pmx_core {
 +
 + /*
 +  * map all board specific static pins enabled by the pinctrl driver
 +  * itself during the boot (or just set them up in the bootloader)
 +  */
 + pinctrl-names = default;
 + pinctrl-0 = board_pins;
 +
 + board_pins: pinmux_board_pins {
 + board_static_pins {
 + pinctrl-simple,cells = 
 + 0x6c 0xf/* CSI21_DX3 OMAP_PIN_OUTPUT | 
 OMAP_MUX_MODE7 */
 + 0x6e 0xf/* CSI21_DY3 OMAP_PIN_OUTPUT | 
 OMAP_MUX_MODE7 */
 + 0x70 0xf/* CSI21_DX4 OMAP_PIN_OUTPUT | 
 OMAP_MUX_MODE7 */
 + 0x72 0xf/* CSI21_DY4 OMAP_PIN_OUTPUT | 
 OMAP_MUX_MODE7 */
 + ;
 + };
 + };
 +
 +
 + /* map all uart2 pins as a single function */
 + uart2_pins: pinmux_uart2_pins {
 + uart2_pins {
 + pinctrl-simple,cells = 
 + 0xd8 0x118  /* UART2_CTS 
 OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0 */
 + 0xda 0  /* UART2_RTS OMAP_PIN_OUTPUT | 
 OMAP_MUX_MODE0 */
 + 0xdc 0x118  /* UART2_RX 
 OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0 */
 + 0xde 0  /* UART2_TX OMAP_PIN_OUTPUT | 
 OMAP_MUX_MODE0 */
 + ;
 +   

Re: Problems with 3.4-rc5

2012-05-03 Thread Archit Taneja

On Thursday 03 May 2012 02:19 PM, Joe Woodward wrote:

-Original Message-
From: Tomi Valkeinentomi.valkei...@ti.com
To: Joe Woodwardj...@terrafix.co.uk
Cc: Archit Tanejaa0393...@ti.com, linux-omap@vger.kernel.org
Date: Thu, 03 May 2012 11:28:41 +0300
Subject: Re: Problems with 3.4-rc5


On Wed, 2012-05-02 at 13:46 +0100, Joe Woodward wrote:


Secondly, I get the following when booted:
...
[4.701232] devtmpfs: mounted
[4.704772] Freeing init memory: 168K
[4.827301] omapdss DISPC error: FIFO UNDERFLOW on gfx,

disabling

the overlay

...



Could you add some dss debug prints? You can add omapdss.debug=1
debug
in the bootargs to get that.

There was a feature called fifo merge added in 3.4, this might lead

to

underflow, we had tested this using a DVI monitor on beagle but

didn't

see any underflows.

Are you trying this out on 3.4 for the first time? What was the

last

kernel revision on which you tested this and didn't see any issues?


Can you try the following changes (separately):


diff --git a/drivers/video/omap2/dss/dispc.c
b/drivers/video/omap2/dss/dispc.c
index ee30937..aca4eb1 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -1091,13 +1091,8 @@ void dispc_ovl_compute_fifo_thresholds(enum
omap_plane plane,
 * combined fifo size
 */

-   if (dss_has_feature(FEAT_OMAP3_DSI_FIFO_BUG)) {
-   *fifo_low = ovl_fifo_size - burst_size * 2;
-   *fifo_high = total_fifo_size - burst_size;
-   } else {
-   *fifo_low = ovl_fifo_size - burst_size;
-   *fifo_high = total_fifo_size - buf_unit;
-   }
+   *fifo_low = ovl_fifo_size - burst_size;
+   *fifo_high = total_fifo_size - buf_unit;
  }

  static void dispc_ovl_set_fir(enum omap_plane plane,

---


The above patch fixes the problem (I no longer see any underflows).


Tomi,

Before FIFO merge was added, the special fifo_low/high calculation was 
only done for DSI on OMAP3, now it seems to be done on OMAP3 and for all 
interfaces. Maybe this is the difference between 3.3.







diff --git a/drivers/video/omap2/dss/dispc.c
b/drivers/video/omap2/dss/dispc.c
index ee30937..d63f1a3 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -1077,13 +1077,7 @@ void dispc_ovl_compute_fifo_thresholds(enum
omap_plane plane,
burst_size = dispc_ovl_get_burst_size(plane);
ovl_fifo_size = dispc_ovl_get_fifo_size(plane);

-   if (use_fifomerge) {
-   total_fifo_size = 0;
-   for (i = 0; i  omap_dss_get_num_overlays(); ++i)
-   total_fifo_size += dispc_ovl_get_fifo_size(i);
-   } else {
-   total_fifo_size = ovl_fifo_size;
-   }
+   total_fifo_size = ovl_fifo_size;

/*
 * We use the same low threshold for both fifomerge and non-fifomerge



The above patch has no effect (I still see underflows).

Both patches together results in slightly different behaviour, the display is 
still broken-
it flickers on and off with occassional underflows before breaking completely.


With both the patches combined, we are configuring DSS with FIFO merge 
enabled, but configuring thresholds normally and not utilising the large 
FIFO. Getting underflows with this is strange, because it's more or less 
similar to what it was on 3.3 without FIFO merge.


Archit



Cheers,
Joe


  Tomi







--
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] net: davinci_emac: Add pre_open, post_stop platform callbacks

2012-05-03 Thread Bedia, Vaibhav
On Thu, May 03, 2012 at 05:17:18, Mark A. Greer wrote:
 From: Mark A. Greer mgr...@animalcreek.com
 
 The davinci EMAC driver has been incorporated into the am35x
 family of SoC's which is OMAP-based.  The incorporation is
 incomplete in that the EMAC cannot unblock the [ARM] core if
 its blocked on a 'wfi' instruction.  This is an issue with
 the cpu_idle code because it has the core execute a 'wfi'
 instruction.
 
 To work around this issue, add platform data callbacks which
 are called at the beginning of the open routine and at the
 end of the stop routine of the davinci_emac driver.  The
 callbacks allow the platform code to issue disable_hlt() and
 enable_hlt() calls appropriately.  Calling disable_hlt()
 prevents cpu_idle from issuing the 'wfi' instruction.
 
 It is not sufficient to simply call disable_hlt() when
 there is an EMAC present because it could be present but
 not actually used in which case, we do want the 'wfi' to
 be executed.
 

Are you trying to say that if ARM executes _just_ wfi and _absolutely
nothing else_ is done in the OMAP PM code, EMAC stops working?

However, if this is indeed the case, then probably a better solution would be
to invoke disable_hlt() from the board file when EMAC support is compiled in.

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


[PATCH 1/4] OMAP: DSS2: Remove suspicous and unused TAAL regulator API usage

2012-05-03 Thread Mark Brown
The TAAL driver contains some regulator support which is currently unused
(the code is there but the one panel supported by the driver doesn't have
any regulators provided). This code mostly looks like an open coded
version of the regulator core bulk API.

The only additional feature is that a voltage range can be set once when
the device is opened, though this is never varied at runtime. The general
expectation is that if the device is not actively managing the voltage of
the device (eg, doing DVFS) then any configuration will be done using the
constraints rather than by drivers, saving them code and ensuring that
they work well with systems where the voltage is not configurable.

If systems are added needing regulator support this can be added back in,
though it should be based on core features rather than open coding things.

Signed-off-by: Mark Brown broo...@opensource.wolfsonmicro.com
---
 drivers/video/omap2/displays/panel-taal.c |   80 -
 1 file changed, 80 deletions(-)

diff --git a/drivers/video/omap2/displays/panel-taal.c 
b/drivers/video/omap2/displays/panel-taal.c
index 0f21fa5..72d6307 100644
--- a/drivers/video/omap2/displays/panel-taal.c
+++ b/drivers/video/omap2/displays/panel-taal.c
@@ -30,7 +30,6 @@
 #include linux/gpio.h
 #include linux/workqueue.h
 #include linux/slab.h
-#include linux/regulator/consumer.h
 #include linux/mutex.h
 
 #include video/omapdss.h
@@ -55,73 +54,6 @@ static int _taal_enable_te(struct omap_dss_device *dssdev, 
bool enable);
 
 static int taal_panel_reset(struct omap_dss_device *dssdev);
 
-struct panel_regulator {
-   struct regulator *regulator;
-   const char *name;
-   int min_uV;
-   int max_uV;
-};
-
-static void free_regulators(struct panel_regulator *regulators, int n)
-{
-   int i;
-
-   for (i = 0; i  n; i++) {
-   /* disable/put in reverse order */
-   regulator_disable(regulators[n - i - 1].regulator);
-   regulator_put(regulators[n - i - 1].regulator);
-   }
-}
-
-static int init_regulators(struct omap_dss_device *dssdev,
-   struct panel_regulator *regulators, int n)
-{
-   int r, i, v;
-
-   for (i = 0; i  n; i++) {
-   struct regulator *reg;
-
-   reg = regulator_get(dssdev-dev, regulators[i].name);
-   if (IS_ERR(reg)) {
-   dev_err(dssdev-dev, failed to get regulator %s\n,
-   regulators[i].name);
-   r = PTR_ERR(reg);
-   goto err;
-   }
-
-   /* FIXME: better handling of fixed vs. variable regulators */
-   v = regulator_get_voltage(reg);
-   if (v  regulators[i].min_uV || v  regulators[i].max_uV) {
-   r = regulator_set_voltage(reg, regulators[i].min_uV,
-   regulators[i].max_uV);
-   if (r) {
-   dev_err(dssdev-dev,
-   failed to set regulator %s voltage\n,
-   regulators[i].name);
-   regulator_put(reg);
-   goto err;
-   }
-   }
-
-   r = regulator_enable(reg);
-   if (r) {
-   dev_err(dssdev-dev, failed to enable regulator %s\n,
-   regulators[i].name);
-   regulator_put(reg);
-   goto err;
-   }
-
-   regulators[i].regulator = reg;
-   }
-
-   return 0;
-
-err:
-   free_regulators(regulators, i);
-
-   return r;
-}
-
 /**
  * struct panel_config - panel configuration
  * @name: panel name
@@ -150,8 +82,6 @@ struct panel_config {
unsigned int low;
} reset_sequence;
 
-   struct panel_regulator *regulators;
-   int num_regulators;
 };
 
 enum {
@@ -977,11 +907,6 @@ static int taal_probe(struct omap_dss_device *dssdev)
 
atomic_set(td-do_update, 0);
 
-   r = init_regulators(dssdev, panel_config-regulators,
-   panel_config-num_regulators);
-   if (r)
-   goto err_reg;
-
td-workqueue = create_singlethread_workqueue(taal_esd);
if (td-workqueue == NULL) {
dev_err(dssdev-dev, can't create ESD workqueue\n);
@@ -1075,8 +1000,6 @@ err_gpio:
 err_bl:
destroy_workqueue(td-workqueue);
 err_wq:
-   free_regulators(panel_config-regulators, panel_config-num_regulators);
-err_reg:
kfree(td);
 err:
return r;
@@ -1113,9 +1036,6 @@ static void __exit taal_remove(struct omap_dss_device 
*dssdev)
/* reset, to be sure that the panel is in a valid state */
taal_hw_reset(dssdev);
 
-   free_regulators(td-panel_config-regulators,
-   td-panel_config-num_regulators);
-

[PATCH 2/4] OMAPDSS: VENC: Check for errors from regulator_enable()

2012-05-03 Thread Mark Brown
It is possible for regulator_enable() to fail and if it does fail that's
generally a bad sign for anything we try to do with the hardware afterwards
so check for and immediately return an error if regulator_enable() fails.

Signed-off-by: Mark Brown broo...@opensource.wolfsonmicro.com
---
 drivers/video/omap2/dss/venc.c |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/video/omap2/dss/venc.c b/drivers/video/omap2/dss/venc.c
index 9c3daf7..abfbd4a 100644
--- a/drivers/video/omap2/dss/venc.c
+++ b/drivers/video/omap2/dss/venc.c
@@ -443,7 +443,9 @@ static int venc_power_on(struct omap_dss_device *dssdev)
dispc_set_digit_size(dssdev-panel.timings.x_res,
dssdev-panel.timings.y_res/2);
 
-   regulator_enable(venc.vdda_dac_reg);
+   r = regulator_enable(venc.vdda_dac_reg);
+   if (r)
+   goto err;
 
if (dssdev-platform_enable)
dssdev-platform_enable(dssdev);
-- 
1.7.10

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


[PATCH 4/4] OMAPDSS: TPO-TD03MTEA1: Correct comment for power on delay

2012-05-03 Thread Mark Brown
Since any power on stabilisation delay for the supply itself should be
taken care of transparently by the regulator API when the regulator is
enabled the additional delay that the TPO-TD03MTEA1 driver adds after
that returned should be due to the requirements of the device itself
rather than the supply (the delay is also suspicously long for one for
a regulator to ramp). Correct the comment to avoid misleading people
taking this code as a reference.

Signed-off-by: Mark Brown broo...@opensource.wolfsonmicro.com
Acked-by: Grazvydas Ignotas nota...@gmail.com
---
 drivers/video/omap2/displays/panel-tpo-td043mtea1.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/video/omap2/displays/panel-tpo-td043mtea1.c 
b/drivers/video/omap2/displays/panel-tpo-td043mtea1.c
index 74c6b87..987cb84 100644
--- a/drivers/video/omap2/displays/panel-tpo-td043mtea1.c
+++ b/drivers/video/omap2/displays/panel-tpo-td043mtea1.c
@@ -281,7 +281,7 @@ static int tpo_td043_power_on(struct tpo_td043_device 
*tpo_td043)
if (r != 0)
return r;
 
-   /* wait for regulator to stabilize */
+   /* wait for panel to stabilize */
msleep(160);
 
if (gpio_is_valid(nreset_gpio))
-- 
1.7.10

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


[PATCH 3/4] OMAPDSS: TPO-TD03MTEA1: Check for errors from regulator_enable()

2012-05-03 Thread Mark Brown
It is possible for regulator_enable() to fail and if it does fail that's
generally a bad sign for anything we try to do with the hardware afterwards
so check for and immediately return an error if regulator_enable() fails.

Signed-off-by: Mark Brown broo...@opensource.wolfsonmicro.com
Acked-by: Grazvydas Ignotas nota...@gmail.com
---
 drivers/video/omap2/displays/panel-tpo-td043mtea1.c |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/video/omap2/displays/panel-tpo-td043mtea1.c 
b/drivers/video/omap2/displays/panel-tpo-td043mtea1.c
index 32f3fcd..74c6b87 100644
--- a/drivers/video/omap2/displays/panel-tpo-td043mtea1.c
+++ b/drivers/video/omap2/displays/panel-tpo-td043mtea1.c
@@ -272,11 +272,14 @@ static const struct omap_video_timings tpo_td043_timings 
= {
 static int tpo_td043_power_on(struct tpo_td043_device *tpo_td043)
 {
int nreset_gpio = tpo_td043-nreset_gpio;
+   int r;
 
if (tpo_td043-powered_on)
return 0;
 
-   regulator_enable(tpo_td043-vcc_reg);
+   r = regulator_enable(tpo_td043-vcc_reg);
+   if (r != 0)
+   return r;
 
/* wait for regulator to stabilize */
msleep(160);
-- 
1.7.10

--
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: [PATCHv4 8/8] ARM: OMAP4: PM: Added option for enabling OSWR

2012-05-03 Thread Jean Pihet
Hi Tero,

On Fri, Apr 20, 2012 at 11:19 AM, Tero Kristo t-kri...@ti.com wrote:
 PM debug now contains a file that can be used to control OSWR support
 enable / disable on OMAP4. Also removed the off_mode_enable file for
 the same platform as it is unsupported.

 Signed-off-by: Tero Kristo t-kri...@ti.com
 ---
  arch/arm/mach-omap2/pm-debug.c |   20 
  arch/arm/mach-omap2/pm.h       |    1 +
  arch/arm/mach-omap2/pm44xx.c   |   16 
  3 files changed, 33 insertions(+), 4 deletions(-)

 diff --git a/arch/arm/mach-omap2/pm-debug.c b/arch/arm/mach-omap2/pm-debug.c
 index 814bcd9..d9a8e42 100644
 --- a/arch/arm/mach-omap2/pm-debug.c
 +++ b/arch/arm/mach-omap2/pm-debug.c
 @@ -39,6 +39,7 @@
  #include pm.h

  u32 enable_off_mode;
 +static u32 enable_oswr_mode;

  #ifdef CONFIG_DEBUG_FS
  #include linux/debugfs.h
 @@ -247,10 +248,13 @@ static int option_set(void *data, u64 val)
                        omap_pm_enable_off_mode();
                else
                        omap_pm_disable_off_mode();
 -               if (cpu_is_omap34xx())
 -                       omap3_pm_off_mode_enable(val);
 +
 +               omap3_pm_off_mode_enable(val);
Great since this change removes a non-init cpu_is_xxx check.

        }

 +       if (option == enable_oswr_mode)
 +               omap4_pm_oswr_mode_enable(val);
 +
        return 0;
  }

 @@ -274,8 +278,16 @@ static int __init pm_dbg_init(void)

        pwrdm_for_each(pwrdms_setup, (void *)d);

 -       (void) debugfs_create_file(enable_off_mode, S_IRUGO | S_IWUSR, d,
 -                                  enable_off_mode, pm_dbg_option_fops);
 +       if (cpu_is_omap34xx())
 +               (void) debugfs_create_file(enable_off_mode,
 +                       S_IRUGO | S_IWUSR, d, enable_off_mode,
 +                       pm_dbg_option_fops);
Is the enable_off_mode entry needed on other OMAP platorms (OMAP3)?

 +
 +       if (cpu_is_omap44xx())
 +               (void) debugfs_create_file(enable_oswr_mode,
 +                       S_IRUGO | S_IWUSR, d, enable_oswr_mode,
 +                       pm_dbg_option_fops);
 +
        pm_dbg_init_done = 1;

Regards,
Jean
--
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: smsc911x on Gumstix Overo/Tobi doesn't work

2012-05-03 Thread Javier Martinez Canillas
On Wed, May 2, 2012 at 1:42 PM, Thomas Klute
thomas2.kl...@uni-dortmund.de wrote:
 Am 01.04.2012 21:20, schrieb Javier Martinez Canillas:
 On Fri, Mar 30, 2012 at 5:28 PM, Thomas Klute
 thomas2.kl...@uni-dortmund.de wrote:
 Hi,

 I finally had some time to do more tests on this problem. Findings below.


 Great, I guess we are close to find the issue :)

 Am 20.03.2012 20:47, schrieb Javier Martinez Canillas:
 On Tue, Mar 20, 2012 at 3:27 PM, Thomas Klute
 thomas2.kl...@uni-dortmund.de wrote:
 Am 19.03.2012 23:51, schrieb Tony Lindgren:
 * Thomas Klute thomas2.kl...@uni-dortmund.de [120319 09:26]:
 Am 16.03.2012 20:33, schrieb Tony Lindgren:
 Hi,

 * Thomas Klute thomas2.kl...@uni-dortmund.de [120316 05:08]:
 Hi,

 I have trouble getting the Ethernet port on a Gumstix Overo with Tobi
 expansion board to work with current kernel versions. With the latest
 commit from linux-omap git (b8fe1781ec8bed5e086691a827a6ee11facec2aa),
 the output from loading the smsc911x driver is as follows:

 du14:~# modprobe smsc911x
 [  254.843811] smsc911x: Driver version 2008-10-21
 [  254.854553] smsc911x: Driver version 2008-10-21
 [  254.859588] _regulator_get: smsc911x.1 supply vdd33a not found, 
 using
 dummy regulator
 [  254.868377] _regulator_get: smsc911x.1 supply vddvario not found,
 using dummy regulator

 ip link show does not show any available Ethernet port.

 The first instance one should work the same way as earlier using
 fixed regulator in gpmc-smsc911x.c. Is it not working for you
 somehow? At least it works for me on zoom3.

 The Tobi board has only one Ethernet port.

 I know there has been some trouble with changes around smsc911x
 regulator support and Gumstix Overo in particular. Am I just missing 
 the
 right regulator in my kernel config or is this a bug? I can test 
 patches
 in the latter case.

 The second smsc911x now needs a regulator. For multiple smsc911x 
 instances,
 we should change things around so no regulator is created if one
 is passed.

 Care to test the following patch by passing a fixed regulator
 from board-overo.c?

 After applying the patch the Ethernet port works consistently once I had
 done a cold boot (reboot from the unpatched kernel did not work).
 Thank you!

 Hmm but this patch should not change the behaviour for the first smsc911x
 instance unless you specify a custom regulator.. Did you patch in a
 custom regulator, or do we have a bug somewhere? Or do you just need to
 do a cold reset without the patch I posted?

 You're right, during further tests I found that the problem lies
 elsewhere: If the Ethernet cable is attached on modprobe, the device
 works as expected, if not, it's not found (with or without the patch).
 This means if I boot with the cable disconnected, the device won't show
 up, but after

 # modprobe -r smsc911x
 [attach cable]
 # modprobe smsc911x

 it will work. I'd still consider this a bug, but it doesn't seem to be a
 regulator problem.


 Hi Thomas,

 I had the same behavior with the smsc911x chip but on an IGEPv2 board.
 The problem was when CONFIG_SMSC_PHY=y since the driver for the chip
 internal PHY enables an energy detect power-down mode.

 The smsc911x driver probe function tries to software reset the chip
 but if the cable is unplugged the energy detect puts the chip in a low
 power mode. Since the chip is not in an operational state the reset
 fails and hence the driver probe function. If the cable is plugged
 then then energy is detected, the chip is in an operational state and
 the reset is successful.

 I sent a patch a few months ago to fix this issue. The patch disables
 the energy detect power-down mode before reseting the chip and then it
 enables again after reset.

 The commit is:

 commit 6386994e03ebbe60338ded3d586308a41e81c0dc
 Author: Javier Martinez Canillas jav...@dowhile0.org
 Date:   Tue Jan 3 13:36:19 2012 +

     net/smsc911x: Check if PHY is in operational mode before software reset

 When I fix the issue I only guarded against generation 4 chips (i.e:
 pdata-generation == 4), but maybe this problem also exists in other
 SMSC chips (I didn't know since I only had access to specific
 data-sheets).

 Also you can try enabling debug in the driver by setting USE_DEBUG to
 1 in drivers/net/ethernet/smsc/smsc911x.h and also trying disabling
 CONFIG_SMSC_PHY, this will use a generic PHY driver that doesn't put
 the chip in auto power mode.

 After looking at the code I set USE_DEBUG to 3 to get as much
 information as possible and tested with and without the SMSC PHY driver.
 Results:

 With the Ethernet cable attached, the device is properly initialized
 with and without the PHY driver (as before).

 Without the cable, the smsc911x driver can initialize the card only if
 the smsc PHY driver had not been loaded previously. Unloading the PHY
 driver is not enough, even a reboot doesn't help. I have to do a cold
 boot (or attach the cable).


 This makes sense since is the PHY driver who enables the auto energy
 detect 

Re: [PATCH 1/8] gpio/omap: remove virtual_irq_start variable

2012-05-03 Thread Santosh Shilimkar
On Friday 27 April 2012 07:43 PM, Tarun Kanti DebBarma wrote:
 This cleanup got missed while implementing following:
 25db711 gpio/omap: Fix IRQ handling for SPARSE_IRQ
 384ebe1 gpio/omap: Add DT support to GPIO driver
 
 Cc: Kevin Hilman khil...@ti.com
 Cc: Tony Lindgren t...@atomide.com
 Cc: Santosh Shilimkar santosh.shilim...@ti.com
 Cc: Cousson, Benoit b-cous...@ti.com
 Cc: Grant Likely grant.lik...@secretlab.ca
 Signed-off-by: Tarun Kanti DebBarma tarun.ka...@ti.com
 ---
  arch/arm/mach-omap1/gpio15xx.c |2 --
  arch/arm/mach-omap1/gpio16xx.c |5 -
  arch/arm/mach-omap1/gpio7xx.c  |7 ---
  arch/arm/mach-omap2/gpio.c |1 -
  arch/arm/plat-omap/include/plat/gpio.h |1 -
  5 files changed, 0 insertions(+), 16 deletions(-)
 
Looks good.
Reviewed-by: Santosh Shilimkar santosh.shilim...@ti.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: [PATCH 7/8] gpio/omap: remove cpu_is_omapxxxx() checks from *_runtime_resume()

2012-05-03 Thread Santosh Shilimkar
On Friday 27 April 2012 07:43 PM, Tarun Kanti DebBarma wrote:
 Add register offsets for GPIO_IRQSTATUS_RAW_0, GPIO_IRQSTATUS_RAW_0
 which are present on OMAP4+ processors. Now we can distinguish
 conditions applicable to OMAP4,5 and those specific to OMAP24xx
 and OMAP3xxx.
 
 Cc: Kevin Hilman khil...@ti.com
 Cc: Tony Lindgren t...@atomide.com
 Cc: Santosh Shilimkar santosh.shilim...@ti.com
 Cc: Cousson, Benoit b-cous...@ti.com
 Cc: Grant Likely grant.lik...@secretlab.ca
 Signed-off-by: Tarun Kanti DebBarma tarun.ka...@ti.com
 ---
  arch/arm/mach-omap2/gpio.c |2 ++
  arch/arm/plat-omap/include/plat/gpio.h |2 ++
  drivers/gpio/gpio-omap.c   |4 ++--
  3 files changed, 6 insertions(+), 2 deletions(-)
 
Looks like this was the last cpu_is_*() in gpio driver.
Thanks for cleaning up this.

Reviewed-by: Santosh Shilimkar santosh.shilim...@ti.com

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 8/8] gpio/omap: fix missing check in *_runtime_suspend()

2012-05-03 Thread Santosh Shilimkar
On Friday 27 April 2012 07:43 PM, Tarun Kanti DebBarma wrote:
 We do checking for bank-enabled_non_wakeup_gpios in order
 to skip redundant operations. Somehow, the check got missed
 while doing the cleanup series.
 
 Just to make sure that we do context restore correctly in
 *_runtime_resume(), the bank-workaround_enabled check is
 moved after context restore. Otherwise, it would prevent
 context restore when bank-enabled_non_wakeup_gpios is 0.
 
 Cc: Kevin Hilman khil...@ti.com
 Cc: Tony Lindgren t...@atomide.com
 Cc: Santosh Shilimkar santosh.shilim...@ti.com
 Cc: Cousson, Benoit b-cous...@ti.com
 Cc: Grant Likely grant.lik...@secretlab.ca
 Signed-off-by: Tarun Kanti DebBarma tarun.ka...@ti.com
 ---
Looks good.
Reviewed-by: Santosh Shilimkar santosh.shilim...@ti.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: [PATCH 0/8] gpio/omap: remaining cleanups and fix

2012-05-03 Thread Santosh Shilimkar
Tarun,

On Friday 27 April 2012 07:43 PM, Tarun Kanti DebBarma wrote:
 Here are the remaining cleanup patches. There are broadly
 two categories of cleanups.
 
 Cat-1: Those missed while introducing new feature like SPARSE_IRQ
handling and DT support; use edge/level handlers from
generic IRQ framework.
 
 Cat-2: Removal of redundant fields from struct gpio_bank{} as a
result of they being already covered by members within
context field of struct gpio_bank{}.
 
 Reference: 
 git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
 Commit: 66f75a5d028beaf67c931435fdc3e7823125730c (Linux 3.4-rc4)
 
 Series is available for reference here:
 git://gitorious.org/~tarunkanti/omap-sw-develoment/tarunkantis-linux-omap-dev.git
  for_3.5/gpio_more_cleanup_fixes
 
 Test info:
 OMAP2+ platforms: OMAP2430SDP, OMAP3430SDP, OMAP4430SDP
 OMAP1: Bootup test on OMAP1710SDP.
 
 Cc: Kevin Hilman khil...@ti.com
 Cc: Tony Lindgren t...@atomide.com
 Cc: Santosh Shilimkar santosh.shilim...@ti.com
 Cc: Cousson, Benoit b-cous...@ti.com
 Cc: Grant Likely grant.lik...@secretlab.ca
 Tarun Kanti DebBarma (8):
   gpio/omap: remove virtual_irq_start variable
   gpio/omap: remove saved_fallingdetect, saved_risingdetect
   gpio/omap: remove suspend_wakeup field from struct gpio_bank
   gpio/omap: remove saved_wakeup field from struct gpio_bank
   gpio/omap: remove retrigger variable in gpio_irq_handler
   gpio/omap: remove suspend/resume callbacks
   gpio/omap: remove cpu_is_omap() checks from *_runtime_resume()
   gpio/omap: fix missing check in *_runtime_suspend()
 
I have reviewed the remaining 3 patches from this series.
Thanks.

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 v3 07/10] arm: omap4430sdp: Add support for omap4iss camera

2012-05-03 Thread Aguirre, Sergio
Hi Sakari,

Thanks for reviewing.

On Wed, May 2, 2012 at 2:47 PM, Sakari Ailus sakari.ai...@iki.fi wrote:

 Hi Sergio,

 Thanks for the patches!!

 On Wed, May 02, 2012 at 10:15:46AM -0500, Sergio Aguirre wrote:
 ...
 +static int sdp4430_ov_cam1_power(struct v4l2_subdev *subdev, int on)
 +{
 +     struct device *dev = subdev-v4l2_dev-dev;
 +     int ret;
 +
 +     if (on) {
 +             if (!regulator_is_enabled(sdp4430_cam2pwr_reg)) {
 +                     ret = regulator_enable(sdp4430_cam2pwr_reg);
 +                     if (ret) {
 +                             dev_err(dev,
 +                                     Error in enabling sensor power 
 regulator 'cam2pwr'\n);
 +                             return ret;
 +                     }
 +
 +                     msleep(50);
 +             }
 +
 +             gpio_set_value(OMAP4430SDP_GPIO_CAM_PDN_B, 1);
 +             msleep(10);
 +             ret = clk_enable(sdp4430_cam1_aux_clk); /* Enable XCLK */
 +             if (ret) {
 +                     dev_err(dev,
 +                             Error in clk_enable() in %s(%d)\n,
 +                             __func__, on);
 +                     gpio_set_value(OMAP4430SDP_GPIO_CAM_PDN_B, 0);
 +                     return ret;
 +             }
 +             msleep(10);
 +     } else {
 +             clk_disable(sdp4430_cam1_aux_clk);
 +             msleep(1);
 +             gpio_set_value(OMAP4430SDP_GPIO_CAM_PDN_B, 0);
 +             if (regulator_is_enabled(sdp4430_cam2pwr_reg)) {
 +                     ret = regulator_disable(sdp4430_cam2pwr_reg);
 +                     if (ret) {
 +                             dev_err(dev,
 +                                     Error in disabling sensor power 
 regulator 'cam2pwr'\n);
 +                             return ret;
 +                     }
 +             }
 +     }
 +
 +     return 0;
 +}

 Isn't this something that should be part of the sensor driver? There's
 nothing in the above code that would be board specific, except the names of
 the clocks, regulators and GPIOs. The sensor driver could hold the names
 instead; this would be also compatible with the device tree.

Agreed. I see what you mean...

I'll take care of that.


 It should be possible to have s_power() callback NULL, too.

 +static int sdp4430_ov_cam2_power(struct v4l2_subdev *subdev, int on)
 +{
 +     struct device *dev = subdev-v4l2_dev-dev;
 +     int ret;
 +
 +     if (on) {
 +             u8 gpoctl = 0;
 +
 +             ret = regulator_enable(sdp4430_cam2pwr_reg);
 +             if (ret) {
 +                     dev_err(dev,
 +                             Error in enabling sensor power regulator 
 'cam2pwr'\n);
 +                     return ret;
 +             }
 +
 +             msleep(50);
 +
 +             if (twl_i2c_read_u8(TWL_MODULE_AUDIO_VOICE, gpoctl,
 +                                 TWL6040_REG_GPOCTL))
 +                     return -ENODEV;
 +             if (twl_i2c_write_u8(TWL_MODULE_AUDIO_VOICE,
 +                                  gpoctl | TWL6040_GPO3,
 +                                  TWL6040_REG_GPOCTL))
 +                     return -ENODEV;

 The above piece of code looks quite interesting. What does it do?

Well, this is because the camera adapter board in 4430SDP has 3
sensors actually:

- 1 Sony IMX060 12.1 MP sensor
- 2 OmniVision OV5650 sensors

And there's 3 wideband analog switches, like this:

http://www.analog.com/static/imported-files/data_sheets/ADG936_936R.pdf

That basically select either IMX060 or OV5650 for CSI2A input.

So, this commands are because the TWL6040 chip has a GPO pin to toggle
this, instead
of an OMAP GPIO (Don't ask me why :) )

Anyways... I see your point, maybe this should be explained better
through a comment.

Regards,
Sergio

 Kind regards,

 --
 Sakari Ailus
 e-mail: sakari.ai...@iki.fi     jabber/XMPP/Gmail: sai...@retiisi.org.uk
--
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: Problems with 3.4-rc5

2012-05-03 Thread Tomi Valkeinen
On Thu, 2012-05-03 at 09:49 +0100, Joe Woodward wrote:

 Both patches together results in slightly different behaviour, the display is 
 still broken- 
 it flickers on and off with occassional underflows before breaking completely.

Beagle works fine for me with omap2plus based config, and I think overo
also although I can't test it now as I broke my micro mmc adapter.

Can you send your panel definition? Any other things that could affect
display? Do you have PM enabled? Can you share your kernel config?

 Tomi



signature.asc
Description: This is a digitally signed message part


Re: [PATCH 1/4] OMAP: DSS2: Remove suspicous and unused TAAL regulator API usage

2012-05-03 Thread Tomi Valkeinen
Hi,

On Thu, 2012-05-03 at 11:57 +0100, Mark Brown wrote:
 The TAAL driver contains some regulator support which is currently unused
 (the code is there but the one panel supported by the driver doesn't have
 any regulators provided). This code mostly looks like an open coded
 version of the regulator core bulk API.
 
 The only additional feature is that a voltage range can be set once when
 the device is opened, though this is never varied at runtime. The general
 expectation is that if the device is not actively managing the voltage of
 the device (eg, doing DVFS) then any configuration will be done using the
 constraints rather than by drivers, saving them code and ensuring that
 they work well with systems where the voltage is not configurable.
 
 If systems are added needing regulator support this can be added back in,
 though it should be based on core features rather than open coding things.

I've already applied this and the three other patches that you sent in
March to my omapdss tree. Have there been any changes?

 Tomi



signature.asc
Description: This is a digitally signed message part


Re: [PATCH 1/4] OMAP: DSS2: Remove suspicous and unused TAAL regulator API usage

2012-05-03 Thread Mark Brown
On Thu, May 03, 2012 at 04:11:00PM +0300, Tomi Valkeinen wrote:

 I've already applied this and the three other patches that you sent in
 March to my omapdss tree. Have there been any changes?

No, it's a resend - if you've applied these changes they're not showing
up in -next.


signature.asc
Description: Digital signature


Re: [PATCH 1/4] OMAP: DSS2: Remove suspicous and unused TAAL regulator API usage

2012-05-03 Thread Tomi Valkeinen
On Thu, 2012-05-03 at 14:21 +0100, Mark Brown wrote:
 On Thu, May 03, 2012 at 04:11:00PM +0300, Tomi Valkeinen wrote:
 
  I've already applied this and the three other patches that you sent in
  March to my omapdss tree. Have there been any changes?
 
 No, it's a resend - if you've applied these changes they're not showing
 up in -next.

Yes, I seem to have forgotten to update my for-next branch. I'll do it
right away.

 Tomi



signature.asc
Description: This is a digitally signed message part


Re: [PATCH 1/4] OMAP: DSS2: Remove suspicous and unused TAAL regulator API usage

2012-05-03 Thread Mark Brown
On Thu, May 03, 2012 at 04:23:27PM +0300, Tomi Valkeinen wrote:
 On Thu, 2012-05-03 at 14:21 +0100, Mark Brown wrote:
  On Thu, May 03, 2012 at 04:11:00PM +0300, Tomi Valkeinen wrote:

   I've already applied this and the three other patches that you sent in
   March to my omapdss tree. Have there been any changes?

  No, it's a resend - if you've applied these changes they're not showing
  up in -next.

 Yes, I seem to have forgotten to update my for-next branch. I'll do it
 right away.

Great, thanks!


signature.asc
Description: Digital signature


[PATCH 00/25] OMAPDSS: DT preparation patches v2

2012-05-03 Thread Tomi Valkeinen
Hi,

I started cleaning up and restructuring omapdss for device tree, and here's the
first set of patches from that ordeal. There's nothing DT specific in these
patches, but they are mostly generic cleanups that make sense even without DT.

This is the second version of these patches, the previous version can be found
from: http://www.spinics.net/lists/linux-fbdev/msg05667.html

The first 21 patches, which were in the previous version, have only gotten
minor cleanups (and, of course, more testing). The last 4 patches are new. The
most important of those patches is the DSI pin config patch, which makes it
possible for the panel driver to configure the DSI pins it needs.

This series can also be found from:
git://gitorious.org/linux-omap-dss2/linux.git work/devtree-base

 Tomi

Tomi Valkeinen (25):
  OMAPDSS: panel-dvi: add PD gpio handling
  OMAP: board-files: remove custom PD GPIO handling for DVI output
  OMAPDSS: TFP410: rename dvi - tfp410
  OMAPDSS: TFP410: rename dvi files to tfp410
  OMAPDSS: TFP410: pdata rewrite
  OMAPDSS: DSI: use dsi_get_dsidev_id(dsidev) instead of dsidev-id
  OMAPDSS: Taal: move reset gpio handling to taal driver
  OMAPDSS: clean up the omapdss platform data mess
  OMAPDSS: remove return from platform_driver_unreg
  OMAPDSS: use platform_driver_probe for core/dispc/dss
  OMAPDSS: create custom pdevs for DSS omap_devices
  OMAPDSS: create DPI  SDI devices
  OMAPDSS: create DPI  SDI drivers
  OMAPDSS: remove uses of dss_runtime_get/put
  OMAPDSS: handle output-driver reg/unreg more dynamically
  OMAPDSS: move the creation of debugfs files
  OMAPDSS: use platform_driver_probe for dsi/hdmi/rfbi/venc/dpi/sdi
  OMAPDSS: add __init  __exit
  OMAPFB: add __init  __exit
  OMAPDSS: change default_device handling
  OMAPDSS: interface drivers register their panel devices
  OMAPDSS: init omap_dss_devices internally
  OMAPDSS: DSI: implement generic DSI pin config
  OMAPDSS: DSI: improve DSI module id handling
  OMAPDSS: separate pdata based initialization

 arch/arm/mach-omap2/board-3430sdp.c |   38 +--
 arch/arm/mach-omap2/board-4430sdp.c |   37 +--
 arch/arm/mach-omap2/board-am3517evm.c   |   25 +-
 arch/arm/mach-omap2/board-cm-t35.c  |   30 +--
 arch/arm/mach-omap2/board-devkit8000.c  |   30 +--
 arch/arm/mach-omap2/board-igep0020.c|   32 +--
 arch/arm/mach-omap2/board-omap3beagle.c |   37 +--
 arch/arm/mach-omap2/board-omap3evm.c|   29 +-
 arch/arm/mach-omap2/board-omap3stalker.c|   29 +-
 arch/arm/mach-omap2/board-omap4panda.c  |   39 +--
 arch/arm/mach-omap2/board-overo.c   |   25 +-
 arch/arm/mach-omap2/display.c   |  175 ++--
 drivers/video/omap2/displays/Kconfig|8 +-
 drivers/video/omap2/displays/Makefile   |2 +-
 drivers/video/omap2/displays/panel-dvi.c|  363 -
 drivers/video/omap2/displays/panel-taal.c   |   22 ++
 drivers/video/omap2/displays/panel-tfp410.c |  385 +++
 drivers/video/omap2/dss/core.c  |  239 ++---
 drivers/video/omap2/dss/dispc.c |   50 ++--
 drivers/video/omap2/dss/display.c   |   40 ---
 drivers/video/omap2/dss/dpi.c   |   68 +++--
 drivers/video/omap2/dss/dsi.c   |  281 ++-
 drivers/video/omap2/dss/dss.c   |   44 ++-
 drivers/video/omap2/dss/dss.h   |  113 ++--
 drivers/video/omap2/dss/hdmi.c  |   86 +++---
 drivers/video/omap2/dss/rfbi.c  |   60 +++--
 drivers/video/omap2/dss/sdi.c   |   61 -
 drivers/video/omap2/dss/venc.c  |   62 +++--
 drivers/video/omap2/omapfb/omapfb-main.c|9 +-
 include/video/omap-panel-dvi.h  |   37 ---
 include/video/omap-panel-nokia-dsi.h|3 +
 include/video/omap-panel-tfp410.h   |   35 +++
 include/video/omapdss.h |   33 +--
 33 files changed, 1220 insertions(+), 1307 deletions(-)
 delete mode 100644 drivers/video/omap2/displays/panel-dvi.c
 create mode 100644 drivers/video/omap2/displays/panel-tfp410.c
 delete mode 100644 include/video/omap-panel-dvi.h
 create mode 100644 include/video/omap-panel-tfp410.h

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


[PATCH 01/25] OMAPDSS: panel-dvi: add PD gpio handling

2012-05-03 Thread Tomi Valkeinen
The driver for the TFP410 chip should handle the power-down signal of
the chip, instead of the current way of handling it in the board files.

This patch adds power_down_gpio into the device's platform data, and
adds the necessary code in the driver to request and handle the GPIO.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/displays/panel-dvi.c |   31 ++
 include/video/omap-panel-dvi.h   |2 ++
 2 files changed, 33 insertions(+)

diff --git a/drivers/video/omap2/displays/panel-dvi.c 
b/drivers/video/omap2/displays/panel-dvi.c
index 03eb14a..876b798 100644
--- a/drivers/video/omap2/displays/panel-dvi.c
+++ b/drivers/video/omap2/displays/panel-dvi.c
@@ -21,6 +21,7 @@
 #include linux/slab.h
 #include video/omapdss.h
 #include linux/i2c.h
+#include linux/gpio.h
 #include drm/drm_edid.h
 
 #include video/omap-panel-dvi.h
@@ -44,6 +45,8 @@ struct panel_drv_data {
struct omap_dss_device *dssdev;
 
struct mutex lock;
+
+   int pd_gpio;
 };
 
 static inline struct panel_dvi_platform_data
@@ -54,6 +57,7 @@ static inline struct panel_dvi_platform_data
 
 static int panel_dvi_power_on(struct omap_dss_device *dssdev)
 {
+   struct panel_drv_data *ddata = dev_get_drvdata(dssdev-dev);
struct panel_dvi_platform_data *pdata = get_pdata(dssdev);
int r;
 
@@ -70,6 +74,9 @@ static int panel_dvi_power_on(struct omap_dss_device *dssdev)
goto err1;
}
 
+   if (gpio_is_valid(ddata-pd_gpio))
+   gpio_set_value(ddata-pd_gpio, 1);
+
return 0;
 err1:
omapdss_dpi_display_disable(dssdev);
@@ -79,11 +86,15 @@ err0:
 
 static void panel_dvi_power_off(struct omap_dss_device *dssdev)
 {
+   struct panel_drv_data *ddata = dev_get_drvdata(dssdev-dev);
struct panel_dvi_platform_data *pdata = get_pdata(dssdev);
 
if (dssdev-state != OMAP_DSS_DISPLAY_ACTIVE)
return;
 
+   if (gpio_is_valid(ddata-pd_gpio))
+   gpio_set_value(ddata-pd_gpio, 0);
+
if (pdata-platform_disable)
pdata-platform_disable(dssdev);
 
@@ -92,7 +103,9 @@ static void panel_dvi_power_off(struct omap_dss_device 
*dssdev)
 
 static int panel_dvi_probe(struct omap_dss_device *dssdev)
 {
+   struct panel_dvi_platform_data *pdata = get_pdata(dssdev);
struct panel_drv_data *ddata;
+   int r;
 
ddata = kzalloc(sizeof(*ddata), GFP_KERNEL);
if (!ddata)
@@ -104,6 +117,21 @@ static int panel_dvi_probe(struct omap_dss_device *dssdev)
ddata-dssdev = dssdev;
mutex_init(ddata-lock);
 
+   if (pdata)
+   ddata-pd_gpio = pdata-power_down_gpio;
+   else
+   ddata-pd_gpio = -1;
+
+   if (gpio_is_valid(ddata-pd_gpio)) {
+   r = gpio_request_one(ddata-pd_gpio, GPIOF_OUT_INIT_LOW,
+   tfp410 pd);
+   if (r) {
+   dev_err(dssdev-dev, Failed to request PD GPIO %d\n,
+   ddata-pd_gpio);
+   ddata-pd_gpio = -1;
+   }
+   }
+
dev_set_drvdata(dssdev-dev, ddata);
 
return 0;
@@ -115,6 +143,9 @@ static void __exit panel_dvi_remove(struct omap_dss_device 
*dssdev)
 
mutex_lock(ddata-lock);
 
+   if (gpio_is_valid(ddata-pd_gpio))
+   gpio_free(ddata-pd_gpio);
+
dev_set_drvdata(dssdev-dev, NULL);
 
mutex_unlock(ddata-lock);
diff --git a/include/video/omap-panel-dvi.h b/include/video/omap-panel-dvi.h
index 87ad567b..4ad41fc 100644
--- a/include/video/omap-panel-dvi.h
+++ b/include/video/omap-panel-dvi.h
@@ -27,11 +27,13 @@ struct omap_dss_device;
  * @platform_enable: platform specific panel enable function
  * @platform_disable: platform specific panel disable function
  * @i2c_bus_num: i2c bus id for the panel
+ * @power_down_gpio: gpio number for PD pin (or -1 if not available)
  */
 struct panel_dvi_platform_data {
int (*platform_enable)(struct omap_dss_device *dssdev);
void (*platform_disable)(struct omap_dss_device *dssdev);
u16 i2c_bus_num;
+   int power_down_gpio;
 };
 
 #endif /* __OMAP_PANEL_DVI_H */
-- 
1.7.9.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


[PATCH 02/25] OMAP: board-files: remove custom PD GPIO handling for DVI output

2012-05-03 Thread Tomi Valkeinen
Now that the panel-dvi driver handles the PD (power-down) GPIO, we can
remove the custom PD handling from the board files.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 arch/arm/mach-omap2/board-3430sdp.c  |   32 +
 arch/arm/mach-omap2/board-am3517evm.c|   19 +
 arch/arm/mach-omap2/board-cm-t35.c   |   24 +-
 arch/arm/mach-omap2/board-devkit8000.c   |   24 ++
 arch/arm/mach-omap2/board-igep0020.c |   26 ++-
 arch/arm/mach-omap2/board-omap3beagle.c  |   31 ++--
 arch/arm/mach-omap2/board-omap3evm.c |   23 +
 arch/arm/mach-omap2/board-omap3stalker.c |   23 +
 arch/arm/mach-omap2/board-omap4panda.c   |   33 ++
 arch/arm/mach-omap2/board-overo.c|   19 +
 drivers/video/omap2/displays/panel-dvi.c |   13 
 include/video/omap-panel-dvi.h   |4 
 12 files changed, 14 insertions(+), 257 deletions(-)

diff --git a/arch/arm/mach-omap2/board-3430sdp.c 
b/arch/arm/mach-omap2/board-3430sdp.c
index da75f23..d827f8b 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -113,9 +113,6 @@ static struct gpio sdp3430_dss_gpios[] __initdata = {
{SDP3430_LCD_PANEL_BACKLIGHT_GPIO, GPIOF_OUT_INIT_LOW, LCD Backlight},
 };
 
-static int lcd_enabled;
-static int dvi_enabled;
-
 static void __init sdp3430_display_init(void)
 {
int r;
@@ -129,44 +126,18 @@ static void __init sdp3430_display_init(void)
 
 static int sdp3430_panel_enable_lcd(struct omap_dss_device *dssdev)
 {
-   if (dvi_enabled) {
-   printk(KERN_ERR cannot enable LCD, DVI is enabled\n);
-   return -EINVAL;
-   }
-
gpio_direction_output(SDP3430_LCD_PANEL_ENABLE_GPIO, 1);
gpio_direction_output(SDP3430_LCD_PANEL_BACKLIGHT_GPIO, 1);
 
-   lcd_enabled = 1;
-
return 0;
 }
 
 static void sdp3430_panel_disable_lcd(struct omap_dss_device *dssdev)
 {
-   lcd_enabled = 0;
-
gpio_direction_output(SDP3430_LCD_PANEL_ENABLE_GPIO, 0);
gpio_direction_output(SDP3430_LCD_PANEL_BACKLIGHT_GPIO, 0);
 }
 
-static int sdp3430_panel_enable_dvi(struct omap_dss_device *dssdev)
-{
-   if (lcd_enabled) {
-   printk(KERN_ERR cannot enable DVI, LCD is enabled\n);
-   return -EINVAL;
-   }
-
-   dvi_enabled = 1;
-
-   return 0;
-}
-
-static void sdp3430_panel_disable_dvi(struct omap_dss_device *dssdev)
-{
-   dvi_enabled = 0;
-}
-
 static int sdp3430_panel_enable_tv(struct omap_dss_device *dssdev)
 {
return 0;
@@ -187,8 +158,7 @@ static struct omap_dss_device sdp3430_lcd_device = {
 };
 
 static struct panel_dvi_platform_data dvi_panel = {
-   .platform_enable= sdp3430_panel_enable_dvi,
-   .platform_disable   = sdp3430_panel_disable_dvi,
+   .power_down_gpio= -1,
 };
 
 static struct omap_dss_device sdp3430_dvi_device = {
diff --git a/arch/arm/mach-omap2/board-am3517evm.c 
b/arch/arm/mach-omap2/board-am3517evm.c
index 3645285..ce155bf 100644
--- a/arch/arm/mach-omap2/board-am3517evm.c
+++ b/arch/arm/mach-omap2/board-am3517evm.c
@@ -207,25 +207,8 @@ static struct omap_dss_device am3517_evm_tv_device = {
.platform_disable   = am3517_evm_panel_disable_tv,
 };
 
-static int am3517_evm_panel_enable_dvi(struct omap_dss_device *dssdev)
-{
-   if (lcd_enabled) {
-   printk(KERN_ERR cannot enable DVI, LCD is enabled\n);
-   return -EINVAL;
-   }
-   dvi_enabled = 1;
-
-   return 0;
-}
-
-static void am3517_evm_panel_disable_dvi(struct omap_dss_device *dssdev)
-{
-   dvi_enabled = 0;
-}
-
 static struct panel_dvi_platform_data dvi_panel = {
-   .platform_enable= am3517_evm_panel_enable_dvi,
-   .platform_disable   = am3517_evm_panel_disable_dvi,
+   .power_down_gpio= -1,
 };
 
 static struct omap_dss_device am3517_evm_dvi_device = {
diff --git a/arch/arm/mach-omap2/board-cm-t35.c 
b/arch/arm/mach-omap2/board-cm-t35.c
index 909a8b9..6f79026 100644
--- a/arch/arm/mach-omap2/board-cm-t35.c
+++ b/arch/arm/mach-omap2/board-cm-t35.c
@@ -218,25 +218,6 @@ static void cm_t35_panel_disable_lcd(struct 
omap_dss_device *dssdev)
gpio_set_value(CM_T35_LCD_EN_GPIO, 0);
 }
 
-static int cm_t35_panel_enable_dvi(struct omap_dss_device *dssdev)
-{
-   if (lcd_enabled) {
-   printk(KERN_ERR cannot enable DVI, LCD is enabled\n);
-   return -EINVAL;
-   }
-
-   gpio_set_value(CM_T35_DVI_EN_GPIO, 0);
-   dvi_enabled = 1;
-
-   return 0;
-}
-
-static void cm_t35_panel_disable_dvi(struct omap_dss_device *dssdev)
-{
-   gpio_set_value(CM_T35_DVI_EN_GPIO, 1);
-   dvi_enabled = 0;
-}
-
 static int cm_t35_panel_enable_tv(struct omap_dss_device *dssdev)
 {
return 0;
@@ -261,8 +242,7 @@ static 

[PATCH 05/25] OMAPDSS: TFP410: pdata rewrite

2012-05-03 Thread Tomi Valkeinen
To ease device tree adaptation in the future, rewrite TFP410 platform
data handling to be done inside probe(), so that probe() is the only
place where we need to handle the DT/pdata choice.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/displays/panel-tfp410.c |   72 ++-
 1 file changed, 38 insertions(+), 34 deletions(-)

diff --git a/drivers/video/omap2/displays/panel-tfp410.c 
b/drivers/video/omap2/displays/panel-tfp410.c
index 52637fa..f03964e 100644
--- a/drivers/video/omap2/displays/panel-tfp410.c
+++ b/drivers/video/omap2/displays/panel-tfp410.c
@@ -47,13 +47,9 @@ struct panel_drv_data {
struct mutex lock;
 
int pd_gpio;
-};
 
-static inline struct tfp410_platform_data
-*get_pdata(const struct omap_dss_device *dssdev)
-{
-   return dssdev-data;
-}
+   struct i2c_adapter *i2c_adapter;
+};
 
 static int tfp410_power_on(struct omap_dss_device *dssdev)
 {
@@ -90,11 +86,11 @@ static void tfp410_power_off(struct omap_dss_device *dssdev)
 
 static int tfp410_probe(struct omap_dss_device *dssdev)
 {
-   struct tfp410_platform_data *pdata = get_pdata(dssdev);
struct panel_drv_data *ddata;
int r;
+   int i2c_bus_num;
 
-   ddata = kzalloc(sizeof(*ddata), GFP_KERNEL);
+   ddata = devm_kzalloc(dssdev-dev, sizeof(*ddata), GFP_KERNEL);
if (!ddata)
return -ENOMEM;
 
@@ -104,10 +100,15 @@ static int tfp410_probe(struct omap_dss_device *dssdev)
ddata-dssdev = dssdev;
mutex_init(ddata-lock);
 
-   if (pdata)
+   if (dssdev-data) {
+   struct tfp410_platform_data *pdata = dssdev-data;
+
ddata-pd_gpio = pdata-power_down_gpio;
-   else
+   i2c_bus_num = pdata-i2c_bus_num;
+   } else {
ddata-pd_gpio = -1;
+   i2c_bus_num = -1;
+   }
 
if (gpio_is_valid(ddata-pd_gpio)) {
r = gpio_request_one(ddata-pd_gpio, GPIOF_OUT_INIT_LOW,
@@ -115,13 +116,31 @@ static int tfp410_probe(struct omap_dss_device *dssdev)
if (r) {
dev_err(dssdev-dev, Failed to request PD GPIO %d\n,
ddata-pd_gpio);
-   ddata-pd_gpio = -1;
+   return r;
}
}
 
+   if (i2c_bus_num != -1) {
+   struct i2c_adapter *adapter;
+
+   adapter = i2c_get_adapter(i2c_bus_num);
+   if (!adapter) {
+   dev_err(dssdev-dev, Failed to get I2C adapter, bus 
%d\n,
+   i2c_bus_num);
+   r = -EINVAL;
+   goto err_i2c;
+   }
+
+   ddata-i2c_adapter = adapter;
+   }
+
dev_set_drvdata(dssdev-dev, ddata);
 
return 0;
+err_i2c:
+   if (gpio_is_valid(ddata-pd_gpio))
+   gpio_free(ddata-pd_gpio);
+   return r;
 }
 
 static void __exit tfp410_remove(struct omap_dss_device *dssdev)
@@ -130,14 +149,15 @@ static void __exit tfp410_remove(struct omap_dss_device 
*dssdev)
 
mutex_lock(ddata-lock);
 
+   if (ddata-i2c_adapter)
+   i2c_put_adapter(ddata-i2c_adapter);
+
if (gpio_is_valid(ddata-pd_gpio))
gpio_free(ddata-pd_gpio);
 
dev_set_drvdata(dssdev-dev, NULL);
 
mutex_unlock(ddata-lock);
-
-   kfree(ddata);
 }
 
 static int tfp410_enable(struct omap_dss_device *dssdev)
@@ -269,27 +289,17 @@ static int tfp410_read_edid(struct omap_dss_device 
*dssdev,
u8 *edid, int len)
 {
struct panel_drv_data *ddata = dev_get_drvdata(dssdev-dev);
-   struct tfp410_platform_data *pdata = get_pdata(dssdev);
-   struct i2c_adapter *adapter;
int r, l, bytes_read;
 
mutex_lock(ddata-lock);
 
-   if (pdata-i2c_bus_num == 0) {
+   if (!ddata-i2c_adapter) {
r = -ENODEV;
goto err;
}
 
-   adapter = i2c_get_adapter(pdata-i2c_bus_num);
-   if (!adapter) {
-   dev_err(dssdev-dev, Failed to get I2C adapter, bus %d\n,
-   pdata-i2c_bus_num);
-   r = -EINVAL;
-   goto err;
-   }
-
l = min(EDID_LENGTH, len);
-   r = tfp410_ddc_read(adapter, edid, l, 0);
+   r = tfp410_ddc_read(ddata-i2c_adapter, edid, l, 0);
if (r)
goto err;
 
@@ -299,7 +309,7 @@ static int tfp410_read_edid(struct omap_dss_device *dssdev,
if (len  EDID_LENGTH  edid[0x7e]  0) {
l = min(EDID_LENGTH, len - EDID_LENGTH);
 
-   r = tfp410_ddc_read(adapter, edid + EDID_LENGTH,
+   r = tfp410_ddc_read(ddata-i2c_adapter, edid + EDID_LENGTH,
l, EDID_LENGTH);
if (r)
goto err;
@@ -319,21 +329,15 @@ err:
 static bool tfp410_detect(struct omap_dss_device *dssdev)
 {
struct 

[PATCH 07/25] OMAPDSS: Taal: move reset gpio handling to taal driver

2012-05-03 Thread Tomi Valkeinen
The reset GPIO for Taal panel driver is currently requested in the
4430sdp board file. This patch moves the gpio request/free into the Taal
driver, where it should be.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 arch/arm/mach-omap2/board-4430sdp.c   |   16 
 drivers/video/omap2/displays/panel-taal.c |   15 +++
 2 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/arch/arm/mach-omap2/board-4430sdp.c 
b/arch/arm/mach-omap2/board-4430sdp.c
index 130ab00..6cbb16f 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -758,21 +758,6 @@ static struct omap_dss_device sdp4430_lcd2_device = {
.channel= OMAP_DSS_CHANNEL_LCD2,
 };
 
-static void sdp4430_lcd_init(void)
-{
-   int r;
-
-   r = gpio_request_one(dsi1_panel.reset_gpio, GPIOF_DIR_OUT,
-   lcd1_reset_gpio);
-   if (r)
-   pr_err(%s: Could not get lcd1_reset_gpio\n, __func__);
-
-   r = gpio_request_one(dsi2_panel.reset_gpio, GPIOF_DIR_OUT,
-   lcd2_reset_gpio);
-   if (r)
-   pr_err(%s: Could not get lcd2_reset_gpio\n, __func__);
-}
-
 static struct omap_dss_hdmi_data sdp4430_hdmi_data = {
.hpd_gpio = HDMI_GPIO_HPD,
 };
@@ -858,7 +843,6 @@ static void __init omap_4430sdp_display_init(void)
if (r)
pr_err(%s: Could not get display_sel GPIO\n, __func__);
 
-   sdp4430_lcd_init();
sdp4430_picodlp_init();
omap_display_init(sdp4430_dss_data);
/*
diff --git a/drivers/video/omap2/displays/panel-taal.c 
b/drivers/video/omap2/displays/panel-taal.c
index 3053399..be9992f 100644
--- a/drivers/video/omap2/displays/panel-taal.c
+++ b/drivers/video/omap2/displays/panel-taal.c
@@ -912,6 +912,15 @@ static int taal_probe(struct omap_dss_device *dssdev)
 
dev_set_drvdata(dssdev-dev, td);
 
+   if (gpio_is_valid(panel_data-reset_gpio)) {
+   r = gpio_request_one(panel_data-reset_gpio, GPIOF_OUT_INIT_LOW,
+   taal rst);
+   if (r) {
+   dev_err(dssdev-dev, failed to request reset gpio\n);
+   goto err_rst_gpio;
+   }
+   }
+
taal_hw_reset(dssdev);
 
if (panel_data-use_dsi_backlight) {
@@ -992,6 +1001,9 @@ err_gpio:
if (bldev != NULL)
backlight_device_unregister(bldev);
 err_bl:
+   if (gpio_is_valid(panel_data-reset_gpio))
+   gpio_free(panel_data-reset_gpio);
+err_rst_gpio:
destroy_workqueue(td-workqueue);
 err_wq:
kfree(td);
@@ -1030,6 +1042,9 @@ static void __exit taal_remove(struct omap_dss_device 
*dssdev)
/* reset, to be sure that the panel is in a valid state */
taal_hw_reset(dssdev);
 
+   if (gpio_is_valid(panel_data-reset_gpio))
+   gpio_free(panel_data-reset_gpio);
+
kfree(td);
 }
 
-- 
1.7.9.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


[PATCH 08/25] OMAPDSS: clean up the omapdss platform data mess

2012-05-03 Thread Tomi Valkeinen
The omapdss pdata handling is a mess. This is more evident when trying
to use device tree for DSS, as we don't have platform data anymore in
that case. This patch cleans the pdata handling by:

- Remove struct omap_display_platform_data. It was used just as a
  wrapper for struct omap_dss_board_info.
- Pass the platform data only to omapdss device. The drivers for omap
  dss hwmods do not need the platform data. This should also work better
  for DT, as we can create omapdss device programmatically in generic omap
  boot code, and thus we can pass the pdata to it.
- Create dss functions for get_ctx_loss_count and dsi_enable/disable_pads
  that the dss hwmod drivers can call.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 arch/arm/mach-omap2/display.c   |   39 +++
 drivers/video/omap2/dss/core.c  |   35 +++
 drivers/video/omap2/dss/dispc.c |   21 ++---
 drivers/video/omap2/dss/dsi.c   |   17 +++--
 drivers/video/omap2/dss/dss.h   |3 +++
 drivers/video/omap2/dss/hdmi.c  |2 --
 include/video/omapdss.h |5 -
 7 files changed, 62 insertions(+), 60 deletions(-)

diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
index 60cded4..07232fd 100644
--- a/arch/arm/mach-omap2/display.c
+++ b/arch/arm/mach-omap2/display.c
@@ -191,10 +191,24 @@ int __init omap_display_init(struct omap_dss_board_info 
*board_data)
struct omap_hwmod *oh;
struct platform_device *pdev;
int i, oh_count;
-   struct omap_display_platform_data pdata;
const struct omap_dss_hwmod_data *curr_dss_hwmod;
 
-   memset(pdata, 0, sizeof(pdata));
+   /* create omapdss device */
+
+   board_data-dsi_enable_pads = omap_dsi_enable_pads;
+   board_data-dsi_disable_pads = omap_dsi_disable_pads;
+   board_data-get_context_loss_count = omap_pm_get_dev_context_loss_count;
+   board_data-set_min_bus_tput = omap_dss_set_min_bus_tput;
+
+   omap_display_device.dev.platform_data = board_data;
+
+   r = platform_device_register(omap_display_device);
+   if (r  0) {
+   pr_err(Unable to register omapdss device\n);
+   return r;
+   }
+
+   /* create devices for dss hwmods */
 
if (cpu_is_omap24xx()) {
curr_dss_hwmod = omap2_dss_hwmod_data;
@@ -207,16 +221,6 @@ int __init omap_display_init(struct omap_dss_board_info 
*board_data)
oh_count = ARRAY_SIZE(omap4_dss_hwmod_data);
}
 
-   if (board_data-dsi_enable_pads == NULL)
-   board_data-dsi_enable_pads = omap_dsi_enable_pads;
-   if (board_data-dsi_disable_pads == NULL)
-   board_data-dsi_disable_pads = omap_dsi_disable_pads;
-
-   pdata.board_data = board_data;
-   pdata.board_data-get_context_loss_count =
-   omap_pm_get_dev_context_loss_count;
-   pdata.board_data-set_min_bus_tput = omap_dss_set_min_bus_tput;
-
for (i = 0; i  oh_count; i++) {
oh = omap_hwmod_lookup(curr_dss_hwmod[i].oh_name);
if (!oh) {
@@ -226,21 +230,16 @@ int __init omap_display_init(struct omap_dss_board_info 
*board_data)
}
 
pdev = omap_device_build(curr_dss_hwmod[i].dev_name,
-   curr_dss_hwmod[i].id, oh, pdata,
-   sizeof(struct omap_display_platform_data),
+   curr_dss_hwmod[i].id, oh,
+   NULL, 0,
NULL, 0, 0);
 
if (WARN((IS_ERR(pdev)), Could not build omap_device for %s\n,
curr_dss_hwmod[i].oh_name))
return -ENODEV;
}
-   omap_display_device.dev.platform_data = board_data;
 
-   r = platform_device_register(omap_display_device);
-   if (r  0)
-   printk(KERN_ERR Unable to register OMAP-Display device\n);
-
-   return r;
+   return 0;
 }
 
 static void dispc_disable_outputs(void)
diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
index 64cb8aa..b37b6f4 100644
--- a/drivers/video/omap2/dss/core.c
+++ b/drivers/video/omap2/dss/core.c
@@ -87,6 +87,41 @@ struct regulator *dss_get_vdds_sdi(void)
return reg;
 }
 
+int dss_get_ctx_loss_count(struct device *dev)
+{
+   struct omap_dss_board_info *board_data = core.pdev-dev.platform_data;
+   int cnt;
+
+   if (!board_data-get_context_loss_count)
+   return -ENOENT;
+
+   cnt = board_data-get_context_loss_count(dev);
+
+   WARN_ONCE(cnt  0, get_context_loss_count failed: %d\n, cnt);
+
+   return cnt;
+}
+
+int dss_dsi_enable_pads(int dsi_id, unsigned lane_mask)
+{
+   struct omap_dss_board_info *board_data = core.pdev-dev.platform_data;
+
+   if (!board_data-dsi_enable_pads)
+   return -ENOENT;
+
+   return 

[PATCH 10/25] OMAPDSS: use platform_driver_probe for core/dispc/dss

2012-05-03 Thread Tomi Valkeinen
The platform devices for omapdss, dss and dispc drivers are always
present, so we can use platform_driver_probe instead of
platform_driver_register.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/core.c  |3 +--
 drivers/video/omap2/dss/dispc.c |3 +--
 drivers/video/omap2/dss/dss.c   |3 +--
 3 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
index b37b6f4..db45e6a 100644
--- a/drivers/video/omap2/dss/core.c
+++ b/drivers/video/omap2/dss/core.c
@@ -296,7 +296,6 @@ static int omap_dss_resume(struct platform_device *pdev)
 }
 
 static struct platform_driver omap_dss_driver = {
-   .probe  = omap_dss_probe,
.remove = omap_dss_remove,
.shutdown   = omap_dss_shutdown,
.suspend= omap_dss_suspend,
@@ -521,7 +520,7 @@ static int __init omap_dss_register_drivers(void)
 {
int r;
 
-   r = platform_driver_register(omap_dss_driver);
+   r = platform_driver_probe(omap_dss_driver, omap_dss_probe);
if (r)
return r;
 
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index 2aa1fea..68aa566 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -3620,7 +3620,6 @@ static const struct dev_pm_ops dispc_pm_ops = {
 };
 
 static struct platform_driver omap_dispchw_driver = {
-   .probe  = omap_dispchw_probe,
.remove = omap_dispchw_remove,
.driver = {
.name   = omapdss_dispc,
@@ -3631,7 +3630,7 @@ static struct platform_driver omap_dispchw_driver = {
 
 int dispc_init_platform_driver(void)
 {
-   return platform_driver_register(omap_dispchw_driver);
+   return platform_driver_probe(omap_dispchw_driver, omap_dispchw_probe);
 }
 
 void dispc_uninit_platform_driver(void)
diff --git a/drivers/video/omap2/dss/dss.c b/drivers/video/omap2/dss/dss.c
index 24f5429..2bdc400 100644
--- a/drivers/video/omap2/dss/dss.c
+++ b/drivers/video/omap2/dss/dss.c
@@ -857,7 +857,6 @@ static const struct dev_pm_ops dss_pm_ops = {
 };
 
 static struct platform_driver omap_dsshw_driver = {
-   .probe  = omap_dsshw_probe,
.remove = omap_dsshw_remove,
.driver = {
.name   = omapdss_dss,
@@ -868,7 +867,7 @@ static struct platform_driver omap_dsshw_driver = {
 
 int dss_init_platform_driver(void)
 {
-   return platform_driver_register(omap_dsshw_driver);
+   return platform_driver_probe(omap_dsshw_driver, omap_dsshw_probe);
 }
 
 void dss_uninit_platform_driver(void)
-- 
1.7.9.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


[PATCH 09/25] OMAPDSS: remove return from platform_driver_unreg

2012-05-03 Thread Tomi Valkeinen
For unknown reasons we seem to have a return in each of the omapdss's
uninit functions, which is a void function.

Remove the returns.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/dispc.c |2 +-
 drivers/video/omap2/dss/dsi.c   |2 +-
 drivers/video/omap2/dss/dss.c   |2 +-
 drivers/video/omap2/dss/hdmi.c  |2 +-
 drivers/video/omap2/dss/rfbi.c  |2 +-
 drivers/video/omap2/dss/venc.c  |2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index 262ed29..2aa1fea 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -3636,5 +3636,5 @@ int dispc_init_platform_driver(void)
 
 void dispc_uninit_platform_driver(void)
 {
-   return platform_driver_unregister(omap_dispchw_driver);
+   platform_driver_unregister(omap_dispchw_driver);
 }
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index a5a8316..45ba9e7 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -4816,5 +4816,5 @@ int dsi_init_platform_driver(void)
 
 void dsi_uninit_platform_driver(void)
 {
-   return platform_driver_unregister(omap_dsihw_driver);
+   platform_driver_unregister(omap_dsihw_driver);
 }
diff --git a/drivers/video/omap2/dss/dss.c b/drivers/video/omap2/dss/dss.c
index e731aa4..24f5429 100644
--- a/drivers/video/omap2/dss/dss.c
+++ b/drivers/video/omap2/dss/dss.c
@@ -873,5 +873,5 @@ int dss_init_platform_driver(void)
 
 void dss_uninit_platform_driver(void)
 {
-   return platform_driver_unregister(omap_dsshw_driver);
+   platform_driver_unregister(omap_dsshw_driver);
 }
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index 2321b75..35580b1 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -914,5 +914,5 @@ int hdmi_init_platform_driver(void)
 
 void hdmi_uninit_platform_driver(void)
 {
-   return platform_driver_unregister(omapdss_hdmihw_driver);
+   platform_driver_unregister(omapdss_hdmihw_driver);
 }
diff --git a/drivers/video/omap2/dss/rfbi.c b/drivers/video/omap2/dss/rfbi.c
index a81ffcb..39aac0b 100644
--- a/drivers/video/omap2/dss/rfbi.c
+++ b/drivers/video/omap2/dss/rfbi.c
@@ -1039,5 +1039,5 @@ int rfbi_init_platform_driver(void)
 
 void rfbi_uninit_platform_driver(void)
 {
-   return platform_driver_unregister(omap_rfbihw_driver);
+   platform_driver_unregister(omap_rfbihw_driver);
 }
diff --git a/drivers/video/omap2/dss/venc.c b/drivers/video/omap2/dss/venc.c
index 30bbb63..7b0e8ed 100644
--- a/drivers/video/omap2/dss/venc.c
+++ b/drivers/video/omap2/dss/venc.c
@@ -907,5 +907,5 @@ void venc_uninit_platform_driver(void)
if (cpu_is_omap44xx())
return;
 
-   return platform_driver_unregister(omap_venchw_driver);
+   platform_driver_unregister(omap_venchw_driver);
 }
-- 
1.7.9.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


[PATCH 11/25] OMAPDSS: create custom pdevs for DSS omap_devices

2012-05-03 Thread Tomi Valkeinen
Instead of using omap_device_build() to create the omap_devices for DSS
hwmods, create them with a custom function. This will allow us to create
a parent-child hierarchy for the devices so that the omapdss_core device
is parent for the rest of the dss hwmod devices.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 arch/arm/mach-omap2/display.c |   88 ++---
 1 file changed, 74 insertions(+), 14 deletions(-)

diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
index 07232fd..46d2a98 100644
--- a/arch/arm/mach-omap2/display.c
+++ b/arch/arm/mach-omap2/display.c
@@ -185,13 +185,71 @@ static int omap_dss_set_min_bus_tput(struct device *dev, 
unsigned long tput)
return omap_pm_set_min_bus_tput(dev, OCP_INITIATOR_AGENT, tput);
 }
 
+static struct platform_device *create_dss_pdev(const char *pdev_name,
+   int pdev_id, const char *oh_name, void *pdata, int pdata_len,
+   struct platform_device *parent)
+{
+   struct platform_device *pdev;
+   struct omap_device *od;
+   struct omap_hwmod *ohs[1];
+   struct omap_hwmod *oh;
+   int r;
+
+   oh = omap_hwmod_lookup(oh_name);
+   if (!oh) {
+   pr_err(Could not look up %s\n, oh_name);
+   r = -ENODEV;
+   goto err;
+   }
+
+   pdev = platform_device_alloc(pdev_name, pdev_id);
+   if (!pdev) {
+   pr_err(Could not create pdev for %s\n, pdev_name);
+   r = -ENOMEM;
+   goto err;
+   }
+
+   if (parent != NULL)
+   pdev-dev.parent = parent-dev;
+
+   if (pdev-id != -1)
+   dev_set_name(pdev-dev, %s.%d, pdev-name, pdev-id);
+   else
+   dev_set_name(pdev-dev, %s, pdev-name);
+
+   ohs[0] = oh;
+   od = omap_device_alloc(pdev, ohs, 1, NULL, 0);
+   if (!od) {
+   pr_err(Could not alloc omap_device for %s\n, pdev_name);
+   r = -ENOMEM;
+   goto err;
+   }
+
+   r = platform_device_add_data(pdev, pdata, pdata_len);
+   if (r) {
+   pr_err(Could not set pdata for %s\n, pdev_name);
+   goto err;
+   }
+
+   r = omap_device_register(pdev);
+   if (r) {
+   pr_err(Could not register omap_device for %s\n, pdev_name);
+   goto err;
+   }
+
+   return pdev;
+
+err:
+   return ERR_PTR(r);
+}
+
 int __init omap_display_init(struct omap_dss_board_info *board_data)
 {
int r = 0;
-   struct omap_hwmod *oh;
struct platform_device *pdev;
int i, oh_count;
const struct omap_dss_hwmod_data *curr_dss_hwmod;
+   struct platform_device *dss_pdev;
 
/* create omapdss device */
 
@@ -221,22 +279,24 @@ int __init omap_display_init(struct omap_dss_board_info 
*board_data)
oh_count = ARRAY_SIZE(omap4_dss_hwmod_data);
}
 
-   for (i = 0; i  oh_count; i++) {
-   oh = omap_hwmod_lookup(curr_dss_hwmod[i].oh_name);
-   if (!oh) {
-   pr_err(Could not look up %s\n,
-   curr_dss_hwmod[i].oh_name);
-   return -ENODEV;
-   }
+   dss_pdev = NULL;
 
-   pdev = omap_device_build(curr_dss_hwmod[i].dev_name,
-   curr_dss_hwmod[i].id, oh,
+   for (i = 0; i  oh_count; i++) {
+   pdev = create_dss_pdev(curr_dss_hwmod[i].dev_name,
+   curr_dss_hwmod[i].id,
+   curr_dss_hwmod[i].oh_name,
NULL, 0,
-   NULL, 0, 0);
+   dss_pdev);
+
+   if (IS_ERR(pdev)) {
+   pr_err(Could not build omap_device for %s\n,
+   curr_dss_hwmod[i].oh_name);
+
+   return PTR_ERR(pdev);
+   }
 
-   if (WARN((IS_ERR(pdev)), Could not build omap_device for %s\n,
-   curr_dss_hwmod[i].oh_name))
-   return -ENODEV;
+   if (i == 0)
+   dss_pdev = pdev;
}
 
return 0;
-- 
1.7.9.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


[PATCH 04/25] OMAPDSS: TFP410: rename dvi files to tfp410

2012-05-03 Thread Tomi Valkeinen
Now that the tfp410 driver has been renamed in the code, this patch
finishes the renaming by renaming the files.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 arch/arm/mach-omap2/board-3430sdp.c |2 +-
 arch/arm/mach-omap2/board-am3517evm.c   |2 +-
 arch/arm/mach-omap2/board-cm-t35.c  |2 +-
 arch/arm/mach-omap2/board-devkit8000.c  |2 +-
 arch/arm/mach-omap2/board-igep0020.c|2 +-
 arch/arm/mach-omap2/board-omap3beagle.c |2 +-
 arch/arm/mach-omap2/board-omap3evm.c|2 +-
 arch/arm/mach-omap2/board-omap3stalker.c|2 +-
 arch/arm/mach-omap2/board-omap4panda.c  |2 +-
 arch/arm/mach-omap2/board-overo.c   |2 +-
 drivers/video/omap2/displays/Makefile   |2 +-
 drivers/video/omap2/displays/panel-dvi.c|  381 ---
 drivers/video/omap2/displays/panel-tfp410.c |  381 +++
 include/video/omap-panel-dvi.h  |   35 ---
 include/video/omap-panel-tfp410.h   |   35 +++
 15 files changed, 427 insertions(+), 427 deletions(-)
 delete mode 100644 drivers/video/omap2/displays/panel-dvi.c
 create mode 100644 drivers/video/omap2/displays/panel-tfp410.c
 delete mode 100644 include/video/omap-panel-dvi.h
 create mode 100644 include/video/omap-panel-tfp410.h

diff --git a/arch/arm/mach-omap2/board-3430sdp.c 
b/arch/arm/mach-omap2/board-3430sdp.c
index 2a26d62..37abb0d 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -37,7 +37,7 @@
 #include plat/dma.h
 #include plat/gpmc.h
 #include video/omapdss.h
-#include video/omap-panel-dvi.h
+#include video/omap-panel-tfp410.h
 
 #include plat/gpmc-smc91x.h
 
diff --git a/arch/arm/mach-omap2/board-am3517evm.c 
b/arch/arm/mach-omap2/board-am3517evm.c
index feecc96..99790eb 100644
--- a/arch/arm/mach-omap2/board-am3517evm.c
+++ b/arch/arm/mach-omap2/board-am3517evm.c
@@ -37,7 +37,7 @@
 #include plat/usb.h
 #include video/omapdss.h
 #include video/omap-panel-generic-dpi.h
-#include video/omap-panel-dvi.h
+#include video/omap-panel-tfp410.h
 
 #include am35xx-emac.h
 #include mux.h
diff --git a/arch/arm/mach-omap2/board-cm-t35.c 
b/arch/arm/mach-omap2/board-cm-t35.c
index 9e8efe9..45746cb 100644
--- a/arch/arm/mach-omap2/board-cm-t35.c
+++ b/arch/arm/mach-omap2/board-cm-t35.c
@@ -44,7 +44,7 @@
 #include plat/usb.h
 #include video/omapdss.h
 #include video/omap-panel-generic-dpi.h
-#include video/omap-panel-dvi.h
+#include video/omap-panel-tfp410.h
 #include plat/mcspi.h
 
 #include mach/hardware.h
diff --git a/arch/arm/mach-omap2/board-devkit8000.c 
b/arch/arm/mach-omap2/board-devkit8000.c
index 5ea88f5..b063f0d 100644
--- a/arch/arm/mach-omap2/board-devkit8000.c
+++ b/arch/arm/mach-omap2/board-devkit8000.c
@@ -47,7 +47,7 @@
 #include plat/usb.h
 #include video/omapdss.h
 #include video/omap-panel-generic-dpi.h
-#include video/omap-panel-dvi.h
+#include video/omap-panel-tfp410.h
 
 #include plat/mcspi.h
 #include linux/input/matrix_keypad.h
diff --git a/arch/arm/mach-omap2/board-igep0020.c 
b/arch/arm/mach-omap2/board-igep0020.c
index bf87f17..04816c9 100644
--- a/arch/arm/mach-omap2/board-igep0020.c
+++ b/arch/arm/mach-omap2/board-igep0020.c
@@ -32,7 +32,7 @@
 #include plat/gpmc.h
 #include plat/usb.h
 #include video/omapdss.h
-#include video/omap-panel-dvi.h
+#include video/omap-panel-tfp410.h
 #include plat/onenand.h
 
 #include mux.h
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c 
b/arch/arm/mach-omap2/board-omap3beagle.c
index 1795967..8ede8d2 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -42,7 +42,7 @@
 #include plat/board.h
 #include common.h
 #include video/omapdss.h
-#include video/omap-panel-dvi.h
+#include video/omap-panel-tfp410.h
 #include plat/gpmc.h
 #include plat/nand.h
 #include plat/usb.h
diff --git a/arch/arm/mach-omap2/board-omap3evm.c 
b/arch/arm/mach-omap2/board-omap3evm.c
index 9cb0d08..9919d6c 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -46,7 +46,7 @@
 #include common.h
 #include plat/mcspi.h
 #include video/omapdss.h
-#include video/omap-panel-dvi.h
+#include video/omap-panel-tfp410.h
 
 #include mux.h
 #include sdram-micron-mt46h32m32lf-6.h
diff --git a/arch/arm/mach-omap2/board-omap3stalker.c 
b/arch/arm/mach-omap2/board-omap3stalker.c
index a9acf96..4396bae 100644
--- a/arch/arm/mach-omap2/board-omap3stalker.c
+++ b/arch/arm/mach-omap2/board-omap3stalker.c
@@ -42,7 +42,7 @@
 #include plat/usb.h
 #include video/omapdss.h
 #include video/omap-panel-generic-dpi.h
-#include video/omap-panel-dvi.h
+#include video/omap-panel-tfp410.h
 
 #include plat/mcspi.h
 #include linux/input/matrix_keypad.h
diff --git a/arch/arm/mach-omap2/board-omap4panda.c 
b/arch/arm/mach-omap2/board-omap4panda.c
index e1f19b2..b26cd15 100644
--- a/arch/arm/mach-omap2/board-omap4panda.c
+++ b/arch/arm/mach-omap2/board-omap4panda.c
@@ -42,7 +42,7 @@
 #include 

[PATCH 12/25] OMAPDSS: create DPI SDI devices

2012-05-03 Thread Tomi Valkeinen
We currently have separate device/driver for each DSS HW module. The DPI
and SDI outputs are more or less parts of the DSS or DISPC hardware
modules, but in SW it makes sense to represent them as device/driver
pairs similarly to all the other outputs. This also makes sense for
device tree, as each node under dss will be a platform device, and
handling DPI  SDI somehow differently than the rest would just make the
code more complex.

This patch modifies arch/arm/mach-omap2/display.c to create platform
devices for DPI and SDI, and later patches will implement driver for
them.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 arch/arm/mach-omap2/display.c |   57 +
 1 file changed, 57 insertions(+)

diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
index 46d2a98..2c05a60 100644
--- a/arch/arm/mach-omap2/display.c
+++ b/arch/arm/mach-omap2/display.c
@@ -243,6 +243,46 @@ err:
return ERR_PTR(r);
 }
 
+static struct platform_device *create_simple_dss_pdev(const char *pdev_name,
+   int pdev_id, void *pdata, int pdata_len,
+   struct platform_device *parent)
+{
+   struct platform_device *pdev;
+   int r;
+
+   pdev = platform_device_alloc(pdev_name, pdev_id);
+   if (!pdev) {
+   pr_err(Could not create pdev for %s\n, pdev_name);
+   r = -ENOMEM;
+   goto err;
+   }
+
+   if (parent != NULL)
+   pdev-dev.parent = parent-dev;
+
+   if (pdev-id != -1)
+   dev_set_name(pdev-dev, %s.%d, pdev-name, pdev-id);
+   else
+   dev_set_name(pdev-dev, %s, pdev-name);
+
+   r = platform_device_add_data(pdev, pdata, pdata_len);
+   if (r) {
+   pr_err(Could not set pdata for %s\n, pdev_name);
+   goto err;
+   }
+
+   r = omap_device_register(pdev);
+   if (r) {
+   pr_err(Could not register omap_device for %s\n, pdev_name);
+   goto err;
+   }
+
+   return pdev;
+
+err:
+   return ERR_PTR(r);
+}
+
 int __init omap_display_init(struct omap_dss_board_info *board_data)
 {
int r = 0;
@@ -299,6 +339,23 @@ int __init omap_display_init(struct omap_dss_board_info 
*board_data)
dss_pdev = pdev;
}
 
+   /* Create devices for DPI and SDI */
+
+   pdev = create_simple_dss_pdev(omapdss_dpi, -1, NULL, 0, dss_pdev);
+   if (IS_ERR(pdev)) {
+   pr_err(Could not build platform_device for omapdss_dpi\n);
+   return PTR_ERR(pdev);
+   }
+
+   if (cpu_is_omap34xx()) {
+   pdev = create_simple_dss_pdev(omapdss_sdi, -1, NULL, 0,
+   dss_pdev);
+   if (IS_ERR(pdev)) {
+   pr_err(Could not build platform_device for 
omapdss_sdi\n);
+   return PTR_ERR(pdev);
+   }
+   }
+
return 0;
 }
 
-- 
1.7.9.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


[PATCH 14/25] OMAPDSS: remove uses of dss_runtime_get/put

2012-05-03 Thread Tomi Valkeinen
Now that the omapdss_core device is the parent for all other dss
devices, we don't need to use the dss_runtime_get/put anymore. Instead,
enabling omapdss_core will happen automatically when a child device is
enabled.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/dispc.c |7 ---
 drivers/video/omap2/dss/dpi.c   |   16 +---
 drivers/video/omap2/dss/dsi.c   |   12 +---
 drivers/video/omap2/dss/dss.c   |7 +--
 drivers/video/omap2/dss/dss.h   |3 ---
 drivers/video/omap2/dss/hdmi.c  |   34 ++
 drivers/video/omap2/dss/rfbi.c  |   12 +---
 drivers/video/omap2/dss/sdi.c   |7 ---
 drivers/video/omap2/dss/venc.c  |   12 +---
 9 files changed, 11 insertions(+), 99 deletions(-)

diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index 68aa566..1cccd4c 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -3596,19 +3596,12 @@ static int omap_dispchw_remove(struct platform_device 
*pdev)
 static int dispc_runtime_suspend(struct device *dev)
 {
dispc_save_context();
-   dss_runtime_put();
 
return 0;
 }
 
 static int dispc_runtime_resume(struct device *dev)
 {
-   int r;
-
-   r = dss_runtime_get();
-   if (r  0)
-   return r;
-
dispc_restore_context();
 
return 0;
diff --git a/drivers/video/omap2/dss/dpi.c b/drivers/video/omap2/dss/dpi.c
index f4398fd..d7a433b 100644
--- a/drivers/video/omap2/dss/dpi.c
+++ b/drivers/video/omap2/dss/dpi.c
@@ -202,10 +202,6 @@ int omapdss_dpi_display_enable(struct omap_dss_device 
*dssdev)
goto err_reg_enable;
}
 
-   r = dss_runtime_get();
-   if (r)
-   goto err_get_dss;
-
r = dispc_runtime_get();
if (r)
goto err_get_dispc;
@@ -244,8 +240,6 @@ err_dsi_pll_init:
 err_get_dsi:
dispc_runtime_put();
 err_get_dispc:
-   dss_runtime_put();
-err_get_dss:
if (cpu_is_omap34xx())
regulator_disable(dpi.vdds_dsi_reg);
 err_reg_enable:
@@ -266,7 +260,6 @@ void omapdss_dpi_display_disable(struct omap_dss_device 
*dssdev)
}
 
dispc_runtime_put();
-   dss_runtime_put();
 
if (cpu_is_omap34xx())
regulator_disable(dpi.vdds_dsi_reg);
@@ -283,21 +276,14 @@ void dpi_set_timings(struct omap_dss_device *dssdev,
DSSDBG(dpi_set_timings\n);
dssdev-panel.timings = *timings;
if (dssdev-state == OMAP_DSS_DISPLAY_ACTIVE) {
-   r = dss_runtime_get();
-   if (r)
-   return;
-
r = dispc_runtime_get();
-   if (r) {
-   dss_runtime_put();
+   if (r)
return;
-   }
 
dpi_set_mode(dssdev);
dispc_mgr_go(dssdev-manager-id);
 
dispc_runtime_put();
-   dss_runtime_put();
}
 }
 EXPORT_SYMBOL(dpi_set_timings);
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index 45ba9e7..c365942 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -4769,7 +4769,6 @@ static int omap_dsihw_remove(struct platform_device 
*dsidev)
 static int dsi_runtime_suspend(struct device *dev)
 {
dispc_runtime_put();
-   dss_runtime_put();
 
return 0;
 }
@@ -4778,20 +4777,11 @@ static int dsi_runtime_resume(struct device *dev)
 {
int r;
 
-   r = dss_runtime_get();
-   if (r)
-   goto err_get_dss;
-
r = dispc_runtime_get();
if (r)
-   goto err_get_dispc;
+   return r;
 
return 0;
-
-err_get_dispc:
-   dss_runtime_put();
-err_get_dss:
-   return r;
 }
 
 static const struct dev_pm_ops dsi_pm_ops = {
diff --git a/drivers/video/omap2/dss/dss.c b/drivers/video/omap2/dss/dss.c
index 17a1927..06fb5dc 100644
--- a/drivers/video/omap2/dss/dss.c
+++ b/drivers/video/omap2/dss/dss.c
@@ -62,6 +62,9 @@ struct dss_reg {
 #define REG_FLD_MOD(idx, val, start, end) \
dss_write_reg(idx, FLD_MOD(dss_read_reg(idx), val, start, end))
 
+static int dss_runtime_get(void);
+static void dss_runtime_put(void);
+
 static struct {
struct platform_device *pdev;
void __iomem*base;
@@ -706,7 +709,7 @@ static void dss_put_clocks(void)
clk_put(dss.dss_clk);
 }
 
-int dss_runtime_get(void)
+static int dss_runtime_get(void)
 {
int r;
 
@@ -717,7 +720,7 @@ int dss_runtime_get(void)
return r  0 ? r : 0;
 }
 
-void dss_runtime_put(void)
+static void dss_runtime_put(void)
 {
int r;
 
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index 4373b15..b53b2e6 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -228,9 +228,6 @@ int dss_ovl_check(struct omap_overlay *ovl,
 int 

[PATCH 13/25] OMAPDSS: create DPI SDI drivers

2012-05-03 Thread Tomi Valkeinen
We currently have separate device/driver for each DSS HW module. The DPI
and SDI outputs are more or less parts of the DSS or DISPC hardware
modules, but in SW it makes sense to represent them as device/driver
pairs similarly to all the other outputs. This also makes sense for
device tree, as each node under dss will be a platform device, and
handling DPI  SDI somehow differently than the rest would just make the
code more complex.

This patch modifies the dpi.c and sdi.c to create drivers for the
platform devices.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/core.c |   18 ++
 drivers/video/omap2/dss/dpi.c  |   23 +--
 drivers/video/omap2/dss/dss.c  |   20 +---
 drivers/video/omap2/dss/dss.h  |   26 --
 drivers/video/omap2/dss/sdi.c  |   25 +++--
 5 files changed, 71 insertions(+), 41 deletions(-)

diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
index db45e6a..77fbd99 100644
--- a/drivers/video/omap2/dss/core.c
+++ b/drivers/video/omap2/dss/core.c
@@ -536,6 +536,18 @@ static int __init omap_dss_register_drivers(void)
goto err_dispc;
}
 
+   r = dpi_init_platform_driver();
+   if (r) {
+   DSSERR(Failed to initialize dpi platform driver\n);
+   goto err_dpi;
+   }
+
+   r = sdi_init_platform_driver();
+   if (r) {
+   DSSERR(Failed to initialize sdi platform driver\n);
+   goto err_sdi;
+   }
+
r = rfbi_init_platform_driver();
if (r) {
DSSERR(Failed to initialize rfbi platform driver\n);
@@ -569,6 +581,10 @@ err_dsi:
 err_venc:
rfbi_uninit_platform_driver();
 err_rfbi:
+   sdi_uninit_platform_driver();
+err_sdi:
+   dpi_uninit_platform_driver();
+err_dpi:
dispc_uninit_platform_driver();
 err_dispc:
dss_uninit_platform_driver();
@@ -584,6 +600,8 @@ static void __exit omap_dss_unregister_drivers(void)
dsi_uninit_platform_driver();
venc_uninit_platform_driver();
rfbi_uninit_platform_driver();
+   sdi_uninit_platform_driver();
+   dpi_uninit_platform_driver();
dispc_uninit_platform_driver();
dss_uninit_platform_driver();
 
diff --git a/drivers/video/omap2/dss/dpi.c b/drivers/video/omap2/dss/dpi.c
index cec1166..f4398fd 100644
--- a/drivers/video/omap2/dss/dpi.c
+++ b/drivers/video/omap2/dss/dpi.c
@@ -378,12 +378,31 @@ int dpi_init_display(struct omap_dss_device *dssdev)
return 0;
 }
 
-int dpi_init(void)
+static int omap_dpi_probe(struct platform_device *pdev)
 {
return 0;
 }
 
-void dpi_exit(void)
+static int omap_dpi_remove(struct platform_device *pdev)
 {
+   return 0;
 }
 
+static struct platform_driver omap_dpi_driver = {
+   .probe  = omap_dpi_probe,
+   .remove = omap_dpi_remove,
+   .driver = {
+   .name   = omapdss_dpi,
+   .owner  = THIS_MODULE,
+   },
+};
+
+int dpi_init_platform_driver(void)
+{
+   return platform_driver_register(omap_dpi_driver);
+}
+
+void dpi_uninit_platform_driver(void)
+{
+   platform_driver_unregister(omap_dpi_driver);
+}
diff --git a/drivers/video/omap2/dss/dss.c b/drivers/video/omap2/dss/dss.c
index 2bdc400..17a1927 100644
--- a/drivers/video/omap2/dss/dss.c
+++ b/drivers/video/omap2/dss/dss.c
@@ -785,18 +785,6 @@ static int omap_dsshw_probe(struct platform_device *pdev)
dss.lcd_clk_source[0] = OMAP_DSS_CLK_SRC_FCK;
dss.lcd_clk_source[1] = OMAP_DSS_CLK_SRC_FCK;
 
-   r = dpi_init();
-   if (r) {
-   DSSERR(Failed to initialize DPI\n);
-   goto err_dpi;
-   }
-
-   r = sdi_init();
-   if (r) {
-   DSSERR(Failed to initialize SDI\n);
-   goto err_sdi;
-   }
-
rev = dss_read_reg(DSS_REVISION);
printk(KERN_INFO OMAP DSS rev %d.%d\n,
FLD_GET(rev, 7, 4), FLD_GET(rev, 3, 0));
@@ -804,10 +792,7 @@ static int omap_dsshw_probe(struct platform_device *pdev)
dss_runtime_put();
 
return 0;
-err_sdi:
-   dpi_exit();
-err_dpi:
-   dss_runtime_put();
+
 err_runtime_get:
pm_runtime_disable(pdev-dev);
dss_put_clocks();
@@ -816,9 +801,6 @@ err_runtime_get:
 
 static int omap_dsshw_remove(struct platform_device *pdev)
 {
-   dpi_exit();
-   sdi_exit();
-
pm_runtime_disable(pdev-dev);
 
dss_put_clocks();
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index bb3079d..4373b15 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -267,17 +267,12 @@ int dss_calc_clock_div(bool is_tft, unsigned long req_pck,
 
 /* SDI */
 #ifdef CONFIG_OMAP2_DSS_SDI
-int sdi_init(void);
-void sdi_exit(void);
+int sdi_init_platform_driver(void);
+void sdi_uninit_platform_driver(void);
 int sdi_init_display(struct 

[PATCH 16/25] OMAPDSS: move the creation of debugfs files

2012-05-03 Thread Tomi Valkeinen
Instead of having an ugly #ifdef mess in the core.c for creating debugfs
files, add a dss_debugfs_create_file() function that the dss drivers
can use to create the debugfs files.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/core.c  |   46 +++
 drivers/video/omap2/dss/dispc.c |7 +-
 drivers/video/omap2/dss/dsi.c   |   42 ++-
 drivers/video/omap2/dss/dss.c   |4 +++-
 drivers/video/omap2/dss/dss.h   |   11 +-
 drivers/video/omap2/dss/hdmi.c  |4 +++-
 drivers/video/omap2/dss/rfbi.c  |4 +++-
 drivers/video/omap2/dss/venc.c  |4 +++-
 8 files changed, 48 insertions(+), 74 deletions(-)

diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
index 2a0cbae..c54bba0 100644
--- a/drivers/video/omap2/dss/core.c
+++ b/drivers/video/omap2/dss/core.c
@@ -166,34 +166,6 @@ static int dss_initialize_debugfs(void)
debugfs_create_file(clk, S_IRUGO, dss_debugfs_dir,
dss_debug_dump_clocks, dss_debug_fops);
 
-#ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS
-   debugfs_create_file(dispc_irq, S_IRUGO, dss_debugfs_dir,
-   dispc_dump_irqs, dss_debug_fops);
-#endif
-
-#if defined(CONFIG_OMAP2_DSS_DSI)  
defined(CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS)
-   dsi_create_debugfs_files_irq(dss_debugfs_dir, dss_debug_fops);
-#endif
-
-   debugfs_create_file(dss, S_IRUGO, dss_debugfs_dir,
-   dss_dump_regs, dss_debug_fops);
-   debugfs_create_file(dispc, S_IRUGO, dss_debugfs_dir,
-   dispc_dump_regs, dss_debug_fops);
-#ifdef CONFIG_OMAP2_DSS_RFBI
-   debugfs_create_file(rfbi, S_IRUGO, dss_debugfs_dir,
-   rfbi_dump_regs, dss_debug_fops);
-#endif
-#ifdef CONFIG_OMAP2_DSS_DSI
-   dsi_create_debugfs_files_reg(dss_debugfs_dir, dss_debug_fops);
-#endif
-#ifdef CONFIG_OMAP2_DSS_VENC
-   debugfs_create_file(venc, S_IRUGO, dss_debugfs_dir,
-   venc_dump_regs, dss_debug_fops);
-#endif
-#ifdef CONFIG_OMAP4_DSS_HDMI
-   debugfs_create_file(hdmi, S_IRUGO, dss_debugfs_dir,
-   hdmi_dump_regs, dss_debug_fops);
-#endif
return 0;
 }
 
@@ -202,6 +174,19 @@ static void dss_uninitialize_debugfs(void)
if (dss_debugfs_dir)
debugfs_remove_recursive(dss_debugfs_dir);
 }
+
+int dss_debugfs_create_file(const char *name, void (*write)(struct seq_file *))
+{
+   struct dentry *d;
+
+   d = debugfs_create_file(name, S_IRUGO, dss_debugfs_dir,
+   write, dss_debug_fops);
+
+   if (IS_ERR(d))
+   return PTR_ERR(d);
+
+   return 0;
+}
 #else /* CONFIG_DEBUG_FS  CONFIG_OMAP2_DSS_DEBUG_SUPPORT */
 static inline int dss_initialize_debugfs(void)
 {
@@ -210,6 +195,11 @@ static inline int dss_initialize_debugfs(void)
 static inline void dss_uninitialize_debugfs(void)
 {
 }
+static inline int dss_debugfs_create_file(const char *name,
+   void (*write)(struct seq_file *))
+{
+   return 0;
+}
 #endif /* CONFIG_DEBUG_FS  CONFIG_OMAP2_DSS_DEBUG_SUPPORT */
 
 /* PLATFORM DEVICE */
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index 1cccd4c..e4b880f 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -2765,7 +2765,7 @@ void dispc_dump_irqs(struct seq_file *s)
 }
 #endif
 
-void dispc_dump_regs(struct seq_file *s)
+static void dispc_dump_regs(struct seq_file *s)
 {
int i, j;
const char *mgr_names[] = {
@@ -3576,6 +3576,11 @@ static int omap_dispchw_probe(struct platform_device 
*pdev)
 
dispc_runtime_put();
 
+   dss_debugfs_create_file(dispc, dispc_dump_regs);
+
+#ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS
+   dss_debugfs_create_file(dispc_irq, dispc_dump_irqs);
+#endif
return 0;
 
 err_runtime_get:
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index c365942..b380231 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -1852,22 +1852,6 @@ static void dsi2_dump_irqs(struct seq_file *s)
 
dsi_dump_dsidev_irqs(dsidev, s);
 }
-
-void dsi_create_debugfs_files_irq(struct dentry *debugfs_dir,
-   const struct file_operations *debug_fops)
-{
-   struct platform_device *dsidev;
-
-   dsidev = dsi_get_dsidev_from_id(0);
-   if (dsidev)
-   debugfs_create_file(dsi1_irqs, S_IRUGO, debugfs_dir,
-   dsi1_dump_irqs, debug_fops);
-
-   dsidev = dsi_get_dsidev_from_id(1);
-   if (dsidev)
-   debugfs_create_file(dsi2_irqs, S_IRUGO, debugfs_dir,
-   dsi2_dump_irqs, debug_fops);
-}
 #endif
 
 static void dsi_dump_dsidev_regs(struct platform_device *dsidev,
@@ -1968,21 +1952,6 @@ static void dsi2_dump_regs(struct seq_file *s)
dsi_dump_dsidev_regs(dsidev, s);
 }
 
-void dsi_create_debugfs_files_reg(struct dentry 

[PATCH 15/25] OMAPDSS: handle output-driver reg/unreg more dynamically

2012-05-03 Thread Tomi Valkeinen
Initialize and uninitialize the output drivers by using arrays of
pointers to the init/uninit functions. This simplifies the code
slightly.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/core.c |  111 +---
 drivers/video/omap2/dss/dss.h  |   41 ---
 2 files changed, 59 insertions(+), 93 deletions(-)

diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
index 77fbd99..2a0cbae 100644
--- a/drivers/video/omap2/dss/core.c
+++ b/drivers/video/omap2/dss/core.c
@@ -515,10 +515,54 @@ static int omap_dss_bus_register(void)
 }
 
 /* INIT */
+static int (*dss_output_drv_reg_funcs[])(void) __initdata = {
+#ifdef CONFIG_OMAP2_DSS_DPI
+   dpi_init_platform_driver,
+#endif
+#ifdef CONFIG_OMAP2_DSS_SDI
+   sdi_init_platform_driver,
+#endif
+#ifdef CONFIG_OMAP2_DSS_RFBI
+   rfbi_init_platform_driver,
+#endif
+#ifdef CONFIG_OMAP2_DSS_VENC
+   venc_init_platform_driver,
+#endif
+#ifdef CONFIG_OMAP2_DSS_DSI
+   dsi_init_platform_driver,
+#endif
+#ifdef CONFIG_OMAP4_DSS_HDMI
+   hdmi_init_platform_driver,
+#endif
+};
+
+static void (*dss_output_drv_unreg_funcs[])(void) __exitdata = {
+#ifdef CONFIG_OMAP2_DSS_DPI
+   dpi_uninit_platform_driver,
+#endif
+#ifdef CONFIG_OMAP2_DSS_SDI
+   sdi_uninit_platform_driver,
+#endif
+#ifdef CONFIG_OMAP2_DSS_RFBI
+   rfbi_uninit_platform_driver,
+#endif
+#ifdef CONFIG_OMAP2_DSS_VENC
+   venc_uninit_platform_driver,
+#endif
+#ifdef CONFIG_OMAP2_DSS_DSI
+   dsi_uninit_platform_driver,
+#endif
+#ifdef CONFIG_OMAP4_DSS_HDMI
+   hdmi_uninit_platform_driver,
+#endif
+};
+
+static bool dss_output_drv_loaded[ARRAY_SIZE(dss_output_drv_reg_funcs)];
 
 static int __init omap_dss_register_drivers(void)
 {
int r;
+   int i;
 
r = platform_driver_probe(omap_dss_driver, omap_dss_probe);
if (r)
@@ -536,56 +580,18 @@ static int __init omap_dss_register_drivers(void)
goto err_dispc;
}
 
-   r = dpi_init_platform_driver();
-   if (r) {
-   DSSERR(Failed to initialize dpi platform driver\n);
-   goto err_dpi;
-   }
-
-   r = sdi_init_platform_driver();
-   if (r) {
-   DSSERR(Failed to initialize sdi platform driver\n);
-   goto err_sdi;
-   }
-
-   r = rfbi_init_platform_driver();
-   if (r) {
-   DSSERR(Failed to initialize rfbi platform driver\n);
-   goto err_rfbi;
-   }
-
-   r = venc_init_platform_driver();
-   if (r) {
-   DSSERR(Failed to initialize venc platform driver\n);
-   goto err_venc;
-   }
-
-   r = dsi_init_platform_driver();
-   if (r) {
-   DSSERR(Failed to initialize DSI platform driver\n);
-   goto err_dsi;
-   }
-
-   r = hdmi_init_platform_driver();
-   if (r) {
-   DSSERR(Failed to initialize hdmi\n);
-   goto err_hdmi;
+   /*
+* It's ok if the output-driver register fails. It happens, for example,
+* when there is no output-device (e.g. SDI for OMAP4).
+*/
+   for (i = 0; i  ARRAY_SIZE(dss_output_drv_reg_funcs); ++i) {
+   r = dss_output_drv_reg_funcs[i]();
+   if (r == 0)
+   dss_output_drv_loaded[i] = true;
}
 
return 0;
 
-err_hdmi:
-   dsi_uninit_platform_driver();
-err_dsi:
-   venc_uninit_platform_driver();
-err_venc:
-   rfbi_uninit_platform_driver();
-err_rfbi:
-   sdi_uninit_platform_driver();
-err_sdi:
-   dpi_uninit_platform_driver();
-err_dpi:
-   dispc_uninit_platform_driver();
 err_dispc:
dss_uninit_platform_driver();
 err_dss:
@@ -596,12 +602,13 @@ err_dss:
 
 static void __exit omap_dss_unregister_drivers(void)
 {
-   hdmi_uninit_platform_driver();
-   dsi_uninit_platform_driver();
-   venc_uninit_platform_driver();
-   rfbi_uninit_platform_driver();
-   sdi_uninit_platform_driver();
-   dpi_uninit_platform_driver();
+   int i;
+
+   for (i = 0; i  ARRAY_SIZE(dss_output_drv_unreg_funcs); ++i) {
+   if (dss_output_drv_loaded[i])
+   dss_output_drv_unreg_funcs[i]();
+   }
+
dispc_uninit_platform_driver();
dss_uninit_platform_driver();
 
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index b53b2e6..57853fd 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -263,14 +263,9 @@ int dss_calc_clock_div(bool is_tft, unsigned long req_pck,
struct dispc_clock_info *dispc_cinfo);
 
 /* SDI */
-#ifdef CONFIG_OMAP2_DSS_SDI
 int sdi_init_platform_driver(void);
 void sdi_uninit_platform_driver(void);
 int sdi_init_display(struct omap_dss_device *display);
-#else
-static inline int sdi_init_platform_driver(void) { return 0; }
-static inline void sdi_uninit_platform_driver(void) { }
-#endif
 
 /* 

[PATCH 17/25] OMAPDSS: use platform_driver_probe for dsi/hdmi/rfbi/venc/dpi/sdi

2012-05-03 Thread Tomi Valkeinen
Now that the core.c doesn't fail if output driver's init fails, we can
change the uses of platform_driver_register to platform_driver_probe.
This will allow us to use __init in the following patches.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/dpi.c  |3 +--
 drivers/video/omap2/dss/dsi.c  |3 +--
 drivers/video/omap2/dss/hdmi.c |3 +--
 drivers/video/omap2/dss/rfbi.c |3 +--
 drivers/video/omap2/dss/sdi.c  |3 +--
 drivers/video/omap2/dss/venc.c |3 +--
 6 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/drivers/video/omap2/dss/dpi.c b/drivers/video/omap2/dss/dpi.c
index d7a433b..5481f7c 100644
--- a/drivers/video/omap2/dss/dpi.c
+++ b/drivers/video/omap2/dss/dpi.c
@@ -375,7 +375,6 @@ static int omap_dpi_remove(struct platform_device *pdev)
 }
 
 static struct platform_driver omap_dpi_driver = {
-   .probe  = omap_dpi_probe,
.remove = omap_dpi_remove,
.driver = {
.name   = omapdss_dpi,
@@ -385,7 +384,7 @@ static struct platform_driver omap_dpi_driver = {
 
 int dpi_init_platform_driver(void)
 {
-   return platform_driver_register(omap_dpi_driver);
+   return platform_driver_probe(omap_dpi_driver, omap_dpi_probe);
 }
 
 void dpi_uninit_platform_driver(void)
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index b380231..eedec80 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -4770,7 +4770,6 @@ static const struct dev_pm_ops dsi_pm_ops = {
 };
 
 static struct platform_driver omap_dsihw_driver = {
-   .probe  = omap_dsihw_probe,
.remove = omap_dsihw_remove,
.driver = {
.name   = omapdss_dsi,
@@ -4781,7 +4780,7 @@ static struct platform_driver omap_dsihw_driver = {
 
 int dsi_init_platform_driver(void)
 {
-   return platform_driver_register(omap_dsihw_driver);
+   return platform_driver_probe(omap_dsihw_driver, omap_dsihw_probe);
 }
 
 void dsi_uninit_platform_driver(void)
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index 614eaed..0e3d099 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -870,7 +870,6 @@ static const struct dev_pm_ops hdmi_pm_ops = {
 };
 
 static struct platform_driver omapdss_hdmihw_driver = {
-   .probe  = omapdss_hdmihw_probe,
.remove = omapdss_hdmihw_remove,
.driver = {
.name   = omapdss_hdmi,
@@ -881,7 +880,7 @@ static struct platform_driver omapdss_hdmihw_driver = {
 
 int hdmi_init_platform_driver(void)
 {
-   return platform_driver_register(omapdss_hdmihw_driver);
+   return platform_driver_probe(omapdss_hdmihw_driver, 
omapdss_hdmihw_probe);
 }
 
 void hdmi_uninit_platform_driver(void)
diff --git a/drivers/video/omap2/dss/rfbi.c b/drivers/video/omap2/dss/rfbi.c
index 6f28955..23b4142 100644
--- a/drivers/video/omap2/dss/rfbi.c
+++ b/drivers/video/omap2/dss/rfbi.c
@@ -1015,7 +1015,6 @@ static const struct dev_pm_ops rfbi_pm_ops = {
 };
 
 static struct platform_driver omap_rfbihw_driver = {
-   .probe  = omap_rfbihw_probe,
.remove = omap_rfbihw_remove,
.driver = {
.name   = omapdss_rfbi,
@@ -1026,7 +1025,7 @@ static struct platform_driver omap_rfbihw_driver = {
 
 int rfbi_init_platform_driver(void)
 {
-   return platform_driver_register(omap_rfbihw_driver);
+   return platform_driver_probe(omap_rfbihw_driver, omap_rfbihw_probe);
 }
 
 void rfbi_uninit_platform_driver(void)
diff --git a/drivers/video/omap2/dss/sdi.c b/drivers/video/omap2/dss/sdi.c
index 90a1955..ff9ad37 100644
--- a/drivers/video/omap2/dss/sdi.c
+++ b/drivers/video/omap2/dss/sdi.c
@@ -187,7 +187,6 @@ static int omap_sdi_remove(struct platform_device *pdev)
 }
 
 static struct platform_driver omap_sdi_driver = {
-   .probe  = omap_sdi_probe,
.remove = omap_sdi_remove,
.driver = {
.name   = omapdss_sdi,
@@ -197,7 +196,7 @@ static struct platform_driver omap_sdi_driver = {
 
 int sdi_init_platform_driver(void)
 {
-   return platform_driver_register(omap_sdi_driver);
+   return platform_driver_probe(omap_sdi_driver, omap_sdi_probe);
 }
 
 void sdi_uninit_platform_driver(void)
diff --git a/drivers/video/omap2/dss/venc.c b/drivers/video/omap2/dss/venc.c
index cb6b571..130263b 100644
--- a/drivers/video/omap2/dss/venc.c
+++ b/drivers/video/omap2/dss/venc.c
@@ -877,7 +877,6 @@ static const struct dev_pm_ops venc_pm_ops = {
 };
 
 static struct platform_driver omap_venchw_driver = {
-   .probe  = omap_venchw_probe,
.remove = omap_venchw_remove,
.driver = {
.name   = omapdss_venc,
@@ -891,7 +890,7 @@ int venc_init_platform_driver(void)
if (cpu_is_omap44xx())
return 0;
 
-   return 

[PATCH 18/25] OMAPDSS: add __init __exit

2012-05-03 Thread Tomi Valkeinen
Now that we are using platform_driver_probe() we can add __inits and
__exits all around.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/core.c  |4 ++--
 drivers/video/omap2/dss/dispc.c |   10 +-
 drivers/video/omap2/dss/dpi.c   |   10 +-
 drivers/video/omap2/dss/dsi.c   |   10 +-
 drivers/video/omap2/dss/dss.c   |8 
 drivers/video/omap2/dss/dss.h   |   30 +++---
 drivers/video/omap2/dss/hdmi.c  |   10 +-
 drivers/video/omap2/dss/rfbi.c  |   10 +-
 drivers/video/omap2/dss/sdi.c   |   10 +-
 drivers/video/omap2/dss/venc.c  |   10 +-
 10 files changed, 56 insertions(+), 56 deletions(-)

diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
index c54bba0..9b84f13 100644
--- a/drivers/video/omap2/dss/core.c
+++ b/drivers/video/omap2/dss/core.c
@@ -203,7 +203,7 @@ static inline int dss_debugfs_create_file(const char *name,
 #endif /* CONFIG_DEBUG_FS  CONFIG_OMAP2_DSS_DEBUG_SUPPORT */
 
 /* PLATFORM DEVICE */
-static int omap_dss_probe(struct platform_device *pdev)
+static int __init omap_dss_probe(struct platform_device *pdev)
 {
struct omap_dss_board_info *pdata = pdev-dev.platform_data;
int r;
@@ -483,7 +483,7 @@ static void omap_dss_unregister_device(struct 
omap_dss_device *dssdev)
 }
 
 /* BUS */
-static int omap_dss_bus_register(void)
+static int __init omap_dss_bus_register(void)
 {
int r;
 
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index e4b880f..0e6fc04 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -3507,7 +3507,7 @@ static void _omap_dispc_initial_config(void)
 }
 
 /* DISPC HW IP initialisation */
-static int omap_dispchw_probe(struct platform_device *pdev)
+static int __init omap_dispchw_probe(struct platform_device *pdev)
 {
u32 rev;
int r = 0;
@@ -3589,7 +3589,7 @@ err_runtime_get:
return r;
 }
 
-static int omap_dispchw_remove(struct platform_device *pdev)
+static int __exit omap_dispchw_remove(struct platform_device *pdev)
 {
pm_runtime_disable(pdev-dev);
 
@@ -3618,7 +3618,7 @@ static const struct dev_pm_ops dispc_pm_ops = {
 };
 
 static struct platform_driver omap_dispchw_driver = {
-   .remove = omap_dispchw_remove,
+   .remove = __exit_p(omap_dispchw_remove),
.driver = {
.name   = omapdss_dispc,
.owner  = THIS_MODULE,
@@ -3626,12 +3626,12 @@ static struct platform_driver omap_dispchw_driver = {
},
 };
 
-int dispc_init_platform_driver(void)
+int __init dispc_init_platform_driver(void)
 {
return platform_driver_probe(omap_dispchw_driver, omap_dispchw_probe);
 }
 
-void dispc_uninit_platform_driver(void)
+void __exit dispc_uninit_platform_driver(void)
 {
platform_driver_unregister(omap_dispchw_driver);
 }
diff --git a/drivers/video/omap2/dss/dpi.c b/drivers/video/omap2/dss/dpi.c
index 5481f7c..f92134c 100644
--- a/drivers/video/omap2/dss/dpi.c
+++ b/drivers/video/omap2/dss/dpi.c
@@ -364,30 +364,30 @@ int dpi_init_display(struct omap_dss_device *dssdev)
return 0;
 }
 
-static int omap_dpi_probe(struct platform_device *pdev)
+static int __init omap_dpi_probe(struct platform_device *pdev)
 {
return 0;
 }
 
-static int omap_dpi_remove(struct platform_device *pdev)
+static int __exit omap_dpi_remove(struct platform_device *pdev)
 {
return 0;
 }
 
 static struct platform_driver omap_dpi_driver = {
-   .remove = omap_dpi_remove,
+   .remove = __exit_p(omap_dpi_remove),
.driver = {
.name   = omapdss_dpi,
.owner  = THIS_MODULE,
},
 };
 
-int dpi_init_platform_driver(void)
+int __init dpi_init_platform_driver(void)
 {
return platform_driver_probe(omap_dpi_driver, omap_dpi_probe);
 }
 
-void dpi_uninit_platform_driver(void)
+void __exit dpi_uninit_platform_driver(void)
 {
platform_driver_unregister(omap_dpi_driver);
 }
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index eedec80..f37e7ee 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -4610,7 +4610,7 @@ static void dsi_put_clocks(struct platform_device *dsidev)
 }
 
 /* DSI1 HW IP initialisation */
-static int omap_dsihw_probe(struct platform_device *dsidev)
+static int __init omap_dsihw_probe(struct platform_device *dsidev)
 {
u32 rev;
int r, i, dsi_module = dsi_get_dsidev_id(dsidev);
@@ -4723,7 +4723,7 @@ err_runtime_get:
return r;
 }
 
-static int omap_dsihw_remove(struct platform_device *dsidev)
+static int __exit omap_dsihw_remove(struct platform_device *dsidev)
 {
struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
 
@@ -4770,7 +4770,7 @@ static const struct dev_pm_ops dsi_pm_ops = {
 };
 
 static struct platform_driver omap_dsihw_driver = {
-   .remove  

[PATCH 19/25] OMAPFB: add __init __exit

2012-05-03 Thread Tomi Valkeinen
Change omapfb to use platform_driver_probe and add __init  __exit.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/omapfb/omapfb-main.c |9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/video/omap2/omapfb/omapfb-main.c 
b/drivers/video/omap2/omapfb/omapfb-main.c
index b00db40..a0967dc 100644
--- a/drivers/video/omap2/omapfb/omapfb-main.c
+++ b/drivers/video/omap2/omapfb/omapfb-main.c
@@ -2307,7 +2307,7 @@ static int omapfb_init_display(struct omapfb2_device 
*fbdev,
return 0;
 }
 
-static int omapfb_probe(struct platform_device *pdev)
+static int __init omapfb_probe(struct platform_device *pdev)
 {
struct omapfb2_device *fbdev = NULL;
int r = 0;
@@ -2448,7 +2448,7 @@ err0:
return r;
 }
 
-static int omapfb_remove(struct platform_device *pdev)
+static int __exit omapfb_remove(struct platform_device *pdev)
 {
struct omapfb2_device *fbdev = platform_get_drvdata(pdev);
 
@@ -2462,8 +2462,7 @@ static int omapfb_remove(struct platform_device *pdev)
 }
 
 static struct platform_driver omapfb_driver = {
-   .probe  = omapfb_probe,
-   .remove = omapfb_remove,
+   .remove = __exit_p(omapfb_remove),
.driver = {
.name   = omapfb,
.owner  = THIS_MODULE,
@@ -2474,7 +2473,7 @@ static int __init omapfb_init(void)
 {
DBG(omapfb_init\n);
 
-   if (platform_driver_register(omapfb_driver)) {
+   if (platform_driver_probe(omapfb_driver, omapfb_probe)) {
printk(KERN_ERR failed to register omapfb driver\n);
return -ENODEV;
}
-- 
1.7.9.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


[PATCH 20/25] OMAPDSS: change default_device handling

2012-05-03 Thread Tomi Valkeinen
We currently have a two ways to set a default panel device for dss, to
which the overlays are connected when the omapdss driver is loaded:

- in textual format (name of the display) as cmdline parameter
- as a pointer to the panel device from board file via pdata

The current code handles this in a bit too complex way by using both of
the above methods during runtime. However, with DT we don't have pdata
anymore, so the code handling the second case won't work anymore. The
current code has also the problem that it modifies the platform_data.

This patch simplifies the code a bit by using the pointer method only
inside the probe function, and stores the name of the panel device. This
way we only need to handle the textual format during operation and also
avoid modifying the platform_data.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/core.c |   14 +-
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
index 9b84f13..c3566a0 100644
--- a/drivers/video/omap2/dss/core.c
+++ b/drivers/video/omap2/dss/core.c
@@ -43,6 +43,8 @@ static struct {
 
struct regulator *vdds_dsi_reg;
struct regulator *vdds_sdi_reg;
+
+   const char *default_display_name;
 } core;
 
 static char *def_disp_name;
@@ -222,6 +224,11 @@ static int __init omap_dss_probe(struct platform_device 
*pdev)
if (r)
goto err_debugfs;
 
+   if (def_disp_name)
+   core.default_display_name = def_disp_name;
+   else if (pdata-default_device)
+   core.default_display_name = pdata-default_device-name;
+
for (i = 0; i  pdata-num_devices; ++i) {
struct omap_dss_device *dssdev = pdata-devices[i];
 
@@ -235,9 +242,6 @@ static int __init omap_dss_probe(struct platform_device 
*pdev)
 
goto err_register;
}
-
-   if (def_disp_name  strcmp(def_disp_name, dssdev-name) == 0)
-   pdata-default_device = dssdev;
}
 
return 0;
@@ -360,7 +364,6 @@ static int dss_driver_probe(struct device *dev)
int r;
struct omap_dss_driver *dssdrv = to_dss_driver(dev-driver);
struct omap_dss_device *dssdev = to_dss_device(dev);
-   struct omap_dss_board_info *pdata = core.pdev-dev.platform_data;
bool force;
 
DSSDBG(driver_probe: dev %s/%s, drv %s\n,
@@ -369,7 +372,8 @@ static int dss_driver_probe(struct device *dev)
 
dss_init_device(core.pdev, dssdev);
 
-   force = pdata-default_device == dssdev;
+   force = core.default_display_name 
+   strcmp(core.default_display_name, dssdev-name) == 0;
dss_recheck_connections(dssdev, force);
 
r = dssdrv-probe(dssdev);
-- 
1.7.9.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


[PATCH 21/25] OMAPDSS: interface drivers register their panel devices

2012-05-03 Thread Tomi Valkeinen
Currently the higher level omapdss platform driver gets the list of
displays in its platform data, and uses that list to create the
omap_dss_device for each display.

With DT, the logical way to do the above is to list the displays under
each individual output, i.e. we'd have dpi node, under which we would
have the display that uses DPI. In other words, each output driver
handles the displays that use that particular output.

To make the current code ready for DT, this patch modifies the output
drivers so that each of them creates the display devices which use that
output. However, instead of changing the platform data to suit this
method, each output driver is passed the full list of displays, and the
drivers pick the displays that are meant for them. This allows us to
keep the old platform data, and thus we avoid the need to change the
board files.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 arch/arm/mach-omap2/display.c  |9 
 drivers/video/omap2/dss/core.c |   46 ++--
 drivers/video/omap2/dss/dpi.c  |   17 +++
 drivers/video/omap2/dss/dsi.c  |   18 
 drivers/video/omap2/dss/dss.h  |5 +
 drivers/video/omap2/dss/hdmi.c |   17 ++-
 drivers/video/omap2/dss/rfbi.c |   16 +-
 drivers/video/omap2/dss/sdi.c  |   17 +++
 drivers/video/omap2/dss/venc.c |   18 +++-
 9 files changed, 126 insertions(+), 37 deletions(-)

diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
index 2c05a60..2c51809 100644
--- a/arch/arm/mach-omap2/display.c
+++ b/arch/arm/mach-omap2/display.c
@@ -325,7 +325,7 @@ int __init omap_display_init(struct omap_dss_board_info 
*board_data)
pdev = create_dss_pdev(curr_dss_hwmod[i].dev_name,
curr_dss_hwmod[i].id,
curr_dss_hwmod[i].oh_name,
-   NULL, 0,
+   board_data, sizeof(*board_data),
dss_pdev);
 
if (IS_ERR(pdev)) {
@@ -341,15 +341,16 @@ int __init omap_display_init(struct omap_dss_board_info 
*board_data)
 
/* Create devices for DPI and SDI */
 
-   pdev = create_simple_dss_pdev(omapdss_dpi, -1, NULL, 0, dss_pdev);
+   pdev = create_simple_dss_pdev(omapdss_dpi, -1,
+   board_data, sizeof(*board_data), dss_pdev);
if (IS_ERR(pdev)) {
pr_err(Could not build platform_device for omapdss_dpi\n);
return PTR_ERR(pdev);
}
 
if (cpu_is_omap34xx()) {
-   pdev = create_simple_dss_pdev(omapdss_sdi, -1, NULL, 0,
-   dss_pdev);
+   pdev = create_simple_dss_pdev(omapdss_sdi, -1,
+   board_data, sizeof(*board_data), dss_pdev);
if (IS_ERR(pdev)) {
pr_err(Could not build platform_device for 
omapdss_sdi\n);
return PTR_ERR(pdev);
diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
index c3566a0..9915e9d 100644
--- a/drivers/video/omap2/dss/core.c
+++ b/drivers/video/omap2/dss/core.c
@@ -56,9 +56,6 @@ bool dss_debug;
 module_param_named(debug, dss_debug, bool, 0644);
 #endif
 
-static int omap_dss_register_device(struct omap_dss_device *);
-static void omap_dss_unregister_device(struct omap_dss_device *);
-
 /* REGULATORS */
 
 struct regulator *dss_get_vdds_dsi(void)
@@ -209,7 +206,6 @@ static int __init omap_dss_probe(struct platform_device 
*pdev)
 {
struct omap_dss_board_info *pdata = pdev-dev.platform_data;
int r;
-   int i;
 
core.pdev = pdev;
 
@@ -229,25 +225,8 @@ static int __init omap_dss_probe(struct platform_device 
*pdev)
else if (pdata-default_device)
core.default_display_name = pdata-default_device-name;
 
-   for (i = 0; i  pdata-num_devices; ++i) {
-   struct omap_dss_device *dssdev = pdata-devices[i];
-
-   r = omap_dss_register_device(dssdev);
-   if (r) {
-   DSSERR(device %d %s register failed %d\n, i,
-   dssdev-name ?: unnamed, r);
-
-   while (--i = 0)
-   omap_dss_unregister_device(pdata-devices[i]);
-
-   goto err_register;
-   }
-   }
-
return 0;
 
-err_register:
-   dss_uninitialize_debugfs();
 err_debugfs:
 
return r;
@@ -255,17 +234,11 @@ err_debugfs:
 
 static int omap_dss_remove(struct platform_device *pdev)
 {
-   struct omap_dss_board_info *pdata = pdev-dev.platform_data;
-   int i;
-
dss_uninitialize_debugfs();
 
dss_uninit_overlays(pdev);
dss_uninit_overlay_managers(pdev);
 
-   for (i = 0; i  pdata-num_devices; ++i)
-   omap_dss_unregister_device(pdata-devices[i]);
-
return 0;
 }

[PATCH 22/25] OMAPDSS: init omap_dss_devices internally

2012-05-03 Thread Tomi Valkeinen
Now that each output driver creates their own display devices, the
output drivers can also initialize those devices.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/display.c |   40 -
 drivers/video/omap2/dss/dpi.c |8 +++-
 drivers/video/omap2/dss/dsi.c |8 +++-
 drivers/video/omap2/dss/dss.h |   10 --
 drivers/video/omap2/dss/hdmi.c|8 +++-
 drivers/video/omap2/dss/rfbi.c|8 +++-
 drivers/video/omap2/dss/sdi.c |8 +++-
 drivers/video/omap2/dss/venc.c|8 +++-
 8 files changed, 42 insertions(+), 56 deletions(-)

diff --git a/drivers/video/omap2/dss/display.c 
b/drivers/video/omap2/dss/display.c
index e688d10..faf7d91 100644
--- a/drivers/video/omap2/dss/display.c
+++ b/drivers/video/omap2/dss/display.c
@@ -359,46 +359,6 @@ void dss_init_device(struct platform_device *pdev,
int i;
int r;
 
-   switch (dssdev-type) {
-#ifdef CONFIG_OMAP2_DSS_DPI
-   case OMAP_DISPLAY_TYPE_DPI:
-   r = dpi_init_display(dssdev);
-   break;
-#endif
-#ifdef CONFIG_OMAP2_DSS_RFBI
-   case OMAP_DISPLAY_TYPE_DBI:
-   r = rfbi_init_display(dssdev);
-   break;
-#endif
-#ifdef CONFIG_OMAP2_DSS_VENC
-   case OMAP_DISPLAY_TYPE_VENC:
-   r = venc_init_display(dssdev);
-   break;
-#endif
-#ifdef CONFIG_OMAP2_DSS_SDI
-   case OMAP_DISPLAY_TYPE_SDI:
-   r = sdi_init_display(dssdev);
-   break;
-#endif
-#ifdef CONFIG_OMAP2_DSS_DSI
-   case OMAP_DISPLAY_TYPE_DSI:
-   r = dsi_init_display(dssdev);
-   break;
-#endif
-   case OMAP_DISPLAY_TYPE_HDMI:
-   r = hdmi_init_display(dssdev);
-   break;
-   default:
-   DSSERR(Support for display '%s' not compiled in.\n,
-   dssdev-name);
-   return;
-   }
-
-   if (r) {
-   DSSERR(failed to init display %s\n, dssdev-name);
-   return;
-   }
-
/* create device sysfs files */
i = 0;
while ((attr = display_sysfs_attrs[i++]) != NULL) {
diff --git a/drivers/video/omap2/dss/dpi.c b/drivers/video/omap2/dss/dpi.c
index 631953b..4f8defe 100644
--- a/drivers/video/omap2/dss/dpi.c
+++ b/drivers/video/omap2/dss/dpi.c
@@ -338,7 +338,7 @@ int dpi_check_timings(struct omap_dss_device *dssdev,
 }
 EXPORT_SYMBOL(dpi_check_timings);
 
-int dpi_init_display(struct omap_dss_device *dssdev)
+static int __init dpi_init_display(struct omap_dss_device *dssdev)
 {
DSSDBG(init_display\n);
 
@@ -375,6 +375,12 @@ static int __init omap_dpi_probe(struct platform_device 
*pdev)
if (dssdev-type != OMAP_DISPLAY_TYPE_DPI)
continue;
 
+   r = dpi_init_display(dssdev);
+   if (r) {
+   DSSERR(device %s init failed: %d\n, dssdev-name, r);
+   continue;
+   }
+
r = omap_dss_register_device(dssdev, pdev-dev);
if (r)
DSSERR(device %s register failed: %d\n,
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index 0ff1e63..49b83a4 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -4456,7 +4456,7 @@ int omapdss_dsi_enable_te(struct omap_dss_device *dssdev, 
bool enable)
 }
 EXPORT_SYMBOL(omapdss_dsi_enable_te);
 
-int dsi_init_display(struct omap_dss_device *dssdev)
+static int __init dsi_init_display(struct omap_dss_device *dssdev)
 {
struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev);
struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
@@ -4712,6 +4712,12 @@ static int __init omap_dsihw_probe(struct 
platform_device *dsidev)
if (dssdev-phy.dsi.module != dsi_module)
continue;
 
+   r = dsi_init_display(dssdev);
+   if (r) {
+   DSSERR(device %s init failed: %d\n, dssdev-name, r);
+   continue;
+   }
+
r = omap_dss_register_device(dssdev, dsidev-dev);
if (r)
DSSERR(device %s register failed: %d\n,
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index 828f669..c0a1532 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -270,7 +270,6 @@ int dss_calc_clock_div(bool is_tft, unsigned long req_pck,
 /* SDI */
 int sdi_init_platform_driver(void) __init;
 void sdi_uninit_platform_driver(void) __exit;
-int sdi_init_display(struct omap_dss_device *display);
 
 /* DSI */
 #ifdef CONFIG_OMAP2_DSS_DSI
@@ -286,7 +285,6 @@ void dsi_runtime_put(struct platform_device *dsidev);
 
 void dsi_dump_clocks(struct seq_file *s);
 
-int dsi_init_display(struct omap_dss_device *display);
 void dsi_irq_handler(void);
 u8 

[PATCH 24/25] OMAPDSS: DSI: improve DSI module id handling

2012-05-03 Thread Tomi Valkeinen
We currently use the id of the dsi platform device (dsidev-id) as the
DSI hardware module ID. This works because we assign the ID manually in
arch/arm/mach-omap2/display.c at boot time.

However, with device tree the platform device IDs are automatically
assigned to an arbitrary number, and we can't use it.

Instead of using dsidev-id during operation, this patch stores the
value of dsidev-id to a private field of the dsi driver at probe(). The
future device tree code can thus set the private field with some other
way.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/dsi.c |   46 +++--
 1 file changed, 21 insertions(+), 25 deletions(-)

diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index 6cc92a8..ce964dd 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -256,6 +256,8 @@ struct dsi_data {
struct platform_device *pdev;
void __iomem*base;
 
+   int module_id;
+
int irq;
 
struct clk *dss_clk;
@@ -358,11 +360,6 @@ struct platform_device *dsi_get_dsidev_from_id(int module)
return dsi_pdev_map[module];
 }
 
-static inline int dsi_get_dsidev_id(struct platform_device *dsidev)
-{
-   return dsidev-id;
-}
-
 static inline void dsi_write_reg(struct platform_device *dsidev,
const struct dsi_reg idx, u32 val)
 {
@@ -1181,10 +1178,9 @@ static unsigned long dsi_get_txbyteclkhs(struct 
platform_device *dsidev)
 static unsigned long dsi_fclk_rate(struct platform_device *dsidev)
 {
unsigned long r;
-   int dsi_module = dsi_get_dsidev_id(dsidev);
struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
 
-   if (dss_get_dsi_clk_source(dsi_module) == OMAP_DSS_CLK_SRC_FCK) {
+   if (dss_get_dsi_clk_source(dsi-module_id) == OMAP_DSS_CLK_SRC_FCK) {
/* DSI FCLK source is DSS_CLK_FCK */
r = clk_get_rate(dsi-dss_clk);
} else {
@@ -1683,7 +1679,7 @@ static void dsi_dump_dsidev_clocks(struct platform_device 
*dsidev,
struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
struct dsi_clock_info *cinfo = dsi-current_cinfo;
enum omap_dss_clk_source dispc_clk_src, dsi_clk_src;
-   int dsi_module = dsi_get_dsidev_id(dsidev);
+   int dsi_module = dsi-module_id;
 
dispc_clk_src = dss_get_dispc_clk_source();
dsi_clk_src = dss_get_dsi_clk_source(dsi_module);
@@ -1755,7 +1751,6 @@ static void dsi_dump_dsidev_irqs(struct platform_device 
*dsidev,
struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
unsigned long flags;
struct dsi_irq_stats stats;
-   int dsi_module = dsi_get_dsidev_id(dsidev);
 
spin_lock_irqsave(dsi-irq_stats_lock, flags);
 
@@ -1772,7 +1767,7 @@ static void dsi_dump_dsidev_irqs(struct platform_device 
*dsidev,
 #define PIS(x) \
seq_printf(s, %-20s %10d\n, #x, stats.dsi_irqs[ffs(DSI_IRQ_##x)-1]);
 
-   seq_printf(s, -- DSI%d interrupts --\n, dsi_module + 1);
+   seq_printf(s, -- DSI%d interrupts --\n, dsi-module_id + 1);
PIS(VC0);
PIS(VC1);
PIS(VC2);
@@ -2272,7 +2267,7 @@ static int dsi_cio_init(struct omap_dss_device *dssdev)
 
DSSDBGF();
 
-   r = dss_dsi_enable_pads(dsi_get_dsidev_id(dsidev), 
dsi_get_lane_mask(dssdev));
+   r = dss_dsi_enable_pads(dsi-module_id, dsi_get_lane_mask(dssdev));
if (r)
return r;
 
@@ -2382,20 +2377,21 @@ err_cio_pwr:
dsi_cio_disable_lane_override(dsidev);
 err_scp_clk_dom:
dsi_disable_scp_clk(dsidev);
-   dss_dsi_disable_pads(dsi_get_dsidev_id(dsidev), 
dsi_get_lane_mask(dssdev));
+   dss_dsi_disable_pads(dsi-module_id, dsi_get_lane_mask(dssdev));
return r;
 }
 
 static void dsi_cio_uninit(struct omap_dss_device *dssdev)
 {
struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev);
+   struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
 
/* DDR_CLK_ALWAYS_ON */
REG_FLD_MOD(dsidev, DSI_CLK_CTRL, 0, 13, 13);
 
dsi_cio_power(dsidev, DSI_COMPLEXIO_POWER_OFF);
dsi_disable_scp_clk(dsidev);
-   dss_dsi_disable_pads(dsi_get_dsidev_id(dsidev), 
dsi_get_lane_mask(dssdev));
+   dss_dsi_disable_pads(dsi-module_id, dsi_get_lane_mask(dssdev));
 }
 
 static void dsi_config_tx_fifo(struct platform_device *dsidev,
@@ -4277,7 +4273,7 @@ static int dsi_configure_dispc_clocks(struct 
omap_dss_device *dssdev)
 static int dsi_display_init_dsi(struct omap_dss_device *dssdev)
 {
struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev);
-   int dsi_module = dsi_get_dsidev_id(dsidev);
+   struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
int r;
 
r = dsi_pll_init(dsidev, true, true);
@@ -4289,7 +4285,7 @@ static int dsi_display_init_dsi(struct omap_dss_device 
*dssdev)
goto err1;
 

[PATCH 23/25] OMAPDSS: DSI: implement generic DSI pin config

2012-05-03 Thread Tomi Valkeinen
In preparation for device tree, this patch changes how the DSI pins are
configured. The current configuration method is only doable with board
files and the configuration data is OMAP specific.

This patch moves the configuration data to the panel's platform data,
and the data can easily be given via DT in the future. The configuration
data format is also changed to a generic one which should be suitable
for all platforms.

The new format is an array of pin numbers, where the array items start
from clock + and -, then data1 + and -, and so on. For example:

{
0,  // pin num for clock lane +
1,  // pin num for clock lane -
2,  // pin num for data1 lane +
3,  // pin num for data1 lane -
...
}

The pin numbers are translated by the DSI driver and used to configure
the hardware appropriately.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 arch/arm/mach-omap2/board-4430sdp.c   |   21 ++---
 drivers/video/omap2/displays/panel-taal.c |7 ++
 drivers/video/omap2/dss/dsi.c |  133 +++--
 include/video/omap-panel-nokia-dsi.h  |3 +
 include/video/omapdss.h   |   28 +++---
 5 files changed, 103 insertions(+), 89 deletions(-)

diff --git a/arch/arm/mach-omap2/board-4430sdp.c 
b/arch/arm/mach-omap2/board-4430sdp.c
index 6cbb16f..b4ad706 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -666,6 +666,10 @@ static struct nokia_dsi_panel_data dsi1_panel = {
.use_ext_te = false,
.ext_te_gpio= 101,
.esd_interval   = 0,
+   .pin_config = {
+   .num_pins   = 6,
+   .pins   = { 0, 1, 2, 3, 4, 5 },
+   },
 };
 
 static struct omap_dss_device sdp4430_lcd_device = {
@@ -674,13 +678,6 @@ static struct omap_dss_device sdp4430_lcd_device = {
.type   = OMAP_DISPLAY_TYPE_DSI,
.data   = dsi1_panel,
.phy.dsi= {
-   .clk_lane   = 1,
-   .clk_pol= 0,
-   .data1_lane = 2,
-   .data1_pol  = 0,
-   .data2_lane = 3,
-   .data2_pol  = 0,
-
.module = 0,
},
 
@@ -715,6 +712,10 @@ static struct nokia_dsi_panel_data dsi2_panel = {
.use_ext_te = false,
.ext_te_gpio= 103,
.esd_interval   = 0,
+   .pin_config = {
+   .num_pins   = 6,
+   .pins   = { 0, 1, 2, 3, 4, 5 },
+   },
 };
 
 static struct omap_dss_device sdp4430_lcd2_device = {
@@ -723,12 +724,6 @@ static struct omap_dss_device sdp4430_lcd2_device = {
.type   = OMAP_DISPLAY_TYPE_DSI,
.data   = dsi2_panel,
.phy.dsi= {
-   .clk_lane   = 1,
-   .clk_pol= 0,
-   .data1_lane = 2,
-   .data1_pol  = 0,
-   .data2_lane = 3,
-   .data2_pol  = 0,
 
.module = 1,
},
diff --git a/drivers/video/omap2/displays/panel-taal.c 
b/drivers/video/omap2/displays/panel-taal.c
index be9992f..2ce9992 100644
--- a/drivers/video/omap2/displays/panel-taal.c
+++ b/drivers/video/omap2/displays/panel-taal.c
@@ -1051,9 +1051,16 @@ static void __exit taal_remove(struct omap_dss_device 
*dssdev)
 static int taal_power_on(struct omap_dss_device *dssdev)
 {
struct taal_data *td = dev_get_drvdata(dssdev-dev);
+   struct nokia_dsi_panel_data *panel_data = get_panel_data(dssdev);
u8 id1, id2, id3;
int r;
 
+   r = omapdss_dsi_configure_pins(dssdev, panel_data-pin_config);
+   if (r) {
+   dev_err(dssdev-dev, failed to configure DSI pins\n);
+   goto err0;
+   };
+
r = omapdss_dsi_display_enable(dssdev);
if (r) {
dev_err(dssdev-dev, failed to enable DSI\n);
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index 49b83a4..6cc92a8 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -2011,65 +2011,6 @@ static unsigned dsi_get_line_buf_size(struct 
platform_device *dsidev)
}
 }
 
-static int dsi_parse_lane_config(struct omap_dss_device *dssdev)
-{
-   struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev);
-   struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
-   u8 lanes[DSI_MAX_NR_LANES];
-   u8 polarities[DSI_MAX_NR_LANES];
-   int num_lanes, i;
-
-   static const enum dsi_lane_function functions[] = {
-   DSI_LANE_CLK,
-   DSI_LANE_DATA1,
-   DSI_LANE_DATA2,
-   DSI_LANE_DATA3,
-   DSI_LANE_DATA4,
-   };
-
-   lanes[0] = 

[PATCH 25/25] OMAPDSS: separate pdata based initialization

2012-05-03 Thread Tomi Valkeinen
Move the platform-data based display device initialization into a
separate function, so that we may later add of-based initialization.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/dpi.c  |7 +-
 drivers/video/omap2/dss/dsi.c  |   50 +++-
 drivers/video/omap2/dss/hdmi.c |   46 +---
 drivers/video/omap2/dss/rfbi.c |   45 +---
 drivers/video/omap2/dss/sdi.c  |7 +-
 drivers/video/omap2/dss/venc.c |   45 +---
 6 files changed, 120 insertions(+), 80 deletions(-)

diff --git a/drivers/video/omap2/dss/dpi.c b/drivers/video/omap2/dss/dpi.c
index 4f8defe..835e106 100644
--- a/drivers/video/omap2/dss/dpi.c
+++ b/drivers/video/omap2/dss/dpi.c
@@ -364,7 +364,7 @@ static int __init dpi_init_display(struct omap_dss_device 
*dssdev)
return 0;
 }
 
-static int __init omap_dpi_probe(struct platform_device *pdev)
+static void __init dpi_probe_pdata(struct platform_device *pdev)
 {
struct omap_dss_board_info *pdata = pdev-dev.platform_data;
int i, r;
@@ -386,6 +386,11 @@ static int __init omap_dpi_probe(struct platform_device 
*pdev)
DSSERR(device %s register failed: %d\n,
dssdev-name, r);
}
+}
+
+static int __init omap_dpi_probe(struct platform_device *pdev)
+{
+   dpi_probe_pdata(pdev);
 
return 0;
 }
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index ce964dd..429d918 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -4607,6 +4607,34 @@ static void dsi_put_clocks(struct platform_device 
*dsidev)
clk_put(dsi-sys_clk);
 }
 
+static void __init dsi_probe_pdata(struct platform_device *dsidev)
+{
+   struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
+   struct omap_dss_board_info *pdata = dsidev-dev.platform_data;
+   int i, r;
+
+   for (i = 0; i  pdata-num_devices; ++i) {
+   struct omap_dss_device *dssdev = pdata-devices[i];
+
+   if (dssdev-type != OMAP_DISPLAY_TYPE_DSI)
+   continue;
+
+   if (dssdev-phy.dsi.module != dsi-module_id)
+   continue;
+
+   r = dsi_init_display(dssdev);
+   if (r) {
+   DSSERR(device %s init failed: %d\n, dssdev-name, r);
+   continue;
+   }
+
+   r = omap_dss_register_device(dssdev, dsidev-dev);
+   if (r)
+   DSSERR(device %s register failed: %d\n,
+   dssdev-name, r);
+   }
+}
+
 /* DSI1 HW IP initialisation */
 static int __init omap_dsihw_probe(struct platform_device *dsidev)
 {
@@ -4614,7 +4642,6 @@ static int __init omap_dsihw_probe(struct platform_device 
*dsidev)
int r, i;
struct resource *dsi_mem;
struct dsi_data *dsi;
-   struct omap_dss_board_info *pdata = dsidev-dev.platform_data;
 
dsi = devm_kzalloc(dsidev-dev, sizeof(*dsi), GFP_KERNEL);
if (!dsi)
@@ -4702,26 +4729,7 @@ static int __init omap_dsihw_probe(struct 
platform_device *dsidev)
else
dsi-num_lanes_supported = 3;
 
-   for (i = 0; i  pdata-num_devices; ++i) {
-   struct omap_dss_device *dssdev = pdata-devices[i];
-
-   if (dssdev-type != OMAP_DISPLAY_TYPE_DSI)
-   continue;
-
-   if (dssdev-phy.dsi.module != dsi-module_id)
-   continue;
-
-   r = dsi_init_display(dssdev);
-   if (r) {
-   DSSERR(device %s init failed: %d\n, dssdev-name, r);
-   continue;
-   }
-
-   r = omap_dss_register_device(dssdev, dsidev-dev);
-   if (r)
-   DSSERR(device %s register failed: %d\n,
-   dssdev-name, r);
-   }
+   dsi_probe_pdata(dsidev);
 
dsi_runtime_put(dsidev);
 
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index 8b3ac6e..1b06df2 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -769,12 +769,36 @@ static void hdmi_put_clocks(void)
clk_put(hdmi.sys_clk);
 }
 
+static void __init hdmi_probe_pdata(struct platform_device *pdev)
+{
+   struct omap_dss_board_info *pdata = pdev-dev.platform_data;
+   int r, i;
+
+   for (i = 0; i  pdata-num_devices; ++i) {
+   struct omap_dss_device *dssdev = pdata-devices[i];
+   struct omap_dss_hdmi_data *priv = dssdev-data;
+
+   if (dssdev-type != OMAP_DISPLAY_TYPE_HDMI)
+   continue;
+
+   r = hdmi_init_display(dssdev);
+   if (r) {
+   DSSERR(device %s init failed: %d\n, dssdev-name, r);
+ 

[PATCH 03/25] OMAPDSS: TFP410: rename dvi - tfp410

2012-05-03 Thread Tomi Valkeinen
The driver for the TFP410 DPI-to-DVI chip was named quite badly as DVI
panel driver. This patch renames the code to use tfp410 name for the
driver.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 arch/arm/mach-omap2/board-3430sdp.c  |4 +-
 arch/arm/mach-omap2/board-am3517evm.c|4 +-
 arch/arm/mach-omap2/board-cm-t35.c   |4 +-
 arch/arm/mach-omap2/board-devkit8000.c   |4 +-
 arch/arm/mach-omap2/board-igep0020.c |4 +-
 arch/arm/mach-omap2/board-omap3beagle.c  |4 +-
 arch/arm/mach-omap2/board-omap3evm.c |4 +-
 arch/arm/mach-omap2/board-omap3stalker.c |4 +-
 arch/arm/mach-omap2/board-omap4panda.c   |4 +-
 arch/arm/mach-omap2/board-overo.c|4 +-
 drivers/video/omap2/displays/Kconfig |8 +--
 drivers/video/omap2/displays/Makefile|2 +-
 drivers/video/omap2/displays/panel-dvi.c |   94 +++---
 include/video/omap-panel-dvi.h   |   12 ++--
 14 files changed, 78 insertions(+), 78 deletions(-)

diff --git a/arch/arm/mach-omap2/board-3430sdp.c 
b/arch/arm/mach-omap2/board-3430sdp.c
index d827f8b..2a26d62 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -157,14 +157,14 @@ static struct omap_dss_device sdp3430_lcd_device = {
.platform_disable   = sdp3430_panel_disable_lcd,
 };
 
-static struct panel_dvi_platform_data dvi_panel = {
+static struct tfp410_platform_data dvi_panel = {
.power_down_gpio= -1,
 };
 
 static struct omap_dss_device sdp3430_dvi_device = {
.name   = dvi,
.type   = OMAP_DISPLAY_TYPE_DPI,
-   .driver_name= dvi,
+   .driver_name= tfp410,
.data   = dvi_panel,
.phy.dpi.data_lines = 24,
 };
diff --git a/arch/arm/mach-omap2/board-am3517evm.c 
b/arch/arm/mach-omap2/board-am3517evm.c
index ce155bf..feecc96 100644
--- a/arch/arm/mach-omap2/board-am3517evm.c
+++ b/arch/arm/mach-omap2/board-am3517evm.c
@@ -207,14 +207,14 @@ static struct omap_dss_device am3517_evm_tv_device = {
.platform_disable   = am3517_evm_panel_disable_tv,
 };
 
-static struct panel_dvi_platform_data dvi_panel = {
+static struct tfp410_platform_data dvi_panel = {
.power_down_gpio= -1,
 };
 
 static struct omap_dss_device am3517_evm_dvi_device = {
.type   = OMAP_DISPLAY_TYPE_DPI,
.name   = dvi,
-   .driver_name= dvi,
+   .driver_name= tfp410,
.data   = dvi_panel,
.phy.dpi.data_lines = 24,
 };
diff --git a/arch/arm/mach-omap2/board-cm-t35.c 
b/arch/arm/mach-omap2/board-cm-t35.c
index 6f79026..9e8efe9 100644
--- a/arch/arm/mach-omap2/board-cm-t35.c
+++ b/arch/arm/mach-omap2/board-cm-t35.c
@@ -241,14 +241,14 @@ static struct omap_dss_device cm_t35_lcd_device = {
.phy.dpi.data_lines = 18,
 };
 
-static struct panel_dvi_platform_data dvi_panel = {
+static struct tfp410_platform_data dvi_panel = {
.power_down_gpio= CM_T35_DVI_EN_GPIO,
 };
 
 static struct omap_dss_device cm_t35_dvi_device = {
.name   = dvi,
.type   = OMAP_DISPLAY_TYPE_DPI,
-   .driver_name= dvi,
+   .driver_name= tfp410,
.data   = dvi_panel,
.phy.dpi.data_lines = 24,
 };
diff --git a/arch/arm/mach-omap2/board-devkit8000.c 
b/arch/arm/mach-omap2/board-devkit8000.c
index 92f79de..5ea88f5 100644
--- a/arch/arm/mach-omap2/board-devkit8000.c
+++ b/arch/arm/mach-omap2/board-devkit8000.c
@@ -141,14 +141,14 @@ static struct omap_dss_device devkit8000_lcd_device = {
.phy.dpi.data_lines = 24,
 };
 
-static struct panel_dvi_platform_data dvi_panel = {
+static struct tfp410_platform_data dvi_panel = {
.power_down_gpio= -1,
 };
 
 static struct omap_dss_device devkit8000_dvi_device = {
.name   = dvi,
.type   = OMAP_DISPLAY_TYPE_DPI,
-   .driver_name= dvi,
+   .driver_name= tfp410,
.data   = dvi_panel,
.phy.dpi.data_lines = 24,
 };
diff --git a/arch/arm/mach-omap2/board-igep0020.c 
b/arch/arm/mach-omap2/board-igep0020.c
index c702822..bf87f17 100644
--- a/arch/arm/mach-omap2/board-igep0020.c
+++ b/arch/arm/mach-omap2/board-igep0020.c
@@ -444,7 +444,7 @@ static struct twl4030_gpio_platform_data 
igep_twl4030_gpio_pdata = {
.setup  = igep_twl_gpio_setup,
 };
 
-static struct panel_dvi_platform_data dvi_panel = {
+static struct tfp410_platform_data dvi_panel = {
.i2c_bus_num= 3,
.power_down_gpio= IGEP2_GPIO_DVI_PUP,
 };
@@ -452,7 +452,7 @@ static struct panel_dvi_platform_data dvi_panel = {
 static struct omap_dss_device igep2_dvi_device = {
.type   = OMAP_DISPLAY_TYPE_DPI,
.name   

[PATCH 06/25] OMAPDSS: DSI: use dsi_get_dsidev_id(dsidev) instead of dsidev-id

2012-05-03 Thread Tomi Valkeinen
The DSI driver uses dsi_get_dsidev_id() to get the ID number for the DSI
instance. However, there were a few places where dsidev-id was used
instead of the function. Fix those places to use the function.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/dsi.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index b6cf03c..f6ecc3a 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -2365,7 +2365,7 @@ static int dsi_cio_init(struct omap_dss_device *dssdev)
 
DSSDBGF();
 
-   r = dsi-enable_pads(dsidev-id, dsi_get_lane_mask(dssdev));
+   r = dsi-enable_pads(dsi_get_dsidev_id(dsidev), 
dsi_get_lane_mask(dssdev));
if (r)
return r;
 
@@ -2475,7 +2475,7 @@ err_cio_pwr:
dsi_cio_disable_lane_override(dsidev);
 err_scp_clk_dom:
dsi_disable_scp_clk(dsidev);
-   dsi-disable_pads(dsidev-id, dsi_get_lane_mask(dssdev));
+   dsi-disable_pads(dsi_get_dsidev_id(dsidev), dsi_get_lane_mask(dssdev));
return r;
 }
 
@@ -2489,7 +2489,7 @@ static void dsi_cio_uninit(struct omap_dss_device *dssdev)
 
dsi_cio_power(dsidev, DSI_COMPLEXIO_POWER_OFF);
dsi_disable_scp_clk(dsidev);
-   dsi-disable_pads(dsidev-id, dsi_get_lane_mask(dssdev));
+   dsi-disable_pads(dsi_get_dsidev_id(dsidev), dsi_get_lane_mask(dssdev));
 }
 
 static void dsi_config_tx_fifo(struct platform_device *dsidev,
-- 
1.7.9.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


Re: [PATCH] net: davinci_emac: Add pre_open, post_stop platform callbacks

2012-05-03 Thread Kevin Hilman
Bedia, Vaibhav vaibhav.be...@ti.com writes:

 On Thu, May 03, 2012 at 05:17:18, Mark A. Greer wrote:
 From: Mark A. Greer mgr...@animalcreek.com
 
 The davinci EMAC driver has been incorporated into the am35x
 family of SoC's which is OMAP-based.  The incorporation is
 incomplete in that the EMAC cannot unblock the [ARM] core if
 its blocked on a 'wfi' instruction.  This is an issue with
 the cpu_idle code because it has the core execute a 'wfi'
 instruction.
 
 To work around this issue, add platform data callbacks which
 are called at the beginning of the open routine and at the
 end of the stop routine of the davinci_emac driver.  The
 callbacks allow the platform code to issue disable_hlt() and
 enable_hlt() calls appropriately.  Calling disable_hlt()
 prevents cpu_idle from issuing the 'wfi' instruction.
 
 It is not sufficient to simply call disable_hlt() when
 there is an EMAC present because it could be present but
 not actually used in which case, we do want the 'wfi' to
 be executed.
 

 Are you trying to say that if ARM executes _just_ wfi and _absolutely
 nothing else_ is done in the OMAP PM code, EMAC stops working?

 However, if this is indeed the case, then probably a better solution would be
 to invoke disable_hlt() from the board file when EMAC support is compiled in.

No.  As Mark stated in the changelog, doing that will prevent any
low-power states states even if the EMAC is not in use.  IMO, it is best
to only prevent WFI when absolutely needed.

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


[PATCH v2 15/16] mmc: Update preempted request with CORRECTLY_PRG_SECTORS_NUM info

2012-05-03 Thread Venkatraman S
Ongoing request that was preempted during 'programming' state is partially
completed. Number of correctly programmed sectors is available in the
ext_csd field CORRECTLY_PRG_SECTORS_NUM. Read this field to update
the bytes_xfered field of the request

Signed-off-by: Venkatraman S svenk...@ti.com
---
 drivers/mmc/core/core.c |   26 --
 include/linux/mmc/mmc.h |4 
 2 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index e6430f8..354dd7a 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -122,6 +122,23 @@ static inline void mmc_should_fail_request(struct mmc_host 
*host,
 
 #endif /* CONFIG_FAIL_MMC_REQUEST */
 
+static int mmc_get_programmed_sectors(struct mmc_card *card, int *nsectors)
+{
+   int err;
+   u8 ext_csd[512];
+
+   mmc_claim_host(card-host);
+   err = mmc_send_ext_csd(card, ext_csd);
+   mmc_release_host(card-host);
+   if (err)
+   return err;
+   *nsectors = ext_csd[EXT_CSD_C_PRG_SECTORS_NUM0] +
+   (ext_csd[EXT_CSD_C_PRG_SECTORS_NUM1]  7) +
+   (ext_csd[EXT_CSD_C_PRG_SECTORS_NUM2]  15) +
+   (ext_csd[EXT_CSD_C_PRG_SECTORS_NUM3]  23);
+
+   return 0;
+}
 /**
  * mmc_request_done - finish processing an MMC request
  * @host: MMC host which completed request
@@ -470,6 +487,7 @@ int mmc_preempt_foreground_request(struct mmc_card *card,
struct mmc_request *req)
 {
int ret;
+   int nsectors;
 
ret = mmc_abort_req(card-host, req);
if (ret == -ENOSYS)
@@ -490,8 +508,12 @@ int mmc_preempt_foreground_request(struct mmc_card *card,
 */
if (req-data  req-data-error) {
mmc_interrupt_hpi(card);
-   /* TODO : Take out the CORRECTLY_PRG_SECTORS_NUM
-* from ext_csd and add it to the request */
+
+   ret = mmc_get_programmed_sectors(card, nsectors);
+   if (ret)
+   req-data-bytes_xfered = 0;
+   else
+   req-data-bytes_xfered = nsectors * 512;
}
 
return 0;
diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h
index ec2f195..4a3453f 100644
--- a/include/linux/mmc/mmc.h
+++ b/include/linux/mmc/mmc.h
@@ -315,6 +315,10 @@ struct _mmc_csd {
 #define EXT_CSD_PWR_CL_200_360 237 /* RO */
 #define EXT_CSD_PWR_CL_DDR_52_195  238 /* RO */
 #define EXT_CSD_PWR_CL_DDR_52_360  239 /* RO */
+#define EXT_CSD_C_PRG_SECTORS_NUM0 242 /* RO */
+#define EXT_CSD_C_PRG_SECTORS_NUM1 243 /* RO */
+#define EXT_CSD_C_PRG_SECTORS_NUM2 244 /* RO */
+#define EXT_CSD_C_PRG_SECTORS_NUM3 245 /* RO */
 #define EXT_CSD_POWER_OFF_LONG_TIME247 /* RO */
 #define EXT_CSD_GENERIC_CMD6_TIME  248 /* RO */
 #define EXT_CSD_CACHE_SIZE 249 /* RO, 4 bytes */
-- 
1.7.10.rc2

--
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 16/16] mmc: omap_hsmmc: Implement abort_req host_ops

2012-05-03 Thread Venkatraman S
Provide the abort_req implementation for omap_hsmmc host.

When invoked, the host controller should stop the transfer
and end the ongoing request as early as possible.

If the aborted command is a data transfer command, dma setup is
aborted and a STOP command is issued. The transfer state is
marked as an error (except when the command has almost completed
while receiving the abort request, in which case finish the command
normally).

Signed-off-by: Venkatraman S svenk...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c |   55 ++---
 1 file changed, 51 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index d15b149..a4da478 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -177,6 +177,7 @@ struct omap_hsmmc_host {
int reqs_blocked;
int use_reg;
int req_in_progress;
+   int abort_in_progress;
unsigned intflags;
struct omap_hsmmc_next  next_data;
 
@@ -982,6 +983,7 @@ static inline void omap_hsmmc_reset_controller_fsm(struct 
omap_hsmmc_host *host,
 static void omap_hsmmc_do_irq(struct omap_hsmmc_host *host, int status)
 {
struct mmc_data *data;
+   int err = 0;
int end_cmd = 0, end_trans = 0;
 
if (!host-req_in_progress) {
@@ -993,6 +995,11 @@ static void omap_hsmmc_do_irq(struct omap_hsmmc_host 
*host, int status)
return;
}
 
+   if (host-abort_in_progress) {
+   end_trans = 1;
+   end_cmd = 1;
+   }
+
data = host-data;
dev_dbg(mmc_dev(host-mmc), IRQ Status is %x\n, status);
 
@@ -1021,7 +1028,7 @@ static void omap_hsmmc_do_irq(struct omap_hsmmc_host 
*host, int status)
if ((status  DATA_TIMEOUT) ||
(status  DATA_CRC)) {
if (host-data || host-response_busy) {
-   int err = (status  DATA_TIMEOUT) ?
+   err = (status  DATA_TIMEOUT) ?
-ETIMEDOUT : -EILSEQ;
 
if (host-data)
@@ -1045,10 +1052,13 @@ static void omap_hsmmc_do_irq(struct omap_hsmmc_host 
*host, int status)
 
OMAP_HSMMC_WRITE(host-base, STAT, status);
 
-   if (end_cmd || ((status  CC)  host-cmd))
+   if ((end_cmd || (status  CC))  host-cmd)
omap_hsmmc_cmd_done(host, host-cmd);
-   if ((end_trans || (status  TC))  host-mrq)
+   if ((end_trans || (status  TC))  host-mrq) {
+   if (data)
+   data-error = err;
omap_hsmmc_xfer_done(host, data);
+   }
 }
 
 /*
@@ -1257,7 +1267,7 @@ static void omap_hsmmc_dma_cb(int lch, u16 ch_status, 
void *cb_data)
}
 
spin_lock_irqsave(host-irq_lock, flags);
-   if (host-dma_ch  0) {
+   if (host-dma_ch  0 || host-abort_in_progress) {
spin_unlock_irqrestore(host-irq_lock, flags);
return;
}
@@ -1478,6 +1488,40 @@ static void omap_hsmmc_pre_req(struct mmc_host *mmc, 
struct mmc_request *mrq,
mrq-data-host_cookie = 0;
 }
 
+static int omap_hsmmc_abort_req(struct mmc_host *mmc, struct mmc_request *req)
+{
+   struct omap_hsmmc_host *host = mmc_priv(mmc);
+   unsigned long flags;
+
+   if (!host-req_in_progress) {
+   dev_dbg(mmc_dev(host-mmc), No request to abort\n);
+   return -EINVAL;
+   }
+   if (req  req != host-mrq) {
+   dev_dbg(mmc_dev(host-mmc), Non matching abort request\n);
+   return -EINVAL;
+   }
+   spin_lock_irqsave(host-irq_lock, flags);
+   host-abort_in_progress = 1;
+   omap_hsmmc_disable_irq(host);
+   spin_unlock_irqrestore(host-irq_lock, flags);
+
+   host-response_busy = 0;
+
+   if (host-data) {
+   struct mmc_data *dat = host-data;
+   omap_hsmmc_dma_cleanup(host, -EIO);
+   dev_dbg(mmc_dev(host-mmc), Aborting Transfer\n);
+   omap_hsmmc_xfer_done(host, dat);
+   } else if (host-cmd) {
+   dev_dbg(mmc_dev(host-mmc), Aborting Command\n);
+   omap_hsmmc_cmd_done(host, host-cmd);
+   }
+
+   dev_dbg(mmc_dev(host-mmc), Request %pK aborted\n, req);
+   return 0;
+
+}
 /*
  * Request function. for read/write operation
  */
@@ -1488,6 +1532,8 @@ static void omap_hsmmc_request(struct mmc_host *mmc, 
struct mmc_request *req)
 
BUG_ON(host-req_in_progress);
BUG_ON(host-dma_ch != -1);
+   host-abort_in_progress = 0;
+
if (host-protect_card) {
if (host-reqs_blocked  3) {
/*
@@ -1664,6 +1710,7 @@ static const struct mmc_host_ops omap_hsmmc_ops = {
.disable = omap_hsmmc_disable_fclk,
.post_req = omap_hsmmc_post_req,

[PATCHv2 00/16] [FS, MM, block, MMC]: eMMC High Priority Interrupt Feature

2012-05-03 Thread Venkatraman S
Standard eMMC (Embedded MultiMedia Card) specification expects to execute
one request at a time. If some requests are more important than others, they
can't be aborted while the flash procedure is in progress.

New versions of the eMMC standard (4.41 and above) specfies a feature 
called High Priority Interrupt (HPI). This enables an ongoing transaction
to be aborted using a special command (HPI command) so that the card is ready
to receive new commands immediately. Then the new request can be submitted
to the card, and optionally the interrupted command can be resumed again.

Some restrictions exist on when and how the command can be used. For example,
only write and write-like commands (ERASE) can be preempted, and the urgent
request must be a read.

In order to support this in software,
a) At the top level, some policy decisions have to be made on what is
worth preempting for.
This implementation uses the demand paging requests and swap
read requests as potential reads worth preempting an ongoing long write.
This is expected to provide improved responsiveness for smarphones
with multitasking capabilities - example would be launch a email application
while a video capture session (which causes long writes) is ongoing.
b) At the block handler, the higher priority request should be queued
  ahead of the pending requests in the elevator
c) At the MMC block and core level, transactions have to executed to 
enforce the rules of the MMC spec and make a reasonable tradeoff if the
ongoing command is really worth preempting. (For example, is it too close
to completing already ?).
The current implementation uses a fixed time logic. If 10ms has
already elapsed since the first request was submitted, then a new high
priority request would not cause a HPI, as it is expected that the first
request would finish soon. Further work is needed to dynamically tune
this value (maybe through sysfs) or automatically determine based on
average write times of previous requests.
d) At the lowest level (MMC host controllers), support interface to 
provide a transition path for ongoing transactions to be aborted and the
controller to be ready to receive next command.

More information about this feature can be found at
Jedec Specification:-
http://www.jedec.org/standards-documents/docs/jesd84-a441
Presentation on eMMC4.41 features:-
http://www.jedec.org/sites/default/files/Victor_Tsai.pdf

Acknowledgements:-  
In no particular order, thanks to Arnd Bergmann and  Saugata Das
from Linaro, Ilan Smith and Alex Lemberg from Sandisk, Luca Porzio from Micron
Technologies, Yejin Moon, Jae Hoon Chung from Samsung and others.


v1 - v2:-
* Convert threshold for hpi usage to a tuning parameter (sysfs)
* Add Documentation/ABI for all sysfs entries
* Add implementation of abort for OMAP controller
* Rebased to 3.4-rc4 + mmc-next

This patch series depends on a few other related cleanups
in MMC driver. All the patches and the dependent series can be
pulled from 
git://github.com/svenkatr/linux.git my/mmc/3.4/foreground-hpiv2


Ilan Smith (3):
  FS: Added demand paging markers to filesystem
  MM: Added page swapping markers to memory management
  block: treat DMPG and SWAPIN requests as special

Venkatraman S (13):
  block: add queue attributes to manage dpmg and swapin requests
  block: add sysfs attributes for runtime control of dpmg and swapin
  block: Documentation: add sysfs ABI for expedite_dmpg and expedite_swapin
  mmc: core: helper function for finding preemptible command
  mmc: core: add preemptibility tracking fields to mmc command
  mmc: core: Add MMC abort interface
  mmc: block: Detect HPI support in card and host controller
  mmc: core: Implement foreground request preemption procedure
  mmc: sysfs: Add sysfs entry for tuning preempt_time_threshold
  mmc: Documentation: Add sysfs ABI for hpi_time_threshold
  mmc: block: Implement HPI invocation and handling logic.
  mmc: Update preempted request with CORRECTLY_PRG_SECTORS_NUM info
  mmc: omap_hsmmc: Implement abort_req host_ops

 Documentation/ABI/testing/sysfs-block   |   12 ++
 Documentation/ABI/testing/sysfs-devices-mmc |   12 ++
 block/blk-core.c|   18 +++
 block/blk-sysfs.c   |   16 +++
 block/elevator.c|   14 ++-
 drivers/mmc/card/block.c|  143 --
 drivers/mmc/card/queue.h|1 +
 drivers/mmc/core/core.c |   67 ++
 drivers/mmc/core/mmc.c  |   25 
 drivers/mmc/host/omap_hsmmc.c   |   55 -
 fs/mpage.c  |2 +
 include/linux/bio.h |8 ++
 include/linux/blk_types.h

[PATCH v2 02/16] MM: Added page swapping markers to memory management

2012-05-03 Thread Venkatraman S
From: Ilan Smith ilan.sm...@sandisk.com

Add attribute to identify swapin requests
Mark memory management requests with swapin requests

Signed-off-by: Ilan Smith ilan.sm...@sandisk.com
Signed-off-by: Alex Lemberg alex.lemb...@sandisk.com
Signed-off-by: Venkatraman S svenk...@ti.com
---
 include/linux/bio.h   |1 +
 include/linux/blk_types.h |2 ++
 mm/page_io.c  |3 ++-
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/include/linux/bio.h b/include/linux/bio.h
index 264e0ef..8494b2f 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -63,6 +63,7 @@ static inline bool bio_rw_flagged(struct bio *bio, unsigned 
long flag)
 }
 
 #define bio_dmpg(bio)  bio_rw_flagged(bio, REQ_RW_DMPG)
+#define bio_swapin(bio)bio_rw_flagged(bio, REQ_RW_SWAPIN)
 
 /*
  * various member access, note that bio_data should of course not be used
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index 87feb80..df2b9ea 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -151,6 +151,7 @@ enum rq_flag_bits {
__REQ_IO_STAT,  /* account I/O stat */
__REQ_MIXED_MERGE,  /* merge of different types, fail separately */
__REQ_RW_DMPG,
+   __REQ_RW_SWAPIN,
__REQ_NR_BITS,  /* stops here */
 };
 
@@ -193,5 +194,6 @@ enum rq_flag_bits {
 #define REQ_MIXED_MERGE(1  __REQ_MIXED_MERGE)
 #define REQ_SECURE (1  __REQ_SECURE)
 #define REQ_RW_DMPG(1  __REQ_RW_DMPG)
+#define REQ_RW_SWAPIN  (1  __REQ_RW_SWAPIN)
 
 #endif /* __LINUX_BLK_TYPES_H */
diff --git a/mm/page_io.c b/mm/page_io.c
index dc76b4d..a148bea 100644
--- a/mm/page_io.c
+++ b/mm/page_io.c
@@ -128,8 +128,9 @@ int swap_readpage(struct page *page)
ret = -ENOMEM;
goto out;
}
+   bio-bi_rw |= REQ_RW_SWAPIN;
count_vm_event(PSWPIN);
-   submit_bio(READ, bio);
+   submit_bio(READ | REQ_RW_SWAPIN, bio);
 out:
return ret;
 }
-- 
1.7.10.rc2

--
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 03/16] block: add queue attributes to manage dpmg and swapin requests

2012-05-03 Thread Venkatraman S
Add block queue properties to identify and manage demand paging
and swapin requests differently.

Signed-off-by: Ilan Smith ilan.sm...@sandisk.com
Signed-off-by: Alex Lemberg alex.lemb...@sandisk.com
Signed-off-by: Venkatraman S svenk...@ti.com
---
 include/linux/blkdev.h |8 
 1 file changed, 8 insertions(+)

diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 2aa2466..e9187d4 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -420,6 +420,8 @@ struct request_queue {
 #define QUEUE_FLAG_ADD_RANDOM  16  /* Contributes to random pool */
 #define QUEUE_FLAG_SECDISCARD  17  /* supports SECDISCARD */
 #define QUEUE_FLAG_SAME_FORCE  18  /* force complete on same CPU */
+#define QUEUE_FLAG_EXP_DMPG19  /* Expedite Demand paging requests */
+#define QUEUE_FLAG_EXP_SWAPIN  20  /* Expedit page swapping */
 
 #define QUEUE_FLAG_DEFAULT ((1  QUEUE_FLAG_IO_STAT) |\
 (1  QUEUE_FLAG_STACKABLE)|   \
@@ -502,6 +504,12 @@ static inline void queue_flag_clear(unsigned int flag, 
struct request_queue *q)
 #define blk_queue_secdiscard(q)(blk_queue_discard(q)  \
test_bit(QUEUE_FLAG_SECDISCARD, (q)-queue_flags))
 
+#define blk_queue_exp_dmpg(q) \
+   test_bit(QUEUE_FLAG_EXP_DMPG, (q)-queue_flags)
+
+#define blk_queue_exp_swapin(q) \
+   test_bit(QUEUE_FLAG_EXP_SWAPIN, (q)-queue_flags)
+
 #define blk_noretry_request(rq) \
((rq)-cmd_flags  (REQ_FAILFAST_DEV|REQ_FAILFAST_TRANSPORT| \
 REQ_FAILFAST_DRIVER))
-- 
1.7.10.rc2

--
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 05/16] block: Documentation: add sysfs ABI for expedite_dmpg and expedite_swapin

2012-05-03 Thread Venkatraman S
Add description on the usage of expedite_dmpg and
expedite_swapin.

Signed-off-by: Venkatraman S svenk...@ti.com
---
 Documentation/ABI/testing/sysfs-block |   12 
 1 file changed, 12 insertions(+)

diff --git a/Documentation/ABI/testing/sysfs-block 
b/Documentation/ABI/testing/sysfs-block
index c1eb41c..0fb9fef 100644
--- a/Documentation/ABI/testing/sysfs-block
+++ b/Documentation/ABI/testing/sysfs-block
@@ -206,3 +206,15 @@ Description:
when a discarded area is read the discard_zeroes_data
parameter will be set to one. Otherwise it will be 0 and
the result of reading a discarded area is undefined.
+
+What:  /sys/block/disk/queue/expedite_demandpaging
+What:  /sys/block/disk/queue/expedite_swapin
+Date:  April 2012
+Contact:   Venkatraman S svenk...@ti.com
+Description:
+   For latency improvements, some storage devices could
+   provide a mechanism for servicing demand paging and
+   swapin requests in a high priority manner. Setting
+   these flags to 1 would get the requests marked with
+   REQ_RW_DMPG or REQ_RW_SWAPIN to be moved to the front
+   of elevator queue.
-- 
1.7.10.rc2

--
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 04/16] block: add sysfs attributes for runtime control of dpmg and swapin

2012-05-03 Thread Venkatraman S
sysfs entries for DPMG and SWAPIN requests so that they can
be set/reset from userspace.

Signed-off-by: Venkatraman S svenk...@ti.com
---
 block/blk-sysfs.c |   16 
 1 file changed, 16 insertions(+)

diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
index cf15001..764de9f 100644
--- a/block/blk-sysfs.c
+++ b/block/blk-sysfs.c
@@ -213,6 +213,8 @@ queue_store_##name(struct request_queue *q, const char 
*page, size_t count) \
 }
 
 QUEUE_SYSFS_BIT_FNS(nonrot, NONROT, 1);
+QUEUE_SYSFS_BIT_FNS(expedite_dmpg, EXP_DMPG, 0);
+QUEUE_SYSFS_BIT_FNS(expedite_swapin, EXP_SWAPIN, 0);
 QUEUE_SYSFS_BIT_FNS(random, ADD_RANDOM, 0);
 QUEUE_SYSFS_BIT_FNS(iostats, IO_STAT, 0);
 #undef QUEUE_SYSFS_BIT_FNS
@@ -387,6 +389,18 @@ static struct queue_sysfs_entry queue_random_entry = {
.store = queue_store_random,
 };
 
+static struct queue_sysfs_entry queue_dmpg_entry = {
+   .attr = {.name = expedite_demandpaging, .mode = S_IRUGO | S_IWUSR },
+   .show = queue_show_expedite_dmpg,
+   .store = queue_store_expedite_dmpg,
+};
+
+static struct queue_sysfs_entry queue_swapin_entry = {
+   .attr = {.name = expedite_swapping, .mode = S_IRUGO | S_IWUSR },
+   .show = queue_show_expedite_swapin,
+   .store = queue_store_expedite_swapin,
+};
+
 static struct attribute *default_attrs[] = {
queue_requests_entry.attr,
queue_ra_entry.attr,
@@ -409,6 +423,8 @@ static struct attribute *default_attrs[] = {
queue_rq_affinity_entry.attr,
queue_iostats_entry.attr,
queue_random_entry.attr,
+   queue_dmpg_entry.attr,
+   queue_swapin_entry.attr,
NULL,
 };
 
-- 
1.7.10.rc2

--
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 07/16] mmc: core: helper function for finding preemptible command

2012-05-03 Thread Venkatraman S
According to table30 in eMMC spec, only some commands
can be preempted by foreground HPI. Provide a helper function
for the HPI procedure to identify if the command is
preemptible.

Signed-off-by: Venkatraman S svenk...@ti.com
---
 include/linux/mmc/core.h |   13 +
 1 file changed, 13 insertions(+)

diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
index 1b431c7..680e256 100644
--- a/include/linux/mmc/core.h
+++ b/include/linux/mmc/core.h
@@ -10,6 +10,7 @@
 
 #include linux/interrupt.h
 #include linux/completion.h
+#include linux/mmc/mmc.h
 
 struct request;
 struct mmc_data;
@@ -192,6 +193,18 @@ static inline void mmc_claim_host(struct mmc_host *host)
__mmc_claim_host(host, NULL);
 }
 
+static inline bool mmc_is_preemptible_command(struct mmc_command *cmd)
+{
+   if ((cmd-opcode == MMC_SWITCH  (cmd-arg == EXT_CSD_BKOPS_START ||
+   cmd-arg == EXT_CSD_SANITIZE_START ||
+   cmd-arg == EXT_CSD_FLUSH_CACHE))
+   || (cmd-opcode == MMC_ERASE)
+   || (cmd-opcode == MMC_WRITE_MULTIPLE_BLOCK)
+   || (cmd-opcode == MMC_WRITE_BLOCK))
+   return true;
+   return false;
+}
+
 extern u32 mmc_vddrange_to_ocrmask(int vdd_min, int vdd_max);
 
 #endif /* LINUX_MMC_CORE_H */
-- 
1.7.10.rc2

--
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 08/16] mmc: core: add preemptibility tracking fields to mmc command

2012-05-03 Thread Venkatraman S
Set a preemptibility command atrribute to MMC commands. This
can be later used by write (multi block), trim etc for
evaluating if a HPI is applicable.

Note the starting time of executing a command so a decision
can be made if it is too late for preemption.

Signed-off-by: Venkatraman S svenk...@ti.com
---
 drivers/mmc/core/core.c  |5 +
 include/linux/mmc/core.h |4 
 2 files changed, 9 insertions(+)

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index c4cd6fb..b4152ca 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -258,6 +258,11 @@ static int __mmc_start_req(struct mmc_host *host, struct 
mmc_request *mrq)
complete(mrq-completion);
return -ENOMEDIUM;
}
+   if (mmc_is_preemptible_command(mrq-cmd))
+   mrq-cmd-cmd_attr |= MMC_CMD_PREEMPTIBLE;
+   else
+   mrq-cmd-cmd_attr = ~MMC_CMD_PREEMPTIBLE;
+   mrq-cmd-started_time = jiffies;
mmc_start_request(host, mrq);
return 0;
 }
diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
index 680e256..d86144e 100644
--- a/include/linux/mmc/core.h
+++ b/include/linux/mmc/core.h
@@ -76,6 +76,10 @@ struct mmc_command {
  */
 #define mmc_cmd_type(cmd)  ((cmd)-flags  MMC_CMD_MASK)
 
+   unsigned intcmd_attr; /*Runtime attributes of the command */
+#define MMC_CMD_PREEMPTIBLEBIT(0)
+#define MMC_CMD_PREEMPTED  BIT(1)
+   unsigned long   started_time;
unsigned intretries;/* max number of retries */
unsigned interror;  /* command error */
 
-- 
1.7.10.rc2

--
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 09/16] mmc: core: Add MMC abort interface

2012-05-03 Thread Venkatraman S
HPI (and possibly other) procedures require that an ongoing
mmc request issued to a controller be aborted in the middle
of a transaction. Define a abort interface function to the
controller so that individual host controllers can safely
abort a request, stop the dma and cleanup their statemachine
etc. The implementation is controller dependant

Signed-off-by: Venkatraman S svenk...@ti.com
---
 drivers/mmc/core/core.c  |8 
 include/linux/mmc/host.h |1 +
 2 files changed, 9 insertions(+)

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index b4152ca..3f0e927 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -328,6 +328,14 @@ static void mmc_post_req(struct mmc_host *host, struct 
mmc_request *mrq,
}
 }
 
+static int mmc_abort_req(struct mmc_host *host, struct mmc_request *req)
+{
+   if (host-ops-abort_req)
+   return host-ops-abort_req(host, req);
+
+   return -ENOSYS;
+}
+
 /**
  * mmc_start_req - start a non-blocking request
  * @host: MMC host to start command
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 0707d22..d700703 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -98,6 +98,7 @@ struct mmc_host_ops {
int err);
void(*pre_req)(struct mmc_host *host, struct mmc_request *req,
   bool is_first_req);
+   int (*abort_req)(struct mmc_host *host, struct mmc_request *req);
void(*request)(struct mmc_host *host, struct mmc_request *req);
/*
 * Avoid calling these three functions too often or in a fast path,
-- 
1.7.10.rc2

--
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 12/16] mmc: sysfs: Add sysfs entry for tuning preempt_time_threshold

2012-05-03 Thread Venkatraman S
When High Priority Interrupt (HPI) is enabled, ongoing requests
might be preempted. It is worthwhile to not preempt some requests
which have progressed in the underlying driver for some time.

The threshold of elapsed time after which HPI is not useful can
be tuned on a per-device basis, using the hpi_time_threshold
sysfs entry.

Signed-off-by: Venkatraman S svenk...@ti.com
---
 drivers/mmc/core/mmc.c   |   25 +
 include/linux/mmc/card.h |1 +
 2 files changed, 26 insertions(+)

diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index 54df5ad..b7dbea1 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -624,6 +624,30 @@ MMC_DEV_ATTR(enhanced_area_offset, %llu\n,
card-ext_csd.enhanced_area_offset);
 MMC_DEV_ATTR(enhanced_area_size, %u\n, card-ext_csd.enhanced_area_size);
 
+static ssize_t mmc_hpi_threhold_show(struct device *dev,
+   struct device_attribute *attr, char *buf)
+{
+   struct mmc_card *card = mmc_dev_to_card(dev);
+   return sprintf(buf, %d\n, card-preempt_time_threshold);
+}
+
+static ssize_t mmc_hpi_threshold_store(struct device *dev,
+   struct device_attribute *attr,
+   const char *buf, size_t count)
+{
+   unsigned long threshold;
+   struct mmc_card *card = mmc_dev_to_card(dev);
+
+   if (kstrtoul(buf, 0, threshold))
+   return -EINVAL;
+   if (threshold)
+   card-preempt_time_threshold = threshold;
+   return count;
+}
+
+DEVICE_ATTR(hpi_time_threshold, S_IRWXU, mmc_hpi_threhold_show,
+   mmc_hpi_threshold_store);
+
 static struct attribute *mmc_std_attrs[] = {
dev_attr_cid.attr,
dev_attr_csd.attr,
@@ -638,6 +662,7 @@ static struct attribute *mmc_std_attrs[] = {
dev_attr_serial.attr,
dev_attr_enhanced_area_offset.attr,
dev_attr_enhanced_area_size.attr,
+   dev_attr_hpi_time_threshold.attr,
NULL,
 };
 
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index 629b823..2a0da29 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -245,6 +245,7 @@ struct mmc_card {
unsigned interase_shift;/* if erase unit is power 2 */
unsigned intpref_erase; /* in sectors */
u8  erased_byte;/* value of erased bytes */
+   unsigned int preempt_time_threshold;/* ms for checking hpi usage */
 
u32 raw_cid[4]; /* raw card CID */
u32 raw_csd[4]; /* raw card CSD */
-- 
1.7.10.rc2

--
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 14/16] mmc: block: Implement HPI invocation and handling logic.

2012-05-03 Thread Venkatraman S
Intercept command which require high priority treatment.
If the ongoing command can be preempted according to JEDEC HPI
definition and sufficient window exist to complete an ongoing
request, invoke HPI and abort the current request, and issue
the high priority request.
Otherwise, process the command normally.

Signed-off-by: Venkatraman S svenk...@ti.com
---
 drivers/mmc/card/block.c |  131 +++---
 drivers/mmc/card/queue.h |1 +
 2 files changed, 124 insertions(+), 8 deletions(-)

diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index 11833e4..3dd662b 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -1276,7 +1276,7 @@ static int mmc_blk_cmd_err(struct mmc_blk_data *md, 
struct mmc_card *card,
return ret;
 }
 
-static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *rqc)
+static int mmc_blk_execute_rw_rq(struct mmc_queue *mq, struct request *rqc)
 {
struct mmc_blk_data *md = mq-data;
struct mmc_card *card = md-queue.card;
@@ -1285,22 +1285,31 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, 
struct request *rqc)
enum mmc_blk_status status;
struct mmc_queue_req *mq_rq;
struct request *req;
-   struct mmc_async_req *areq;
+   struct mmc_async_req *prev_req, *cur_req;
 
if (!rqc  !mq-mqrq_prev-req)
return 0;
 
+   mq-mqrq_interrupted = NULL;
+
do {
if (rqc) {
mmc_blk_rw_rq_prep(mq-mqrq_cur, card, 0, mq);
-   areq = mq-mqrq_cur-mmc_active;
-   } else
-   areq = NULL;
-   areq = mmc_start_req(card-host, areq, (int *) status);
-   if (!areq)
+   cur_req = mq-mqrq_cur-mmc_active;
+   } else {
+   cur_req = NULL;
+   }
+   prev_req = mmc_start_req(card-host, cur_req, (int *) status);
+   if (!prev_req)
return 0;
 
-   mq_rq = container_of(areq, struct mmc_queue_req, mmc_active);
+   if (cur_req 
+   cur_req-mrq-cmd-cmd_attr  MMC_CMD_PREEMPTIBLE) {
+   mq-mqrq_interrupted = mq-mqrq_cur;
+   }
+
+   mq_rq = container_of(prev_req,
+   struct mmc_queue_req, mmc_active);
brq = mq_rq-brq;
req = mq_rq-req;
type = rq_data_dir(req) == READ ? MMC_BLK_READ : MMC_BLK_WRITE;
@@ -1406,6 +1415,112 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, 
struct request *rqc)
return 0;
 }
 
+#define HPI_CHECK  (REQ_RW_SWAPIN | REQ_RW_DMPG)
+
+static bool mmc_can_do_foreground_hpi(struct mmc_queue *mq,
+   struct request *req, unsigned int thpi)
+{
+
+   /*
+* If some time has elapsed since the issuing of previous write
+* command, or if the size of the request was too small, there's
+* no point in preempting it. Check if it's worthwhile to preempt
+*/
+   int time_elapsed = jiffies_to_msecs(jiffies -
+   mq-mqrq_cur-mmc_active.mrq-cmd-started_time);
+
+   if (time_elapsed = thpi)
+   return true;
+
+   return false;
+}
+
+/*
+ * When a HPI command had been given for a foreground
+ * request, the host controller will finish the request,
+ * the completion request has to be handled differently
+ */
+static struct mmc_async_req *mmc_handle_aborted_request(struct mmc_queue *mq,
+   int hpi_err)
+{
+   struct mmc_async_req *areq;
+   struct mmc_request *mrq;
+   struct mmc_queue_req *mq_rq;
+   struct mmc_blk_data *md = mq-data;
+   struct request *req;
+
+   BUG_ON(!mq-mqrq_interrupted);
+
+   areq = mq-mqrq_interrupted-mmc_active;
+   mrq = areq-mrq;
+
+   /* Error checking is TBD */
+   mq_rq = container_of(areq, struct mmc_queue_req, mmc_active);
+   req = mq_rq-req;
+   mmc_queue_bounce_post(mq_rq);
+
+   spin_lock_irq(md-lock);
+   /*
+* TODO. Do the error translation as done in
+* blk_err_check here and propogate
+* the partial transfer status if applicable
+*/
+   __blk_end_request(req, -EIO, 0);
+   spin_unlock_irq(md-lock);
+   return areq;
+}
+
+static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *req)
+{
+   int ret;
+   struct mmc_blk_data *md = mq-data;
+   struct mmc_card *card = md-queue.card;
+   struct mmc_async_req *areq;
+
+   if (req  md-flags  MMC_HPI_SUPPORT) {
+   if (!((req-cmd_flags  HPI_CHECK)  mq-mqrq_interrupted))
+   goto no_preempt;
+   if (!mmc_can_do_foreground_hpi(mq, req,
+   card-preempt_time_threshold))
+   goto no_preempt;
+
+   pr_debug(Pre-empting ongoing request %pK\n,
+  

[PATCH v2 13/16] mmc: Documentation: Add sysfs ABI for hpi_time_threshold

2012-05-03 Thread Venkatraman S
hpi_time_threshold can be set to configure elapsed time in ms,
after which an ongoing request will not be preempted.
Explain the hpi_time_threhold parameter for MMC devices.

Signed-off-by: Venkatraman S svenk...@ti.com
---
 Documentation/ABI/testing/sysfs-devices-mmc |   12 
 1 file changed, 12 insertions(+)

diff --git a/Documentation/ABI/testing/sysfs-devices-mmc 
b/Documentation/ABI/testing/sysfs-devices-mmc
index 5a50ab6..133dba5 100644
--- a/Documentation/ABI/testing/sysfs-devices-mmc
+++ b/Documentation/ABI/testing/sysfs-devices-mmc
@@ -19,3 +19,15 @@ Description:
is enabled, this attribute will indicate the size of enhanced
data area. If not, this attribute will be -EINVAL.
Unit KByte. Format decimal.
+
+What:  /sys/devices/.../mmc_host/mmcX/mmcX:/hpi_time_threshold
+Date:  April 2012
+Contact:   Venkatraman S svenk...@ti.com
+Description:
+   High Priority Interrupt is a new feature defined in eMMC4.4
+   standard. If this feature is enabled, stack needs to decide
+   till what time since the last issued request is considered
+   preemptible. This attribute value (in milliseconds) is
+   used for arriving at the most optimal value for a specific
+   card. Default is zero, which also disables the feature, as
+   the request becomes non-preemptible immediately.
-- 
1.7.10.rc2

--
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 10/16] mmc: block: Detect HPI support in card and host controller

2012-05-03 Thread Venkatraman S
If both the card and host controller support HPI related
operations, set a flag in MMC queue to remember it.

Signed-off-by: Venkatraman S svenk...@ti.com
---
 drivers/mmc/card/block.c |   12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index dabec55..11833e4 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -88,6 +88,7 @@ struct mmc_blk_data {
unsigned intflags;
 #define MMC_BLK_CMD23  (1  0)/* Can do SET_BLOCK_COUNT for 
multiblock */
 #define MMC_BLK_REL_WR (1  1)/* MMC Reliable write support */
+#define MMC_HPI_SUPPORT(1  2)
 
unsigned intusage;
unsigned intread_only;
@@ -1548,12 +1549,15 @@ static struct mmc_blk_data *mmc_blk_alloc_req(struct 
mmc_card *card,
md-flags |= MMC_BLK_CMD23;
}
 
-   if (mmc_card_mmc(card) 
-   md-flags  MMC_BLK_CMD23 
+   if (mmc_card_mmc(card)) {
+   if (md-flags  MMC_BLK_CMD23 
((card-ext_csd.rel_param  EXT_CSD_WR_REL_PARAM_EN) ||
 card-ext_csd.rel_sectors)) {
-   md-flags |= MMC_BLK_REL_WR;
-   blk_queue_flush(md-queue.queue, REQ_FLUSH | REQ_FUA);
+   md-flags |= MMC_BLK_REL_WR;
+   blk_queue_flush(md-queue.queue, REQ_FLUSH | REQ_FUA);
+   }
+   if (card-host-ops-abort_req  card-ext_csd.hpi_en)
+   md-flags |= MMC_HPI_SUPPORT;
}
 
return md;
-- 
1.7.10.rc2

--
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 11/16] mmc: core: Implement foreground request preemption procedure

2012-05-03 Thread Venkatraman S
When invoked, ongoing command at the host controller should abort
and completion should be invoked.

It's quite possible that the interruption will race with the
successful completion of the command. If so, HPI is invoked
only when the low level driver sets an error flag for the
aborted request.

Signed-off-by: Venkatraman S svenk...@ti.com
---
 drivers/mmc/core/core.c  |   32 
 include/linux/mmc/core.h |2 ++
 2 files changed, 34 insertions(+)

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 3f0e927..e6430f8 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -466,6 +466,38 @@ out:
 }
 EXPORT_SYMBOL(mmc_interrupt_hpi);
 
+int mmc_preempt_foreground_request(struct mmc_card *card,
+   struct mmc_request *req)
+{
+   int ret;
+
+   ret = mmc_abort_req(card-host, req);
+   if (ret == -ENOSYS)
+   return ret;
+   /*
+* Whether or not abort was successful, the command is
+* still under the host controller's context.
+* Should wait for the completion to be returned.
+*/
+   wait_for_completion(req-completion);
+   /*
+* Checkpoint the aborted request.
+* If error is set, the request completed partially,
+* and the ext_csd field CORRECTLY_PRG_SECTORS_NUM
+* contains the number of blocks written to the device.
+* If error is not set, the request was completed
+* successfully and there is no need to try it again.
+*/
+   if (req-data  req-data-error) {
+   mmc_interrupt_hpi(card);
+   /* TODO : Take out the CORRECTLY_PRG_SECTORS_NUM
+* from ext_csd and add it to the request */
+   }
+
+   return 0;
+}
+EXPORT_SYMBOL(mmc_preempt_foreground_request);
+
 /**
  * mmc_wait_for_cmd - start a command and wait for completion
  * @host: MMC host to start command
diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
index d86144e..e2d55c6 100644
--- a/include/linux/mmc/core.h
+++ b/include/linux/mmc/core.h
@@ -144,6 +144,8 @@ extern struct mmc_async_req *mmc_start_req(struct mmc_host 
*,
 extern int mmc_interrupt_hpi(struct mmc_card *);
 extern void mmc_wait_for_req(struct mmc_host *, struct mmc_request *);
 extern int mmc_wait_for_cmd(struct mmc_host *, struct mmc_command *, int);
+extern int mmc_preempt_foreground_request(struct mmc_card *card,
+   struct mmc_request *req);
 extern int mmc_app_cmd(struct mmc_host *, struct mmc_card *);
 extern int mmc_wait_for_app_cmd(struct mmc_host *, struct mmc_card *,
struct mmc_command *, int);
-- 
1.7.10.rc2

--
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 06/16] block: treat DMPG and SWAPIN requests as special

2012-05-03 Thread Venkatraman S
From: Ilan Smith ilan.sm...@sandisk.com

When exp_swapin and exp_dmpg are set, treat read requests
marked with DMPG and SWAPIN as high priority and move to
the front of the queue.

Signed-off-by: Ilan Smith ilan.sm...@sandisk.com
Signed-off-by: Alex Lemberg alex.lemb...@sandisk.com
Signed-off-by: Venkatraman S svenk...@ti.com
---
 block/blk-core.c |   18 ++
 block/elevator.c |   14 +-
 2 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/block/blk-core.c b/block/blk-core.c
index 1f61b74..7a1b98b 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -1306,6 +1306,12 @@ void init_request_from_bio(struct request *req, struct 
bio *bio)
if (bio-bi_rw  REQ_RAHEAD)
req-cmd_flags |= REQ_FAILFAST_MASK;
 
+   if (bio_swapin(bio)  blk_queue_exp_swapin(req-q))
+   req-cmd_flags |= REQ_RW_SWAPIN | REQ_NOMERGE;
+
+   if (bio_dmpg(bio)  blk_queue_exp_dmpg(req-q))
+   req-cmd_flags |= REQ_RW_DMPG | REQ_NOMERGE;
+
req-errors = 0;
req-__sector = bio-bi_sector;
req-ioprio = bio_prio(bio);
@@ -1333,6 +1339,18 @@ void blk_queue_bio(struct request_queue *q, struct bio 
*bio)
goto get_rq;
}
 
+   if (bio_swapin(bio)  blk_queue_exp_swapin(q)) {
+   spin_lock_irq(q-queue_lock);
+   where = ELEVATOR_INSERT_FLUSH;
+   goto get_rq;
+   }
+
+   if (bio_dmpg(bio)  blk_queue_exp_dmpg(q)) {
+   spin_lock_irq(q-queue_lock);
+   where = ELEVATOR_INSERT_FLUSH;
+   goto get_rq;
+   }
+
/*
 * Check if we can merge with the plugged list before grabbing
 * any locks.
diff --git a/block/elevator.c b/block/elevator.c
index f016855..76d571b 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -367,7 +367,8 @@ void elv_dispatch_sort(struct request_queue *q, struct 
request *rq)
q-nr_sorted--;
 
boundary = q-end_sector;
-   stop_flags = REQ_SOFTBARRIER | REQ_STARTED;
+   stop_flags = REQ_SOFTBARRIER | REQ_STARTED
+   | REQ_RW_SWAPIN | REQ_RW_DMPG ;
list_for_each_prev(entry, q-queue_head) {
struct request *pos = list_entry_rq(entry);
 
@@ -585,6 +586,17 @@ void elv_quiesce_end(struct request_queue *q)
 
 void __elv_add_request(struct request_queue *q, struct request *rq, int where)
 {
+   unsigned int hpi_flags = REQ_RW_DMPG | REQ_RW_SWAPIN;
+
+   if (rq-cmd_flags  hpi_flags) {
+   /*
+* Insert swap-in or demand page requests at the front. This
+* causes them to be queued in the reversed order.
+*/
+   where = ELEVATOR_INSERT_FRONT;
+   } else
+
+
trace_block_rq_insert(q, rq);
 
rq-q = q;
-- 
1.7.10.rc2

--
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 01/16] FS: Added demand paging markers to filesystem

2012-05-03 Thread Venkatraman S
From: Ilan Smith ilan.sm...@sandisk.com

Add attribute to identify demand paging requests.
Mark readpages with demand paging attribute.

Signed-off-by: Ilan Smith ilan.sm...@sandisk.com
Signed-off-by: Alex Lemberg alex.lemb...@sandisk.com
Signed-off-by: Venkatraman S svenk...@ti.com
---
 fs/mpage.c|2 ++
 include/linux/bio.h   |7 +++
 include/linux/blk_types.h |2 ++
 3 files changed, 11 insertions(+)

diff --git a/fs/mpage.c b/fs/mpage.c
index 0face1c..8b144f5 100644
--- a/fs/mpage.c
+++ b/fs/mpage.c
@@ -386,6 +386,8 @@ mpage_readpages(struct address_space *mapping, struct 
list_head *pages,
last_block_in_bio, map_bh,
first_logical_block,
get_block);
+   if (bio)
+   bio-bi_rw |= REQ_RW_DMPG;
}
page_cache_release(page);
}
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 4d94eb8..264e0ef 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -57,6 +57,13 @@
(bio)-bi_rw |= ((unsigned long) (prio)  BIO_PRIO_SHIFT); \
 } while (0)
 
+static inline bool bio_rw_flagged(struct bio *bio, unsigned long flag)
+{
+   return ((bio-bi_rw  flag)  != 0);
+}
+
+#define bio_dmpg(bio)  bio_rw_flagged(bio, REQ_RW_DMPG)
+
 /*
  * various member access, note that bio_data should of course not be used
  * on highmem page vectors
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index 4053cbd..87feb80 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -150,6 +150,7 @@ enum rq_flag_bits {
__REQ_FLUSH_SEQ,/* request for flush sequence */
__REQ_IO_STAT,  /* account I/O stat */
__REQ_MIXED_MERGE,  /* merge of different types, fail separately */
+   __REQ_RW_DMPG,
__REQ_NR_BITS,  /* stops here */
 };
 
@@ -191,5 +192,6 @@ enum rq_flag_bits {
 #define REQ_IO_STAT(1  __REQ_IO_STAT)
 #define REQ_MIXED_MERGE(1  __REQ_MIXED_MERGE)
 #define REQ_SECURE (1  __REQ_SECURE)
+#define REQ_RW_DMPG(1  __REQ_RW_DMPG)
 
 #endif /* __LINUX_BLK_TYPES_H */
-- 
1.7.10.rc2

--
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 06/16] block: treat DMPG and SWAPIN requests as special

2012-05-03 Thread Jeff Moyer
Venkatraman S svenk...@ti.com writes:

 From: Ilan Smith ilan.sm...@sandisk.com

 When exp_swapin and exp_dmpg are set, treat read requests
 marked with DMPG and SWAPIN as high priority and move to
 the front of the queue.

[...]
 + if (bio_swapin(bio)  blk_queue_exp_swapin(q)) {
 + spin_lock_irq(q-queue_lock);
 + where = ELEVATOR_INSERT_FLUSH;
 + goto get_rq;
 + }
 +
 + if (bio_dmpg(bio)  blk_queue_exp_dmpg(q)) {
 + spin_lock_irq(q-queue_lock);
 + where = ELEVATOR_INSERT_FLUSH;
 + goto get_rq;

Is ELEVATOR_INSERT_FRONT not good enough?  It seems wrong to use _FLUSH,
here.  If the semantics of ELEVATOR_INSERT_FLUSH are really what is
required, then perhaps we need to have another think about the naming of
these flags.

Cheers,
Jeff
--
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   >