Converting to DM SERIAL for Kirkwood boards

Tony Dinh mibodhi at gmail.com
Fri Dec 23 07:34:52 CET 2022


Hi Stefan,


On Thu, Dec 15, 2022 at 10:29 PM Stefan Roese <sr at denx.de> wrote:
>
> Hi Tony,
>
> On 12/16/22 03:42, Tony Dinh wrote:
> > Hi all,
> >
> > On Mon, Dec 12, 2022 at 5:18 PM Tony Dinh <mibodhi at gmail.com> wrote:
> >>
> >> Hi Michael,
> >>
> >> On Mon, Dec 12, 2022 at 1:03 AM Michael Walle <michael at walle.cc> wrote:
> >>>
> >>>>> On 12/9/22 04:55, Tony Dinh wrote:
> >>>>>> Hi Simon et al,
> >>>>>>
> >>>>>> (Resend to include u-boot mailing list)
> >>>>>>
> >>>>>> I'm in the process of converting Kirkwood boards to use DM SERIAL. I
> >>>>>> could not seem to get it to work, having tried adding
> >>>>>> CONFIG_DM_SERIAL, and also playing with various  related CONFIG
> >>>>>> options  (CONFIG_SPECIFY_CONSOLE_INDEX and CONFIG_CONS_INDEX ). From
> >>>>>> my reading various board configurations that were already converted to
> >>>>>> DM_SERIAL, I'm under the impression that just turning on
> >>>>>> CONFIG_DM_SERIAL would work without any other addition.
> >>>>>>
> >>>>>> The board I'm testing is Zyxel NSA310S Kirkwood 6702 (6192) SoC.
> >>>>>>
> >>>>>> diff --git a/configs/nsa310s_defconfig b/configs/nsa310s_defconfig
> >>>>>> index afa0cad041..e81d1495bd 100644
> >>>>>> --- a/configs/nsa310s_defconfig
> >>>>>> +++ b/configs/nsa310s_defconfig
> >>>>>> @@ -41,7 +41,6 @@ CONFIG_ENV_OVERWRITE=y
> >>>>>>    CONFIG_ENV_IS_IN_NAND=y
> >>>>>>    CONFIG_SYS_RELOC_GD_ENV_ADDR=y
> >>>>>>    CONFIG_NET_RANDOM_ETHADDR=y
> >>>>>> -CONFIG_NETCONSOLE=y
> >>>>>>    CONFIG_SYS_FAULT_ECHO_LINK_DOWN=y
> >>>>>>    CONFIG_SATA_MV=y
> >>>>>>    CONFIG_SYS_SATA_MAX_DEVICE=1
> >>>>>> @@ -53,6 +52,7 @@ CONFIG_MTD_RAW_NAND=y
> >>>>>>    CONFIG_PHY_MARVELL=y
> >>>>>>    CONFIG_MVGBE=y
> >>>>>>    CONFIG_MII=y
> >>>>>> +CONFIG_DM_SERIAL=y
> >>>>>>    CONFIG_SYS_NS16550=y
> >>>>>>    CONFIG_USB=y
> >>>>>>    CONFIG_USB_EHCI_HCD=y
> >>>>>>
> >>>>>> I also added kirkwood-nsa310s-u-boot.dtsi to help in running kwboot.
> >>>>>>
> >>>>>> &uart0 {
> >>>>>> u-boot,dm-pre-reloc;
> >>>>>> };
> >>>>>>
> >>>>>> I've tried kwboot the new u-boot image, and also flashed this image to
> >>>>>> NAND, and in both cases, I got a silent serial console. It seems to
> >>>>>> hang up right off the bat. Hope you can help by giving me some
> >>>>>> pointers on how to debug this.
> >>>>>
> >>>>> Might be that the alias is missing and / or that the uart DT node is
> >>>>> not enabled. Please give this test-only patch a try:
> >>>>>
> >>>>> diff --git a/arch/arm/dts/kirkwood-nsa310s.dts
> >>>>> b/arch/arm/dts/kirkwood-nsa310s.dts
> >>>>> index 09ee76c2a2e0..ca7a49af9ba4 100644
> >>>>> --- a/arch/arm/dts/kirkwood-nsa310s.dts
> >>>>> +++ b/arch/arm/dts/kirkwood-nsa310s.dts
> >>>>> @@ -17,6 +17,10 @@
> >>>>>           model = "Zyxel NSA310S";
> >>>>>           compatible = "zyxel,nsa320s", "marvell,kirkwood-88f6702",
> >>>>> "marvell,kirkwood";
> >>>>>
> >>>>> +       aliases {
> >>>>> +               serial0 = &uart0;
> >>>>> +       };
> >>>>> +
> >>>>>           memory {
> >>>>>                   device_type = "memory";
> >>>>>                   reg = <0x00000000 0x10000000>;
> >>>>> @@ -317,3 +321,8 @@
> >>>>>    &pcie0 {
> >>>>>           status = "okay";
> >>>>>    };
> >>>>> +
> >>>>> +&uart0 {
> >>>>> +       status = "okay";
> >>>>> +       u-boot,dm-pre-reloc;
> >>>>> +};
> >>>>
> >>>> Thanks for the patch! but the behavior is still the same (silent
> >>>> serial console and hung the board).
> >>>>
> >>>> Thanks,
> >>>> Tony
> >>>
> >>> Maybe this will help:
> >>> https://lore.kernel.org/u-boot/20220817193809.1059688-20-michael@walle.cc/
> >>>
> >>> The lsxl is also a kirkwood based board.
> >>>
> >>
> >> Thanks! indeed that was the malloc problem. This NSA310S board is now
> >> working with DM_SERIAL.
> >>
> >> I will test a few more Kirkwood boards and keep everybody posted.
> >
> > Closing the loop on this DM_SERIAL conversion for Kirkwood.
> >
> > I've tested DM_SERIAL with Michael's malloc patches on a few other
> > Kirkwood boards. They're all working fine with u-boot-2023.01-rc3.
>
> Good to know. I assume that you will post some patches for these
> Kirkwood board soon? Or even better, making the necessary changes
> for Kirkwood in general in Kconfig (if possible).

Here is a RFC patch to convert Kirkwood boards to DM_SERIAL and also
set up the boards using Michael's approach for the
CUSTOM_SYS_INIT_SP_ADDR. I'm not sure this is the best way to do it,
so I thought I should run it by this list first to see if I'm on the
right track.

My rationale is that even though HAS_CUSTOM_SYS_INIT_SP_ADDR and
CUSTOM_SYS_INIT_SP_ADDR are already defined in top level ./Kconfig,
the value CUSTOM_SYS_INIT_SP_ADDR=0x5ff000 belongs in the
./arch/arm/mach-kirkwood/Kconfig. And note that it will work
regardless whether DM_SERIAL is enabled or not.

And since we are still converting the boards to DM_SERIAL, during the
transition it should be up to the individual maintainer to do it. Once
the mandatory deadline is over, we can turn it on wholesale in
arch/arm/mach-kirkwood/Kconfig (by enabling CONFIG_KIRKWOOD_COMMON for
each board).

diff --git a/arch/arm/mach-kirkwood/Kconfig b/arch/arm/mach-kirkwood/Kconfig
index c8a193dd4c..45cc932636 100644
--- a/arch/arm/mach-kirkwood/Kconfig
+++ b/arch/arm/mach-kirkwood/Kconfig
@@ -12,6 +12,19 @@ config KW88F6281
 config SHEEVA_88SV131
  bool

+config KIRKWOOD_COMMON
+ bool
+ select DM_SERIAL
+
+config HAS_CUSTOM_SYS_INIT_SP_ADDR
+        bool "Use a custom location for the initial stack pointer address"
+        default y
+
+config CUSTOM_SYS_INIT_SP_ADDR
+        hex "Static location for the initial stack pointer"
+        depends on HAS_CUSTOM_SYS_INIT_SP_ADDR
+        default 0x5ff000
+
 choice
  prompt "Marvell Kirkwood board select"
  optional
@@ -25,6 +38,7 @@ config TARGET_DREAMPLUG
  bool "DreamPlug Board"
  select KW88F6281
  select SHEEVA_88SV131
+ select KIRKWOOD_COMMON

 config TARGET_DS109
  bool "Synology DS109"
@@ -40,6 +54,7 @@ config TARGET_SHEEVAPLUG
  bool "SheevaPlug Board"
  select FEROCEON_88FR131
  select KW88F6281
+ select KIRKWOOD_COMMON

 config TARGET_LSXL
  bool "lsxl Board"
@@ -47,16 +62,19 @@ config TARGET_LSXL
  select KW88F6281
  select BOARD_EARLY_INIT_R
  select MISC_INIT_R
+ select KIRKWOOD_COMMON

 config TARGET_POGO_E02
  bool "pogo_e02 Board"
  select FEROCEON_88FR131
  select KW88F6281
+ select KIRKWOOD_COMMON

 config TARGET_POGO_V4
  bool "Pogoplug V4 Board"
  select FEROCEON_88FR131
  select KW88F6192
+ select KIRKWOOD_COMMON

 config TARGET_DNS325
  bool "dns325 Board"
@@ -67,6 +85,7 @@ config TARGET_ICONNECT
  bool "iconnect Board"
  select FEROCEON_88FR131
  select KW88F6281
+ select KIRKWOOD_COMMON

 config TARGET_KM_KIRKWOOD
  bool "KM Kirkwood Board"
@@ -92,11 +111,13 @@ config TARGET_DOCKSTAR
  bool "Dockstar Board"
  select FEROCEON_88FR131
  select KW88F6281
+ select KIRKWOOD_COMMON

 config TARGET_GOFLEXHOME
  bool "GoFlex Home Board"
  select FEROCEON_88FR131
  select KW88F6281
+ select KIRKWOOD_COMMON

 config TARGET_NAS220
  bool "BlackArmor NAS220"
@@ -107,6 +128,7 @@ config TARGET_NSA310S
  bool "Zyxel NSA310S"
  select FEROCEON_88FR131
  select KW88F6192
+ select KIRKWOOD_COMMON

 config TARGET_SBx81LIFKW
  bool "Allied Telesis SBx81GS24/SBx81GT40/SBx81XS6/SBx81XS16"


Thanks,
Tony




>
> Thanks,
> Stefan
>
> > NSA310s
> > Dreamplug
> > Sheevaplug
> > GFHome
> > Dockstar
> > iConnect
> > Pogo E02
> > Pogo V4 (tested with u-boot-2022.10, since Pogo V4 itself was broken
> > in u-boot-2023.01-rc3 for unknown reason).
> >
> > All the best,
> > Tony
>
> Viele Grüße,
> Stefan Roese
>
> --
> DENX Software Engineering GmbH,      Managing Director: Erika Unter
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr at denx.de


More information about the U-Boot mailing list