Skip to contentSkip to conversation

w1: Add AXI 1-wire host driver for AMD programmable logic IP core

PATCH RESEND Superseded Kris Chaplin 3 participants 8 messages Oct 26, 2023 – Oct 30, 2023 1 message not in the archive

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Kris Chaplin

author maintainer
#0 lore raw

v2 cover w1: Add AXI 1-wire host driver for AMD programmable logic IP core

Changes since v1:
Updated IP name and binding to axi-1wire-host and filenames to match Comment pruning where operation obvious, additional comments where not Unwrapped helper functions for register read/writes Removed un-necessary device reset on fail to add device Fixed duplicate clock disable in remove function Move bus master structure to per instance Improved hardware testing with multiple w1 instances

Add a host driver to support the AMD 1-Wire programmable logic IP block.
This block guarantees protocol timing for driving off-board devices such as thermal sensors, proms, etc.

Kris Chaplin (2):
dt-bindings: w1: Add YAML DT schema for AMD AXI w1 host and
MAINTAINERS entry
w1: Add AXI 1-wire host driver for AMD programmable logic IP core

 .../bindings/w1/amd,axi-1wire-host.yaml       |  44 ++
 MAINTAINERS                                   |   8 +
 drivers/w1/masters/Kconfig                    |  11 +
 drivers/w1/masters/Makefile                   |   1 +
 drivers/w1/masters/amd_axi_w1.c               | 395 ++++++++++++++++++
 5 files changed, 459 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/w1/amd,axi-1wire-host.yaml
 create mode 100644 drivers/w1/masters/amd_axi_w1.c
Signature · 1 line
2.42.GIT
author maintainer
#1 lore raw

PATCH RESEND v2 1/2 dt-bindings: w1: Add YAML DT schema for AMD AXI w1 host and MAINTAINERS entry

Add YAML DT schema for the AMD AXI w1 host IP.

This hardware guarantees protocol timing for driving off-board devices such as thermal sensors, proms, etc using the 1wire protocol.

Add MAINTAINERS entry for DT schema.

---
 .../bindings/w1/amd,axi-1wire-host.yaml       | 44 +++++++++++++++++++
 MAINTAINERS                                   |  7 +++
 2 files changed, 51 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/w1/amd,axi-1wire-host.yaml
Documentation/devicetree/bindings/w1/amd,axi-1wire-host.yaml new file +44 -0
new file mode 100644
index 000000000000..ef70fa2c0c5d
@@ -0,0 +1,44 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/w1/amd,axi-1wire-host.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: AMD AXI 1-wire bus host for programmable logic
+
+maintainers:
+  - Kris Chaplin <[email protected]>
+
+properties:
+  compatible:
+    const: amd,axi-1wire-host
+
+  reg:
+    maxItems: 1
+
+  clocks:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - interrupts
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+
+    onewire@a0000000 {
+        compatible = "amd,axi-1wire-host";
+        reg = <0xa0000000 0x10000>;
+        clocks = <&zynqmp_clk 0x47>;
+        interrupts = <GIC_SPI 0x59 IRQ_TYPE_LEVEL_HIGH>;
+    };
+
+...
MAINTAINERS +7 -0
index 7a7bd8bd80e9..3dacb7ed6e3b 100644
@@ -890,6 +890,13 @@ Q:	https://patchwork.kernel.org/project/linux-rdma/list/
 F:	drivers/infiniband/hw/efa/
 F:	include/uapi/rdma/efa-abi.h
 
+AMD AXI W1 DRIVER
+M:	Kris Chaplin <[email protected]>
+R:	Thomas Delev <[email protected]>
+R:	Michal Simek <[email protected]>
+S:	Maintained
+F:	Documentation/devicetree/bindings/w1/amd,axi-1wire-host.yaml
+
 AMD CDX BUS DRIVER
 M:	Nipun Gupta <[email protected]>
 M:	Nikhil Agarwal <[email protected]>
Signature · 1 line
2.42.GIT
maintainer
#2 lore raw

Re: [RESEND v2 1/2] dt-bindings: w1: Add YAML DT schema for AMD AXI w1 host and MAINTAINERS entry

Quoted 26 lines · Kris Chaplin

Add YAML DT schema for the AMD AXI w1 host IP.

This hardware guarantees protocol timing for driving off-board devices such as thermal sensors, proms, etc using the 1wire protocol.

Add MAINTAINERS entry for DT schema.

---
 .../bindings/w1/amd,axi-1wire-host.yaml       | 44 +++++++++++++++++++
 MAINTAINERS                                   |  7 +++
 2 files changed, 51 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/w1/amd,axi-1wire-host.yaml
Documentation/devicetree/bindings/w1/amd,axi-1wire-host.yaml new file +4 -0
new file mode 100644
index 000000000000..ef70fa2c0c5d
@@ -0,0 +1,44 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/w1/amd,axi-1wire-host.yaml#

Documentation/devicetree/bindings/w1/amd,axi-1wire-host.yaml line 14

Quoted 10 lines
Documentation/devicetree/bindings/w1/amd,axi-1wire-host.yaml new file +10 -0
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: AMD AXI 1-wire bus host for programmable logic
+
+maintainers:
+  - Kris Chaplin <[email protected]>
+
+properties:
+  compatible:
+    const: amd,axi-1wire-host

Is there a device side implementation? I can't really imagine that 1-wire would ever be implemented as firmware on the device side given its limited nature. So adding 'host' doesn't make this any more specific.

Rob

author maintainer
#3 lore raw

Re: [RESEND v2 1/2] dt-bindings: w1: Add YAML DT schema for AMD AXI w1 host and MAINTAINERS entry

Hi Rob,

Quoted 5 lines · Rob Herring

Is there a device side implementation? I can't really imagine that 1-wire would ever be implemented as firmware on the device side given its limited nature. So adding 'host' doesn't make this any more specific.

There are slave drivers as well as master, although these do not have a device tree binding.

The IP device from AMD is called "axi_1wire_host", and so we are hoping to stick with this binding if appropriate as it relates to the IP name.

Regards,
Kris

#4 lore raw

Re: [RESEND v2 1/2] dt-bindings: w1: Add YAML DT schema for AMD AXI w1 host and MAINTAINERS entry

In reply to Rob Herring
Quoted 34 lines · Rob Herring
Quoted 33 lines · Kris Chaplin

Add YAML DT schema for the AMD AXI w1 host IP.

This hardware guarantees protocol timing for driving off-board devices such as thermal sensors, proms, etc using the 1wire protocol.

Add MAINTAINERS entry for DT schema.

---
 .../bindings/w1/amd,axi-1wire-host.yaml       | 44 +++++++++++++++++++
 MAINTAINERS                                   |  7 +++
 2 files changed, 51 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/w1/amd,axi-1wire-host.yaml
Documentation/devicetree/bindings/w1/amd,axi-1wire-host.yaml new file +11 -0
new file mode 100644
index 000000000000..ef70fa2c0c5d
@@ -0,0 +1,44 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/w1/amd,axi-1wire-host.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: AMD AXI 1-wire bus host for programmable logic
+
+maintainers:
+  - Kris Chaplin <[email protected]>
+
Quoted 8 lines

Documentation/devicetree/bindings/w1/amd,axi-1wire-host.yaml line 14

Quoted 3 lines
Documentation/devicetree/bindings/w1/amd,axi-1wire-host.yaml new file +3 -0
+properties:
+  compatible:
+    const: amd,axi-1wire-host

Is there a device side implementation? I can't really imagine that 1-wire would ever be implemented as firmware on the device side given its limited nature. So adding 'host' doesn't make this any more specific.

"host" here means "controller", to avoid the other naming "master/slave".

Best regards,
Krzysztof

A message that is not in the archive (sent off-list or not yet received): [email protected]

maintainer
#6 lore raw

Re: [RESEND v2 1/2] dt-bindings: w1: Add YAML DT schema for AMD AXI w1 host and MAINTAINERS entry

Quoted 11 lines · Kris Chaplin

Hello Rob,

On 30/10/2023 15:40, Rob Herring wrote:

Is there a device side implementation? I can't really imagine that 1-wire would ever be implemented as firmware on the device side given its limited nature. So adding 'host' doesn't make this any more specific.

There are slave drivers as well as master, although these do not have a device tree binding.

My question is whether there is slave/device IP for implementing the device side in software? The slave drivers in the kernel are for handling those devices, not a slave side controller interface.

For comparison, we have SPI slave in the kernel which is for implementing the device side in software (running Linux or another OS). There is no such thing in the kernel for 1-wire and I would doubt there would ever be a software implementation. Could you, yes, but given the limited nature of 1-wire why would you?

Quoted 2 lines

The IP device from AMD is called "axi_1wire_host", and so we are hoping to stick with this binding if appropriate as it relates to the IP name.

Okay, I suppose that is good enough reason.

However, the versioning comments in your first v2 have not been addressed. I believe the conclusion was to mention the IP has a version register. And Conor's R-by tag was not added.

Rob

author maintainer
#7 lore raw

Re: [RESEND v2 1/2] dt-bindings: w1: Add YAML DT schema for AMD AXI w1 host and MAINTAINERS entry

Thanks Rob,

Quoted 11 lines · Rob Herring
Quoted 6 lines

Is there a device side implementation? I can't really imagine that 1-wire would ever be implemented as firmware on the device side given its limited nature. So adding 'host' doesn't make this any more specific.

There are slave drivers as well as master, although these do not have a device tree binding.

My question is whether there is slave/device IP for implementing the device side in software? The slave drivers in the kernel are for handling those devices, not a slave side controller interface.

Quoted 5 lines

For comparison, we have SPI slave in the kernel which is for implementing the device side in software (running Linux or another OS). There is no such thing in the kernel for 1-wire and I would doubt there would ever be a software implementation. Could you, yes, but given the limited nature of 1-wire why would you?

I agree - I'm not aware of any such interface or plans. Yes - I've seen it with SPI, but I've not heard anything similar for 1-wire.

Quoted 5 lines
Quoted 3 lines

The IP device from AMD is called "axi_1wire_host", and so we are hoping to stick with this binding if appropriate as it relates to the IP name.

Okay, I suppose that is good enough reason.

Thank you - it does help when we can align the binding and IP name.

Quoted 3 lines

However, the versioning comments in your first v2 have not been addressed. I believe the conclusion was to mention the IP has a version register. And Conor's R-by tag was not added.

I messed up with not adding a note about this to the commit on v2 which I can resolve in a v3 - yes the versioning is via register in the IP core at a known offset. The binding name (and IP name) changed between v1 and v2 (from master to host) so I didn't add the review tag for Conor in v2 as the commit changed.

regards,
Kris

author maintainer
#8 lore raw

PATCH RESEND v2 2/2 w1: Add AXI 1-wire host driver for AMD programmable logic IP core

In reply to Kris Chaplin

Add a host driver to support the AMD 1-Wire programmable logic IP block. This block guarantees protocol timing for driving off-board devices such as thermal sensors, proms, etc.

Add file to MAINTAINERS

---
 MAINTAINERS                     |   1 +
 drivers/w1/masters/Kconfig      |  11 +
 drivers/w1/masters/Makefile     |   1 +
 drivers/w1/masters/amd_axi_w1.c | 395 ++++++++++++++++++++++++++++++++
 4 files changed, 408 insertions(+)
 create mode 100644 drivers/w1/masters/amd_axi_w1.c
MAINTAINERS +1 -0
index 3dacb7ed6e3b..c31b17df3be9 100644
@@ -896,6 +896,7 @@ R:	Thomas Delev <[email protected]>
 R:	Michal Simek <[email protected]>
 S:	Maintained
 F:	Documentation/devicetree/bindings/w1/amd,axi-1wire-host.yaml
+F:	drivers/w1/masters/amd_axi_w1.c
 
 AMD CDX BUS DRIVER
 M:	Nipun Gupta <[email protected]>
drivers/w1/masters/Kconfig +11 -0
index ad316573288a..513c0b114337 100644
@@ -5,6 +5,17 @@
 
 menu "1-wire Bus Masters"
 
+config W1_MASTER_AMD_AXI
+	tristate "AMD AXI 1-wire bus host"
+	help
+	  Say Y here is you want to support the AMD AXI 1-wire IP core.
+	  This driver makes use of the programmable logic IP to perform
+	  correctly timed 1 wire transactions without relying on GPIO timing
+	  through the kernel.
+
+	  This driver can also be built as a module.  If so, the module will be
+	  called amd_w1_axi.
+
 config W1_MASTER_MATROX
 	tristate "Matrox G400 transport layer for 1-wire"
 	depends on PCI
drivers/w1/masters/Makefile +1 -0
index c5d85a827e52..6c5a21f9b88c 100644
@@ -3,6 +3,7 @@
 # Makefile for 1-wire bus master drivers.
 #
 
+obj-$(CONFIG_W1_MASTER_AMD_AXI)		+= amd_axi_w1.o
 obj-$(CONFIG_W1_MASTER_MATROX)		+= matrox_w1.o
 obj-$(CONFIG_W1_MASTER_DS2490)		+= ds2490.o
 obj-$(CONFIG_W1_MASTER_DS2482)		+= ds2482.o
drivers/w1/masters/amd_axi_w1.c new file +395 -0

395 lines not on this page · raw message

Signature · 1 line
2.42.GIT