OMAP3: hwmod: Adding flag to prevent caching of sysconfig register.
Subsystems (4)
PATCH 1/1 OMAP3: hwmod: Adding flag to prevent caching of sysconfig register.
In the current implementation the sysconfig value is read into
_sysc_cache once and an actual update to the sysconfig register
happens only if the new value paased is differnt from the one in _sysc_cache. _sysc_cache is updated only if _HWMOD_SYSCONFIG_LOADED is not set. This can lead to the follwing issue if off mode is enabled in modules which employs "always-retore" mechanism of context save and restore.
a. The module sets the sysconfig register through omap_device_enable.
Here _sysc_cache is updated with the value written to the sysconfig register and left.
b. The power domain containig the module enters off mode and the
module context is lost.
c. The module in use becomes active and calls omap_device_enable to
enable itself. Here a read of sysconfig register does not happen as _HWMOD_SYSCONFIG_LOADED flag is set. The value to be written to the sysconfig register will be same as the one written in step a. Since _sysc_cache reflects the previous written value an update of the sysconfig register does not happen.
This means in modules which employs "always-restore" mechanism after off , the sysconfig regsiters will never get updated.
This patch introduces a flag SYSC_NO_CACHE which if set ensures that the sysconfig register is always read into _sysc_cache before an update is attempted.
This flags need to be set only by modules which does not do a context save but re-initializes the registers every time the module is accessed. This includes modules like i2c, smartreflex etc.
---
This patch depends on
http://patchwork.kernel.org/patch/63383/ http://patchwork.kernel.org/patch/65140/
arch/arm/mach-omap2/omap_hwmod.c | 3 ++- arch/arm/plat-omap/include/plat/omap_hwmod.h | 1 + 2 files changed, 3 insertions(+), 1 deletions(-)
arch/arm/mach-omap2/omap_hwmod.c +2 -1
@@ -93,7 +93,8 @@ static int _update_sysc_cache(struct omap_hwmod *oh) oh->_sysc_cache =omap_hwmod_readl (oh, oh->sysconfig->sysc_offs); - oh->_int_flags |= _HWMOD_SYSCONFIG_LOADED; +if (!(oh->sysconfig->sysc_flags &SYSC_NO_CACHE )) + oh->_int_flags |= _HWMOD_SYSCONFIG_LOADED;return 0 ; }
arch/arm/plat-omap/include/plat/omap_hwmod.h +1 -0
@@ -228,6 +228,7 @@ struct omap_hwmod_ocp_if {#define SYSC_HAS_MIDLEMODE (1 << 6)#define SYSS_MISSING (1 << 7)#define SYSC_CHANGE_CLKACT_OFFSET (1 << 8) +#define SYSC_NO_CACHE (1 << 9)/* omap_hwmod_sysconfig.clockact flags */ #define CLOCKACT_TEST_BOTH 0x0
Signature · 1 line
1.5.4.7
Quoted 74 lines
Quoted 74 lines
-----Original Message-----
From: Gopinath, Thara
Sent: Sunday, December 06, 2009 4:55 PM
To: [email protected]
Cc: Gopinath, Thara; Paul Walmsley
Subject: [PATCH] OMAP3: hwmod: Adding flag to prevent caching of sysconfig register.In the current implementation the sysconfig value is read into
_sysc_cacheonce and an actual update to the sysconfig register happens only if the new value paased is differnt from the one in_sysc_cache._sysc_cacheis updated only if_HWMOD_SYSCONFIG_LOADEDis not set. This can lead to the follwing issue if off mode is enabled in modules which employs "always-retore" mechanism of context save and restore.a. The module sets the sysconfig register through
omap_device_enable.
Here_sysc_cacheis updated with the value written to the sysconfig register and left.
b. The power domain containig the module enters off mode and the
module context is lost.
c. The module in use becomes active and callsomap_device_enableto
enable itself. Here a read of sysconfig register does not happen as_HWMOD_SYSCONFIG_LOADEDflag is set. The value to be written to the sysconfig register will be same as the one written in step a. Since_sysc_cachereflects the previous written value an update of the sysconfig register does not happen.
This means in modules which employs "always-restore" mechanism after off , the sysconfig regsiters will never get updated.This patch introduces a flag
SYSC_NO_CACHEwhich if set ensures that the sysconfig register is always read into_sysc_cachebefore an update is attempted.This flags need to be set only by modules which does not do a context save but re-initializes the registers every time the module is accessed. This includes modules like i2c, smartreflex etc.
Signed-off-by Thara Gopinath <[email protected]>Cc Paul Walmsley <[email protected]>---
This patch depends onhttp://patchwork.kernel.org/patch/63383/ http://patchwork.kernel.org/patch/65140/arch/arm/mach-omap2/omap_hwmod.c | 3 ++- arch/arm/plat-omap/include/plat/omap_hwmod.h | 1 + 2 files changed, 3 insertions(+), 1 deletions(-)arch/arm/mach-omap2/omap_hwmod.c +2
-1@@ -93,7 +93,8 @@ static int _update_sysc_cache(struct omap_hwmod *oh) oh->_sysc_cache =omap_hwmod_readl (oh, oh->sysconfig->sysc_offs); - oh->_int_flags |= _HWMOD_SYSCONFIG_LOADED; +if (!(oh->sysconfig->sysc_flags &SYSC_NO_CACHE )) + oh->_int_flags |= _HWMOD_SYSCONFIG_LOADED;return 0 ; }arch/arm/plat- renamed from arch/arm/plat-omap/include/plat/omap_hwmod.h +0
-0
omap/include/plat/omap_hwmod.h
index 1f83495..a3298ca 100644arch/arm/plat-omap/include/plat/omap_hwmod.h +1
-0@@ -228,6 +228,7 @@ struct omap_hwmod_ocp_if {#define SYSC_HAS_MIDLEMODE (1 << 6)#define SYSS_MISSING (1 << 7)#define SYSC_CHANGE_CLKACT_OFFSET (1 << 8) +#define SYSC_NO_CACHE (1 << 9)
Quoted 3 lines
arch/arm/plat-omap/include/plat/omap_hwmod.h struct omap_hwmod_ocp_if {
Quoted 3 lines
arch/arm/plat-omap/include/plat/omap_hwmod.h +0
-1/* omap_hwmod_sysconfig.clockact flags */ #define CLOCKACT_TEST_BOTH 0x0 --
Hi Paul,Kevin.. Does this patch look ok?
Quoted 1 line
Quoted 1 line
1.5.4.7
Paul Walmsley
maintainerQuoted 1 line · Thara
Hi Paul,Kevin.. Does this patch look ok?
Hello Thara,
looking over this patch. Nice job on the descriptive patch comment; it explains the problem well. What do you think about a slightly different approach -- that is, to add a hook to the hwmod code to invalidate the cache if the module's powerdomain has lost context?
- Paul
Quoted 11 lines
Quoted 11 lines
-----Original Message-----
From: Paul Walmsley [mailto:[email protected]]
Sent: Wednesday, January 06, 2010 6:02 AM
To: Gopinath, Thara
Cc: [email protected]
Subject: RE: [PATCH] OMAP3: hwmod: Adding flag to prevent caching of sysconfig register.On Wed, 23 Dec 2009, Gopinath, Thara wrote:
Quoted 8 lines
Quoted 8 lines
Quoted 1 line
Hi Paul,Kevin.. Does this patch look ok?
Hello Thara,
looking over this patch. Nice job on the descriptive patch comment; it explains the problem well. What do you think about a slightly different approach -- that is, to add a hook to the hwmod code to invalidate the cache if the module's powerdomain has lost context?
Hi Paul
It should be possible but I feel it is a bit cumbersome. Couple of reasons I have.
a. Some modules like smartreflex does not have any power domain associated with it.
b. Invalidating the cache is not needed for all modules even if the module powerdomain context is lost. This is needed only for modules which employ always restore mechanism. All other modules will do explicit context save and restore of its registers c. Getting whether power domain context is lost or not is not very straight forward. If I am not mistaken the only way is to keep tab of the powerdomain counters through omap_pm_get_dev_context_loss_count. I might be mistaken.
Regards
Thara
Paul Walmsley
maintainerQuoted 18 lines · Thara
Quoted 9 lines
Quoted 9 lines
-----Original Message-----
From: Paul Walmsley [mailto:[email protected]]
Sent: Wednesday, January 06, 2010 6:02 AM
To: Gopinath, Thara
Cc: [email protected]
Subject: RE: [PATCH] OMAP3: hwmod: Adding flag to prevent caching of sysconfig register.On Wed, 23 Dec 2009, Gopinath, Thara wrote:
Quoted 8 lines
Quoted 8 lines
Quoted 1 line
Hi Paul,Kevin.. Does this patch look ok?
Hello Thara,
looking over this patch. Nice job on the descriptive patch comment; it explains the problem well. What do you think about a slightly different approach -- that is, to add a hook to the hwmod code to invalidate the cache if the module's powerdomain has lost context?
Quoted 4 lines
It should be possible but I feel it is a bit cumbersome. Couple of reasons I have.
a. Some modules like smartreflex does not have any power domain associated with it.
Aren't the SmartReflex modules in their own powerdomain that changes with the CORE powerdomain?
Quoted 4 lines
b. Invalidating the cache is not needed for all modules even if the module powerdomain context is lost. This is needed only for modules which employ always restore mechanism. All other modules will do explicit context save and restore of its registers
I think we'll want to move all SYSCONFIG manipulation into the hwmod layer, once it is in place.
Quoted 4 lines
c. Getting whether power domain context is lost or not is not very straight forward. If I am not mistaken the only way is to keep tab of the powerdomain counters through
omap_pm_get_dev_context_loss_count. I might be mistaken.
Yeah. Getting the hook in will take a little bit of work.
Anyway, for the time being, we can take this patch. But the other reason that this approach doesn't appeal is that this new flag doesn't have anything to do with the hardware -- it's just a software workaround for device driver code. Ideally, all of these flags should be generatable based on hardware data only. Flags that pertain to how the device driver works belong in a different place. Perhaps they should still be connected to the hwmod code, but they should exist separately from the hwmod data.
Queued for .33-rc (fixes).
- Paul
Paul Walmsley
maintainerQuoted 1 line · Paul Walmsley
Queued for .33-rc (fixes).
By the way, the patch had to be slightly tweaked to apply it since the original was based on the configurable clockactivity offset patch - here's what is queued in the 'for_2.6.33rc_d' branch ofgit://git.pwsan.com/linux-2.6
- Paul
Quoted 1 line
From
5d121735372f9983cca1747bc0332a045151d4a8Mon Sep 17 00:00:00 2001
From: Thara Gopinath <[email protected]>
Date: Mon, 11 Jan 2010 15:25:05 -0700
Subject: [PATCH] OMAP3: hwmod: Adding flag to prevent caching of sysconfig register.
In the current implementation the sysconfig value is read into
_sysc_cache once and an actual update to the sysconfig register
happens only if the new value paased is differnt from the one in _sysc_cache. _sysc_cache is updated only if _HWMOD_SYSCONFIG_LOADED is not set. This can lead to the follwing issue if off mode is enabled in modules which employs "always-retore" mechanism of context save and restore.
a. The module sets the sysconfig register through omap_device_enable.
Here _sysc_cache is updated with the value written to the sysconfig register and left.
b. The power domain containig the module enters off mode and the
module context is lost.
c. The module in use becomes active and calls omap_device_enable to
enable itself. Here a read of sysconfig register does not happen as _HWMOD_SYSCONFIG_LOADED flag is set. The value to be written to the sysconfig register will be same as the one written in step a. Since _sysc_cache reflects the previous written value an update of the sysconfig register does not happen.
This means in modules which employs "always-restore" mechanism after off , the sysconfig regsiters will never get updated.
This patch introduces a flag SYSC_NO_CACHE which if set ensures that the sysconfig register is always read into _sysc_cache before an update is attempted.
This flags need to be set only by modules which does not do a context save but re-initializes the registers every time the module is accessed. This includes modules like i2c, smartreflex etc.
--- arch/arm/mach-omap2/omap_hwmod.c | 3 ++- arch/arm/plat-omap/include/plat/omap_hwmod.h | 1 + 2 files changed, 3 insertions(+), 1 deletions(-)
arch/arm/mach-omap2/omap_hwmod.c +2 -1
@@ -94,7 +94,8 @@ static int _update_sysc_cache(struct omap_hwmod *oh) oh->_sysc_cache =omap_hwmod_readl (oh, oh->sysconfig->sysc_offs); - oh->_int_flags |= _HWMOD_SYSCONFIG_LOADED; +if (!(oh->sysconfig->sysc_flags &SYSC_NO_CACHE )) + oh->_int_flags |= _HWMOD_SYSCONFIG_LOADED;return 0 ; }
arch/arm/plat-omap/include/plat/omap_hwmod.h +1 -0
@@ -227,6 +227,7 @@ struct omap_hwmod_ocp_if {#define SYSC_HAS_SIDLEMODE (1 << 5)#define SYSC_HAS_MIDLEMODE (1 << 6)#define SYSS_MISSING (1 << 7) +#define SYSC_NO_CACHE (1 << 8)/* omap_hwmod_sysconfig.clockact flags */ #define CLOCKACT_TEST_BOTH 0x0
Signature · 1 line
1.6.6.rc2.5.g49666
Quoted 13 lines
Quoted 13 lines
-----Original Message-----
From: Paul Walmsley [mailto:[email protected]]
Sent: Tuesday, January 12, 2010 4:02 AM
To: Gopinath, Thara
Cc: [email protected]
Subject: RE: [PATCH] OMAP3: hwmod: Adding flag to prevent caching of sysconfig register.Quoted 1 line · Paul Walmsley
Queued for .33-rc (fixes).
Quoted 7 lines
Quoted 7 lines
By the way, the patch had to be slightly tweaked to apply it since the original was based on the configurable clockactivity offset patch - here's what is queued in the 'for_2.6.33rc_d' branch of
git://git.pwsan.com/linux-2.6- Paul
Thanks Paul
Regards
Thara
Quoted 29 lines
Quoted 29 lines
-----Original Message-----
From: Paul Walmsley [mailto:[email protected]]
Sent: Tuesday, January 12, 2010 3:51 AM
To: Gopinath, Thara
Cc: [email protected]
Subject: RE: [PATCH] OMAP3: hwmod: Adding flag to prevent caching of sysconfig register.Quoted 18 lines · Thara
Quoted 17 lines
Quoted 17 lines
-----Original Message-----
From: Paul Walmsley [mailto:[email protected]]
Sent: Wednesday, January 06, 2010 6:02 AM
To: Gopinath, Thara
Cc: [email protected]
Subject: RE: [PATCH] OMAP3: hwmod: Adding flag to prevent caching of sysconfig register.Quoted 1 line · Thara
Hi Paul,Kevin.. Does this patch look ok?
Hello Thara,
looking over this patch. Nice job on the descriptive patch comment; it explains the problem well. What do you think about a slightly different approach -- that is, to add a hook to the hwmod code to invalidate the cache if the module's powerdomain has lost context?
Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
It should be possible but I feel it is a bit cumbersome. Couple of reasons I have.
a. Some modules like smartreflex does not have any power domain associated with it.Aren't the SmartReflex modules in their own powerdomain that changes with the CORE powerdomain?
Hmmmm I think Smartreflex is in Core poweerdomain but sr1_fclk and sr2_fclk are in the wakeup domain. Slightly complicated :-(
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
b. Invalidating the cache is not needed for all modules even if the module powerdomain context is lost. This is needed only for modules which employ always restore mechanism. All other modules will do explicit context save and restore of its registers
I think we'll want to move all SYSCONFIG manipulation into the hwmod layer, once it is in place.
Agreed.
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
c. Getting whether power domain context is lost or not is not very straight forward. If I am not mistaken the only way is to keep tab of the powerdomain counters through
omap_pm_get_dev_context_loss_count. I might be mistaken.Yeah. Getting the hook in will take a little bit of work.
Quoted 7 lines
Quoted 7 lines
Anyway, for the time being, we can take this patch. But the other reason that this approach doesn't appeal is that this new flag doesn't have anything to do with the hardware -- it's just a software workaround for device driver code. Ideally, all of these flags should be generatable based on hardware data only. Flags that pertain to how the device driver works belong in a different place. Perhaps they should still be connected to the hwmod code, but they should exist separately from the hwmod data.
Ah.. yes. It will be difficult to auto generate this flag based on h/w info. Maybe once appropriate hooks are available for powerdomain context lost or not, we can do away with this. Else if there are too may of these flags depending on device driver implementations we can generate a separate header file and a hook to these flags in hwmod structure.
Quoted 5 lines
Quoted 5 lines
Queued for .33-rc (fixes).
- Paul
Paul Walmsley
maintainerHi Thara,
Quoted 8 lines · Thara
Quoted 5 lines
Quoted 5 lines
-----Original Message-----
From: Paul Walmsley [mailto:[email protected]]Aren't the SmartReflex modules in their own powerdomain that changes with the CORE powerdomain?
Hmmmm I think Smartreflex is in Core poweerdomain but
sr1_fclkandsr2_fclkare in the wakeup domain. Slightly complicated :-(
According to the TRM rev W figure 4-18 "Device Power Domains", at least, the SmartReflex modules are in their own powerdomain.
- Paul
Hi Paul,
Quoted 1 line
Texas Instruments France SA, 821 Avenue Jack Kilby, 06270 Villeneuve Loubet. 036 420 040 R.C.S Antibes. Capital de EUR 753.920
-----Original Message-----
Quoted 29 lines
From: [email protected] [mailto:linux-omap- [email protected]] On Behalf Of Paul Walmsley
Sent: Monday, January 11, 2010 11:21 PM
To: Gopinath, Thara
Cc: [email protected]
Subject: RE: [PATCH] OMAP3: hwmod: Adding flag to prevent caching of sysconfig register.Quoted 6 lines · Thara
Quoted 6 lines
Quoted 6 lines
-----Original Message-----
From: Paul Walmsley [mailto:[email protected]]
Sent: Wednesday, January 06, 2010 6:02 AM
To: Gopinath, Thara
Cc: [email protected]
Subject: RE: [PATCH] OMAP3: hwmod: Adding flag to prevent caching ofsysconfig register.
Quoted 12 lines
Quoted 11 lines
Quoted 11 lines · Thara
Quoted 2 lines
Hi Paul,Kevin.. Does this patch look ok?
Hello Thara,
looking over this patch. Nice job on the descriptive patch comment; it explains the problem well. What do you think about a slightly different approach -- that is, to add a hook to the hwmod code to invalidate the cache if the module's powerdomain has lost context?
Quoted 7 lines
Quoted 4 lines
It should be possible but I feel it is a bit cumbersome. Couple of reasons I have.
a. Some modules like smartreflex does not have any power domain associated with it.Aren't the SmartReflex modules in their own powerdomain that changes with the CORE powerdomain?
Yes, both SR1 and SR2 are inside a "tactical" power domain, without any SW control. It follows the CORE power domain state. This is in fact not very well explained in the TRM.
Regards,
Benoit
Quoted 32 lines
Quoted 5 lines
b. Invalidating the cache is not needed for all modules even if the module powerdomain context is lost. This is needed only for modules which employ always restore mechanism. All other modules will do explicit context save and restore of its registers
I think we'll want to move all SYSCONFIG manipulation into the hwmod layer, once it is in place.
Quoted 4 lines
c. Getting whether power domain context is lost or not is not very straight forward. If I am not mistaken the only way is to keep tab of the powerdomain counters through
omap_pm_get_dev_context_loss_count. I might be mistaken.Yeah. Getting the hook in will take a little bit of work.
Anyway, for the time being, we can take this patch. But the other reason that this approach doesn't appeal is that this new flag doesn't have anything to do with the hardware -- it's just a software workaround for device driver code. Ideally, all of these flags should be generatable based on hardware data only. Flags that pertain to how the device driver works belong in a different place. Perhaps they should still be connected to the hwmod code, but they should exist separately from the hwmod data.
Queued for .33-rc (fixes).
- Paul
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html