Skip to content

Commit

Permalink
drivers: mfd: Add support for Moxtet bus
Browse files Browse the repository at this point in the history
On the Turris Mox router there can be connected different modules to
the main CPU board, currently a module with a SFP cage, a module with
MiniPCIe connector, a 4-port switch module and a 8-port switch module,
for example:
  [CPU]-[PCIe]-[8-port switch]-[8-port switch]-[SFP]

Each of this modules has an input and output shift register, and these
are connected via SPI to CPU board.

Via this SPI connection we are able to discover which modules are
connected and we can also read/write some configuration to the modules.
Fromi/to each module 8 bits can be read (of which lower 4 bits identify
the module) and written.

For example from the module with a SFP cage we can read the LOS,
TX-FAULT and MOD-DEF0 signals, while we can write TX-DISABLE and
RATE-SELECT signals.

Other modules may support something else.

This driver creates a new bus type, called "moxtet". For each Mox module
it finds via SPI, it creates a new device on the moxtet bus so that
drivers can be written for them, for example a gpio driver for the
module with a SFP cage.

The topology of how Mox modules are connected can then be read by
listing /sys/bus/moxtet/devices.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
  • Loading branch information
elkablo authored and intel-lab-lkp committed Aug 30, 2018
1 parent d2c9281 commit 316bda5
Show file tree
Hide file tree
Showing 6 changed files with 658 additions and 0 deletions.
36 changes: 36 additions & 0 deletions Documentation/devicetree/bindings/mfd/moxtet.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
Turris Mox module configuration bus (over SPI)

Required properties:
- compatible : Should be "cznic,moxtet".
- #address-cells : Has to be 1
- #size-cells : Has to be 0
For other required and optional properties of SPI slave
nodes please refer to ../spi/spi-bus.txt.

Required properties of subnodes:
- reg : Should be position on the Moxtet bus
- moxtet,id : Should be ID of the Moxtet device connected

The driver finds the devices connected to the bus by itself, but it may be
needed to reference some of them from other parts of the device tree. In that
case the devices can be defined as subnodes of the moxtet node.

Example:

moxtet@1 {
#address-cells = <1>;
#size-cells = <0>;
compatible = "cznic,moxtet";
reg = <1>;
spi-max-frequency = <1000000>;
spi-cpol;
spi-cpha;

moxtet_sfp: moxtet-sfp@0 {
compatible = "cznic,moxtet-sfp";
gpio-controller;
#gpio-cells;
reg = <0>;
moxtet,id = <1>;
}
};
7 changes: 7 additions & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -1378,6 +1378,13 @@ F: drivers/clocksource/timer-prima2.c
F: drivers/clocksource/timer-atlas7.c
N: [^a-z]sirf

ARM/CZ.NIC TURRIS MOX SUPPORT
M: Marek Behun <marek.behun@nic.cz>
W: http://mox.turris.cz
S: Maintained
F: include/mfd/moxtet.h
F: drivers/mfd/moxtet.c

ARM/EBSA110 MACHINE SUPPORT
M: Russell King <linux@armlinux.org.uk>
L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
Expand Down
10 changes: 10 additions & 0 deletions drivers/mfd/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -814,6 +814,16 @@ config MFD_MAX8998
additional drivers must be enabled in order to use the functionality
of the device.

config MFD_MOXTET
tristate "CZ.NIC Turris Mox module configuration bus"
depends on SPI_MASTER && OF
help
Say yes here to add support for the module configuration bus found
on CZ.NIC's Turris Mox. This is needed for the ability to read
in what order the modules are connected and to get/set some of
their settings. For example the GPIOs on Mox SFP module are
configured through this bus.

config MFD_MT6397
tristate "MediaTek MT6397 PMIC Support"
select MFD_CORE
Expand Down
1 change: 1 addition & 0 deletions drivers/mfd/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ max8925-objs := max8925-core.o max8925-i2c.o
obj-$(CONFIG_MFD_MAX8925) += max8925.o
obj-$(CONFIG_MFD_MAX8997) += max8997.o max8997-irq.o
obj-$(CONFIG_MFD_MAX8998) += max8998.o max8998-irq.o
obj-$(CONFIG_MFD_MOXTET) += moxtet.o

pcf50633-objs := pcf50633-core.o pcf50633-irq.o
obj-$(CONFIG_MFD_PCF50633) += pcf50633.o
Expand Down
Loading

0 comments on commit 316bda5

Please sign in to comment.