Acked

2024-06-24 Thread Angelo Dureghello

Hi Tom,

Acked-by: Angelo Dureghello 


thanks,
angelo

On 19/06/24 11:27 PM, Tom Rini wrote:

Implement a weak default version of flush_dcache_all which is based on
the ARM default, which is to flush the entire range via
flush_dcache_range(...).

Signed-off-by: Tom Rini 
---
Cc: Huan Wang 
Cc: Angelo Dureghello 
---
  arch/m68k/lib/cache.c | 9 +
  1 file changed, 9 insertions(+)

diff --git a/arch/m68k/lib/cache.c b/arch/m68k/lib/cache.c
index de04124404cf..dab834c1cbd8 100644
--- a/arch/m68k/lib/cache.c
+++ b/arch/m68k/lib/cache.c
@@ -134,6 +134,15 @@ void dcache_invalid(void)
  #endif
  }
  
+/*

+ * Default implementation:
+ * do a range flush for the entire range
+ */
+__weak void flush_dcache_all(void)
+{
+   flush_dcache_range(0, ~0);
+}
+
  __weak void invalidate_dcache_range(unsigned long start, unsigned long stop)
  {
/* An empty stub, real implementation should be in platform code */


Acked

2024-05-29 Thread Angelo Dureghello

Hi Rasmus,


On 28/05/24 1:13 PM, Rasmus Villemoes wrote:

watchdog_reset is no more. That is, it is no longer called from
anywhere, so any leftover definitions are just dead weight, and
references in comments need to be updated.

I don't have access to any m68k, sh or powerpc boards. Only lightly
compile-tested.

Apart from the two sh4 patches, these are independent of each other
and can be applied individually.


Thanks for the cleanup,

Acked-by: Angelo Dureghello 



Cc: Angelo Dureghello 
Cc: Christophe Leroy 
Cc: Huan Wang 
Cc: Nobuhiro Iwamatsu 

Rasmus Villemoes (7):
   m68k: remove dead code
   wdt-uclass: watchdog_reset cleanup
   serial: ns16550: fix comment to mention schedule instead of
 watchdog_reset
   sh4: move reset_cpu() from watchdog.c to cpu.c
   sh4: remove watchdog.c file
   powerpc: mpc83xx: remove unused watchdog_reset() function
   powerpc: mpc85xx: remove dead watchdog-related code

  arch/m68k/cpu/mcf52x2/cpu.c| 108 -
  arch/powerpc/cpu/mpc83xx/cpu.c |  15 -
  arch/powerpc/cpu/mpc85xx/cpu.c |  31 --
  arch/sh/cpu/sh4/Makefile   |   2 +-
  arch/sh/cpu/sh4/cpu.c  |  10 +++
  arch/sh/cpu/sh4/watchdog.c |  61 ---
  drivers/serial/ns16550.c   |   8 +--
  drivers/watchdog/wdt-uclass.c  |  19 +-
  include/watchdog.h |   3 -
  9 files changed, 17 insertions(+), 240 deletions(-)
  delete mode 100644 arch/sh/cpu/sh4/watchdog.c



Re: [PATCH 78/81] watchdog: Remove and add needed includes

2024-05-02 Thread Angelo Dureghello

Hi Tom,

Acked-by: Angelo Dureghello 


On 02/05/24 3:31 AM, Tom Rini wrote:

Remove  from this driver directory and when needed
add missing include files directly.

Signed-off-by: Tom Rini 
---
Cc: Stefan Roese 
Cc: Tom Rini 
Cc: Ryan Chen 
Cc: Chia-Wei Wang 
Cc: Aspeed BMC SW team 
Cc: Joel Stanley 
Cc: Michal Simek 
Cc: Alex Nemirovsky 
Cc: Huan Wang 
Cc: Angelo Dureghello 
Cc: Ryder Lee 
Cc: Weijie Gao 
Cc: Chunfeng Yun 
Cc: GSS_MTK_Uboot_upstream 
Cc: Simon Glass 
Cc: Priyanka Jain 
Cc: Michael Walle 
Cc: Patrick Delaunay 
Cc: Patrice Chotard 
---
  drivers/watchdog/armada-37xx-wdt.c   | 1 -
  drivers/watchdog/ast2600_wdt.c   | 1 -
  drivers/watchdog/ast_wdt.c   | 1 -
  drivers/watchdog/at91sam9_wdt.c  | 1 -
  drivers/watchdog/bcm6345_wdt.c   | 1 -
  drivers/watchdog/cdns_wdt.c  | 1 -
  drivers/watchdog/cortina_wdt.c   | 1 -
  drivers/watchdog/designware_wdt.c| 1 -
  drivers/watchdog/ftwdt010_wdt.c  | 1 -
  drivers/watchdog/imx_watchdog.c  | 1 -
  drivers/watchdog/mcf_wdt.c   | 2 +-
  drivers/watchdog/mpc8xxx_wdt.c   | 1 -
  drivers/watchdog/mt7621_wdt.c| 1 -
  drivers/watchdog/mtk_wdt.c   | 1 -
  drivers/watchdog/omap_wdt.c  | 1 -
  drivers/watchdog/orion_wdt.c | 1 -
  drivers/watchdog/rti_wdt.c   | 1 -
  drivers/watchdog/s5p_wdt.c   | 1 -
  drivers/watchdog/sandbox_alarm-wdt.c | 1 -
  drivers/watchdog/sandbox_wdt.c   | 1 -
  drivers/watchdog/sbsa_gwdt.c | 1 -
  drivers/watchdog/sl28cpld-wdt.c  | 1 -
  drivers/watchdog/sp805_wdt.c | 1 -
  drivers/watchdog/stm32mp_wdt.c   | 1 -
  drivers/watchdog/tangier_wdt.c   | 1 -
  drivers/watchdog/ulp_wdog.c  | 1 -
  drivers/watchdog/wdt-uclass.c| 1 -
  drivers/watchdog/xilinx_tb_wdt.c | 1 -
  drivers/watchdog/xilinx_wwdt.c   | 1 -
  29 files changed, 1 insertion(+), 29 deletions(-)

diff --git a/drivers/watchdog/armada-37xx-wdt.c 
b/drivers/watchdog/armada-37xx-wdt.c
index e09f5ac9e34e..4b51178e1b8c 100644
--- a/drivers/watchdog/armada-37xx-wdt.c
+++ b/drivers/watchdog/armada-37xx-wdt.c
@@ -5,7 +5,6 @@
   * Marek Behún 
   */
  
-#include 

  #include 
  #include 
  #include 
diff --git a/drivers/watchdog/ast2600_wdt.c b/drivers/watchdog/ast2600_wdt.c
index bc9842089bea..190490f3692b 100644
--- a/drivers/watchdog/ast2600_wdt.c
+++ b/drivers/watchdog/ast2600_wdt.c
@@ -3,7 +3,6 @@
   * Copyright (c) 2020 Aspeed Technology, Inc
   */
  
-#include 

  #include 
  #include 
  #include 
diff --git a/drivers/watchdog/ast_wdt.c b/drivers/watchdog/ast_wdt.c
index f7b5a1adc108..e61e13fdc49d 100644
--- a/drivers/watchdog/ast_wdt.c
+++ b/drivers/watchdog/ast_wdt.c
@@ -3,7 +3,6 @@
   * Copyright 2017 Google, Inc
   */
  
-#include 

  #include 
  #include 
  #include 
diff --git a/drivers/watchdog/at91sam9_wdt.c b/drivers/watchdog/at91sam9_wdt.c
index 647ae325e9ae..c809a8936b89 100644
--- a/drivers/watchdog/at91sam9_wdt.c
+++ b/drivers/watchdog/at91sam9_wdt.c
@@ -18,7 +18,6 @@
  #include 
  #include 
  #include 
-#include 
  #include 
  #include 
  #include 
diff --git a/drivers/watchdog/bcm6345_wdt.c b/drivers/watchdog/bcm6345_wdt.c
index 677b1347ca7a..6ebe901c2b82 100644
--- a/drivers/watchdog/bcm6345_wdt.c
+++ b/drivers/watchdog/bcm6345_wdt.c
@@ -7,7 +7,6 @@
   *Copyright (C) 2008 Florian Fainelli 
   */
  
-#include 

  #include 
  #include 
  #include 
diff --git a/drivers/watchdog/cdns_wdt.c b/drivers/watchdog/cdns_wdt.c
index 743ab6487bcd..cb5a786c5891 100644
--- a/drivers/watchdog/cdns_wdt.c
+++ b/drivers/watchdog/cdns_wdt.c
@@ -6,7 +6,6 @@
   * Author(s): Shreenidhi Shedi 
   */
  
-#include 

  #include 
  #include 
  #include 
diff --git a/drivers/watchdog/cortina_wdt.c b/drivers/watchdog/cortina_wdt.c
index 7ab9d7b2db97..9f09ac0e15ff 100644
--- a/drivers/watchdog/cortina_wdt.c
+++ b/drivers/watchdog/cortina_wdt.c
@@ -4,7 +4,6 @@
   *
   */
  
-#include 

  #include 
  #include 
  #include 
diff --git a/drivers/watchdog/designware_wdt.c 
b/drivers/watchdog/designware_wdt.c
index b22e0ee06a4e..bd9d7105366b 100644
--- a/drivers/watchdog/designware_wdt.c
+++ b/drivers/watchdog/designware_wdt.c
@@ -4,7 +4,6 @@
   */
  
  #include 

-#include 
  #include 
  #include 
  #include 
diff --git a/drivers/watchdog/ftwdt010_wdt.c b/drivers/watchdog/ftwdt010_wdt.c
index 1f5f301b1251..4769b967e527 100644
--- a/drivers/watchdog/ftwdt010_wdt.c
+++ b/drivers/watchdog/ftwdt010_wdt.c
@@ -14,7 +14,6 @@
   * 22/08/2022 Port to DM
   */
  
-#include 

  #include 
  #include 
  #include 
diff --git a/drivers/watchdog/imx_watchdog.c b/drivers/watchdog/imx_watchdog.c
index 894158b304a7..ea770217e590 100644
--- a/drivers/watchdog/imx_watchdog.c
+++ b/drivers/watchdog/imx_watchdog.c
@@ -4,7 +4,6 @@
   * Licensed under the GPL-2 or later.
   */
  
-#include 

  #include 
  #include 
  #include 
diff --git a/drivers/watchdog/mcf_wdt.c b/drivers/watchdog/mcf_wdt.c
index b36488bb5b96..5092a256af0c 100644
--- a/drivers/watchdog

Re: [PATCH 040/149] board: cobra5272: Remove and add needed includes

2024-05-02 Thread Angelo Dureghello

Hi Tom,

Acked-by:Angelo Dureghello 

On 01/05/24 4:41 AM, Tom Rini wrote:

Remove  from this board vendor directory and when needed
add missing include files directly.

Signed-off-by: Tom Rini 
---
Cc: Angelo Dureghello 
---
  board/cobra5272/cobra5272.c | 2 +-
  board/cobra5272/flash.c | 6 +-
  2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/board/cobra5272/cobra5272.c b/board/cobra5272/cobra5272.c
index 69a9df942311..774aa82b57fe 100644
--- a/board/cobra5272/cobra5272.c
+++ b/board/cobra5272/cobra5272.c
@@ -4,7 +4,7 @@
   * Wolfgang Denk, DENX Software Engineering, w...@denx.de.
   */
  
-#include 

+#include 
  #include 
  #include 
  #include 
diff --git a/board/cobra5272/flash.c b/board/cobra5272/flash.c
index 8416af163ad1..157b71da85e8 100644
--- a/board/cobra5272/flash.c
+++ b/board/cobra5272/flash.c
@@ -4,13 +4,17 @@
   * Wolfgang Denk, DENX Software Engineering, w...@denx.de.
   */
  
-#include 

+#include 
  #include 
  #include 
  #include 
  #include 
+#include 
+#include 
  #include 
+#include 
  #include 
+#include 
  
  #define PHYS_FLASH_1 CFG_SYS_FLASH_BASE

  #define FLASH_BANK_SIZE 0x20


Re: [PATCH v3] test/py: reset: Add a test for reset command

2024-03-11 Thread Angelo Dureghello

Hi,

jfyi,

reset support added in qemu
merged as commit d3c79c3974.

Regards,
angelo

On 07/03/24 1:55 PM, Tom Rini wrote:

On Thu, Mar 07, 2024 at 09:26:42AM +0100, Michal Simek wrote:



On 3/7/24 08:56, Angelo Dureghello wrote:

Hi Tom,

On 07/03/24 1:10 AM, Tom Rini wrote:

On Thu, Mar 07, 2024 at 12:36:42AM +0100, Angelo Dureghello wrote:

Hi,

On 05/03/24 1:34 PM, Michal Simek wrote:



On 3/3/24 22:58, Angelo Dureghello wrote:

Hi Tom,

On Tue, Feb 20, 2024 at 01:11:38PM +0530, Love Kumar wrote:

Add a test for reset commands which performs resetting of
CPU, It does COLD reset by default and WARM reset with -w
option. Signed-off-by: Love Kumar 
Reviewed-by: Tom Rini  --- Changes in
v2: - Set bootmode through boardenv if modeboot is not
defined Changes in v3: - Fix the issue with bad pattern
found on console --- test/py/tests/test_reset.py | 61
+ 1 file changed, 61
insertions(+) create mode 100644 test/py/tests/test_reset.py

I had hoped this was all sorted out now, but both this and the
saveenv test cause qemu_m68k to fail now. See:
https://source.denx.de/u-boot/u-boot/-/jobs/791635

looking into this.


Is reset implemented in qemu? It should be skipped if it is not.


yes, seems not implemented

=> reset
=> reset -w
=>
=>

Not finding any trace in the qemu code related to

out_8(>rcr, RCM_RCR_SOFTRST);


Does reset work on the real HW, or can you not test? What I'm wondering
is if we have a missing feature on the board/arch code (and should
disable the reset command) or a problem with QEMU.


I don't have the exact hardware (m5208evb) but:

1) i checked by tracing that on qemu the reset function is properly called

=> reset
resetting, RCR fc0a

2) reset register address is correct. I checked also that writing
directly to it by mw.b does now produce the reset,

=> reset
resetting, RCR fc0a

=> mw.b 0xfc0a 80
=>

So looks not implemented in qemu.


ok. That means that we shouldn't run reset test inside CI loop for this 
platform.


Agreed.  The TEST_PY_TEST_SPEC variable in both of the pipelines can be
used to say "not reset" for this platform in the next rev. It would also
be nice to file a bug report with QEMU too I think. Thanks for digging
in to this everyone.



Re: [PATCH v3] test/py: reset: Add a test for reset command

2024-03-07 Thread Angelo Dureghello

Hi,

On 07/03/24 1:55 PM, Tom Rini wrote:

On Thu, Mar 07, 2024 at 09:26:42AM +0100, Michal Simek wrote:



On 3/7/24 08:56, Angelo Dureghello wrote:

Hi Tom,

On 07/03/24 1:10 AM, Tom Rini wrote:

On Thu, Mar 07, 2024 at 12:36:42AM +0100, Angelo Dureghello wrote:

Hi,

On 05/03/24 1:34 PM, Michal Simek wrote:



On 3/3/24 22:58, Angelo Dureghello wrote:

Hi Tom,

On Tue, Feb 20, 2024 at 01:11:38PM +0530, Love Kumar wrote:

Add a test for reset commands which performs resetting of
CPU, It does COLD reset by default and WARM reset with -w
option. Signed-off-by: Love Kumar 
Reviewed-by: Tom Rini  --- Changes in
v2: - Set bootmode through boardenv if modeboot is not
defined Changes in v3: - Fix the issue with bad pattern
found on console --- test/py/tests/test_reset.py | 61
+ 1 file changed, 61
insertions(+) create mode 100644 test/py/tests/test_reset.py

I had hoped this was all sorted out now, but both this and the
saveenv test cause qemu_m68k to fail now. See:
https://source.denx.de/u-boot/u-boot/-/jobs/791635

looking into this.


Is reset implemented in qemu? It should be skipped if it is not.


yes, seems not implemented

=> reset
=> reset -w
=>
=>

Not finding any trace in the qemu code related to

out_8(>rcr, RCM_RCR_SOFTRST);


Does reset work on the real HW, or can you not test? What I'm wondering
is if we have a missing feature on the board/arch code (and should
disable the reset command) or a problem with QEMU.


I don't have the exact hardware (m5208evb) but:

1) i checked by tracing that on qemu the reset function is properly called

=> reset
resetting, RCR fc0a

2) reset register address is correct. I checked also that writing
directly to it by mw.b does now produce the reset,

=> reset
resetting, RCR fc0a

=> mw.b 0xfc0a 80
=>

So looks not implemented in qemu.


ok. That means that we shouldn't run reset test inside CI loop for this 
platform.


Agreed.  The TEST_PY_TEST_SPEC variable in both of the pipelines can be
used to say "not reset" for this platform in the next rev. It would also
be nice to file a bug report with QEMU too I think. Thanks for digging
in to this everyone.



good.
I also sent a patch to qemu, lets see

https://lists.gnu.org/archive/html/qemu-devel/2024-03/msg01899.html

Regards,
angelo


Re: [PATCH v3] test/py: reset: Add a test for reset command

2024-03-07 Thread Angelo Dureghello

Hi Tom,

On 07/03/24 1:10 AM, Tom Rini wrote:

On Thu, Mar 07, 2024 at 12:36:42AM +0100, Angelo Dureghello wrote:

Hi,

On 05/03/24 1:34 PM, Michal Simek wrote:



On 3/3/24 22:58, Angelo Dureghello wrote:

Hi Tom,

On Tue, Feb 20, 2024 at 01:11:38PM +0530, Love Kumar wrote:

Add a test for reset commands which performs resetting of
CPU, It does COLD reset by default and WARM reset with -w
option. Signed-off-by: Love Kumar 
Reviewed-by: Tom Rini  --- Changes in
v2: - Set bootmode through boardenv if modeboot is not
defined Changes in v3: - Fix the issue with bad pattern
found on console --- test/py/tests/test_reset.py | 61
+ 1 file changed, 61
insertions(+) create mode 100644 test/py/tests/test_reset.py

I had hoped this was all sorted out now, but both this and the
saveenv test cause qemu_m68k to fail now. See:
https://source.denx.de/u-boot/u-boot/-/jobs/791635

looking into this.


Is reset implemented in qemu? It should be skipped if it is not.


yes, seems not implemented

=> reset
=> reset -w
=>
=>

Not finding any trace in the qemu code related to

out_8(>rcr, RCM_RCR_SOFTRST);


Does reset work on the real HW, or can you not test? What I'm wondering
is if we have a missing feature on the board/arch code (and should
disable the reset command) or a problem with QEMU.


I don't have the exact hardware (m5208evb) but:

1) i checked by tracing that on qemu the reset function is properly called

=> reset
resetting, RCR fc0a

2) reset register address is correct. I checked also that writing 
directly to it by mw.b does now produce the reset,


=> reset
resetting, RCR fc0a

=> mw.b 0xfc0a 80
=>

So looks not implemented in qemu.

3) testing reset on similar mcf5282, real hardware, it works

Regards,
angelo



Re: [PATCH v3] test/py: reset: Add a test for reset command

2024-03-06 Thread Angelo Dureghello

Hi,

On 05/03/24 1:34 PM, Michal Simek wrote:



On 3/3/24 22:58, Angelo Dureghello wrote:

Hi Tom,

On Tue, Feb 20, 2024 at 01:11:38PM +0530, Love Kumar wrote:
Add a test for reset commands which performs resetting of CPU, It 
does COLD reset by default and WARM reset with -w option. 
Signed-off-by: Love Kumar  Reviewed-by: Tom 
Rini  --- Changes in v2: - Set bootmode through 
boardenv if modeboot is not defined Changes in v3: - Fix the issue 
with bad pattern found on console --- test/py/tests/test_reset.py | 
61 + 1 file changed, 61 
insertions(+) create mode 100644 test/py/tests/test_reset.py 
I had hoped this was all sorted out now, but both this and the 
saveenv test cause qemu_m68k to fail now. See: 
https://source.denx.de/u-boot/u-boot/-/jobs/791635 

looking into this.


Is reset implemented in qemu? It should be skipped if it is not.


yes, seems not implemented

=> reset
=> reset -w
=>
=>

Not finding any trace in the qemu code related to

out_8(>rcr, RCM_RCR_SOFTRST);

Regards,
angelo



Thanks,
Michal


Re: [PATCH v3] test/py: reset: Add a test for reset command

2024-03-03 Thread Angelo Dureghello

Hi Tom,

On Tue, Feb 20, 2024 at 01:11:38PM +0530, Love Kumar wrote:
Add a test for reset commands which performs resetting of CPU, It 
does COLD reset by default and WARM reset with -w option. 
Signed-off-by: Love Kumar  Reviewed-by: Tom Rini 
 --- Changes in v2: - Set bootmode through 
boardenv if modeboot is not defined Changes in v3: - Fix the issue 
with bad pattern found on console --- test/py/tests/test_reset.py | 
61 + 1 file changed, 61 
insertions(+) create mode 100644 test/py/tests/test_reset.py 
I had hoped this was all sorted out now, but both this and the saveenv 
test cause qemu_m68k to fail now. See: 
https://source.denx.de/u-boot/u-boot/-/jobs/791635 

looking into this.

Regards,
angelo


On 02/03/24 4:18 PM, Tom Rini wrote:


Re: [PATCH v2 04/16] treewide: Make arch-specific bootm code depend on BOOTM

2023-12-22 Thread Angelo Dureghello

Hi Simon,

Acked-by: Angelo Dureghello 

On 15/12/23 5:19 AM, Simon Glass wrote:

Allow these functions to be compiled in when CONFIG_BOOTM is enabled,
even if CONFIG_CMD_BOOTM is not.

Signed-off-by: Simon Glass 
---

(no changes since v1)

  arch/arc/lib/Makefile| 2 +-
  arch/arm/lib/Makefile| 2 +-
  arch/m68k/lib/Makefile   | 2 +-
  arch/microblaze/lib/Makefile | 2 +-
  arch/mips/lib/Makefile   | 2 +-
  arch/nios2/lib/Makefile  | 2 +-
  arch/powerpc/lib/Makefile| 2 +-
  arch/riscv/lib/Makefile  | 2 +-
  arch/sandbox/lib/Makefile| 2 +-
  arch/sh/lib/Makefile | 2 +-
  arch/x86/lib/Makefile| 2 +-
  arch/xtensa/lib/Makefile | 2 +-
  12 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/arch/arc/lib/Makefile b/arch/arc/lib/Makefile
index 0eb44bcf33d0..bde1c3d8af3a 100644
--- a/arch/arc/lib/Makefile
+++ b/arch/arc/lib/Makefile
@@ -12,6 +12,6 @@ obj-y += reset.o
  obj-y += ints_low.o
  obj-y += init_helpers.o
  
-obj-$(CONFIG_CMD_BOOTM) += bootm.o

+obj-$(CONFIG_BOOTM) += bootm.o
  
  lib-$(CONFIG_USE_PRIVATE_LIBGCC) += _millicodethunk.o libgcc2.o

diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile
index b1bcd3746625..b20a467f684c 100644
--- a/arch/arm/lib/Makefile
+++ b/arch/arm/lib/Makefile
@@ -31,7 +31,7 @@ endif
  obj-$(CONFIG_CPU_V7M) += cmd_boot.o
  obj-$(CONFIG_OF_LIBFDT) += bootm-fdt.o
  obj-$(CONFIG_CMD_BOOTI) += bootm.o image.o
-obj-$(CONFIG_CMD_BOOTM) += bootm.o
+obj-$(CONFIG_BOOTM) += bootm.o
  obj-$(CONFIG_CMD_BOOTZ) += bootm.o zimage.o
  else
  obj-$(CONFIG_$(SPL_TPL_)FRAMEWORK) += spl.o
diff --git a/arch/m68k/lib/Makefile b/arch/m68k/lib/Makefile
index 6e1fd938f526..5ccd9545cb5c 100644
--- a/arch/m68k/lib/Makefile
+++ b/arch/m68k/lib/Makefile
@@ -8,7 +8,7 @@
  lib-$(CONFIG_USE_PRIVATE_LIBGCC) += lshrdi3.o muldi3.o ashldi3.o ashrdi3.o
  
  obj-y	+= bdinfo.o

-obj-$(CONFIG_CMD_BOOTM) += bootm.o
+obj-$(CONFIG_BOOTM) += bootm.o
  obj-y += cache.o
  obj-y += interrupts.o
  obj-y += time.o
diff --git a/arch/microblaze/lib/Makefile b/arch/microblaze/lib/Makefile
index dfd8135f4f25..2f234825f804 100644
--- a/arch/microblaze/lib/Makefile
+++ b/arch/microblaze/lib/Makefile
@@ -3,6 +3,6 @@
  # (C) Copyright 2003-2006
  # Wolfgang Denk, DENX Software Engineering, w...@denx.de.
  
-obj-$(CONFIG_CMD_BOOTM) += bootm.o

+obj-$(CONFIG_BOOTM) += bootm.o
  obj-$(CONFIG_CMD_BDI) += bdinfo.o
  obj-y += muldi3.o
diff --git a/arch/mips/lib/Makefile b/arch/mips/lib/Makefile
index 9ee1fcb5c702..f8e162c53b58 100644
--- a/arch/mips/lib/Makefile
+++ b/arch/mips/lib/Makefile
@@ -10,7 +10,7 @@ obj-y += reloc.o
  obj-y += stack.o
  obj-y += traps.o
  
-obj-$(CONFIG_CMD_BOOTM) += bootm.o

+obj-$(CONFIG_BOOTM) += bootm.o
  obj-$(CONFIG_CMD_GO) += boot.o
  obj-$(CONFIG_SPL_BUILD) += spl.o
  
diff --git a/arch/nios2/lib/Makefile b/arch/nios2/lib/Makefile

index a9f3c7100e72..68a5ca007d55 100644
--- a/arch/nios2/lib/Makefile
+++ b/arch/nios2/lib/Makefile
@@ -4,5 +4,5 @@
  # Wolfgang Denk, DENX Software Engineering, w...@denx.de.
  
  obj-y	+= cache.o

-obj-$(CONFIG_CMD_BOOTM) += bootm.o
+obj-$(CONFIG_BOOTM) += bootm.o
  obj-y += libgcc.o
diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile
index bb819dcbb6cc..dcce9834927d 100644
--- a/arch/powerpc/lib/Makefile
+++ b/arch/powerpc/lib/Makefile
@@ -34,7 +34,7 @@ obj-y += ticks.o
  endif
  obj-y += reloc.o
  
-obj-$(CONFIG_CMD_BOOTM) += bootm.o

+obj-$(CONFIG_BOOTM) += bootm.o
  obj-y += cache.o
  obj-y += extable.o
  obj-y += interrupts.o
diff --git a/arch/riscv/lib/Makefile b/arch/riscv/lib/Makefile
index 9a05b662fd63..0b2c88db6bad 100644
--- a/arch/riscv/lib/Makefile
+++ b/arch/riscv/lib/Makefile
@@ -6,7 +6,7 @@
  # Copyright (C) 2017 Andes Technology Corporation
  # Rick Chen, Andes Technology Corporation 
  
-obj-$(CONFIG_CMD_BOOTM) += bootm.o

+obj-$(CONFIG_BOOTM) += bootm.o
  obj-$(CONFIG_CMD_BOOTI) += bootm.o image.o
  obj-$(CONFIG_CMD_GO) += boot.o
  obj-y += cache.o
diff --git a/arch/sandbox/lib/Makefile b/arch/sandbox/lib/Makefile
index a2bc5a7ee60f..c4924b23c832 100644
--- a/arch/sandbox/lib/Makefile
+++ b/arch/sandbox/lib/Makefile
@@ -7,5 +7,5 @@
  
  obj-y	+= fdt_fixup.o interrupts.o sections.o

  obj-$(CONFIG_PCI) += pci_io.o
-obj-$(CONFIG_CMD_BOOTM) += bootm.o
+obj-$(CONFIG_BOOTM) += bootm.o
  obj-$(CONFIG_CMD_BOOTZ) += bootm.o
diff --git a/arch/sh/lib/Makefile b/arch/sh/lib/Makefile
index e7520a328d54..8c3c30293a3c 100644
--- a/arch/sh/lib/Makefile
+++ b/arch/sh/lib/Makefile
@@ -6,7 +6,7 @@
  extra-y   += start.o
  
  obj-y	+= board.o

-obj-$(CONFIG_CMD_BOOTM) += bootm.o
+obj-$(CONFIG_BOOTM) += bootm.o
  obj-y += time.o
  obj-$(CONFIG_CMD_SH_ZIMAGEBOOT) += zimageboot.o
  
diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile

index 8fc35e1b51ea..94aa335ede4c 100644
--- a/arch/x86/lib/Makefile
+++ b/arch/x86/lib/Makefile
@@ -16,7 +16,7 @@ obj-$(CONFIG_X86_32BIT_INIT) += string.o
  endif
  
  ifndef CONFIG_SPL_BUILD

-obj-$(CONFIG_CMD_BOOTM) += bootm.o
+obj

Re: [PATCH 04/14] treewide: Make arch-specific bootm code depend on BOOTM

2023-12-22 Thread Angelo Dureghello

Hi Simon,

Acked-by: Angelo Dureghello 

On 04/12/23 1:31 AM, Simon Glass wrote:

Allow these functions to be compiled in when CONFIG_BOOTM is enabled,
even if CONFIG_CMD_BOOTM is not.

Signed-off-by: Simon Glass 
---

  arch/arc/lib/Makefile| 2 +-
  arch/arm/lib/Makefile| 2 +-
  arch/m68k/lib/Makefile   | 2 +-
  arch/microblaze/lib/Makefile | 2 +-
  arch/mips/lib/Makefile   | 2 +-
  arch/nios2/lib/Makefile  | 2 +-
  arch/powerpc/lib/Makefile| 2 +-
  arch/riscv/lib/Makefile  | 2 +-
  arch/sandbox/lib/Makefile| 2 +-
  arch/sh/lib/Makefile | 2 +-
  arch/x86/lib/Makefile| 2 +-
  arch/xtensa/lib/Makefile | 2 +-
  12 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/arch/arc/lib/Makefile b/arch/arc/lib/Makefile
index 0eb44bcf33d0..bde1c3d8af3a 100644
--- a/arch/arc/lib/Makefile
+++ b/arch/arc/lib/Makefile
@@ -12,6 +12,6 @@ obj-y += reset.o
  obj-y += ints_low.o
  obj-y += init_helpers.o
  
-obj-$(CONFIG_CMD_BOOTM) += bootm.o

+obj-$(CONFIG_BOOTM) += bootm.o
  
  lib-$(CONFIG_USE_PRIVATE_LIBGCC) += _millicodethunk.o libgcc2.o

diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile
index b1bcd3746625..b20a467f684c 100644
--- a/arch/arm/lib/Makefile
+++ b/arch/arm/lib/Makefile
@@ -31,7 +31,7 @@ endif
  obj-$(CONFIG_CPU_V7M) += cmd_boot.o
  obj-$(CONFIG_OF_LIBFDT) += bootm-fdt.o
  obj-$(CONFIG_CMD_BOOTI) += bootm.o image.o
-obj-$(CONFIG_CMD_BOOTM) += bootm.o
+obj-$(CONFIG_BOOTM) += bootm.o
  obj-$(CONFIG_CMD_BOOTZ) += bootm.o zimage.o
  else
  obj-$(CONFIG_$(SPL_TPL_)FRAMEWORK) += spl.o
diff --git a/arch/m68k/lib/Makefile b/arch/m68k/lib/Makefile
index 6e1fd938f526..5ccd9545cb5c 100644
--- a/arch/m68k/lib/Makefile
+++ b/arch/m68k/lib/Makefile
@@ -8,7 +8,7 @@
  lib-$(CONFIG_USE_PRIVATE_LIBGCC) += lshrdi3.o muldi3.o ashldi3.o ashrdi3.o
  
  obj-y	+= bdinfo.o

-obj-$(CONFIG_CMD_BOOTM) += bootm.o
+obj-$(CONFIG_BOOTM) += bootm.o
  obj-y += cache.o
  obj-y += interrupts.o
  obj-y += time.o
diff --git a/arch/microblaze/lib/Makefile b/arch/microblaze/lib/Makefile
index dfd8135f4f25..2f234825f804 100644
--- a/arch/microblaze/lib/Makefile
+++ b/arch/microblaze/lib/Makefile
@@ -3,6 +3,6 @@
  # (C) Copyright 2003-2006
  # Wolfgang Denk, DENX Software Engineering, w...@denx.de.
  
-obj-$(CONFIG_CMD_BOOTM) += bootm.o

+obj-$(CONFIG_BOOTM) += bootm.o
  obj-$(CONFIG_CMD_BDI) += bdinfo.o
  obj-y += muldi3.o
diff --git a/arch/mips/lib/Makefile b/arch/mips/lib/Makefile
index 9ee1fcb5c702..f8e162c53b58 100644
--- a/arch/mips/lib/Makefile
+++ b/arch/mips/lib/Makefile
@@ -10,7 +10,7 @@ obj-y += reloc.o
  obj-y += stack.o
  obj-y += traps.o
  
-obj-$(CONFIG_CMD_BOOTM) += bootm.o

+obj-$(CONFIG_BOOTM) += bootm.o
  obj-$(CONFIG_CMD_GO) += boot.o
  obj-$(CONFIG_SPL_BUILD) += spl.o
  
diff --git a/arch/nios2/lib/Makefile b/arch/nios2/lib/Makefile

index a9f3c7100e72..68a5ca007d55 100644
--- a/arch/nios2/lib/Makefile
+++ b/arch/nios2/lib/Makefile
@@ -4,5 +4,5 @@
  # Wolfgang Denk, DENX Software Engineering, w...@denx.de.
  
  obj-y	+= cache.o

-obj-$(CONFIG_CMD_BOOTM) += bootm.o
+obj-$(CONFIG_BOOTM) += bootm.o
  obj-y += libgcc.o
diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile
index bb819dcbb6cc..dcce9834927d 100644
--- a/arch/powerpc/lib/Makefile
+++ b/arch/powerpc/lib/Makefile
@@ -34,7 +34,7 @@ obj-y += ticks.o
  endif
  obj-y += reloc.o
  
-obj-$(CONFIG_CMD_BOOTM) += bootm.o

+obj-$(CONFIG_BOOTM) += bootm.o
  obj-y += cache.o
  obj-y += extable.o
  obj-y += interrupts.o
diff --git a/arch/riscv/lib/Makefile b/arch/riscv/lib/Makefile
index 9a05b662fd63..0b2c88db6bad 100644
--- a/arch/riscv/lib/Makefile
+++ b/arch/riscv/lib/Makefile
@@ -6,7 +6,7 @@
  # Copyright (C) 2017 Andes Technology Corporation
  # Rick Chen, Andes Technology Corporation 
  
-obj-$(CONFIG_CMD_BOOTM) += bootm.o

+obj-$(CONFIG_BOOTM) += bootm.o
  obj-$(CONFIG_CMD_BOOTI) += bootm.o image.o
  obj-$(CONFIG_CMD_GO) += boot.o
  obj-y += cache.o
diff --git a/arch/sandbox/lib/Makefile b/arch/sandbox/lib/Makefile
index a2bc5a7ee60f..c4924b23c832 100644
--- a/arch/sandbox/lib/Makefile
+++ b/arch/sandbox/lib/Makefile
@@ -7,5 +7,5 @@
  
  obj-y	+= fdt_fixup.o interrupts.o sections.o

  obj-$(CONFIG_PCI) += pci_io.o
-obj-$(CONFIG_CMD_BOOTM) += bootm.o
+obj-$(CONFIG_BOOTM) += bootm.o
  obj-$(CONFIG_CMD_BOOTZ) += bootm.o
diff --git a/arch/sh/lib/Makefile b/arch/sh/lib/Makefile
index e7520a328d54..8c3c30293a3c 100644
--- a/arch/sh/lib/Makefile
+++ b/arch/sh/lib/Makefile
@@ -6,7 +6,7 @@
  extra-y   += start.o
  
  obj-y	+= board.o

-obj-$(CONFIG_CMD_BOOTM) += bootm.o
+obj-$(CONFIG_BOOTM) += bootm.o
  obj-y += time.o
  obj-$(CONFIG_CMD_SH_ZIMAGEBOOT) += zimageboot.o
  
diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile

index 8fc35e1b51ea..94aa335ede4c 100644
--- a/arch/x86/lib/Makefile
+++ b/arch/x86/lib/Makefile
@@ -16,7 +16,7 @@ obj-$(CONFIG_X86_32BIT_INIT) += string.o
  endif
  
  ifndef CONFIG_SPL_BUILD

-obj-$(CONFIG_CMD_BOOTM) += bootm.o
+obj-$(CONFIG_BOOTM) += bootm.o

Re: [PATCH 05/18] treewide: bootm: Drop command-line args to boot_os_fn

2023-12-10 Thread Angelo Dureghello

Hi Simon,


Acked-by: Angelo Dureghello 

On 04/12/23 1:26 AM, Simon Glass wrote:

These arguments are not used now. They cannot be provided when there is
no bootm command invoked to provide arguments. Drop the argc and argv
parameters.

Signed-off-by: Simon Glass 
---

  arch/arc/lib/bootm.c|  2 +-
  arch/arm/lib/bootm.c|  3 +--
  arch/m68k/lib/bootm.c   |  3 +--
  arch/microblaze/lib/bootm.c |  3 +--
  arch/mips/lib/bootm.c   |  3 +--
  arch/nios2/lib/bootm.c  |  3 +--
  arch/powerpc/lib/bootm.c|  3 +--
  arch/riscv/lib/bootm.c  |  5 ++--
  arch/sandbox/lib/bootm.c|  2 +-
  arch/sh/lib/bootm.c |  3 +--
  arch/x86/lib/bootm.c|  3 +--
  arch/xtensa/lib/bootm.c |  2 +-
  boot/bootm.c|  6 ++---
  boot/bootm_os.c | 46 ++---
  include/bootm.h |  7 +-
  15 files changed, 34 insertions(+), 60 deletions(-)

diff --git a/arch/arc/lib/bootm.c b/arch/arc/lib/bootm.c
index 44ec5864a1c6..0ae7a21b24b6 100644
--- a/arch/arc/lib/bootm.c
+++ b/arch/arc/lib/bootm.c
@@ -78,7 +78,7 @@ static void boot_jump_linux(struct bootm_headers *images, int 
flag)
board_jump_and_run(kernel_entry, r0, 0, r2);
  }
  
-int do_bootm_linux(int flag, int argc, char *argv[], struct bootm_headers *images)

+int do_bootm_linux(int flag, struct bootm_headers *images)
  {
/* No need for those on ARC */
if ((flag & BOOTM_STATE_OS_BD_T) || (flag & BOOTM_STATE_OS_CMDLINE))
diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
index c56285738a26..ebaac029e094 100644
--- a/arch/arm/lib/bootm.c
+++ b/arch/arm/lib/bootm.c
@@ -378,8 +378,7 @@ static void boot_jump_linux(struct bootm_headers *images, 
int flag)
   * DIFFERENCE: Instead of calling prep and go at the end
   * they are called if subcommand is equal 0.
   */
-int do_bootm_linux(int flag, int argc, char *const argv[],
-  struct bootm_headers *images)
+int do_bootm_linux(int flag, struct bootm_headers *images)
  {
/* No need for those on ARM */
if (flag & BOOTM_STATE_OS_BD_T || flag & BOOTM_STATE_OS_CMDLINE)
diff --git a/arch/m68k/lib/bootm.c b/arch/m68k/lib/bootm.c
index 79d8b34c0d56..0720861ae9cc 100644
--- a/arch/m68k/lib/bootm.c
+++ b/arch/m68k/lib/bootm.c
@@ -34,8 +34,7 @@ void arch_lmb_reserve(struct lmb *lmb)
arch_lmb_reserve_generic(lmb, get_sp(), gd->ram_top, 1024);
  }
  
-int do_bootm_linux(int flag, int argc, char *const argv[],

-  struct bootm_headers *images)
+int do_bootm_linux(int flag, struct bootm_headers *images)
  {
int ret;
struct bd_info  *kbd;
diff --git a/arch/microblaze/lib/bootm.c b/arch/microblaze/lib/bootm.c
index f3ec4b741b88..93cdf62e18cf 100644
--- a/arch/microblaze/lib/bootm.c
+++ b/arch/microblaze/lib/bootm.c
@@ -81,8 +81,7 @@ static void boot_prep_linux(struct bootm_headers *images)
}
  }
  
-int do_bootm_linux(int flag, int argc, char *const argv[],

-  struct bootm_headers *images)
+int do_bootm_linux(int flag, struct bootm_headers *images)
  {
images->cmdline_start = (ulong)env_get("bootargs");
  
diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c

index d6d2f7d9d031..05dbe6131728 100644
--- a/arch/mips/lib/bootm.c
+++ b/arch/mips/lib/bootm.c
@@ -300,8 +300,7 @@ static void boot_jump_linux(struct bootm_headers *images)
linux_extra);
  }
  
-int do_bootm_linux(int flag, int argc, char *const argv[],

-  struct bootm_headers *images)
+int do_bootm_linux(int flag, struct bootm_headers *images)
  {
/* No need for those on MIPS */
if (flag & BOOTM_STATE_OS_BD_T)
diff --git a/arch/nios2/lib/bootm.c b/arch/nios2/lib/bootm.c
index 823d524c9a2d..040a806bc75e 100644
--- a/arch/nios2/lib/bootm.c
+++ b/arch/nios2/lib/bootm.c
@@ -16,8 +16,7 @@ DECLARE_GLOBAL_DATA_PTR;
  
  #define NIOS_MAGIC 0x534f494e /* enable command line and initrd passing */
  
-int do_bootm_linux(int flag, int argc, char *const argv[],

-  struct bootm_headers *images)
+int do_bootm_linux(int flag, struct bootm_headers *images)
  {
void (*kernel)(int, int, int, char *) = (void *)images->ep;
char *commandline = env_get("bootargs");
diff --git a/arch/powerpc/lib/bootm.c b/arch/powerpc/lib/bootm.c
index 910121ec9c85..4d248cb13b5f 100644
--- a/arch/powerpc/lib/bootm.c
+++ b/arch/powerpc/lib/bootm.c
@@ -223,8 +223,7 @@ static int boot_body_linux(struct bootm_headers *images)
return 0;
  }
  
-noinline int do_bootm_linux(int flag, int argc, char *const argv[],

-   struct bootm_headers *images)
+noinline int do_bootm_linux(int flag, struct bootm_headers *images)
  {
int ret;
  
diff --git a/arch/riscv/lib/bootm.c b/arch/riscv/lib/bootm.c

index f9e1e18ae026..d90f26091530 100644
--- a/arch/riscv/lib/bootm.c
+++ b/arch/riscv/lib/bootm.c
@@ -1

Re: [PATCH 08/18] m68k: Add a reset_cpu() function

2023-12-10 Thread Angelo Dureghello

Hi Simon,


Acked-by: Angelo Dureghello 


On 04/12/23 1:26 AM, Simon Glass wrote:

The current do_reset() is called from a command context. Add a function
which can be used from anywhere, as is done on ARM.

Since there are lots of reset functions, this one actually just calls
do_reset(). Future refactoring could correct this.

Signed-off-by: Simon Glass 
---

  arch/m68k/lib/traps.c | 7 +++
  1 file changed, 7 insertions(+)

diff --git a/arch/m68k/lib/traps.c b/arch/m68k/lib/traps.c
index c283351181d8..ae8ae6ccf592 100644
--- a/arch/m68k/lib/traps.c
+++ b/arch/m68k/lib/traps.c
@@ -7,6 +7,7 @@
   * Wolfgang Denk, DENX Software Engineering, w...@denx.de.
   */
  
+#include 

  #include 
  #include 
  #include 
@@ -65,3 +66,9 @@ int arch_initr_trap(void)
  
  	return 0;

  }
+
+void reset_cpu(void)
+{
+   /* TODO: Refactor all the do_reset calls to be reset_cpu() instead */
+   do_reset(NULL, 0, 0, NULL);
+}


Re: [PATCH 05/18] treewide: bootm: Drop command-line args to boot_os_fn

2023-12-04 Thread Angelo Dureghello

Hi Simon,

looks like i cannot apply this patch:

    ~/dev-k/u-boot-coldfire  on   master *2  git am 
Complete-decoupling-of-bootm-logic-from-commands.patch

Applying: bootm: netbds: Drop passing of arguments
Applying: bootm: plan: Drop passing of arguments
Applying: bootm: qnxelf: Drop passing of arguments
Applying: nios2: Drop separate parsing of bootm args
Applying: treewide: bootm: Drop command-line args to boot_os_fn
error: patch failed: boot/bootm_os.c:441
error: boot/bootm_os.c: patch does not apply
Patch failed at 0005 treewide: bootm: Drop command-line args to boot_os_fn
hint: Use 'git am --show-current-patch=diff' to see the failed patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".


And getting similar issues for the "pxe: Allow extlinux booting without 
CMDLINE enabled"


Am i doing something wrong ?

Thanks,

Regards
angelo

On 04/12/23 1:26 AM, Simon Glass wrote:

These arguments are not used now. They cannot be provided when there is
no bootm command invoked to provide arguments. Drop the argc and argv
parameters.

Signed-off-by: Simon Glass 
---

  arch/arc/lib/bootm.c|  2 +-
  arch/arm/lib/bootm.c|  3 +--
  arch/m68k/lib/bootm.c   |  3 +--
  arch/microblaze/lib/bootm.c |  3 +--
  arch/mips/lib/bootm.c   |  3 +--
  arch/nios2/lib/bootm.c  |  3 +--
  arch/powerpc/lib/bootm.c|  3 +--
  arch/riscv/lib/bootm.c  |  5 ++--
  arch/sandbox/lib/bootm.c|  2 +-
  arch/sh/lib/bootm.c |  3 +--
  arch/x86/lib/bootm.c|  3 +--
  arch/xtensa/lib/bootm.c |  2 +-
  boot/bootm.c|  6 ++---
  boot/bootm_os.c | 46 ++---
  include/bootm.h |  7 +-
  15 files changed, 34 insertions(+), 60 deletions(-)

diff --git a/arch/arc/lib/bootm.c b/arch/arc/lib/bootm.c
index 44ec5864a1c6..0ae7a21b24b6 100644
--- a/arch/arc/lib/bootm.c
+++ b/arch/arc/lib/bootm.c
@@ -78,7 +78,7 @@ static void boot_jump_linux(struct bootm_headers *images, int 
flag)
board_jump_and_run(kernel_entry, r0, 0, r2);
  }
  
-int do_bootm_linux(int flag, int argc, char *argv[], struct bootm_headers *images)

+int do_bootm_linux(int flag, struct bootm_headers *images)
  {
/* No need for those on ARC */
if ((flag & BOOTM_STATE_OS_BD_T) || (flag & BOOTM_STATE_OS_CMDLINE))
diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
index c56285738a26..ebaac029e094 100644
--- a/arch/arm/lib/bootm.c
+++ b/arch/arm/lib/bootm.c
@@ -378,8 +378,7 @@ static void boot_jump_linux(struct bootm_headers *images, 
int flag)
   * DIFFERENCE: Instead of calling prep and go at the end
   * they are called if subcommand is equal 0.
   */
-int do_bootm_linux(int flag, int argc, char *const argv[],
-  struct bootm_headers *images)
+int do_bootm_linux(int flag, struct bootm_headers *images)
  {
/* No need for those on ARM */
if (flag & BOOTM_STATE_OS_BD_T || flag & BOOTM_STATE_OS_CMDLINE)
diff --git a/arch/m68k/lib/bootm.c b/arch/m68k/lib/bootm.c
index 79d8b34c0d56..0720861ae9cc 100644
--- a/arch/m68k/lib/bootm.c
+++ b/arch/m68k/lib/bootm.c
@@ -34,8 +34,7 @@ void arch_lmb_reserve(struct lmb *lmb)
arch_lmb_reserve_generic(lmb, get_sp(), gd->ram_top, 1024);
  }
  
-int do_bootm_linux(int flag, int argc, char *const argv[],

-  struct bootm_headers *images)
+int do_bootm_linux(int flag, struct bootm_headers *images)
  {
int ret;
struct bd_info  *kbd;
diff --git a/arch/microblaze/lib/bootm.c b/arch/microblaze/lib/bootm.c
index f3ec4b741b88..93cdf62e18cf 100644
--- a/arch/microblaze/lib/bootm.c
+++ b/arch/microblaze/lib/bootm.c
@@ -81,8 +81,7 @@ static void boot_prep_linux(struct bootm_headers *images)
}
  }
  
-int do_bootm_linux(int flag, int argc, char *const argv[],

-  struct bootm_headers *images)
+int do_bootm_linux(int flag, struct bootm_headers *images)
  {
images->cmdline_start = (ulong)env_get("bootargs");
  
diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c

index d6d2f7d9d031..05dbe6131728 100644
--- a/arch/mips/lib/bootm.c
+++ b/arch/mips/lib/bootm.c
@@ -300,8 +300,7 @@ static void boot_jump_linux(struct bootm_headers *images)
linux_extra);
  }
  
-int do_bootm_linux(int flag, int argc, char *const argv[],

-  struct bootm_headers *images)
+int do_bootm_linux(int flag, struct bootm_headers *images)
  {
/* No need for those on MIPS */
if (flag & BOOTM_STATE_OS_BD_T)
diff --git a/arch/nios2/lib/bootm.c b/arch/nios2/lib/bootm.c
index 823d524c9a2d..040a806bc75e 100644
--- a/arch/nios2/lib/bootm.c
+++ b/arch/nios2/lib/bootm.c
@@ -16,8 +16,7 @@ DECLARE_GLOBAL_DATA_PTR;
  
  #define NIOS_MAGIC 0x534f494e /* enable command line and initrd passing */
  
-int do_bootm_linux(int flag, int 

Re: [PATCH 04/11] m68k: Rework asm/global_data.h slightly

2023-11-23 Thread Angelo Dureghello

Hi Tom,

sorry, i have difficulties to get the full patchset,
was also looking into patchwork, but seems not updated.

Anyway, i applied patches one by one, all is ok.

Acked-by: Angelo Dureghello 

On 22/11/23 10:09 PM, Tom Rini wrote:

On Wed, Nov 22, 2023 at 10:04:38PM +0100, Angelo Dureghello wrote:

Hi Tom,

thanks,

On 22/11/23 2:11 PM, Tom Rini wrote:

In the architecture global data, replace the one case of u32 with
unsigned long. Now, we can drop config.h here but then do need to add it
in two m68k-centric spaces.

Signed-off-by: Tom Rini 
---
Cc: Huan Wang 
Cc: Angelo Dureghello 
---
   arch/m68k/include/asm/cache.h   | 2 ++
   arch/m68k/include/asm/global_data.h | 4 +---
   arch/m68k/lib/traps.c   | 1 +
   3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch/m68k/include/asm/cache.h b/arch/m68k/include/asm/cache.h
index 8ed2b4dbab47..6ef7f7be1af8 100644
--- a/arch/m68k/include/asm/cache.h
+++ b/arch/m68k/include/asm/cache.h
@@ -9,6 +9,8 @@
   #ifndef __CACHE_H
   #define __CACHE_H
+#include 
+
   #if defined(CONFIG_MCF520x) || defined(CONFIG_MCF523x) || \
   defined(CONFIG_MCF52x2)
   #define CFG_CF_V2
diff --git a/arch/m68k/include/asm/global_data.h 
b/arch/m68k/include/asm/global_data.h
index 5f576ba16f9a..c2ef5770a3df 100644
--- a/arch/m68k/include/asm/global_data.h
+++ b/arch/m68k/include/asm/global_data.h
@@ -7,8 +7,6 @@
   #ifndef  __ASM_GBL_DATA_H
   #define __ASM_GBL_DATA_H
-#include 
-
   /* Architecture-specific global data */
   struct arch_global_data {
   #ifdef CONFIG_SYS_I2C_FSL
@@ -24,7 +22,7 @@ struct arch_global_data {
unsigned long sdhc_clk;
   #endif
   #if defined(CONFIG_FSL_ESDHC)
-   u32 sdhc_per_clk;
+   unsigned long sdhc_per_clk;
   #endif
   };
diff --git a/arch/m68k/lib/traps.c b/arch/m68k/lib/traps.c
index c283351181d8..2a025c5a6e86 100644
--- a/arch/m68k/lib/traps.c
+++ b/arch/m68k/lib/traps.c
@@ -7,6 +7,7 @@
* Wolfgang Denk, DENX Software Engineering, w...@denx.de.
*/
+#include 
   #include 
   #include 
   #include 



testing this getting some errors

+drivers/watchdog/mcf_wdt.c: In function 'mcf_watchdog_init':
+drivers/watchdog/mcf_wdt.c:43:26: error: 'CFG_SYS_CLK' undeclared (first
use in this function)
+   43 | cycles_per_sec = CFG_SYS_CLK / fixed_divider;
+  |  ^~~


Seems solved by

diff --git a/drivers/watchdog/mcf_wdt.c b/drivers/watchdog/mcf_wdt.c
index b555bbeb68..f5ff221dd5 100644
--- a/drivers/watchdog/mcf_wdt.c
+++ b/drivers/watchdog/mcf_wdt.c
@@ -11,6 +11,7 @@
  #include 
  #include 
  #include 
+#include 


Did you have the whole series applied? That is a reasonable solution,
but I didn't see a failure here, thanks for the report.



Re: [PATCH 04/11] m68k: Rework asm/global_data.h slightly

2023-11-22 Thread Angelo Dureghello

Hi Tom,

thanks,

On 22/11/23 2:11 PM, Tom Rini wrote:

In the architecture global data, replace the one case of u32 with
unsigned long. Now, we can drop config.h here but then do need to add it
in two m68k-centric spaces.

Signed-off-by: Tom Rini 
---
Cc: Huan Wang 
Cc: Angelo Dureghello 
---
  arch/m68k/include/asm/cache.h   | 2 ++
  arch/m68k/include/asm/global_data.h | 4 +---
  arch/m68k/lib/traps.c   | 1 +
  3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch/m68k/include/asm/cache.h b/arch/m68k/include/asm/cache.h
index 8ed2b4dbab47..6ef7f7be1af8 100644
--- a/arch/m68k/include/asm/cache.h
+++ b/arch/m68k/include/asm/cache.h
@@ -9,6 +9,8 @@
  #ifndef __CACHE_H
  #define __CACHE_H
  
+#include 

+
  #if defined(CONFIG_MCF520x) || defined(CONFIG_MCF523x) || \
  defined(CONFIG_MCF52x2)
  #define CFG_CF_V2
diff --git a/arch/m68k/include/asm/global_data.h 
b/arch/m68k/include/asm/global_data.h
index 5f576ba16f9a..c2ef5770a3df 100644
--- a/arch/m68k/include/asm/global_data.h
+++ b/arch/m68k/include/asm/global_data.h
@@ -7,8 +7,6 @@
  #ifndef   __ASM_GBL_DATA_H
  #define __ASM_GBL_DATA_H
  
-#include 

-
  /* Architecture-specific global data */
  struct arch_global_data {
  #ifdef CONFIG_SYS_I2C_FSL
@@ -24,7 +22,7 @@ struct arch_global_data {
unsigned long sdhc_clk;
  #endif
  #if defined(CONFIG_FSL_ESDHC)
-   u32 sdhc_per_clk;
+   unsigned long sdhc_per_clk;
  #endif
  };
  
diff --git a/arch/m68k/lib/traps.c b/arch/m68k/lib/traps.c

index c283351181d8..2a025c5a6e86 100644
--- a/arch/m68k/lib/traps.c
+++ b/arch/m68k/lib/traps.c
@@ -7,6 +7,7 @@
   * Wolfgang Denk, DENX Software Engineering, w...@denx.de.
   */
  
+#include 

  #include 
  #include 
  #include 



testing this getting some errors

+drivers/watchdog/mcf_wdt.c: In function 'mcf_watchdog_init':
+drivers/watchdog/mcf_wdt.c:43:26: error: 'CFG_SYS_CLK' undeclared 
(first use in this function)

+   43 | cycles_per_sec = CFG_SYS_CLK / fixed_divider;
+  |  ^~~


Seems solved by

diff --git a/drivers/watchdog/mcf_wdt.c b/drivers/watchdog/mcf_wdt.c
index b555bbeb68..f5ff221dd5 100644
--- a/drivers/watchdog/mcf_wdt.c
+++ b/drivers/watchdog/mcf_wdt.c
@@ -11,6 +11,7 @@
 #include 
 #include 
 #include 
+#include 

Regards,
angelo


[PATCH] m68k: remove unused mcf54xx devicetree

2023-11-06 Thread Angelo Dureghello
Remove unused devicetree, can be re-added later, in case
some board would use it.

Signed-off-by: Angelo Dureghello 
---
 arch/m68k/dts/mcf54xx.dtsi | 72 --
 1 file changed, 72 deletions(-)
 delete mode 100644 arch/m68k/dts/mcf54xx.dtsi

diff --git a/arch/m68k/dts/mcf54xx.dtsi b/arch/m68k/dts/mcf54xx.dtsi
deleted file mode 100644
index e9cebb9f74..00
--- a/arch/m68k/dts/mcf54xx.dtsi
+++ /dev/null
@@ -1,72 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Copyright (C) 2018 Angelo Dureghello 
- */
-
-/ {
-   compatible = "fsl,mcf54x5";
-
-   aliases {
-   /* TO DO, clarify on serial, this SoC seems to have SPC and
-* no UARTS.
-*/
-   spi0 = 
-   fec0 = 
-   fec1 = 
-   };
-
-   soc {
-   compatible = "simple-bus";
-   #address-cells = <1>;
-   #size-cells = <1>;
-
-   mbar: mbar@8000 {
-   compatible = "simple-bus";
-   #address-cells = <1>;
-   #size-cells = <1>;
-   ranges = <0x 0x8000 0x1>;
-   reg = <0x8000 0x1>;
-
-   dspi0: dspi@8a00 {
-   compatible = "fsl,mcf-dspi";
-   #address-cells = <1>;
-   #size-cells = <0>;
-   reg = <0x8a00 0x100>;
-   spi-max-frequency = <5000>;
-   num-cs = <4>;
-   spi-mode = <0>;
-   status = "disabled";
-   };
-
-   fec0: ethernet@9000 {
-   compatible = "fsl,mcf-dma-fec";
-   reg = <0x9000 0x800>;
-   mii-base = <0>;
-   max-speed = <100>;
-   timeout-loop = <5>;
-   rx-task = <0>;
-   tx-task = <1>;
-   rx-piority = <6>;
-   tx-piority = <7>;
-   rx-init = <16>;
-   tx-init = <17>;
-   status = "disabled";
-   };
-
-   fec1: ethernet@9800 {
-   compatible = "fsl,mcf-dma-fec";
-   reg = <0x9800 0x800>;
-   mii-base = <1>;
-   max-speed = <100>;
-   timeout-loop = <5>;
-   rx-task = <2>;
-   tx-task = <3>;
-   rx-piority = <6>;
-   tx-piority = <7>;
-   rx-init = <30>;
-   tx-init = <31>;
-   status = "disabled";
-   };
-   };
-   };
-};
-- 
2.42.0



Re: [PATCH 01/20] m68k: Remove CONFIG_FSLDMAFEC

2023-11-06 Thread Angelo Dureghello

Hi Tom,

sure, i remove the unused dtsi,
patch will follow.

Regards,
angelo

On 06/11/23 5:32 PM, Tom Rini wrote:

On Sat, Nov 04, 2023 at 09:58:07PM +0100, Angelo Dureghello wrote:

Hi Tom,

Reviewed by: Angelo Dureghello 


Thanks for the cleanup, m68k boards build fine.

fsl_mcdmafec driver is still referenced in arch/m68k/dts/mcf54xx.dtsi,
(from compatible field) but no board is including it.
You can remove the dtsi too if you want.


Thanks for the review.  I'd appreciate it if you went and did the rest
of the cleaning of unused code around here as I'm not familiar with it,
I just found this one as part of looking for common.h usage.






Re: [PATCH 01/20] m68k: Remove CONFIG_FSLDMAFEC

2023-11-04 Thread Angelo Dureghello

Hi Tom,

Reviewed by: Angelo Dureghello 


Thanks for the cleanup, m68k boards build fine.

fsl_mcdmafec driver is still referenced in arch/m68k/dts/mcf54xx.dtsi,
(from compatible field) but no board is including it.
You can remove the dtsi too if you want.

Regards,
angelo


On 01/11/23 5:28 PM, Tom Rini wrote:

There are no platforms which enable this feature, so remove it.

Signed-off-by: Tom Rini 
---
Cc: Angelo Dureghello 
---
  arch/m68k/include/asm/fsl_mcdmafec.h |  151 --
  arch/m68k/include/asm/immap.h|   15 -
  arch/m68k/lib/fec.c  |4 +-
  drivers/dma/Kconfig  |1 -
  drivers/dma/MCD_dmaApi.c | 1010 ---
  drivers/dma/MCD_tasks.c  | 2413 --
  drivers/dma/MCD_tasksInit.c  |  225 ---
  drivers/dma/Makefile |1 -
  drivers/net/Kconfig  |8 -
  drivers/net/Makefile |1 -
  drivers/net/fsl_mcdmafec.c   |  592 ---
  include/MCD_dma.h|  369 
  include/MCD_progCheck.h  |   10 -
  include/MCD_tasksInit.h  |   43 -
  14 files changed, 2 insertions(+), 4841 deletions(-)
  delete mode 100644 arch/m68k/include/asm/fsl_mcdmafec.h
  delete mode 100644 drivers/dma/MCD_dmaApi.c
  delete mode 100644 drivers/dma/MCD_tasks.c
  delete mode 100644 drivers/dma/MCD_tasksInit.c
  delete mode 100644 drivers/net/fsl_mcdmafec.c
  delete mode 100644 include/MCD_dma.h
  delete mode 100644 include/MCD_progCheck.h
  delete mode 100644 include/MCD_tasksInit.h

diff --git a/arch/m68k/include/asm/fsl_mcdmafec.h 
b/arch/m68k/include/asm/fsl_mcdmafec.h
deleted file mode 100644
index de6c548fafd7..
--- a/arch/m68k/include/asm/fsl_mcdmafec.h
+++ /dev/null
@@ -1,151 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * fsl_mcdmafec.h -- Multi-channel DMA Fast Ethernet Controller definitions
- *
- * Copyright (C) 2004-2007 Freescale Semiconductor, Inc.
- * TsiChung Liew (tsi-chung.l...@freescale.com)
- */
-
-#ifndef fsl_mcdmafec_h
-#define fsl_mcdmafec_h
-
-/* Re-use of the definitions */
-#include 
-
-typedef struct fecdma {
-   u32 rsvd0;  /* 0x000 */
-   u32 eir;/* 0x004 */
-   u32 eimr;   /* 0x008 */
-   u32 rsvd1[6];   /* 0x00C - 0x023 */
-   u32 ecr;/* 0x024 */
-   u32 rsvd2[6];   /* 0x028 - 0x03F */
-   u32 mmfr;   /* 0x040 */
-   u32 mscr;   /* 0x044 */
-   u32 rsvd3[7];   /* 0x048 - 0x063 */
-   u32 mibc;   /* 0x064 */
-   u32 rsvd4[7];   /* 0x068 - 0x083 */
-   u32 rcr;/* 0x084 */
-   u32 rhr;/* 0x088 */
-   u32 rsvd5[14];  /* 0x08C - 0x0C3 */
-   u32 tcr;/* 0x0C4 */
-   u32 rsvd6[7];   /* 0x0C8 - 0x0E3 */
-   u32 palr;   /* 0x0E4 */
-   u32 paur;   /* 0x0E8 */
-   u32 opd;/* 0x0EC */
-   u32 rsvd7[10];  /* 0x0F0 - 0x117 */
-   u32 iaur;   /* 0x118 */
-   u32 ialr;   /* 0x11C */
-   u32 gaur;   /* 0x120 */
-   u32 galr;   /* 0x124 */
-   u32 rsvd8[7];   /* 0x128 - 0x143 */
-   u32 tfwr;   /* 0x144 */
-   u32 rsvd9[14];  /* 0x148 - 0x17F */
-   u32 fmc;/* 0x180 */
-   u32 rfdr;   /* 0x184 */
-   u32 rfsr;   /* 0x188 */
-   u32 rfcr;   /* 0x18C */
-   u32 rlrfp;  /* 0x190 */
-   u32 rlwfp;  /* 0x194 */
-   u32 rfar;   /* 0x198 */
-   u32 rfrp;   /* 0x19C */
-   u32 rfwp;   /* 0x1A0 */
-   u32 tfdr;   /* 0x1A4 */
-   u32 tfsr;   /* 0x1A8 */
-   u32 tfcr;   /* 0x1AC */
-   u32 tlrfp;  /* 0x1B0 */
-   u32 tlwfp;  /* 0x1B4 */
-   u32 tfar;   /* 0x1B8 */
-   u32 tfrp;   /* 0x1BC */
-   u32 tfwp;   /* 0x1C0 */
-   u32 frst;   /* 0x1C4 */
-   u32 ctcwr;  /* 0x1C8 */
-} fecdma_t;
-
-struct fec_info_dma {
-   int index;
-   u32 iobase;
-   u32 pinmux;
-   u32 miibase;
-   int phy_addr;
-   int dup_spd;
-   char *phy_name;
-   int phyname_init;
-   cbd_t *rxbd;/* Rx BD */
-   cbd_t *txbd;/* Tx BD */
-   uint rx_idx;
-   uint tx_idx;
-   char *txbuf;
-   int initialized;
-   struct fec_info_dma *next;
-   u16 rx_task;/* DMA receive Task Number */
-   u16 tx_task;/* DMA Transmit Task Number */
-   u16 rx_pri; /* DMA Receive Priority */
-   u16 tx_pri; /* DMA Transmit Priority */
-   u16 rx_init;/* DMA Receive Initiator

[PATCH] m68k: remove common.h references

2023-11-04 Thread Angelo Dureghello
In one case (mcffec.c), had to replace common.h include with
config.h, to avoid CFG_SYS_CACHE_ACR0 redefine-order conflict.

Signed-off-by: Angelo Dureghello 
---
 drivers/net/mcffec.c| 2 +-
 drivers/net/mcfmii.c| 1 -
 drivers/rtc/mcfrtc.c| 2 --
 drivers/serial/serial_mcf.c | 1 -
 drivers/watchdog/mcf_wdt.c  | 1 -
 5 files changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/net/mcffec.c b/drivers/net/mcffec.c
index ec1fae9688..4e0a9a8b7c 100644
--- a/drivers/net/mcffec.c
+++ b/drivers/net/mcffec.c
@@ -10,8 +10,8 @@
  * (C) 2019 Angelo Dureghello 
  */
 
-#include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/drivers/net/mcfmii.c b/drivers/net/mcfmii.c
index eae2065451..9bf887035d 100644
--- a/drivers/net/mcfmii.c
+++ b/drivers/net/mcfmii.c
@@ -4,7 +4,6 @@
  * TsiChung Liew (tsi-chung.l...@freescale.com)
  */
 
-#include 
 #include 
 #include 
 #include 
diff --git a/drivers/rtc/mcfrtc.c b/drivers/rtc/mcfrtc.c
index d2ac889c30..9708971c5c 100644
--- a/drivers/rtc/mcfrtc.c
+++ b/drivers/rtc/mcfrtc.c
@@ -4,8 +4,6 @@
  * TsiChung Liew (tsi-chung.l...@freescale.com)
  */
 
-#include 
-
 #include 
 #include 
 #include 
diff --git a/drivers/serial/serial_mcf.c b/drivers/serial/serial_mcf.c
index bb2afd0d8c..76143575fa 100644
--- a/drivers/serial/serial_mcf.c
+++ b/drivers/serial/serial_mcf.c
@@ -15,7 +15,6 @@
  * as serial console interface.
  */
 
-#include 
 #include 
 #include 
 #include 
diff --git a/drivers/watchdog/mcf_wdt.c b/drivers/watchdog/mcf_wdt.c
index b36488bb5b..b555bbeb68 100644
--- a/drivers/watchdog/mcf_wdt.c
+++ b/drivers/watchdog/mcf_wdt.c
@@ -6,7 +6,6 @@
  *
  */
 
-#include 
 #include 
 #include 
 #include 
-- 
2.42.0



Re: [PATCH] Kconfig: Remove all default n/no options

2023-10-29 Thread Angelo Dureghello

Hi Michal,

thanks, built all m68k stuff, no issues.
Also tested on stmark2, all is ok.

Reviewed-by: Angelo Dureghello 

On 25/10/23 9:25 AM, Michal Simek wrote:

Similar change was done by commit b4c2c151b14b ("Kconfig: Remove all
default n/no options") and again sync is required.

default n/no doesn't need to be specified. It is default option anyway.

Signed-off-by: Michal Simek 
---

  arch/arm/mach-imx/mxs/Kconfig  | 2 --
  arch/arm/mach-rockchip/Kconfig | 1 -
  arch/arm/mach-snapdragon/Kconfig   | 1 -
  arch/arm/mach-sunxi/Kconfig| 1 -
  arch/arm/mach-tegra/Kconfig| 1 -
  arch/m68k/Kconfig  | 1 -
  arch/riscv/Kconfig | 1 -
  board/asus/grouper/Kconfig | 2 --
  board/asus/transformer-t30/Kconfig | 1 -
  board/keymile/Kconfig  | 3 ---
  board/lg/x3-t30/Kconfig| 2 --
  cmd/Kconfig| 3 ---
  drivers/crypto/fsl/Kconfig | 1 -
  drivers/memory/Kconfig | 1 -
  drivers/misc/Kconfig   | 1 -
  drivers/mtd/nand/raw/Kconfig   | 1 -
  drivers/mtd/spi/Kconfig| 1 -
  drivers/sm/Kconfig | 1 -
  drivers/spi/Kconfig| 1 -
  drivers/usb/host/Kconfig   | 2 --
  fs/ubifs/Kconfig   | 1 -
  21 files changed, 29 deletions(-)

diff --git a/arch/arm/mach-imx/mxs/Kconfig b/arch/arm/mach-imx/mxs/Kconfig
index ccce6a78caa2..d2e4205c5ce5 100644
--- a/arch/arm/mach-imx/mxs/Kconfig
+++ b/arch/arm/mach-imx/mxs/Kconfig
@@ -54,7 +54,6 @@ config SYS_SOC
  
  config SPL_MXS_PMU_MINIMAL_VDD5V_CURRENT

bool "Force minimal current draw from VDD5V by MX28 PMU"
-   default n
help
  After setting this option, the current drawn from VDD5V
  by the PMU is reduced to zero - the DCDC_BATT is used as
@@ -62,7 +61,6 @@ config SPL_MXS_PMU_MINIMAL_VDD5V_CURRENT
  
  config SPL_MXS_PMU_DISABLE_BATT_CHARGE

bool "Disable Battery Charging in MX28 PMU"
-   default n
  
  config SPL_MXS_PMU_ENABLE_4P2_LINEAR_REGULATOR

bool "Enable the 4P2 linear regulator in MX28 PMU"
diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index c43c185c17c5..a6c69c300d00 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -450,7 +450,6 @@ config ROCKCHIP_BOOT_MODE_REG
  config ROCKCHIP_RK8XX_DISABLE_BOOT_ON_POWERON
bool "Disable device boot on power plug-in"
depends on PMIC_RK8XX
-   default n
---help---
  Say Y here to prevent the device from booting up because of a plug-in
  event. When set, the device will boot briefly to determine why it was
diff --git a/arch/arm/mach-snapdragon/Kconfig b/arch/arm/mach-snapdragon/Kconfig
index 0e073045be54..2fc1521e2d30 100644
--- a/arch/arm/mach-snapdragon/Kconfig
+++ b/arch/arm/mach-snapdragon/Kconfig
@@ -14,7 +14,6 @@ config SPL_SYS_MALLOC_F_LEN
  
  config SDM845

bool "Qualcomm Snapdragon 845 SoC"
-   default n
select LINUX_KERNEL_IMAGE_HEADER
  
  config LNX_KRNL_IMG_TEXT_OFFSET_BASE

diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig
index 40ca7d7b3a99..a10e4c06b6a3 100644
--- a/arch/arm/mach-sunxi/Kconfig
+++ b/arch/arm/mach-sunxi/Kconfig
@@ -811,7 +811,6 @@ config AXP_GPIO
  config AXP_DISABLE_BOOT_ON_POWERON
bool "Disable device boot on power plug-in"
depends on AXP209_POWER || AXP221_POWER || AXP809_POWER || AXP818_POWER
-   default n
---help---
  Say Y here to prevent the device from booting up because of a plug-in
  event. When set, the device will boot into the SPL briefly to
diff --git a/arch/arm/mach-tegra/Kconfig b/arch/arm/mach-tegra/Kconfig
index 464bd0798f62..0e94b84fe657 100644
--- a/arch/arm/mach-tegra/Kconfig
+++ b/arch/arm/mach-tegra/Kconfig
@@ -18,7 +18,6 @@ config TEGRA_CLKRST
  config TEGRA_CRYPTO
bool "Tegra AES128 crypto module"
select AES
-   default n
  
  config TEGRA_GP_PADCTRL

bool
diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index 587edd50d7e8..b288c65e7fd1 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -200,7 +200,6 @@ source "board/sysam/stmark2/Kconfig"
  
  config M68K_QEMU

bool "Build with workarounds for incomplete QEMU emulation"
-   default n
help
  QEMU 8.x currently does not implement RAMBAR accesses and
  DMA timers. Enable this option for U-Boot CI purposes only
diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index e291456530bd..8fc81fb284cd 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -68,7 +68,6 @@ config SPL_SYS_DCACHE_OFF
  config SPL_ZERO_MEM_BEFORE_USE
bool "Zero memory before use"
depends on SPL
-   default n
help
  Zero stack/GD/malloc area in SPL before using them, this is needed for
 

Re: [PATCH 4/7] m68k: Remove common.h usage

2023-10-13 Thread Angelo Dureghello

Hi Tom,

sorry, applied all now, it works, i can boot properly.

Thanks.

Acked-by: Angelo Dureghello 

On 13/10/23 10:55 PM, Tom Rini wrote:

On Fri, Oct 13, 2023 at 10:53:04PM +0200, Angelo Dureghello wrote:

Hi Tom,


On 13/10/23 1:03 AM, Tom Rini wrote:

We can remove common.h from most cases of the code here, and only a few
places need an additional header instead.

Signed-off-by: Tom Rini 
---
Cc: Angelo Dureghello 
---
   arch/m68k/cpu/mcf523x/cpu.c | 1 -
   arch/m68k/cpu/mcf523x/cpu_init.c| 1 -
   arch/m68k/cpu/mcf523x/interrupts.c  | 1 -
   arch/m68k/cpu/mcf523x/speed.c   | 1 -
   arch/m68k/cpu/mcf52x2/cpu.c | 1 -
   arch/m68k/cpu/mcf52x2/cpu_init.c| 3 +--
   arch/m68k/cpu/mcf52x2/interrupts.c  | 1 -
   arch/m68k/cpu/mcf52x2/speed.c   | 1 -
   arch/m68k/cpu/mcf530x/cpu.c | 1 -
   arch/m68k/cpu/mcf530x/cpu_init.c| 1 -
   arch/m68k/cpu/mcf530x/interrupts.c  | 1 -
   arch/m68k/cpu/mcf530x/speed.c   | 1 -
   arch/m68k/cpu/mcf532x/cpu.c | 1 -
   arch/m68k/cpu/mcf532x/cpu_init.c| 1 -
   arch/m68k/cpu/mcf532x/interrupts.c  | 1 -
   arch/m68k/cpu/mcf532x/speed.c   | 1 -
   arch/m68k/cpu/mcf5445x/cpu.c| 1 -
   arch/m68k/cpu/mcf5445x/cpu_init.c   | 1 -
   arch/m68k/cpu/mcf5445x/dspi.c   | 1 -
   arch/m68k/cpu/mcf5445x/interrupts.c | 1 -
   arch/m68k/cpu/mcf5445x/speed.c  | 1 -
   arch/m68k/cpu/mcf5445x/start.S  | 1 -
   arch/m68k/include/asm/immap.h   | 1 +
   arch/m68k/include/asm/immap_520x.h  | 1 +
   arch/m68k/include/asm/immap_5235.h  | 1 +
   arch/m68k/include/asm/immap_5272.h  | 1 +
   arch/m68k/include/asm/immap_5275.h  | 1 +
   arch/m68k/include/asm/immap_5282.h  | 1 +
   arch/m68k/include/asm/immap_5301x.h | 1 +
   arch/m68k/include/asm/immap_5307.h  | 2 ++
   arch/m68k/include/asm/immap_5329.h  | 1 +
   arch/m68k/include/asm/immap_5441x.h | 1 +
   arch/m68k/lib/bdinfo.c  | 3 ++-
   arch/m68k/lib/bootm.c   | 1 -
   arch/m68k/lib/cache.c   | 2 +-
   arch/m68k/lib/fec.c | 2 +-
   arch/m68k/lib/interrupts.c  | 2 +-
   arch/m68k/lib/time.c| 1 -
   arch/m68k/lib/traps.c   | 1 -
   39 files changed, 17 insertions(+), 30 deletions(-)



building for mcf5307 i get this error

In file included from arch/m68k/lib/bootm.c:7:
include/bootstage.h:225:1: error: unknown type name 'ulong'; did you mean
'long'?
   225 | ulong timer_get_boot_us(void);
   | ^


Did you apply the whole series?  The first few patches fix some global
issues.



--
Angelo Dureghello
w: www.kernel-space.org
e: ang...@kernel-space.org


Re: [PATCH 4/7] m68k: Remove common.h usage

2023-10-13 Thread Angelo Dureghello

Hi Tom,


On 13/10/23 1:03 AM, Tom Rini wrote:

We can remove common.h from most cases of the code here, and only a few
places need an additional header instead.

Signed-off-by: Tom Rini 
---
Cc: Angelo Dureghello 
---
  arch/m68k/cpu/mcf523x/cpu.c | 1 -
  arch/m68k/cpu/mcf523x/cpu_init.c| 1 -
  arch/m68k/cpu/mcf523x/interrupts.c  | 1 -
  arch/m68k/cpu/mcf523x/speed.c   | 1 -
  arch/m68k/cpu/mcf52x2/cpu.c | 1 -
  arch/m68k/cpu/mcf52x2/cpu_init.c| 3 +--
  arch/m68k/cpu/mcf52x2/interrupts.c  | 1 -
  arch/m68k/cpu/mcf52x2/speed.c   | 1 -
  arch/m68k/cpu/mcf530x/cpu.c | 1 -
  arch/m68k/cpu/mcf530x/cpu_init.c| 1 -
  arch/m68k/cpu/mcf530x/interrupts.c  | 1 -
  arch/m68k/cpu/mcf530x/speed.c   | 1 -
  arch/m68k/cpu/mcf532x/cpu.c | 1 -
  arch/m68k/cpu/mcf532x/cpu_init.c| 1 -
  arch/m68k/cpu/mcf532x/interrupts.c  | 1 -
  arch/m68k/cpu/mcf532x/speed.c   | 1 -
  arch/m68k/cpu/mcf5445x/cpu.c| 1 -
  arch/m68k/cpu/mcf5445x/cpu_init.c   | 1 -
  arch/m68k/cpu/mcf5445x/dspi.c   | 1 -
  arch/m68k/cpu/mcf5445x/interrupts.c | 1 -
  arch/m68k/cpu/mcf5445x/speed.c  | 1 -
  arch/m68k/cpu/mcf5445x/start.S  | 1 -
  arch/m68k/include/asm/immap.h   | 1 +
  arch/m68k/include/asm/immap_520x.h  | 1 +
  arch/m68k/include/asm/immap_5235.h  | 1 +
  arch/m68k/include/asm/immap_5272.h  | 1 +
  arch/m68k/include/asm/immap_5275.h  | 1 +
  arch/m68k/include/asm/immap_5282.h  | 1 +
  arch/m68k/include/asm/immap_5301x.h | 1 +
  arch/m68k/include/asm/immap_5307.h  | 2 ++
  arch/m68k/include/asm/immap_5329.h  | 1 +
  arch/m68k/include/asm/immap_5441x.h | 1 +
  arch/m68k/lib/bdinfo.c  | 3 ++-
  arch/m68k/lib/bootm.c   | 1 -
  arch/m68k/lib/cache.c   | 2 +-
  arch/m68k/lib/fec.c | 2 +-
  arch/m68k/lib/interrupts.c  | 2 +-
  arch/m68k/lib/time.c| 1 -
  arch/m68k/lib/traps.c   | 1 -
  39 files changed, 17 insertions(+), 30 deletions(-)



building for mcf5307 i get this error

In file included from arch/m68k/lib/bootm.c:7:
include/bootstage.h:225:1: error: unknown type name 'ulong'; did you 
mean 'long'?

  225 | ulong timer_get_boot_us(void);
  | ^

regards,
--
Angelo Dureghello
w: www.kernel-space.org
e: ang...@kernel-space.org


[PULL] please pull u-boot-coldfire/next

2023-09-06 Thread Angelo Dureghello

Hi Tom,

The following changes since commit b53ab97150314674edc25508f4fc528be2baa73f:

  event.h: Documented some newly added portions better (2023-09-04 
11:19:50 -0400)


are available in the Git repository at:

  git://git.denx.de/u-boot-coldfire.git next

for you to fetch changes up to 26af162ac8f8ab3222d32f00f06a4774a061150a:

  arch: m68k: Implement relocation (2023-09-06 13:28:58 +0200)


Marek Vasut (3):
  tools: relocate-rela: Fix BE symtab handling
  tools: relocate-rela: Add M68K support
  arch: m68k: Implement relocation

 arch/Kconfig   |   1 -
 arch/m68k/Kconfig  |   4 +--
 arch/m68k/config.mk|   6 ++--
 arch/m68k/cpu/mcf523x/start.S  |  57 +
 arch/m68k/cpu/mcf52x2/start.S  |  57 +
 arch/m68k/cpu/mcf530x/start.S  |  59 +-
 arch/m68k/cpu/mcf532x/start.S  |  57 +
 arch/m68k/cpu/mcf5445x/start.S |  57 +
 arch/m68k/cpu/u-boot.lds   |  14 
 tools/relocate-rela.c  | 134 
+

 10 files changed, 303 insertions(+), 143 deletions(-)


Re: [PATCH] tools: relocate-rela: Fix BE symtab handling

2023-08-28 Thread Angelo Dureghello

applied to u-boot-coldfire

Thanks,
angelo

On 31/07/23 12:16 AM, Marek Vasut wrote:

The symtab contains data in target endianness, convert the data to
native endianness before doing any operations and on them, and back
to target endianness before updating the bin file.

Signed-off-by: Marek Vasut 
---
Cc: Angelo Dureghello 
Cc: Angelo Durgehello 
Cc: Bin Meng 
Cc: Heinrich Schuchardt 
Cc: Huan Wang 
Cc: Marek Vasut 
Cc: Michal Simek 
Cc: Ovidiu Panait 
Cc: Simon Glass 
Cc: Zong Li 
---
  tools/relocate-rela.c | 18 ++
  1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/tools/relocate-rela.c b/tools/relocate-rela.c
index f230ec5676c..e28e7fcc6f5 100644
--- a/tools/relocate-rela.c
+++ b/tools/relocate-rela.c
@@ -78,6 +78,14 @@ static uint32_t elf32_to_cpu(uint32_t data)
return be32_to_cpu(data);
  }
  
+static uint32_t cpu_to_elf32(uint32_t data)

+{
+   if (ei_data == ELFDATA2LSB)
+   return cpu_to_le32(data);
+
+   return cpu_to_be32(data);
+}
+
  static bool supported_rela(Elf64_Rela *rela)
  {
uint64_t mask = 0xULL; /* would be different on 32-bit */
@@ -602,14 +610,16 @@ static int rela_elf32(char **argv, FILE *f)
}
  
  			debug("Symbol description:\n");

-   debug(" st_name:\t0x%x\n", symbols.st_name);
-   debug(" st_value:\t0x%x\n", symbols.st_value);
-   debug(" st_size:\t0x%x\n", symbols.st_size);
+   debug(" st_name:\t0x%x\n", 
elf32_to_cpu(symbols.st_name));
+   debug(" st_value:\t0x%x\n", 
elf32_to_cpu(symbols.st_value));
+   debug(" st_size:\t0x%x\n", 
elf32_to_cpu(symbols.st_size));
  
-			value = swrela.r_addend + symbols.st_value;

+   value = swrela.r_addend + 
elf32_to_cpu(symbols.st_value);
  
  			debug("Value:\t0x%x\n", value);
  
+			value = cpu_to_elf32(value);

+
if (fseek(f, addr, SEEK_SET) < 0) {
fprintf(stderr, "%s: %s: seek to %"
PRIx32 " failed: %s\n",


Re: [PATCH 1/2] tools: relocate-rela: Add M68K support

2023-08-28 Thread Angelo Dureghello

Hi,

applying this patchset to u-boot-coldfire

Thanks,
angelo

On 27/08/23 12:29 AM, Marek Vasut wrote:

On 8/26/23 09:44, Angelo Dureghello wrote:

Hi Marek,

thanks a lot for the job i should have done.

Tested on real hw:

m5282evb   worked out of the box
mcf54415   not working,
had a lot of unsupported relocation type for R_68K_JMP_SLOT
mcf5307    need to fix the hw, will do in short

i had to add this fix:

diff --git a/tools/relocate-rela.c b/tools/relocate-rela.c
index 2d008c7f60..9722a6291a 100644
--- a/tools/relocate-rela.c
+++ b/tools/relocate-rela.c
@@ -40,6 +40,10 @@
  #define R_68K_GLOB_DAT 20
  #endif

+#ifndef R_68K_JMP_SLOT
+#define R_68K_JMP_SLOT  21
+#endif
+
  #ifndef R_68K_RELATIVE
  #define R_68K_RELATIVE 22
  #endif
@@ -531,6 +535,9 @@ static bool supported_rela32(Elf32_Rela *rela, 
uint32_t *type)

 case R_68K_RELATIVE:
 debug("R_68K_RELATIVE\n");
 return true;
+   case R_68K_JMP_SLOT:
+    debug("R_68K_JMP_SLOT\n");
+    return true;
 }
 } else {
 switch (*type) {
@@ -631,8 +638,9 @@ static int rela_elf32(char **argv, FILE *f)
 return 4;
 }
 } else if ((machine == EM_M68K &&
-   (type == R_68K_32 || type == 
R_68K_GLOB_DAT)) ||

-  (machine == EM_MICROBLAZE &&
+   (type == R_68K_32 || type == 
R_68K_GLOB_DAT ||

+    type == R_68K_JMP_SLOT)) ||
+   (machine == EM_MICROBLAZE &&
 (type == R_MICROBLAZE_32 ||
  type == R_MICROBLAZE_GLOB_DAT))) {
 /* global symbols read it and add reloc 
offset */


Wrapped into V2, thanks


Re: [PATCH 1/2] tools: relocate-rela: Add M68K support

2023-08-27 Thread Angelo Dureghello

Hi Marex,

thanks,

Acked-by: Angelo Dureghello 

On 27/08/23 12:29 AM, Marek Vasut wrote:

On 8/26/23 09:44, Angelo Dureghello wrote:

Hi Marek,

thanks a lot for the job i should have done.

Tested on real hw:

m5282evb   worked out of the box
mcf54415   not working,
had a lot of unsupported relocation type for R_68K_JMP_SLOT
mcf5307    need to fix the hw, will do in short

i had to add this fix:

diff --git a/tools/relocate-rela.c b/tools/relocate-rela.c
index 2d008c7f60..9722a6291a 100644
--- a/tools/relocate-rela.c
+++ b/tools/relocate-rela.c
@@ -40,6 +40,10 @@
  #define R_68K_GLOB_DAT 20
  #endif

+#ifndef R_68K_JMP_SLOT
+#define R_68K_JMP_SLOT  21
+#endif
+
  #ifndef R_68K_RELATIVE
  #define R_68K_RELATIVE 22
  #endif
@@ -531,6 +535,9 @@ static bool supported_rela32(Elf32_Rela *rela, 
uint32_t *type)

 case R_68K_RELATIVE:
 debug("R_68K_RELATIVE\n");
 return true;
+   case R_68K_JMP_SLOT:
+    debug("R_68K_JMP_SLOT\n");
+    return true;
 }
 } else {
 switch (*type) {
@@ -631,8 +638,9 @@ static int rela_elf32(char **argv, FILE *f)
 return 4;
 }
 } else if ((machine == EM_M68K &&
-   (type == R_68K_32 || type == 
R_68K_GLOB_DAT)) ||

-  (machine == EM_MICROBLAZE &&
+   (type == R_68K_32 || type == 
R_68K_GLOB_DAT ||

+    type == R_68K_JMP_SLOT)) ||
+   (machine == EM_MICROBLAZE &&
 (type == R_MICROBLAZE_32 ||
  type == R_MICROBLAZE_GLOB_DAT))) {
 /* global symbols read it and add reloc 
offset */


Wrapped into V2, thanks


Re: [PATCH 1/2] tools: relocate-rela: Add M68K support

2023-08-26 Thread Angelo Dureghello

Hi Marek,

thanks a lot for the job i should have done.

Tested on real hw:

m5282evb   worked out of the box
mcf54415   not working,
had a lot of unsupported relocation type for R_68K_JMP_SLOT
mcf5307need to fix the hw, will do in short

i had to add this fix:

diff --git a/tools/relocate-rela.c b/tools/relocate-rela.c
index 2d008c7f60..9722a6291a 100644
--- a/tools/relocate-rela.c
+++ b/tools/relocate-rela.c
@@ -40,6 +40,10 @@
 #define R_68K_GLOB_DAT 20
 #endif

+#ifndef R_68K_JMP_SLOT
+#define R_68K_JMP_SLOT  21
+#endif
+
 #ifndef R_68K_RELATIVE
 #define R_68K_RELATIVE 22
 #endif
@@ -531,6 +535,9 @@ static bool supported_rela32(Elf32_Rela *rela, 
uint32_t *type)

case R_68K_RELATIVE:
debug("R_68K_RELATIVE\n");
return true;
+   case R_68K_JMP_SLOT:
+debug("R_68K_JMP_SLOT\n");
+return true;
}
} else {
switch (*type) {
@@ -631,8 +638,9 @@ static int rela_elf32(char **argv, FILE *f)
return 4;
}
} else if ((machine == EM_M68K &&
-   (type == R_68K_32 || type == R_68K_GLOB_DAT)) ||
-  (machine == EM_MICROBLAZE &&
+   (type == R_68K_32 || type == R_68K_GLOB_DAT ||
+type == R_68K_JMP_SLOT)) ||
+   (machine == EM_MICROBLAZE &&
(type == R_MICROBLAZE_32 ||
 type == R_MICROBLAZE_GLOB_DAT))) {
/* global symbols read it and add reloc offset */



On 31/07/23 12:20 AM, Marek Vasut wrote:

Add M68K ELF32 support into this tool, so it can patch static rela
into M68K u-boot-nodtb.bin . This is the first step toward M68K
relocation support, and in turn, removal of NEEDS_MANUAL_RELOC
from the codebase altogether.

Signed-off-by: Marek Vasut 
---
Cc: Angelo Dureghello 
Cc: Angelo Durgehello 
Cc: Bin Meng 
Cc: Heinrich Schuchardt 
Cc: Huan Wang 
Cc: Marek Vasut 
Cc: Michal Simek 
Cc: Ovidiu Panait 
Cc: Simon Glass 
Cc: Zong Li 
---
  tools/relocate-rela.c | 108 ++
  1 file changed, 77 insertions(+), 31 deletions(-)

diff --git a/tools/relocate-rela.c b/tools/relocate-rela.c
index e28e7fcc6f5..2d008c7f602 100644
--- a/tools/relocate-rela.c
+++ b/tools/relocate-rela.c
@@ -24,6 +24,26 @@
  #define R_AARCH64_RELATIVE1027
  #endif
  
+#ifndef EM_M68K

+#define EM_M68K4
+#endif
+
+#ifndef R_68K_NONE
+#define R_68K_NONE 0
+#endif
+
+#ifndef R_68K_32
+#define R_68K_32   1
+#endif
+
+#ifndef R_68K_GLOB_DAT
+#define R_68K_GLOB_DAT 20
+#endif
+
+#ifndef R_68K_RELATIVE
+#define R_68K_RELATIVE 22
+#endif
+
  #ifndef EM_MICROBLAZE
  #define EM_MICROBLAZE 189
  #endif
@@ -46,6 +66,7 @@
  
  static int ei_class;

  static int ei_data;
+static int machine;
  
  static uint64_t rela_start, rela_end, text_base, dyn_start;
  
@@ -111,7 +132,7 @@ static int decode_elf64(FILE *felf, char **argv)

uint64_t sh_addr, sh_offset, sh_size;
Elf64_Half sh_index, sh_num;
Elf64_Shdr *sh_table; /* Elf symbol table */
-   int ret, i, machine;
+   int ret, i;
char *sh_str;
  
  	debug("64bit version\n");

@@ -245,7 +266,7 @@ static int decode_elf32(FILE *felf, char **argv)
uint32_t sh_addr, sh_offset, sh_size;
Elf32_Half sh_index, sh_num;
Elf32_Shdr *sh_table; /* Elf symbol table */
-   int ret, i, machine;
+   int ret, i;
char *sh_str;
  
  	debug("32bit version\n");

@@ -262,12 +283,20 @@ static int decode_elf32(FILE *felf, char **argv)
machine = elf16_to_cpu(header.e_machine);
debug("Machine %d\n", machine);
  
-	if (machine != EM_MICROBLAZE) {

+   if (machine != EM_MICROBLAZE && machine != EM_M68K) {
fprintf(stderr, "%s: Not supported machine type\n", argv[0]);
return 30;
}
  
  	text_base = elf32_to_cpu(header.e_entry);

+   /*
+* M68K ELF entry point is MONITOR_BASE, not TEXT_BASE.
+* TEXT_BASE is always MONITOR_BASE &~ 0x7ff, so clear
+* those bits here.
+*/
+   if (machine == EM_M68K)
+   text_base &= ~0x7ff;
+
section_header_base = elf32_to_cpu(header.e_shoff);
section_header_size = elf16_to_cpu(header.e_shentsize) *
  elf16_to_cpu(header.e_shnum);
@@ -488,25 +517,41 @@ static bool supported_rela32(Elf32_Rela *rela, uint32_t 
*type)
  
  	debug("Type:\t");
  
-	switch (*type) {

-   case R_MICROBLAZE_32:
-   debug("R_MICROBLAZE_32\n");
-   return true;
-   case R_MICROBLAZE

Re: [PATCH] tools: relocate-rela: Fix BE symtab handling

2023-08-26 Thread Angelo Dureghello

Hi Marek,

thanks !

Reviewed-by: Angelo Dureghello 


On 31/07/23 12:16 AM, Marek Vasut wrote:

The symtab contains data in target endianness, convert the data to
native endianness before doing any operations and on them, and back
to target endianness before updating the bin file.

Signed-off-by: Marek Vasut 
---
Cc: Angelo Dureghello 
Cc: Angelo Durgehello 
Cc: Bin Meng 
Cc: Heinrich Schuchardt 
Cc: Huan Wang 
Cc: Marek Vasut 
Cc: Michal Simek 
Cc: Ovidiu Panait 
Cc: Simon Glass 
Cc: Zong Li 
---
  tools/relocate-rela.c | 18 ++
  1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/tools/relocate-rela.c b/tools/relocate-rela.c
index f230ec5676c..e28e7fcc6f5 100644
--- a/tools/relocate-rela.c
+++ b/tools/relocate-rela.c
@@ -78,6 +78,14 @@ static uint32_t elf32_to_cpu(uint32_t data)
return be32_to_cpu(data);
  }
  
+static uint32_t cpu_to_elf32(uint32_t data)

+{
+   if (ei_data == ELFDATA2LSB)
+   return cpu_to_le32(data);
+
+   return cpu_to_be32(data);
+}
+
  static bool supported_rela(Elf64_Rela *rela)
  {
uint64_t mask = 0xULL; /* would be different on 32-bit */
@@ -602,14 +610,16 @@ static int rela_elf32(char **argv, FILE *f)
}
  
  			debug("Symbol description:\n");

-   debug(" st_name:\t0x%x\n", symbols.st_name);
-   debug(" st_value:\t0x%x\n", symbols.st_value);
-   debug(" st_size:\t0x%x\n", symbols.st_size);
+   debug(" st_name:\t0x%x\n", 
elf32_to_cpu(symbols.st_name));
+   debug(" st_value:\t0x%x\n", 
elf32_to_cpu(symbols.st_value));
+   debug(" st_size:\t0x%x\n", 
elf32_to_cpu(symbols.st_size));
  
-			value = swrela.r_addend + symbols.st_value;

+   value = swrela.r_addend + 
elf32_to_cpu(symbols.st_value);
  
  			debug("Value:\t0x%x\n", value);
  
+			value = cpu_to_elf32(value);

+
if (fseek(f, addr, SEEK_SET) < 0) {
fprintf(stderr, "%s: %s: seek to %"
PRIx32 " failed: %s\n",





[PULL] Please pull u-boot-coldfire/master

2023-07-25 Thread Angelo Dureghello

The following changes since commit ff296acc3549c18aaf95dcb1052c9fe4f1a98552:

  Prepare v2023.10-rc1 (2023-07-25 17:19:54 -0400)

are available in the Git repository at:

  git://git.denx.de/u-boot-coldfire.git master

for you to fetch changes up to 59dee11b17fecb516872ea7951f9a528003602eb:

  MAINTAINERS: add myself as mcf_wdt.c maintainer (2023-07-25 23:21:42 
+0200)



Angelo Dureghello (6):
  board: m68k add missing maintainer
  drivers: watchdog: add mcf watchdog support
  m68k: move watchdog functions in mcf_wdt driver
  m68k: dts: add watchdog node
  configs: m68k: add watchdog driver
  MAINTAINERS: add myself as mcf_wdt.c maintainer

 MAINTAINERS   |   1 +
 arch/m68k/cpu/mcf523x/cpu.c   |  42 --
 arch/m68k/cpu/mcf52x2/cpu.c   |  47 +
 arch/m68k/cpu/mcf532x/cpu.c   |  44 ---
 arch/m68k/dts/M5208EVBE.dts   |   5 +++
 arch/m68k/dts/mcf5208.dtsi|   6 
 arch/m68k/dts/mcf523x.dtsi|   6 
 arch/m68k/dts/mcf5271.dtsi|   6 
 arch/m68k/dts/mcf5275.dtsi|   6 
 arch/m68k/dts/mcf5282.dtsi|   6 
 arch/m68k/dts/mcf5329.dtsi|   6 
 arch/m68k/dts/mcf537x.dtsi|   6 
 board/cobra5272/MAINTAINERS   |   2 +-
 board/freescale/m5208evbe/MAINTAINERS |   2 +-
 board/freescale/m5249evb/MAINTAINERS  |   2 +-
 board/freescale/m5272c3/MAINTAINERS   |   2 +-
 board/freescale/m5275evb/MAINTAINERS  |   2 +-
 board/freescale/m5282evb/MAINTAINERS  |   2 +-
 configs/M5208EVBE_defconfig   |   2 ++
 configs/astro_mcf5373l_defconfig  |   4 +--
 configs/eb_cpu5282_defconfig  |   1 +
 configs/eb_cpu5282_internal_defconfig |   1 +
 drivers/watchdog/Kconfig  |   7 
 drivers/watchdog/Makefile |   1 +
 drivers/watchdog/mcf_wdt.c| 135 
++

 25 files changed, 204 insertions(+), 140 deletions(-)
 create mode 100644 drivers/watchdog/mcf_wdt.c


[PATCH v3 5/5] MAINTAINERS: add myself as mcf_wdt.c maintainer

2023-07-24 Thread Angelo Dureghello
Signed-off-by: Angelo Dureghello 
---
Changes for v2:
- none
Changes for v3:
- none
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 87991cccdd..2b157214cb 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -867,6 +867,7 @@ S:  Maintained
 T: git https://source.denx.de/u-boot/custodians/u-boot-coldfire.git
 F: arch/m68k/
 F: doc/arch/m68k.rst
+F: drivers/watchdog/mcf_wdt.c
 
 CYCLIC
 M: Stefan Roese 
-- 
2.41.0



[PATCH v3 2/5] m68k: move watchdog functions in mcf_wdt driver

2023-07-24 Thread Angelo Dureghello
Move watchdog functions inside a separate watchdog driver.

Signed-off-by: Angelo Dureghello 
---
Changes for v2:
- none
Changes for v3:
- none
---
 arch/m68k/cpu/mcf523x/cpu.c | 42 -
 arch/m68k/cpu/mcf52x2/cpu.c | 47 +
 arch/m68k/cpu/mcf532x/cpu.c | 44 --
 3 files changed, 1 insertion(+), 132 deletions(-)

diff --git a/arch/m68k/cpu/mcf523x/cpu.c b/arch/m68k/cpu/mcf523x/cpu.c
index ba2c228911..bef67767b4 100644
--- a/arch/m68k/cpu/mcf523x/cpu.c
+++ b/arch/m68k/cpu/mcf523x/cpu.c
@@ -12,7 +12,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -62,47 +61,6 @@ int print_cpuinfo(void)
 };
 #endif /* CONFIG_DISPLAY_CPUINFO */
 
-#if defined(CONFIG_WATCHDOG)
-/* Called by macro WATCHDOG_RESET */
-void watchdog_reset(void)
-{
-   wdog_t *wdp = (wdog_t *) (MMAP_WDOG);
-
-   /* Count register */
-   out_be16(>sr, 0x);
-   asm("nop");
-   out_be16(>sr, 0x);
-}
-
-int watchdog_disable(void)
-{
-   wdog_t *wdp = (wdog_t *) (MMAP_WDOG);
-
-   /* UserManual, once the wdog is disabled, wdog cannot be re-enabled */
-   /* halted watchdog timer */
-   setbits_be16(>cr, WTM_WCR_HALTED);
-
-   puts("WATCHDOG:disabled\n");
-   return (0);
-}
-
-int watchdog_init(void)
-{
-   wdog_t *wdp = (wdog_t *) (MMAP_WDOG);
-   u32 wdog_module = 0;
-
-   /* set timeout and enable watchdog */
-   wdog_module = ((CFG_SYS_CLK / CONFIG_SYS_HZ) * 
CONFIG_WATCHDOG_TIMEOUT_MSECS);
-   wdog_module |= (wdog_module / 8192);
-   out_be16(>mr, wdog_module);
-
-   out_be16(>cr, WTM_WCR_EN);
-   puts("WATCHDOG:enabled\n");
-
-   return (0);
-}
-#endif /* CONFIG_WATCHDOG */
-
 #if defined(CONFIG_MCFFEC)
 /* Default initializations for MCFFEC controllers.  To override,
  * create a board-specific function called:
diff --git a/arch/m68k/cpu/mcf52x2/cpu.c b/arch/m68k/cpu/mcf52x2/cpu.c
index d7cbf11e25..5042a38b3e 100644
--- a/arch/m68k/cpu/mcf52x2/cpu.c
+++ b/arch/m68k/cpu/mcf52x2/cpu.c
@@ -17,7 +17,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -53,51 +52,7 @@ int print_cpuinfo(void)
return 0;
 };
 #endif /* CONFIG_DISPLAY_CPUINFO */
-
-#if defined(CONFIG_WATCHDOG)
-/* Called by macro WATCHDOG_RESET */
-void watchdog_reset(void)
-{
-   wdog_t *wdt = (wdog_t *)(MMAP_WDOG);
-
-   out_be16(>sr, 0x);
-   out_be16(>sr, 0x);
-}
-
-int watchdog_disable(void)
-{
-   wdog_t *wdt = (wdog_t *)(MMAP_WDOG);
-
-   /* reset watchdog counter */
-   out_be16(>sr, 0x);
-   out_be16(>sr, 0x);
-   /* disable watchdog timer */
-   out_be16(>cr, 0);
-
-   puts("WATCHDOG:disabled\n");
-   return (0);
-}
-
-int watchdog_init(void)
-{
-   wdog_t *wdt = (wdog_t *)(MMAP_WDOG);
-
-   /* disable watchdog */
-   out_be16(>cr, 0);
-
-   /* set timeout and enable watchdog */
-   out_be16(>mr,
-   (CONFIG_WATCHDOG_TIMEOUT_MSECS * CONFIG_SYS_HZ) / (32768 * 
1000) - 1);
-
-   /* reset watchdog counter */
-   out_be16(>sr, 0x);
-   out_be16(>sr, 0x);
-
-   puts("WATCHDOG:enabled\n");
-   return (0);
-}
-#endif /* #ifdef CONFIG_WATCHDOG */
-#endif /* #ifdef CONFIG_M5208 */
+#endif /* #ifdef CONFIG_M5208 */
 
 #ifdef  CONFIG_M5271
 #if defined(CONFIG_DISPLAY_CPUINFO)
diff --git a/arch/m68k/cpu/mcf532x/cpu.c b/arch/m68k/cpu/mcf532x/cpu.c
index 548cbca36a..18d20a8926 100644
--- a/arch/m68k/cpu/mcf532x/cpu.c
+++ b/arch/m68k/cpu/mcf532x/cpu.c
@@ -12,7 +12,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -102,49 +101,6 @@ int print_cpuinfo(void)
 };
 #endif /* CONFIG_DISPLAY_CPUINFO */
 
-#if defined(CONFIG_WATCHDOG)
-/* Called by macro WATCHDOG_RESET */
-void watchdog_reset(void)
-{
-   wdog_t *wdp = (wdog_t *) (MMAP_WDOG);
-
-   /* Count register */
-   out_be16(>sr, 0x);
-   out_be16(>sr, 0x);
-}
-
-int watchdog_disable(void)
-{
-   wdog_t *wdp = (wdog_t *) (MMAP_WDOG);
-
-   /* UserManual, once the wdog is disabled, wdog cannot be re-enabled */
-   /* halted watchdog timer */
-   setbits_be16(>cr, WTM_WCR_HALTED);
-
-   puts("WATCHDOG:disabled\n");
-   return (0);
-}
-
-int watchdog_init(void)
-{
-   wdog_t *wdp = (wdog_t *) (MMAP_WDOG);
-   u32 wdog_module = 0;
-
-   /* set timeout and enable watchdog */
-   wdog_module = ((CFG_SYS_CLK / 1000) * CONFIG_WATCHDOG_TIMEOUT_MSECS);
-#ifdef CONFIG_M5329
-   out_be16(>mr, wdog_module / 8192);
-#else
-   out_be16(>mr, wdog_module / 4096);
-#endif
-
-   out_be16(>cr, WTM_WCR_EN);
-   puts("WATCHDOG:enabled\n");
-
-   return (0);
-}
-#endif   

[PATCH v3 4/5] configs: m68k: add watchdog driver

2023-07-24 Thread Angelo Dureghello
Add config options for mcf_wdt driver.

Signed-off-by: Angelo Dureghello 
---
Changes for v2:
- none
Changes for v3:
- none
---
 configs/M5208EVBE_defconfig   | 2 ++
 configs/astro_mcf5373l_defconfig  | 4 ++--
 configs/eb_cpu5282_defconfig  | 1 +
 configs/eb_cpu5282_internal_defconfig | 1 +
 4 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/configs/M5208EVBE_defconfig b/configs/M5208EVBE_defconfig
index 0c5afe869b..aa054f753f 100644
--- a/configs/M5208EVBE_defconfig
+++ b/configs/M5208EVBE_defconfig
@@ -50,3 +50,5 @@ CONFIG_MCFFEC=y
 CONFIG_MII=y
 CONFIG_MCFUART=y
 CONFIG_WATCHDOG_TIMEOUT_MSECS=5000
+CONFIG_WDT=y
+CONFIG_WDT_MCF=y
diff --git a/configs/astro_mcf5373l_defconfig b/configs/astro_mcf5373l_defconfig
index aade1f98be..f4dad3bcc8 100644
--- a/configs/astro_mcf5373l_defconfig
+++ b/configs/astro_mcf5373l_defconfig
@@ -46,5 +46,5 @@ CONFIG_DM_RTC=y
 CONFIG_MCFRTC=y
 CONFIG_SYS_MCFRTC_BASE=0xFC0A8000
 CONFIG_MCFUART=y
-CONFIG_WATCHDOG=y
-CONFIG_WATCHDOG_TIMEOUT_MSECS=3355
+CONFIG_WDT=y
+CONFIG_WDT_MCF=y
diff --git a/configs/eb_cpu5282_defconfig b/configs/eb_cpu5282_defconfig
index 24edecb510..2873322598 100644
--- a/configs/eb_cpu5282_defconfig
+++ b/configs/eb_cpu5282_defconfig
@@ -52,3 +52,4 @@ CONFIG_MII=y
 CONFIG_DM_RTC=y
 CONFIG_RTC_DS1338=y
 CONFIG_MCFUART=y
+CONFIG_WDT=y
diff --git a/configs/eb_cpu5282_internal_defconfig 
b/configs/eb_cpu5282_internal_defconfig
index 44e22eb01d..bd780034ba 100644
--- a/configs/eb_cpu5282_internal_defconfig
+++ b/configs/eb_cpu5282_internal_defconfig
@@ -50,3 +50,4 @@ CONFIG_MII=y
 CONFIG_DM_RTC=y
 CONFIG_RTC_DS1338=y
 CONFIG_MCFUART=y
+CONFIG_WDT=y
-- 
2.41.0



[PATCH v3 3/5] m68k: dts: add watchdog node

2023-07-24 Thread Angelo Dureghello
Add watchdog node for the implemented mcf_wdt driver.

Signed-off-by: Angelo Dureghello 
---
Changes for v2:
- remove unnecessary big-endian property
Changes for v3:
- none
---
 arch/m68k/dts/M5208EVBE.dts | 5 +
 arch/m68k/dts/mcf5208.dtsi  | 6 ++
 arch/m68k/dts/mcf523x.dtsi  | 6 ++
 arch/m68k/dts/mcf5271.dtsi  | 6 ++
 arch/m68k/dts/mcf5275.dtsi  | 6 ++
 arch/m68k/dts/mcf5282.dtsi  | 6 ++
 arch/m68k/dts/mcf5329.dtsi  | 6 ++
 arch/m68k/dts/mcf537x.dtsi  | 6 ++
 8 files changed, 47 insertions(+)

diff --git a/arch/m68k/dts/M5208EVBE.dts b/arch/m68k/dts/M5208EVBE.dts
index 1c32718af4..ec203e8b69 100644
--- a/arch/m68k/dts/M5208EVBE.dts
+++ b/arch/m68k/dts/M5208EVBE.dts
@@ -15,6 +15,11 @@
};
 };
 
+ {
+   timeout-sec = <32>;
+   status = "okay";
+};
+
  {
bootph-all;
status = "okay";
diff --git a/arch/m68k/dts/mcf5208.dtsi b/arch/m68k/dts/mcf5208.dtsi
index 9392facfa8..c61dbf3557 100644
--- a/arch/m68k/dts/mcf5208.dtsi
+++ b/arch/m68k/dts/mcf5208.dtsi
@@ -16,6 +16,12 @@
#address-cells = <1>;
#size-cells = <1>;
 
+   wdog0: watchdog@fc08c000 {
+   compatible = "fsl,mcf5208-wdt";
+   reg = <0xfc08c000 0x10>;
+   status = "disabled";
+   };
+
uart0: uart@fc06 {
compatible = "fsl,mcf-uart";
reg = <0xfc06 0x40>;
diff --git a/arch/m68k/dts/mcf523x.dtsi b/arch/m68k/dts/mcf523x.dtsi
index 41c7b9b2d1..cae7b4f861 100644
--- a/arch/m68k/dts/mcf523x.dtsi
+++ b/arch/m68k/dts/mcf523x.dtsi
@@ -23,6 +23,12 @@
ranges = <0x 0x4000 0x4000>;
reg = <0x4000 0x4000>;
 
+   wdog0: watchdog@14 {
+   compatible = "fsl,mcf5208-wdt";
+   reg = <0x14 0x10>;
+   status = "disabled";
+   };
+
uart0: uart@200 {
compatible = "fsl,mcf-uart";
reg = <0x200 0x40>;
diff --git a/arch/m68k/dts/mcf5271.dtsi b/arch/m68k/dts/mcf5271.dtsi
index fc82bd3c24..5acf6994af 100644
--- a/arch/m68k/dts/mcf5271.dtsi
+++ b/arch/m68k/dts/mcf5271.dtsi
@@ -23,6 +23,12 @@
ranges = <0x 0x4000 0x4000>;
reg = <0x4000 0x4000>;
 
+   wdog0: watchdog@14 {
+   compatible = "fsl,mcf5208-wdt";
+   reg = <0x14 0x10>;
+   status = "disabled";
+   };
+
uart0: uart@200 {
compatible = "fsl,mcf-uart";
reg = <0x200 0x40>;
diff --git a/arch/m68k/dts/mcf5275.dtsi b/arch/m68k/dts/mcf5275.dtsi
index 402517cdec..3df17b445c 100644
--- a/arch/m68k/dts/mcf5275.dtsi
+++ b/arch/m68k/dts/mcf5275.dtsi
@@ -24,6 +24,12 @@
ranges = <0x 0x4000 0x4000>;
reg = <0x4000 0x4000>;
 
+   wdog0: watchdog@14 {
+   compatible = "fsl,mcf5208-wdt";
+   reg = <0x14 0x10>;
+   status = "disabled";
+   };
+
uart0: uart@200 {
compatible = "fsl,mcf-uart";
reg = <0x200 0x40>;
diff --git a/arch/m68k/dts/mcf5282.dtsi b/arch/m68k/dts/mcf5282.dtsi
index 883c0d0324..640c1a32e4 100644
--- a/arch/m68k/dts/mcf5282.dtsi
+++ b/arch/m68k/dts/mcf5282.dtsi
@@ -23,6 +23,12 @@
ranges = <0x 0x4000 0x4000>;
reg = <0x4000 0x4000>;
 
+   wdog0: watchdog@14 {
+   compatible = "fsl,mcf5282-wdt";
+   reg = <0x14 0x10>;
+   status = "disabled";
+   };
+
uart0: uart@200 {
compatible = "fsl,mcf-uart";
reg = <0x200 0x40>;
diff --git a/arch/m68k/dts/mcf5329.dtsi b/arch/m68k/dts/mcf5329.dtsi
index 7501cc4b01..991985e48c 100644
--- a/arch/m68k/dts/mcf5329.dtsi
+++ b/arch/m68k/dts/mcf5329.dtsi
@@ -16,6 +16,12 @@
#address-cells = <1>;
#size-cells = <1>;
 
+   wdog0: watchdog@fc098000 {
+

[PATCH v3 1/5] drivers: watchdog: add mcf watchdog support

2023-07-24 Thread Angelo Dureghello
This watchdog driver applies to the following
mcf families:

- mcf52x2 (5271 5275 5282)
- mcf532x (5329 5373)
- mcf523x (5235)

Cpu's not listed for each family does not have WDT module.

Note, after some attempts testing by qemu on 5208 i
finally abandoned, watchdog seems not implemented properly.

The driver has been tested in a real M5282EVM.

Signed-off-by: Angelo Dureghello 
---
Changes for v2:
- remove unnecessary hardcoded timeouts
- remove unnecessary hw_watchdog_xxx stuff
- rewrite wdog module reg calculation
- using IS_ENABLED() where possible
Changes for v3:
- remove hardcoded 4s test
---
 drivers/watchdog/Kconfig   |   7 ++
 drivers/watchdog/Makefile  |   1 +
 drivers/watchdog/mcf_wdt.c | 135 +
 3 files changed, 143 insertions(+)
 create mode 100644 drivers/watchdog/mcf_wdt.c

diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index 646663528a..07fc4940e9 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -178,6 +178,13 @@ config WDT_MAX6370
help
  Select this to enable max6370 watchdog timer.
 
+config WDT_MCF
+   bool "ColdFire family watchdog timer support"
+   depends on WDT
+   help
+ Select this to enable ColdFire watchdog timer,
+ which supports mcf52x2 mcf532x mcf523x families.
+
 config WDT_MESON_GXBB
bool "Amlogic watchdog timer support"
depends on WDT
diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile
index fd5d9c7376..eef786f5e7 100644
--- a/drivers/watchdog/Makefile
+++ b/drivers/watchdog/Makefile
@@ -31,6 +31,7 @@ obj-$(CONFIG_WDT_CDNS) += cdns_wdt.o
 obj-$(CONFIG_WDT_FTWDT010) += ftwdt010_wdt.o
 obj-$(CONFIG_WDT_GPIO) += gpio_wdt.o
 obj-$(CONFIG_WDT_MAX6370) += max6370_wdt.o
+obj-$(CONFIG_WDT_MCF) += mcf_wdt.o
 obj-$(CONFIG_WDT_MESON_GXBB) += meson_gxbb_wdt.o
 obj-$(CONFIG_WDT_MPC8xxx) += mpc8xxx_wdt.o
 obj-$(CONFIG_WDT_MT7620) += mt7620_wdt.o
diff --git a/drivers/watchdog/mcf_wdt.c b/drivers/watchdog/mcf_wdt.c
new file mode 100644
index 00..b36488bb5b
--- /dev/null
+++ b/drivers/watchdog/mcf_wdt.c
@@ -0,0 +1,135 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * mcf_wdt.c - driver for ColdFire on-chip watchdog
+ *
+ * Author: Angelo Dureghello 
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define DIVIDER_5XXX   4096
+#define DIVIDER_5282   8192
+
+#define WCR_EN  BIT(0)
+#define WCR_HALTED  BIT(1)
+#define WCR_DOZEBIT(2)
+#define WCR_WAITBIT(3)
+
+struct watchdog_regs {
+   u16 wcr;/* Control */
+   u16 wmr;/* Service */
+   u16 wcntr;  /* Counter */
+   u16 wsr;/* Reset Status */
+};
+
+static void mcf_watchdog_reset(struct watchdog_regs *wdog)
+{
+   if (!IS_ENABLED(CONFIG_WATCHDOG_RESET_DISABLE)) {
+   writew(0x, >wsr);
+   writew(0x, >wsr);
+   }
+}
+
+static void mcf_watchdog_init(struct watchdog_regs *wdog, u32 fixed_divider,
+ u64 timeout_msecs)
+{
+   u32 wdog_module, cycles_per_sec;
+
+   cycles_per_sec = CFG_SYS_CLK / fixed_divider;
+
+   wdog_module = cycles_per_sec * ((u32)timeout_msecs / 1000);
+   wdog_module += (cycles_per_sec / 1000) * ((u32)timeout_msecs % 1000);
+
+   /* Limit check, max 16 bits */
+   if (wdog_module > 0x)
+   wdog_module = 0x;
+
+   /* Set timeout and enable watchdog */
+   writew((u16)wdog_module, >wmr);
+   writew(WCR_EN, >wcr);
+
+   mcf_watchdog_reset(wdog);
+}
+
+struct mcf_wdt_priv {
+   void __iomem *base;
+   u32 fixed_divider;
+};
+
+static int mcf_wdt_expire_now(struct udevice *dev, ulong flags)
+{
+   hang();
+
+   return 0;
+}
+
+static int mcf_wdt_reset(struct udevice *dev)
+{
+   struct mcf_wdt_priv *priv = dev_get_priv(dev);
+
+   mcf_watchdog_reset(priv->base);
+
+   return 0;
+}
+
+static int mcf_wdt_start(struct udevice *dev, u64 timeout, ulong flags)
+{
+   struct mcf_wdt_priv *priv = dev_get_priv(dev);
+
+   /* Timeout from fdt (timeout) comes in milliseconds */
+   mcf_watchdog_init(priv->base, priv->fixed_divider, timeout);
+
+   return 0;
+}
+
+static int mcf_wdt_stop(struct udevice *dev)
+{
+   struct mcf_wdt_priv *priv = dev_get_priv(dev);
+   struct watchdog_regs *wdog = (struct watchdog_regs *)priv->base;
+
+   setbits_be16(>wcr, WCR_HALTED);
+
+   return 0;
+}
+
+static int mcf_wdt_probe(struct udevice *dev)
+{
+   struct mcf_wdt_priv *priv = dev_get_priv(dev);
+
+   priv->base = dev_read_addr_ptr(dev);
+   if (!priv->base)
+   return -ENOENT;
+
+   priv->fixed_divider = (u32)dev_get_driver_data(dev);
+
+   return 0;
+}
+
+static const struct wdt_ops mcf_wdt_ops = {
+   .start  = mcf_wdt_start,
+   .stop   = mcf_wdt_stop,
+   .reset  = mcf_wdt_reset,

[PATCH v3 0/5] m68k: add ColdFire watchdog driver

2023-07-24 Thread Angelo Dureghello
This patch allows to reach 0 warning for the m68k
family. Watchdog driver was the last one producing the
"conversion to DM" warning,

Angelo Dureghello (5):
  drivers: watchdog: add mcf watchdog support
  m68k: move watchdog functions in mcf_wdt driver
  m68k: dts: add watchdog node
  configs: m68k: add watchdog driver
  MAINTAINERS: add myself as mcf_wdt.c maintainer

 MAINTAINERS   |   1 +
 arch/m68k/cpu/mcf523x/cpu.c   |  42 
 arch/m68k/cpu/mcf52x2/cpu.c   |  47 +
 arch/m68k/cpu/mcf532x/cpu.c   |  44 -
 arch/m68k/dts/M5208EVBE.dts   |   5 +
 arch/m68k/dts/mcf5208.dtsi|   6 ++
 arch/m68k/dts/mcf523x.dtsi|   6 ++
 arch/m68k/dts/mcf5271.dtsi|   6 ++
 arch/m68k/dts/mcf5275.dtsi|   6 ++
 arch/m68k/dts/mcf5282.dtsi|   6 ++
 arch/m68k/dts/mcf5329.dtsi|   6 ++
 arch/m68k/dts/mcf537x.dtsi|   6 ++
 configs/M5208EVBE_defconfig   |   2 +
 configs/astro_mcf5373l_defconfig  |   4 +-
 configs/eb_cpu5282_defconfig  |   1 +
 configs/eb_cpu5282_internal_defconfig |   1 +
 drivers/watchdog/Kconfig  |   7 ++
 drivers/watchdog/Makefile |   1 +
 drivers/watchdog/mcf_wdt.c| 135 ++
 19 files changed, 198 insertions(+), 134 deletions(-)
 create mode 100644 drivers/watchdog/mcf_wdt.c

-- 
2.41.0



Re: [PATCH v2 1/5] drivers: watchdog: add mcf watchdog support

2023-07-24 Thread Angelo Dureghello

Hi Stefan,

On 24/07/23 8:21 AM, Stefan Roese wrote:

Hi Angelo,

On 7/23/23 23:35, Angelo Dureghello wrote:

This watchdog driver applies to the following
mcf families:

- mcf52x2 (5271 5275 5282)
- mcf532x (5329 5373)
- mcf523x (5235)

Cpu's not listed for each family does not have WDT module.

Note, after some attempts testing by qemu on 5208 i
finally abandoned, watchdog seems not implemented properly.

The driver has been tested in a real M5282EVM.

Signed-off-by: Angelo Dureghello 
---
Changes for v2:
- remove unnecessary hardcoded timeouts
- remove unnecessary hw_watchdog_xxx stuff


Perfect, thanks!


- rewrite wdog module reg calculation
- using IS_ENABLED() where possible
---
  drivers/watchdog/Kconfig   |   7 ++
  drivers/watchdog/Makefile  |   1 +
  drivers/watchdog/mcf_wdt.c | 137 +
  3 files changed, 145 insertions(+)
  create mode 100644 drivers/watchdog/mcf_wdt.c

diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index 646663528a..07fc4940e9 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -178,6 +178,13 @@ config WDT_MAX6370
  help
    Select this to enable max6370 watchdog timer.
+config WDT_MCF
+    bool "ColdFire family watchdog timer support"
+    depends on WDT
+    help
+  Select this to enable ColdFire watchdog timer,
+  which supports mcf52x2 mcf532x mcf523x families.
+
  config WDT_MESON_GXBB
  bool "Amlogic watchdog timer support"
  depends on WDT
diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile
index fd5d9c7376..eef786f5e7 100644
--- a/drivers/watchdog/Makefile
+++ b/drivers/watchdog/Makefile
@@ -31,6 +31,7 @@ obj-$(CONFIG_WDT_CDNS) += cdns_wdt.o
  obj-$(CONFIG_WDT_FTWDT010) += ftwdt010_wdt.o
  obj-$(CONFIG_WDT_GPIO) += gpio_wdt.o
  obj-$(CONFIG_WDT_MAX6370) += max6370_wdt.o
+obj-$(CONFIG_WDT_MCF) += mcf_wdt.o
  obj-$(CONFIG_WDT_MESON_GXBB) += meson_gxbb_wdt.o
  obj-$(CONFIG_WDT_MPC8xxx) += mpc8xxx_wdt.o
  obj-$(CONFIG_WDT_MT7620) += mt7620_wdt.o
diff --git a/drivers/watchdog/mcf_wdt.c b/drivers/watchdog/mcf_wdt.c
new file mode 100644
index 00..cad6097a7d
--- /dev/null
+++ b/drivers/watchdog/mcf_wdt.c
@@ -0,0 +1,137 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * mcf_wdt.c - driver for ColdFire on-chip watchdog
+ *
+ * Author: Angelo Dureghello 
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define DIVIDER_5XXX    4096
+#define DIVIDER_5282    8192
+
+#define WCR_EN  BIT(0)
+#define WCR_HALTED  BIT(1)
+#define WCR_DOZE    BIT(2)
+#define WCR_WAIT    BIT(3)
+
+struct watchdog_regs {
+    u16 wcr;    /* Control */
+    u16 wmr;    /* Service */
+    u16 wcntr;  /* Counter */
+    u16 wsr;    /* Reset Status */
+};
+
+static void mcf_watchdog_reset(struct watchdog_regs *wdog)
+{
+    if (!IS_ENABLED(CONFIG_WATCHDOG_RESET_DISABLE)) {
+    writew(0x, >wsr);
+    writew(0x, >wsr);
+    }
+}
+
+static void mcf_watchdog_init(struct watchdog_regs *wdog, u32 
fixed_divider,

+  u64 timeout_msecs)
+{
+    u32 wdog_module, cycles_per_sec;
+
+    cycles_per_sec = CFG_SYS_CLK / fixed_divider;
+
+    wdog_module = cycles_per_sec * ((u32)timeout_msecs / 1000);
+    wdog_module += (cycles_per_sec / 1000) * ((u32)timeout_msecs % 
1000);

+
+    /* Limit check, max 16 bits */
+    if (wdog_module > 0x)
+    wdog_module = 0x;
+
+    wdog_module = 0x8000;


Hmmm, all the calculations are overwritten here. This does not seem to
be correct. Please check again.


ops, thanks for catching it, i had a reflog reset at a certain point,
and this test left in.

Fixing.


Thanks,
Stefan


+
+    /* Set timeout and enable watchdog */
+    writew((u16)wdog_module, >wmr);
+    writew(WCR_EN, >wcr);
+
+    mcf_watchdog_reset(wdog);
+}
+
+struct mcf_wdt_priv {
+    void __iomem *base;
+    u32 fixed_divider;
+};
+
+static int mcf_wdt_expire_now(struct udevice *dev, ulong flags)
+{
+    hang();
+
+    return 0;
+}
+
+static int mcf_wdt_reset(struct udevice *dev)
+{
+    struct mcf_wdt_priv *priv = dev_get_priv(dev);
+
+    mcf_watchdog_reset(priv->base);
+
+    return 0;
+}
+
+static int mcf_wdt_start(struct udevice *dev, u64 timeout, ulong flags)
+{
+    struct mcf_wdt_priv *priv = dev_get_priv(dev);
+
+    /* Timeout from fdt (timeout) comes in milliseconds */
+    mcf_watchdog_init(priv->base, priv->fixed_divider, timeout);
+
+    return 0;
+}
+
+static int mcf_wdt_stop(struct udevice *dev)
+{
+    struct mcf_wdt_priv *priv = dev_get_priv(dev);
+    struct watchdog_regs *wdog = (struct watchdog_regs *)priv->base;
+
+    setbits_be16(>wcr, WCR_HALTED);
+
+    return 0;
+}
+
+static int mcf_wdt_probe(struct udevice *dev)
+{
+    struct mcf_wdt_priv *priv = dev_get_priv(dev);
+
+    priv->base = dev_read_addr_ptr(dev);
+    if (!priv->base)
+    return -ENOENT;
+
+    priv->fixed_divider = (u32)dev_get_driver_da

[PATCH] board: m68k add missing maintainer

2023-07-23 Thread Angelo Dureghello
Add myself as a maintainer for orphaned boards.
All these boards are covered by buildman m68k test.

Signed-off-by: Angelo Dureghello 
---
 board/cobra5272/MAINTAINERS   | 2 +-
 board/freescale/m5208evbe/MAINTAINERS | 2 +-
 board/freescale/m5249evb/MAINTAINERS  | 2 +-
 board/freescale/m5272c3/MAINTAINERS   | 2 +-
 board/freescale/m5275evb/MAINTAINERS  | 2 +-
 board/freescale/m5282evb/MAINTAINERS  | 2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/board/cobra5272/MAINTAINERS b/board/cobra5272/MAINTAINERS
index a064da2f15..1f398a7323 100644
--- a/board/cobra5272/MAINTAINERS
+++ b/board/cobra5272/MAINTAINERS
@@ -1,5 +1,5 @@
 COBRA5272 BOARD
-#M:-
+M:  Angelo Dureghello 
 S: Maintained
 F: board/cobra5272/
 F: include/configs/cobra5272.h
diff --git a/board/freescale/m5208evbe/MAINTAINERS 
b/board/freescale/m5208evbe/MAINTAINERS
index c9c3c882e6..ff153034a4 100644
--- a/board/freescale/m5208evbe/MAINTAINERS
+++ b/board/freescale/m5208evbe/MAINTAINERS
@@ -1,5 +1,5 @@
 M5208EVBE BOARD
-#M:-
+M:  Angelo Dureghello 
 S: Maintained
 F: board/freescale/m5208evbe/
 F: include/configs/M5208EVBE.h
diff --git a/board/freescale/m5249evb/MAINTAINERS 
b/board/freescale/m5249evb/MAINTAINERS
index c2273c35e1..619e0cd20d 100644
--- a/board/freescale/m5249evb/MAINTAINERS
+++ b/board/freescale/m5249evb/MAINTAINERS
@@ -1,5 +1,5 @@
 M5249EVB BOARD
-#M:-
+M:  Angelo Dureghello 
 S: Maintained
 F: board/freescale/m5249evb/
 F: include/configs/M5249EVB.h
diff --git a/board/freescale/m5272c3/MAINTAINERS 
b/board/freescale/m5272c3/MAINTAINERS
index e58663096d..692ab5b582 100644
--- a/board/freescale/m5272c3/MAINTAINERS
+++ b/board/freescale/m5272c3/MAINTAINERS
@@ -1,5 +1,5 @@
 M5272C3 BOARD
-#M:-
+M:  Angelo Dureghello 
 S: Maintained
 F: board/freescale/m5272c3/
 F: include/configs/M5272C3.h
diff --git a/board/freescale/m5275evb/MAINTAINERS 
b/board/freescale/m5275evb/MAINTAINERS
index 4e6dbb12d9..065ae7bb1d 100644
--- a/board/freescale/m5275evb/MAINTAINERS
+++ b/board/freescale/m5275evb/MAINTAINERS
@@ -1,5 +1,5 @@
 M5275EVB BOARD
-#M:-
+M:  Angelo Dureghello 
 S: Maintained
 F: board/freescale/m5275evb/
 F: include/configs/M5275EVB.h
diff --git a/board/freescale/m5282evb/MAINTAINERS 
b/board/freescale/m5282evb/MAINTAINERS
index 305e748e74..f141c89c3a 100644
--- a/board/freescale/m5282evb/MAINTAINERS
+++ b/board/freescale/m5282evb/MAINTAINERS
@@ -1,5 +1,5 @@
 M5282EVB BOARD
-#M:-
+M:  Angelo Dureghello 
 S: Maintained
 F: board/freescale/m5282evb/
 F: include/configs/M5282EVB.h
-- 
2.41.0



[PATCH v2 5/5] MAINTAINERS: add myself as mcf_wdt.c maintainer

2023-07-23 Thread Angelo Dureghello
Signed-off-by: Angelo Dureghello 
---
Changes for v2:
- none
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 87991cccdd..2b157214cb 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -867,6 +867,7 @@ S:  Maintained
 T: git https://source.denx.de/u-boot/custodians/u-boot-coldfire.git
 F: arch/m68k/
 F: doc/arch/m68k.rst
+F: drivers/watchdog/mcf_wdt.c
 
 CYCLIC
 M: Stefan Roese 
-- 
2.41.0



[PATCH v2 4/5] configs: m68k: add watchdog driver

2023-07-23 Thread Angelo Dureghello
Add config options for mcf_wdt driver.

Signed-off-by: Angelo Dureghello 
---
Changes for v2:
- none
---
 configs/M5208EVBE_defconfig   | 2 ++
 configs/astro_mcf5373l_defconfig  | 4 ++--
 configs/eb_cpu5282_defconfig  | 1 +
 configs/eb_cpu5282_internal_defconfig | 1 +
 4 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/configs/M5208EVBE_defconfig b/configs/M5208EVBE_defconfig
index 0c5afe869b..aa054f753f 100644
--- a/configs/M5208EVBE_defconfig
+++ b/configs/M5208EVBE_defconfig
@@ -50,3 +50,5 @@ CONFIG_MCFFEC=y
 CONFIG_MII=y
 CONFIG_MCFUART=y
 CONFIG_WATCHDOG_TIMEOUT_MSECS=5000
+CONFIG_WDT=y
+CONFIG_WDT_MCF=y
diff --git a/configs/astro_mcf5373l_defconfig b/configs/astro_mcf5373l_defconfig
index aade1f98be..f4dad3bcc8 100644
--- a/configs/astro_mcf5373l_defconfig
+++ b/configs/astro_mcf5373l_defconfig
@@ -46,5 +46,5 @@ CONFIG_DM_RTC=y
 CONFIG_MCFRTC=y
 CONFIG_SYS_MCFRTC_BASE=0xFC0A8000
 CONFIG_MCFUART=y
-CONFIG_WATCHDOG=y
-CONFIG_WATCHDOG_TIMEOUT_MSECS=3355
+CONFIG_WDT=y
+CONFIG_WDT_MCF=y
diff --git a/configs/eb_cpu5282_defconfig b/configs/eb_cpu5282_defconfig
index 24edecb510..2873322598 100644
--- a/configs/eb_cpu5282_defconfig
+++ b/configs/eb_cpu5282_defconfig
@@ -52,3 +52,4 @@ CONFIG_MII=y
 CONFIG_DM_RTC=y
 CONFIG_RTC_DS1338=y
 CONFIG_MCFUART=y
+CONFIG_WDT=y
diff --git a/configs/eb_cpu5282_internal_defconfig 
b/configs/eb_cpu5282_internal_defconfig
index 44e22eb01d..bd780034ba 100644
--- a/configs/eb_cpu5282_internal_defconfig
+++ b/configs/eb_cpu5282_internal_defconfig
@@ -50,3 +50,4 @@ CONFIG_MII=y
 CONFIG_DM_RTC=y
 CONFIG_RTC_DS1338=y
 CONFIG_MCFUART=y
+CONFIG_WDT=y
-- 
2.41.0



[PATCH v2 3/5] m68k: dts: add watchdog node

2023-07-23 Thread Angelo Dureghello
Add watchdog node for the implemented mcf_wdt driver.

Signed-off-by: Angelo Dureghello 
---
Changes for v2:
- remove unnecessary big-endian property
---
 arch/m68k/dts/M5208EVBE.dts | 5 +
 arch/m68k/dts/mcf5208.dtsi  | 6 ++
 arch/m68k/dts/mcf523x.dtsi  | 6 ++
 arch/m68k/dts/mcf5271.dtsi  | 6 ++
 arch/m68k/dts/mcf5275.dtsi  | 6 ++
 arch/m68k/dts/mcf5282.dtsi  | 6 ++
 arch/m68k/dts/mcf5329.dtsi  | 6 ++
 arch/m68k/dts/mcf537x.dtsi  | 6 ++
 8 files changed, 47 insertions(+)

diff --git a/arch/m68k/dts/M5208EVBE.dts b/arch/m68k/dts/M5208EVBE.dts
index 1c32718af4..ec203e8b69 100644
--- a/arch/m68k/dts/M5208EVBE.dts
+++ b/arch/m68k/dts/M5208EVBE.dts
@@ -15,6 +15,11 @@
};
 };
 
+ {
+   timeout-sec = <32>;
+   status = "okay";
+};
+
  {
bootph-all;
status = "okay";
diff --git a/arch/m68k/dts/mcf5208.dtsi b/arch/m68k/dts/mcf5208.dtsi
index 9392facfa8..c61dbf3557 100644
--- a/arch/m68k/dts/mcf5208.dtsi
+++ b/arch/m68k/dts/mcf5208.dtsi
@@ -16,6 +16,12 @@
#address-cells = <1>;
#size-cells = <1>;
 
+   wdog0: watchdog@fc08c000 {
+   compatible = "fsl,mcf5208-wdt";
+   reg = <0xfc08c000 0x10>;
+   status = "disabled";
+   };
+
uart0: uart@fc06 {
compatible = "fsl,mcf-uart";
reg = <0xfc06 0x40>;
diff --git a/arch/m68k/dts/mcf523x.dtsi b/arch/m68k/dts/mcf523x.dtsi
index 41c7b9b2d1..cae7b4f861 100644
--- a/arch/m68k/dts/mcf523x.dtsi
+++ b/arch/m68k/dts/mcf523x.dtsi
@@ -23,6 +23,12 @@
ranges = <0x 0x4000 0x4000>;
reg = <0x4000 0x4000>;
 
+   wdog0: watchdog@14 {
+   compatible = "fsl,mcf5208-wdt";
+   reg = <0x14 0x10>;
+   status = "disabled";
+   };
+
uart0: uart@200 {
compatible = "fsl,mcf-uart";
reg = <0x200 0x40>;
diff --git a/arch/m68k/dts/mcf5271.dtsi b/arch/m68k/dts/mcf5271.dtsi
index fc82bd3c24..5acf6994af 100644
--- a/arch/m68k/dts/mcf5271.dtsi
+++ b/arch/m68k/dts/mcf5271.dtsi
@@ -23,6 +23,12 @@
ranges = <0x 0x4000 0x4000>;
reg = <0x4000 0x4000>;
 
+   wdog0: watchdog@14 {
+   compatible = "fsl,mcf5208-wdt";
+   reg = <0x14 0x10>;
+   status = "disabled";
+   };
+
uart0: uart@200 {
compatible = "fsl,mcf-uart";
reg = <0x200 0x40>;
diff --git a/arch/m68k/dts/mcf5275.dtsi b/arch/m68k/dts/mcf5275.dtsi
index 402517cdec..3df17b445c 100644
--- a/arch/m68k/dts/mcf5275.dtsi
+++ b/arch/m68k/dts/mcf5275.dtsi
@@ -24,6 +24,12 @@
ranges = <0x 0x4000 0x4000>;
reg = <0x4000 0x4000>;
 
+   wdog0: watchdog@14 {
+   compatible = "fsl,mcf5208-wdt";
+   reg = <0x14 0x10>;
+   status = "disabled";
+   };
+
uart0: uart@200 {
compatible = "fsl,mcf-uart";
reg = <0x200 0x40>;
diff --git a/arch/m68k/dts/mcf5282.dtsi b/arch/m68k/dts/mcf5282.dtsi
index 883c0d0324..640c1a32e4 100644
--- a/arch/m68k/dts/mcf5282.dtsi
+++ b/arch/m68k/dts/mcf5282.dtsi
@@ -23,6 +23,12 @@
ranges = <0x 0x4000 0x4000>;
reg = <0x4000 0x4000>;
 
+   wdog0: watchdog@14 {
+   compatible = "fsl,mcf5282-wdt";
+   reg = <0x14 0x10>;
+   status = "disabled";
+   };
+
uart0: uart@200 {
compatible = "fsl,mcf-uart";
reg = <0x200 0x40>;
diff --git a/arch/m68k/dts/mcf5329.dtsi b/arch/m68k/dts/mcf5329.dtsi
index 7501cc4b01..991985e48c 100644
--- a/arch/m68k/dts/mcf5329.dtsi
+++ b/arch/m68k/dts/mcf5329.dtsi
@@ -16,6 +16,12 @@
#address-cells = <1>;
#size-cells = <1>;
 
+   wdog0: watchdog@fc098000 {
+   compatible = "fs

[PATCH v2 2/5] m68k: move watchdog functions in mcf_wdt driver

2023-07-23 Thread Angelo Dureghello
Move watchdog functions inside a separate watchdog driver.

Signed-off-by: Angelo Dureghello 
---
Changes for v2:
- none
---
 arch/m68k/cpu/mcf523x/cpu.c | 42 -
 arch/m68k/cpu/mcf52x2/cpu.c | 47 +
 arch/m68k/cpu/mcf532x/cpu.c | 44 --
 3 files changed, 1 insertion(+), 132 deletions(-)

diff --git a/arch/m68k/cpu/mcf523x/cpu.c b/arch/m68k/cpu/mcf523x/cpu.c
index ba2c228911..bef67767b4 100644
--- a/arch/m68k/cpu/mcf523x/cpu.c
+++ b/arch/m68k/cpu/mcf523x/cpu.c
@@ -12,7 +12,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -62,47 +61,6 @@ int print_cpuinfo(void)
 };
 #endif /* CONFIG_DISPLAY_CPUINFO */
 
-#if defined(CONFIG_WATCHDOG)
-/* Called by macro WATCHDOG_RESET */
-void watchdog_reset(void)
-{
-   wdog_t *wdp = (wdog_t *) (MMAP_WDOG);
-
-   /* Count register */
-   out_be16(>sr, 0x);
-   asm("nop");
-   out_be16(>sr, 0x);
-}
-
-int watchdog_disable(void)
-{
-   wdog_t *wdp = (wdog_t *) (MMAP_WDOG);
-
-   /* UserManual, once the wdog is disabled, wdog cannot be re-enabled */
-   /* halted watchdog timer */
-   setbits_be16(>cr, WTM_WCR_HALTED);
-
-   puts("WATCHDOG:disabled\n");
-   return (0);
-}
-
-int watchdog_init(void)
-{
-   wdog_t *wdp = (wdog_t *) (MMAP_WDOG);
-   u32 wdog_module = 0;
-
-   /* set timeout and enable watchdog */
-   wdog_module = ((CFG_SYS_CLK / CONFIG_SYS_HZ) * 
CONFIG_WATCHDOG_TIMEOUT_MSECS);
-   wdog_module |= (wdog_module / 8192);
-   out_be16(>mr, wdog_module);
-
-   out_be16(>cr, WTM_WCR_EN);
-   puts("WATCHDOG:enabled\n");
-
-   return (0);
-}
-#endif /* CONFIG_WATCHDOG */
-
 #if defined(CONFIG_MCFFEC)
 /* Default initializations for MCFFEC controllers.  To override,
  * create a board-specific function called:
diff --git a/arch/m68k/cpu/mcf52x2/cpu.c b/arch/m68k/cpu/mcf52x2/cpu.c
index d7cbf11e25..5042a38b3e 100644
--- a/arch/m68k/cpu/mcf52x2/cpu.c
+++ b/arch/m68k/cpu/mcf52x2/cpu.c
@@ -17,7 +17,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -53,51 +52,7 @@ int print_cpuinfo(void)
return 0;
 };
 #endif /* CONFIG_DISPLAY_CPUINFO */
-
-#if defined(CONFIG_WATCHDOG)
-/* Called by macro WATCHDOG_RESET */
-void watchdog_reset(void)
-{
-   wdog_t *wdt = (wdog_t *)(MMAP_WDOG);
-
-   out_be16(>sr, 0x);
-   out_be16(>sr, 0x);
-}
-
-int watchdog_disable(void)
-{
-   wdog_t *wdt = (wdog_t *)(MMAP_WDOG);
-
-   /* reset watchdog counter */
-   out_be16(>sr, 0x);
-   out_be16(>sr, 0x);
-   /* disable watchdog timer */
-   out_be16(>cr, 0);
-
-   puts("WATCHDOG:disabled\n");
-   return (0);
-}
-
-int watchdog_init(void)
-{
-   wdog_t *wdt = (wdog_t *)(MMAP_WDOG);
-
-   /* disable watchdog */
-   out_be16(>cr, 0);
-
-   /* set timeout and enable watchdog */
-   out_be16(>mr,
-   (CONFIG_WATCHDOG_TIMEOUT_MSECS * CONFIG_SYS_HZ) / (32768 * 
1000) - 1);
-
-   /* reset watchdog counter */
-   out_be16(>sr, 0x);
-   out_be16(>sr, 0x);
-
-   puts("WATCHDOG:enabled\n");
-   return (0);
-}
-#endif /* #ifdef CONFIG_WATCHDOG */
-#endif /* #ifdef CONFIG_M5208 */
+#endif /* #ifdef CONFIG_M5208 */
 
 #ifdef  CONFIG_M5271
 #if defined(CONFIG_DISPLAY_CPUINFO)
diff --git a/arch/m68k/cpu/mcf532x/cpu.c b/arch/m68k/cpu/mcf532x/cpu.c
index 548cbca36a..18d20a8926 100644
--- a/arch/m68k/cpu/mcf532x/cpu.c
+++ b/arch/m68k/cpu/mcf532x/cpu.c
@@ -12,7 +12,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -102,49 +101,6 @@ int print_cpuinfo(void)
 };
 #endif /* CONFIG_DISPLAY_CPUINFO */
 
-#if defined(CONFIG_WATCHDOG)
-/* Called by macro WATCHDOG_RESET */
-void watchdog_reset(void)
-{
-   wdog_t *wdp = (wdog_t *) (MMAP_WDOG);
-
-   /* Count register */
-   out_be16(>sr, 0x);
-   out_be16(>sr, 0x);
-}
-
-int watchdog_disable(void)
-{
-   wdog_t *wdp = (wdog_t *) (MMAP_WDOG);
-
-   /* UserManual, once the wdog is disabled, wdog cannot be re-enabled */
-   /* halted watchdog timer */
-   setbits_be16(>cr, WTM_WCR_HALTED);
-
-   puts("WATCHDOG:disabled\n");
-   return (0);
-}
-
-int watchdog_init(void)
-{
-   wdog_t *wdp = (wdog_t *) (MMAP_WDOG);
-   u32 wdog_module = 0;
-
-   /* set timeout and enable watchdog */
-   wdog_module = ((CFG_SYS_CLK / 1000) * CONFIG_WATCHDOG_TIMEOUT_MSECS);
-#ifdef CONFIG_M5329
-   out_be16(>mr, wdog_module / 8192);
-#else
-   out_be16(>mr, wdog_module / 4096);
-#endif
-
-   out_be16(>cr, WTM_WCR_EN);
-   puts("WATCHDOG:enabled\n");
-
-   return (0);
-}
-#endif /* CON

[PATCH v2 1/5] drivers: watchdog: add mcf watchdog support

2023-07-23 Thread Angelo Dureghello
This watchdog driver applies to the following
mcf families:

- mcf52x2 (5271 5275 5282)
- mcf532x (5329 5373)
- mcf523x (5235)

Cpu's not listed for each family does not have WDT module.

Note, after some attempts testing by qemu on 5208 i
finally abandoned, watchdog seems not implemented properly.

The driver has been tested in a real M5282EVM.

Signed-off-by: Angelo Dureghello 
---
Changes for v2:
- remove unnecessary hardcoded timeouts
- remove unnecessary hw_watchdog_xxx stuff
- rewrite wdog module reg calculation
- using IS_ENABLED() where possible
---
 drivers/watchdog/Kconfig   |   7 ++
 drivers/watchdog/Makefile  |   1 +
 drivers/watchdog/mcf_wdt.c | 137 +
 3 files changed, 145 insertions(+)
 create mode 100644 drivers/watchdog/mcf_wdt.c

diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index 646663528a..07fc4940e9 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -178,6 +178,13 @@ config WDT_MAX6370
help
  Select this to enable max6370 watchdog timer.
 
+config WDT_MCF
+   bool "ColdFire family watchdog timer support"
+   depends on WDT
+   help
+ Select this to enable ColdFire watchdog timer,
+ which supports mcf52x2 mcf532x mcf523x families.
+
 config WDT_MESON_GXBB
bool "Amlogic watchdog timer support"
depends on WDT
diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile
index fd5d9c7376..eef786f5e7 100644
--- a/drivers/watchdog/Makefile
+++ b/drivers/watchdog/Makefile
@@ -31,6 +31,7 @@ obj-$(CONFIG_WDT_CDNS) += cdns_wdt.o
 obj-$(CONFIG_WDT_FTWDT010) += ftwdt010_wdt.o
 obj-$(CONFIG_WDT_GPIO) += gpio_wdt.o
 obj-$(CONFIG_WDT_MAX6370) += max6370_wdt.o
+obj-$(CONFIG_WDT_MCF) += mcf_wdt.o
 obj-$(CONFIG_WDT_MESON_GXBB) += meson_gxbb_wdt.o
 obj-$(CONFIG_WDT_MPC8xxx) += mpc8xxx_wdt.o
 obj-$(CONFIG_WDT_MT7620) += mt7620_wdt.o
diff --git a/drivers/watchdog/mcf_wdt.c b/drivers/watchdog/mcf_wdt.c
new file mode 100644
index 00..cad6097a7d
--- /dev/null
+++ b/drivers/watchdog/mcf_wdt.c
@@ -0,0 +1,137 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * mcf_wdt.c - driver for ColdFire on-chip watchdog
+ *
+ * Author: Angelo Dureghello 
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define DIVIDER_5XXX   4096
+#define DIVIDER_5282   8192
+
+#define WCR_EN  BIT(0)
+#define WCR_HALTED  BIT(1)
+#define WCR_DOZEBIT(2)
+#define WCR_WAITBIT(3)
+
+struct watchdog_regs {
+   u16 wcr;/* Control */
+   u16 wmr;/* Service */
+   u16 wcntr;  /* Counter */
+   u16 wsr;/* Reset Status */
+};
+
+static void mcf_watchdog_reset(struct watchdog_regs *wdog)
+{
+   if (!IS_ENABLED(CONFIG_WATCHDOG_RESET_DISABLE)) {
+   writew(0x, >wsr);
+   writew(0x, >wsr);
+   }
+}
+
+static void mcf_watchdog_init(struct watchdog_regs *wdog, u32 fixed_divider,
+ u64 timeout_msecs)
+{
+   u32 wdog_module, cycles_per_sec;
+
+   cycles_per_sec = CFG_SYS_CLK / fixed_divider;
+
+   wdog_module = cycles_per_sec * ((u32)timeout_msecs / 1000);
+   wdog_module += (cycles_per_sec / 1000) * ((u32)timeout_msecs % 1000);
+
+   /* Limit check, max 16 bits */
+   if (wdog_module > 0x)
+   wdog_module = 0x;
+
+   wdog_module = 0x8000;
+
+   /* Set timeout and enable watchdog */
+   writew((u16)wdog_module, >wmr);
+   writew(WCR_EN, >wcr);
+
+   mcf_watchdog_reset(wdog);
+}
+
+struct mcf_wdt_priv {
+   void __iomem *base;
+   u32 fixed_divider;
+};
+
+static int mcf_wdt_expire_now(struct udevice *dev, ulong flags)
+{
+   hang();
+
+   return 0;
+}
+
+static int mcf_wdt_reset(struct udevice *dev)
+{
+   struct mcf_wdt_priv *priv = dev_get_priv(dev);
+
+   mcf_watchdog_reset(priv->base);
+
+   return 0;
+}
+
+static int mcf_wdt_start(struct udevice *dev, u64 timeout, ulong flags)
+{
+   struct mcf_wdt_priv *priv = dev_get_priv(dev);
+
+   /* Timeout from fdt (timeout) comes in milliseconds */
+   mcf_watchdog_init(priv->base, priv->fixed_divider, timeout);
+
+   return 0;
+}
+
+static int mcf_wdt_stop(struct udevice *dev)
+{
+   struct mcf_wdt_priv *priv = dev_get_priv(dev);
+   struct watchdog_regs *wdog = (struct watchdog_regs *)priv->base;
+
+   setbits_be16(>wcr, WCR_HALTED);
+
+   return 0;
+}
+
+static int mcf_wdt_probe(struct udevice *dev)
+{
+   struct mcf_wdt_priv *priv = dev_get_priv(dev);
+
+   priv->base = dev_read_addr_ptr(dev);
+   if (!priv->base)
+   return -ENOENT;
+
+   priv->fixed_divider = (u32)dev_get_driver_data(dev);
+
+   return 0;
+}
+
+static const struct wdt_ops mcf_wdt_ops = {
+   .start  = mcf_wdt_start,
+   .stop   = mcf_wdt_stop,
+   .reset  = mcf_wdt_reset,
+ 

[PATCH v2 0/5] m68k: add ColdFire watchdog driver

2023-07-23 Thread Angelo Dureghello
This patch allows to reach 0 warning for the m68k
family. Watchdog driver was the last one producing the
"conversion to DM" warning,

Angelo Dureghello (5):
  drivers: watchdog: add mcf watchdog support
  m68k: move watchdog functions in mcf_wdt driver
  m68k: dts: add watchdog node
  configs: m68k: add watchdog driver
  MAINTAINERS: add myself as mcf_wdt.c maintainer

 MAINTAINERS   |   1 +
 arch/m68k/cpu/mcf523x/cpu.c   |  42 
 arch/m68k/cpu/mcf52x2/cpu.c   |  47 +
 arch/m68k/cpu/mcf532x/cpu.c   |  44 -
 arch/m68k/dts/M5208EVBE.dts   |   5 +
 arch/m68k/dts/mcf5208.dtsi|   6 ++
 arch/m68k/dts/mcf523x.dtsi|   6 ++
 arch/m68k/dts/mcf5271.dtsi|   6 ++
 arch/m68k/dts/mcf5275.dtsi|   6 ++
 arch/m68k/dts/mcf5282.dtsi|   6 ++
 arch/m68k/dts/mcf5329.dtsi|   6 ++
 arch/m68k/dts/mcf537x.dtsi|   6 ++
 configs/M5208EVBE_defconfig   |   2 +
 configs/astro_mcf5373l_defconfig  |   4 +-
 configs/eb_cpu5282_defconfig  |   1 +
 configs/eb_cpu5282_internal_defconfig |   1 +
 drivers/watchdog/Kconfig  |   7 ++
 drivers/watchdog/Makefile |   1 +
 drivers/watchdog/mcf_wdt.c| 137 ++
 19 files changed, 200 insertions(+), 134 deletions(-)
 create mode 100644 drivers/watchdog/mcf_wdt.c

-- 
2.41.0



Re: [PATCH 1/5] drivers: watchdog: add mcf watchdog support

2023-07-18 Thread Angelo Dureghello

Hi Stefan,

thanks for the feedbacks,

On 18/07/23 2:23 PM, Stefan Roese wrote:

On 6/25/23 21:35, Angelo Dureghello wrote:

This watchdog driver applies to the following
mcf families:

- mcf52x2 (5271 5275 5282)
- mcf532x (5329 5373)
- mcf523x (5235)

Cpu's not listed for each family does not have WDT module.

Note, after some attempts testing by qemu on 5208 i
finally abandoned, watchdog seems not implemented properly.

The driver has been tested in a real M5282EVM.

Signed-off-by: Angelo Dureghello 
---
  drivers/watchdog/Kconfig   |   7 ++
  drivers/watchdog/Makefile  |   1 +
  drivers/watchdog/mcf_wdt.c | 162 +
  3 files changed, 170 insertions(+)
  create mode 100644 drivers/watchdog/mcf_wdt.c

diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index 646663528a..07fc4940e9 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -178,6 +178,13 @@ config WDT_MAX6370
  help
    Select this to enable max6370 watchdog timer.
+config WDT_MCF
+    bool "ColdFire family watchdog timer support"
+    depends on WDT
+    help
+  Select this to enable ColdFire watchdog timer,
+  which supports mcf52x2 mcf532x mcf523x families.
+
  config WDT_MESON_GXBB
  bool "Amlogic watchdog timer support"
  depends on WDT
diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile
index fd5d9c7376..eef786f5e7 100644
--- a/drivers/watchdog/Makefile
+++ b/drivers/watchdog/Makefile
@@ -31,6 +31,7 @@ obj-$(CONFIG_WDT_CDNS) += cdns_wdt.o
  obj-$(CONFIG_WDT_FTWDT010) += ftwdt010_wdt.o
  obj-$(CONFIG_WDT_GPIO) += gpio_wdt.o
  obj-$(CONFIG_WDT_MAX6370) += max6370_wdt.o
+obj-$(CONFIG_WDT_MCF) += mcf_wdt.o
  obj-$(CONFIG_WDT_MESON_GXBB) += meson_gxbb_wdt.o
  obj-$(CONFIG_WDT_MPC8xxx) += mpc8xxx_wdt.o
  obj-$(CONFIG_WDT_MT7620) += mt7620_wdt.o
diff --git a/drivers/watchdog/mcf_wdt.c b/drivers/watchdog/mcf_wdt.c
new file mode 100644
index 00..03842135c5
--- /dev/null
+++ b/drivers/watchdog/mcf_wdt.c
@@ -0,0 +1,162 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * mcf_wdt.c - driver for ColdFire on-chip watchdog
+ *
+ * Author: Angelo Dureghello 
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define TIMEOUT_MAX    3360
+#define TIMEOUT_MIN    500


Those 2 defines above are not used in this source. Please drop.


ok

+
+#define DIVIDER_5XXX    4096
+#define DIVIDER_5282    8192
+
+#define WCR_EN  BIT(0)
+#define WCR_HALTED  BIT(1)
+#define WCR_DOZE    BIT(2)
+#define WCR_WAIT    BIT(3)
+
+struct watchdog_regs {
+    u16 wcr;    /* Control */
+    u16 wmr;    /* Service */
+    u16 wcntr;  /* Counter */
+    u16 wsr;    /* Reset Status */
+};
+
+#if defined(CONFIG_WDT_MCF)


Is it possible to drop this "#if" somehow?


will try

+static void mcf_watchdog_reset(struct watchdog_regs *wdog)
+{
+#ifndef CONFIG_WATCHDOG_RESET_DISABLE
+    writew(0x, >wsr);
+    writew(0x, >wsr);
+#endif /* CONFIG_WATCHDOG_RESET_DISABLE*/


checkpatch.pl warning:

WARNING: Use 'if (IS_ENABLED(CONFIG...))' instead of '#if or #ifdef' 
where possible

#37: FILE: drivers/watchdog/mcf_wdt.c:37:
+#ifndef CONFIG_WATCHDOG_RESET_DISABLE


ok will try to use if (IS_ENABLED

 +}

+
+static void mcf_watchdog_init(struct watchdog_regs *wdog, u32 
fixed_divider,

+  u64 timeout_msecs)
+{
+    u32 wdog_module;
+
+    /*
+ * The timer watchdog can be set between
+ * 0.5 and 128 Seconds.
+ */
+
+    /* set timeout and enable watchdog */
+    wdog_module = ((CFG_SYS_CLK / 1000) * timeout_msecs);
+
+    writew((u16)(wdog_module / fixed_divider), >wmr);
+    writew(WCR_EN, >wcr);
+
+    mcf_watchdog_reset(wdog);
+}
+
+#if !CONFIG_IS_ENABLED(WDT)
+void hw_watchdog_reset(void)
+{
+    struct watchdog_regs *wdog = (struct watchdog_regs *)MMAP_WDOG;
+
+    mcf_watchdog_reset(wdog);
+}


Can you perhaps completely remove this hw_watchdog stuff? Is it really
needed on these Coldfire platforms?


Will recheck, maybe yes,

+
+void hw_watchdog_init(void)
+{
+    struct watchdog_regs *wdog = (struct watchdog_regs *)MMAP_WDOG;
+
+    if (IS_ENABLED(CONFIG_MCF5282))
+    writew(>wmr, wdog_module / DIVIDER_5282);
+    else
+    writew(>wmr, wdog_module / DIVIDER_5XXX);
+
+    mcf_watchdog_init(wdog, CONFIG_WATCHDOG_TIMEOUT_MSECS);
+}
+
+#else /* CONFIG_WDT */
+
+struct mcf_wdt_priv {
+    void __iomem *base;
+    u32 fixed_divider;
+};
+
+static int mcf_wdt_expire_now(struct udevice *dev, ulong flags)
+{
+    hang();
+
+    return 0;
+}
+
+static int mcf_wdt_reset(struct udevice *dev)
+{
+    struct mcf_wdt_priv *priv = dev_get_priv(dev);
+
+    mcf_watchdog_reset(priv->base);
+
+    return 0;
+}
+
+static int mcf_wdt_start(struct udevice *dev, u64 timeout, ulong flags)
+{
+    struct mcf_wdt_priv *priv = dev_get_priv(dev);
+
+    /* Timeout from fdt is in second, driver works in msecs */


I'm a bit confused here. AFAIK,

Re: [PATCH 3/5] m68k: dts: add watchdog node

2023-07-18 Thread Angelo Dureghello

Hi Stefan,

On 18/07/23 2:26 PM, Stefan Roese wrote:

On 6/25/23 21:35, Angelo Dureghello wrote:

Add watchdog node for the implemented mcf_wdt driver.

Signed-off-by: Angelo Dureghello 
---
  arch/m68k/dts/M5208EVBE.dts | 5 +
  arch/m68k/dts/mcf5208.dtsi  | 7 +++
  arch/m68k/dts/mcf523x.dtsi  | 7 +++
  arch/m68k/dts/mcf5271.dtsi  | 7 +++
  arch/m68k/dts/mcf5275.dtsi  | 7 +++
  arch/m68k/dts/mcf5282.dtsi  | 7 +++
  arch/m68k/dts/mcf5329.dtsi  | 7 +++
  arch/m68k/dts/mcf537x.dtsi  | 7 +++
  8 files changed, 54 insertions(+)

diff --git a/arch/m68k/dts/M5208EVBE.dts b/arch/m68k/dts/M5208EVBE.dts
index 1c32718af4..ec203e8b69 100644
--- a/arch/m68k/dts/M5208EVBE.dts
+++ b/arch/m68k/dts/M5208EVBE.dts
@@ -15,6 +15,11 @@
  };
  };
+ {
+    timeout-sec = <32>;
+    status = "okay";
+};
+
   {
  bootph-all;
  status = "okay";
diff --git a/arch/m68k/dts/mcf5208.dtsi b/arch/m68k/dts/mcf5208.dtsi
index 9392facfa8..b06dc4bb26 100644
--- a/arch/m68k/dts/mcf5208.dtsi
+++ b/arch/m68k/dts/mcf5208.dtsi
@@ -16,6 +16,13 @@
  #address-cells = <1>;
  #size-cells = <1>;
+    wdog0: watchdog@fc08c000 {
+    compatible = "fsl,mcf5208-wdt";
+    reg = <0xfc08c000 0x10>;
+    big-endian;
+    status = "disabled";
+    };


I was not able to find this compatible property in the Linux Kernel
source tree. Is this the official version of the Coldfire WDT DT node?
Just checking..



there is no fdt support for m68k in Linux, after discussing the need in 
u-boot, i implemented fdt here the best i could.



Thanks,
Stefan


+
  uart0: uart@fc06 {
  compatible = "fsl,mcf-uart";
  reg = <0xfc06 0x40>;
diff --git a/arch/m68k/dts/mcf523x.dtsi b/arch/m68k/dts/mcf523x.dtsi
index 41c7b9b2d1..fb5a4cdc21 100644
--- a/arch/m68k/dts/mcf523x.dtsi
+++ b/arch/m68k/dts/mcf523x.dtsi
@@ -23,6 +23,13 @@
  ranges = <0x 0x4000 0x4000>;
  reg = <0x4000 0x4000>;
+    wdog0: watchdog@14 {
+    compatible = "fsl,mcf5208-wdt";
+    reg = <0x14 0x10>;
+    big-endian;
+    status = "disabled";
+    };
+
  uart0: uart@200 {
  compatible = "fsl,mcf-uart";
  reg = <0x200 0x40>;
diff --git a/arch/m68k/dts/mcf5271.dtsi b/arch/m68k/dts/mcf5271.dtsi
index fc82bd3c24..0884c13ab1 100644
--- a/arch/m68k/dts/mcf5271.dtsi
+++ b/arch/m68k/dts/mcf5271.dtsi
@@ -23,6 +23,13 @@
  ranges = <0x 0x4000 0x4000>;
  reg = <0x4000 0x4000>;
+    wdog0: watchdog@14 {
+    compatible = "fsl,mcf5208-wdt";
+    reg = <0x14 0x10>;
+    big-endian;
+    status = "disabled";
+    };
+
  uart0: uart@200 {
  compatible = "fsl,mcf-uart";
  reg = <0x200 0x40>;
diff --git a/arch/m68k/dts/mcf5275.dtsi b/arch/m68k/dts/mcf5275.dtsi
index 402517cdec..78210569da 100644
--- a/arch/m68k/dts/mcf5275.dtsi
+++ b/arch/m68k/dts/mcf5275.dtsi
@@ -24,6 +24,13 @@
  ranges = <0x 0x4000 0x4000>;
  reg = <0x4000 0x4000>;
+    wdog0: watchdog@14 {
+    compatible = "fsl,mcf5208-wdt";
+    reg = <0x14 0x10>;
+    big-endian;
+    status = "disabled";
+    };
+
  uart0: uart@200 {
  compatible = "fsl,mcf-uart";
  reg = <0x200 0x40>;
diff --git a/arch/m68k/dts/mcf5282.dtsi b/arch/m68k/dts/mcf5282.dtsi
index 883c0d0324..40704c5202 100644
--- a/arch/m68k/dts/mcf5282.dtsi
+++ b/arch/m68k/dts/mcf5282.dtsi
@@ -23,6 +23,13 @@
  ranges = <0x 0x4000 0x4000>;
  reg = <0x4000 0x4000>;
+    wdog0: watchdog@14 {
+    compatible = "fsl,mcf5282-wdt";
+    reg = <0x14 0x10>;
+    big-endian;
+    status = "disabled";
+    };
+
  uart0: uart@200 {
  compatible = "fsl,mcf-uart";
  reg = <0x200 0x40>;
diff --git a/arch/m68k/dts/mcf5329.dtsi b/arch/m68k/dts/mcf5329.dtsi
index 7501cc4b01..50ff73bca7 100644
--- a/arch/m68k/dts/mcf5329.dtsi
+++ b/arch/m68k/dts/mcf5329.dtsi
@@ -16,6 +16,13 @@
  #address-cells = <1>;
  #size-cells = <1>;
+    wdog0: watchdog@fc098000 {
+    compatible = "fsl,mcf5208-wdt";
+    reg = <0xfc08c000 0x10>;
+    big-endian;
+    status = "disabled";
+    

[PATCH 5/5] MAINTAINERS: add myself as mcf_wdt.c maintainer

2023-06-25 Thread Angelo Dureghello
Signed-off-by: Angelo Dureghello 
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 228d8af433..59d011ffcf 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -865,6 +865,7 @@ S:  Maintained
 T: git https://source.denx.de/u-boot/custodians/u-boot-coldfire.git
 F: arch/m68k/
 F: doc/arch/m68k.rst
+F: drivers/watchdog/mcf_wdt.c
 
 CYCLIC
 M: Stefan Roese 
-- 
2.41.0



[PATCH 4/5] configs: m68k: add watchdog driver

2023-06-25 Thread Angelo Dureghello
Add config options for mcf_wdt driver.

Signed-off-by: Angelo Dureghello 
---
 configs/M5208EVBE_defconfig   | 2 ++
 configs/astro_mcf5373l_defconfig  | 4 ++--
 configs/eb_cpu5282_defconfig  | 1 +
 configs/eb_cpu5282_internal_defconfig | 1 +
 4 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/configs/M5208EVBE_defconfig b/configs/M5208EVBE_defconfig
index 0c5afe869b..aa054f753f 100644
--- a/configs/M5208EVBE_defconfig
+++ b/configs/M5208EVBE_defconfig
@@ -50,3 +50,5 @@ CONFIG_MCFFEC=y
 CONFIG_MII=y
 CONFIG_MCFUART=y
 CONFIG_WATCHDOG_TIMEOUT_MSECS=5000
+CONFIG_WDT=y
+CONFIG_WDT_MCF=y
diff --git a/configs/astro_mcf5373l_defconfig b/configs/astro_mcf5373l_defconfig
index aade1f98be..f4dad3bcc8 100644
--- a/configs/astro_mcf5373l_defconfig
+++ b/configs/astro_mcf5373l_defconfig
@@ -46,5 +46,5 @@ CONFIG_DM_RTC=y
 CONFIG_MCFRTC=y
 CONFIG_SYS_MCFRTC_BASE=0xFC0A8000
 CONFIG_MCFUART=y
-CONFIG_WATCHDOG=y
-CONFIG_WATCHDOG_TIMEOUT_MSECS=3355
+CONFIG_WDT=y
+CONFIG_WDT_MCF=y
diff --git a/configs/eb_cpu5282_defconfig b/configs/eb_cpu5282_defconfig
index 24edecb510..2873322598 100644
--- a/configs/eb_cpu5282_defconfig
+++ b/configs/eb_cpu5282_defconfig
@@ -52,3 +52,4 @@ CONFIG_MII=y
 CONFIG_DM_RTC=y
 CONFIG_RTC_DS1338=y
 CONFIG_MCFUART=y
+CONFIG_WDT=y
diff --git a/configs/eb_cpu5282_internal_defconfig 
b/configs/eb_cpu5282_internal_defconfig
index 44e22eb01d..bd780034ba 100644
--- a/configs/eb_cpu5282_internal_defconfig
+++ b/configs/eb_cpu5282_internal_defconfig
@@ -50,3 +50,4 @@ CONFIG_MII=y
 CONFIG_DM_RTC=y
 CONFIG_RTC_DS1338=y
 CONFIG_MCFUART=y
+CONFIG_WDT=y
-- 
2.41.0



[PATCH 3/5] m68k: dts: add watchdog node

2023-06-25 Thread Angelo Dureghello
Add watchdog node for the implemented mcf_wdt driver.

Signed-off-by: Angelo Dureghello 
---
 arch/m68k/dts/M5208EVBE.dts | 5 +
 arch/m68k/dts/mcf5208.dtsi  | 7 +++
 arch/m68k/dts/mcf523x.dtsi  | 7 +++
 arch/m68k/dts/mcf5271.dtsi  | 7 +++
 arch/m68k/dts/mcf5275.dtsi  | 7 +++
 arch/m68k/dts/mcf5282.dtsi  | 7 +++
 arch/m68k/dts/mcf5329.dtsi  | 7 +++
 arch/m68k/dts/mcf537x.dtsi  | 7 +++
 8 files changed, 54 insertions(+)

diff --git a/arch/m68k/dts/M5208EVBE.dts b/arch/m68k/dts/M5208EVBE.dts
index 1c32718af4..ec203e8b69 100644
--- a/arch/m68k/dts/M5208EVBE.dts
+++ b/arch/m68k/dts/M5208EVBE.dts
@@ -15,6 +15,11 @@
};
 };
 
+ {
+   timeout-sec = <32>;
+   status = "okay";
+};
+
  {
bootph-all;
status = "okay";
diff --git a/arch/m68k/dts/mcf5208.dtsi b/arch/m68k/dts/mcf5208.dtsi
index 9392facfa8..b06dc4bb26 100644
--- a/arch/m68k/dts/mcf5208.dtsi
+++ b/arch/m68k/dts/mcf5208.dtsi
@@ -16,6 +16,13 @@
#address-cells = <1>;
#size-cells = <1>;
 
+   wdog0: watchdog@fc08c000 {
+   compatible = "fsl,mcf5208-wdt";
+   reg = <0xfc08c000 0x10>;
+   big-endian;
+   status = "disabled";
+   };
+
uart0: uart@fc06 {
compatible = "fsl,mcf-uart";
reg = <0xfc06 0x40>;
diff --git a/arch/m68k/dts/mcf523x.dtsi b/arch/m68k/dts/mcf523x.dtsi
index 41c7b9b2d1..fb5a4cdc21 100644
--- a/arch/m68k/dts/mcf523x.dtsi
+++ b/arch/m68k/dts/mcf523x.dtsi
@@ -23,6 +23,13 @@
ranges = <0x 0x4000 0x4000>;
reg = <0x4000 0x4000>;
 
+   wdog0: watchdog@14 {
+   compatible = "fsl,mcf5208-wdt";
+   reg = <0x14 0x10>;
+   big-endian;
+   status = "disabled";
+   };
+
uart0: uart@200 {
compatible = "fsl,mcf-uart";
reg = <0x200 0x40>;
diff --git a/arch/m68k/dts/mcf5271.dtsi b/arch/m68k/dts/mcf5271.dtsi
index fc82bd3c24..0884c13ab1 100644
--- a/arch/m68k/dts/mcf5271.dtsi
+++ b/arch/m68k/dts/mcf5271.dtsi
@@ -23,6 +23,13 @@
ranges = <0x 0x4000 0x4000>;
reg = <0x4000 0x4000>;
 
+   wdog0: watchdog@14 {
+   compatible = "fsl,mcf5208-wdt";
+   reg = <0x14 0x10>;
+   big-endian;
+   status = "disabled";
+   };
+
uart0: uart@200 {
compatible = "fsl,mcf-uart";
reg = <0x200 0x40>;
diff --git a/arch/m68k/dts/mcf5275.dtsi b/arch/m68k/dts/mcf5275.dtsi
index 402517cdec..78210569da 100644
--- a/arch/m68k/dts/mcf5275.dtsi
+++ b/arch/m68k/dts/mcf5275.dtsi
@@ -24,6 +24,13 @@
ranges = <0x 0x4000 0x4000>;
reg = <0x4000 0x4000>;
 
+   wdog0: watchdog@14 {
+   compatible = "fsl,mcf5208-wdt";
+   reg = <0x14 0x10>;
+   big-endian;
+   status = "disabled";
+   };
+
uart0: uart@200 {
compatible = "fsl,mcf-uart";
reg = <0x200 0x40>;
diff --git a/arch/m68k/dts/mcf5282.dtsi b/arch/m68k/dts/mcf5282.dtsi
index 883c0d0324..40704c5202 100644
--- a/arch/m68k/dts/mcf5282.dtsi
+++ b/arch/m68k/dts/mcf5282.dtsi
@@ -23,6 +23,13 @@
ranges = <0x 0x4000 0x4000>;
reg = <0x4000 0x4000>;
 
+   wdog0: watchdog@14 {
+   compatible = "fsl,mcf5282-wdt";
+   reg = <0x14 0x10>;
+   big-endian;
+   status = "disabled";
+   };
+
uart0: uart@200 {
compatible = "fsl,mcf-uart";
reg = <0x200 0x40>;
diff --git a/arch/m68k/dts/mcf5329.dtsi b/arch/m68k/dts/mcf5329.dtsi
index 7501cc4b01..50ff73bca7 100644
--- a/arch/m68k/dts/mcf5329.dtsi
+++ b/arch/m68k/dts/mcf5329.dtsi
@@ -16,6 +16,13 @@
 

[PATCH 2/5] m68k: move watchdog functions in mcf_wdt driver

2023-06-25 Thread Angelo Dureghello
Move watchdog functions inside a separate watchdog driver.

Signed-off-by: Angelo Dureghello 
---
 arch/m68k/cpu/mcf523x/cpu.c | 42 -
 arch/m68k/cpu/mcf52x2/cpu.c | 47 +
 arch/m68k/cpu/mcf532x/cpu.c | 44 --
 3 files changed, 1 insertion(+), 132 deletions(-)

diff --git a/arch/m68k/cpu/mcf523x/cpu.c b/arch/m68k/cpu/mcf523x/cpu.c
index ba2c228911..bef67767b4 100644
--- a/arch/m68k/cpu/mcf523x/cpu.c
+++ b/arch/m68k/cpu/mcf523x/cpu.c
@@ -12,7 +12,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -62,47 +61,6 @@ int print_cpuinfo(void)
 };
 #endif /* CONFIG_DISPLAY_CPUINFO */
 
-#if defined(CONFIG_WATCHDOG)
-/* Called by macro WATCHDOG_RESET */
-void watchdog_reset(void)
-{
-   wdog_t *wdp = (wdog_t *) (MMAP_WDOG);
-
-   /* Count register */
-   out_be16(>sr, 0x);
-   asm("nop");
-   out_be16(>sr, 0x);
-}
-
-int watchdog_disable(void)
-{
-   wdog_t *wdp = (wdog_t *) (MMAP_WDOG);
-
-   /* UserManual, once the wdog is disabled, wdog cannot be re-enabled */
-   /* halted watchdog timer */
-   setbits_be16(>cr, WTM_WCR_HALTED);
-
-   puts("WATCHDOG:disabled\n");
-   return (0);
-}
-
-int watchdog_init(void)
-{
-   wdog_t *wdp = (wdog_t *) (MMAP_WDOG);
-   u32 wdog_module = 0;
-
-   /* set timeout and enable watchdog */
-   wdog_module = ((CFG_SYS_CLK / CONFIG_SYS_HZ) * 
CONFIG_WATCHDOG_TIMEOUT_MSECS);
-   wdog_module |= (wdog_module / 8192);
-   out_be16(>mr, wdog_module);
-
-   out_be16(>cr, WTM_WCR_EN);
-   puts("WATCHDOG:enabled\n");
-
-   return (0);
-}
-#endif /* CONFIG_WATCHDOG */
-
 #if defined(CONFIG_MCFFEC)
 /* Default initializations for MCFFEC controllers.  To override,
  * create a board-specific function called:
diff --git a/arch/m68k/cpu/mcf52x2/cpu.c b/arch/m68k/cpu/mcf52x2/cpu.c
index d7cbf11e25..5042a38b3e 100644
--- a/arch/m68k/cpu/mcf52x2/cpu.c
+++ b/arch/m68k/cpu/mcf52x2/cpu.c
@@ -17,7 +17,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -53,51 +52,7 @@ int print_cpuinfo(void)
return 0;
 };
 #endif /* CONFIG_DISPLAY_CPUINFO */
-
-#if defined(CONFIG_WATCHDOG)
-/* Called by macro WATCHDOG_RESET */
-void watchdog_reset(void)
-{
-   wdog_t *wdt = (wdog_t *)(MMAP_WDOG);
-
-   out_be16(>sr, 0x);
-   out_be16(>sr, 0x);
-}
-
-int watchdog_disable(void)
-{
-   wdog_t *wdt = (wdog_t *)(MMAP_WDOG);
-
-   /* reset watchdog counter */
-   out_be16(>sr, 0x);
-   out_be16(>sr, 0x);
-   /* disable watchdog timer */
-   out_be16(>cr, 0);
-
-   puts("WATCHDOG:disabled\n");
-   return (0);
-}
-
-int watchdog_init(void)
-{
-   wdog_t *wdt = (wdog_t *)(MMAP_WDOG);
-
-   /* disable watchdog */
-   out_be16(>cr, 0);
-
-   /* set timeout and enable watchdog */
-   out_be16(>mr,
-   (CONFIG_WATCHDOG_TIMEOUT_MSECS * CONFIG_SYS_HZ) / (32768 * 
1000) - 1);
-
-   /* reset watchdog counter */
-   out_be16(>sr, 0x);
-   out_be16(>sr, 0x);
-
-   puts("WATCHDOG:enabled\n");
-   return (0);
-}
-#endif /* #ifdef CONFIG_WATCHDOG */
-#endif /* #ifdef CONFIG_M5208 */
+#endif /* #ifdef CONFIG_M5208 */
 
 #ifdef  CONFIG_M5271
 #if defined(CONFIG_DISPLAY_CPUINFO)
diff --git a/arch/m68k/cpu/mcf532x/cpu.c b/arch/m68k/cpu/mcf532x/cpu.c
index 548cbca36a..18d20a8926 100644
--- a/arch/m68k/cpu/mcf532x/cpu.c
+++ b/arch/m68k/cpu/mcf532x/cpu.c
@@ -12,7 +12,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -102,49 +101,6 @@ int print_cpuinfo(void)
 };
 #endif /* CONFIG_DISPLAY_CPUINFO */
 
-#if defined(CONFIG_WATCHDOG)
-/* Called by macro WATCHDOG_RESET */
-void watchdog_reset(void)
-{
-   wdog_t *wdp = (wdog_t *) (MMAP_WDOG);
-
-   /* Count register */
-   out_be16(>sr, 0x);
-   out_be16(>sr, 0x);
-}
-
-int watchdog_disable(void)
-{
-   wdog_t *wdp = (wdog_t *) (MMAP_WDOG);
-
-   /* UserManual, once the wdog is disabled, wdog cannot be re-enabled */
-   /* halted watchdog timer */
-   setbits_be16(>cr, WTM_WCR_HALTED);
-
-   puts("WATCHDOG:disabled\n");
-   return (0);
-}
-
-int watchdog_init(void)
-{
-   wdog_t *wdp = (wdog_t *) (MMAP_WDOG);
-   u32 wdog_module = 0;
-
-   /* set timeout and enable watchdog */
-   wdog_module = ((CFG_SYS_CLK / 1000) * CONFIG_WATCHDOG_TIMEOUT_MSECS);
-#ifdef CONFIG_M5329
-   out_be16(>mr, wdog_module / 8192);
-#else
-   out_be16(>mr, wdog_module / 4096);
-#endif
-
-   out_be16(>cr, WTM_WCR_EN);
-   puts("WATCHDOG:enabled\n");
-
-   return (0);
-}
-#endif /* CONFIG_WATCHDOG */
-
 #if de

[PATCH 1/5] drivers: watchdog: add mcf watchdog support

2023-06-25 Thread Angelo Dureghello
This watchdog driver applies to the following
mcf families:

- mcf52x2 (5271 5275 5282)
- mcf532x (5329 5373)
- mcf523x (5235)

Cpu's not listed for each family does not have WDT module.

Note, after some attempts testing by qemu on 5208 i
finally abandoned, watchdog seems not implemented properly.

The driver has been tested in a real M5282EVM.

Signed-off-by: Angelo Dureghello 
---
 drivers/watchdog/Kconfig   |   7 ++
 drivers/watchdog/Makefile  |   1 +
 drivers/watchdog/mcf_wdt.c | 162 +
 3 files changed, 170 insertions(+)
 create mode 100644 drivers/watchdog/mcf_wdt.c

diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index 646663528a..07fc4940e9 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -178,6 +178,13 @@ config WDT_MAX6370
help
  Select this to enable max6370 watchdog timer.
 
+config WDT_MCF
+   bool "ColdFire family watchdog timer support"
+   depends on WDT
+   help
+ Select this to enable ColdFire watchdog timer,
+ which supports mcf52x2 mcf532x mcf523x families.
+
 config WDT_MESON_GXBB
bool "Amlogic watchdog timer support"
depends on WDT
diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile
index fd5d9c7376..eef786f5e7 100644
--- a/drivers/watchdog/Makefile
+++ b/drivers/watchdog/Makefile
@@ -31,6 +31,7 @@ obj-$(CONFIG_WDT_CDNS) += cdns_wdt.o
 obj-$(CONFIG_WDT_FTWDT010) += ftwdt010_wdt.o
 obj-$(CONFIG_WDT_GPIO) += gpio_wdt.o
 obj-$(CONFIG_WDT_MAX6370) += max6370_wdt.o
+obj-$(CONFIG_WDT_MCF) += mcf_wdt.o
 obj-$(CONFIG_WDT_MESON_GXBB) += meson_gxbb_wdt.o
 obj-$(CONFIG_WDT_MPC8xxx) += mpc8xxx_wdt.o
 obj-$(CONFIG_WDT_MT7620) += mt7620_wdt.o
diff --git a/drivers/watchdog/mcf_wdt.c b/drivers/watchdog/mcf_wdt.c
new file mode 100644
index 00..03842135c5
--- /dev/null
+++ b/drivers/watchdog/mcf_wdt.c
@@ -0,0 +1,162 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * mcf_wdt.c - driver for ColdFire on-chip watchdog
+ *
+ * Author: Angelo Dureghello 
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define TIMEOUT_MAX3360
+#define TIMEOUT_MIN500
+
+#define DIVIDER_5XXX   4096
+#define DIVIDER_5282   8192
+
+#define WCR_EN  BIT(0)
+#define WCR_HALTED  BIT(1)
+#define WCR_DOZEBIT(2)
+#define WCR_WAITBIT(3)
+
+struct watchdog_regs {
+   u16 wcr;/* Control */
+   u16 wmr;/* Service */
+   u16 wcntr;  /* Counter */
+   u16 wsr;/* Reset Status */
+};
+
+#if defined(CONFIG_WDT_MCF)
+static void mcf_watchdog_reset(struct watchdog_regs *wdog)
+{
+#ifndef CONFIG_WATCHDOG_RESET_DISABLE
+   writew(0x, >wsr);
+   writew(0x, >wsr);
+#endif /* CONFIG_WATCHDOG_RESET_DISABLE*/
+}
+
+static void mcf_watchdog_init(struct watchdog_regs *wdog, u32 fixed_divider,
+ u64 timeout_msecs)
+{
+   u32 wdog_module;
+
+   /*
+* The timer watchdog can be set between
+* 0.5 and 128 Seconds.
+*/
+
+   /* set timeout and enable watchdog */
+   wdog_module = ((CFG_SYS_CLK / 1000) * timeout_msecs);
+
+   writew((u16)(wdog_module / fixed_divider), >wmr);
+   writew(WCR_EN, >wcr);
+
+   mcf_watchdog_reset(wdog);
+}
+
+#if !CONFIG_IS_ENABLED(WDT)
+void hw_watchdog_reset(void)
+{
+   struct watchdog_regs *wdog = (struct watchdog_regs *)MMAP_WDOG;
+
+   mcf_watchdog_reset(wdog);
+}
+
+void hw_watchdog_init(void)
+{
+   struct watchdog_regs *wdog = (struct watchdog_regs *)MMAP_WDOG;
+
+   if (IS_ENABLED(CONFIG_MCF5282))
+   writew(>wmr, wdog_module / DIVIDER_5282);
+   else
+   writew(>wmr, wdog_module / DIVIDER_5XXX);
+
+   mcf_watchdog_init(wdog, CONFIG_WATCHDOG_TIMEOUT_MSECS);
+}
+
+#else /* CONFIG_WDT */
+
+struct mcf_wdt_priv {
+   void __iomem *base;
+   u32 fixed_divider;
+};
+
+static int mcf_wdt_expire_now(struct udevice *dev, ulong flags)
+{
+   hang();
+
+   return 0;
+}
+
+static int mcf_wdt_reset(struct udevice *dev)
+{
+   struct mcf_wdt_priv *priv = dev_get_priv(dev);
+
+   mcf_watchdog_reset(priv->base);
+
+   return 0;
+}
+
+static int mcf_wdt_start(struct udevice *dev, u64 timeout, ulong flags)
+{
+   struct mcf_wdt_priv *priv = dev_get_priv(dev);
+
+   /* Timeout from fdt is in second, driver works in msecs */
+   mcf_watchdog_init(priv->base, priv->fixed_divider,
+ timeout * 1000);
+
+   return 0;
+}
+
+static int mcf_wdt_stop(struct udevice *dev)
+{
+   struct mcf_wdt_priv *priv = dev_get_priv(dev);
+   struct watchdog_regs *wdog = (struct watchdog_regs *)priv->base;
+
+   setbits_be16(>wcr, WCR_HALTED);
+
+   return 0;
+}
+
+static int mcf_wdt_probe(struct udevice *dev)
+{
+   struct mcf_wdt_priv *priv = dev_get_priv(dev);
+
+   priv->base = dev_read_addr_ptr(dev);

[PATCH 0/5] m68k: add ColdFire watchdog driver

2023-06-25 Thread Angelo Dureghello
This patch allows to reach 0 warning for the m68k
family. Watchdog driver was the last one producing the
"conversion to DM" warning,

Angelo Dureghello (5):
  drivers: watchdog: add mcf watchdog support
  m68k: move watchdog functions in mcf_wdt driver
  m68k: dts: add watchdog node
  configs: m68k: add watchdog driver
  MAINTAINERS: add myself as mcf_wdt.c maintainer

 MAINTAINERS   |   1 +
 arch/m68k/cpu/mcf523x/cpu.c   |  42 ---
 arch/m68k/cpu/mcf52x2/cpu.c   |  47 +---
 arch/m68k/cpu/mcf532x/cpu.c   |  44 ---
 arch/m68k/dts/M5208EVBE.dts   |   5 +
 arch/m68k/dts/mcf5208.dtsi|   7 ++
 arch/m68k/dts/mcf523x.dtsi|   7 ++
 arch/m68k/dts/mcf5271.dtsi|   7 ++
 arch/m68k/dts/mcf5275.dtsi|   7 ++
 arch/m68k/dts/mcf5282.dtsi|   7 ++
 arch/m68k/dts/mcf5329.dtsi|   7 ++
 arch/m68k/dts/mcf537x.dtsi|   7 ++
 configs/M5208EVBE_defconfig   |   2 +
 configs/astro_mcf5373l_defconfig  |   4 +-
 configs/eb_cpu5282_defconfig  |   1 +
 configs/eb_cpu5282_internal_defconfig |   1 +
 drivers/watchdog/Kconfig  |   7 ++
 drivers/watchdog/Makefile |   1 +
 drivers/watchdog/mcf_wdt.c| 162 ++
 19 files changed, 232 insertions(+), 134 deletions(-)
 create mode 100644 drivers/watchdog/mcf_wdt.c

-- 
2.41.0



Re: [PATCH 4/8] m68k: use asm-generic/unaligned.h

2023-05-28 Thread Angelo Dureghello

Hi,

On 22/05/23 2:22 PM, Jens Wiklander wrote:

M68k essentially duplicates the content of asm-generic/unaligned.h, with
an exception for non-Coldfire configurations. Coldfire configurations
are apparently able to do unaligned accesses. But in an attempt to clean
up and handle unaligned accesses in the same way we ignore that and use
the common asm-generic/unaligned.h directly instead.

Signed-off-by: Jens Wiklander 
---
  arch/m68k/include/asm/unaligned.h | 17 ++---
  1 file changed, 2 insertions(+), 15 deletions(-)

diff --git a/arch/m68k/include/asm/unaligned.h 
b/arch/m68k/include/asm/unaligned.h
index 328aa0c316c9..7fb482abc383 100644
--- a/arch/m68k/include/asm/unaligned.h
+++ b/arch/m68k/include/asm/unaligned.h
@@ -1,15 +1,2 @@
-#ifndef _ASM_M68K_UNALIGNED_H
-#define _ASM_M68K_UNALIGNED_H
-
-#ifdef CONFIG_COLDFIRE
-#include 
-#else
-#include 
-#endif
-
-#include 
-
-#define get_unaligned  __get_unaligned_be
-#define put_unaligned  __put_unaligned_be
-
-#endif /* _ASM_M68K_UNALIGNED_H */
+/* SPDX-License-Identifier: GPL-2.0 */
+#include 


sorry if a bit late,
i tested this on coldfire mcf54415, no issues, so ok for me.


Acked-by: Angelo Dureghello 


Regards,
angelo



[PULL] Please pull u-boot-coldfire/master

2023-04-16 Thread Angelo Dureghello

The following changes since commit 12c1e5782401abca1a8cff578d1911a9ca7d2e7d:

  Merge branch 'master' of 
https://source.denx.de/u-boot/custodians/u-boot-marvell (2023-04-14 
10:50:55 -0400)


are available in the Git repository at:

  git://git.denx.de/u-boot-coldfire.git master

for you to fetch changes up to ea82cd1cbdc9d2bf8ff94d2f993edce9fec16d1e:

  configs: m68k: Use default shell prompt (2023-04-16 21:43:28 +0200)


Marek Vasut (6):
  arch: m68k: Use existing CONFIG_MCFTMR instead of CFG_MCFTMR
  arch: m68k: Introduce trivial PIT based timer
  arch: m68k: Add QEMU specific RAMBAR workaround
  CI: Add m68k target
  travis-ci: Add m68k M5208EVBE machine
  configs: m68k: Use default shell prompt

 .azure-pipelines.yml   |  5 +
 .gitlab-ci.yml |  8 
 arch/m68k/Kconfig  | 10 ++
 arch/m68k/cpu/mcf523x/interrupts.c |  2 +-
 arch/m68k/cpu/mcf52x2/interrupts.c | 12 ++--
 arch/m68k/cpu/mcf52x2/start.S  |  4 ++--
 arch/m68k/cpu/mcf532x/interrupts.c |  2 +-
 arch/m68k/cpu/mcf5445x/interrupts.c|  2 +-
 arch/m68k/include/asm/immap.h  | 48 

 arch/m68k/lib/time.c   | 38 
+++---
 bin/travis-ci/conf.M5208EVBE_qemu  | 27 
+++

 board/freescale/m53017evb/README   |  2 +-
 board/freescale/m5373evb/README|  2 +-
 common/board_f.c   |  2 +-
 configs/M5208EVBE_defconfig|  1 -
 configs/M5235EVB_defconfig |  1 -
 configs/M5272C3_defconfig  |  1 -
 configs/M5275EVB_defconfig |  1 -
 configs/M5282EVB_defconfig |  1 -
 configs/M53017EVB_defconfig|  1 -
 configs/M5329AFEE_defconfig|  1 -
 configs/M5329BFEE_defconfig|  1 -
 configs/M5373EVB_defconfig |  1 -
 include/configs/M5208EVBE.h|  1 -
 include/configs/M5235EVB.h |  1 -
 include/configs/M5249EVB.h |  1 -
 include/configs/M5253DEMO.h|  1 -
 include/configs/M5272C3.h  |  1 -
 include/configs/M5275EVB.h |  1 -
 include/configs/M5282EVB.h |  1 -
 include/configs/M53017EVB.h|  1 -
 include/configs/M5329EVB.h |  1 -
 include/configs/M5373EVB.h |  1 -
 include/configs/amcore.h   |  1 -
 include/configs/astro_mcf5373l.h   |  1 -
 include/configs/cobra5272.h|  1 -
 include/configs/eb_cpu5282.h   |  1 -
 include/configs/stmark2.h  |  1 -
 py/travis-ci/u_boot_boardenv_M5208EVBE_qemu.py |  6 ++
 39 files changed, 141 insertions(+), 53 deletions(-)
 create mode 100644 bin/travis-ci/conf.M5208EVBE_qemu
 create mode 100644 py/travis-ci/u_boot_boardenv_M5208EVBE_qemu.py





Re: [PATCH] configs: m68k: Use default shell prompt

2023-04-16 Thread Angelo Dureghello

Hi Marek,

On 23/03/23 1:21 AM, Marek Vasut wrote:

The current shell prompt '->' interferes with CI matching on 'bdinfo'
output. When CI test.py attempts to locate memory information in the
'bdinfo' output, it matches on '->' prefix which is identical to the
shell prefix. Switch the prompt to default '=>' one to avoid this
interference.

Suggested-by: Tom Rini  # found the CI oddity
Signed-off-by: Marek Vasut 
---
Cc: Angelo Dureghello 
Cc: Huan Wang 
Cc: Marek Vasut 
Cc: Simon Glass 
Cc: Stefan Roese 
Cc: Tom Rini 
---
  configs/M5208EVBE_defconfig | 1 -
  configs/M5235EVB_defconfig  | 1 -
  configs/M5272C3_defconfig   | 1 -
  configs/M5275EVB_defconfig  | 1 -
  configs/M5282EVB_defconfig  | 1 -
  configs/M53017EVB_defconfig | 1 -
  configs/M5329AFEE_defconfig | 1 -
  configs/M5329BFEE_defconfig | 1 -
  configs/M5373EVB_defconfig  | 1 -
  9 files changed, 9 deletions(-)

diff --git a/configs/M5208EVBE_defconfig b/configs/M5208EVBE_defconfig
index 3263414d1c2..bc98d7fd641 100644
--- a/configs/M5208EVBE_defconfig
+++ b/configs/M5208EVBE_defconfig
@@ -4,7 +4,6 @@ CONFIG_SYS_MALLOC_LEN=0x2
  CONFIG_ENV_SIZE=0x1000
  CONFIG_ENV_SECT_SIZE=0x2000
  CONFIG_DEFAULT_DEVICE_TREE="M5208EVBE"
-CONFIG_SYS_PROMPT="-> "
  CONFIG_SYS_LOAD_ADDR=0x4001
  CONFIG_ENV_ADDR=0x2000
  CONFIG_TARGET_M5208EVBE=y
diff --git a/configs/M5235EVB_defconfig b/configs/M5235EVB_defconfig
index fbd3e086ec3..ac696d8a8d6 100644
--- a/configs/M5235EVB_defconfig
+++ b/configs/M5235EVB_defconfig
@@ -4,7 +4,6 @@ CONFIG_SYS_MALLOC_LEN=0x2
  CONFIG_ENV_SIZE=0x2000
  CONFIG_ENV_SECT_SIZE=0x2000
  CONFIG_DEFAULT_DEVICE_TREE="M5235EVB"
-CONFIG_SYS_PROMPT="-> "
  CONFIG_SYS_LOAD_ADDR=0x2
  CONFIG_ENV_ADDR=0xFFE04000
  CONFIG_TARGET_M5235EVB=y
diff --git a/configs/M5272C3_defconfig b/configs/M5272C3_defconfig
index 1c51c4a1666..6b46c6f4f51 100644
--- a/configs/M5272C3_defconfig
+++ b/configs/M5272C3_defconfig
@@ -4,7 +4,6 @@ CONFIG_SYS_MALLOC_LEN=0x4
  CONFIG_ENV_SIZE=0x2000
  CONFIG_ENV_SECT_SIZE=0x2000
  CONFIG_DEFAULT_DEVICE_TREE="M5272C3"
-CONFIG_SYS_PROMPT="-> "
  CONFIG_SYS_LOAD_ADDR=0x2
  CONFIG_ENV_ADDR=0xFFE04000
  CONFIG_TARGET_M5272C3=y
diff --git a/configs/M5275EVB_defconfig b/configs/M5275EVB_defconfig
index ca1c18420ff..8eb551678b9 100644
--- a/configs/M5275EVB_defconfig
+++ b/configs/M5275EVB_defconfig
@@ -4,7 +4,6 @@ CONFIG_SYS_MALLOC_LEN=0x4
  CONFIG_ENV_SIZE=0x2000
  CONFIG_ENV_SECT_SIZE=0x2000
  CONFIG_DEFAULT_DEVICE_TREE="M5275EVB"
-CONFIG_SYS_PROMPT="-> "
  CONFIG_SYS_LOAD_ADDR=0x80
  CONFIG_ENV_ADDR=0xFFE04000
  CONFIG_TARGET_M5275EVB=y
diff --git a/configs/M5282EVB_defconfig b/configs/M5282EVB_defconfig
index 2b053e3bbfe..1997f3800bb 100644
--- a/configs/M5282EVB_defconfig
+++ b/configs/M5282EVB_defconfig
@@ -4,7 +4,6 @@ CONFIG_SYS_MALLOC_LEN=0x4
  CONFIG_ENV_SIZE=0x2000
  CONFIG_ENV_SECT_SIZE=0x2000
  CONFIG_DEFAULT_DEVICE_TREE="M5282EVB"
-CONFIG_SYS_PROMPT="-> "
  CONFIG_SYS_LOAD_ADDR=0x2
  CONFIG_ENV_ADDR=0xFFE04000
  CONFIG_TARGET_M5282EVB=y
diff --git a/configs/M53017EVB_defconfig b/configs/M53017EVB_defconfig
index c70964f7aa0..92445feb7d2 100644
--- a/configs/M53017EVB_defconfig
+++ b/configs/M53017EVB_defconfig
@@ -4,7 +4,6 @@ CONFIG_SYS_MALLOC_LEN=0x2
  CONFIG_ENV_SIZE=0x1000
  CONFIG_ENV_SECT_SIZE=0x8000
  CONFIG_DEFAULT_DEVICE_TREE="M53017EVB"
-CONFIG_SYS_PROMPT="-> "
  CONFIG_SYS_LOAD_ADDR=0x4001
  CONFIG_ENV_ADDR=0x4
  CONFIG_TARGET_M53017EVB=y
diff --git a/configs/M5329AFEE_defconfig b/configs/M5329AFEE_defconfig
index 455eea255ae..238413d2d5c 100644
--- a/configs/M5329AFEE_defconfig
+++ b/configs/M5329AFEE_defconfig
@@ -4,7 +4,6 @@ CONFIG_SYS_MALLOC_LEN=0x2
  CONFIG_ENV_SIZE=0x2000
  CONFIG_ENV_SECT_SIZE=0x2000
  CONFIG_DEFAULT_DEVICE_TREE="M5329AFEE"
-CONFIG_SYS_PROMPT="-> "
  CONFIG_SYS_LOAD_ADDR=0x4001
  CONFIG_ENV_ADDR=0x4000
  CONFIG_TARGET_M5329EVB=y
diff --git a/configs/M5329BFEE_defconfig b/configs/M5329BFEE_defconfig
index 0251444b3bf..43cfc0e94db 100644
--- a/configs/M5329BFEE_defconfig
+++ b/configs/M5329BFEE_defconfig
@@ -4,7 +4,6 @@ CONFIG_SYS_MALLOC_LEN=0x2
  CONFIG_ENV_SIZE=0x2000
  CONFIG_ENV_SECT_SIZE=0x2000
  CONFIG_DEFAULT_DEVICE_TREE="M5329BFEE"
-CONFIG_SYS_PROMPT="-> "
  CONFIG_SYS_LOAD_ADDR=0x4001
  CONFIG_ENV_ADDR=0x4000
  CONFIG_TARGET_M5329EVB=y
diff --git a/configs/M5373EVB_defconfig b/configs/M5373EVB_defconfig
index eec95da8573..db85e3401f4 100644
--- a/configs/M5373EVB_defconfig
+++ b/configs/M5373EVB_defconfig
@@ -4,7 +4,6 @@ CONFIG_SYS_MALLOC_LEN=0x2
  CONFIG_ENV_SIZE=0x2000
  CONFIG_ENV_SECT_SIZE=0x2000
  CONFIG_DEFAULT_DEVICE_TREE="M5373EVB"
-CONFIG_SYS_PROMPT="-> "
  CONFIG_SYS_LOAD_ADDR=0x4001
  CONFIG_ENV_ADDR=0x4000
  CONFIG_TARGET_M5373EVB=y



Applied to u-boot-coldfire/master, thanks!


angelo


Re: [PATCH 6/6] m68k: upgrading all boards to dm i2c

2023-04-11 Thread Angelo Dureghello

Hi Helko,

On 11/04/23 6:41 AM, Heiko Schocher wrote:

Hello Angelo,

On 05.04.23 00:59, Angelo Dureghello wrote:

Upgrading all board configs where i2c is involved to DM i2c.

Signed-off-by: Angelo Dureghello 
---
  configs/M5208EVBE_defconfig   | 5 +
  configs/M5235EVB_Flash32_defconfig| 1 +
  configs/M5235EVB_defconfig| 1 +
  configs/M5253DEMO_defconfig   | 5 +
  configs/M5275EVB_defconfig| 5 +
  configs/M53017EVB_defconfig   | 6 ++
  configs/M5329AFEE_defconfig   | 6 ++
  configs/M5329BFEE_defconfig   | 6 ++
  configs/M5373EVB_defconfig| 3 ++-
  configs/astro_mcf5373l_defconfig  | 6 ++
  configs/eb_cpu5282_defconfig  | 5 ++---
  configs/eb_cpu5282_internal_defconfig | 5 ++---
  configs/stmark2_defconfig | 4 
  13 files changed, 23 insertions(+), 35 deletions(-)


Thanks for this series, I did not find a cover letter Email,
so I have here a common question:

You rename in patch 1/6

CONFIG_SYS_I2C_0 -> CFG_SYS_I2C_0

but only add in patch 2/6 for the stmark2 this renamed define,
and add DTS nodes for other boards in patch 5/6 and here the
defconfig changes... may I oversee something obvious, but do
the other boards not also need some CFG_SYS_I2C_0 define?



CFG_SYS_I2C_0 (0 to 5) it's a define to setup pads pinmux to i2c,
but only for coldfire mcf5441x family that requires this.

m68k/cpu/mcf5445x/cpu_init.c:#ifdef CFG_SYS_I2C_0

Involved board is only stmark2, that is the board
i am using here for test. I found this define to be set
because i2c was not working, so i moved in the more proper
CFG_ namespace.

I cannot test other boards actually, but i don't find any
similar define/need in their start code, so i am supposing
other cpu families are not needing it, or using other
definitions for pinmux.

I would like one day to add pinmux setup from fdt,
but not trivial, linux does not have fdt implementation for
coldfire, so need to invent it from scratch.



Thanks!

bye,
Heiko


Thanks,
Regards,
angelo




[PATCH] doc: arch: m68k: fix maintainer email

2023-04-04 Thread Angelo Dureghello
Fix email with currently used address.

Signed-off-by: Angelo Dureghello 
---
 doc/arch/m68k.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/arch/m68k.rst b/doc/arch/m68k.rst
index a9180fd785..8474ece62c 100644
--- a/doc/arch/m68k.rst
+++ b/doc/arch/m68k.rst
@@ -5,7 +5,7 @@ M68K / ColdFire
 
 History
 ---
-* November 02, 2017Angelo Dureghello 
+* November 02, 2017Angelo Dureghello 
 * August   08, 2005Jens Scharsig 
   MCF5282 implementation without preloader
 * January  12, 2004
-- 
2.40.0



[PATCH 6/6] m68k: upgrading all boards to dm i2c

2023-04-04 Thread Angelo Dureghello
Upgrading all board configs where i2c is involved to DM i2c.

Signed-off-by: Angelo Dureghello 
---
 configs/M5208EVBE_defconfig   | 5 +
 configs/M5235EVB_Flash32_defconfig| 1 +
 configs/M5235EVB_defconfig| 1 +
 configs/M5253DEMO_defconfig   | 5 +
 configs/M5275EVB_defconfig| 5 +
 configs/M53017EVB_defconfig   | 6 ++
 configs/M5329AFEE_defconfig   | 6 ++
 configs/M5329BFEE_defconfig   | 6 ++
 configs/M5373EVB_defconfig| 3 ++-
 configs/astro_mcf5373l_defconfig  | 6 ++
 configs/eb_cpu5282_defconfig  | 5 ++---
 configs/eb_cpu5282_internal_defconfig | 5 ++---
 configs/stmark2_defconfig | 4 
 13 files changed, 23 insertions(+), 35 deletions(-)

diff --git a/configs/M5208EVBE_defconfig b/configs/M5208EVBE_defconfig
index 3263414d1c..72c0560d11 100644
--- a/configs/M5208EVBE_defconfig
+++ b/configs/M5208EVBE_defconfig
@@ -38,11 +38,8 @@ CONFIG_NETMASK="255.255.255.0"
 CONFIG_USE_SERVERIP=y
 CONFIG_SERVERIP="192.162.1.1"
 CONFIG_SYS_RX_ETH_BUFFER=8
-CONFIG_SYS_I2C_LEGACY=y
+CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_FSL=y
-CONFIG_SYS_FSL_I2C_OFFSET=0x58000
-CONFIG_SYS_I2C_SLAVE=0x7F
-CONFIG_SYS_I2C_SPEED=8
 CONFIG_MTD_NOR_FLASH=y
 CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_CFI_WIDTH_16BIT=y
diff --git a/configs/M5235EVB_Flash32_defconfig 
b/configs/M5235EVB_Flash32_defconfig
index 0b924563d2..f96a2f290b 100644
--- a/configs/M5235EVB_Flash32_defconfig
+++ b/configs/M5235EVB_Flash32_defconfig
@@ -61,3 +61,4 @@ CONFIG_MCFFEC=y
 CONFIG_MII=y
 CONFIG_MCFUART=y
 CONFIG_WATCHDOG_TIMEOUT_MSECS=5000
+CONFIG_DM_I2C=y
diff --git a/configs/M5235EVB_defconfig b/configs/M5235EVB_defconfig
index fbd3e086ec..64f8a133e1 100644
--- a/configs/M5235EVB_defconfig
+++ b/configs/M5235EVB_defconfig
@@ -61,3 +61,4 @@ CONFIG_MCFFEC=y
 CONFIG_MII=y
 CONFIG_MCFUART=y
 CONFIG_WATCHDOG_TIMEOUT_MSECS=5000
+CONFIG_DM_I2C=y
diff --git a/configs/M5253DEMO_defconfig b/configs/M5253DEMO_defconfig
index e6ab998f29..99bf18f963 100644
--- a/configs/M5253DEMO_defconfig
+++ b/configs/M5253DEMO_defconfig
@@ -37,11 +37,8 @@ CONFIG_SYS_ATA_ALT_OFFSET=0xC0
 CONFIG_SYS_ATA_IDE0_OFFSET=0
 CONFIG_ATAPI=y
 CONFIG_IDE_RESET=y
-CONFIG_SYS_I2C_LEGACY=y
+CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_FSL=y
-CONFIG_SYS_FSL_I2C_OFFSET=0x280
-CONFIG_SYS_I2C_SLAVE=0x7F
-CONFIG_SYS_I2C_SPEED=8
 CONFIG_MTD_NOR_FLASH=y
 CONFIG_SYS_MAX_FLASH_SECT=2048
 CONFIG_USE_SYS_MAX_FLASH_BANKS=y
diff --git a/configs/M5275EVB_defconfig b/configs/M5275EVB_defconfig
index ca1c18420f..5ce9b74f06 100644
--- a/configs/M5275EVB_defconfig
+++ b/configs/M5275EVB_defconfig
@@ -34,11 +34,8 @@ CONFIG_OVERWRITE_ETHADDR_ONCE=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_SYS_FAULT_ECHO_LINK_DOWN=y
 CONFIG_SYS_RX_ETH_BUFFER=8
-CONFIG_SYS_I2C_LEGACY=y
+CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_FSL=y
-CONFIG_SYS_FSL_I2C_OFFSET=0x300
-CONFIG_SYS_I2C_SLAVE=0x7F
-CONFIG_SYS_I2C_SPEED=8
 CONFIG_MTD_NOR_FLASH=y
 CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_FLASH_SHOW_PROGRESS=0
diff --git a/configs/M53017EVB_defconfig b/configs/M53017EVB_defconfig
index c70964f7aa..7c31a68c3b 100644
--- a/configs/M53017EVB_defconfig
+++ b/configs/M53017EVB_defconfig
@@ -40,11 +40,8 @@ CONFIG_NETMASK="255.255.255.0"
 CONFIG_USE_SERVERIP=y
 CONFIG_SERVERIP="192.162.1.1"
 CONFIG_SYS_RX_ETH_BUFFER=8
-CONFIG_SYS_I2C_LEGACY=y
+CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_FSL=y
-CONFIG_SYS_FSL_I2C_OFFSET=0x58000
-CONFIG_SYS_I2C_SLAVE=0x7F
-CONFIG_SYS_I2C_SPEED=8
 CONFIG_MTD_NOR_FLASH=y
 CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_CFI_WIDTH_16BIT=y
@@ -57,6 +54,7 @@ CONFIG_SYS_MAX_FLASH_SECT=137
 CONFIG_MCFFEC=y
 CONFIG_SYS_UNIFY_CACHE=y
 CONFIG_MII=y
+CONFIG_DM_RTC=y
 CONFIG_MCFRTC=y
 CONFIG_SYS_MCFRTC_BASE=0xFC0A8000
 CONFIG_MCFUART=y
diff --git a/configs/M5329AFEE_defconfig b/configs/M5329AFEE_defconfig
index 455eea255a..a5ee08207a 100644
--- a/configs/M5329AFEE_defconfig
+++ b/configs/M5329AFEE_defconfig
@@ -39,11 +39,8 @@ CONFIG_NETMASK="255.255.255.0"
 CONFIG_USE_SERVERIP=y
 CONFIG_SERVERIP="192.162.1.1"
 CONFIG_SYS_RX_ETH_BUFFER=8
-CONFIG_SYS_I2C_LEGACY=y
+CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_FSL=y
-CONFIG_SYS_FSL_I2C_OFFSET=0x58000
-CONFIG_SYS_I2C_SLAVE=0x7F
-CONFIG_SYS_I2C_SPEED=8
 CONFIG_MTD=y
 CONFIG_MTD_NOR_FLASH=y
 CONFIG_FLASH_CFI_DRIVER=y
@@ -55,6 +52,7 @@ CONFIG_SYS_MAX_FLASH_SECT=137
 CONFIG_MCFFEC=y
 CONFIG_SYS_UNIFY_CACHE=y
 CONFIG_MII=y
+CONFIG_DM_RTC=y
 CONFIG_MCFRTC=y
 CONFIG_SYS_MCFRTC_BASE=0xFC0A8000
 CONFIG_MCFUART=y
diff --git a/configs/M5329BFEE_defconfig b/configs/M5329BFEE_defconfig
index 0251444b3b..c5abed9dfd 100644
--- a/configs/M5329BFEE_defconfig
+++ b/configs/M5329BFEE_defconfig
@@ -40,11 +40,8 @@ CONFIG_NETMASK="255.255.255.0"
 CONFIG_USE_SERVERIP=y
 CONFIG_SERVERIP="192.162.1.1"
 CONFIG_SYS_RX_ETH_BUFFER=8
-CONFIG_SYS_I2C_LEGACY=y
+CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_FSL=y
-CONFIG_SYS_FSL_I2C_OFFSET=0x58000
-CONFIG_SYS_

[PATCH 5/6] m68k: dts: add i2c nodes

2023-04-04 Thread Angelo Dureghello
Add all the i2c nodes for each family, and add specific i2c
overwrites in the related board-specific dts.

Signed-off-by: Angelo Dureghello 
---
 arch/m68k/dts/M5208EVBE.dts   |  6 +++
 arch/m68k/dts/M5253DEMO.dts   |  5 +++
 arch/m68k/dts/M5275EVB.dts|  6 +++
 arch/m68k/dts/M53017EVB.dts   |  6 +++
 arch/m68k/dts/M5329AFEE.dts   |  6 +++
 arch/m68k/dts/M5329BFEE.dts   |  6 +++
 arch/m68k/dts/M5373EVB.dts|  4 ++
 arch/m68k/dts/astro_mcf5373l.dts  |  6 +++
 arch/m68k/dts/eb_cpu5282.dts  |  9 
 arch/m68k/dts/eb_cpu5282_internal.dts |  9 
 arch/m68k/dts/mcf5208.dtsi| 10 +
 arch/m68k/dts/mcf523x.dtsi| 10 +
 arch/m68k/dts/mcf5249.dtsi| 28 +
 arch/m68k/dts/mcf5253.dtsi| 28 +
 arch/m68k/dts/mcf5271.dtsi| 10 +
 arch/m68k/dts/mcf5275.dtsi| 10 +
 arch/m68k/dts/mcf5282.dtsi| 10 +
 arch/m68k/dts/mcf5301x.dtsi   | 10 +
 arch/m68k/dts/mcf5307.dtsi| 10 +
 arch/m68k/dts/mcf5329.dtsi| 10 +
 arch/m68k/dts/mcf537x.dtsi| 10 +
 arch/m68k/dts/mcf5441x.dtsi   | 60 +++
 arch/m68k/dts/stmark2.dts |  4 ++
 23 files changed, 273 insertions(+)

diff --git a/arch/m68k/dts/M5208EVBE.dts b/arch/m68k/dts/M5208EVBE.dts
index 78973fca57..1c32718af4 100644
--- a/arch/m68k/dts/M5208EVBE.dts
+++ b/arch/m68k/dts/M5208EVBE.dts
@@ -23,3 +23,9 @@
  {
status = "okay";
 };
+
+ {
+   clock-frequency = <8>;
+   u-boot,i2c-slave-addr = <0x7f>;
+   status = "okay";
+};
diff --git a/arch/m68k/dts/M5253DEMO.dts b/arch/m68k/dts/M5253DEMO.dts
index 515484ae93..a3f070661e 100644
--- a/arch/m68k/dts/M5253DEMO.dts
+++ b/arch/m68k/dts/M5253DEMO.dts
@@ -20,3 +20,8 @@
status = "okay";
 };
 
+ {
+   clock-frequency = <8>;
+   u-boot,i2c-slave-addr = <0x7f>;
+   status = "okay";
+};
diff --git a/arch/m68k/dts/M5275EVB.dts b/arch/m68k/dts/M5275EVB.dts
index 4737f927db..d79f8a7885 100644
--- a/arch/m68k/dts/M5275EVB.dts
+++ b/arch/m68k/dts/M5275EVB.dts
@@ -27,3 +27,9 @@
  {
status = "okay";
 };
+
+ {
+   clock-frequency = <8>;
+   u-boot,i2c-slave-addr = <0x7f>;
+   status = "okay";
+};
diff --git a/arch/m68k/dts/M53017EVB.dts b/arch/m68k/dts/M53017EVB.dts
index 31c50b65c2..90851dd0af 100644
--- a/arch/m68k/dts/M53017EVB.dts
+++ b/arch/m68k/dts/M53017EVB.dts
@@ -27,3 +27,9 @@
  {
status = "okay";
 };
+
+ {
+   clock-frequency = <8>;
+   u-boot,i2c-slave-addr = <0x7f>;
+   status = "okay";
+};
diff --git a/arch/m68k/dts/M5329AFEE.dts b/arch/m68k/dts/M5329AFEE.dts
index de4af4743d..c1cd2845a3 100644
--- a/arch/m68k/dts/M5329AFEE.dts
+++ b/arch/m68k/dts/M5329AFEE.dts
@@ -23,3 +23,9 @@
  {
status = "okay";
 };
+
+ {
+   clock-frequency = <8>;
+   u-boot,i2c-slave-addr = <0x7f>;
+   status = "okay";
+};
diff --git a/arch/m68k/dts/M5329BFEE.dts b/arch/m68k/dts/M5329BFEE.dts
index 2b2aae2cf9..51ec4b5d1a 100644
--- a/arch/m68k/dts/M5329BFEE.dts
+++ b/arch/m68k/dts/M5329BFEE.dts
@@ -23,3 +23,9 @@
  {
status = "okay";
 };
+
+ {
+   clock-frequency = <8>;
+   u-boot,i2c-slave-addr = <0x7f>;
+   status = "okay";
+};
diff --git a/arch/m68k/dts/M5373EVB.dts b/arch/m68k/dts/M5373EVB.dts
index 7df8206d63..27ce800cae 100644
--- a/arch/m68k/dts/M5373EVB.dts
+++ b/arch/m68k/dts/M5373EVB.dts
@@ -23,3 +23,7 @@
  {
status = "okay";
 };
+
+ {
+   status = "okay";
+};
diff --git a/arch/m68k/dts/astro_mcf5373l.dts b/arch/m68k/dts/astro_mcf5373l.dts
index d3caf12db1..baa2f1466d 100644
--- a/arch/m68k/dts/astro_mcf5373l.dts
+++ b/arch/m68k/dts/astro_mcf5373l.dts
@@ -20,3 +20,9 @@
status = "okay";
 };
 
+ {
+   clock-frequency = <8>;
+   u-boot,i2c-slave-addr = <0x7f>;
+   status = "okay";
+};
+
diff --git a/arch/m68k/dts/eb_cpu5282.dts b/arch/m68k/dts/eb_cpu5282.dts
index 925f9af3a8..27f33b9f90 100644
--- a/arch/m68k/dts/eb_cpu5282.dts
+++ b/arch/m68k/dts/eb_cpu5282.dts
@@ -23,3 +23,12 @@
  {
status = "okay";
 };
+
+ {
+   status = "okay";
+
+   rtc@68 {
+   compatible = "dallas,ds1338";
+   reg = <0x68>;
+   };
+};
diff --git a/arch/m68k/dts/eb_cpu5282_internal.dts 
b/arch/m68k/dts/eb_cpu5282_internal.dts
index ae6a8157cf..53a94ea7f7 100644
--- a/arch/m68k/dts/eb_cpu5282_internal.dts
+++ b/arch/m68k/dts/eb_cpu5282_internal.dts
@@ -23,3 +23,12 @@
  {
status = "okay";
 };
+
+ {
+   status = "okay";
+
+   rtc@68 {
+   compatible

[PATCH 3/6] m68k: mcf5441x: fix CONFIG_SYS_FSL_I2C definition

2023-04-04 Thread Angelo Dureghello
Fix CONFIG_SYS_FSL_I2C to correct name CONFIG_SYS_I2C_FSL.

Signed-off-by: Angelo Dureghello 
---
 arch/m68k/cpu/mcf5445x/speed.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/arch/m68k/cpu/mcf5445x/speed.c b/arch/m68k/cpu/mcf5445x/speed.c
index eb73da68c6..5c78eb9834 100644
--- a/arch/m68k/cpu/mcf5445x/speed.c
+++ b/arch/m68k/cpu/mcf5445x/speed.c
@@ -129,9 +129,8 @@ int get_clocks(void)
setup_5441x_clocks();
 #endif
 
-#ifdef CONFIG_SYS_FSL_I2C
-   gd->arch.i2c1_clk = gd->bus_clk;
-#endif
+   if (IS_ENABLED(CONFIG_SYS_I2C_FSL))
+   gd->arch.i2c1_clk = gd->bus_clk;
 
return (0);
 }
-- 
2.40.0



[PATCH 4/6] i2c: fsl_i2c: fix m68k transferts

2023-04-04 Thread Angelo Dureghello
This driver is actually used for powerpc and m68k/ColdFire.

On ColdFire SoC's, interrupt flag get not set if IIEN flag (mbcr bit6,
interrupt enabled) is not set appropriately before each transfert.
As a result, the transfert hangs forever waiting for IIEN.
This patch set IIEN before each transfert, while considering this fix
as not harming powerpc arch.

Signed-off-by: Angelo Dureghello 
---
 arch/m68k/include/asm/fsl_i2c.h | 10 ++
 drivers/i2c/fsl_i2c.c   | 16 +---
 2 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/arch/m68k/include/asm/fsl_i2c.h b/arch/m68k/include/asm/fsl_i2c.h
index 9c54fdea77..dc6b37a575 100644
--- a/arch/m68k/include/asm/fsl_i2c.h
+++ b/arch/m68k/include/asm/fsl_i2c.h
@@ -57,4 +57,14 @@ typedef struct fsl_i2c_base {
 #define I2C_DR_RES ~(I2C_DR)
 } fsl_i2c_t;
 
+#if CONFIG_IS_ENABLED(DM_I2C)
+struct fsl_i2c_dev {
+   struct fsl_i2c_base __iomem *base;  /* register base */
+   u32 i2c_clk;
+   u32 index;
+   u8 slaveadd;
+   uint speed;
+};
+#endif
+
 #endif /* _ASM_I2C_H_ */
diff --git a/drivers/i2c/fsl_i2c.c b/drivers/i2c/fsl_i2c.c
index d312f35f04..d9d8ee81d2 100644
--- a/drivers/i2c/fsl_i2c.c
+++ b/drivers/i2c/fsl_i2c.c
@@ -278,7 +278,8 @@ static void __i2c_init(const struct fsl_i2c_base *base, int 
speed, int
set_i2c_bus_speed(base, i2c_clk, speed);
writeb(slaveadd << 1, >adr);/* write slave address */
writeb(0x0, >sr); /* clear status register */
-   writeb(I2C_CR_MEN, >cr);  /* start I2C controller */
+   /* start I2C controller */
+   writeb(I2C_CR_MEN | I2C_CR_MIEN, >cr);
 
timeval = get_ticks();
while (readb(>sr) & I2C_SR_MBB) {
@@ -346,7 +347,7 @@ static int i2c_wait(const struct fsl_i2c_base *base, int 
write)
 static int i2c_write_addr(const struct fsl_i2c_base *base, u8 dev,
  u8 dir, int rsta)
 {
-   writeb(I2C_CR_MEN | I2C_CR_MSTA | I2C_CR_MTX
+   writeb(I2C_CR_MEN | I2C_CR_MIEN | I2C_CR_MSTA | I2C_CR_MTX
   | (rsta ? I2C_CR_RSTA : 0),
   >cr);
 
@@ -378,7 +379,8 @@ static int __i2c_read_data(const struct fsl_i2c_base *base, 
u8 *data,
 {
int i;
 
-   writeb(I2C_CR_MEN | I2C_CR_MSTA | ((length == 1) ? I2C_CR_TXAK : 0),
+   writeb(I2C_CR_MEN | I2C_CR_MIEN |
+  I2C_CR_MSTA | ((length == 1) ? I2C_CR_TXAK : 0),
   >cr);
 
/* dummy read */
@@ -390,13 +392,13 @@ static int __i2c_read_data(const struct fsl_i2c_base 
*base, u8 *data,
 
/* Generate ack on last next to last byte */
if (i == length - 2)
-   writeb(I2C_CR_MEN | I2C_CR_MSTA | I2C_CR_TXAK,
-  >cr);
+   writeb(I2C_CR_MEN | I2C_CR_MIEN | I2C_CR_MSTA |
+  I2C_CR_TXAK, >cr);
 
/* Do not generate stop on last byte */
if (i == length - 1)
-   writeb(I2C_CR_MEN | I2C_CR_MSTA | I2C_CR_MTX,
-  >cr);
+   writeb(I2C_CR_MEN | I2C_CR_MIEN | I2C_CR_MSTA |
+  I2C_CR_MTX, >cr);
 
data[i] = readb(>dr);
}
-- 
2.40.0



[PATCH 2/6] board: stmark2: add i2c0 pinmux pad configuration

2023-04-04 Thread Angelo Dureghello
Add CFG option to enable proper pinmux pad setting for i2c0.

Signed-off-by: Angelo Dureghello 
---
 include/configs/stmark2.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/configs/stmark2.h b/include/configs/stmark2.h
index ffc47c8076..af5da096b7 100644
--- a/include/configs/stmark2.h
+++ b/include/configs/stmark2.h
@@ -96,4 +96,6 @@
CFG_SYS_INIT_RAM_SIZE - 12)
 
 
+#define CFG_SYS_I2C_0
+
 #endif /* __STMARK2_CONFIG_H */
-- 
2.40.0



[PATCH 1/6] m68k: move CONFIG_SYS_I2C to CFG_ namespace

2023-04-04 Thread Angelo Dureghello
Move CONFIG_SYS_I2C_X to CFG_ namespace.
This is a preliminary step to move to dm i2c.

Signed-off-by: Angelo Dureghello 
---
 arch/m68k/cpu/mcf5445x/cpu_init.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/m68k/cpu/mcf5445x/cpu_init.c 
b/arch/m68k/cpu/mcf5445x/cpu_init.c
index 1ce244872f..bc3a2f3aed 100644
--- a/arch/m68k/cpu/mcf5445x/cpu_init.c
+++ b/arch/m68k/cpu/mcf5445x/cpu_init.c
@@ -159,14 +159,14 @@ void cpu_init_f(void)
/* NAND */
out_8(>pmcr0, 63);
 
-#ifdef CONFIG_SYS_I2C_0
+#ifdef CFG_SYS_I2C_0
out_8(>par_cani2c, 0xF0);
/* I2C0 pull up */
out_be16(>pcr_b, 0x003C);
/* I2C0 max speed */
out_8(>srcr_cani2c, 0x03);
 #endif
-#ifdef CONFIG_SYS_I2C_2
+#ifdef CFG_SYS_I2C_2
/* I2C2 */
out_8(>par_ssi0h, 0xA0);
/* I2C2, UART7 */
@@ -184,7 +184,7 @@ void cpu_init_f(void)
/* I2C2 pull up */
out_be16(>pcr_h, 0xF000);
 #endif
-#ifdef CONFIG_SYS_I2C_5
+#ifdef CFG_SYS_I2C_5
/* I2C5 */
out_8(>par_uart1, 0x0A);
/* I2C5 pull up */
-- 
2.40.0



Re: [PATCH] travis-ci: Add m68k M5208EVBE machine

2023-04-04 Thread Angelo Dureghello

Hi Tom,

On 02/04/23 4:36 PM, Tom Rini wrote:

On Sun, Apr 02, 2023 at 07:37:29AM +0200, Angelo Dureghello wrote:

Hi Marek,

On 26/03/23 4:33 PM, Tom Rini wrote:


On Mon, 20 Mar 2023 20:46:47 +0100, Marek Vasut wrote:

Add m68k M5208EVBE machine configured to test U-Boot m68k support.




Applied, thanks!

[1/1] travis-ci: Add m68k M5208EVBE machine
commit: 3f604a1b68a07e6c20f617c38fc849eb796f9af0

Best regards,


i rebased and tested the build, i see still a python error,

https://source.denx.de/u-boot/custodians/u-boot-coldfire/-/pipelines/15856

I applied

93acc7282341a294c28f50086ca1fb3d4cd66a90
travis-ci: Add m68k M5208EVBE machine

77e22d25af74c3be461b27d35805072ead63c178
CI: Add m68k target

31368868227702ad7176e4729a837e4a2183b739
arch: m68k: Add QEMU specific RAMBAR workaround

f087d8873614e5bfa1093d5e3a1b6d4cf85623d1
arch: m68k: Introduce trivial PIT based timer

d7ef34a0e1c500d4db2331fefaea688b1946a351
arch: m68k: Use existing CONFIG_MCFTMR instead of CFG_MCFTMR


You should rebase this all on -next at this point, where the container
has qemu-system-m68k, which is why it's failing there.



Ok. So i keep applied this patch serie to u-boot-coldfire master.

Regards,
angelo



Re: [PATCH] travis-ci: Add m68k M5208EVBE machine

2023-04-01 Thread Angelo Dureghello

Hi Marek,

On 26/03/23 4:33 PM, Tom Rini wrote:


On Mon, 20 Mar 2023 20:46:47 +0100, Marek Vasut wrote:

Add m68k M5208EVBE machine configured to test U-Boot m68k support.




Applied, thanks!

[1/1] travis-ci: Add m68k M5208EVBE machine
   commit: 3f604a1b68a07e6c20f617c38fc849eb796f9af0

Best regards,


i rebased and tested the build, i see still a python error,

https://source.denx.de/u-boot/custodians/u-boot-coldfire/-/pipelines/15856

I applied

93acc7282341a294c28f50086ca1fb3d4cd66a90
travis-ci: Add m68k M5208EVBE machine

77e22d25af74c3be461b27d35805072ead63c178
CI: Add m68k target

31368868227702ad7176e4729a837e4a2183b739
arch: m68k: Add QEMU specific RAMBAR workaround

f087d8873614e5bfa1093d5e3a1b6d4cf85623d1
arch: m68k: Introduce trivial PIT based timer

d7ef34a0e1c500d4db2331fefaea688b1946a351
arch: m68k: Use existing CONFIG_MCFTMR instead of CFG_MCFTMR


Regards,
angelo


Re: [PATCH v2 1/3] arch: m68k: Use existing CONFIG_MCFTMR instead of CFG_MCFTMR

2023-03-25 Thread Angelo Dureghello

Hi Marek,

applied all these patches in u-boot-coldfire:

fb67f91b5e9b5e9aae5ab038895ebabc10af4d9d
travis-ci: Add m68k M5208EVBE machine
04adf3b61690ba818f42e746ae79243cbe64aa55
CI: Add m68k target
9c5775623542b9a837e634e68e00746bcf35f53c
arch: m68k: Add QEMU specific RAMBAR workaround
b4a4248515630984cada05cdc2cbf243e511fa0a
arch: m68k: Introduce trivial PIT based timer
3c39f2cdaa2427a17f0d68fea522824ee53f5315
arch: m68k: Use existing CONFIG_MCFTMR instead of CFG_MCFTMR

Still getting one pipeline error:

https://source.denx.de/u-boot/custodians/u-boot-coldfire/-/pipelines/15744/failures


am i missing something ?

Regards,
angelo


On 23/03/23 1:20 AM, Marek Vasut wrote:

There is an existing CONFIG_MCFTMR Kconfig symbol,
use it and drop all other instances of CFG_MCFTMR.
This duality is likely a result of bogus conversion
to Kconfig.

Fixes: 7ff7b46e6ce ("m68k: rename CONFIG_MCFTMR to CFG_MCFTMR")
Signed-off-by: Marek Vasut 
---
Cc: Angelo Dureghello 
Cc: Huan Wang 
Cc: Marek Vasut 
Cc: Simon Glass 
Cc: Stefan Roese 
Cc: Tom Rini 
---
V2: Add Fixes tag
---
  arch/m68k/Kconfig   |  1 +
  arch/m68k/cpu/mcf523x/interrupts.c  |  2 +-
  arch/m68k/cpu/mcf52x2/interrupts.c  | 12 ++--
  arch/m68k/cpu/mcf532x/interrupts.c  |  2 +-
  arch/m68k/cpu/mcf5445x/interrupts.c |  2 +-
  arch/m68k/include/asm/immap.h   | 24 
  arch/m68k/lib/time.c|  4 ++--
  board/freescale/m53017evb/README|  2 +-
  board/freescale/m5373evb/README |  2 +-
  include/configs/M5208EVBE.h |  1 -
  include/configs/M5235EVB.h  |  1 -
  include/configs/M5249EVB.h  |  1 -
  include/configs/M5253DEMO.h |  1 -
  include/configs/M5272C3.h   |  1 -
  include/configs/M5275EVB.h  |  1 -
  include/configs/M5282EVB.h  |  1 -
  include/configs/M53017EVB.h |  1 -
  include/configs/M5329EVB.h  |  1 -
  include/configs/M5373EVB.h  |  1 -
  include/configs/amcore.h|  1 -
  include/configs/astro_mcf5373l.h|  1 -
  include/configs/cobra5272.h |  1 -
  include/configs/eb_cpu5282.h|  1 -
  include/configs/stmark2.h   |  1 -
  24 files changed, 26 insertions(+), 40 deletions(-)

diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index 76233ef563f..32759cde47d 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -200,5 +200,6 @@ source "board/sysam/stmark2/Kconfig"
  
  config MCFTMR

bool "Use DMA timer"
+   default y
  
  endmenu

diff --git a/arch/m68k/cpu/mcf523x/interrupts.c 
b/arch/m68k/cpu/mcf523x/interrupts.c
index b02ea29f635..09c7f9e67cc 100644
--- a/arch/m68k/cpu/mcf523x/interrupts.c
+++ b/arch/m68k/cpu/mcf523x/interrupts.c
@@ -22,7 +22,7 @@ int interrupt_init(void)
return 0;
  }
  
-#if defined(CFG_MCFTMR)

+#if CONFIG_IS_ENABLED(MCFTMR)
  void dtimer_intr_setup(void)
  {
int0_t *intp = (int0_t *) (CFG_SYS_INTR_BASE);
diff --git a/arch/m68k/cpu/mcf52x2/interrupts.c 
b/arch/m68k/cpu/mcf52x2/interrupts.c
index e787c7605f8..c5ed0600736 100644
--- a/arch/m68k/cpu/mcf52x2/interrupts.c
+++ b/arch/m68k/cpu/mcf52x2/interrupts.c
@@ -34,7 +34,7 @@ int interrupt_init(void)
return 0;
  }
  
-#if defined(CFG_MCFTMR)

+#if CONFIG_IS_ENABLED(MCFTMR)
  void dtimer_intr_setup(void)
  {
intctrl_t *intp = (intctrl_t *) (CFG_SYS_INTR_BASE);
@@ -42,7 +42,7 @@ void dtimer_intr_setup(void)
clrbits_be32(>int_icr1, INT_ICR1_TMR3MASK);
setbits_be32(>int_icr1, CFG_SYS_TMRINTR_PRI);
  }
-#endif /* CFG_MCFTMR */
+#endif /* CONFIG_MCFTMR */
  #endif/* CONFIG_M5272 */
  
  #if defined(CONFIG_M5208) || defined(CONFIG_M5282) || \

@@ -63,7 +63,7 @@ int interrupt_init(void)
return 0;
  }
  
-#if defined(CFG_MCFTMR)

+#if CONFIG_IS_ENABLED(MCFTMR)
  void dtimer_intr_setup(void)
  {
int0_t *intp = (int0_t *) (CFG_SYS_INTR_BASE);
@@ -72,7 +72,7 @@ void dtimer_intr_setup(void)
clrbits_be32(>imrl0, 0x0001);
clrbits_be32(>imrl0, CFG_SYS_TMRINTR_MASK);
  }
-#endif /* CFG_MCFTMR */
+#endif /* CONFIG_MCFTMR */
  #endif/* CONFIG_M5282 | CONFIG_M5271 | 
CONFIG_M5275 */
  
  #if defined(CONFIG_M5249) || defined(CONFIG_M5253)

@@ -83,11 +83,11 @@ int interrupt_init(void)
return 0;
  }
  
-#if defined(CFG_MCFTMR)

+#if CONFIG_IS_ENABLED(MCFTMR)
  void dtimer_intr_setup(void)
  {
mbar_writeLong(MCFSIM_IMR, mbar_readLong(MCFSIM_IMR) & ~0x0400);
mbar_writeByte(MCFSIM_TIMER2ICR, CFG_SYS_TMRINTR_PRI);
  }
-#endif /* CFG_MCFTMR */
+#endif /* CONFIG_MCFTMR */
  #endif/* CONFIG_M5249 || CONFIG_M5253 */
diff --git a/arch/m68k/cpu/mcf532x/interrupts.c 
b/arch/m68k/cpu/mcf532x/interrupts.c
index bbe823c0cf7..

Re: [PATCH v2] CI: Add m68k target

2023-03-23 Thread Angelo Dureghello

Acked-by: Angelo Dureghello 

On 23/03/23 1:22 AM, Marek Vasut wrote:

Add M5208EVBE board to CI. This does not use default config due to
limitations of QEMU emulation, instead the timer is switched from
DMA timer to PIT timer and RAMBAR accesses are inhibited.

Local QEMU launch command is as follows:
$ qemu-system-m68k -nographic -machine mcf5208evb -cpu m5208 -bios u-boot.bin

Signed-off-by: Marek Vasut 
---
Cc: Angelo Dureghello 
Cc: Huan Wang 
Cc: Marek Vasut 
Cc: Simon Glass 
Cc: Stefan Roese 
Cc: Tom Rini 
---
V2: Disable CONFIG_MCFTMR using -a ~CONFIG_MCFTMR
---
  .azure-pipelines.yml | 5 +
  .gitlab-ci.yml   | 8 
  2 files changed, 13 insertions(+)

diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml
index 5594a67d6b5..6452127ff42 100644
--- a/.azure-pipelines.yml
+++ b/.azure-pipelines.yml
@@ -297,6 +297,11 @@ stages:
  qemu_arm64:
TEST_PY_BD: "qemu_arm64"
TEST_PY_TEST_SPEC: "not sleep"
+qemu_m68k:
+  TEST_PY_BD: "M5208EVBE"
+  TEST_PY_ID: "--id qemu"
+  TEST_PY_TEST_SPEC: "not sleep and not efi"
+  OVERRIDE: "-a CONFIG_M68K_QEMU=y -a ~CONFIG_MCFTMR"
  qemu_malta:
TEST_PY_BD: "malta"
TEST_PY_ID: "--id qemu"
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 5431bf6011a..a06c2aa4be9 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -355,6 +355,14 @@ qemu_arm64 test.py:
  TEST_PY_TEST_SPEC: "not sleep"
<<: *buildman_and_testpy_dfn
  
+qemu_m68k test.py:

+  variables:
+TEST_PY_BD: "M5208EVBE"
+TEST_PY_ID: "--id qemu"
+TEST_PY_TEST_SPEC: "not sleep and not efi"
+OVERRIDE: "-a CONFIG_M68K_QEMU=y -a ~CONFIG_MCFTMR"
+  <<: *buildman_and_testpy_dfn
+
  qemu_malta test.py:
variables:
  TEST_PY_BD: "malta"


--
Angelo Dureghello
+++ kernelspace +++
+E: angelo AT kernel-space.org
+W: www.kernel-space.org


Re: [PATCH 4/4] CI: Add m68k target

2023-03-19 Thread Angelo Dureghello

Hi Marek,

On 19/03/23 4:14 AM, Marek Vasut wrote:

Add M5208EVBE board to CI. This does not use default config due to
limitations of QEMU emulation, instead the timer is switched from
DMA timer to PIT timer and RAMBAR accesses are inhibited.

Local QEMU launch command is as follows:
$ qemu-system-m68k -nographic -machine mcf5208evb -cpu m5208 -bios u-boot.bin

Signed-off-by: Marek Vasut 
---
Cc: Angelo Dureghello 
Cc: Huan Wang 
Cc: Marek Vasut 
Cc: Simon Glass 
Cc: Stefan Roese 
Cc: Tom Rini 
---
  .azure-pipelines.yml | 5 +
  .gitlab-ci.yml   | 8 
  2 files changed, 13 insertions(+)

diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml
index 947c400f8d3..e4e0c4c4d0d 100644
--- a/.azure-pipelines.yml
+++ b/.azure-pipelines.yml
@@ -268,6 +268,11 @@ stages:
  qemu_arm64:
TEST_PY_BD: "qemu_arm64"
TEST_PY_TEST_SPEC: "not sleep"
+qemu_m68k:
+  TEST_PY_BD: "M5208EVBE"
+  TEST_PY_ID: "--id qemu"
+  TEST_PY_TEST_SPEC: "not sleep and not efi"
+  OVERRIDE: "-a CONFIG_M68K_QEMU=y -a CONFIG_MCFTMR=n"
  qemu_malta:
TEST_PY_BD: "malta"
TEST_PY_ID: "--id qemu"
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 272d69e2206..4c144ab938a 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -322,6 +322,14 @@ qemu_arm64 test.py:
  TEST_PY_TEST_SPEC: "not sleep"
<<: *buildman_and_testpy_dfn
  
+qemu_m68k test.py:

+  variables:
+TEST_PY_BD: "M5208EVBE"
+TEST_PY_TEST_SPEC: "not sleep and not efi"
+TEST_PY_ID: "--id qemu"
+OVERRIDE: "-a CONFIG_M68K_QEMU=y -a CONFIG_MCFTMR=n"
+  <<: *buildman_and_testpy_dfn
+
  qemu_malta test.py:
variables:
  TEST_PY_BD: "malta"


i tested the patchset in u-boot-coldfire, i see also a pipeline error:

https://source.denx.de/u-boot/custodians/u-boot-coldfire/-/pipelines/15651/failures

regards,
angelo



Re: [PATCH 2/4] arch: m68k: Introduce trivial PIT based timer

2023-03-19 Thread Angelo Dureghello

Hi Marek,

On 19/03/23 4:14 AM, Marek Vasut wrote:

The QEMU emulation of m68k does not support DMA timer, the only
timer that is supported is the PIT timer. Implement trivial PIT
timer support for m68k.

Signed-off-by: Marek Vasut 
---
Cc: Angelo Dureghello 
Cc: Huan Wang 
Cc: Marek Vasut 
Cc: Simon Glass 
Cc: Stefan Roese 
Cc: Tom Rini 
---
  arch/m68k/include/asm/immap.h | 24 +++
  arch/m68k/lib/time.c  | 36 +--
  common/board_f.c  |  2 +-
  3 files changed, 59 insertions(+), 3 deletions(-)

diff --git a/arch/m68k/include/asm/immap.h b/arch/m68k/include/asm/immap.h
index 3b515fe2c65..aafa4f40cb3 100644
--- a/arch/m68k/include/asm/immap.h
+++ b/arch/m68k/include/asm/immap.h
@@ -25,6 +25,8 @@
  #define CFG_SYS_TMRINTR_PEND  (CFG_SYS_TMRINTR_MASK)
  #define CFG_SYS_TMRINTR_PRI   (6)
  #define CFG_SYS_TIMER_PRESCALER   (((gd->bus_clk / 100) - 1) << 8)
+#else
+#define CFG_SYS_UDELAY_BASE(MMAP_PIT0)
  #endif
  
  #define CFG_SYS_INTR_BASE		(MMAP_INTC0)

@@ -47,6 +49,8 @@
  #define CFG_SYS_TMRINTR_PEND  (CFG_SYS_TMRINTR_MASK)
  #define CFG_SYS_TMRINTR_PRI   (0x1E)  /* Level must include 
inorder to work */
  #define CFG_SYS_TIMER_PRESCALER   (((gd->bus_clk / 100) - 1) << 8)
+#else
+#define CFG_SYS_UDELAY_BASE(MMAP_PIT0)
  #endif
  
  #define CFG_SYS_INTR_BASE		(MMAP_INTC0)

@@ -72,6 +76,8 @@
  #define CFG_SYS_TMRINTR_PEND  (CFG_SYS_TMRINTR_MASK)
  #define CFG_SYS_TMRINTR_PRI   (MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL7 
| MCFSIM_ICR_PRI3)
  #define CFG_SYS_TIMER_PRESCALER   (((gd->bus_clk / 200) - 1) << 8)
+#else
+#define CFG_SYS_UDELAY_BASE(MMAP_PIT0)
  #endif
  #endif/* CONFIG_M5249 */
  
@@ -95,6 +101,8 @@

  #define CFG_SYS_TMRINTR_PEND  (CFG_SYS_TMRINTR_MASK)
  #define CFG_SYS_TMRINTR_PRI   (MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL3 
| MCFSIM_ICR_PRI3)
  #define CFG_SYS_TIMER_PRESCALER   (((gd->bus_clk / 200) - 1) << 8)
+#else
+#define CFG_SYS_UDELAY_BASE(MMAP_PIT0)
  #endif
  #endif/* CONFIG_M5253 */
  
@@ -114,6 +122,8 @@

  #define CFG_SYS_TMRINTR_PEND  (CFG_SYS_TMRINTR_MASK)
  #define CFG_SYS_TMRINTR_PRI   (0x1E) /* Interrupt level 3, priority 6 
*/
  #define CFG_SYS_TIMER_PRESCALER   (((gd->bus_clk / 100) - 1) << 8)
+#else
+#define CFG_SYS_UDELAY_BASE(MMAP_PIT0)
  #endif
  
  #define CFG_SYS_INTR_BASE		(MMAP_INTC0)

@@ -139,6 +149,8 @@
  #define CFG_SYS_TMRINTR_PEND  (0)
  #define CFG_SYS_TMRINTR_PRI   (INT_ICR1_TMR3PI | INT_ICR1_TMR3IPL(5))
  #define CFG_SYS_TIMER_PRESCALER   (((gd->bus_clk / 100) - 1) << 8)
+#else
+#define CFG_SYS_UDELAY_BASE(MMAP_PIT0)
  #endif
  #endif/* CONFIG_M5272 */
  
@@ -161,6 +173,8 @@

  #define CFG_SYS_TMRINTR_PEND  (CFG_SYS_TMRINTR_MASK)
  #define CFG_SYS_TMRINTR_PRI   (0x1E)
  #define CFG_SYS_TIMER_PRESCALER   (((gd->bus_clk / 100) - 1) << 8)
+#else
+#define CFG_SYS_UDELAY_BASE(MMAP_PIT0)
  #endif
  #endif/* CONFIG_M5275 */
  
@@ -183,6 +197,8 @@

  #define CFG_SYS_TMRINTR_PEND  (CFG_SYS_TMRINTR_MASK)
  #define CFG_SYS_TMRINTR_PRI   (0x1E)  /* Level must include 
inorder to work */
  #define CFG_SYS_TIMER_PRESCALER   (((gd->bus_clk / 100) - 1) << 8)
+#else
+#define CFG_SYS_UDELAY_BASE(MMAP_PIT0)
  #endif
  #endif/* CONFIG_M5282 */
  
@@ -207,6 +223,8 @@

  #define CFG_SYS_TMRINTR_PRI  (MCFSIM_ICR_AUTOVEC | \
MCFSIM_ICR_LEVEL7 | MCFSIM_ICR_PRI3)
  #define CFG_SYS_TIMER_PRESCALER  (((gd->bus_clk / 100) - 1) << 8)
+#else
+#define CFG_SYS_UDELAY_BASE(MMAP_PIT0)
  #endif
  #endif  /* CONFIG_M5307 */
  
@@ -226,6 +244,8 @@

  #define CFG_SYS_TMRINTR_PEND  (CFG_SYS_TMRINTR_MASK)
  #define CFG_SYS_TMRINTR_PRI   (6)
  #define CFG_SYS_TIMER_PRESCALER   (((gd->bus_clk / 100) - 1) << 8)
+#else
+#define CFG_SYS_UDELAY_BASE(MMAP_PIT0)
  #endif
  
  #define CFG_SYS_INTR_BASE		(MMAP_INTC0)

@@ -248,6 +268,8 @@
  #define CFG_SYS_TMRINTR_PEND  (CFG_SYS_TMRINTR_MASK)
  #define CFG_SYS_TMRINTR_PRI   (6)
  #define CFG_SYS_TIMER_PRESCALER   (((gd->bus_clk / 100) - 1) << 8)
+#else
+#define CFG_SYS_UDELAY_BASE(MMAP_PIT0)
  #endif
  
  #define CFG_SYS_INTR_BASE		(MMAP_INTC0)

@@ -278,6 +300,8 @@
  #define CFG_SYS_TMRINTR_PEND  (CFG_SYS_TMRINTR_MASK)
  #define CFG_SYS_TMRINTR_PRI   (6)
  #define CFG_SYS_TIMER_PRESCALER   (((gd->bus_clk / 100) - 1) << 8)
+#else
+#define CFG_SYS_UDELAY_BASE(MMAP_PIT0)
  #endif
  
  #define CFG_SYS_INTR

Re: [PATCH 1/4] arch: m68k: Use existing CONFIG_MCFTMR instead of CFG_MCFTMR

2023-03-19 Thread Angelo Dureghello

Hi Marek,

On 19/03/23 4:14 AM, Marek Vasut wrote:

There is an existing CONFIG_MCFTMR Kconfig symbol,
use it and drop all other instances of CFG_MCFTMR.
This duality is likely a result of bogus conversion
to Kconfig.



Thanks, my fault here, introduced in commit
7ff7b46e6ce44b2ee09647a928ce1021c3c8a66e

i mainly misunderstood the CI error, moving this to
CFG namespace. Thanks for fixing it.


Signed-off-by: Marek Vasut 
---
Cc: Angelo Dureghello 
Cc: Huan Wang 
Cc: Marek Vasut 
Cc: Simon Glass 
Cc: Stefan Roese 
Cc: Tom Rini 
---
  arch/m68k/Kconfig   |  1 +
  arch/m68k/cpu/mcf523x/interrupts.c  |  2 +-
  arch/m68k/cpu/mcf52x2/interrupts.c  | 12 ++--
  arch/m68k/cpu/mcf532x/interrupts.c  |  2 +-
  arch/m68k/cpu/mcf5445x/interrupts.c |  2 +-
  arch/m68k/include/asm/immap.h   | 24 
  arch/m68k/lib/time.c|  4 ++--
  board/freescale/m53017evb/README|  2 +-
  board/freescale/m5373evb/README |  2 +-
  include/configs/M5208EVBE.h |  1 -
  include/configs/M5235EVB.h  |  1 -
  include/configs/M5249EVB.h  |  1 -
  include/configs/M5253DEMO.h |  1 -
  include/configs/M5272C3.h   |  1 -
  include/configs/M5275EVB.h  |  1 -
  include/configs/M5282EVB.h  |  1 -
  include/configs/M53017EVB.h |  1 -
  include/configs/M5329EVB.h  |  1 -
  include/configs/M5373EVB.h  |  1 -
  include/configs/amcore.h|  1 -
  include/configs/astro_mcf5373l.h|  1 -
  include/configs/cobra5272.h |  1 -
  include/configs/eb_cpu5282.h|  1 -
  include/configs/stmark2.h   |  1 -
  24 files changed, 26 insertions(+), 40 deletions(-)

diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index 76233ef563f..32759cde47d 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -200,5 +200,6 @@ source "board/sysam/stmark2/Kconfig"
  
  config MCFTMR

bool "Use DMA timer"
+   default y
  
  endmenu

diff --git a/arch/m68k/cpu/mcf523x/interrupts.c 
b/arch/m68k/cpu/mcf523x/interrupts.c
index b02ea29f635..09c7f9e67cc 100644
--- a/arch/m68k/cpu/mcf523x/interrupts.c
+++ b/arch/m68k/cpu/mcf523x/interrupts.c
@@ -22,7 +22,7 @@ int interrupt_init(void)
return 0;
  }
  
-#if defined(CFG_MCFTMR)

+#if CONFIG_IS_ENABLED(MCFTMR)
  void dtimer_intr_setup(void)
  {
int0_t *intp = (int0_t *) (CFG_SYS_INTR_BASE);
diff --git a/arch/m68k/cpu/mcf52x2/interrupts.c 
b/arch/m68k/cpu/mcf52x2/interrupts.c
index e787c7605f8..c5ed0600736 100644
--- a/arch/m68k/cpu/mcf52x2/interrupts.c
+++ b/arch/m68k/cpu/mcf52x2/interrupts.c
@@ -34,7 +34,7 @@ int interrupt_init(void)
return 0;
  }
  
-#if defined(CFG_MCFTMR)

+#if CONFIG_IS_ENABLED(MCFTMR)
  void dtimer_intr_setup(void)
  {
intctrl_t *intp = (intctrl_t *) (CFG_SYS_INTR_BASE);
@@ -42,7 +42,7 @@ void dtimer_intr_setup(void)
clrbits_be32(>int_icr1, INT_ICR1_TMR3MASK);
setbits_be32(>int_icr1, CFG_SYS_TMRINTR_PRI);
  }
-#endif /* CFG_MCFTMR */
+#endif /* CONFIG_MCFTMR */
  #endif/* CONFIG_M5272 */
  
  #if defined(CONFIG_M5208) || defined(CONFIG_M5282) || \

@@ -63,7 +63,7 @@ int interrupt_init(void)
return 0;
  }
  
-#if defined(CFG_MCFTMR)

+#if CONFIG_IS_ENABLED(MCFTMR)
  void dtimer_intr_setup(void)
  {
int0_t *intp = (int0_t *) (CFG_SYS_INTR_BASE);
@@ -72,7 +72,7 @@ void dtimer_intr_setup(void)
clrbits_be32(>imrl0, 0x0001);
clrbits_be32(>imrl0, CFG_SYS_TMRINTR_MASK);
  }
-#endif /* CFG_MCFTMR */
+#endif /* CONFIG_MCFTMR */
  #endif/* CONFIG_M5282 | CONFIG_M5271 | 
CONFIG_M5275 */
  
  #if defined(CONFIG_M5249) || defined(CONFIG_M5253)

@@ -83,11 +83,11 @@ int interrupt_init(void)
return 0;
  }
  
-#if defined(CFG_MCFTMR)

+#if CONFIG_IS_ENABLED(MCFTMR)
  void dtimer_intr_setup(void)
  {
mbar_writeLong(MCFSIM_IMR, mbar_readLong(MCFSIM_IMR) & ~0x0400);
mbar_writeByte(MCFSIM_TIMER2ICR, CFG_SYS_TMRINTR_PRI);
  }
-#endif /* CFG_MCFTMR */
+#endif /* CONFIG_MCFTMR */
  #endif/* CONFIG_M5249 || CONFIG_M5253 */
diff --git a/arch/m68k/cpu/mcf532x/interrupts.c 
b/arch/m68k/cpu/mcf532x/interrupts.c
index bbe823c0cf7..4f72fa88e58 100644
--- a/arch/m68k/cpu/mcf532x/interrupts.c
+++ b/arch/m68k/cpu/mcf532x/interrupts.c
@@ -23,7 +23,7 @@ int interrupt_init(void)
return 0;
  }
  
-#if defined(CFG_MCFTMR)

+#if CONFIG_IS_ENABLED(MCFTMR)
  void dtimer_intr_setup(void)
  {
int0_t *intp = (int0_t *) (CFG_SYS_INTR_BASE);
diff --git a/arch/m68k/cpu/mcf5445x/interrupts.c 
b/arch/m68k/cpu/mcf5445x/interrupts.c
index fb80a879c7e..400f3dee879 100644
--- a/arch/m68k/cpu/mcf5445x/interrupts.c
+++ b/arch/m68k/cpu/mcf5445x/interrupts.c
@@ -26,7 +26,7 @@ int i

[PULL] Please pull u-boot-coldfire/master

2023-03-14 Thread Angelo Dureghello

The following changes since commit 88e08fc5f6e508eac46cd1dfb0379b11ae032c0a:

  Prepare v2023.04-rc4 (2023-03-13 20:52:48 -0400)

are available in the Git repository at:

  git://git.denx.de/u-boot-coldfire.git master

for you to fetch changes up to 791840fdc41d7e937158a6ac56e9316391fde7ab:

  board: m5253demo: remove floating point flash size calculation 
(2023-03-15 01:52:15 +0100)



Angelo Dureghello (10):
  board: amcore: fix u-boot mtd partition
  m68k: use longword-based jumps
  m68k: add global variable sdhc_per_clk for m68k
  board: stmark2: fix clock value
  arch: enable private libgcc for m68k
  m68k: dts: stmark2: set correct compatible field for spi nor
  m68k: rename CONFIG_MCFTMR to CFG_MCFTMR
  board: amcore: fix config options namespace
  m68k: add private libgcc ashrdi3
  board: m5253demo: remove floating point flash size calculation

 arch/Kconfig  |  1 +
 arch/m68k/cpu/mcf523x/interrupts.c|  2 +-
 arch/m68k/cpu/mcf52x2/interrupts.c| 12 ++--
 arch/m68k/cpu/mcf530x/start.S | 18 --
 arch/m68k/cpu/mcf532x/interrupts.c|  2 +-
 arch/m68k/cpu/mcf5445x/interrupts.c   |  2 +-
 arch/m68k/dts/stmark2.dts |  2 +-
 arch/m68k/include/asm/global_data.h   |  3 +++
 arch/m68k/include/asm/immap.h | 24 
 arch/m68k/lib/Makefile|  2 +-
 arch/m68k/lib/ashrdi3.c   | 48 


 arch/m68k/lib/time.c  |  4 ++--
 board/freescale/m5253demo/flash.c | 20 ++--
 board/freescale/m53017evb/README  |  2 +-
 board/freescale/m5373evb/README   |  2 +-
 board/sysam/stmark2/Kconfig   |  2 +-
 configs/M5208EVBE_defconfig   |  1 -
 configs/M5235EVB_Flash32_defconfig|  1 -
 configs/M5235EVB_defconfig|  1 -
 configs/M5249EVB_defconfig|  1 -
 configs/M5253DEMO_defconfig   |  1 -
 configs/M5272C3_defconfig |  1 -
 configs/M5275EVB_defconfig|  1 -
 configs/M5282EVB_defconfig|  1 -
 configs/M53017EVB_defconfig   |  1 -
 configs/M5329AFEE_defconfig   |  1 -
 configs/M5329BFEE_defconfig   |  1 -
 configs/M5373EVB_defconfig|  1 -
 configs/amcore_defconfig  |  4 ++--
 configs/astro_mcf5373l_defconfig  |  1 -
 configs/cobra5272_defconfig   |  1 -
 configs/eb_cpu5282_defconfig  |  1 -
 configs/eb_cpu5282_internal_defconfig |  1 -
 configs/stmark2_defconfig |  1 -
 include/configs/M5208EVBE.h   |  2 ++
 include/configs/M5235EVB.h|  2 ++
 include/configs/M5249EVB.h|  2 ++
 include/configs/M5253DEMO.h   |  2 ++
 include/configs/M5272C3.h |  3 +++
 include/configs/M5275EVB.h|  2 ++
 include/configs/M5282EVB.h|  2 ++
 include/configs/M53017EVB.h   |  2 ++
 include/configs/M5329EVB.h|  2 ++
 include/configs/M5373EVB.h|  2 ++
 include/configs/amcore.h  | 15 +--
 include/configs/astro_mcf5373l.h  |  2 ++
 include/configs/cobra5272.h   |  2 ++
 include/configs/eb_cpu5282.h  |  2 ++
 include/configs/stmark2.h |  2 ++
 49 files changed, 134 insertions(+), 77 deletions(-)
 create mode 100644 arch/m68k/lib/ashrdi3.c




[PATCH] board: m5253demo: remove floating point flash size calculation

2023-03-14 Thread Angelo Dureghello
From: Angelo Dureghello 

This board is using floating point arithmetic to display
the SST39VF6401B flash size.

This actually generates errors with toolchains without
appropriate sw fp math functions available.

SST39VF6401B is the only flash for wich the size is displayed,
it's size is 8192KB and floating point calculation seems not
needed. Removing it.

Signed-off-by: Angelo Dureghello 
---
 board/freescale/m5253demo/flash.c | 20 ++--
 1 file changed, 2 insertions(+), 18 deletions(-)

diff --git a/board/freescale/m5253demo/flash.c 
b/board/freescale/m5253demo/flash.c
index fbd4835416..eeb9cfd312 100644
--- a/board/freescale/m5253demo/flash.c
+++ b/board/freescale/m5253demo/flash.c
@@ -96,24 +96,8 @@ void flash_print_info(flash_info_t * info)
return;
}
 
-   if (info->size > 0x10) {
-   int remainder;
-
-   printf("  Size: %ld", info->size >> 20);
-
-   remainder = (info->size % 0x10);
-   if (remainder) {
-   remainder >>= 10;
-   remainder = (int)((float)
- (((float)remainder / (float)1024) *
-  1));
-   printf(".%d ", remainder);
-   }
-
-   printf("MB in %d Sectors\n", info->sector_count);
-   } else
-   printf("  Size: %ld KB in %d Sectors\n",
-  info->size >> 10, info->sector_count);
+   printf("  Size: %ld KB in %d Sectors\n",
+  info->size >> 10, info->sector_count);
 
printf("  Sector Start Addresses:");
for (i = 0; i < info->sector_count; ++i) {
-- 
2.39.1



[PATCH] m68k: add private libgcc ashrdi3

2023-03-14 Thread Angelo Dureghello
From: Angelo Dureghello 

Add ashrdi3.c to private libgcc.

Signed-off-by: Angelo Dureghello 
---
 arch/m68k/lib/Makefile  |  2 +-
 arch/m68k/lib/ashrdi3.c | 48 +
 2 files changed, 49 insertions(+), 1 deletion(-)
 create mode 100644 arch/m68k/lib/ashrdi3.c

diff --git a/arch/m68k/lib/Makefile b/arch/m68k/lib/Makefile
index b66d66afd2..6e1fd938f5 100644
--- a/arch/m68k/lib/Makefile
+++ b/arch/m68k/lib/Makefile
@@ -5,7 +5,7 @@
 
 ## Build a couple of necessary functions into a private libgcc
 ## if the user asked for it
-lib-$(CONFIG_USE_PRIVATE_LIBGCC) += lshrdi3.o muldi3.o ashldi3.o
+lib-$(CONFIG_USE_PRIVATE_LIBGCC) += lshrdi3.o muldi3.o ashldi3.o ashrdi3.o
 
 obj-y  += bdinfo.o
 obj-$(CONFIG_CMD_BOOTM) += bootm.o
diff --git a/arch/m68k/lib/ashrdi3.c b/arch/m68k/lib/ashrdi3.c
new file mode 100644
index 00..e144378b7f
--- /dev/null
+++ b/arch/m68k/lib/ashrdi3.c
@@ -0,0 +1,48 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * ashrdi3.c extracted from gcc-2.7.2/libgcc2.c which is:
+ * Copyright (C) 1989, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
+ */
+
+#define BITS_PER_UNIT 8
+
+typedef int SItype __attribute__((mode(SI)));
+typedef unsigned int USItype   __attribute__((mode(SI)));
+typedef int DItype __attribute__((mode(DI)));
+typedef int word_type   __attribute__((mode(__word__)));
+
+struct DIstruct {
+   SItype high, low;
+};
+
+typedef union {
+   struct DIstruct s;
+   DItype ll;
+} di_union;
+
+DItype __ashrdi3(DItype u, word_type b)
+{
+   di_union w;
+   word_type bm;
+   di_union uu;
+
+   if (b == 0)
+   return u;
+
+   uu.ll = u;
+
+   bm = (sizeof(SItype) * BITS_PER_UNIT) - b;
+   if (bm <= 0) {
+   /* w.s.high = 1..1 or 0..0 */
+   w.s.high = uu.s.high >> (sizeof(SItype) * BITS_PER_UNIT - 1);
+   w.s.low = uu.s.high >> -bm;
+   } else {
+   USItype carries = (USItype)uu.s.high << bm;
+
+   w.s.high = uu.s.high >> b;
+   w.s.low = ((USItype)uu.s.low >> b) | carries;
+   }
+
+   return w.ll;
+}
+
-- 
2.39.1



[PATCH] board: amcore: fix config options namespace

2023-03-14 Thread Angelo Dureghello
From: Angelo Dureghello 

Remove CONFIG_ namespace options from .h, moving them to
defconfig, while changing non-defconfig options to CFG_ namespace.

Signed-off-by: Angelo Durgehello 
---
 configs/amcore_defconfig |  3 ++-
 include/configs/amcore.h | 13 +++--
 2 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/configs/amcore_defconfig b/configs/amcore_defconfig
index 0b1a4e8745..e618ca0117 100644
--- a/configs/amcore_defconfig
+++ b/configs/amcore_defconfig
@@ -9,7 +9,7 @@ CONFIG_SYS_PROMPT="amcore $ "
 CONFIG_SYS_LOAD_ADDR=0x2
 CONFIG_ENV_ADDR=0xFFC1F000
 CONFIG_TARGET_AMCORE=y
-CONFIG_SYS_MONITOR_LEN=126976
+CONFIG_SYS_MONITOR_LEN=192512
 CONFIG_SYS_MONITOR_BASE=0xFFC00400
 CONFIG_BOOTDELAY=1
 CONFIG_USE_BOOTCOMMAND=y
@@ -17,6 +17,7 @@ CONFIG_BOOTCOMMAND="bootm ffc2"
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_SYS_MALLOC_BOOTPARAMS=y
+CONFIG_SYS_BOOTPARAMS_LEN=65536
 # CONFIG_CMDLINE_EDITING is not set
 # CONFIG_SYS_LONGHELP is not set
 CONFIG_SYS_PBSIZE=282
diff --git a/include/configs/amcore.h b/include/configs/amcore.h
index 35f09b47e8..ca8d17bfd2 100644
--- a/include/configs/amcore.h
+++ b/include/configs/amcore.h
@@ -11,12 +11,10 @@
 #define CFG_SYS_UART_PORT  0
 
 #define CFG_MCFTMR
-#define CONFIG_MCFUART
-#define CONFIG_SYS_UART_PORT   0
-#define CONFIG_SYS_BAUDRATE_TABLE  { 9600, 19200, 38400, 57600, 115200 }
+#define CFG_SYS_UART_PORT  0
+#define CFG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200 }
 
-#define CONFIG_BOOTCOMMAND "bootm ffc3"
-#define CONFIG_EXTRA_ENV_SETTINGS  \
+#define CFG_EXTRA_ENV_SETTINGS \
"upgrade_uboot=loady; " \
"protect off 0xffc0 0xffc2; "   \
"erase 0xffc0 0xffc2; " \
@@ -43,11 +41,6 @@
 
 /* amcore design has flash data bytes wired swapped */
 #define CFG_SYS_WRITE_SWAPPED_DATA
-/* reserve 128-4KB */
-#define CONFIG_SYS_MONITOR_BASE(CONFIG_SYS_FLASH_BASE + 0x400)
-#define CONFIG_SYS_MONITOR_LEN  ((192 - 4) * 1024)
-#define CONFIG_SYS_MALLOC_LEN  (1 * 1024 * 1024)
-#define CONFIG_SYS_BOOTPARAMS_LEN  (64 * 1024)
 
 #define LDS_BOARD_TEXT \
. = DEFINED(env_offset) ? env_offset : .; \
-- 
2.39.1



[PATCH] m68k: rename CONFIG_MCFTMR to CFG_MCFTMR

2023-03-14 Thread Angelo Dureghello
From: Angelo Dureghello 

This is not a Kconfig option so changing to _CFG.

Signed-off-by: Angelo Durgehello 
---
 arch/m68k/cpu/mcf523x/interrupts.c|  2 +-
 arch/m68k/cpu/mcf52x2/interrupts.c| 12 ++--
 arch/m68k/cpu/mcf532x/interrupts.c|  2 +-
 arch/m68k/cpu/mcf5445x/interrupts.c   |  2 +-
 arch/m68k/include/asm/immap.h | 24 
 arch/m68k/lib/time.c  |  4 ++--
 board/freescale/m53017evb/README  |  2 +-
 board/freescale/m5373evb/README   |  2 +-
 configs/M5208EVBE_defconfig   |  1 -
 configs/M5235EVB_Flash32_defconfig|  1 -
 configs/M5235EVB_defconfig|  1 -
 configs/M5249EVB_defconfig|  1 -
 configs/M5253DEMO_defconfig   |  1 -
 configs/M5272C3_defconfig |  1 -
 configs/M5275EVB_defconfig|  1 -
 configs/M5282EVB_defconfig|  1 -
 configs/M53017EVB_defconfig   |  1 -
 configs/M5329AFEE_defconfig   |  1 -
 configs/M5329BFEE_defconfig   |  1 -
 configs/M5373EVB_defconfig|  1 -
 configs/amcore_defconfig  |  1 -
 configs/astro_mcf5373l_defconfig  |  1 -
 configs/cobra5272_defconfig   |  1 -
 configs/eb_cpu5282_defconfig  |  1 -
 configs/eb_cpu5282_internal_defconfig |  1 -
 configs/stmark2_defconfig |  1 -
 include/configs/M5208EVBE.h   |  2 ++
 include/configs/M5235EVB.h|  2 ++
 include/configs/M5249EVB.h|  2 ++
 include/configs/M5253DEMO.h   |  2 ++
 include/configs/M5272C3.h |  3 +++
 include/configs/M5275EVB.h|  2 ++
 include/configs/M5282EVB.h|  2 ++
 include/configs/M53017EVB.h   |  2 ++
 include/configs/M5329EVB.h|  2 ++
 include/configs/M5373EVB.h|  2 ++
 include/configs/amcore.h  |  2 +-
 include/configs/astro_mcf5373l.h  |  2 ++
 include/configs/cobra5272.h   |  2 ++
 include/configs/eb_cpu5282.h  |  2 ++
 include/configs/stmark2.h |  2 ++
 41 files changed, 55 insertions(+), 44 deletions(-)

diff --git a/arch/m68k/cpu/mcf523x/interrupts.c 
b/arch/m68k/cpu/mcf523x/interrupts.c
index 331288e006..b02ea29f63 100644
--- a/arch/m68k/cpu/mcf523x/interrupts.c
+++ b/arch/m68k/cpu/mcf523x/interrupts.c
@@ -22,7 +22,7 @@ int interrupt_init(void)
return 0;
 }
 
-#if defined(CONFIG_MCFTMR)
+#if defined(CFG_MCFTMR)
 void dtimer_intr_setup(void)
 {
int0_t *intp = (int0_t *) (CFG_SYS_INTR_BASE);
diff --git a/arch/m68k/cpu/mcf52x2/interrupts.c 
b/arch/m68k/cpu/mcf52x2/interrupts.c
index e8a1e132d2..e787c7605f 100644
--- a/arch/m68k/cpu/mcf52x2/interrupts.c
+++ b/arch/m68k/cpu/mcf52x2/interrupts.c
@@ -34,7 +34,7 @@ int interrupt_init(void)
return 0;
 }
 
-#if defined(CONFIG_MCFTMR)
+#if defined(CFG_MCFTMR)
 void dtimer_intr_setup(void)
 {
intctrl_t *intp = (intctrl_t *) (CFG_SYS_INTR_BASE);
@@ -42,7 +42,7 @@ void dtimer_intr_setup(void)
clrbits_be32(>int_icr1, INT_ICR1_TMR3MASK);
setbits_be32(>int_icr1, CFG_SYS_TMRINTR_PRI);
 }
-#endif /* CONFIG_MCFTMR */
+#endif /* CFG_MCFTMR */
 #endif /* CONFIG_M5272 */
 
 #if defined(CONFIG_M5208) || defined(CONFIG_M5282) || \
@@ -63,7 +63,7 @@ int interrupt_init(void)
return 0;
 }
 
-#if defined(CONFIG_MCFTMR)
+#if defined(CFG_MCFTMR)
 void dtimer_intr_setup(void)
 {
int0_t *intp = (int0_t *) (CFG_SYS_INTR_BASE);
@@ -72,7 +72,7 @@ void dtimer_intr_setup(void)
clrbits_be32(>imrl0, 0x0001);
clrbits_be32(>imrl0, CFG_SYS_TMRINTR_MASK);
 }
-#endif /* CONFIG_MCFTMR */
+#endif /* CFG_MCFTMR */
 #endif /* CONFIG_M5282 | CONFIG_M5271 | CONFIG_M5275 */
 
 #if defined(CONFIG_M5249) || defined(CONFIG_M5253)
@@ -83,11 +83,11 @@ int interrupt_init(void)
return 0;
 }
 
-#if defined(CONFIG_MCFTMR)
+#if defined(CFG_MCFTMR)
 void dtimer_intr_setup(void)
 {
mbar_writeLong(MCFSIM_IMR, mbar_readLong(MCFSIM_IMR) & ~0x0400);
mbar_writeByte(MCFSIM_TIMER2ICR, CFG_SYS_TMRINTR_PRI);
 }
-#endif /* CONFIG_MCFTMR */
+#endif /* CFG_MCFTMR */
 #endif /* CONFIG_M5249 || CONFIG_M5253 */
diff --git a/arch/m68k/cpu/mcf532x/interrupts.c 
b/arch/m68k/cpu/mcf532x/interrupts.c
index 64e04664a5..bbe823c0cf 100644
--- a/arch/m68k/cpu/mcf532x/interrupts.c
+++ b/arch/m68k/cpu/mcf532x/interrupts.c
@@ -23,7 +23,7 @@ int interrupt_init(void)
return 0;
 }
 
-#if defined(CONFIG_MCFTMR)
+#if defined(CFG_MCFTMR)
 void dtimer_intr_setup(void)
 {
int0_t *intp = (int0_t *) (CFG_SYS_INTR_BASE);
diff --git a/arch/m68k/cpu/mcf5445x/interrupts.c 
b/arch/m68k/cpu/mcf5445x/interrupts.c
index ea0cf87990..fb80a879c7 100644
--- a/arch/m68k/cpu/mcf5445x/interrupts.c
+++ b/arch/m68k/cpu/mcf5445x/interrupts.

Re: [PULL] Please pull u-boot-coldfire/master

2023-02-28 Thread Angelo Dureghello

Hi Tom,

On 28/02/23 9:34 PM, Tom Rini wrote:

On Tue, Feb 28, 2023 at 09:21:23PM +0100, Angelo Dureghello wrote:


The following changes since commit e8c80ac0f7a13bf0fc016ce324b870c0cff7a2b8:

   Prepare v2023.04-rc3 (2023-02-27 17:18:36 -0500)

are available in the Git repository at:

   git://git.denx.de/u-boot-coldfire.git master

for you to fetch changes up to 4c885f9f64cd85471614c75027620e3bcf3046bd:

   m68k: dts: stmark2: set correct compatible field for spi nor (2023-02-28
21:19:47 +0100)


Angelo Dureghello (6):
   board: amcore: fix u-boot mtd partition
   m68k: use longword-based jumps
   m68k: add global variable sdhc_per_clk for m68k
   board: stmark2: fix clock value
   arch: enable private libgcc for m68k
   m68k: dts: stmark2: set correct compatible field for spi nor

  arch/Kconfig|  1 +
  arch/m68k/cpu/mcf530x/start.S   | 18 --
  arch/m68k/dts/stmark2.dts   |  2 +-
  arch/m68k/include/asm/global_data.h |  3 +++
  board/sysam/stmark2/Kconfig |  2 +-
  include/configs/amcore.h| 20 +++-
  6 files changed, 33 insertions(+), 13 deletions(-)


OK, you need to re-work a few of the changes:
https://source.denx.de/u-boot/u-boot/-/jobs/586499

Things are either in a Kconfig (and the defconfig), or now "CFG_..."
instead of "CONFIG_...".



i received the automated email. Fixes are in progress, but
not ready still, there are several CFG to be fixed.
Could i ask another pull request later, for next release ?

Regards,
--
Angelo Dureghello



[PULL] Please pull u-boot-coldfire/master

2023-02-28 Thread Angelo Dureghello

The following changes since commit e8c80ac0f7a13bf0fc016ce324b870c0cff7a2b8:

  Prepare v2023.04-rc3 (2023-02-27 17:18:36 -0500)

are available in the Git repository at:

  git://git.denx.de/u-boot-coldfire.git master

for you to fetch changes up to 4c885f9f64cd85471614c75027620e3bcf3046bd:

  m68k: dts: stmark2: set correct compatible field for spi nor 
(2023-02-28 21:19:47 +0100)



Angelo Dureghello (6):
  board: amcore: fix u-boot mtd partition
  m68k: use longword-based jumps
  m68k: add global variable sdhc_per_clk for m68k
  board: stmark2: fix clock value
  arch: enable private libgcc for m68k
  m68k: dts: stmark2: set correct compatible field for spi nor

 arch/Kconfig|  1 +
 arch/m68k/cpu/mcf530x/start.S   | 18 --
 arch/m68k/dts/stmark2.dts   |  2 +-
 arch/m68k/include/asm/global_data.h |  3 +++
 board/sysam/stmark2/Kconfig |  2 +-
 include/configs/amcore.h| 20 +++-
 6 files changed, 33 insertions(+), 13 deletions(-)


[PATCH 3/3] mmc: fsl_esdhc_imx: add ColdFire support

2023-02-23 Thread Angelo Dureghello
From: Angelo Durgehello 

ColdFire mcf5441x includes the same imx esdhc controller module,
so adding minimal code to support it.

Signed-off-by: Angelo Durgehello 
---
 drivers/mmc/fsl_esdhc_imx.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/drivers/mmc/fsl_esdhc_imx.c b/drivers/mmc/fsl_esdhc_imx.c
index 66caf683f7..4e15738782 100644
--- a/drivers/mmc/fsl_esdhc_imx.c
+++ b/drivers/mmc/fsl_esdhc_imx.c
@@ -1381,7 +1381,9 @@ void fdt_fixup_esdhc(void *blob, struct bd_info *bd)
 #endif
 
 #if CONFIG_IS_ENABLED(DM_MMC)
+#if !CONFIG_IS_ENABLED(MCF5441x)
 #include 
+#endif
 __weak void init_clk_usdhc(u32 index)
 {
 }
@@ -1536,7 +1538,12 @@ static int fsl_esdhc_probe(struct udevice *dev)
 #else
init_clk_usdhc(dev_seq(dev));
 
+#if IS_ENABLED(CONFIG_MCF5441x)
+   priv->sdhc_clk = gd->arch.sdhc_clk;
+#else
priv->sdhc_clk = mxc_get_clock(MXC_ESDHC_CLK + dev_seq(dev));
+#endif
+
if (priv->sdhc_clk <= 0) {
dev_err(dev, "Unable to get clk for %s\n", dev->name);
return -EINVAL;
-- 
2.39.1



[PATCH 2/3] board: stmark2: add mmc support

2023-02-23 Thread Angelo Dureghello
From: Angelo Durgehello 

Enable mmc boot.

Signed-off-by: Angelo Durgehello 
---
 arch/m68k/dts/stmark2.dts |  4 
 configs/stmark2_defconfig | 12 ++--
 include/configs/stmark2.h |  6 --
 3 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/arch/m68k/dts/stmark2.dts b/arch/m68k/dts/stmark2.dts
index 3688651e59..9532a01b2f 100644
--- a/arch/m68k/dts/stmark2.dts
+++ b/arch/m68k/dts/stmark2.dts
@@ -41,3 +41,7 @@
status = "okay";
mii-base = <0>;
 };
+
+ {
+   status = "okay";
+};
diff --git a/configs/stmark2_defconfig b/configs/stmark2_defconfig
index ae7a9cf6da..ab95baa148 100644
--- a/configs/stmark2_defconfig
+++ b/configs/stmark2_defconfig
@@ -14,9 +14,9 @@ CONFIG_SYS_MONITOR_LEN=262144
 CONFIG_TIMESTAMP=y
 CONFIG_SYS_MONITOR_BASE=0x47E00400
 CONFIG_USE_BOOTARGS=y
-CONFIG_BOOTARGS="console=ttyS0,115200 root=/dev/ram0 rw rootfstype=ramfs 
rdinit=/bin/init devtmpfs.mount=1"
+CONFIG_BOOTARGS="console=ttyS0,115200 root=/dev/ram0 rw rootfstype=ramfs 
rdinit=/sbin/init devtmpfs.mount=1"
 CONFIG_USE_BOOTCOMMAND=y
-CONFIG_BOOTCOMMAND="sf probe 0:1 5000; sf read ${loadaddr} 0x10 
${kern_size}; bootm ${loadaddr}"
+CONFIG_BOOTCOMMAND="run boot_sd; bootm ${loadaddr} ${loadaddr_ramfs}"
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_SYS_MALLOC_BOOTPARAMS=y
 CONFIG_HUSH_PARSER=y
@@ -32,6 +32,12 @@ CONFIG_CMD_SPI=y
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_CMD_CACHE=y
 CONFIG_CMD_MTDPARTS=y
+CONFIG_CMD_MMC=y
+CONFIG_CMD_EXT2=y
+CONFIG_CMD_EXT4=y
+CONFIG_CMD_FAT=y
+CONFIG_CMD_FS_GENERIC=y
+CONFIG_DOS_PARTITION=y
 CONFIG_MTDIDS_DEFAULT="nor0=spi-flash.0"
 CONFIG_MTDPARTS_DEFAULT="mtdparts=spi-flash.0:1m(u-boot),7m(kernel),-(rootfs)"
 CONFIG_ENV_IS_IN_SPI_FLASH=y
@@ -41,6 +47,8 @@ CONFIG_USE_HOSTNAME=y
 CONFIG_HOSTNAME="stmark2"
 # CONFIG_NET is not set
 CONFIG_MTD=y
+CONFIG_MMC=y
+CONFIG_FSL_ESDHC_IMX=y
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SF_DEFAULT_SPEED=5000
 CONFIG_SPI_FLASH_ISSI=y
diff --git a/include/configs/stmark2.h b/include/configs/stmark2.h
index 19589be270..ddb85cc7d1 100644
--- a/include/configs/stmark2.h
+++ b/include/configs/stmark2.h
@@ -13,10 +13,12 @@
 #define LDS_BOARD_TEXT \
board/sysam/stmark2/sbf_dram_init.o (.text*)
 
-#define CFG_EXTRA_ENV_SETTINGS \
+#define CFG_EXTRA_ENV_SETTINGS \
+   "boot_sd=load mmc 0:1 ${loadaddr} uImage; " \
+   "load mmc 0:1 ${loadaddr_ramfs} uRamfs\0"   \
"kern_size=0x70\0"  \
"loadaddr=0x40001000\0" \
-   "-(rootfs)\0"   \
+   "loadaddr_ramfs=0x41001000\0"   \
"update_uboot=loady ${loadaddr}; "  \
"sf probe 0:1 5000; "   \
"sf erase 0 0x8; "  \
-- 
2.39.1



[PATCH 1/3] m68k: add mmc device for mcf5441x

2023-02-23 Thread Angelo Dureghello
From: Angelo Durgehello 

Add mmc support for the mcf5441x family.

Signed-off-by: Angelo Durgehello 
---
 arch/m68k/dts/mcf5441x.dtsi | 8 
 1 file changed, 8 insertions(+)

diff --git a/arch/m68k/dts/mcf5441x.dtsi b/arch/m68k/dts/mcf5441x.dtsi
index 6769bdc270..6383b50f11 100644
--- a/arch/m68k/dts/mcf5441x.dtsi
+++ b/arch/m68k/dts/mcf5441x.dtsi
@@ -103,5 +103,13 @@
timeout-loop = <5>;
status = "disabled";
};
+
+   esdhc1: mmc@0xfc0cc000 {
+   compatible = "fsl,esdhc";
+   reg = <0xfc0cc000 0x8000>;
+   non-removable;
+   bus-width = <4>;
+   status = "disabled";
+   };
};
 };
-- 
2.39.1



[PATCH] m68k: use longword-based jumps

2023-02-23 Thread Angelo Dureghello
From: Angelo Durgehello 

Increasing of binary size requires longword-based jumps.

Signed-off-by: Angelo Durgehello 
---
 arch/m68k/cpu/mcf530x/start.S | 18 --
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/arch/m68k/cpu/mcf530x/start.S b/arch/m68k/cpu/mcf530x/start.S
index dbe2b54e41..cef8d79aad 100644
--- a/arch/m68k/cpu/mcf530x/start.S
+++ b/arch/m68k/cpu/mcf530x/start.S
@@ -132,7 +132,8 @@ _start:
 * then (and always) gd struct space will be reserved
 */
move.l  %sp, -(%sp)
-   bsr board_init_f_alloc_reserve
+   move.l  #board_init_f_alloc_reserve, %a1
+   jsr (%a1)
 
/* update stack and frame-pointers */
move.l  %d0, %sp
@@ -140,14 +141,17 @@ _start:
 
/* initialize reserved area */
move.l  %d0, -(%sp)
-   bsr board_init_f_init_reserve
+   move.l  #board_init_f_init_reserve, %a1
+   jsr (%a1)
 
/* run low-level CPU init code (from flash) */
-   bsr cpu_init_f
+   move.l  #cpu_init_f, %a1
+   jsr (%a1)
 
/* run low-level board init code (from flash) */
clr.l   %sp@-
-   bsr board_init_f
+   move.l  #board_init_f, %a1
+   jsr (%a1)
 
/* board_init_f() does not return */
 
@@ -239,7 +243,8 @@ _fault:
 _exc_handler:
SAVE_ALL
movel   %sp,%sp@-
-   bsr exc_handler
+   move.l  #exc_handler, %a1
+   jsr (%a1)
addql   #4,%sp
RESTORE_ALL
 
@@ -247,7 +252,8 @@ _exc_handler:
 _int_handler:
SAVE_ALL
movel   %sp,%sp@-
-   bsr int_handler
+   move.l  #int_handler, %a1
+   jsr (%a1)
addql   #4,%sp
RESTORE_ALL
 
-- 
2.39.1



[PATCH] board: amcore: fix u-boot mtd partition

2023-02-23 Thread Angelo Dureghello
From: Angelo Durgehello 

Signed-off-by: Angelo Dureghello 
---
 include/configs/amcore.h | 20 +++-
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/include/configs/amcore.h b/include/configs/amcore.h
index 648d30a5b2..37c45e7172 100644
--- a/include/configs/amcore.h
+++ b/include/configs/amcore.h
@@ -10,14 +10,20 @@
 
 #define CFG_SYS_UART_PORT  0
 
-#define CFG_EXTRA_ENV_SETTINGS \
+#define CONFIG_MCFTMR
+#define CONFIG_MCFUART
+#define CONFIG_SYS_UART_PORT   0
+#define CONFIG_SYS_BAUDRATE_TABLE  { 9600, 19200, 38400, 57600, 115200 }
+
+#define CONFIG_BOOTCOMMAND "bootm ffc3"
+#define CONFIG_EXTRA_ENV_SETTINGS  \
"upgrade_uboot=loady; " \
-   "protect off 0xffc0 0xffc1; "   \
-   "erase 0xffc0 0xffc1; " \
+   "protect off 0xffc0 0xffc2; "   \
+   "erase 0xffc0 0xffc2; " \
"cp.b 0x2 0xffc0 ${filesize}\0" \
"upgrade_kernel=loady; "\
-   "erase 0xffc2 0xffef; " \
-   "cp.b 0x2 0xffc2 ${filesize}\0" \
+   "erase 0xffc3 0xffef; " \
+   "cp.b 0x2 0xffc3 ${filesize}\0" \
"upgrade_jffs2=loady; " \
"erase 0xfff0 0x; " \
"cp.b 0x2 0xfff0 ${filesize}\0"
@@ -38,6 +44,10 @@
 /* amcore design has flash data bytes wired swapped */
 #define CFG_SYS_WRITE_SWAPPED_DATA
 /* reserve 128-4KB */
+#define CONFIG_SYS_MONITOR_BASE(CONFIG_SYS_FLASH_BASE + 0x400)
+#define CONFIG_SYS_MONITOR_LEN  ((192 - 4) * 1024)
+#define CONFIG_SYS_MALLOC_LEN  (1 * 1024 * 1024)
+#define CONFIG_SYS_BOOTPARAMS_LEN  (64 * 1024)
 
 #define LDS_BOARD_TEXT \
. = DEFINED(env_offset) ? env_offset : .; \
-- 
2.39.1



[PATCH] m68k: dts: stmark2: set correct compatible field for spi nor

2023-02-15 Thread Angelo Dureghello
From: Angelo Durgehello 

Fix error:

Invalid chip select 0:1 (err=-19)

update spi nor "compatible" property with "jedec,spi-nor"
to have spi nor properly bound as a child device.

Signed-off-by: Angelo Durgehello 
---
 arch/m68k/dts/stmark2.dts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/m68k/dts/stmark2.dts b/arch/m68k/dts/stmark2.dts
index 306b56d679..3688651e59 100644
--- a/arch/m68k/dts/stmark2.dts
+++ b/arch/m68k/dts/stmark2.dts
@@ -27,7 +27,7 @@
flash: is25lp128@1 {
#address-cells = <1>;
#size-cells = <1>;
-   compatible = "spi-flash";
+   compatible = "jedec,spi-nor";
spi-max-frequency = <6000>;
reg = <1>;
};
-- 
2.39.1



[PATCH] arch: enable private libgcc for m68k

2023-02-07 Thread Angelo Dureghello
From: Angelo Durgehello 

This patch fixes u-boot hanging on the first printf("%x", val).

Some toolchains built without multilib enabled may produce
u-boot freezing on first u64 shift operation, as in
lib/vsprintf.c number() function.
Using our private libgcc solves the issue.

Setting private libgcc enabled at architecture level to avoid
similar issues, it should not harm.

Signed-off-by: Angelo Durgehello 
---
 arch/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/Kconfig b/arch/Kconfig
index d30676ae81..55b9a5eb8a 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -67,6 +67,7 @@ config ARM
 config M68K
bool "M68000 architecture"
select HAVE_PRIVATE_LIBGCC
+   select USE_PRIVATE_LIBGCC
select NEEDS_MANUAL_RELOC
select SYS_BOOT_GET_CMDLINE
select SYS_BOOT_GET_KBD
-- 
2.39.1



Re: U-Boot support for M68K removal

2023-02-07 Thread Angelo Dureghello
Hi all,

finally u-boot up and running again on m68k,
at least on mcf54415:

U-Boot 2023.04-rc1-00216-g33bd3d34d2-dirty (Feb 07 2023 - 22:45:11 +0100)

CPU:   54415 :)
Freescale 0a0
Freescale MCF54415 (Mask:a0 Version:2)
   CPU CLK 240 MHz BUS CLK 120 MHz FLB CLK 60 MHz
   INP CLK 30 MHz VCO CLK 480 MHz
DRAM:  128 MiB
Core:  6 devices, 6 uclasses, devicetree: separate
MMC:
Loading Environment from SPIFlash... spi_coldfire dspi@fc05c000: Invalid
chip select 0:1 (err=-19)
*** Warning - spi_flash_probe_bus_cs() failed, using default environment

In:uart@fc06
Out:   uart@fc06
Err:   uart@fc06
Hit any key to stop autoboot:  0
## Error: "boot_sd" not defined
Wrong Image Format for bootm command
ERROR: can't get kernel image!
stmark2 $

Still something to fix, but at least it works.


Regards,
angelo

On Mon, Feb 6, 2023 at 3:00 PM Greg Ungerer  wrote:

> Hi Adrian,
>
> On 6/2/23 22:25, John Paul Adrian Glaubitz wrote:
> > Hi Greg!
> >
> > On Mon, 2023-02-06 at 22:02 +1000, Greg Ungerer wrote:
> >> I wish I had a 54415 based board in my collection. Would make it so
> >> much easier to keep the kernel working on it :-(
> >
> > Maybe we can find one to buy for you. I would be happy to donate for it.
>
> I'll gladly accept any surplus boards anyone has.
> I have quite a few of the older ColdFire evaluation boards, but not all.
> I only have a single M5475EVB for MMU testing currently though.
>
> Regards
> Greg
>
>
>
>

-- 
Angelo Dureghello
*Timesys*
e. angelo.dureghe...@timesys.com


[PATCH] m68k: add global variable sdhc_per_clk for m68k

2023-02-07 Thread Angelo Dureghello
From: Angelo Durgehello 

The FSL eSDHC controller supports two reference clocks. They are
platform clock and periperhal clock. The global variable sdhc_clk
has already been used for platform clock.
ColdFire also uses eSHDC controller, as in arm and powerpc,
so adding sdhc_per_clk to arch_global_data.

Signed-off-by: Angelo Durgehello 
---
 arch/m68k/include/asm/global_data.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/m68k/include/asm/global_data.h 
b/arch/m68k/include/asm/global_data.h
index 273e843c4a..5f576ba16f 100644
--- a/arch/m68k/include/asm/global_data.h
+++ b/arch/m68k/include/asm/global_data.h
@@ -23,6 +23,9 @@ struct arch_global_data {
 #ifdef CONFIG_MCF5441x
unsigned long sdhc_clk;
 #endif
+#if defined(CONFIG_FSL_ESDHC)
+   u32 sdhc_per_clk;
+#endif
 };
 
 #include 
-- 
2.39.1



[PATCH] board: stmark2: move CONFIG_SYS_SBFHDR_SIZE to CFG namespace

2023-02-07 Thread Angelo Dureghello
From: Angelo Durgehello 

Move CONFIG_SYS_SBFHDR_SIZE to CFG_SYS_SBFHDR_SIZE.

Signed-off-by: Angelo Durgehello 
---
 include/configs/stmark2.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/configs/stmark2.h b/include/configs/stmark2.h
index 11ca86737d..81c8f011bf 100644
--- a/include/configs/stmark2.h
+++ b/include/configs/stmark2.h
@@ -57,7 +57,7 @@
 /* Serial Flash */
 #define CONFIG_SERIAL_FLASH
 
-#define CONFIG_SYS_SBFHDR_SIZE 0x7
+#define CFG_SYS_SBFHDR_SIZE0x7
 
 /* Input, PCI, Flexbus, and VCO */
 #define CONFIG_PRAM2048/* 2048 KB */
-- 
2.39.1



Re: [PATCH 3/3] board: stmark2: fix clock value

2023-02-07 Thread Angelo Dureghello




Sorry, double sent.


On 07/02/23 21:48, Angelo Dureghello wrote:

From: Angelo Dureghello 

Fix totally blank console at boot, clock value must be decimal,
as for the 30Mhz external crystal.

Signed-off-by: Angelo Dureghello 
---
  board/sysam/stmark2/Kconfig | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/board/sysam/stmark2/Kconfig b/board/sysam/stmark2/Kconfig
index b2595059c6..94f5049c94 100644
--- a/board/sysam/stmark2/Kconfig
+++ b/board/sysam/stmark2/Kconfig
@@ -11,7 +11,7 @@ config SERIAL_BOOT
depends on CF_SBF
  
  config SYS_INPUT_CLKSRC

-   hex
+   int "External crystal clock"
default 3000
  
  config SYS_CPU


--
Angelo Dureghello
+++ kernelspace +++
+E: angelo AT kernel-space.org
+W: www.kernel-space.org


Re: [PATCH 2/3] board: stmark2: move CONFIG_SYS_SBFHDR_SIZE to CFG namespace

2023-02-07 Thread Angelo Dureghello



Sorry, sent as patchset for error,
resending as single patch.

On 07/02/23 21:47, Angelo Dureghello wrote:

From: Angelo Durgehello 

Move CONFIG_SYS_SBFHDR_SIZE to CFG_SYS_SBFHDR_SIZE.

Signed-off-by: Angelo Durgehello 
---
  include/configs/stmark2.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/configs/stmark2.h b/include/configs/stmark2.h
index 11ca86737d..81c8f011bf 100644
--- a/include/configs/stmark2.h
+++ b/include/configs/stmark2.h
@@ -57,7 +57,7 @@
  /* Serial Flash */
  #define CONFIG_SERIAL_FLASH
  
-#define CONFIG_SYS_SBFHDR_SIZE		0x7

+#define CFG_SYS_SBFHDR_SIZE0x7
  
  /* Input, PCI, Flexbus, and VCO */

  #define CONFIG_PRAM   2048/* 2048 KB */


--
Angelo Dureghello
+++ kernelspace +++
+E: angelo AT kernel-space.org
+W: www.kernel-space.org


[PATCH] board: stmark2: fix clock value

2023-02-07 Thread Angelo Dureghello
From: Angelo Dureghello 

Fix totally blank console at boot, clock value must be decimal,
as for the 30Mhz external crystal.

Signed-off-by: Angelo Dureghello 
---
 board/sysam/stmark2/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/board/sysam/stmark2/Kconfig b/board/sysam/stmark2/Kconfig
index b2595059c6..94f5049c94 100644
--- a/board/sysam/stmark2/Kconfig
+++ b/board/sysam/stmark2/Kconfig
@@ -11,7 +11,7 @@ config SERIAL_BOOT
depends on CF_SBF
 
 config SYS_INPUT_CLKSRC
-   hex
+   int "External crystal clock"
default 3000
 
 config SYS_CPU
-- 
2.39.1



[PATCH 3/3] board: stmark2: fix clock value

2023-02-07 Thread Angelo Dureghello
From: Angelo Dureghello 

Fix totally blank console at boot, clock value must be decimal,
as for the 30Mhz external crystal.

Signed-off-by: Angelo Dureghello 
---
 board/sysam/stmark2/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/board/sysam/stmark2/Kconfig b/board/sysam/stmark2/Kconfig
index b2595059c6..94f5049c94 100644
--- a/board/sysam/stmark2/Kconfig
+++ b/board/sysam/stmark2/Kconfig
@@ -11,7 +11,7 @@ config SERIAL_BOOT
depends on CF_SBF
 
 config SYS_INPUT_CLKSRC
-   hex
+   int "External crystal clock"
default 3000
 
 config SYS_CPU
-- 
2.39.1



[PATCH 2/3] board: stmark2: move CONFIG_SYS_SBFHDR_SIZE to CFG namespace

2023-02-07 Thread Angelo Dureghello
From: Angelo Durgehello 

Move CONFIG_SYS_SBFHDR_SIZE to CFG_SYS_SBFHDR_SIZE.

Signed-off-by: Angelo Durgehello 
---
 include/configs/stmark2.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/configs/stmark2.h b/include/configs/stmark2.h
index 11ca86737d..81c8f011bf 100644
--- a/include/configs/stmark2.h
+++ b/include/configs/stmark2.h
@@ -57,7 +57,7 @@
 /* Serial Flash */
 #define CONFIG_SERIAL_FLASH
 
-#define CONFIG_SYS_SBFHDR_SIZE 0x7
+#define CFG_SYS_SBFHDR_SIZE0x7
 
 /* Input, PCI, Flexbus, and VCO */
 #define CONFIG_PRAM2048/* 2048 KB */
-- 
2.39.1



Re: [PATCH] board: stmark2: fix clock value

2023-02-06 Thread Angelo Dureghello

Hi Tom,

a small issue, i cannot push on u-boot-coldfire

Already on 'master'
remote:
remote: 


remote:
remote: Your account has been blocked.
remote:
remote: 


remote:
fatal: Could not read from remote repository.

On 06/02/23 23:03, Tom Rini wrote:

On Mon, Feb 06, 2023 at 11:01:04PM +0100, Angelo Dureghello wrote:


Fix totally blank console at boot, clock value must be decimal,
as for the 30Mhz external crystal.

Signed-off-by: Angelo Dureghello 


Fixes: 26e5944ec90c ("stmark2: Migrate CONFIG_SYS_EXTRA_OPTIONS to Kconfig")
Reviewed-by: Tom Rini 

And please feel free to put this in to a PR and send it along once your
board is booting, or as soon as you can if this was all that's wrong.



regards,
angelo

--
Angelo Dureghello
+++ kernelspace +++
+E: angelo AT kernel-space.org
+W: www.kernel-space.org


Re: [PATCH] board: stmark2: fix clock value

2023-02-06 Thread Angelo Dureghello

Hi Tom,

On 06/02/23 23:03, Tom Rini wrote:

On Mon, Feb 06, 2023 at 11:01:04PM +0100, Angelo Dureghello wrote:


Fix totally blank console at boot, clock value must be decimal,
as for the 30Mhz external crystal.

Signed-off-by: Angelo Dureghello 


Fixes: 26e5944ec90c ("stmark2: Migrate CONFIG_SYS_EXTRA_OPTIONS to Kconfig")
Reviewed-by: Tom Rini 

And please feel free to put this in to a PR and send it along once your
board is booting, or as soon as you can if this was all that's wrong.



thanks,

i am now at:

U-Boot 2023.01-00936-gde8202a9f3-dirty (Feb 06 2023 - 22:52:44 +0100)

CPU:


will keep this and further arch-related patches in
u-boot-coldfire and will ask PR later on.

Regards,

--
Angelo Dureghello
+++ kernelspace +++
+E: angelo AT kernel-space.org
+W: www.kernel-space.org


[PATCH] board: stmark2: fix clock value

2023-02-06 Thread Angelo Dureghello
Fix totally blank console at boot, clock value must be decimal,
as for the 30Mhz external crystal.

Signed-off-by: Angelo Dureghello 
---
 board/sysam/stmark2/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/board/sysam/stmark2/Kconfig b/board/sysam/stmark2/Kconfig
index b2595059c6..94f5049c94 100644
--- a/board/sysam/stmark2/Kconfig
+++ b/board/sysam/stmark2/Kconfig
@@ -11,7 +11,7 @@ config SERIAL_BOOT
depends on CF_SBF
 
 config SYS_INPUT_CLKSRC
-   hex
+   int "External crystal clock"
default 3000
 
 config SYS_CPU
-- 
2.39.1



Re: U-Boot support for M68K removal

2023-02-06 Thread Angelo Dureghello
Hi Greg,

On Mon, Feb 6, 2023 at 1:02 PM Greg Ungerer  wrote:
>
>

> I wish I had a 54415 based board in my collection. Would make it so
> much easier to keep the kernel working on it :-(
>
> Regards
> Greg
>

I can solder here one additional stmark2 for you when i find the time.

You can send me your data at
angelo AT kernel-space.org

Regards
-- 
angelo


Re: U-Boot support for M68K removal

2023-02-06 Thread Angelo Dureghello
Hi John,

On Sat, Feb 4, 2023 at 4:55 PM John Paul Adrian Glaubitz
 wrote:
>
> On Mon, 2023-01-30 at 17:22 +0100, John Paul Adrian Glaubitz wrote:
> > FWIW, m68k is still a very actively maintained architecture in the
> > Linux kernel and userland with even LLVM and Rust having recently
> > added support for m68k.
> >
> > I also own a Coldfire board myself (not sure which one without
> > looking), so I can offer to test U-Boot patches in the future.
>
> So, I just found my Coldfire board and it's actually a 547x/548x EVB
> fitted with a 5475 CPU module clocked at 266 MHz.
>
> I will get this board set up during the next weeks and I am happy to
> test any Coldfire kernel patches, and eventually, U-Boot patches if
> that board is still supported.
>

thanks a lot.

Actually, i am debugging on a 54415 based board, totally dead
using current master.
I cannot printf, so using some gpio's for debug.
Issue seems to happen at first puts, so, something related
to serial port initialization. Hope to fix this soon.

>
> Adrian
>
> --
>  .''`.  John Paul Adrian Glaubitz
> : :' :  Debian Developer
> `. `'   Physicist
>   `-GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913


Regards,
angelo

-- 
Angelo Dureghello
Timesys
e. angelo.dureghe...@timesys.com


Re: U-Boot support for M68K removal

2023-01-30 Thread Angelo Dureghello
Hi Greg,

On Mon, Jan 30, 2023 at 10:50 PM Greg Ungerer  wrote:
>
> Hi Tom,
>
> On 31/1/23 05:31, Tom Rini wrote:
> > On Mon, Jan 30, 2023 at 08:10:36PM +0100, Geert Uytterhoeven wrote:
> >> Hi Eero,
> >>
> >> On Mon, Jan 30, 2023 at 8:02 PM Eero Tamminen  wrote:
> >>> On 30.1.2023 18.34, Tom Rini wrote:
> >>>> That's great to hear. While I started my life on m68k machines, I never
> >>>> did get Linux up on one. Do the coldfire platforms you have run U-Boot
> >>>> today? If so, are they already supported upstream? One of my biggest
> >>>> concerns about the architecture, in U-Boot, is that I've just not heard
> >>>> of anyone using it in quite some time, and we don't have any emulated
> >>>> platforms either (can it be done in QEMU? We have other plaforms in CI
> >>>> via QEMU) so I worry it's not working.
> >>>
> >>> Qemu supports both m68k and ColdFire nowadays:
> >>> https://www.qemu.org/docs/master/system/target-m68k.html
> >>>
> >>>
> >>>  - Eero
> >>>
> >>> PS. For m68k there are also a lot of other emulators that emulate
> >>> specific platforms.
> >>>
> >>> Aranym, 68040 Atari "clone", used a lot by Debian m68k port before Qemu
> >>> got m68k support.
> >>>
> >>> WinAUE, 68000-68040 Amiga emulation.  Unlike Aranym or Qemu, this
> >>> emulates also CPU cache.
> >>>
> >>> Hatari, 68000-68040 Atari emulation (based on WinUAE CPU core).
> >>>
> >>> Previous, 68030 NeXT emulator (based on Hatari).
> >>
> >> But none of the platforms listed above boot using U-Boot, which is
> >> what Tom is interested in...
> >>
> >> "qemu-system-m68k -machine help" lists a.o.:
> >>
> >>  an5206   Arnewsh 5206
> >>  mcf5208evb   MCF5208EVB (default)
> >>
> >> U-Boot still contains include/configs/M5208EVBE.h, but there are no
> >> actual users...
> >>
> >> Angelo: so support for amcore in qemu would be nice ;-)
> >
> > I did a little searching after sending and I see there's been some
> > patches for mcf5208evb and U-Boot, in QEMU but the last message (2019)
> > was that the CPU emulation wasn't quite complete enough.  But yes, one
> > way or another, it would be really great to get a virtualized platform
> > in CI to prevent future breakage.
>
> FWIW the QEMU emulation of the m5208evb is good enough to run Linux.
> I do a lot of kernel testing (and development!) using that.
>
Thanks for the info !


> Regards
> Greg
>

Regards,
angelo
>


-- 
Angelo Dureghello
Timesys
e. angelo.dureghe...@timesys.com


[PATCH] MAINTAINERS: m68k: Change Angelo's email address

2023-01-30 Thread Angelo Dureghello
Set my new current personal email.

Signed-off-by: Angelo Dureghello 
---
 MAINTAINERS | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 2dd2b46fcd..abf77a5f17 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -842,7 +842,7 @@ F:  drivers/clk/imx/
 
 COLDFIRE
 M: Huan Wang 
-M: Angelo Dureghello 
+M: Angelo Dureghello 
 S: Maintained
 T: git https://source.denx.de/u-boot/custodians/u-boot-coldfire.git
 F: arch/m68k/
-- 
2.39.0



[PATCH] MAINTAINERS: m68k: Change Angelo's email address

2023-01-30 Thread Angelo Dureghello
Set my new current personal email.

Signed-off-by: Angelo Dureghello 
---
 MAINTAINERS | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 2dd2b46fcd..abf77a5f17 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -842,7 +842,7 @@ F:  drivers/clk/imx/
 
 COLDFIRE
 M: Huan Wang 
-M: Angelo Dureghello 
+M: Angelo Dureghello 
 S: Maintained
 T: git https://source.denx.de/u-boot/custodians/u-boot-coldfire.git
 F: arch/m68k/
-- 
2.39.0



  1   2   3   4   >