linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Randy Dunlap <rdunlap@infradead.org>
To: Sven Van Asbroeck <svendev@arcx.com>,
	lee.jones@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com,
	afaerber@suse.de, treding@nvidia.com, david@lechnology.com,
	noralf@tronnes.org, johan@kernel.org, monstr@monstr.eu,
	michal.vokac@ysoft.com, arnd@arndb.de,
	gregkh@linuxfoundation.org, john.garry@huawei.com,
	andriy.shevchenko@linux.intel.com, geert+renesas@glider.be,
	robin.murphy@arm.com, paul.gortmaker@windriver.com,
	sebastien.bourdelin@savoirfairelinux.com, icenowy@aosc.io,
	yuanzhichang@hisilicon.com, stuyoder@gmail.com,
	linus.walleij@linaro.org, maxime.ripard@bootlin.com,
	bogdan.purcareata@nxp.com
Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH anybus v1 4/4] misc: support HMS Profinet IRT industrial controller.
Date: Wed, 24 Oct 2018 08:58:20 -0700	[thread overview]
Message-ID: <cbc42346-4b67-dd3a-ddca-4c0e0ba6929a@infradead.org> (raw)
In-Reply-To: <20181024142456.10084-5-svendev@arcx.com>

Hi,

On 10/24/18 7:24 AM, Sven Van Asbroeck wrote:
> 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 creates a /dev/profinet%d devnode,
> and a /sys/class/misc/profinet%d sysfs subdir:
> - the card can be configured with a single, atomic ioctl on the devnode;
> - the card's internal dpram is accessed by calling read/write/seek
>     on the devnode.
> - the card's "fieldbus specific area" properties can be accessed via
>     the sysfs dir.
> 
> Signed-off-by: Sven Van Asbroeck <svendev@arcx.com>
> ---
>  drivers/misc/Kconfig              |  11 +
>  drivers/misc/Makefile             |   1 +
>  drivers/misc/hms-profinet.c       | 747 ++++++++++++++++++++++++++++++
>  include/uapi/linux/hms-common.h   |  14 +
>  include/uapi/linux/hms-profinet.h | 101 ++++
>  5 files changed, 874 insertions(+)
>  create mode 100644 drivers/misc/hms-profinet.c
>  create mode 100644 include/uapi/linux/hms-common.h
>  create mode 100644 include/uapi/linux/hms-profinet.h
> 
> diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
> index 3726eacdf65d..377fea2e3003 100644
> --- a/drivers/misc/Kconfig
> +++ b/drivers/misc/Kconfig
> @@ -406,6 +406,17 @@ config SPEAR13XX_PCIE_GADGET
>  	 entry will be created for that controller. User can use these
>  	 sysfs node to configure PCIe EP as per his requirements.
>  
> +config HMS_PROFINET
> +	tristate "HMS Profinet IRT Controller (Anybus-S)"
> +	select HMS_ANYBUSS_HOST
> +	default n

Please drop the "default n".

> +	help
> +	 If you say yes here you get support for the HMS Industrial
> +	 Networks Profinet IRT Controller.
> +	 This driver can also be built as a module. If so, the module
> +	 will be called hms-profinet.
> +	 If unsure, say N.
> +
>  config VMWARE_BALLOON
>  	tristate "VMware Balloon Driver"
>  	depends on VMWARE_VMCI && X86 && HYPERVISOR_GUEST

> diff --git a/drivers/misc/hms-profinet.c b/drivers/misc/hms-profinet.c
> new file mode 100644
> index 000000000000..7338a49cbddd
> --- /dev/null
> +++ b/drivers/misc/hms-profinet.c

Please check multi-line comment style in this source file.



> diff --git a/include/uapi/linux/hms-profinet.h b/include/uapi/linux/hms-profinet.h
> new file mode 100644
> index 000000000000..4ae5eab8ab43
> --- /dev/null
> +++ b/include/uapi/linux/hms-profinet.h
> @@ -0,0 +1,101 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +/*
> + * Copyright 2018 Archronix Corp. All Rights Reserved.
> + *
> + */
> +
> +#ifndef _UAPILINUX_PROFINET_H_
> +#define _UAPILINUX_PROFINET_H_
> +
> +#include <asm/types.h>
> +#include <linux/hms-common.h>
> +
> +#define PROFI_CFG_STRLEN	64
> +
> +struct ProfinetConfig {
> +	struct {
> +		/* addresses IN NETWORK ORDER! */
> +		__u32 ip_addr;
> +		__u32 subnet_msk;
> +		__u32 gateway_addr;
> +		__u8  is_valid:1;
> +	} eth;
> +	struct {
> +		__u16 vendorid, deviceid;
> +		__u8  is_valid:1;
> +	} dev_id;
> +	struct {
> +		char name[PROFI_CFG_STRLEN];
> +		__u8 is_valid:1;
> +	} station_name;
> +	struct {
> +		char name[PROFI_CFG_STRLEN];
> +		__u8 is_valid:1;
> +	} station_type;
> +	struct {
> +		__u8 addr[6];
> +		__u8 is_valid:1;
> +	} mac_addr;
> +	struct {
> +		char hostname[PROFI_CFG_STRLEN];
> +		char domainname[PROFI_CFG_STRLEN];
> +		__u8 is_valid:1;
> +	} host_domain;
> +	struct {
> +		__u8 enable:1;
> +		__u8 is_valid:1;
> +	} hicp;
> +	struct {
> +		__u8 enable:1;
> +		__u8 is_valid:1;
> +	} web_server;
> +	struct {
> +		__u8 disable:1;
> +	} ftp_server;
> +	struct {
> +		__u8 enable:1;
> +	} global_admin_mode;
> +	struct {
> +		__u8 disable:1;
> +	} vfs;
> +	struct {
> +		/* one of HMS_SMA_CLEAR/FREEZE/SET */
> +		int action;
> +		__u8 is_valid:1;
> +	} stop_mode;
> +	struct {
> +		char description[PROFI_CFG_STRLEN];
> +		__u8 is_valid:1;
> +	} snmp_system_descr;
> +	struct {
> +		char description[PROFI_CFG_STRLEN];
> +		__u8 is_valid:1;
> +	} snmp_iface_descr;
> +	struct {
> +		char description[PROFI_CFG_STRLEN];
> +		__u8 is_valid:1;
> +	} mib2_system_descr;
> +	struct {
> +		char contact[PROFI_CFG_STRLEN];
> +		__u8 is_valid:1;
> +	} mib2_system_contact;
> +	struct {
> +		char location[PROFI_CFG_STRLEN];
> +		__u8 is_valid:1;
> +	} mib2_system_location;
> +	/* use non-volatile defaults for any properties not specified.
> +	 * when in doubt, keep this OFF.
> +	 */
> +	__u8 use_nv_defaults:1;
> +};
> +
> +#define PROFINET_IOC_MAGIC 'l'
> +
> +/*
> + * Configures profinet according to the ProfinetConfig structure, and
> + * switches the card on if it was previously off.
> + */
> +#define PROFINET_IOCSETCONFIG   _IOW(PROFINET_IOC_MAGIC, 1,\
> +						struct ProfinetConfig)

ioctl magic numbers should be added to
Documentation/ioctl/ioctl-number.txt, please.

> +
> +#endif /* _UAPILINUX_PROFINET_H_ */
> 


-- 
~Randy

  reply	other threads:[~2018-10-24 15:58 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-24 14:24 [PATCH anybus v1 0/4] Support HMS Profinet Card over Anybus Sven Van Asbroeck
2018-10-24 14:24 ` [PATCH anybus v1 1/4] mfd: support the Arcx anybus bridge Sven Van Asbroeck
2018-10-24 15:58   ` Randy Dunlap
2018-10-26  8:34   ` Lee Jones
2018-10-26 13:40     ` Sven Van Asbroeck
2018-10-24 14:24 ` [PATCH anybus v1 2/4] dt-bindings: anybus-bridge: document devicetree binding Sven Van Asbroeck
2018-10-25  0:06   ` Rob Herring
2018-10-25  5:19   ` Lee Jones
2018-10-25 10:16   ` Linus Walleij
2018-10-24 14:24 ` [PATCH anybus v1 3/4] bus: support HMS Anybus-S bus Sven Van Asbroeck
2018-10-24 15:58   ` Randy Dunlap
2018-10-25 11:08   ` Linus Walleij
2018-10-24 14:24 ` [PATCH anybus v1 4/4] misc: support HMS Profinet IRT industrial controller Sven Van Asbroeck
2018-10-24 15:58   ` Randy Dunlap [this message]
2018-10-25  9:18 ` [PATCH anybus v1 0/4] Support HMS Profinet Card over Anybus Andy Shevchenko
2018-11-05 14:49   ` Sven Van Asbroeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cbc42346-4b67-dd3a-ddca-4c0e0ba6929a@infradead.org \
    --to=rdunlap@infradead.org \
    --cc=afaerber@suse.de \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=arnd@arndb.de \
    --cc=bogdan.purcareata@nxp.com \
    --cc=david@lechnology.com \
    --cc=devicetree@vger.kernel.org \
    --cc=geert+renesas@glider.be \
    --cc=gregkh@linuxfoundation.org \
    --cc=icenowy@aosc.io \
    --cc=johan@kernel.org \
    --cc=john.garry@huawei.com \
    --cc=lee.jones@linaro.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=maxime.ripard@bootlin.com \
    --cc=michal.vokac@ysoft.com \
    --cc=monstr@monstr.eu \
    --cc=noralf@tronnes.org \
    --cc=paul.gortmaker@windriver.com \
    --cc=robh+dt@kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=sebastien.bourdelin@savoirfairelinux.com \
    --cc=stuyoder@gmail.com \
    --cc=svendev@arcx.com \
    --cc=treding@nvidia.com \
    --cc=yuanzhichang@hisilicon.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).