Skip to contentSkip to conversation

Add Fieldbus subsystem + support HMS Profinet card

PATCH Superseded Sven Van Asbroeck 7 participants 34 messages Apr 9, 2019 – Apr 29, 2019

Subsystems (5)

v10 of 11 Superseded Latest is v11 →

lore
Share & tools
lore
#0 lore raw

v10 cover Add Fieldbus subsystem + support HMS Profinet card

This patch:
1. adds a Fieldbus subsystem
2. adds support for the HMS Industrial Networks AB Profinet card.

1. Fieldbus subsystem
---------------------

Fieldbus device (client) adapters allow data exchange with a PLC aka. "Fieldbus Controller" over a fieldbus (Profinet, FLNet, etc.) They are typically used when a Linux device wants to expose itself as an actuator, motor, console light, switch, etc. over the fieldbus. The framework is designed to provide a generic interface to Fieldbus Devices from both the Linux Kernel and the userspace.

2. Add support for HMS Profinet Card
------------------------------------

Profinet is an industry technical standard for data communication over Industrial Ethernet, designed for collecting data from, and controlling, equipment in industrial systems, with a particular strength in delivering data under tight time constraints (on the order of 1ms or less).

The profinet card itself is connected to the system via an industrial bus called 'anybus'.

I have followed the bus driver/client driver pattern, and created an anybus bus driver, plus a client driver for the profinet card.

In case this patch set gets (eventually) accepted, drivers for other anybus client cards may follow: flnet, cc-link, ...

The anybus slot on the host is located on an 'anybus controller', which is custom h/w designed by arcx. It exposes a dual anybus host implementation, plus a power readout unrelated to the anybus.

v10:
add a TODO file on how to take this patch set out of staging fix linker errors on defconfigs without HAS_IOMEM or REGULATOR

v9:
Moved everything to staging/ so new userspace ABI can still be tweaked Suggested cross-posting to linux-netdev to widen audience Greg KH: call ida_destroy() on module exits
replace arcx anybus controller's reset spinlock with mutex
(no need for spinlock as never run in atomic context) udelay() can now be replaced with usleep_range()
harmonized email addresses across patchset
various whitespace changes to silence checkpatch.pl --strict

v8:
allow fieldbus core to be built as a module (define as tristate). use IS_ENABLED() in fieldbus_dev.h to conditionally compile dummy functions. anybuss_core.ko uses symbols from fieldbus_dev.ko. Use "top level kbuild
file" method to make this work.
See Documentation/kbuild/modules.txt, section 6.3
Confirm licence choice: GPL-v2 only. no changes.

v7:
use %zu printf formatter to display size_t

v6:
Randy Dunlap:
correctly/consistently indent Kconfig
spelling/punctuation improvements

Greg KH:
suggestion: simplify /sys/class/fieldbus_dev/fieldbus_devX/ -> /sys/class/fieldbus_dev/X/
can't simplify: create_device() also determines the name of the associated char device. simplification would result in a char device named /dev/X ?
applied above suggestion to arcx-controller driver, this works ok as it does not
have associated char device
class name left as-is (fieldbus_dev) to differentiate between
"fieldbus controller" and "fieldbus device" in the future
makefile clean-up
sysfs attributes: snprintf -> sprintf
except card_name, as it's externally provided and could potentially be > PAGE_SIZE
enabled/online sysfs attributes converted to "0/1" values
using kstrtobool()

v5:
Greg KH:
fix licence nit
consistent use of e-mail address
replaced raw sysfs attribute with kobject_uevent() call keep __ATTRIBUTE_GROUPS because we need is_visible field
Rob Herring:
controller devicetree entry now requires multiple address
regions and interrupts
controller child node(s) now mapped to child devices by
slot/host position (using devicetree reg = <>)
architectural overhaul to align closely to existing pci arch:

pci anybus
--------------------------------------------------------------------------------
Common bus code (spec), pci/pci_driver.c anybus/dev_core.c
calls bus_register() no of compatible no of compatible
--------------------------------------------------------------------------------
Device on bus, calls
XXX_client_driver_register() hwmon/k8temp.c fieldbus/hms-profinet.c
--------------------------------------------------------------------------------
Controller, silicon driver pci/pcie-tango.c anybus/arcx-anybus.c
platform_driver calls platform_driver calls
pci_host_probe() anybus_host_common_probe()

v4:
general
create fieldbus_dev subsystem, with standardized 'simple'
userspace interface (sysfs + cdev)
remove redundant __packed keywords
use __be16/32 types wherever values are explicitly big-endian
hms-profinet:
remove configuration code, and uapi headers: not supported (yet)
when registering as a fieldbus_dev.
anybuss-host:
use struct kref to reference-count tasks
replace busy loops with usleep_range() loop after 10 tries use threaded irq so time_before_eq(jiffies, timeout) will
continue to work
allow client devices to be assigned a devicetree node,
in the same way as pci/mmc/...

v3:
devicetree-bindings
adding the vendor prefix is now a separate commit
anybus-bridge:
moved misc driver to drivers/bus/ converted of_gpio_* to gpiod_* abstractions can power readout is now a fixed-voltage regulator
anybuss-host:
converted refcounts from atomic_t to refcount_t fixed potential use-after-free
hms-profinet:
applied minor kernel build robot suggestion

v2:
added architecture overview comments to host driver completely reworked anybus-bridge driver, it becomes a reset controller anybuss-host driver now needs devicetree entry, link to reset controller I will hold off on kernel-doc until the overall architecture gets
more validation / approval
fixed Kconfig, comment-style, document ioctl magic numbers removed redundant pwm dependency
renamed enable-gpios to reset-gpios
stop driving reset-gpio after unloading driver
use interrupt-parent / interrupts method to describe interrupts
in the devicetree
convert references 'i.MX WEIM parallel bus' to 'parallel bus' replace devicetree functions with more generic platform_get_resource()
platform_get_irq()
added device unique data to add_device_randomness()

v1:
first shot

Sven Van Asbroeck (7):
fieldbus_dev: add Fieldbus Device subsystem.
anybus-s: support HMS Anybus-S bus
anybus-s: support the Arcx anybus controller
dt-bindings: anybus-controller: document devicetree binding
dt-bindings: Add vendor prefix for arcx / Archronix
fieldbus_dev: support HMS Profinet IRT industrial controller
staging: fieldbus_dev: add TODO

 Documentation/ABI/testing/fieldbus-dev-cdev   |   31 +
 .../ABI/testing/sysfs-class-fieldbus-dev      |   62 +
 .../fieldbus/arcx,anybus-controller.txt       |   71 +
 .../devicetree/bindings/vendor-prefixes.txt   |    1 +
 Documentation/fieldbus_dev/fieldbus_dev.txt   |   66 +
 drivers/staging/Kconfig                       |    2 +
 drivers/staging/Makefile                      |    1 +
 drivers/staging/fieldbus/Kconfig              |   18 +
 drivers/staging/fieldbus/Makefile             |    7 +
 drivers/staging/fieldbus/TODO                 |    5 +
 drivers/staging/fieldbus/anybuss/Kconfig      |   39 +
 drivers/staging/fieldbus/anybuss/Makefile     |   10 +
 .../staging/fieldbus/anybuss/arcx-anybus.c    |  398 +++++
 .../staging/fieldbus/anybuss/hms-profinet.c   |  224 +++
 drivers/staging/fieldbus/anybuss/host.c       | 1459 +++++++++++++++++
 drivers/staging/fieldbus/dev_core.c           |  349 ++++
 include/linux/anybuss-client.h                |  102 ++
 include/linux/anybuss-controller.h            |   47 +
 include/linux/fieldbus_dev.h                  |  106 ++
 19 files changed, 2998 insertions(+)
 create mode 100644 Documentation/ABI/testing/fieldbus-dev-cdev
 create mode 100644 Documentation/ABI/testing/sysfs-class-fieldbus-dev
 create mode 100644 Documentation/devicetree/bindings/fieldbus/arcx,anybus-controller.txt
 create mode 100644 Documentation/fieldbus_dev/fieldbus_dev.txt
 create mode 100644 drivers/staging/fieldbus/Kconfig
 create mode 100644 drivers/staging/fieldbus/Makefile
 create mode 100644 drivers/staging/fieldbus/TODO
 create mode 100644 drivers/staging/fieldbus/anybuss/Kconfig
 create mode 100644 drivers/staging/fieldbus/anybuss/Makefile
 create mode 100644 drivers/staging/fieldbus/anybuss/arcx-anybus.c
 create mode 100644 drivers/staging/fieldbus/anybuss/hms-profinet.c
 create mode 100644 drivers/staging/fieldbus/anybuss/host.c
 create mode 100644 drivers/staging/fieldbus/dev_core.c
 create mode 100644 include/linux/anybuss-client.h
 create mode 100644 include/linux/anybuss-controller.h
 create mode 100644 include/linux/fieldbus_dev.h
Signature · 1 line
2.17.1
#1 lore raw

PATCH v10 1/7 fieldbus_dev: add Fieldbus Device subsystem.

Fieldbus device (client) adapters allow data exchange with a PLC aka. "Fieldbus Controller" over a fieldbus (Profinet, FLNet, etc.)

They are typically used when a Linux device wants to expose itself as an actuator, motor, console light, switch, etc. over the fieldbus.

This framework is designed to provide a generic interface to Fieldbus Devices from both the Linux Kernel and the userspace.

---
 Documentation/ABI/testing/fieldbus-dev-cdev   |  31 ++
 .../ABI/testing/sysfs-class-fieldbus-dev      |  62 ++++
 Documentation/fieldbus_dev/fieldbus_dev.txt   |  66 ++++
 drivers/staging/Kconfig                       |   2 +
 drivers/staging/Makefile                      |   1 +
 drivers/staging/fieldbus/Kconfig              |  19 +
 drivers/staging/fieldbus/Makefile             |   9 +
 drivers/staging/fieldbus/dev_core.c           | 349 ++++++++++++++++++
 include/linux/fieldbus_dev.h                  | 106 ++++++
 9 files changed, 645 insertions(+)
 create mode 100644 Documentation/ABI/testing/fieldbus-dev-cdev
 create mode 100644 Documentation/ABI/testing/sysfs-class-fieldbus-dev
 create mode 100644 Documentation/fieldbus_dev/fieldbus_dev.txt
 create mode 100644 drivers/staging/fieldbus/Kconfig
 create mode 100644 drivers/staging/fieldbus/Makefile
 create mode 100644 drivers/staging/fieldbus/dev_core.c
 create mode 100644 include/linux/fieldbus_dev.h
Documentation/ABI/testing/fieldbus-dev-cdev new file +31 -0
new file mode 100644
index 000000000000..45f631ea32a6
@@ -0,0 +1,31 @@
+What:		/dev/fieldbus_devX
+Date:		December 2018
+KernelVersion:	5.1 (staging)
+Contact:	Sven Van Asbroeck <[email protected]>
+Description:
+		The cdev interface to drivers for Fieldbus Device Memory
+			(aka. Process Memory).
+
+		The following file operations are supported:
+
+		open(2)
+		Create an I/O context associated with the file descriptor.
+
+		read(2)
+		Read from Process Memory's "read area".
+		Clears POLLERR | POLLPRI from the file descriptor.
+
+		write(2)
+		Write to Process Memory's "write area".
+
+		poll(2), select(2), epoll_wait(2) etc.
+		When a "Process Memory Read Area Changed" event occurs,
+		POLLERR | POLLPRI will be set on the file descriptor.
+		Note that POLLIN | POLLOUT events are always set, because the
+		process memory area is always readable and writable.
+
+		close(2)
+		Free up the I/O context that was associated
+		with the file descriptor.
+
+Users:		TBD
Documentation/ABI/testing/sysfs-class-fieldbus-dev new file +62 -0

62 lines not on this page · raw message

Documentation/fieldbus_dev/fieldbus_dev.txt new file +66 -0

66 lines not on this page · raw message

drivers/staging/Kconfig +2 -0
index 62951e836cbc..da58314732e1 100644
@@ -122,4 +122,6 @@ source "drivers/staging/axis-fifo/Kconfig"
 
 source "drivers/staging/erofs/Kconfig"
 
+source "drivers/staging/fieldbus/Kconfig"
+
 endif # STAGING
drivers/staging/Makefile +1 -0
index d1b17ddcd354..ded12bdeb1a6 100644
@@ -51,3 +51,4 @@ obj-$(CONFIG_SOC_MT7621)	+= mt7621-dts/
 obj-$(CONFIG_STAGING_GASKET_FRAMEWORK)	+= gasket/
 obj-$(CONFIG_XIL_AXIS_FIFO)	+= axis-fifo/
 obj-$(CONFIG_EROFS_FS)		+= erofs/
+obj-$(CONFIG_FIELDBUS_DEV)     += fieldbus/
drivers/staging/fieldbus/Kconfig new file +19 -0
new file mode 100644
index 000000000000..b1d071cb096e
@@ -0,0 +1,19 @@
+menuconfig FIELDBUS_DEV
+	tristate "Fieldbus Device Support"
+	help
+	  Support for Fieldbus Device Adapters.
+
+	  Fieldbus device (client) adapters allow data exchange with a PLC aka.
+	  "Fieldbus Controller" over a fieldbus (Profinet, FLNet, etc.)
+
+	  They are typically used when a Linux device wants to expose itself
+	  as an actuator, motor, console light, switch, etc. over the fieldbus.
+
+	  This framework is designed to provide a generic interface to Fieldbus
+	  Devices from both the Linux Kernel and the userspace.
+
+	  If unsure, say no.
+
+if FIELDBUS_DEV
+
+endif
drivers/staging/fieldbus/Makefile new file +9 -0
new file mode 100644
index 000000000000..23877def5803
@@ -0,0 +1,9 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# Makefile for fieldbus_dev drivers.
+#
+
+obj-$(CONFIG_FIELDBUS_DEV)	+= fieldbus_dev.o
+fieldbus_dev-y			:= dev_core.o
+
+# Devices
drivers/staging/fieldbus/dev_core.c new file +349 -0

349 lines not on this page · raw message

include/linux/fieldbus_dev.h new file +106 -0

106 lines not on this page · raw message

Signature · 1 line
2.17.1
maintainer
#2 lore raw

Re: [PATCH v10 1/7] fieldbus_dev: add Fieldbus Device subsystem.

Quoted 10 lines · Sven Van Asbroeck

Fieldbus device (client) adapters allow data exchange with a PLC aka. "Fieldbus Controller" over a fieldbus (Profinet, FLNet, etc.)

They are typically used when a Linux device wants to expose itself as an actuator, motor, console light, switch, etc. over the fieldbus.

This framework is designed to provide a generic interface to Fieldbus Devices from both the Linux Kernel and the userspace.

Quoted 10 lines
---
 Documentation/ABI/testing/fieldbus-dev-cdev   |  31 ++
 .../ABI/testing/sysfs-class-fieldbus-dev      |  62 ++++
 Documentation/fieldbus_dev/fieldbus_dev.txt   |  66 ++++
 drivers/staging/Kconfig                       |   2 +
 drivers/staging/Makefile                      |   1 +
 drivers/staging/fieldbus/Kconfig              |  19 +
 drivers/staging/fieldbus/Makefile             |   9 +
 drivers/staging/fieldbus/dev_core.c           | 349 ++++++++++++++++++
 include/linux/fieldbus_dev.h                  | 106 ++++++

Please keep all staging code self-contained within your drivers/staging/ directory.

For the dt stuff, as that has been acked, it can go into the "real" locations. But for the include and sysfs documentation stuff, that all needs to stay within your directory.

Can you respin this series based on that and resend?

thanks,

greg k-h

#3 lore raw

PATCH v10 2/7 anybus-s: support HMS Anybus-S bus

In reply to Sven Van Asbroeck

The Anybus-S/Anybus-M is a series of interchangeable fieldbus communication modules featuring on board memory and processing power. All software and hardware functionality required to communicate on the fieldbus is incorporated in the module itself, allowing the application to focus on other tasks.

Typical applications are frequency inverters, HMI and visualization devices, instruments, scales, robotics, PLC’s and intelligent measuring devices.

Official documentation:
https://www.anybus.com/docs/librariesprovider7/default-document-library/
manuals-design-guides/hms-hmsi-27-275.pdf

---
 drivers/staging/fieldbus/Kconfig          |    3 +-
 drivers/staging/fieldbus/Makefile         |    3 +-
 drivers/staging/fieldbus/anybuss/Kconfig  |    9 +
 drivers/staging/fieldbus/anybuss/Makefile |    7 +
 drivers/staging/fieldbus/anybuss/host.c   | 1459 +++++++++++++++++++++
 include/linux/anybuss-client.h            |  102 ++
 include/linux/anybuss-controller.h        |   47 +
 7 files changed, 1626 insertions(+), 4 deletions(-)
 create mode 100644 drivers/staging/fieldbus/anybuss/Kconfig
 create mode 100644 drivers/staging/fieldbus/anybuss/Makefile
 create mode 100644 drivers/staging/fieldbus/anybuss/host.c
 create mode 100644 include/linux/anybuss-client.h
 create mode 100644 include/linux/anybuss-controller.h
drivers/staging/fieldbus/Kconfig +1 -2
index b1d071cb096e..e5e28e52c59b 100644
@@ -14,6 +14,5 @@ menuconfig FIELDBUS_DEV
 
 	  If unsure, say no.
 
-if FIELDBUS_DEV
+source "drivers/staging/fieldbus/anybuss/Kconfig"
 
-endif
drivers/staging/fieldbus/Makefile +1 -2
index 23877def5803..c21056bdb3d2 100644
@@ -3,7 +3,6 @@
 # Makefile for fieldbus_dev drivers.
 #
 
-obj-$(CONFIG_FIELDBUS_DEV)	+= fieldbus_dev.o
+obj-$(CONFIG_FIELDBUS_DEV)	+= fieldbus_dev.o anybuss/
 fieldbus_dev-y			:= dev_core.o
 
-# Devices
drivers/staging/fieldbus/anybuss/Kconfig new file +9 -0
new file mode 100644
index 000000000000..5b495f25c11e
@@ -0,0 +1,9 @@
+config HMS_ANYBUSS_BUS
+	tristate "HMS Anybus-S Bus Support"
+	select REGMAP
+	depends on OF && FIELDBUS_DEV
+	help
+	  Driver for the HMS Industrial Networks Anybus-S bus.
+	  You can attach a single Anybus-S compatible card to it, which
+	  typically provides fieldbus and industrial ethernet
+	  functionality.
drivers/staging/fieldbus/anybuss/Makefile new file +7 -0
new file mode 100644
index 000000000000..236579aa7270
@@ -0,0 +1,7 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# Makefile for anybuss drivers.
+#
+
+obj-$(CONFIG_HMS_ANYBUSS_BUS)	+= anybuss_core.o
+anybuss_core-y			+= host.o
drivers/staging/fieldbus/anybuss/host.c new file +1459 -0

1,459 lines not on this page · raw message

include/linux/anybuss-client.h new file +102 -0

102 lines not on this page · raw message

include/linux/anybuss-controller.h new file +47 -0

47 lines not on this page · raw message

Signature · 1 line
2.17.1
#4 lore raw

PATCH v10 3/7 anybus-s: support the Arcx anybus controller

In reply to Sven Van Asbroeck

Add a driver for the Arcx anybus controller.

This device implements two Anybus-S hosts (buses), and connects to the SoC via a parallel memory bus. There is also a CAN power readout, unrelated to the Anybus, modelled as a regulator.

---
 drivers/staging/fieldbus/Makefile             |   1 -
 drivers/staging/fieldbus/anybuss/Kconfig      |  14 +
 drivers/staging/fieldbus/anybuss/Makefile     |   2 +
 .../staging/fieldbus/anybuss/arcx-anybus.c    | 398 ++++++++++++++++++
 4 files changed, 414 insertions(+), 1 deletion(-)
 create mode 100644 drivers/staging/fieldbus/anybuss/arcx-anybus.c
drivers/staging/fieldbus/Makefile +0 -1
index c21056bdb3d2..bdf645d41344 100644
@@ -5,4 +5,3 @@
 
 obj-$(CONFIG_FIELDBUS_DEV)	+= fieldbus_dev.o anybuss/
 fieldbus_dev-y			:= dev_core.o
-
drivers/staging/fieldbus/anybuss/Kconfig +14 -0
index 5b495f25c11e..e257f8a517bb 100644
@@ -7,3 +7,17 @@ config HMS_ANYBUSS_BUS
 	  You can attach a single Anybus-S compatible card to it, which
 	  typically provides fieldbus and industrial ethernet
 	  functionality.
+
+if HMS_ANYBUSS_BUS
+
+config ARCX_ANYBUS_CONTROLLER
+	tristate "Arcx Anybus-S Controller"
+	depends on OF && GPIOLIB && HAS_IOMEM && REGULATOR
+	help
+	  Select this to get support for the Arcx Anybus controller.
+	  It connects to the SoC via a parallel memory bus, and
+	  embeds up to two Anybus-S buses (slots).
+	  There is also a CAN power readout, unrelated to the Anybus,
+	  modelled as a regulator.
+
+endif
drivers/staging/fieldbus/anybuss/Makefile +2 -0
index 236579aa7270..7198b080926b 100644
@@ -5,3 +5,5 @@
 
 obj-$(CONFIG_HMS_ANYBUSS_BUS)	+= anybuss_core.o
 anybuss_core-y			+= host.o
+
+obj-$(CONFIG_ARCX_ANYBUS_CONTROLLER) += arcx-anybus.o
drivers/staging/fieldbus/anybuss/arcx-anybus.c new file +398 -0

398 lines not on this page · raw message

Signature · 1 line
2.17.1
#5 lore raw

PATCH v10 4/7 dt-bindings: anybus-controller: document devicetree binding

In reply to Sven Van Asbroeck

This patch adds devicetree binding documentation for the Arcx anybus controller.

---
 .../fieldbus/arcx,anybus-controller.txt       | 71 +++++++++++++++++++
 1 file changed, 71 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/fieldbus/arcx,anybus-controller.txt
Documentation/devicetree/bindings/fieldbus/arcx,anybus-controller.txt new file +71 -0
new file mode 100644
index 000000000000..b1f9474f36d5
@@ -0,0 +1,71 @@
+* Arcx Anybus-S controller
+
+This chip communicates with the SoC over a parallel bus. It is
+expected that its Device Tree node is specified as the child of a node
+corresponding to the parallel bus used for communication.
+
+Required properties:
+--------------------
+
+  - compatible : The following chip-specific string:
+        "arcx,anybus-controller"
+
+  - reg : three areas:
+	index 0: bus memory area where the cpld registers are located.
+	index 1: bus memory area of the first  host's dual-port ram.
+	index 2: bus memory area of the second host's dual-port ram.
+
+  - reset-gpios : the GPIO pin connected to the reset line of the controller.
+
+  - interrupts : two interrupts:
+		index 0: interrupt connected to the first  host
+		index 1: interrupt connected to the second host
+	Generic interrupt client node bindings are described in
+	interrupt-controller/interrupts.txt
+
+Optional: use of subnodes
+-------------------------
+
+The card connected to a host may need additional properties. These can be
+specified in subnodes to the controller node.
+
+The subnodes are identified by the standard 'reg' property. Which information
+exactly can be specified depends on the bindings for the function driver
+for the subnode.
+
+Required controller node properties when using subnodes:
+- #address-cells: should be one.
+- #size-cells: should be zero.
+
+Required subnode properties:
+- reg: Must contain the host index of the card this subnode describes:
+		<0>	for the first  host on the controller
+		<1>	for the second host on the controller
+	Note that only a single card can be plugged into a host, so the host
+	index uniquely describes the card location.
+
+Example of usage:
+-----------------
+
+This example places the bridge on top of the i.MX WEIM parallel bus, see:
+Documentation/devicetree/bindings/bus/imx-weim.txt
+
+&weim {
+	controller@0,0 {
+		compatible = "arcx,anybus-controller";
+		reg = <0 0 0x100>, <0 0x400000 0x800>, <1 0x400000 0x800>;
+		reset-gpios = <&gpio5 2 GPIO_ACTIVE_HIGH>;
+		interrupt-parent = <&gpio1>;
+		interrupts = <1 IRQ_TYPE_LEVEL_LOW>, <5 IRQ_TYPE_LEVEL_LOW>;
+		/* fsl,weim-cs-timing is a i.MX WEIM bus specific property */
+		fsl,weim-cs-timing = <0x024400b1 0x00001010 0x20081100
+				0x00000000 0xa0000240 0x00000000>;
+		/* optional subnode for a card plugged into the first host */
+		#address-cells = <1>;
+		#size-cells = <0>;
+		card@0 {
+			reg = <0>;
+			/* card specific properties go here */
+		};
+	};
+};
Signature · 1 line
2.17.1
#6 lore raw

Re: [PATCH v10 4/7] dt-bindings: anybus-controller: document devicetree binding

Quoted 9 lines · Sven Van Asbroeck

This patch adds devicetree binding documentation for the Arcx anybus controller.

---
 .../fieldbus/arcx,anybus-controller.txt       | 71 +++++++++++++++++++
 1 file changed, 71 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/fieldbus/arcx,anybus-controller.txt

DT patches don't get in my queue if you don't CC DT list.

Rob

#7 lore raw

Re: [PATCH v10 4/7] dt-bindings: anybus-controller: document devicetree binding

Quoted 3 lines · Rob Herring

DT patches don't get in my queue if you don't CC DT list.

My apologies for the confusion. You already offered your tag to an identical commit in v3:
https://lkml.org/lkml/2018/11/6/66

Am I ok to add it, given that nothing has changed in this particular commit?

#8 lore raw

Re: [PATCH v10 4/7] dt-bindings: anybus-controller: document devicetree binding

Quoted 6 lines · Sven Van Asbroeck

My apologies for the confusion. You already offered your tag to an identical commit in v3:
https://lkml.org/lkml/2018/11/6/66

Am I ok to add it, given that nothing has changed in this particular commit?

I added a link to the wrong version. The current patch is identical to v5, where you
said it looks fine, but the series itself still has discussion.
https://lkml.org/lkml/2018/12/7/600

Should I re-post to the DT list?

#9 lore raw

Re: [PATCH v10 4/7] dt-bindings: anybus-controller: document devicetree binding

Quoted 7 lines · Sven Van Asbroeck
Quoted 5 lines · Sven Van Asbroeck

My apologies for the confusion. You already offered your tag to an identical commit in v3:
https://lkml.org/lkml/2018/11/6/66

Quoted 8 lines
Quoted 1 line

Am I ok to add it, given that nothing has changed in this particular commit?

I added a link to the wrong version. The current patch is identical to v5, where you
said it looks fine, but the series itself still has discussion.
https://lkml.org/lkml/2018/12/7/600

Should I re-post to the DT list?

No. If you send again, then add my R-by if it hasn't changed.

#10 lore raw

Re: [PATCH v10 4/7] dt-bindings: anybus-controller: document devicetree binding

Quoted 2 lines · Rob Herring

No. If you send again, then add my R-by if it hasn't changed.

Thank you.

Greg, are you able to apply Rob's R-by tag if you merge this set as-is, or would you like me to repost as v11 ?

maintainer
#11 lore raw

Re: [PATCH v10 4/7] dt-bindings: anybus-controller: document devicetree binding

Quoted 8 lines · Sven Van Asbroeck
Quoted 2 lines · Rob Herring

No. If you send again, then add my R-by if it hasn't changed.

Thank you.

Greg, are you able to apply Rob's R-by tag if you merge this set as-is, or would you like me to repost as v11 ?

I can add it, thanks.

greg k-h

#12 lore raw

PATCH v10 5/7 dt-bindings: Add vendor prefix for arcx / Archronix

In reply to Sven Van Asbroeck

arcx Inc. is an engineering company which provides advanced embedded systems and consulting services.

Archronix is a technology design and product engineering firm specializing in hardware control systems and enabling software. Clients include OEM's in the transportation, aerospace, medical and commercial sectors.

Websites:

	http://www.arcx.com/
	http://www.archronix.com/
---
 Documentation/devicetree/bindings/vendor-prefixes.txt | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/vendor-prefixes.txt +1 -0
index 8162b0eb4b50..f3c81407675e 100644
@@ -36,6 +36,7 @@ aptina	Aptina Imaging
 arasan	Arasan Chip Systems
 archermind ArcherMind Technology (Nanjing) Co., Ltd.
 arctic	Arctic Sand
+arcx	arcx Inc. / Archronix Inc.
 aries	Aries Embedded GmbH
 arm	ARM Ltd.
 armadeus	ARMadeus Systems SARL
Signature · 1 line
2.17.1
#13 lore raw

PATCH v10 6/7 fieldbus_dev: support HMS Profinet IRT industrial controller

In reply to Sven Van Asbroeck

The Anybus-S PROFINET IRT communication module provides instant integration to any Ethernet based LAN via SMTP, FTP, HTTP as well as PROFINET and Modbus-TCP. Additional protocols can be implemented on top of TCP/IP or UDP using the transparent socket interface.

Official documentation:
https://www.anybus.com/docs/librariesprovider7/default-document-library
/manuals-design-guides/hms-hmsi-168-52.pdf

This implementation is an Anybus-S client driver, designed to be instantiated by the Anybus-S bus driver when it discovers the Profinet card.

If loaded successfully, the driver registers itself as a fieldbus_dev, and userspace can access it through the fieldbus_dev interface.

---
 drivers/staging/fieldbus/anybuss/Kconfig      |  16 ++
 drivers/staging/fieldbus/anybuss/Makefile     |   1 +
 .../staging/fieldbus/anybuss/hms-profinet.c   | 224 ++++++++++++++++++
 3 files changed, 241 insertions(+)
 create mode 100644 drivers/staging/fieldbus/anybuss/hms-profinet.c
drivers/staging/fieldbus/anybuss/Kconfig +16 -0
index e257f8a517bb..41f241c73826 100644
@@ -20,4 +20,20 @@ config ARCX_ANYBUS_CONTROLLER
 	  There is also a CAN power readout, unrelated to the Anybus,
 	  modelled as a regulator.
 
+config HMS_PROFINET
+	tristate "HMS Profinet IRT Controller (Anybus-S)"
+	depends on FIELDBUS_DEV && HMS_ANYBUSS_BUS
+	help
+	  If you say yes here you get support for the HMS Industrial
+	  Networks Profinet IRT Controller.
+
+	  It will be registered with the kernel as a fieldbus_dev,
+	  so userspace can interact with it via the fieldbus_dev userspace
+	  interface(s).
+
+	  This driver can also be built as a module. If so, the module
+	  will be called hms-profinet.
+
+	  If unsure, say N.
+
 endif
drivers/staging/fieldbus/anybuss/Makefile +1 -0
index 7198b080926b..3ad3dcc6be56 100644
@@ -7,3 +7,4 @@ obj-$(CONFIG_HMS_ANYBUSS_BUS)	+= anybuss_core.o
 anybuss_core-y			+= host.o
 
 obj-$(CONFIG_ARCX_ANYBUS_CONTROLLER) += arcx-anybus.o
+obj-$(CONFIG_HMS_PROFINET)	+= hms-profinet.o
drivers/staging/fieldbus/anybuss/hms-profinet.c new file +224 -0

224 lines not on this page · raw message

Signature · 1 line
2.17.1
#14 lore raw

PATCH v10 7/7 staging: fieldbus_dev: add TODO

In reply to Sven Van Asbroeck

Add a TODO file which describes what needs to be done in order to get the fieldbus_dev subsystem out of staging.

---
 drivers/staging/fieldbus/TODO | 5 +++++
 1 file changed, 5 insertions(+)
 create mode 100644 drivers/staging/fieldbus/TODO
drivers/staging/fieldbus/TODO new file +5 -0
new file mode 100644
index 000000000000..6d6626af4ec7
@@ -0,0 +1,5 @@
+TODO:
+-Get more people/drivers to use the Fieldbus userspace ABI. It requires
+ verification/sign-off by multiple users.
+
+Contact: Sven Van Asbroeck <[email protected]>
Signature · 1 line
2.17.1
#15 lore raw
In reply to Sven Van Asbroeck

On 09.04.19 16:42, Sven Van Asbroeck wrote:

Hi,

Quoted 2 lines

Fieldbus device (client) adapters allow data exchange with a PLC aka. "Fieldbus Controller" over a fieldbus (Profinet, FLNet, etc.)

AFAIK, "fieldbus" is a bit broader term than just the typical IEC61158- style remote memory stuff. At least that's the terminology my clients tend to use (eg. they also call some homebbrewn rs485-based protocols "fieldbus").

Maybe it would be better calling it "IEC-61158" instead of "fieldbus" ?

By the way: can this device be opened/used by several processes simultaniously ?

--mtx

Signature · 3 lines
Enrico Weigelt, metux IT consult
Free software and Linux embedded engineering
[email protected] -- +49-151-27565287
#16 lore raw

Hi Enrico,

Thanks for your input, appreciate it !

Quoted 8 lines · metux IT consult

AFAIK, "fieldbus" is a bit broader term than just the typical IEC61158- style remote memory stuff. At least that's the terminology my clients tend to use (eg. they also call some homebbrewn rs485-based protocols "fieldbus").

Maybe it would be better calling it "IEC-61158" instead of "fieldbus" ?

Yes, we are certainly open to that, if it is more correct and/or better accepted by users.

Quoted 4 lines

By the way: can this device be opened/used by several processes simultaniously ?

Yes. You can open as many handles to the device as you like, they will all share the fieldbus memory. When the remote fieldbus memory changes, that event will be broadcast to all open handles, via poll/select.

Of course if your application is monitoring the fieldbus memory in more than one thread/process, you may need to guard against race conditions. There is no guarantee which thread/process will react to the change first.

Sven

#17 lore raw

On 15.04.19 20:31, Sven Van Asbroeck wrote:

Hi,

Quoted 1 line
Quoted 1 line

Maybe it would be better calling it "IEC-61158" instead of "fieldbus" ?>>> > Yes, we are certainly open to that, if it is more correct and/or

better> accepted by users.
Thanks, I'd really appreciate that :)

Maybe I'm a bit beaurocratic here, but I really believe that precise naming is important, eg. for avoiding potential conflicts w/ different fieldbus classes (eg. mvb) that might come in the future.

Quoted 4 lines

Yes. You can open as many handles to the device as you like, they will all share the fieldbus memory. When the remote fieldbus memory changes, that event will be broadcast to all open handles, via poll/select.

Great. When I read your first mail, I got reminded on the old legacy canbus chardevs (before cansocket came in) that was single-user only.

By the way: any special reason for doing this via device instead of socket (like we have w/ can) ?

I'm, personally, pretty undecided which way is better. Device nodes give us easy access control via fs permissions, while socket allows firewalling.

--mtx

Signature · 3 lines
Enrico Weigelt, metux IT consult
Free software and Linux embedded engineering
[email protected] -- +49-151-27565287
#18 lore raw
Quoted 5 lines · metux IT consult

Maybe I'm a bit beaurocratic here, but I really believe that precise naming is important, eg. for avoiding potential conflicts w/ different fieldbus classes (eg. mvb) that might come in the future.

I named the subsystem 'fieldbus_dev' because it handles fieldbus devices, not controllers. Granted, it's in the drivers/staging/fieldbus directory, but that's because people objected to the verbosity of fieldbus_dev. In the C code, it's all fieldbus_dev.

Quoted 4 lines

By the way: any special reason for doing this via device instead of socket (like we have w/ can) ?

A fieldbus_dev device communicates with its controller through a section of shared memory (process memory). It just felt more logical to model this as a device which acts like a file. When you read/write the file, you read/write the process memory underneath.

Sven

#19 lore raw
Quoted 8 lines · Sven Van Asbroeck
Quoted 3 lines

By the way: any special reason for doing this via device instead of socket (like we have w/ can) ?

A fieldbus_dev device communicates with its controller through a section of shared memory (process memory). It just felt more logical to model this as a device which acts like a file. When you read/write the file, you read/write the process memory underneath.

Yeah, that sounds logical. By the way: could we also mmap() that device?

Okay that's just a purely academical idea here, but I'm curious whether that would make a notable difference in performance.

Yet another question: does each fieldbus_dev instance talk to exactly one plc process memory, or can there be many ?

Having separate device nodes per plc process memory seems a good idea for finer access control (via chown+friends).

--mtx

Signature · 3 lines
Enrico Weigelt, metux IT consult
Free software and Linux embedded engineering
[email protected] -- +49-151-27565287
#20 lore raw
Quoted 2 lines · metux IT consult

Yeah, that sounds logical. By the way: could we also mmap() that device?

AFAIK mmap only makes sense if you have actual device memory, accessible through some memory controller. The process memory on anybus-s devices is accessed through many layers of indirection, which includes a handshaking/ synchronization protocol over anybus-s.

In addition, you'd lose timing information about writes. The current API blocks until the write to the remote PLC's process memory has been successfully completed.

Perhaps if someone ever adds a fieldbus_dev driver for a device with mappable process memory, we can consider mmap() as an optional extension ?

Quoted 3 lines

Okay that's just a purely academical idea here, but I'm curious whether that would make a notable difference in performance.

Perhaps on a device with memory-mappable process memory. But it would have to be an incredibly fast fieldbus device for the difference between read()/write() and mmap() to matter...

Quoted 7 lines

Yet another question: does each fieldbus_dev instance talk to exactly one plc process memory, or can there be many ?

Having separate device nodes per plc process memory seems a good idea for finer access control (via chown+friends).

Good question ! I'll have to get back to you on that...

#21 lore raw
In reply to Enrico Weigelt, metux IT consult
Quoted 8 lines · metux IT consult

Yet another question: does each fieldbus_dev instance talk to exactly one plc process memory, or can there be many ?

Having separate device nodes per plc process memory seems a good idea for finer access control (via chown+friends).

PS do you have a specific fieldbus device in mind which could be added to Linux? Would it support multiple plc process memories?

Sven

#22 lore raw
Quoted 2 lines · Sven Van Asbroeck

PS do you have a specific fieldbus device in mind which could be added to Linux?

I actually had some Duagon MVB controllers (Ionia) in the pipeline. That's stalled for quite some time, as my customer doesn't need the MVB communication yet, for now just the machine as generic Linux host w/ ADCs+DIOs.

Can't tell when exactly the MVB issue comes up again, or whether the device will be connected to WTB instead. But I'm sure either one will come in a few years.

Quoted 1 line

Would it support multiple plc process memories?

Not quite. More like SNMP. Theoretically, (parts of) that could be somehow mapped into a logical process memory, but handling async signals could be tricky (at least we'd need a mtime for each field and an change notification mechanism).

--mtx

Signature · 3 lines
Enrico Weigelt, metux IT consult
Free software and Linux embedded engineering
[email protected] -- +49-151-27565287
#23 lore raw

Hi Enrico,

Quoted 11 lines · metux IT consult
Quoted 2 lines · Sven Van Asbroeck

PS do you have a specific fieldbus device in mind which could be added to Linux?

I actually had some Duagon MVB controllers (Ionia) in the pipeline. That's stalled for quite some time, as my customer doesn't need the MVB communication yet, for now just the machine as generic Linux host w/ ADCs+DIOs.

If you have a fieldbus device you want to add to mainline Linux, and you wish to piggy-back onto the fieldbus_dev subsystem, then we can discuss fieldbus API changes/additions/improvements during the patch review stage.

It's my experience that good userspace APIs evolve from practical requirements, not top-down theoretical design. The staging/ location allows us to take an evolutionary approach.

Sven

#24 lore raw
Quoted 1 line · Sven Van Asbroeck

If you have a fieldbus device you want to add to mainline Linux, and> you wish to piggy-back onto the fieldbus_dev subsystem, then we can>

discuss fieldbus API changes/additions/improvements during the> patch review stage.
With those cases, piggy-backing wouldn't make much sense, as their semantics is pretty different.

My whole point here was just that it shouldn't be called "fieldbus", but iec61158 instead.

--mtx

Signature · 3 lines
Enrico Weigelt, metux IT consult
Free software and Linux embedded engineering
[email protected] -- +49-151-27565287
#25 lore raw

Thanks Enrico!

Quoted 11 lines · metux IT consult
Quoted 1 line · Sven Van Asbroeck

If you have a fieldbus device you want to add to mainline Linux, and> you wish to piggy-back onto the fieldbus_dev subsystem, then we can>

discuss fieldbus API changes/additions/improvements during the> patch review stage.
With those cases, piggy-backing wouldn't make much sense, as their semantics is pretty different.

My whole point here was just that it shouldn't be called "fieldbus", but iec61158 instead.

Full ACK!

The Controller Area Network also belongs to the class of field busses and has its own networking subsystem in linux/net/can.

So using a 'class' of communication protocols as naming scheme doesn't fit IMHO.

Best regards,
Oliver

#26 lore raw

Am 24.04.19 um 12:26 schrieb Oliver Hartkopp:

Quoted 16 lines

Thanks Enrico!

Quoted 4 lines · metux IT consult
Quoted 2 lines · Sven Van Asbroeck

If you have a fieldbus device you want to add to mainline Linux, and> you wish to piggy-back onto the fieldbus_dev subsystem, then we can>

Quoted 8 lines

discuss fieldbus API changes/additions/improvements during the> patch review stage.
With those cases, piggy-backing wouldn't make much sense, as their semantics is pretty different.

My whole point here was just that it shouldn't be called "fieldbus", but iec61158 instead.

Quoted 7 lines

Full ACK!

The Controller Area Network also belongs to the class of field busses and has its own networking subsystem in linux/net/can.

So using a 'class' of communication protocols as naming scheme doesn't fit IMHO.

And - again - NACK. Calling a subsystem just iec61158 is going to hide what it is and stand in the way of development of this niche system. I asked Enrico to come up with a better naming proposal such as having iec61158 as subfolder to human-readable fieldbus, but I did not see him coming up with any such new proposals apart from repeating this name.

Also please read Sven's comment again: It you don't like the current naming you'll need to post follow-up patches, as v11 of this subsystem has been merged into staging. No complaint about piggy-backing on v10 is going to change that fact now!

https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git/tree/drivers/staging/fieldbus?h=staging-next

And since we're at it, Enrico's response to me just threw around a bunch of acronyms instead of explaining which ones have an _actual_ conflict with this subsystem - my point precisely was that if they use sockets or ttys then there's no real conflict apart from lots of things classifying as "fieldbus".

Regards,
Andreas

Signature · 3 lines
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Mary Higgins, Sri Rasiah
HRB 21284 (AG Nürnberg)
#27 lore raw
Quoted 19 lines · Andreas Färber

Am 24.04.19 um 12:26 schrieb Oliver Hartkopp:

Quoted 5 lines

The Controller Area Network also belongs to the class of field busses and has its own networking subsystem in linux/net/can.

So using a 'class' of communication protocols as naming scheme doesn't fit IMHO.

And - again - NACK. Calling a subsystem just iec61158 is going to hide what it is and stand in the way of development of this niche system. I asked Enrico to come up with a better naming proposal such as having iec61158 as subfolder to human-readable fieldbus, but I did not see him coming up with any such new proposals apart from repeating this name.

Also please read Sven's comment again: It you don't like the current naming you'll need to post follow-up patches, as v11 of this subsystem has been merged into staging. No complaint about piggy-backing on v10 is going to change that fact now!

Quoted 7 lines

https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git/tree/drivers/staging/fieldbus?h=staging-next

And since we're at it, Enrico's response to me just threw around a bunch of acronyms instead of explaining which ones have an _actual_ conflict with this subsystem - my point precisely was that if they use sockets or ttys then there's no real conflict apart from lots of things classifying as "fieldbus".

Ok, I either tried to get through the fieldbus code and the documentation from above.

I hopefully got it right by: You implemented a standardized chardev ABI that enables a data exchange between userspace and kernel, where other drivers can register 'from inside the kernel', that feel like being a fieldbus controller?!?

When checking out the Anybus website the first hit for serial fieldbus is https://www.anybus.com/technologies/fieldbus-serial/can-canopen .

CANopen is CAN based - and the CAN network drivers and CAN controllers definitely do not expose sysfs entries like

/sys/class/fieldbus_dev/fieldbus_devX/write_area_size

How can this fit together for me and what would be the plan to cover CANopen or EtherCAT in the fieldbus subsystem? Does it need some kind of CANopen protocol driver that registers to your ABI and speaks to CAN interfaces on the other side?

If this would have been outlined more clearly I wouldn't have stumbled over the fieldbus naming scheme.

Regards,
Oliver

#28 lore raw

Hello Oliver, thank you for your input, appreciate it !

Quoted 5 lines · Oliver Hartkopp

I hopefully got it right by: You implemented a standardized chardev ABI that enables a data exchange between userspace and kernel, where other drivers can register 'from inside the kernel', that feel like being a fieldbus controller?!?

Close ! Devices that "feel like" a Fieldbus _device_ can register.

The subsystem is called fieldbus_dev "fieldbus device" because it abstracts Linux fieldbus clients that want to expose themselves as e.g. an actuator, motor, console light, switch, ...

The commit message fully describes this, and so does the Documentation. Any improvements are welcome.
https://lkml.org/lkml/2019/4/16/817
https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git/tree/drivers/staging/fieldbus/Documentation/fieldbus_dev.txt?h=staging-next

During one of the eleven review cycles, drivers/fieldbus_dev got truncated to drivers/fieldbus because the reviewers felt that _dev was redundant, given the lack of other fieldbus subsystems.

This subsystem came about because I'm trying to mainline support for three HMS cards: FLNet, Profinet and CC-Link. These cards are not controllers, but slaves on the bus. All three make heavy use of process memory. From the get-go, the kernel reviewers made it clear that the userspace cannot be specific and must be generic. So I crafted a generic ABI that works for clients on process-memory based busses, and called it 'fieldbus_dev', for lack of a better name.

I'm by no means a fieldbus expert. It seems that the term 'fieldbus' is much broader than these process-memory based standards? I am open to any _concrete_ naming suggestions that can get consensus.

I'm a bit confused by Wikipedia's entry for fieldbus. It suggests that IEC 61158 and Fieldbus are interchangeable?
https://en.wikipedia.org/wiki/Fieldbus

<quote>
Fieldbus is the name of a family of industrial computer network protocols used for real-time distributed control, standardized as IEC 61158.
</quote>

Quoted 5 lines

How can this fit together for me and what would be the plan to cover CANopen or EtherCAT in the fieldbus subsystem? Does it need some kind of CANopen protocol driver that registers to your ABI and speaks to CAN interfaces on the other side?

Given that CAN/EtherCAT are not process memory based (that I know of), the fieldbus_dev subsystem is probably not a good fit.

Also no good for bus controllers, the subsystem deals with slave devices only.

Sven

#29 lore raw
Quoted 1 line · Sven Van Asbroeck

The subsystem is called fieldbus_dev "fieldbus device" because it> abstracts Linux fieldbus clients that want to expose themselves as>

e.g. an actuator, motor, console light, switch, ... Sounds a bit confusing. With that description, I'd expect highlevel interfaces similar to LED, input, IIO, etc ... but you're actually implementing an distributed process memory system. This in turn is just a subset of the fieldbus world.

Quoted 1 line

During one of the eleven review cycles, drivers/fieldbus_dev got> truncated to drivers/fieldbus because the reviewers felt that> _dev

was redundant, given the lack of other fieldbus> subsystems. There is at least one: CAN. Sometimes CAN is used in the IEC61158-way, but also completely different, even both in combination.

Quoted 1 line

These cards are not controllers, but slaves on the bus.

Do they really implement the process memory part or just the lower layer communications ?

Quoted 1 line

I'm by no means a fieldbus expert. It seems that the term> 'fieldbus' is much broader than these process-memory based> standards?

Yes, indeed.

Quoted 2 lines

I am open to any _concrete_ naming suggestion that can get consensus.

Maybe IEC61158 ?

Quoted 4 lines

I'm a bit confused by Wikipedia's entry for fieldbus. It suggests that IEC 61158 and Fieldbus are interchangeable?
https://en.wikipedia.org/wiki/Fieldbus

That's wrong.

Quoted 5 lines

<quote>
Fieldbus is the name of a family of industrial computer network protocols used for real-time distributed control, standardized as IEC 61158.
</quote>

IEC 61158 only standardizes one particular approach: the distributed process memory.

Quoted 3 lines

Given that CAN/EtherCAT are not process memory based (that I know of), the fieldbus_dev subsystem is probably not a good fit.

ACK. Neither are MVB+friends.

--mtx

Signature · 3 lines
Enrico Weigelt, metux IT consult
Free software and Linux embedded engineering
[email protected] -- +49-151-27565287
#30 lore raw
In reply to Enrico Weigelt, metux IT consult
Quoted 3 lines · metux IT consult

Yet another question: does each fieldbus_dev instance talk to exactly one plc process memory, or can there be many ?

I'm by no means a fieldbus expert, so I had a little chat with one of the fieldbus
people in the company here.

AFAIK if multiple plcs connect to the same device, all of them 'see' the same process memory for that device. Any mechanism to prevent these plcs from racing with each other is implemented in the application software. Could be handshaking, could be each plc dealing with a separate section of the process memory.

So for a fieldbus *device* (which is what this subsystem deals with) there can only be a single process memory. So we have a single devnode per device.

A fieldbus *controller* would have one process memory per device it connects to. But this subsystem does not deal with controllers.

This is my understanding, but I'd appreciate your input if I have overlooked something.

#31 lore raw
In reply to Enrico Weigelt, metux IT consult

Hi Enrico,

Am 16.04.19 um 18:49 schrieb Enrico Weigelt, metux IT consult:

Quoted 8 lines · Sven Van Asbroeck
Quoted 1 line
Quoted 1 line

Maybe it would be better calling it "IEC-61158" instead of "fieldbus" ?>>> > Yes, we are certainly open to that, if it is more correct and/or

better> accepted by users.
Thanks, I'd really appreciate that :)

Maybe I'm a bit beaurocratic here, but I really believe that precise naming is important, eg. for avoiding potential conflicts w/ different fieldbus classes (eg. mvb) that might come in the future.

I somewhat see your point, but I would not have recognized iec61158 as something relevant to my hardware, whereas fieldbus is understandable.

If you see specific conflicts or differences, please explain them instead of just throwing around bus names. :) Then we can more easily discuss whether to make changes to this framework or whether we indeed need some fieldbus/iec61158/ subdirectory. For your RS-485 I don't see a conflict as that'll just go via tty/serial/ and optionally serdev, no? However, I'd be curious how I/O Link might relate to this, it seems to have no public specifications.

Quoted 6 lines

By the way: any special reason for doing this via device instead of socket (like we have w/ can) ?

I'm, personally, pretty undecided which way is better. Device nodes give us easy access control via fs permissions, while socket allows firewalling.

While I do like sockets, they seem more useful for packet-based communication, which may be an implementation detail of fieldbus_dev drivers, but AFAIU that's unrelated to Sven's memory-focused subsystem representing a view of the data received, which may be different from the last packet received. Also, when a packet is received via socket, it gets dequeued, whereas you'll want to access the device's memory without restrictions.

Cheers,
Andreas

Signature · 3 lines
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Mary Higgins, Sri Rasiah
HRB 21284 (AG Nürnberg)
#32 lore raw

On 17.04.19 19:04, Andreas Färber wrote:

Hi,

Quoted 1 line

If you see specific conflicts or differences, please explain them> instead of just throwing around bus names. :) Then we can more easily>

discuss whether to make changes to this framework or whether we indeed> need some fieldbus/iec61158/ subdirectory.

For example, MVB semantically is more similar to can/canopen or even SNMP than to iec61158. T-bus is logically more a typically network interface (similar to 802.3 or HDLC), WTB is actually HDCL via RS485. KNX has similarities to canopen or SNMP. DALI is somewhat similar to I2C.

Ergo: there're various fieldbus protocols with entirely different concepts. Distributed process memory like in iec61158 is just one of them.

Quoted 1 line

For your RS-485 I don't see > conflict as that'll just go via tty/serial/ and optionally serdev, no?

That's just layer 0/1. Ontop of that there're various protocols. Some folks do some ASCII-based protocol ontop of that (eg. elevators, water plants, etc), others put in HDLC (eg. WTB), some do completely weird things ;-)

Quoted 1 line

However, I'd be curious how I/O Link might relate to this, it seems to> have no public specifications.

https://io-link.com/de/Download/Download.php
https://io-link.com/share/Downloads/Spec-Interface/IOL-Interface-Spec_10002_V112_Jul13.pdf

Quoted 1 line

While I do like sockets, they seem more useful for packet-based> communication, which may be an implementation detail of fieldbus_dev>

drivers, but AFAIU that's unrelated to Sven's memory-focused subsystem> representing a view of the data received, which may be different from> the last packet received. Also, when a packet is received via socket, it> gets dequeued, whereas you'll want to access the device's memory without> restrictions.
okay, if the device always represents the current process memory, w/o showing the actual communication, then Sven's approach makes sense.

--mtx

Signature · 3 lines
Enrico Weigelt, metux IT consult
Free software and Linux embedded engineering
[email protected] -- +49-151-27565287
#33 lore raw
In reply to Sven Van Asbroeck
Quoted 6 lines · Sven Van Asbroeck

This patch:
1. adds a Fieldbus subsystem
2. adds support for the HMS Industrial Networks AB Profinet card.

1. Fieldbus subsystem
---------------------

Not sure how I ended up on the review list for this set, but could you please remove me. Thank you.

Signature · 4 lines
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog