Re: [PATCH 0/5] arm: mvebu: turris_omnia: Fix hangup in debug UART

2022-05-17 Thread Stefan Roese

On 06.05.22 11:05, Pali Rohár wrote:

If proper U-Boot on Turris Omnia tries to print something on debug UART
then CPU hangs. Reason is that debug UART in proper U-Boot for Turris
Omnia has incorrect configuration of base register. Base register is
different in SPL and also in different stages of proper U-Boot.

Fix all these issues. Introduce new arch_very_early_init() ARM function
which will be called at very early stage prior initialization of debug
UART. Move code which moves internal mvebu registers to this function.
And split configuration of DEBUG_UART_BASE into SPL and proper U-Boot
to allow setting different values which matches current HW status.

With all these changes, it is possible call "printf" function in
Turris Omnia's board_early_init_f() function in both SPL and proper
U-Boot.

Pali Rohár (5):
   arm: Add new config option ARCH_VERY_EARLY_INIT
   arm: mvebu: Move internal registers in arch_very_early_init() function
   serial: Add new config option SPL_DEBUG_UART_BASE
   serial: ns16550: Add support for SPL_DEBUG_UART_BASE
   arm: mvebu: turris_omnia: Fix DEBUG_UART_BASE

  arch/arm/Kconfig   |  6 ++
  arch/arm/lib/crt0.S|  5 +
  arch/arm/mach-mvebu/Kconfig|  1 +
  arch/arm/mach-mvebu/Makefile   |  1 +
  arch/arm/mach-mvebu/cpu.c  | 31 ---
  arch/arm/mach-mvebu/lowlevel.S | 27 +++
  configs/turris_omnia_defconfig |  3 ++-
  drivers/serial/Kconfig |  7 +++
  drivers/serial/ns16550.c   |  4 ++--
  9 files changed, 51 insertions(+), 34 deletions(-)
  create mode 100644 arch/arm/mach-mvebu/lowlevel.S



Applied with the corresponding additional patches to
u-boot-marvell/master

Thanks,
Stefan


Re: [PATCH 0/5] arm: mvebu: turris_omnia: Fix hangup in debug UART

2022-05-16 Thread Pali Rohár
On Monday 16 May 2022 16:52:06 Stefan Roese wrote:
> Hi Pali,
> 
> On 06.05.22 11:05, Pali Rohár wrote:
> > If proper U-Boot on Turris Omnia tries to print something on debug UART
> > then CPU hangs. Reason is that debug UART in proper U-Boot for Turris
> > Omnia has incorrect configuration of base register. Base register is
> > different in SPL and also in different stages of proper U-Boot.
> > 
> > Fix all these issues. Introduce new arch_very_early_init() ARM function
> > which will be called at very early stage prior initialization of debug
> > UART. Move code which moves internal mvebu registers to this function.
> > And split configuration of DEBUG_UART_BASE into SPL and proper U-Boot
> > to allow setting different values which matches current HW status.
> > 
> > With all these changes, it is possible call "printf" function in
> > Turris Omnia's board_early_init_f() function in both SPL and proper
> > U-Boot.
> > 
> > Pali Rohár (5):
> >arm: Add new config option ARCH_VERY_EARLY_INIT
> >arm: mvebu: Move internal registers in arch_very_early_init() function
> >serial: Add new config option SPL_DEBUG_UART_BASE
> >serial: ns16550: Add support for SPL_DEBUG_UART_BASE
> >arm: mvebu: turris_omnia: Fix DEBUG_UART_BASE
> > 
> >   arch/arm/Kconfig   |  6 ++
> >   arch/arm/lib/crt0.S|  5 +
> >   arch/arm/mach-mvebu/Kconfig|  1 +
> >   arch/arm/mach-mvebu/Makefile   |  1 +
> >   arch/arm/mach-mvebu/cpu.c  | 31 ---
> >   arch/arm/mach-mvebu/lowlevel.S | 27 +++
> >   configs/turris_omnia_defconfig |  3 ++-
> >   drivers/serial/Kconfig |  7 +++
> >   drivers/serial/ns16550.c   |  4 ++--
> >   9 files changed, 51 insertions(+), 34 deletions(-)
> >   create mode 100644 arch/arm/mach-mvebu/lowlevel.S
> 
> This patchset seems to introduce problems on some non-MVEBU platforms
> like x86, chromebook_coral_defconfig:
> 
> drivers/serial/ns16550.c: In function ‘_debug_uart_init’:
> ././include/linux/kconfig.h:51:32: error: ‘CONFIG_TPL_DEBUG_UART_BASE’
> undeclared (first use in this function); did you mean
> ‘CONFIG_SPL_DEBUG_UART_BASE’?
>51 | #define __config_val(pfx, cfg) CONFIG_ ## pfx ## cfg
>   |^~~
> ././include/linux/kconfig.h:50:32: note: in expansion of macro
> ‘__config_val’
>50 | #define  _config_val(pfx, cfg) __config_val(pfx, cfg)
>   |^~~~
> ././include/linux/kconfig.h:49:33: note: in expansion of macro ‘_config_val’
>49 | #define   config_val(cfg)   _config_val(_CONFIG_PREFIX, cfg)
>   | ^~~
> ././include/linux/kconfig.h:61:29: note: in expansion of macro ‘config_val’
>61 | #define CONFIG_VAL(option)  config_val(option)
>   | ^~
> drivers/serial/ns16550.c:328:54: note: in expansion of macro ‘CONFIG_VAL’
>   328 | struct ns16550 *com_port = (struct ns16550
> *)CONFIG_VAL(DEBUG_UART_BASE);
>   |  ^~
> ././include/linux/kconfig.h:51:32: note: each undeclared identifier is
> reported only once for each function it appears in
>51 | #define __config_val(pfx, cfg) CONFIG_ ## pfx ## cfg
>   |^~~
> ././include/linux/kconfig.h:50:32: note: in expansion of macro
> ‘__config_val’
>50 | #define  _config_val(pfx, cfg) __config_val(pfx, cfg)
>   |^~~~
> ././include/linux/kconfig.h:49:33: note: in expansion of macro ‘_config_val’
>49 | #define   config_val(cfg)   _config_val(_CONFIG_PREFIX, cfg)
>   | ^~~
> ././include/linux/kconfig.h:61:29: note: in expansion of macro ‘config_val’
>61 | #define CONFIG_VAL(option)  config_val(option)
>   | ^~
> drivers/serial/ns16550.c:328:54: note: in expansion of macro ‘CONFIG_VAL’
>   328 | struct ns16550 *com_port = (struct ns16550
> *)CONFIG_VAL(DEBUG_UART_BASE);
>   |  ^~
> drivers/serial/ns16550.c: In function ‘_debug_uart_putc’:
> ././include/linux/kconfig.h:51:32: error: ‘CONFIG_TPL_DEBUG_UART_BASE’
> undeclared (first use in this function); did you mean
> ‘CONFIG_SPL_DEBUG_UART_BASE’?
>51 | #define __config_val(pfx, cfg) CONFIG_ ## pfx ## cfg
>   |^~~
> ././include/linux/kconfig.h:50:32: note: in expansion of macro
> ‘__config_val’
>50 | #define  _config_val(pfx, cfg) __config_val(pfx, cfg)
>   |^~~~
> ././include/linux/kconfig.h:49:33: note: in expansion of macro ‘_config_val’
>49 | #define   config_val(cfg)   _config_val(_CONFIG_PREFIX, cfg)
>   | ^~~
> ././include/linux/kconfig.h:61:29: note: in 

Re: [PATCH 0/5] arm: mvebu: turris_omnia: Fix hangup in debug UART

2022-05-16 Thread Stefan Roese

Hi Pali,

On 06.05.22 11:05, Pali Rohár wrote:

If proper U-Boot on Turris Omnia tries to print something on debug UART
then CPU hangs. Reason is that debug UART in proper U-Boot for Turris
Omnia has incorrect configuration of base register. Base register is
different in SPL and also in different stages of proper U-Boot.

Fix all these issues. Introduce new arch_very_early_init() ARM function
which will be called at very early stage prior initialization of debug
UART. Move code which moves internal mvebu registers to this function.
And split configuration of DEBUG_UART_BASE into SPL and proper U-Boot
to allow setting different values which matches current HW status.

With all these changes, it is possible call "printf" function in
Turris Omnia's board_early_init_f() function in both SPL and proper
U-Boot.

Pali Rohár (5):
   arm: Add new config option ARCH_VERY_EARLY_INIT
   arm: mvebu: Move internal registers in arch_very_early_init() function
   serial: Add new config option SPL_DEBUG_UART_BASE
   serial: ns16550: Add support for SPL_DEBUG_UART_BASE
   arm: mvebu: turris_omnia: Fix DEBUG_UART_BASE

  arch/arm/Kconfig   |  6 ++
  arch/arm/lib/crt0.S|  5 +
  arch/arm/mach-mvebu/Kconfig|  1 +
  arch/arm/mach-mvebu/Makefile   |  1 +
  arch/arm/mach-mvebu/cpu.c  | 31 ---
  arch/arm/mach-mvebu/lowlevel.S | 27 +++
  configs/turris_omnia_defconfig |  3 ++-
  drivers/serial/Kconfig |  7 +++
  drivers/serial/ns16550.c   |  4 ++--
  9 files changed, 51 insertions(+), 34 deletions(-)
  create mode 100644 arch/arm/mach-mvebu/lowlevel.S


This patchset seems to introduce problems on some non-MVEBU platforms
like x86, chromebook_coral_defconfig:

drivers/serial/ns16550.c: In function ‘_debug_uart_init’:
././include/linux/kconfig.h:51:32: error: ‘CONFIG_TPL_DEBUG_UART_BASE’ 
undeclared (first use in this function); did you mean 
‘CONFIG_SPL_DEBUG_UART_BASE’?

   51 | #define __config_val(pfx, cfg) CONFIG_ ## pfx ## cfg
  |^~~
././include/linux/kconfig.h:50:32: note: in expansion of macro 
‘__config_val’

   50 | #define  _config_val(pfx, cfg) __config_val(pfx, cfg)
  |^~~~
././include/linux/kconfig.h:49:33: note: in expansion of macro ‘_config_val’
   49 | #define   config_val(cfg)   _config_val(_CONFIG_PREFIX, cfg)
  | ^~~
././include/linux/kconfig.h:61:29: note: in expansion of macro ‘config_val’
   61 | #define CONFIG_VAL(option)  config_val(option)
  | ^~
drivers/serial/ns16550.c:328:54: note: in expansion of macro ‘CONFIG_VAL’
  328 | struct ns16550 *com_port = (struct ns16550 
*)CONFIG_VAL(DEBUG_UART_BASE);

  |  ^~
././include/linux/kconfig.h:51:32: note: each undeclared identifier is 
reported only once for each function it appears in

   51 | #define __config_val(pfx, cfg) CONFIG_ ## pfx ## cfg
  |^~~
././include/linux/kconfig.h:50:32: note: in expansion of macro 
‘__config_val’

   50 | #define  _config_val(pfx, cfg) __config_val(pfx, cfg)
  |^~~~
././include/linux/kconfig.h:49:33: note: in expansion of macro ‘_config_val’
   49 | #define   config_val(cfg)   _config_val(_CONFIG_PREFIX, cfg)
  | ^~~
././include/linux/kconfig.h:61:29: note: in expansion of macro ‘config_val’
   61 | #define CONFIG_VAL(option)  config_val(option)
  | ^~
drivers/serial/ns16550.c:328:54: note: in expansion of macro ‘CONFIG_VAL’
  328 | struct ns16550 *com_port = (struct ns16550 
*)CONFIG_VAL(DEBUG_UART_BASE);

  |  ^~
drivers/serial/ns16550.c: In function ‘_debug_uart_putc’:
././include/linux/kconfig.h:51:32: error: ‘CONFIG_TPL_DEBUG_UART_BASE’ 
undeclared (first use in this function); did you mean 
‘CONFIG_SPL_DEBUG_UART_BASE’?

   51 | #define __config_val(pfx, cfg) CONFIG_ ## pfx ## cfg
  |^~~
././include/linux/kconfig.h:50:32: note: in expansion of macro 
‘__config_val’

   50 | #define  _config_val(pfx, cfg) __config_val(pfx, cfg)
  |^~~~
././include/linux/kconfig.h:49:33: note: in expansion of macro ‘_config_val’
   49 | #define   config_val(cfg)   _config_val(_CONFIG_PREFIX, cfg)
  | ^~~
././include/linux/kconfig.h:61:29: note: in expansion of macro ‘config_val’
   61 | #define CONFIG_VAL(option)  config_val(option)
  | ^~
drivers/serial/ns16550.c:363:54: note: in expansion of macro ‘CONFIG_VAL’
  363 | struct ns16550 *com_port = (struct ns16550 

[PATCH 0/5] arm: mvebu: turris_omnia: Fix hangup in debug UART

2022-05-06 Thread Pali Rohár
If proper U-Boot on Turris Omnia tries to print something on debug UART
then CPU hangs. Reason is that debug UART in proper U-Boot for Turris
Omnia has incorrect configuration of base register. Base register is
different in SPL and also in different stages of proper U-Boot.

Fix all these issues. Introduce new arch_very_early_init() ARM function
which will be called at very early stage prior initialization of debug
UART. Move code which moves internal mvebu registers to this function.
And split configuration of DEBUG_UART_BASE into SPL and proper U-Boot
to allow setting different values which matches current HW status.

With all these changes, it is possible call "printf" function in
Turris Omnia's board_early_init_f() function in both SPL and proper
U-Boot.

Pali Rohár (5):
  arm: Add new config option ARCH_VERY_EARLY_INIT
  arm: mvebu: Move internal registers in arch_very_early_init() function
  serial: Add new config option SPL_DEBUG_UART_BASE
  serial: ns16550: Add support for SPL_DEBUG_UART_BASE
  arm: mvebu: turris_omnia: Fix DEBUG_UART_BASE

 arch/arm/Kconfig   |  6 ++
 arch/arm/lib/crt0.S|  5 +
 arch/arm/mach-mvebu/Kconfig|  1 +
 arch/arm/mach-mvebu/Makefile   |  1 +
 arch/arm/mach-mvebu/cpu.c  | 31 ---
 arch/arm/mach-mvebu/lowlevel.S | 27 +++
 configs/turris_omnia_defconfig |  3 ++-
 drivers/serial/Kconfig |  7 +++
 drivers/serial/ns16550.c   |  4 ++--
 9 files changed, 51 insertions(+), 34 deletions(-)
 create mode 100644 arch/arm/mach-mvebu/lowlevel.S

-- 
2.20.1