linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH anybus v1 0/4] Support HMS Profinet Card over Anybus
@ 2018-10-24 14:24 Sven Van Asbroeck
  2018-10-24 14:24 ` [PATCH anybus v1 1/4] mfd: support the Arcx anybus bridge Sven Van Asbroeck
                   ` (4 more replies)
  0 siblings, 5 replies; 22+ messages in thread
From: Sven Van Asbroeck @ 2018-10-24 14:24 UTC (permalink / raw)
  To: svendev, lee.jones, robh+dt, mark.rutland, afaerber, treding,
	david, noralf, johan, monstr, michal.vokac, arnd, gregkh,
	john.garry, andriy.shevchenko, geert+renesas, robin.murphy,
	paul.gortmaker, sebastien.bourdelin, icenowy, yuanzhichang,
	stuyoder, linus.walleij, maxime.ripard, bogdan.purcareata
  Cc: linux-kernel, devicetree

This patch set adds support for the HMS Industrial Networks AB 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 bridge', which is
custom h/w designed by Arcx. Its driver is modeled as an mfd, which
instantiates two anybus slots.

v1:
	first shot

Sven Van Asbroeck (4):
  mfd: support the Arcx anybus bridge.
  dt-bindings: anybus-bridge: document devicetree binding.
  bus: support HMS Anybus-S bus.
  misc: support HMS Profinet IRT industrial controller.

 .../bindings/mfd/arcx,anybus-bridge.txt       |   37 +
 .../devicetree/bindings/vendor-prefixes.txt   |    1 +
 drivers/bus/Kconfig                           |   11 +
 drivers/bus/Makefile                          |    1 +
 drivers/bus/anybuss-host.c                    | 1301 +++++++++++++++++
 drivers/mfd/Kconfig                           |   11 +
 drivers/mfd/Makefile                          |    1 +
 drivers/mfd/anybus-bridge.c                   |  441 ++++++
 drivers/misc/Kconfig                          |   11 +
 drivers/misc/Makefile                         |    1 +
 drivers/misc/hms-profinet.c                   |  747 ++++++++++
 include/linux/anybuss-client.h                |  100 ++
 include/linux/anybuss-host.h                  |   28 +
 include/uapi/linux/hms-common.h               |   14 +
 include/uapi/linux/hms-profinet.h             |  101 ++
 15 files changed, 2806 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mfd/arcx,anybus-bridge.txt
 create mode 100644 drivers/bus/anybuss-host.c
 create mode 100644 drivers/mfd/anybus-bridge.c
 create mode 100644 drivers/misc/hms-profinet.c
 create mode 100644 include/linux/anybuss-client.h
 create mode 100644 include/linux/anybuss-host.h
 create mode 100644 include/uapi/linux/hms-common.h
 create mode 100644 include/uapi/linux/hms-profinet.h

-- 
2.17.1


^ permalink raw reply	[flat|nested] 22+ messages in thread
* Re: [PATCH anybus v1 2/4] dt-bindings: anybus-bridge: document devicetree binding.
@ 2018-10-25 13:35 thesven73
  0 siblings, 0 replies; 22+ messages in thread
From: thesven73 @ 2018-10-25 13:35 UTC (permalink / raw)
  To: svendev, lee.jones, robh+dt, mark.rutland, afaerber, treding,
	david, noralf, johan, monstr, michal.vokac, arnd, gregkh,
	john.garry, geert+renesas, robin.murphy, paul.gortmaker,
	sebastien.bourdelin, icenowy, yuanzhichang, stuyoder,
	linus.walleij, maxime.ripard, bogdan.purcareata
  Cc: linux-kernel, devicetree

Hi Rob, thank you so much for taking a look at this patch !

>> +This chip communicates with the SoC over the WEIM bus. It is
>> +expected that its Device Tree node is specified as the child of a node
>> +corresponding to the WEIM bus used for communication.
>
>By WEIM you are referring to i.MX external parallel bus? Presumably this 
>can work on any parallel bus, not just i.MX.

That's right, in theory this hardware could work with any parallel bus, if
timed correctly. The driver also has no code dependencies on the WEIM driver.
You'll only find it in the field on top of the i.MX's WEIM bus, however.

Do you think it would be 'nicer' to drop references to i.MX and WEIM? Can do.

>> +  - compatible : The following chip-specific string:
>> +        "arcx,anybus-bridge"
>
>No version or part number?

We have id and capability registers in the chip for that. This driver is
generic, both forwards and backwards compatible. Is it ok to leave out
version/part number in this case?

The rest of your feedback will go into v2. Thanks :)

^ permalink raw reply	[flat|nested] 22+ messages in thread
* Re: [PATCH anybus v1 2/4] dt-bindings: anybus-bridge: document devicetree binding.
@ 2018-10-25 13:55 thesven73
  2018-10-25 15:30 ` David Lechner
  2018-10-26 11:28 ` Linus Walleij
  0 siblings, 2 replies; 22+ messages in thread
From: thesven73 @ 2018-10-25 13:55 UTC (permalink / raw)
  To: svendev, lee.jones, robh+dt, mark.rutland, afaerber, treding,
	david, noralf, johan, monstr, michal.vokac, arnd, gregkh,
	john.garry, geert+renesas, robin.murphy, paul.gortmaker,
	sebastien.bourdelin, icenowy, yuanzhichang, stuyoder,
	linus.walleij, maxime.ripard, bogdan.purcareata
  Cc: linux-kernel, devicetree

Hi Linus, thank you for the patch review !!

>> +  - pwms : the pwm connected to the bridge's 'pwm input'.
>
> That is really unintuitive and needs a detailed explanation. What
> is a bridge doing with a PWM? Is it 100% certain this is a PWM,
> it's not just a .... clock? A pwm is a pule WIDTH modulator and
> I can't for my life understand why a bus bridge needs a signal
> with variable pulse width, but surprise me! :D

You are 100% correct, this is a clock !
The hardware designers attached the bridge's clock input to an iMX pwm output,
and instructed us to provide a clock with 50% duty cycle and a certain freq.

The only way I know to activate a pwm is to connect it to a driver in the fdt,
then inside the driver enable the pwm, like so:

+       /* PWM */
+       pwm = devm_pwm_get(dev, NULL);
+       if (IS_ERR(pwm)) {
+               dev_err(dev, "pwm not found\n");
+               return -EINVAL;
+       }
+       pwm_get_args(pwm, &pargs);
+       period = pargs.period;
+       err = pwm_config(pwm, period/2, period);
+       if (err)
+               return err;
+       err = pwm_enable(pwm);
+       if (err)
+               return err;

This is why the bridge driver has a dependency on a pwm.
If the pwm could be enabled individually, I could drop this dependency.
Can you think of a way?

>> +               fsl,weim-cs-timing = <0x024400b1 0x00001010 0x20081100
>> +                               0x00000000 0xa0000240 0x00000000>;
>
> Is it just a copy/paste from
> Documentation/devicetree/bindings/bus/imx-weim.txt
> leftover?

No. We attach the bridge to the i.MX WEIM bus. Every fdt WEIM child node
requires a fsl,weim-cs-timing property, which provides the bus timing for
that particular chip select. It's the weim driver that requires this,
I'm only following its instructions.

Should I just leave this out in the example? In theory, the bridge can be
connected to any parallel bus, so fsl,weim-cs-timing is Too Much Information
for the example?


^ permalink raw reply	[flat|nested] 22+ messages in thread
* Re: [PATCH anybus v1 2/4] dt-bindings: anybus-bridge: document devicetree binding.
@ 2018-10-25 15:46 thesven73
  2018-10-26  6:39 ` Lee Jones
  0 siblings, 1 reply; 22+ messages in thread
From: thesven73 @ 2018-10-25 15:46 UTC (permalink / raw)
  To: svendev, lee.jones, robh+dt, mark.rutland, afaerber, treding,
	david, noralf, johan, monstr, michal.vokac, arnd, gregkh,
	john.garry, geert+renesas, robin.murphy, paul.gortmaker,
	sebastien.bourdelin, icenowy, stuyoder, linus.walleij,
	maxime.ripard
  Cc: linux-kernel, devicetree

>> This is why the bridge driver has a dependency on a pwm.
>> If the pwm could be enabled individually, I could drop this dependency.
>> Can you think of a way?
>
> How about using the pwm-clock device tree binding to turn the PWM into
> a clock?
> Documentation/devicetree/bindings/clock/pwm-clock.txt

Looks like a winner. Thanks !!

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2018-11-05 14:49 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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
2018-10-25 13:35 [PATCH anybus v1 2/4] dt-bindings: anybus-bridge: document devicetree binding thesven73
2018-10-25 13:55 thesven73
2018-10-25 15:30 ` David Lechner
2018-10-26 11:28 ` Linus Walleij
2018-10-25 15:46 thesven73
2018-10-26  6:39 ` Lee Jones

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