Add Fieldbus subsystem + support HMS Profinet card
Subsystems (2)
v7 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.
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 (6):
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
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/Kconfig | 2 + drivers/Makefile | 1 + drivers/fieldbus/Kconfig | 18 + drivers/fieldbus/Makefile | 10 + drivers/fieldbus/anybuss/Kconfig | 39 + drivers/fieldbus/anybuss/Makefile | 10 + drivers/fieldbus/anybuss/arcx-anybus.c | 399 +++++ drivers/fieldbus/anybuss/hms-profinet.c | 223 +++ drivers/fieldbus/anybuss/host.c | 1459 +++++++++++++++++ drivers/fieldbus/dev_core.c | 348 ++++ include/linux/anybuss-client.h | 104 ++ include/linux/anybuss-controller.h | 47 + include/linux/fieldbus_dev.h | 105 ++ 18 files changed, 2996 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/fieldbus/Kconfig create mode 100644 drivers/fieldbus/Makefile create mode 100644 drivers/fieldbus/anybuss/Kconfig create mode 100644 drivers/fieldbus/anybuss/Makefile create mode 100644 drivers/fieldbus/anybuss/arcx-anybus.c create mode 100644 drivers/fieldbus/anybuss/hms-profinet.c create mode 100644 drivers/fieldbus/anybuss/host.c create mode 100644 drivers/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
PATCH v7 1/6 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/Kconfig | 2 + drivers/Makefile | 1 + drivers/fieldbus/Kconfig | 19 + drivers/fieldbus/Makefile | 9 + drivers/fieldbus/dev_core.c | 348 ++++++++++++++++++ include/linux/fieldbus_dev.h | 105 ++++++ 9 files changed, 643 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/fieldbus/Kconfig create mode 100644 drivers/fieldbus/Makefile create mode 100644 drivers/fieldbus/dev_core.c create mode 100644 include/linux/fieldbus_dev.h
Documentation/ABI/testing/fieldbus-dev-cdev new file +31 -0
@@ -0,0 +1,31 @@ +What: /dev/fieldbus_devX +Date: December 2018 +KernelVersion: 4.21 +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/Kconfig +2 -0
@@ -226,6 +226,8 @@ source "drivers/visorbus/Kconfig" source "drivers/siox/Kconfig" +source "drivers/fieldbus/Kconfig" + source "drivers/slimbus/Kconfig" endmenu
drivers/Makefile +1 -0
@@ -186,3 +186,4 @@ obj-$(CONFIG_MULTIPLEXER) += mux/ obj-$(CONFIG_UNISYS_VISORBUS) += visorbus/ obj-$(CONFIG_SIOX) += siox/ obj-$(CONFIG_GNSS) += gnss/ +obj-$(CONFIG_FIELDBUS_DEV) += fieldbus/
drivers/fieldbus/Kconfig new file +19 -0
@@ -0,0 +1,19 @@ +menuconfig FIELDBUS_DEV + bool "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/fieldbus/Makefile new file +9 -0
@@ -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/fieldbus/dev_core.c new file +348 -0
348 lines not on this page · raw message
include/linux/fieldbus_dev.h new file +105 -0
105 lines not on this page · raw message
Signature · 1 line
2.17.1
Re: [PATCH v7 1/6] fieldbus_dev: add Fieldbus Device subsystem.
Quoted 10 lines · [[PATCH v7 1/6] fieldbus_dev: add Fieldbus Device subsystem.] On 22/01/2019…
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.
Signed-off-by Sven Van Asbroeck <[email protected]>
[...]
drivers/fieldbus/Kconfig line 2
Quoted 8 lines
drivers/fieldbus/Kconfig new file +2
-0@@ -0,0 +1,19 @@ +menuconfig FIELDBUS_DEV + bool "Fieldbus Device Support"
OK, so the core support is NOT tristate, ie not modular, so I think...
Quoted 6 lines
drivers/fieldbus/dev_core.c new file +0
-0
drivers/fieldbus/dev_core.c line 9
Quoted 9 lines
drivers/fieldbus/dev_core.c new file +9
-0@@ -0,0 +1,348 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Fieldbus Device Driver Core +* +*/ + +#include <linux/fieldbus_dev.h> +#include <linux/mutex.h> +#include <linux/module.h>
...you don't need module.h here
Quoted 6 lines
drivers/fieldbus/dev_core.c new file +6
-0+#include <linux/device.h> +#include <linux/idr.h> +#include <linux/fs.h> +#include <linux/slab.h> +#include <linux/poll.h> +
[...]
drivers/fieldbus/dev_core.c line 343
Quoted 9 lines
drivers/fieldbus/dev_core.c new file +9
-0+ +static void __exit fieldbus_exit(void) +{ +unregister_chrdev_region (fieldbus_devt,MAX_FIELDBUSES ); +class_unregister (&fieldbus_class); +} + +subsys_initcall (fieldbus_init); +module_exit (fieldbus_exit);
...and the module_exit is never called, so fieldbus_exit is dead code and hence both should be removed.
drivers/fieldbus/dev_core.c line 348
Quoted 5 lines
drivers/fieldbus/dev_core.c new file +5
-0+ +MODULE_AUTHOR ("Sven Van Asbroeck <[email protected]>" ); +MODULE_AUTHOR ("Jonathan Stiles <[email protected]>" ); +MODULE_DESCRIPTION ("Fieldbus Device Driver Core" ); +MODULE_LICENSE ("GPL v2" );
And these are all no-ops for non-modules, so it is recommended that you instead capture the information at the top of the file in comments.
You can find many similar cleanups for reference with this search:
git log --no-merges --oneline --grep='make .* non-modular'
Thanks,
Paul.
--
Re: [PATCH v7 1/6] fieldbus_dev: add Fieldbus Device subsystem.
Am 22.01.19 um 17:56 schrieb Paul Gortmaker:
Quoted 15 lines
Quoted 10 lines · [[PATCH v7 1/6] fieldbus_dev: add Fieldbus Device subsystem.] On 22/01/2019…
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.
Signed-off-by Sven Van Asbroeck <[email protected]>[...]
Quoted 10 lines
drivers/fieldbus/Kconfig line 2
Quoted 8 lines
drivers/fieldbus/Kconfig new file +2
-0@@ -0,0 +1,19 @@ +menuconfig FIELDBUS_DEV + bool "Fieldbus Device Support"OK, so the core support is NOT tristate, ie not modular,
Is that intentional though, and if so, why?
If possible, I would much rather see it changed to tristate and leave all the metadata below.
Quoted 42 lines
so I think...
Quoted 6 lines
drivers/fieldbus/dev_core.c new file +0
-0drivers/fieldbus/dev_core.c line 9
Quoted 9 lines
drivers/fieldbus/dev_core.c new file +9
-0@@ -0,0 +1,348 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Fieldbus Device Driver Core +* +*/ + +#include <linux/fieldbus_dev.h> +#include <linux/mutex.h> +#include <linux/module.h> ...you don't need
module.hhereQuoted 6 lines
drivers/fieldbus/dev_core.c new file +6
-0+#include <linux/device.h> +#include <linux/idr.h> +#include <linux/fs.h> +#include <linux/slab.h> +#include <linux/poll.h> +[...]
drivers/fieldbus/dev_core.c line 343
Quoted 9 lines
drivers/fieldbus/dev_core.c new file +9
-0+ +static void __exit fieldbus_exit(void) +{ +unregister_chrdev_region (fieldbus_devt,MAX_FIELDBUSES ); +class_unregister (&fieldbus_class); +} + +subsys_initcall (fieldbus_init); +module_exit (fieldbus_exit);...and the
module_exitis never called, sofieldbus_exitis dead code and hence both should be removed.
Quoted 5 lines
drivers/fieldbus/dev_core.c line 348
Quoted 5 lines
drivers/fieldbus/dev_core.c new file +5
-0+ +MODULE_AUTHOR ("Sven Van Asbroeck <[email protected]>" ); +MODULE_AUTHOR ("Jonathan Stiles <[email protected]>" ); +MODULE_DESCRIPTION ("Fieldbus Device Driver Core" ); +MODULE_LICENSE ("GPL v2" );
Sven, as this code appears to be all by ArcX people, any chance you can make it just GPL (SPDX GPL-2.0-or-later)? Only reason to have it v2-only would be if this code was derived from v2-only code that can't be relicensed anymore.
Thanks,
Andreas
Signature · 3 lines
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg)
Re: [PATCH v7 1/6] fieldbus_dev: add Fieldbus Device subsystem.
Quoted 74 lines · Andreas Färber
Am 22.01.19 um 17:56 schrieb Paul Gortmaker:
Quoted 15 lines
Quoted 10 lines · [[PATCH v7 1/6] fieldbus_dev: add Fieldbus Device subsystem.] On 22/01/2019…
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.
Signed-off-by Sven Van Asbroeck <[email protected]>[...]
Quoted 10 lines
drivers/fieldbus/Kconfig line 2
Quoted 8 lines
drivers/fieldbus/Kconfig new file +2
-0@@ -0,0 +1,19 @@ +menuconfig FIELDBUS_DEV + bool "Fieldbus Device Support"OK, so the core support is NOT tristate, ie not modular,
Is that intentional though, and if so, why?
If possible, I would much rather see it changed to tristate and leave all the metadata below.
Quoted 42 lines
so I think...
Quoted 6 lines
drivers/fieldbus/dev_core.c new file +0
-0drivers/fieldbus/dev_core.c line 9
Quoted 9 lines
drivers/fieldbus/dev_core.c new file +9
-0@@ -0,0 +1,348 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Fieldbus Device Driver Core +* +*/ + +#include <linux/fieldbus_dev.h> +#include <linux/mutex.h> +#include <linux/module.h> ...you don't need
module.hhereQuoted 6 lines
drivers/fieldbus/dev_core.c new file +6
-0+#include <linux/device.h> +#include <linux/idr.h> +#include <linux/fs.h> +#include <linux/slab.h> +#include <linux/poll.h> +[...]
drivers/fieldbus/dev_core.c line 343
Quoted 9 lines
drivers/fieldbus/dev_core.c new file +9
-0+ +static void __exit fieldbus_exit(void) +{ +unregister_chrdev_region (fieldbus_devt,MAX_FIELDBUSES ); +class_unregister (&fieldbus_class); +} + +subsys_initcall (fieldbus_init); +module_exit (fieldbus_exit);...and the
module_exitis never called, sofieldbus_exitis dead code and hence both should be removed.
Quoted 8 lines
Quoted 5 lines
drivers/fieldbus/dev_core.c line 348
Quoted 5 lines
drivers/fieldbus/dev_core.c new file +5
-0+ +MODULE_AUTHOR ("Sven Van Asbroeck <[email protected]>" ); +MODULE_AUTHOR ("Jonathan Stiles <[email protected]>" ); +MODULE_DESCRIPTION ("Fieldbus Device Driver Core" ); +MODULE_LICENSE ("GPL v2" );Sven, as this code appears to be all by ArcX people, any chance you can make it just GPL (SPDX GPL-2.0-or-later)? Only reason to have it v2-only
SPDX "GPL-2.0+" please.
Quoted 2 lines
would be if this code was derived from v2-only code that can't be relicensed anymore.
Are you _sure_ you want v2+? I ask as I am forced to :)
And I thought when I made the comment about this code being a module, that would be the change, not this one forcing it not to be :(
thanks,
greg k-h
Re: [PATCH v7 1/6] fieldbus_dev: add Fieldbus Device subsystem.
Quoted 3 lines · [Re: [PATCH v7 1/6] fieldbus_dev: add Fieldbus Device subsystem.] On…
Quoted 2 lines · Andreas Färber
Am 22.01.19 um 17:56 schrieb Paul Gortmaker:
Quoted 1 line
[[PATCH v7 1/6]
fieldbus_dev: add Fieldbus Device subsystem.] On 22/01/2019 (Tue 10:21) Sven Van Asbroeck wrote:
[...]
Quoted 15 lines
Quoted 15 lines
Quoted 10 lines
drivers/fieldbus/Kconfig line 2
Quoted 8 lines
drivers/fieldbus/Kconfig new file +2
-0@@ -0,0 +1,19 @@ +menuconfig FIELDBUS_DEV + bool "Fieldbus Device Support"OK, so the core support is NOT tristate, ie not modular,
Is that intentional though, and if so, why?
If possible, I would much rather see it changed to tristate and leave all the metadata below.
[...]
Quoted 2 lines
And I thought when I made the comment about this code being a module, that would be the change, not this one forcing it not to be :(
Apologies Greg, I didn't see that earlier comment.
Conversion to tristate is of course perfectly fine as well; I'm just against the inconsistency and addition of unused code. But tristate solves both, and I usually mention that (but not this time...<sigh>)
I just default to suggesting removing the unused stuff, since it doesn't change the runtime or implicitly expand the use case beyond what the original author(s) intended. Many times (just as here with fieldbus) I just don't know enough about it to say whether modular has a use case.
Paul.
--
Quoted 4 lines
thanks,
greg k-h
Re: [PATCH v7 1/6] fieldbus_dev: add Fieldbus Device subsystem.
In reply to Greg KHQuoted 8 lines · Greg KH
SPDX "GPL-2.0+" please.
Quoted 2 lines
would be if this code was derived from v2-only code that can't be relicensed anymore.
Are you _sure_ you want v2+? I ask as I am forced to :)
The licencing choice confuses me. Why would I choose a different licence to what the Linux kernel itself is provided under?
If I did pick a different one, what are the tradeoffs between GPLv2 and GPLv2+ ?
Re: [PATCH v7 1/6] fieldbus_dev: add Fieldbus Device subsystem.
Quoted 4 lines · Sven Van Asbroeck
Quoted 3 lines · Greg KH
SPDX "GPL-2.0+" please.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
would be if this code was derived from v2-only code that can't be relicensed anymore.
Are you _sure_ you want v2+? I ask as I am forced to :)
The licencing choice confuses me. Why would I choose a different licence to what the Linux kernel itself is provided under?
The Linux kernel is provided under "GPLv2" not "GPLv2+"
"GPLv2" means "GPLv2 only"
"GPLv2+" means "Any version of the GPL that the FSF decides to create from now until the end of time."
Quoted 1 line
If I did pick a different one, what are the tradeoffs between GPLv2 and GPLv2+ ?
That is for you and your lawyers to discuss :)
thanks,
greg k-h
Re: [PATCH v7 1/6] fieldbus_dev: add Fieldbus Device subsystem.
In reply to Sven Van AsbroeckQuoted 7 lines · Sven Van Asbroeck
Quoted 6 lines · Greg KH
SPDX "GPL-2.0+" please.
Quoted 2 lines
would be if this code was derived from v2-only code that can't be relicensed anymore.
Quoted 6 lines
Quoted 2 lines
Are you _sure_ you want v2+? I ask as I am forced to :)
The licencing choice confuses me. Why would I choose a different licence to what the Linux kernel itself is provided under?
If I did pick a different one, what are the tradeoffs between GPLv2 and GPLv2+ ?
GPLv2 is buggy as it allows TiVO-ization. GPLv3 fixes that bug, so it is more sensible choice. Kernel stays v2, but we have drivers that are dual BSD or v2+, so that they can be used for other projects. One day we might want to run GNU Hurd or something...
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Re: [PATCH v7 1/6] fieldbus_dev: add Fieldbus Device subsystem.
In reply to Greg KHQuoted 11 lines
Quoted 10 lines
Quoted 7 lines
drivers/fieldbus/dev_core.c line 348
Quoted 7 lines
drivers/fieldbus/dev_core.c new file +5
-0+ +MODULE_AUTHOR ("Sven Van Asbroeck <[email protected]>" ); +MODULE_AUTHOR ("Jonathan Stiles <[email protected]>" ); +MODULE_DESCRIPTION ("Fieldbus Device Driver Core" ); +MODULE_LICENSE ("GPL v2" );Sven, as this code appears to be all by ArcX people, any chance you can make it just GPL (SPDX GPL-2.0-or-later)? Only reason to have it v2-only
Quoted 6 lines
SPDX "GPL-2.0+" please.
Quoted 2 lines
would be if this code was derived from v2-only code that can't be relicensed anymore.
Are you _sure_ you want v2+? I ask as I am forced to :)
And I find it pretty nasty. You are trying to push people away from GPL V2+, which is not cool. Who is forcing you and why is that okay thing to do? :-(.
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Re: [PATCH v7 1/6] fieldbus_dev: add Fieldbus Device subsystem.
Quoted 13 lines · Pavel Machek
Quoted 13 lines
Quoted 10 lines
Quoted 7 lines
drivers/fieldbus/dev_core.c line 348
Quoted 7 lines
drivers/fieldbus/dev_core.c new file +5
-0+ +MODULE_AUTHOR ("Sven Van Asbroeck <[email protected]>" ); +MODULE_AUTHOR ("Jonathan Stiles <[email protected]>" ); +MODULE_DESCRIPTION ("Fieldbus Device Driver Core" ); +MODULE_LICENSE ("GPL v2" );Sven, as this code appears to be all by ArcX people, any chance you can make it just GPL (SPDX GPL-2.0-or-later)? Only reason to have it v2-only
SPDX "GPL-2.0+" please.
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
would be if this code was derived from v2-only code that can't be relicensed anymore.
Are you _sure_ you want v2+? I ask as I am forced to :)
And I find it pretty nasty. You are trying to push people away from GPL V2+, which is not cool.
People do not usually realize what they are agreeing to when they say "or later" based on the discussions I always end up having.
Do you really trust that GPL v9 is going to look anything like v2? :)
Anyway, no big deal, just asking as it is good to be sure, especially when odds are, code for this was copied from non + code.
thanks,
greg k-h
PATCH v7 2/6 anybus-s: support HMS Anybus-S bus
In reply to Sven Van AsbroeckThe 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/fieldbus/Kconfig | 3 +- drivers/fieldbus/Makefile | 4 +- drivers/fieldbus/anybuss/Kconfig | 9 + drivers/fieldbus/anybuss/Makefile | 7 + drivers/fieldbus/anybuss/host.c | 1459 ++++++++++++++++++++++++++++ include/linux/anybuss-client.h | 104 ++ include/linux/anybuss-controller.h | 47 + 7 files changed, 1630 insertions(+), 3 deletions(-) create mode 100644 drivers/fieldbus/anybuss/Kconfig create mode 100644 drivers/fieldbus/anybuss/Makefile create mode 100644 drivers/fieldbus/anybuss/host.c create mode 100644 include/linux/anybuss-client.h create mode 100644 include/linux/anybuss-controller.h
drivers/fieldbus/Kconfig +1 -2
@@ -14,6 +14,5 @@ menuconfig FIELDBUS_DEV If unsure, say no. -if FIELDBUS_DEV +source "drivers/fieldbus/anybuss/Kconfig" -endif
drivers/fieldbus/Makefile +3 -1
@@ -6,4 +6,6 @@ obj-$(CONFIG_FIELDBUS_DEV) += fieldbus_dev.o fieldbus_dev-y := dev_core.o -# Devices +# Anybus-S core and devices +obj-$(CONFIG_HMS_ANYBUSS_BUS) += anybuss/ +
drivers/fieldbus/anybuss/Kconfig new file +9 -0
@@ -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/fieldbus/anybuss/Makefile new file +7 -0
@@ -0,0 +1,7 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# Makefile for anybuss drivers. +# + +obj-y += anybuss_core.o +anybuss_core-y += host.o
drivers/fieldbus/anybuss/host.c new file +1459 -0
1,459 lines not on this page · raw message
include/linux/anybuss-client.h new file +104 -0
104 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
PATCH v7 3/6 anybus-s: support the Arcx anybus controller
In reply to Sven Van AsbroeckAdd 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/fieldbus/Makefile | 1 - drivers/fieldbus/anybuss/Kconfig | 14 + drivers/fieldbus/anybuss/Makefile | 2 + drivers/fieldbus/anybuss/arcx-anybus.c | 399 +++++++++++++++++++++++++ 4 files changed, 415 insertions(+), 1 deletion(-) create mode 100644 drivers/fieldbus/anybuss/arcx-anybus.c
drivers/fieldbus/Makefile +0 -1
@@ -8,4 +8,3 @@ fieldbus_dev-y := dev_core.o # Anybus-S core and devices obj-$(CONFIG_HMS_ANYBUSS_BUS) += anybuss/ -
drivers/fieldbus/anybuss/Kconfig +14 -0
@@ -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 + 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/fieldbus/anybuss/Makefile +2 -0
@@ -5,3 +5,5 @@ obj-y += anybuss_core.o anybuss_core-y += host.o + +obj-$(CONFIG_ARCX_ANYBUS_CONTROLLER) += arcx-anybus.o
drivers/fieldbus/anybuss/arcx-anybus.c new file +399 -0
399 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v7 4/6 dt-bindings: anybus-controller: document devicetree binding
In reply to Sven Van AsbroeckFrom: Sven Van Asbroeck <[email protected]>
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
@@ -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
PATCH v7 5/6 dt-bindings: Add vendor prefix for arcx / Archronix
In reply to Sven Van AsbroeckFrom: Sven Van Asbroeck <[email protected]>
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
@@ -35,6 +35,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
PATCH v7 6/6 fieldbus_dev: support HMS Profinet IRT industrial controller
In reply to Sven Van AsbroeckThe 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/fieldbus/anybuss/Kconfig | 16 ++ drivers/fieldbus/anybuss/Makefile | 1 + drivers/fieldbus/anybuss/hms-profinet.c | 223 ++++++++++++++++++++++++ 3 files changed, 240 insertions(+) create mode 100644 drivers/fieldbus/anybuss/hms-profinet.c
drivers/fieldbus/anybuss/Kconfig +16 -0
@@ -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/fieldbus/anybuss/Makefile +1 -0
@@ -7,3 +7,4 @@ obj-y += anybuss_core.o anybuss_core-y += host.o obj-$(CONFIG_ARCX_ANYBUS_CONTROLLER) += arcx-anybus.o +obj-$(CONFIG_HMS_PROFINET) += hms-profinet.o
drivers/fieldbus/anybuss/hms-profinet.c new file +223 -0
223 lines not on this page · raw message
Signature · 1 line
2.17.1