Skip to contentSkip to conversation

arm: moxa: add nport6600 platform

PATCH In review Sergei Antonov 3 participants 7 messages Jul 31, 2023 – Aug 2, 2023 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm: moxa: add nport6600 platform

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.

---
 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
arch/arm/Kconfig +9 -0
index 97c25b4f146d..de5b746b93c9 100644
@@ -705,6 +705,14 @@ config TARGET_BCMNS3
 	  ARMv8 Cortex-A72 processors targeting a broad range of networking
 	  applications.
 
+config TARGET_NPORT6600
+	bool "Support NPort 6600"
+	select CPU_ARM720T
+	help
+	  Support for NPort 6600 Series RS-232/422/485 secure terminal servers.
+	  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.
+
 config ARCH_EXYNOS
 	bool "Samsung EXYNOS"
 	select DM
@@ -2312,6 +2320,7 @@ source "board/hisilicon/hikey960/Kconfig"
 source "board/hisilicon/poplar/Kconfig"
 source "board/isee/igep003x/Kconfig"
 source "board/kontron/sl28/Kconfig"
+source "board/moxa/nport6600/Kconfig"
 source "board/myir/mys_6ulx/Kconfig"
 source "board/samsung/common/Kconfig"
 source "board/siemens/common/Kconfig"
arch/arm/dts/nport6600.dts new file +134 -0

134 lines not on this page · raw message

board/moxa/nport6600/Kconfig new file +15 -0
new file mode 100644
index 000000000000..3094b380c0fd
@@ -0,0 +1,15 @@
+if TARGET_NPORT6600
+
+config SYS_BOARD
+	default "nport6600"
+
+config SYS_VENDOR
+	default "moxa"
+
+config SYS_SOC
+	default "moxa"
+
+config SYS_CONFIG_NAME
+	default "nport6600"
+
+endif
board/moxa/nport6600/MAINTAINERS new file +7 -0
new file mode 100644
index 000000000000..fca3d9d0dbfa
@@ -0,0 +1,7 @@
+NPORT6600 BOARD
+M:	Sergei Antonov <[email protected]>
+S:	Maintained
+F:	board/moxa/nport6600/
+F:	arch/arm/dts/nport6600.dts
+F:	include/configs/nport6600.h
+F:	configs/nport6600_defconfig
board/moxa/nport6600/Makefile new file +3 -0
new file mode 100644
index 000000000000..8d853eaa1a57
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+obj-y	:= nport6600.o
board/moxa/nport6600/nport6600.c new file +78 -0

78 lines not on this page · raw message

configs/nport6600_defconfig new file +129 -0

129 lines not on this page · raw message

include/configs/nport6600.h new file +13 -0
new file mode 100644
index 000000000000..c70cc7e1ac72
@@ -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
+
+#define __io
+
+#endif /* _CONFIG_NPORT6600_H */
Signature · 1 line
2.37.2
#1 lore raw
Quoted 10 lines · Sergei Antonov

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.

---
 arch/arm/Kconfig                 |   9 +++
 arch/arm/dts/nport6600.dts       | 134 +++++++++++++++++++++++++++++++

Where does the device tree come from?

board/moxa/nport6600/nport6600.c line 3

Quoted 9 lines
board/moxa/nport6600/nport6600.c new file +3 -0
new file mode 100644
index 000000000000..88fa98c315fd
@@ -0,0 +1,78 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include <common.h>

New files must not add common.h

Quoted 5 lines
include/configs/nport6600.h new file +0 -0
new file mode 100644
index 000000000000..c70cc7e1ac72

[snip]

Quoted 1 line

+#define __io

What's this for?

Signature · 1 line
Tom
#2 lore raw
Quoted 9 lines · Tom Rini
Quoted 6 lines · Sergei Antonov

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.

Quoted 6 lines
Quoted 4 lines
---
 arch/arm/Kconfig                 |   9 +++
 arch/arm/dts/nport6600.dts       | 134 +++++++++++++++++++++++++++++++

Where does the device tree come from?

From the datasheet, testing, and a similar dts in Linux:
https://github.com/torvalds/linux/tree/master/arch/arm/boot/dts/moxa

Quoted 9 lines

board/moxa/nport6600/nport6600.c line 3

Quoted 9 lines
board/moxa/nport6600/nport6600.c new file +3 -0
new file mode 100644
index 000000000000..88fa98c315fd
@@ -0,0 +1,78 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include <common.h>

OK. Compiles without it.

Quoted 11 lines

New files must not add common.h

Quoted 5 lines
include/configs/nport6600.h new file +0 -0
new file mode 100644
index 000000000000..c70cc7e1ac72

[snip]

Quoted 1 line

+#define __io

What's this for?

Removing it leads to warnings:

.../u-boot/drivers/serial/ns16550.c: In function ‘serial_out_dynamic’:
.../u-boot/drivers/serial/ns16550.c:111:17: warning: implicit declaration of function ‘outb’ [-Wimplicit-function-declaration]

  111 |                 outb(value, addr);
      |                 ^~~~

.../u-boot/drivers/serial/ns16550.c: In function ‘serial_in_dynamic’:
.../u-boot/drivers/serial/ns16550.c:131:24: warning: implicit declaration of function ‘inb’; did you mean ‘isb’? [-Wimplicit-function-declaration]

  131 |                 return inb(addr);
      |                        ^~~
      |                        isb

and then linking errors:

.../armv4/lib/gcc/armv4-linux-gnueabi/13.0.1/../../../../armv4-linux-gnueabi/bin/ld:
/tmp/ccIta0uJ.ltrans12.ltrans.o: in function `ns16550_writeb.isra.0':
.../u-boot/drivers/serial/ns16550.c:111: undefined reference to `outb' .../armv4/lib/gcc/armv4-linux-gnueabi/13.0.1/../../../../armv4-linux-gnueabi/bin/ld:
/tmp/ccIta0uJ.ltrans12.ltrans.o: in function `ns16550_readb.isra.0':
.../u-boot/drivers/serial/ns16550.c:131: undefined reference to `inb'

#3 lore raw
Quoted 15 lines · Sergei Antonov
Quoted 14 lines · Tom Rini
Quoted 10 lines · Sergei Antonov

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.

---
 arch/arm/Kconfig                 |   9 +++
 arch/arm/dts/nport6600.dts       | 134 +++++++++++++++++++++++++++++++
Quoted 4 lines
Quoted 1 line

Where does the device tree come from?

From the datasheet, testing, and a similar dts in Linux:
https://github.com/torvalds/linux/tree/master/arch/arm/boot/dts/moxa

It needs to be the same dts as in Linux, and re-synced periodically. The -u-boot.dtsi file can be used for changes that are still being staged to Linux, but shouldn't be used indefinitely.

Quoted 39 lines
Quoted 9 lines

board/moxa/nport6600/nport6600.c line 3

Quoted 9 lines
board/moxa/nport6600/nport6600.c new file +3 -0
new file mode 100644
index 000000000000..88fa98c315fd
@@ -0,0 +1,78 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include <common.h>

OK. Compiles without it.

Quoted 11 lines

New files must not add common.h

Quoted 5 lines
include/configs/nport6600.h new file +0 -0
new file mode 100644
index 000000000000..c70cc7e1ac72

[snip]

Quoted 1 line

+#define __io

What's this for?

Removing it leads to warnings:

.../u-boot/drivers/serial/ns16550.c: In function ‘serial_out_dynamic’:
.../u-boot/drivers/serial/ns16550.c:111:17: warning: implicit declaration of function ‘outb’ [-Wimplicit-function-declaration]

  111 |                 outb(value, addr);
      |                 ^~~~

.../u-boot/drivers/serial/ns16550.c: In function ‘serial_in_dynamic’:
.../u-boot/drivers/serial/ns16550.c:131:24: warning: implicit declaration of function ‘inb’; did you mean ‘isb’? [-Wimplicit-function-declaration]

  131 |                 return inb(addr);
      |                        ^~~
      |                        isb
Quoted 8 lines

and then linking errors:

.../armv4/lib/gcc/armv4-linux-gnueabi/13.0.1/../../../../armv4-linux-gnueabi/bin/ld:
/tmp/ccIta0uJ.ltrans12.ltrans.o: in function `ns16550_writeb.isra.0':
.../u-boot/drivers/serial/ns16550.c:111: undefined reference to `outb' .../armv4/lib/gcc/armv4-linux-gnueabi/13.0.1/../../../../armv4-linux-gnueabi/bin/ld:
/tmp/ccIta0uJ.ltrans12.ltrans.o: in function `ns16550_readb.isra.0':
.../u-boot/drivers/serial/ns16550.c:131: undefined reference to `inb'

Oh, you need to be enabling CONFIG_DM_SERIAL.

Signature · 1 line
Tom
#4 lore raw
Quoted 17 lines · Tom Rini
Quoted 15 lines · Sergei Antonov
Quoted 14 lines · Tom Rini
Quoted 10 lines · Sergei Antonov

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.

---
 arch/arm/Kconfig                 |   9 +++
 arch/arm/dts/nport6600.dts       | 134 +++++++++++++++++++++++++++++++
Quoted 8 lines
Quoted 4 lines
Quoted 1 line

Where does the device tree come from?

From the datasheet, testing, and a similar dts in Linux:
https://github.com/torvalds/linux/tree/master/arch/arm/boot/dts/moxa

It needs to be the same dts as in Linux, and re-synced periodically. The -u-boot.dtsi file can be used for changes that are still being staged to Linux, but shouldn't be used indefinitely.

There is no dts in Linux for the device (a family of devices) I am submitting. Linux has a dts for a similar device.

Quoted 41 lines
Quoted 41 lines
Quoted 9 lines

board/moxa/nport6600/nport6600.c line 3

Quoted 9 lines
board/moxa/nport6600/nport6600.c new file +3 -0
new file mode 100644
index 000000000000..88fa98c315fd
@@ -0,0 +1,78 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include <common.h>

OK. Compiles without it.

Quoted 11 lines

New files must not add common.h

Quoted 5 lines
include/configs/nport6600.h new file +0 -0
new file mode 100644
index 000000000000..c70cc7e1ac72

[snip]

Quoted 1 line

+#define __io

What's this for?

Removing it leads to warnings:

.../u-boot/drivers/serial/ns16550.c: In function ‘serial_out_dynamic’:
.../u-boot/drivers/serial/ns16550.c:111:17: warning: implicit declaration of function ‘outb’ [-Wimplicit-function-declaration]

  111 |                 outb(value, addr);
      |                 ^~~~

.../u-boot/drivers/serial/ns16550.c: In function ‘serial_in_dynamic’:
.../u-boot/drivers/serial/ns16550.c:131:24: warning: implicit declaration of function ‘inb’; did you mean ‘isb’? [-Wimplicit-function-declaration]

  131 |                 return inb(addr);
      |                        ^~~
      |                        isb

and then linking errors:

Quoted 8 lines
Quoted 6 lines

.../armv4/lib/gcc/armv4-linux-gnueabi/13.0.1/../../../../armv4-linux-gnueabi/bin/ld:
/tmp/ccIta0uJ.ltrans12.ltrans.o: in function `ns16550_writeb.isra.0':
.../u-boot/drivers/serial/ns16550.c:111: undefined reference to `outb' .../armv4/lib/gcc/armv4-linux-gnueabi/13.0.1/../../../../armv4-linux-gnueabi/bin/ld:
/tmp/ccIta0uJ.ltrans12.ltrans.o: in function `ns16550_readb.isra.0':
.../u-boot/drivers/serial/ns16550.c:131: undefined reference to `inb'

Oh, you need to be enabling CONFIG_DM_SERIAL.

It IS enabled.

#5 lore raw
Quoted 23 lines · Sergei Antonov
Quoted 22 lines · Tom Rini
Quoted 19 lines · Sergei Antonov
Quoted 9 lines · Tom Rini
Quoted 6 lines · Sergei Antonov

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.

Quoted 6 lines
Quoted 4 lines
---
 arch/arm/Kconfig                 |   9 +++
 arch/arm/dts/nport6600.dts       | 134 +++++++++++++++++++++++++++++++

Where does the device tree come from?

From the datasheet, testing, and a similar dts in Linux:
https://github.com/torvalds/linux/tree/master/arch/arm/boot/dts/moxa

Quoted 6 lines
Quoted 3 lines

It needs to be the same dts as in Linux, and re-synced periodically. The -u-boot.dtsi file can be used for changes that are still being staged to Linux, but shouldn't be used indefinitely.

There is no dts in Linux for the device (a family of devices) I am submitting. Linux has a dts for a similar device.

Please upstream the device tree.

Quoted 48 lines
Quoted 48 lines
Quoted 47 lines
Quoted 9 lines

board/moxa/nport6600/nport6600.c line 3

Quoted 9 lines
board/moxa/nport6600/nport6600.c new file +3 -0
new file mode 100644
index 000000000000..88fa98c315fd
@@ -0,0 +1,78 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include <common.h>

OK. Compiles without it.

Quoted 11 lines

New files must not add common.h

Quoted 5 lines
include/configs/nport6600.h new file +0 -0
new file mode 100644
index 000000000000..c70cc7e1ac72

[snip]

Quoted 1 line

+#define __io

What's this for?

Removing it leads to warnings:

.../u-boot/drivers/serial/ns16550.c: In function ‘serial_out_dynamic’:
.../u-boot/drivers/serial/ns16550.c:111:17: warning: implicit declaration of function ‘outb’ [-Wimplicit-function-declaration]

  111 |                 outb(value, addr);
      |                 ^~~~

.../u-boot/drivers/serial/ns16550.c: In function ‘serial_in_dynamic’:
.../u-boot/drivers/serial/ns16550.c:131:24: warning: implicit declaration of function ‘inb’; did you mean ‘isb’? [-Wimplicit-function-declaration]

  131 |                 return inb(addr);
      |                        ^~~
      |                        isb

and then linking errors:

.../armv4/lib/gcc/armv4-linux-gnueabi/13.0.1/../../../../armv4-linux-gnueabi/bin/ld:
/tmp/ccIta0uJ.ltrans12.ltrans.o: in function `ns16550_writeb.isra.0':
.../u-boot/drivers/serial/ns16550.c:111: undefined reference to `outb' .../armv4/lib/gcc/armv4-linux-gnueabi/13.0.1/../../../../armv4-linux-gnueabi/bin/ld:
/tmp/ccIta0uJ.ltrans12.ltrans.o: in function `ns16550_readb.isra.0':
.../u-boot/drivers/serial/ns16550.c:131: undefined reference to `inb'

Quoted 3 lines
Quoted 1 line

Oh, you need to be enabling CONFIG_DM_SERIAL.

It IS enabled.

Oh, I see it now, you're right, sorry. But, is CONFIG_NS16550_DYNAMIC really the only choice here?

Signature · 1 line
Tom
#6 lore raw
In reply to Sergei Antonov

Hi Sergei,

Quoted 26 lines · Sergei Antonov

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.

---
 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

[..]

Quoted 24 lines
board/moxa/nport6600/Makefile new file +3 -0
new file mode 100644
index 000000000000..8d853eaa1a57
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+obj-y  := nport6600.o
board/moxa/nport6600/nport6600.c new file +9 -0
new file mode 100644
index 000000000000..88fa98c315fd
@@ -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)

board/moxa/nport6600/nport6600.c line 19

Quoted 10 lines
board/moxa/nport6600/nport6600.c new file +10 -0
+{
+       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?

Quoted 25 lines
board/moxa/nport6600/nport6600.c new file +25 -0
+{
+       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;

board/moxa/nport6600/nport6600.c line 54

Quoted 10 lines
board/moxa/nport6600/nport6600.c new file +10 -0
+
+       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
?

Quoted 24 lines
board/moxa/nport6600/nport6600.c new file +24 -0
+       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();
+}

[..]

board/moxa/nport6600/nport6600.c line 9

Quoted 11 lines

+++ b/include/configs/nport6600.h

board/moxa/nport6600/nport6600.c new file +9 -0
@@ -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?

Quoted 7 lines
board/moxa/nport6600/nport6600.c new file +4 -1
+
+#define __io
+
+#endif /* _CONFIG_NPORT6600_H */
--

2.37.2

Regards,
Simon