Skip to content

Commit 5bc7f99

Browse files
elkabloarndb
authored andcommitted
bus: Add support for Moxtet bus
On the Turris Mox router different modules can be connected to the main CPU board: currently a module with a SFP cage, a module with MiniPCIe connector, a PCIe pass-through MiniPCIe connector module, a 4-port switch module, an 8-port switch module, and a 4-port USB3 module. For example: [CPU]-[PCIe-pass-through]-[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 the CPU board. Via SPI we are able to discover which modules are connected, in which order, and we can also read some information about the modules (eg. their interrupt status), and configure them. From each module 8 bits can be read (of which low 4 bits identify the module) and 8 bits can be 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. 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. It also implements a virtual interrupt controller for the modules which send their interrupt status over the SPI shift register. These modules do this in addition to sending their interrupt status via the shared interrupt line. When the shared interrupt is triggered, we read from the shift register and handle IRQs for all devices which are in interrupt. The topology of how Mox modules are connected can then be read by listing /sys/bus/moxtet/devices. Link: https://lore.kernel.org/r/20190812161118.21476-2-marek.behun@nic.cz Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
1 parent 5ef9eb7 commit 5bc7f99

6 files changed

Lines changed: 1029 additions & 0 deletions

File tree

‎MAINTAINERS‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1626,6 +1626,13 @@ F: drivers/clocksource/timer-atlas7.c
16261626
N: [^a-z]sirf
16271627
X: drivers/gnss
16281628

1629+
ARM/CZ.NIC TURRIS MOX SUPPORT
1630+
M: Marek Behun <marek.behun@nic.cz>
1631+
W: http://mox.turris.cz
1632+
S: Maintained
1633+
F: include/linux/moxtet.h
1634+
F: drivers/bus/moxtet.c
1635+
16291636
ARM/EBSA110 MACHINE SUPPORT
16301637
M: Russell King <linux@armlinux.org.uk>
16311638
L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)

‎drivers/bus/Kconfig‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,16 @@ config BRCMSTB_GISB_ARB
2929
arbiter. This driver provides timeout and target abort error handling
3030
and internal bus master decoding.
3131

32+
config MOXTET
33+
tristate "CZ.NIC Turris Mox module configuration bus"
34+
depends on SPI_MASTER && OF
35+
help
36+
Say yes here to add support for the module configuration bus found
37+
on CZ.NIC's Turris Mox. This is needed for the ability to discover
38+
the order in which the modules are connected and to get/set some of
39+
their settings. For example the GPIOs on Mox SFP module are
40+
configured through this bus.
41+
3242
config HISILICON_LPC
3343
bool "Support for ISA I/O space on HiSilicon Hip06/7"
3444
depends on ARM64 && (ARCH_HISI || COMPILE_TEST)

‎drivers/bus/Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ obj-$(CONFIG_ARM_CCI) += arm-cci.o
88

99
obj-$(CONFIG_HISILICON_LPC) += hisi_lpc.o
1010
obj-$(CONFIG_BRCMSTB_GISB_ARB) += brcmstb_gisb.o
11+
obj-$(CONFIG_MOXTET) += moxtet.o
1112

1213
# DPAA2 fsl-mc bus
1314
obj-$(CONFIG_FSL_MC_BUS) += fsl-mc/

0 commit comments

Comments
 (0)