pci: Add I2C driver for the PLX PEX8xxx PCIe switch
Subsystems (2)
PATCH 1/4 pci: Add I2C driver for the PLX PEX8xxx PCIe switch
Add a driver that allows talking to the I2C interface of the PLX PEX8xxx family of PCI Express switches. More details about the need and use cases have been described in the documentation being added as part of this patchset.
Currently the devices supported and tested with this driver are:
PEX8614
PEX8618
PEX8713
It should be fairly straight forward to support other PLX8xxx devices, since they use fairly similar command formats. Currently limited to these 3 devices primarily due to lack of hardware for testing (on other devices)..
Signed-off-by Rajat Jain <[email protected]>
Signed-off-by Rajat Jain <[email protected]>
Signed-off-by Guenter Roeck <[email protected]>
--- drivers/pci/Kconfig | 11 ++ drivers/pci/Makefile | 2 + drivers/pci/pex8xxx_i2c.c | 258 +++++++++++++++++++++++++++++++++++++++ include/linux/i2c/pex8xxx_i2c.h | 36 ++++++ 4 files changed, 307 insertions(+) create mode 100644 drivers/pci/pex8xxx_i2c.c create mode 100644 include/linux/i2c/pex8xxx_i2c.h
drivers/pci/Kconfig +11 -0
@@ -115,4 +115,15 @@ config PCI_LABEL def_bool y if (DMI || ACPI) select NLS +config PEX8XXX_I2C + tristate "PLX PEX8xxx Switch I2C interface driver" + depends on I2C + help + Select this if you want I2C interface support for the PLX PEX8xxx + family of PCI express switches. Currently this I2C driver supports + PEX8614, PEX8618, PEX8713 switches. It provides read / write API + calls to talk to the switch (over I2C). + + If built as a module, the driver will be called pex8xxx_i2c. + source "drivers/pci/host/Kconfig"
drivers/pci/Makefile +2 -0
@@ -63,3 +63,5 @@ ccflags-$(CONFIG_PCI_DEBUG) := -DDEBUG # PCI host controller drivers obj-y += host/ + +obj-$(CONFIG_PEX8XXX_I2C) += pex8xxx_i2c.o
drivers/pci/pex8xxx_i2c.c new file +258 -0
258 lines not on this page · raw message
include/linux/i2c/pex8xxx_i2c.h new file +36 -0
@@ -0,0 +1,36 @@ +/* +* Interface for the PEX8xxx I2C slave interface +* +* Rajat Jain <[email protected]> +* Copyright 2014 Juniper Networks +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as published +* by the Free Software Foundation. +*/ + +#ifndef __PEX8XXX_I2C_H__ +#define __PEX8XXX_I2C_H__ + +#include <linux/i2c.h> + +/* Values for "mode" argument */ +#define MODE_TRANSPARENT 0x00 +#define MODE_NT_LINK 0x01 +#define MODE_NT_VIRT 0x02 +#define MODE_DMA 0x03 + +/* Values for "byte_mask" argument */ +#define MASK_BYTE0 0x01 +#define MASK_BYTE1 0x02 +#define MASK_BYTE2 0x04 +#define MASK_BYTE3 0x08 +#define MASK_BYTE_ALL (MASK_BYTE0 | MASK_BYTE1 |\ + MASK_BYTE2 | MASK_BYTE3) + +int pex8xxx_read (struct i2c_client *client,u8 stn,u8 mode,u8 byte_mask, +u8 port,u32 reg,u32 *val); +int pex8xxx_write (struct i2c_client *client,u8 stn,u8 mode,u8 byte_mask, +u8 port,u32 reg,u32 val); + +#endif /* __PEX8XXX_I2C_H__ */
Signature · 1 line
1.7.9.5