Commit 080b47de authored by Logan Gunthorpe's avatar Logan Gunthorpe Committed by Bjorn Helgaas

MicroSemi Switchtec management interface driver

Microsemi's "Switchtec" line of PCI switch devices is already well
supported by the kernel with standard PCI switch drivers.  However, the
Switchtec device advertises a special management endpoint with a separate
PCI function address and class code.  This endpoint enables some additional
functionality which includes:

 * Packet and Byte Counters
 * Switch Firmware Upgrades
 * Event and Error logs
 * Querying port link status
 * Custom user firmware commands

Add a switchtec kernel module which provides PCI driver that exposes a char
device.  The char device provides userspace access to this interface
through read, write and (optionally) poll calls.

A userspace tool and library which utilizes this interface is available
at [1].  This tool takes inspiration (and borrows some code) from
nvme-cli [2].  The tool is largely complete at this time but additional
features may be added in the future.

[1] https://github.com/sbates130272/switchtec-user
[2] https://github.com/linux-nvme/nvme-cli

[Dan Carpenter <dan.carpenter@oracle.com>: don't invert error codes]
[Christophe JAILLET <christophe.jaillet@wanadoo.fr>: fix
switchtec_dev_open() error handling]
Tested-by: default avatarKrishna Dhulipala <krishnad@fb.com>
Signed-off-by: default avatarLogan Gunthorpe <logang@deltatee.com>
Signed-off-by: default avatarStephen Bates <stephen.bates@microsemi.com>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
Reviewed-by: default avatarWei Zhang <wzhang@fb.com>
Reviewed-by: default avatarJens Axboe <axboe@fb.com>
Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent c1ae3cfa
...@@ -9655,6 +9655,14 @@ S: Maintained ...@@ -9655,6 +9655,14 @@ S: Maintained
F: Documentation/devicetree/bindings/pci/aardvark-pci.txt F: Documentation/devicetree/bindings/pci/aardvark-pci.txt
F: drivers/pci/host/pci-aardvark.c F: drivers/pci/host/pci-aardvark.c
PCI DRIVER FOR MICROSEMI SWITCHTEC
M: Kurt Schwemmer <kurt.schwemmer@microsemi.com>
M: Stephen Bates <stephen.bates@microsemi.com>
M: Logan Gunthorpe <logang@deltatee.com>
L: linux-pci@vger.kernel.org
S: Maintained
F: drivers/pci/switch/switchtec*
PCI DRIVER FOR NVIDIA TEGRA PCI DRIVER FOR NVIDIA TEGRA
M: Thierry Reding <thierry.reding@gmail.com> M: Thierry Reding <thierry.reding@gmail.com>
L: linux-tegra@vger.kernel.org L: linux-tegra@vger.kernel.org
......
...@@ -134,3 +134,4 @@ config PCI_HYPERV ...@@ -134,3 +134,4 @@ config PCI_HYPERV
source "drivers/pci/hotplug/Kconfig" source "drivers/pci/hotplug/Kconfig"
source "drivers/pci/dwc/Kconfig" source "drivers/pci/dwc/Kconfig"
source "drivers/pci/host/Kconfig" source "drivers/pci/host/Kconfig"
source "drivers/pci/switch/Kconfig"
...@@ -68,3 +68,4 @@ ccflags-$(CONFIG_PCI_DEBUG) := -DDEBUG ...@@ -68,3 +68,4 @@ ccflags-$(CONFIG_PCI_DEBUG) := -DDEBUG
# PCI host controller drivers # PCI host controller drivers
obj-y += host/ obj-y += host/
obj-y += switch/
menu "PCI switch controller drivers"
depends on PCI
config PCI_SW_SWITCHTEC
tristate "MicroSemi Switchtec PCIe Switch Management Driver"
help
Enables support for the management interface for the MicroSemi
Switchtec series of PCIe switches. Supports userspace access
to submit MRPC commands to the switch via /dev/switchtecX
devices. See <file:Documentation/switchtec.txt> for more
information.
endmenu
obj-$(CONFIG_PCI_SW_SWITCHTEC) += switchtec.o
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment