Skip to contentSkip to conversation

Commit "ARM: CPU: arm926ejs: Consolidate cache routines to common file" breaks u-boot on Dreamplug

U-Boot Leigh Brown 4 participants 6 messages Feb 27, 2019 – Feb 28, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hello,

Vagrant Cascadian asked for people to test the version of u-boot packaged
for Debian Buster. I tested u-boot on my Dreamplug and found it was not working correctly. I raised a bug for Debian[1] but I have also tested with the mainline version of u-boot and found the same issues.

The first issue is that the following commit caused u-boot to no longer be able to access usb storage on the Dreamplug:

commit 93b283d49f933f95f3a6f40762936f454ac655a8

Author: Adam Ford <[email protected]>
Date:   Thu Aug 16 13:23:11 2018 -0500

ARM: CPU: arm926ejs: Consolidate cache routines to common file

Four different boards had different options for enabling cache that were virtually all the same. This consolidates these common functions into arch/arm/cpu/arm926ejs/cache.c

This also has the positive side-effect of enabling cache on the Davinci (da850) boards.

[trini: Add mach-at91 to the list of consolidations]

I don't have much knowledge of ARM caching, but the following patch makes
it work again on my Dreamplug.

arch/arm/mach-kirkwood/cpu.c +0 -1
index d54de53f31..8a065d73ae 100644
@@ -291,7 +291,6 @@ int arch_misc_init(void)
  	temp |= (1 << 22);
  	writefr_extra_feature_reg(temp);
 
-	icache_enable();
  	/* Change reset vector to address 0x0 */
  	temp = get_cr();
  	set_cr(temp & ~CR_V);
include/configs/dreamplug.h +2 -0
index f4d717213c..6348935c68 100644
@@ -79,4 +79,6 @@
  #define CONFIG_SYS_ATA_IDE0_OFFSET	MV_SATA_PORT0_OFFSET
  #endif /*CONFIG_MVSATA_IDE*/
 
+#define CONFIG_SYS_DCACHE_OFF
+
  #endif /* _CONFIG_DREAMPLUG_H */

I'd be grateful if someone could take a look. If you need me to do any testing or provide any more information, please let me know.

I found another issue (documented in the same bug). I'll send a separate
email about that.

Regards,

Leigh.

--
[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=923379
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dreamplug_dcache.patch
Type: text/x-diff
Size: 736 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190227/29a5b7b2/attachment.patch>

#1 lore raw
Quoted 9 lines · Leigh Brown

Hello,

Vagrant Cascadian asked for people to test the version of u-boot packaged
for Debian Buster. I tested u-boot on my Dreamplug and found it was not working correctly. I raised a bug for Debian[1] but I have also tested with the mainline version of u-boot and found the same issues.

Quoted 7 lines

The first issue is that the following commit caused u-boot to no longer be able to access usb storage on the Dreamplug:

commit 93b283d49f933f95f3a6f40762936f454ac655a8

Author: Adam Ford <[email protected]>
Date:   Thu Aug 16 13:23:11 2018 -0500

Sorry about that.

Quoted 9 lines

ARM: CPU: arm926ejs: Consolidate cache routines to common file

Four different boards had different options for enabling cache that were virtually all the same. This consolidates these common functions into arch/arm/cpu/arm926ejs/cache.c

This also has the positive side-effect of enabling cache on the Davinci (da850) boards.

Quoted 7 lines
[trini: Add mach-at91 to the list of consolidations]

I don't have much knowledge of ARM caching, but the following patch makes
it work again on my Dreamplug.

I am not that familiar with the ARM caching either, I was just hoping to enable it on the da850 board and compared the various code chunks between ARM 926 boards and noticed a common thread. Tom took it and added some more.

arch/arm/mach-kirkwood/cpu.c int arch_misc_init(void) · line 293

Quoted 9 lines
arch/arm/mach-kirkwood/cpu.c +0 -0
index d54de53f31..8a065d73ae 100644
@@ -291,7 +291,6 @@ int arch_misc_init(void)
        temp |= (1 << 22);
        writefr_extra_feature_reg(temp);
 

#ifndef CONFIG_SYS_ICACHE_OFF

arch/arm/mach-kirkwood/cpu.c int arch_misc_init(void) · line 294

Quoted 1 line
arch/arm/mach-kirkwood/cpu.c +0 -1
-       icache_enable();

#endif

Instead of commenting out that line, try defining CONFIG_SYS_ICACHE_OFF in your header like you did for the CONFIG_SYS_DCACHE_OFF and encapsulate the function call with ifdef's so any other kirkwood processors can enable/disable it independently.

include/configs/dreamplug.h line 82

Quoted 12 lines
arch/arm/mach-kirkwood/cpu.c +0 -0
        /* Change reset vector to address 0x0 */
        temp = get_cr();
        set_cr(temp & ~CR_V);
include/configs/dreamplug.h +1 -0
index f4d717213c..6348935c68 100644
@@ -79,4 +79,6 @@
  #define CONFIG_SYS_ATA_IDE0_OFFSET    MV_SATA_PORT0_OFFSET
  #endif /*CONFIG_MVSATA_IDE*/
 
+#define CONFIG_SYS_DCACHE_OFF

#define CONFIG_SYS_ICACHE_OFF

Quoted 16 lines
include/configs/dreamplug.h +1 -0
+
  #endif /* _CONFIG_DREAMPLUG_H */

I'd be grateful if someone could take a look. If you need me to do any testing or provide any more information, please let me know.

I found another issue (documented in the same bug). I'll send a separate
email about that.

Regards,

Leigh.

--
[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=923379

#2 lore raw

Hi Adam,

Thanks very much for your response.

Quoted 37 lines · Adam Ford
Quoted 11 lines · Leigh Brown

Hello,

Vagrant Cascadian asked for people to test the version of u-boot packaged
for Debian Buster. I tested u-boot on my Dreamplug and found it was not
working correctly. I raised a bug for Debian[1] but I have also tested
with the mainline version of u-boot and found the same issues.

Quoted 8 lines

The first issue is that the following commit caused u-boot to no longer
be able to access usb storage on the Dreamplug:

commit 93b283d49f933f95f3a6f40762936f454ac655a8

Author: Adam Ford <[email protected]>
Date:   Thu Aug 16 13:23:11 2018 -0500

Sorry about that.

Quoted 13 lines

ARM: CPU: arm926ejs: Consolidate cache routines to common file

Four different boards had different options for enabling cache that were virtually all the same. This consolidates these common functions into arch/arm/cpu/arm926ejs/cache.c

This also has the positive side-effect of enabling cache on the Davinci (da850) boards.

[trini: Add mach-at91 to the list of consolidations]
Quoted 8 lines
Quoted 3 lines

I don't have much knowledge of ARM caching, but the following patch makes
it work again on my Dreamplug.

I am not that familiar with the ARM caching either, I was just hoping to enable it on the da850 board and compared the various code chunks between ARM 926 boards and noticed a common thread. Tom took it and added some more.

Okay. Hopefully Tom can comment on my proposed fixes.

Quoted 12 lines

arch/arm/mach-kirkwood/cpu.c int arch_misc_init(void) · line 293

Quoted 11 lines
arch/arm/mach-kirkwood/cpu.c +0 -0
index d54de53f31..8a065d73ae 100644
@@ -291,7 +291,6 @@ int arch_misc_init(void)
        temp |= (1 << 22);
        writefr_extra_feature_reg(temp);
 

#ifndef CONFIG_SYS_ICACHE_OFF

Quoted 7 lines

arch/arm/mach-kirkwood/cpu.c int arch_misc_init(void) · line 294

Quoted 1 line
arch/arm/mach-kirkwood/cpu.c +0 -1
-       icache_enable();

#endif

Instead of commenting out that line, try defining CONFIG_SYS_ICACHE_OFF in your header like you did for the CONFIG_SYS_DCACHE_OFF and encapsulate the function call with ifdef's so any other kirkwood processors can enable/disable it independently.

The reason I removed that line is because icache_enable() is called from enable_caches() which is called from initr_caches() which is in the list of functions in init_sequence_r[] prior to arch_misc_init(). In other words, it will already have been called by then if CONFIG_SYS_ICACHE_OFF is not set. Does that make sense?

Quoted 11 lines
Quoted 11 lines
arch/arm/mach-kirkwood/cpu.c +0 -0
        /* Change reset vector to address 0x0 */
        temp = get_cr();
        set_cr(temp & ~CR_V);
include/configs/dreamplug.h +0 -0
index f4d717213c..6348935c68 100644
@@ -79,4 +79,6 @@
  #define CONFIG_SYS_ATA_IDE0_OFFSET    MV_SATA_PORT0_OFFSET
  #endif /*CONFIG_MVSATA_IDE*/
 
Quoted 2 lines

include/configs/dreamplug.h line 82

Quoted 1 line
include/configs/dreamplug.h +1 -0
+#define CONFIG_SYS_DCACHE_OFF

#define CONFIG_SYS_ICACHE_OFF

The reason I have not done this is because the Kirkwood arch_misc_init() function was already unconditionally enabling the instruction cache, so we want to retain that behaviour - I think. I hope that makes sense.

Quoted 11 lines
Quoted 11 lines
include/configs/dreamplug.h +1 -0
+
  #endif /* _CONFIG_DREAMPLUG_H */

I'd be grateful if someone could take a look. If you need me to do any
testing or provide any more information, please let me know.

I found another issue (documented in the same bug). I'll send a separate
email about that.

Quoted 6 lines
Quoted 6 lines

Regards,

Leigh.

--
[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=923379

Regards,

Leigh.

#3 lore raw
Quoted 74 lines · Leigh Brown

Hi Adam,

Thanks very much for your response.

Quoted 37 lines · Adam Ford
Quoted 11 lines · Leigh Brown

Hello,

Vagrant Cascadian asked for people to test the version of u-boot packaged
for Debian Buster. I tested u-boot on my Dreamplug and found it was not
working correctly. I raised a bug for Debian[1] but I have also tested
with the mainline version of u-boot and found the same issues.

Quoted 8 lines

The first issue is that the following commit caused u-boot to no longer
be able to access usb storage on the Dreamplug:

commit 93b283d49f933f95f3a6f40762936f454ac655a8

Author: Adam Ford <[email protected]>
Date:   Thu Aug 16 13:23:11 2018 -0500

Sorry about that.

Quoted 13 lines

ARM: CPU: arm926ejs: Consolidate cache routines to common file

Four different boards had different options for enabling cache that were virtually all the same. This consolidates these common functions into arch/arm/cpu/arm926ejs/cache.c

This also has the positive side-effect of enabling cache on the Davinci (da850) boards.

[trini: Add mach-at91 to the list of consolidations]
Quoted 8 lines
Quoted 3 lines

I don't have much knowledge of ARM caching, but the following patch makes
it work again on my Dreamplug.

I am not that familiar with the ARM caching either, I was just hoping to enable it on the da850 board and compared the various code chunks between ARM 926 boards and noticed a common thread. Tom took it and added some more.

Okay. Hopefully Tom can comment on my proposed fixes.

Quoted 12 lines

arch/arm/mach-kirkwood/cpu.c int arch_misc_init(void) · line 293

Quoted 11 lines
arch/arm/mach-kirkwood/cpu.c +0 -0
index d54de53f31..8a065d73ae 100644
@@ -291,7 +291,6 @@ int arch_misc_init(void)
        temp |= (1 << 22);
        writefr_extra_feature_reg(temp);
 

#ifndef CONFIG_SYS_ICACHE_OFF

Quoted 7 lines

arch/arm/mach-kirkwood/cpu.c int arch_misc_init(void) · line 294

Quoted 1 line
arch/arm/mach-kirkwood/cpu.c +0 -1
-       icache_enable();

#endif

Instead of commenting out that line, try defining CONFIG_SYS_ICACHE_OFF in your header like you did for the CONFIG_SYS_DCACHE_OFF and encapsulate the function call with ifdef's so any other kirkwood processors can enable/disable it independently.

Quoted 5 lines

The reason I removed that line is because icache_enable() is called from enable_caches() which is called from initr_caches() which is in the list of functions in init_sequence_r[] prior to arch_misc_init(). In other words, it will already have been called by then if CONFIG_SYS_ICACHE_OFF is not set. Does that make sense?

That makes a lot of sense to me.

Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
arch/arm/mach-kirkwood/cpu.c +0 -0
        /* Change reset vector to address 0x0 */
        temp = get_cr();
        set_cr(temp & ~CR_V);
include/configs/dreamplug.h +0 -0
index f4d717213c..6348935c68 100644
@@ -79,4 +79,6 @@
  #define CONFIG_SYS_ATA_IDE0_OFFSET    MV_SATA_PORT0_OFFSET
  #endif /*CONFIG_MVSATA_IDE*/
 
Quoted 6 lines
Quoted 2 lines

include/configs/dreamplug.h line 82

Quoted 1 line
include/configs/dreamplug.h +1 -0
+#define CONFIG_SYS_DCACHE_OFF

#define CONFIG_SYS_ICACHE_OFF

The reason I have not done this is because the Kirkwood arch_misc_init() function was already unconditionally enabling the instruction cache, so we want to retain that behaviour - I think. I hope that makes sense.

That makes a lot of sense too.

adam

Quoted 22 lines
Quoted 12 lines
Quoted 12 lines
include/configs/dreamplug.h +1 -0
+
  #endif /* _CONFIG_DREAMPLUG_H */

I'd be grateful if someone could take a look. If you need me to do any
testing or provide any more information, please let me know.

I found another issue (documented in the same bug). I'll send a separate
email about that.

Quoted 6 lines
Quoted 6 lines

Regards,

Leigh.

--
[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=923379

Regards,

Leigh.

#4 lore raw
In reply to Leigh Brown

Hi Leigh,

Quoted 57 lines · Leigh Brown

Hello,

Vagrant Cascadian asked for people to test the version of u-boot packaged
for Debian Buster. I tested u-boot on my Dreamplug and found it was not working correctly. I raised a bug for Debian[1] but I have also tested with the mainline version of u-boot and found the same issues.

The first issue is that the following commit caused u-boot to no longer be able to access usb storage on the Dreamplug:

commit 93b283d49f933f95f3a6f40762936f454ac655a8

Author: Adam Ford <[email protected]>
Date:   Thu Aug 16 13:23:11 2018 -0500

ARM: CPU: arm926ejs: Consolidate cache routines to common file

Four different boards had different options for enabling cache that were virtually all the same. This consolidates these common functions into arch/arm/cpu/arm926ejs/cache.c

This also has the positive side-effect of enabling cache on the Davinci (da850) boards.

[trini: Add mach-at91 to the list of consolidations]

I don't have much knowledge of ARM caching, but the following patch makes
it work again on my Dreamplug.

arch/arm/mach-kirkwood/cpu.c +0 -1
index d54de53f31..8a065d73ae 100644
@@ -291,7 +291,6 @@ int arch_misc_init(void)
        temp |= (1 << 22);
        writefr_extra_feature_reg(temp);
 
-       icache_enable();
        /* Change reset vector to address 0x0 */
        temp = get_cr();
        set_cr(temp & ~CR_V);
include/configs/dreamplug.h +2 -0
index f4d717213c..6348935c68 100644
@@ -79,4 +79,6 @@
  #define CONFIG_SYS_ATA_IDE0_OFFSET    MV_SATA_PORT0_OFFSET
  #endif /*CONFIG_MVSATA_IDE*/
 
+#define CONFIG_SYS_DCACHE_OFF
+
  #endif /* _CONFIG_DREAMPLUG_H */
Quoted 3 lines

I'd be grateful if someone could take a look. If you need me to do any testing or provide any more information, please let me know.

Thanks for pointing this out. I'd been having a problem like this with the Ethernet interface. I'd been blaming the hardware I was using but your change makes things work for me.

Quoted 13 lines

I found another issue (documented in the same bug). I'll send a separate
email about that.

Regards,

Leigh.

--
[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=923379_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reviewed-by
#5 lore raw
In reply to Leigh Brown

arch/arm/mach-kirkwood/cpu.c

Quoted 32 lines · Leigh Brown

Hello,

Vagrant Cascadian asked for people to test the version of u-boot packaged for Debian Buster. I tested u-boot on my Dreamplug and found it was not working correctly. I raised a bug for Debian[1] but I have also tested with the mainline version of u-boot and found the same issues.

The first issue is that the following commit caused u-boot to no longer be able to access usb storage on the Dreamplug:

commit 93b283d49f933f95f3a6f40762936f454ac655a8

Author: Adam Ford <[email protected]>
Date:   Thu Aug 16 13:23:11 2018 -0500

ARM: CPU: arm926ejs: Consolidate cache routines to common file

Four different boards had different options for enabling cache that were virtually all the same. This consolidates these common functions into arch/arm/cpu/arm926ejs/cache.c

This also has the positive side-effect of enabling cache on the Davinci (da850) boards.

[trini: Add mach-at91 to the list of consolidations]

I don't have much knowledge of ARM caching, but the following patch makes it work again on my Dreamplug.

arch/arm/mach-kirkwood/cpu.c +0 -0
index d54de53f31..8a065d73ae 100644

Thanks for digging into this. Based on the whole thread, yes, this makes sense.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190228/e6c8caab/attachment.sig>