Skip to contentSkip to conversation

mx53: use CONFIG_SYS_L2CACHE_OFF in config file

PATCH New Jason Liu 4 participants 9 messages Jul 26, 2011 – Jul 28, 2011

lore
Share & tools
lore

Jason Liu

author
#0 lore raw

PATCH 1/1 mx53: use CONFIG_SYS_L2CACHE_OFF in config file

CONFIG_L2_OFF is obsolete after the following commit:

e47f2db5371047eb9bcd115fee084e6a8a92a239
armv7: rename cache related CONFIG flags
Replace the cache related CONFIG flags with more meaningful names. Following are the changes:
CONFIG_L2_OFF -> CONFIG_SYS_L2CACHE_OFF

But the above commit does not clean up all the mx53 board config file. This patch does it by using CONFIG_SYS_L2CACHE_OFF instead of _L2_OFF

Cc Stefano Babic <[email protected]>
---
 include/configs/mx53ard.h  |    2 +-
 include/configs/mx53loco.h |    2 +-
 include/configs/mx53smd.h  |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
include/configs/mx53ard.h +1 -1
index c872510..0e323e6 100644
@@ -29,7 +29,7 @@
 #define CONFIG_DISPLAY_CPUINFO
 #define CONFIG_DISPLAY_BOARDINFO
 
-#define CONFIG_L2_OFF
+#define CONFIG_SYS_L2CACHE_OFF
 
 #include <asm/arch/imx-regs.h>
 
include/configs/mx53loco.h +1 -1
index 544e3fb..bc1b401 100644
@@ -30,7 +30,7 @@
 #define CONFIG_DISPLAY_CPUINFO
 #define CONFIG_DISPLAY_BOARDINFO
 
-#define CONFIG_L2_OFF
+#define CONFIG_SYS_L2CACHE_OFF
 
 #include <asm/arch/imx-regs.h>
 
include/configs/mx53smd.h +1 -1
index 65d5e05..194047b 100644
@@ -29,7 +29,7 @@
 #define CONFIG_DISPLAY_CPUINFO
 #define CONFIG_DISPLAY_BOARDINFO
 
-#define CONFIG_L2_OFF
+#define CONFIG_SYS_L2CACHE_OFF
 
 #include <asm/arch/imx-regs.h>
 
Signature · 1 line
1.7.4.1
#1 lore raw

PATCH 1/1 mx53: use CONFIG_SYS_L2CACHE_OFF in config file

Quoted 11 lines · Jason Liu

CONFIG_L2_OFF is obsolete after the following commit:

e47f2db5371047eb9bcd115fee084e6a8a92a239
armv7: rename cache related CONFIG flags
Replace the cache related CONFIG flags with more meaningful names. Following are the changes:
CONFIG_L2_OFF -> CONFIG_SYS_L2CACHE_OFF

But the above commit does not clean up all the mx53 board config file. This patch does it by using CONFIG_SYS_L2CACHE_OFF instead of _L2_OFF

Hi Jason,

I agree that CONFIG_L2_OFF is obsolete and must be removed. However, I do not see any application of CONFIG_SYS_L2CACHE_OFF.

If I grep into u-boot code, this config is not used at all for i.MX. Indeed, I can find application for OMAP boards:

arch/arm/cpu/armv7/omap3/board.c:#ifndef CONFIG_SYS_L2CACHE_OFF arch/arm/cpu/armv7/omap3/board.c:#ifndef CONFIG_SYS_L2CACHE_OFF arch/arm/cpu/armv7/s5pc1xx/cache.S:#ifndef CONFIG_SYS_L2CACHE_OFF arch/arm/cpu/armv7/omap4/board.c:#ifndef CONFIG_SYS_L2CACHE_OFF

So this setup is usefulness, I think.

By the way (and I know it is not the same topic), do you mean maybe CONFIG_SYS_DCACHE_OFF ? Have you read the thread related to cache problems on MX51 ? Maybe we have to disable D_CACHE until we find a fix for the drivers. What do you mean ?

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================
author
#2 lore raw

PATCH 1/1 mx53: use CONFIG_SYS_L2CACHE_OFF in config file

Hi, Stefano,

Quoted 21 lines · Stefano Babic
Quoted 11 lines · Jason Liu

CONFIG_L2_OFF is obsolete after the following commit:

e47f2db5371047eb9bcd115fee084e6a8a92a239
armv7: rename cache related CONFIG flags
Replace the cache related CONFIG flags with more meaningful names. Following are the changes:
CONFIG_L2_OFF ? ? ?-> CONFIG_SYS_L2CACHE_OFF

But the above commit does not clean up all the mx53 board config file. This patch does it by using CONFIG_SYS_L2CACHE_OFF instead of _L2_OFF

Hi Jason,

I agree ?that CONFIG_L2_OFF is obsolete and must be removed. However, I do not see any application of CONFIG_SYS_L2CACHE_OFF.

If I grep into u-boot code, this config is not used at all for i.MX. Indeed, I can find application for OMAP boards:

Quoted 6 lines

arch/arm/cpu/armv7/omap3/board.c:#ifndef CONFIG_SYS_L2CACHE_OFF arch/arm/cpu/armv7/omap3/board.c:#ifndef CONFIG_SYS_L2CACHE_OFF arch/arm/cpu/armv7/s5pc1xx/cache.S:#ifndef CONFIG_SYS_L2CACHE_OFF arch/arm/cpu/armv7/omap4/board.c:#ifndef CONFIG_SYS_L2CACHE_OFF

So this setup is usefulness, I think.

It's used before, if you checkout tag: v2011.06

#ifndef CONFIG_L2_OFF
        /* turn off L2 cache */
        l2_cache_disable();
        /* invalidate L2 cache also */
        invalidate_dcache(get_device_type());
#endif
        i = 0;
        /* mem barrier to sync up things */
        asm("mcr p15, 0, %0, c7, c10, 4": :"r"(i));
#ifndef CONFIG_L2_OFF
        l2_cache_enable();

#endif

I still think we need explicitly disable L2 cache first. If it only omap related, I don't think we need
CONFIG_SYS_L2CACHE_OFF for the global u-boot. If you grep the CONFIG_SYS_L2CACHE_OFF
under include/configs, you will see a lot of define other than omap platform.

Quoted 5 lines

By the way (and I know it is not the same topic), do you mean maybe CONFIG_SYS_DCACHE_OFF ? Have you read the thread related to cache problems on MX51 ? Maybe we have to disable D_CACHE until we find a fix for the drivers. What do you mean ?

Yes, the fec is not working after commit:
c2dd0d45540397704de9b13287417d21049d34c6
armv7: integrate cache maintenance support

It's due to it enable dcache by default if not define CONFIG_SYS_DCACHE_OFF explicitly.
mxc_fec driver need be fixed or re-write to consider cache safe. I agree to disable d-cache first.

Jason

Quoted 11 lines

Best regards,
Stefano Babic

--
=====================================================================
DENX Software Engineering GmbH, ? ? MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 ?Email: office at denx.de
=====================================================================

#3 lore raw

PATCH 1/1 mx53: use CONFIG_SYS_L2CACHE_OFF in config file

Hi, Stefano,

2011/7/26 Jason Hui <[email protected]>:

Quoted 60 lines

Hi, Stefano,

Quoted 21 lines · Stefano Babic
Quoted 11 lines · Jason Liu

CONFIG_L2_OFF is obsolete after the following commit:

e47f2db5371047eb9bcd115fee084e6a8a92a239
armv7: rename cache related CONFIG flags
Replace the cache related CONFIG flags with more meaningful names. Following are the changes:
CONFIG_L2_OFF ? ? ?-> CONFIG_SYS_L2CACHE_OFF

But the above commit does not clean up all the mx53 board config file. This patch does it by using CONFIG_SYS_L2CACHE_OFF instead of _L2_OFF

Hi Jason,

I agree ?that CONFIG_L2_OFF is obsolete and must be removed. However, I do not see any application of CONFIG_SYS_L2CACHE_OFF.

If I grep into u-boot code, this config is not used at all for i.MX. Indeed, I can find application for OMAP boards:

Quoted 6 lines

arch/arm/cpu/armv7/omap3/board.c:#ifndef CONFIG_SYS_L2CACHE_OFF arch/arm/cpu/armv7/omap3/board.c:#ifndef CONFIG_SYS_L2CACHE_OFF arch/arm/cpu/armv7/s5pc1xx/cache.S:#ifndef CONFIG_SYS_L2CACHE_OFF arch/arm/cpu/armv7/omap4/board.c:#ifndef CONFIG_SYS_L2CACHE_OFF

So this setup is usefulness, I think.

It's used before, if you checkout tag: v2011.06

#ifndef CONFIG_L2_OFF
? ? ? ?/* turn off L2 cache */
? ? ? ?l2_cache_disable();
? ? ? ?/* invalidate L2 cache also */
? ? ? ?invalidate_dcache(get_device_type()); #endif
? ? ? ?i = 0;
? ? ? ?/* mem barrier to sync up things */ ? ? ? ?asm("mcr p15, 0, %0, c7, c10, 4": :"r"(i));

#ifndef CONFIG_L2_OFF
? ? ? ?l2_cache_enable();
#endif

I still think we need explicitly disable L2 cache first. If it only omap related, I don't think we need
CONFIG_SYS_L2CACHE_OFF for the global u-boot. If you grep the CONFIG_SYS_L2CACHE_OFF
under include/configs, you will see a lot of define other than omap platform.

Quoted 5 lines

By the way (and I know it is not the same topic), do you mean maybe CONFIG_SYS_DCACHE_OFF ? Have you read the thread related to cache problems on MX51 ? Maybe we have to disable D_CACHE until we find a fix for the drivers. What do you mean ?

Quoted 8 lines

Yes, the fec is not working after commit:
c2dd0d45540397704de9b13287417d21049d34c6
armv7: integrate cache maintenance support

It's due to it enable dcache by default if not define CONFIG_SYS_DCACHE_OFF explicitly.
mxc_fec driver need be fixed or re-write to consider cache safe. I agree to disable d-cache first.

Do I need submit patch to disable D-CACHE first? And another issue for imx51 is that
mmc command does not work correctly sometimes such as saveenv. Do you notice that?

Jason

Quoted 19 lines

Jason

Quoted 11 lines

Best regards,
Stefano Babic

--
=====================================================================
DENX Software Engineering GmbH, ? ? MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 ?Email: office at denx.de
=====================================================================

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

#4 lore raw

PATCH 1/1 mx53: use CONFIG_SYS_L2CACHE_OFF in config file

Quoted 1 line · Jason Liu

Hi, Stefano,

Hi Jason,

Quoted 13 lines
Quoted 13 lines

It's used before, if you checkout tag: v2011.06

#ifndef CONFIG_L2_OFF
       /* turn off L2 cache */
       l2_cache_disable();
       /* invalidate L2 cache also */
       invalidate_dcache(get_device_type());
#endif
       i = 0;
       /* mem barrier to sync up things */
       asm("mcr p15, 0, %0, c7, c10, 4": :"r"(i));
Quoted 3 lines
Quoted 3 lines
#ifndef CONFIG_L2_OFF
       l2_cache_enable();

#endif

However, as far as I can understand, L2 cache is disabled until explicitely enabled.

Quoted 3 lines
Quoted 3 lines

I still think we need explicitly disable L2 cache first

I am still checking this point. My concern is to understand if in the current code we need to do something or not. If there is no code to enable L2 cache (I have not found), there should be no need to disable it. After a reset, L2 cache is disabled, am I right ?
Why do you think we have to explicitely disable it ? Am I missing something ?

Quoted 5 lines
Quoted 5 lines

. If it only
omap related, I don't think we need
CONFIG_SYS_L2CACHE_OFF for the global u-boot. If you grep the CONFIG_SYS_L2CACHE_OFF
under include/configs, you will see a lot of define other than omap platform.

Nevertheless we have to decide if we need it for the MX5. If we manage enable/disable L2 Cache for the MX5, we need it, else not. As I can see in the actual code, we do not manage L2 Cache.

Quoted 6 lines
Quoted 4 lines

It's due to it enable dcache by default if not define CONFIG_SYS_DCACHE_OFF explicitly.
mxc_fec driver need be fixed or re-write to consider cache safe. I agree to disable d-cache first.

Do I need submit patch to disable D-CACHE first?

let's see if we agree on the following points:

- CONFIG_L2_OFF is obsolete, as you pointed out, and must be removed

- CONFIG_SYS_L2CACHE_OFF is needed for MX5 if we have code to enable / disable it. Let me know if you agree that L2 cache is disabled after a reset. Then we do not need this define until we explicitely enable it as default, as now for D cache.

- because of D Cache issues in the driver, it is better to disable D Cache for MX5 processors.

I think, if we agree on these point, we can manage the changes in a single patch (changes are made on the same files, that is the configuration file for the boards), and it is enough to add a useful comment to explain what we do.

Quoted 4 lines

And another issue
for imx51 is that
mmc command does not work correctly sometimes such as saveenv. Do you notice that?

I admit I have not tested recently and I have not noted this issue. Last time was after some changes in MMC code.

I am sure we get the same issues for D Cache as for the FEC. In fact, for powerpc the fsl_esdhc.c enables cache snooping and does not need to invalidate buffers. We have no counterpart for MX5.

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================
#5 lore raw

PATCH 1/1 mx53: use CONFIG_SYS_L2CACHE_OFF in config file

Hi, stefano,

2011/7/28 Stefano Babic <[email protected]>:

Quoted 18 lines · Jason Liu
Quoted 1 line

Hi, Stefano,

Hi Jason,

Quoted 13 lines
Quoted 13 lines

It's used before, if you checkout tag: v2011.06

#ifndef CONFIG_L2_OFF
? ? ? ?/* turn off L2 cache */
? ? ? ?l2_cache_disable();
? ? ? ?/* invalidate L2 cache also */
? ? ? ?invalidate_dcache(get_device_type()); #endif
? ? ? ?i = 0;
? ? ? ?/* mem barrier to sync up things */ ? ? ? ?asm("mcr p15, 0, %0, c7, c10, 4": :"r"(i));

Quoted 6 lines
Quoted 3 lines
Quoted 3 lines

#ifndef CONFIG_L2_OFF
? ? ? ?l2_cache_enable();
#endif

However, as far as I can understand, L2 cache is disabled until explicitely enabled.

Look at the meaning from the name X_OFF, if we define it, it tells people that we want to disable it explicitly. If not define it, it underlying tells that we want to enable it, right? So, if we remove this define L2_OFF from board config file, it may cause confuse since we don't want to enable it now.

Quoted 11 lines
Quoted 4 lines
Quoted 4 lines

I still think we need explicitly disable L2 cache first

I am still checking this point. My concern is to understand if in the current code we need to do something or not. If there is no code to enable L2 cache (I have not found), there should be no need to disable it. After a reset, L2 cache is disabled, am I right ?
Why do you think we have to explicitely disable it ? Am I missing something ?

Currently, MX5 will disable L2 after reset. some points as above.

Quoted 10 lines
Quoted 6 lines
Quoted 6 lines

. If it only
omap related, I don't think we need
CONFIG_SYS_L2CACHE_OFF for the global u-boot. If you grep the CONFIG_SYS_L2CACHE_OFF
under include/configs, you will see a lot of define other than omap platform.

Nevertheless we have to decide if we need it for the MX5. If we manage enable/disable L2 Cache for the MX5, we need it, else not. As I can see in the actual code, we do not manage L2 Cache.

Yes, currently, we don't manage L2.
But, I don't know whether the common code will be changed in the future, if we don't disable L2 explicitly, it will enable L2 by default just like d-cache.

Quoted 17 lines
Quoted 7 lines
Quoted 5 lines

It's due to it enable dcache by default if not define CONFIG_SYS_DCACHE_OFF explicitly.
mxc_fec driver need be fixed or re-write to consider cache safe. I agree to disable d-cache first.

Do I need submit patch to disable D-CACHE first?

let's see if we agree on the following points:

- CONFIG_L2_OFF is obsolete, as you pointed out, and must be removed

- CONFIG_SYS_L2CACHE_OFF is needed for MX5 if we have code to enable / disable it. Let me know if you agree that L2 cache is disabled after a reset. Then we do not need this define until we explicitely enable it as default, as now for D cache.

Quoted 7 lines

- because of D Cache issues in the driver, it is better to disable D Cache for MX5 processors.

I think, if we agree on these point, we can manage the changes in a single patch (changes are made on the same files, that is the configuration file for the boards), and it is enough to add a useful comment to explain what we do.

OK, after get agreement, I will do it soon with single patch.

Quoted 6 lines
Quoted 5 lines

?And another issue
for imx51 is that
mmc command does not work correctly sometimes such as saveenv. Do you notice that?

Quoted 6 lines

I admit I have not tested recently and I have not noted this issue. Last time was after some changes in MMC code.

I am sure we get the same issues for D Cache as for the FEC. In fact, for powerpc the fsl_esdhc.c enables cache snooping and does not need to invalidate buffers. We have no counterpart for MX5.

Yes, correct.

Jason

Quoted 11 lines

Best regards,
Stefano Babic

--
=====================================================================
DENX Software Engineering GmbH, ? ? MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 ?Email: office at denx.de
=====================================================================

#6 lore raw

PATCH 1/1 mx53: use CONFIG_SYS_L2CACHE_OFF in config file

Quoted 1 line · Jason Liu

Hi, stefano,

Hi Jason,

Quoted 2 lines

Look at the meaning from the name X_OFF, if we define it, it tells people that we want to disable it explicitly.

Yes, but is only dead code for MX5. It has sense only if we add l2_cache_enable() and disable functions.

Quoted 2 lines

If not define it, it underlying
tells that we want to enable it, right?

No, it says nothing. A lot of boards has not set this CONFIG, but this does not mean that L2 cache is enabled.

Quoted 3 lines

So, if we remove this define L2_OFF
from board config file, it may cause confuse since we don't want to enable it now.

IMHO it is confusing if we add it.

If we set them into the config file, it means that the L2 Cache is enable simply dropping it, and this is not true, as there is not yet support. Better to add it when we have really support for it.

Quoted 8 lines
Quoted 6 lines

I am still checking this point. My concern is to understand if in the current code we need to do something or not. If there is no code to enable L2 cache (I have not found), there should be no need to disable it. After a reset, L2 cache is disabled, am I right ?
Why do you think we have to explicitely disable it ? Am I missing something ?

Currently, MX5 will disable L2 after reset. some points as above.

Ok, we agree

Quoted 4 lines

Yes, currently, we don't manage L2.
But, I don't know whether the common code will be changed in the future, if we don't disable L2 explicitly, it will enable L2 by default just like d-cache.

Well, we will check this issue when it will be needed. We cannot know the future, it coul also be there is support for L2 Cache at that moment for the i.MX5.

Quoted 6 lines
Quoted 4 lines

I think, if we agree on these point, we can manage the changes in a single patch (changes are made on the same files, that is the configuration file for the boards), and it is enough to add a useful comment to explain what we do.

OK, after get agreement, I will do it soon with single patch.

Ok, I think we agree how to proceed ;-)

Quoted 5 lines
Quoted 3 lines

I am sure we get the same issues for D Cache as for the FEC. In fact, for powerpc the fsl_esdhc.c enables cache snooping and does not need to invalidate buffers. We have no counterpart for MX5.

Yes, correct.

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================
#7 lore raw

PATCH 1/1 mx53: use CONFIG_SYS_L2CACHE_OFF in config file

In reply to Jason Liu

Dear Jason Liu,

Quoted 8 lines · In message <[email protected]> you wrote:

CONFIG_L2_OFF is obsolete after the following commit:

e47f2db5371047eb9bcd115fee084e6a8a92a239
armv7: rename cache related CONFIG flags
Replace the cache related CONFIG flags with more meaningful names. Following are the changes:
CONFIG_L2_OFF -> CONFIG_SYS_L2CACHE_OFF

Quoted 5 lines

But the above commit does not clean up all the mx53 board config file. This patch does it by using CONFIG_SYS_L2CACHE_OFF instead of _L2_OFF

Cc Stefano Babic <[email protected]>

why are you posting a second version of this patch just a few minutes after the first one, and witrhout any indication ifd there are any differences between the two versions, and what these differences might be?

Please STOP doing this!

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The faster I go, the behinder I get.                 -- Lewis Carroll
#8 lore raw

PATCH 1/1 mx53: use CONFIG_SYS_L2CACHE_OFF in config file

Hi, Wolfgang,

2011/7/26 Wolfgang Denk <[email protected]>:

Quoted 17 lines

Dear Jason Liu,

Quoted 8 lines · In message <[email protected]> you wrote:

CONFIG_L2_OFF is obsolete after the following commit:

e47f2db5371047eb9bcd115fee084e6a8a92a239
armv7: rename cache related CONFIG flags
Replace the cache related CONFIG flags with more meaningful names. Following are the changes:
CONFIG_L2_OFF ? ? ?-> CONFIG_SYS_L2CACHE_OFF

Quoted 5 lines

But the above commit does not clean up all the mx53 board config file. This patch does it by using CONFIG_SYS_L2CACHE_OFF instead of _L2_OFF

Cc Stefano Babic <[email protected]>
Quoted 6 lines

why are you posting a second version of this patch just a few minutes after the first one, and witrhout any indication ifd there are any differences between the two versions, and what these differences might be?

Please STOP doing this!

It's my fault to send out the second email when I thought the previous email was not show up in mail-list.
will take care to avoid it later. Sorry for the noise.

Jason

Quoted 14 lines

Wolfgang Denk

--
DENX Software Engineering GmbH, ? ? MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de The faster I go, the behinder I get. ? ? ? ? ? ? ? ? -- Lewis Carroll
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot