[PATCH] arm: moxa: add nport6600 platform

Simon Glass sjg at chromium.org
Wed Aug 2 23:31:38 CEST 2023


Hi Sergei,

On Mon, 31 Jul 2023 at 12:43, Sergei Antonov <saproj at gmail.com> wrote:
>
> Support for NPort 6600 Series RS-232/422/485 secure terminal servers.
>
> Technical specifications:
> FA526 ARMv4 CPU, 64 MB of RAM, 16 MB NOR flash, 100 Mbit/s Ethernet,
> optional expansion modules, up to 32 RS-232/422/485 ports.
>
> Signed-off-by: Sergei Antonov <saproj at gmail.com>
> ---
>  arch/arm/Kconfig                 |   9 +++
>  arch/arm/dts/nport6600.dts       | 134 +++++++++++++++++++++++++++++++
>  board/moxa/nport6600/Kconfig     |  15 ++++
>  board/moxa/nport6600/MAINTAINERS |   7 ++
>  board/moxa/nport6600/Makefile    |   3 +
>  board/moxa/nport6600/nport6600.c |  78 ++++++++++++++++++
>  configs/nport6600_defconfig      | 129 +++++++++++++++++++++++++++++
>  include/configs/nport6600.h      |  13 +++
>  8 files changed, 388 insertions(+)
>  create mode 100644 arch/arm/dts/nport6600.dts
>  create mode 100644 board/moxa/nport6600/Kconfig
>  create mode 100644 board/moxa/nport6600/MAINTAINERS
>  create mode 100644 board/moxa/nport6600/Makefile
>  create mode 100644 board/moxa/nport6600/nport6600.c
>  create mode 100644 configs/nport6600_defconfig
>  create mode 100644 include/configs/nport6600.h
>

[..]

> diff --git a/board/moxa/nport6600/Makefile b/board/moxa/nport6600/Makefile
> new file mode 100644
> index 000000000000..8d853eaa1a57
> --- /dev/null
> +++ b/board/moxa/nport6600/Makefile
> @@ -0,0 +1,3 @@
> +# SPDX-License-Identifier: GPL-2.0-or-later
> +
> +obj-y  := nport6600.o
> diff --git a/board/moxa/nport6600/nport6600.c b/board/moxa/nport6600/nport6600.c
> new file mode 100644
> index 000000000000..88fa98c315fd
> --- /dev/null
> +++ b/board/moxa/nport6600/nport6600.c
> @@ -0,0 +1,78 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +
> +#include <common.h>
> +#include <init.h>
> +#include <env.h>
> +#include <cpu_func.h>
> +#include <string.h>
> +
> +int dram_init(void)
> +{
> +       return fdtdec_setup_mem_size_base();
> +}
> +
> +int board_init(void)
> +{
> +       return 0;
> +}
> +
> +int show_board_info(void)

Can you use the sysinfo API and command instead?

> +{
> +       const u8 *NPORT_EXPANSION_MODULE = (const u8 *)0x8c0000c0;
> +       const unsigned int module_id = *NPORT_EXPANSION_MODULE;
> +       static const char * const modules[] = {
> +               NULL,
> +               "NM-TX01",
> +               "NM-FX01-M-SC",
> +               "NM-FX01-S-SC",
> +               NULL,
> +               "NM-FX02-M-SC",
> +               "NM-FX02-S-SC",
> +               "NM_GPRS",
> +               "NM-TX02",
> +       };
> +
> +       /* Check for Module */
> +       if (module_id < ARRAY_SIZE(modules) && modules[module_id])
> +               printf("Expansion module %s detected\n", modules[module_id]);
> +
> +       return 0;
> +}
> +
> +static int read_net_params(void)
> +{
> +       const u8 *MAC_ADDR = (const u8 *)0x80000050;
> +
> +       if (eth_env_set_enetaddr("ethaddr", MAC_ADDR))
> +               return -1;
> +
> +       return 0;
> +}
> +
> +int misc_init_r(void)
> +{
> +       const char *SERIAL_STR = (const char *)0x80000034;

Is that in the devicetree
?

> +       const unsigned int SERIAL_LEN = 12;
> +       char str[SERIAL_LEN + 1];
> +
> +       if (*SERIAL_STR) {
> +               memcpy(str, SERIAL_STR, SERIAL_LEN);
> +               str[SERIAL_LEN] = 0;
> +       } else {
> +               /* No serial string. Resort to a 2-byte serial number. */
> +               const u16 *SERIAL_NO = (const u16 *)0x8000004c;
> +
> +               sprintf(str, "%05u", *SERIAL_NO);
> +       }
> +
> +       if (env_set("serial#", str))
> +               return -1;
> +
> +       return read_net_params();
> +}
> +
> +void enable_caches(void)
> +{
> +       icache_enable();
> +       dcache_enable();
> +}

[..]

> +++ b/include/configs/nport6600.h
> @@ -0,0 +1,13 @@
> +/* SPDX-License-Identifier: GPL-2.0-or-later */
> +
> +#ifndef _CONFIG_NPORT6600_H
> +#define _CONFIG_NPORT6600_H
> +
> +#include <linux/sizes.h>
> +
> +#define CFG_SYS_INIT_RAM_ADDR 0
> +#define CFG_SYS_INIT_RAM_SIZE SZ_64M

What code uses this? I suppose it is SoC-specific?

> +
> +#define __io
> +
> +#endif /* _CONFIG_NPORT6600_H */
> --
> 2.37.2
>

Regards,
Simon


More information about the U-Boot mailing list