Commit a7cc3464 authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'mctp-i2c'



Matt Johnston says:

====================
MCTP I2C driver

This patch series adds a netdev driver providing MCTP transport over
I2C.

I think I've addressed all the points raised in v5. It now has
mctp_i2c_unregister() to run things in the correct order, waiting for
the worker thread and I2C rx to complete.

Cheers,
Matt

--

v6:
 - Changed netdev register/unregister/free to avoid races. Ensure that
   netif functions are not used by irq handler/threads after unregister.
 - Fix incoming I2C hwaddr that was previously incorrect (left
   shifted 1 bit)
 - Add a check that byte_count wire header matches the length received
 - Renamed I2C driver to mctp-i2c-interface
 - Removed __func__ from print messages, added missing newlines
 - Removed sysfs mctp_current_mux file which was used for debug
 - Renamed curr_lock to sel_lock
 - Tidied comment formatting
 - Fix newline in Kconfig
v5:
 - Fix incorrect format string
v4:
 - Switch to __i2c_transfer() rather than __i2c_smbus_xfer(), drop 255 byte
   smbus patches
 - Use wait_event_idle() for the sleeping TX thread
 - Use dev_addr_set()
v3:
 - Added Reviewed-bys for npcm7xx
 - Resend with net-next open
v2:
 - Simpler Kconfig condition for i2c-mux dependency, from Randy Dunlap
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 4b340a5a f5b8abf9
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -95,6 +95,10 @@ wants to support one of the below features, it should adapt these bindings.
- smbus-alert
	states that the optional SMBus-Alert feature apply to this bus.

- mctp-controller
	indicates that the system is accessible via this bus as an endpoint for
	MCTP over I2C transport.

Required properties (per child device)
--------------------------------------

+92 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/net/mctp-i2c-controller.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: MCTP I2C transport binding

maintainers:
  - Matt Johnston <matt@codeconstruct.com.au>

description: |
  An mctp-i2c-controller defines a local MCTP endpoint on an I2C controller.
  MCTP I2C is specified by DMTF DSP0237.

  An mctp-i2c-controller must be attached to an I2C adapter which supports
  slave functionality. I2C busses (either directly or as subordinate mux
  busses) are attached to the mctp-i2c-controller with a 'mctp-controller'
  property on each used bus. Each mctp-controller I2C bus will be presented
  to the host system as a separate MCTP I2C instance.

properties:
  compatible:
    const: mctp-i2c-controller

  reg:
    minimum: 0x40000000
    maximum: 0x4000007f
    description: |
      7 bit I2C address of the local endpoint.
      I2C_OWN_SLAVE_ADDRESS (1<<30) flag must be set.

additionalProperties: false

required:
  - compatible
  - reg

examples:
  - |
    // Basic case of a single I2C bus
    #include <dt-bindings/i2c/i2c.h>

    i2c {
      #address-cells = <1>;
      #size-cells = <0>;
      mctp-controller;

      mctp@30 {
        compatible = "mctp-i2c-controller";
        reg = <(0x30 | I2C_OWN_SLAVE_ADDRESS)>;
      };
    };

  - |
    // Mux topology with multiple MCTP-handling busses under
    // a single mctp-i2c-controller.
    // i2c1 and i2c6 can have MCTP devices, i2c5 does not.
    #include <dt-bindings/i2c/i2c.h>

    i2c1: i2c {
      #address-cells = <1>;
      #size-cells = <0>;
      mctp-controller;

      mctp@50 {
        compatible = "mctp-i2c-controller";
        reg = <(0x50 | I2C_OWN_SLAVE_ADDRESS)>;
      };
    };

    i2c-mux {
      #address-cells = <1>;
      #size-cells = <0>;
      i2c-parent = <&i2c1>;

      i2c5: i2c@0 {
        #address-cells = <1>;
        #size-cells = <0>;
        reg = <0>;
        eeprom@33 {
          reg = <0x33>;
        };
      };

      i2c6: i2c@1 {
        #address-cells = <1>;
        #size-cells = <0>;
        reg = <1>;
        mctp-controller;
      };
    };
+12 −0
Original line number Diff line number Diff line
@@ -21,6 +21,18 @@ config MCTP_SERIAL
	  Say y here if you need to connect to MCTP endpoints over serial. To
	  compile as a module, use m; the module will be called mctp-serial.

config MCTP_TRANSPORT_I2C
	tristate "MCTP SMBus/I2C transport"
	# i2c-mux is optional, but we must build as a module if i2c-mux is a module
	depends on I2C_MUX || !I2C_MUX
	depends on I2C
	depends on I2C_SLAVE
	select MCTP_FLOWS
	help
	  Provides a driver to access MCTP devices over SMBus/I2C transport,
	  from DMTF specification DSP0237. A MCTP protocol network device is
	  created for each I2C bus that has been assigned a mctp-i2c device.

endmenu

endif
+1 −0
Original line number Diff line number Diff line
obj-$(CONFIG_MCTP_SERIAL) += mctp-serial.o
obj-$(CONFIG_MCTP_TRANSPORT_I2C) += mctp-i2c.o
+1081 −0

File added.

Preview size limit exceeded, changes collapsed.