[PATCH] net: usb: asix88179_178a: Add support for the Belkin B2B128
The Belkin B2B128 is a USB 3.0 Hub + Gigabit Ethernet Adapter, the Ethernet adapter uses the ASIX AX88179 USB 3.0 to Gigabit Ethernet chip supported by this driver, add the USB ID for the same. This patch is based on work by Geoffrey Tran <geoffrey.t...@gmail.com> who has indicated they would like this upstreamed by someone more familiar with the upstreaming process. Signed-off-by: Andrew F. Davis <a...@ti.com> --- drivers/net/usb/ax88179_178a.c | 16 1 file changed, 16 insertions(+) diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c index 51cf60092a18..4037ab27734a 100644 --- a/drivers/net/usb/ax88179_178a.c +++ b/drivers/net/usb/ax88179_178a.c @@ -1722,6 +1722,18 @@ static const struct driver_info lenovo_info = { .tx_fixup = ax88179_tx_fixup, }; +static const struct driver_info belkin_info = { + .description = "Belkin USB Ethernet Adapter", + .bind = ax88179_bind, + .unbind = ax88179_unbind, + .status = ax88179_status, + .link_reset = ax88179_link_reset, + .reset = ax88179_reset, + .flags = FLAG_ETHER | FLAG_FRAMING_AX, + .rx_fixup = ax88179_rx_fixup, + .tx_fixup = ax88179_tx_fixup, +}; + static const struct usb_device_id products[] = { { /* ASIX AX88179 10/100/1000 */ @@ -1751,6 +1763,10 @@ static const struct usb_device_id products[] = { /* Lenovo OneLinkDock Gigabit LAN */ USB_DEVICE(0x17ef, 0x304b), .driver_info = (unsigned long)_info, +}, { + /* Belkin B2B128 USB 3.0 Hub + Gigabit Ethernet Adapter */ + USB_DEVICE(0x050d, 0x0128), + .driver_info = (unsigned long)_info, }, { }, }; -- 2.13.0 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v4 1/2] mfd: ti-smusbdig: Add support for the TI SM-USB-DIG
On 08/09/2016 10:27 AM, Lee Jones wrote: > On Tue, 09 Aug 2016, Andrew F. Davis wrote: > >> The TI SM-USB-DIG is a USB to SPI/I2C/1Wire/GPIO adapter. >> Add MFD core support. >> >> Signed-off-by: Andrew F. Davis <a...@ti.com> >> --- >> drivers/mfd/Kconfig | 9 +++ >> drivers/mfd/Makefile| 2 + >> drivers/mfd/ti-smusbdig.c | 138 >> >> include/linux/mfd/ti-smusbdig.h | 75 ++ >> 4 files changed, 224 insertions(+) >> create mode 100644 drivers/mfd/ti-smusbdig.c >> create mode 100644 include/linux/mfd/ti-smusbdig.h > > Still requires a DT Ack. > > Please ping the relevant guys. > This driver doesn't touch DT. If you meant USB, could you give me a hint as to who needs to ack drivers that communicate over USB? -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 1/2] mfd: ti-smusbdig: Add support for the TI SM-USB-DIG
The TI SM-USB-DIG is a USB to SPI/I2C/1Wire/GPIO adapter. Add MFD core support. Signed-off-by: Andrew F. Davis <a...@ti.com> --- drivers/mfd/Kconfig | 9 +++ drivers/mfd/Makefile| 2 + drivers/mfd/ti-smusbdig.c | 138 include/linux/mfd/ti-smusbdig.h | 75 ++ 4 files changed, 224 insertions(+) create mode 100644 drivers/mfd/ti-smusbdig.c create mode 100644 include/linux/mfd/ti-smusbdig.h diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 2d1fb64..0b63431 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -1387,6 +1387,15 @@ config MFD_LM3533 additional drivers must be enabled in order to use the LED, backlight or ambient-light-sensor functionality of the device. +config MFD_TI_SMUSBDIG + tristate "Texas Instruments SM-USB-DIG interface adapter" + depends on USB + select MFD_CORE + help + Support for the TI SM-USB-DIG USB to SPI/I2C/1Wire/GPIO adapter. + Additional drivers such as SPI_TI_SMUSBDIG, I2C_TI_SMUSBDIG, etc. must + be enabled in order to use the functionality of the device. + config MFD_TIMBERDALE tristate "Timberdale FPGA" select MFD_CORE diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index 2ba3ba3..aa2845e 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile @@ -68,6 +68,8 @@ obj-$(CONFIG_MFD_WM8350_I2C) += wm8350-i2c.o wm8994-objs:= wm8994-core.o wm8994-irq.o wm8994-regmap.o obj-$(CONFIG_MFD_WM8994) += wm8994.o +obj-$(CONFIG_MFD_TI_SMUSBDIG) += ti-smusbdig.o + obj-$(CONFIG_TPS6105X) += tps6105x.o obj-$(CONFIG_TPS65010) += tps65010.o obj-$(CONFIG_TPS6507X) += tps6507x.o diff --git a/drivers/mfd/ti-smusbdig.c b/drivers/mfd/ti-smusbdig.c new file mode 100644 index 000..19f48c6 --- /dev/null +++ b/drivers/mfd/ti-smusbdig.c @@ -0,0 +1,138 @@ +/* + * MFD Core driver for TI SM-USB-DIG + * + * Copyright (C) 2016 Texas Instruments Incorporated - http://www.ti.com/ + * Andrew F. Davis <a...@ti.com> + * + * 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. + * + * This program is distributed "as is" WITHOUT ANY WARRANTY of any + * kind, whether expressed or implied; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License version 2 for more details. + */ + +#include +#include +#include +#include + +#define TI_USB_VENDOR_ID0x0451 +#define TI_USB_DEVICE_ID_SM_USB_DIG 0x2f90 + +#define TI_SMUSBDIG_USB_TIMEOUT_MS 1000 + +struct ti_smusbdig_device { + struct usb_device *usb_dev; + struct usb_interface *interface; +}; + +int ti_smusbdig_xfer(struct ti_smusbdig_device *ti_smusbdig, +u8 *buffer, int size) +{ + struct device *dev = _smusbdig->interface->dev; + int actual_length, ret; + + if (!ti_smusbdig || !buffer || size <= 0) + return -EINVAL; + + ret = usb_interrupt_msg(ti_smusbdig->usb_dev, + usb_sndctrlpipe(ti_smusbdig->usb_dev, 1), + buffer, size, _length, + TI_SMUSBDIG_USB_TIMEOUT_MS); + if (ret) { + dev_err(dev, "USB transaction failed\n"); + return ret; + } + + ret = usb_interrupt_msg(ti_smusbdig->usb_dev, + usb_rcvctrlpipe(ti_smusbdig->usb_dev, 1), + buffer, TI_SMUSBDIG_PACKET_SIZE, _length, + TI_SMUSBDIG_USB_TIMEOUT_MS); + if (ret) { + dev_err(dev, "USB transaction failed\n"); + return ret; + } + + return 0; +} +EXPORT_SYMBOL_GPL(ti_smusbdig_xfer); + +static const struct mfd_cell ti_smusbdig_mfd_cells[] = { + { .name = "ti-sm-usb-dig-gpio", }, + { .name = "ti-sm-usb-dig-i2c", }, + { .name = "ti-sm-usb-dig-spi", }, + { .name = "ti-sm-usb-dig-w1", }, +}; + +static int ti_smusbdig_probe(struct usb_interface *interface, +const struct usb_device_id *usb_id) +{ + struct usb_host_interface *hostif = interface->cur_altsetting; + struct device *dev = >dev; + struct ti_smusbdig_device *ti_smusbdig; + u8 buffer[TI_SMUSBDIG_PACKET_SIZE]; + int ret; + + if (hostif->desc.bInterfaceNumber != 0 || + hostif->desc.bNumEndpoints < 2) + return -ENODEV; + + ti_smusbdig = devm_kzalloc(dev, sizeof(*ti_smusbdig), GFP_KERNEL); + if (!ti_smusbdig) + return -ENOMEM; + + ti_smusb
[PATCH v4 0/2] Add support for the TI SM-USB-DIG
Hello all, This series adds initial support for the TI SM-USB-DIG, this is a USB to I2C/SPI/1Wire/GPIO adapter, we only add support for I2C here, drivers for the other protocols are still in the works. Thanks, Andrew Changes from v3: - Rebased on v4.8-rc1 - Added this cover letter to track series changes Changes from v2: - Rename sm-usb-dig -> ti-smusbdig - Inline helper functions in header - Alphabetize includes Changes from v1: - Added missing dependency on USB to Kconfig Andrew F. Davis (2): mfd: ti-smusbdig: Add support for the TI SM-USB-DIG i2c: ti-smusbdig: add TI SM-USB-DIG I2C bus driver drivers/i2c/busses/Kconfig | 10 ++ drivers/i2c/busses/Makefile | 1 + drivers/i2c/busses/i2c-ti-smusbdig.c | 189 +++ drivers/mfd/Kconfig | 9 ++ drivers/mfd/Makefile | 2 + drivers/mfd/ti-smusbdig.c| 138 + include/linux/mfd/ti-smusbdig.h | 75 ++ 7 files changed, 424 insertions(+) create mode 100644 drivers/i2c/busses/i2c-ti-smusbdig.c create mode 100644 drivers/mfd/ti-smusbdig.c create mode 100644 include/linux/mfd/ti-smusbdig.h -- 2.9.2 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 2/2] i2c: ti-smusbdig: add TI SM-USB-DIG I2C bus driver
Add support for the I2C bus functionality of the TI SM-USB-DIG. Signed-off-by: Andrew F. Davis <a...@ti.com> --- drivers/i2c/busses/Kconfig | 10 ++ drivers/i2c/busses/Makefile | 1 + drivers/i2c/busses/i2c-ti-smusbdig.c | 189 +++ 3 files changed, 200 insertions(+) create mode 100644 drivers/i2c/busses/i2c-ti-smusbdig.c diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig index 5c3993b..fe8bee8 100644 --- a/drivers/i2c/busses/Kconfig +++ b/drivers/i2c/busses/Kconfig @@ -1079,6 +1079,16 @@ config I2C_ROBOTFUZZ_OSIF This driver can also be built as a module. If so, the module will be called i2c-osif. +config I2C_TI_SMUSBDIG + tristate "Texas Instruments SM-USB-DIG I2C interface" + depends on MFD_TI_SMUSBDIG + help + This adds support for the I2C bus functionality of the + TI SM-USB-DIG USB interface adapter. + + This driver can also be built as a module. If so, the module + will be called i2c-ti-smusbdig. + config I2C_TAOS_EVM tristate "TAOS evaluation module" depends on TTY diff --git a/drivers/i2c/busses/Makefile b/drivers/i2c/busses/Makefile index 37f2819..38c0d87 100644 --- a/drivers/i2c/busses/Makefile +++ b/drivers/i2c/busses/Makefile @@ -103,6 +103,7 @@ obj-$(CONFIG_I2C_DLN2) += i2c-dln2.o obj-$(CONFIG_I2C_PARPORT) += i2c-parport.o obj-$(CONFIG_I2C_PARPORT_LIGHT)+= i2c-parport-light.o obj-$(CONFIG_I2C_ROBOTFUZZ_OSIF) += i2c-robotfuzz-osif.o +obj-$(CONFIG_I2C_TI_SMUSBDIG) += i2c-ti-smusbdig.o obj-$(CONFIG_I2C_TAOS_EVM) += i2c-taos-evm.o obj-$(CONFIG_I2C_TINY_USB) += i2c-tiny-usb.o obj-$(CONFIG_I2C_VIPERBOARD) += i2c-viperboard.o diff --git a/drivers/i2c/busses/i2c-ti-smusbdig.c b/drivers/i2c/busses/i2c-ti-smusbdig.c new file mode 100644 index 000..dfd3ca0 --- /dev/null +++ b/drivers/i2c/busses/i2c-ti-smusbdig.c @@ -0,0 +1,189 @@ +/* + * I2C bus driver for TI SM-USB-DIG + * + * Copyright (C) 2016 Texas Instruments Incorporated - http://www.ti.com/ + * Andrew F. Davis <a...@ti.com> + * + * 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. + * + * This program is distributed "as is" WITHOUT ANY WARRANTY of any + * kind, whether expressed or implied; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License version 2 for more details. + */ + +#include +#include +#include +#include + +/* (data size - start condition - address - ACK) / ACK after data byte */ +#define TI_SMUSBDIG_I2C_MAX_MSG ((TI_SMUSBDIG_DATA_SIZE - 3) / 2) + +struct ti_smusbdig_i2c { + struct device *dev; + struct ti_smusbdig_device *ti_smusbdig; + struct i2c_adapter adapter; +}; + +enum ti_smusbdig_i2c_command { + TI_SMUSBDIG_I2C_START = 0x3, + TI_SMUSBDIG_I2C_STOP = 0x4, + TI_SMUSBDIG_I2C_ACKM = 0x5, + TI_SMUSBDIG_I2C_ACKS = 0x6, +}; + +static void ti_smusbdig_i2c_packet_init(struct ti_smusbdig_packet *packet) +{ + memset(packet, 0, sizeof(*packet)); + packet->function = TI_SMUSBDIG_I2C; + packet->channel = 0x1; +} + +static int ti_smusbdig_i2c_xfer(struct i2c_adapter *adapter, + struct i2c_msg *msgs, int num) +{ + struct ti_smusbdig_i2c *ti_smusbdig_i2c = i2c_get_adapdata(adapter); + struct ti_smusbdig_packet packet; + int i, j, k, ret; + + for (i = 0; i < num; i++) { + ti_smusbdig_i2c_packet_init(); + ti_smusbdig_packet_add_command(, TI_SMUSBDIG_I2C_START); + /* add read bit to address if needed */ + msgs[i].addr <<= 1; + if (msgs[i].flags & I2C_M_RD) + msgs[i].addr |= BIT(0); + ti_smusbdig_packet_add_data(, msgs[i].addr); + ti_smusbdig_packet_add_command(, TI_SMUSBDIG_I2C_ACKS); + if (msgs[i].flags & I2C_M_RD) { + for (j = 0; j < msgs[i].len; j++) { + ti_smusbdig_packet_add_data(, 0xff); + ti_smusbdig_packet_add_command(, TI_SMUSBDIG_I2C_ACKM); + } + } else { + for (j = 0; j < msgs[i].len; j++) { + ti_smusbdig_packet_add_data(, msgs[i].buf[j]); + ti_smusbdig_packet_add_command(, TI_SMUSBDIG_I2C_ACKS); + } + } + + ret = ti_smusbdig_xfer(ti_smusbdig_i2c->ti_smusbdig, + (u8 *), sizeof(packet)); + if (ret) + return ret; + + /* +* now we
Re: [PATCH v3 1/2] mfd: ti-smusbdig: Add support for the TI SM-USB-DIG
On 06/15/2016 10:43 AM, Lee Jones wrote: > This requires a USB Ack. > >> The TI SM-USB-DIG is a USB to SPI/I2C/1Wire/GPIO adapter. >> Add MFD core support. >> >> Signed-off-by: Andrew F. Davis <a...@ti.com> >> --- > > Where is the change log from v1 => v2? > Looking at a diff of the two it looks like all the changes are related to your v1 feedback: - Rename sm-usb-dig -> ti-smusbdig - Inline helper functions in header - Alphabetize includes >> Changes from v2: >> - Add missing dependency on USB, thanks kbuild test robot >> >> drivers/mfd/Kconfig | 9 +++ >> drivers/mfd/Makefile| 2 + >> drivers/mfd/ti-smusbdig.c | 138 >> >> include/linux/mfd/ti-smusbdig.h | 75 ++ >> 4 files changed, 224 insertions(+) >> create mode 100644 drivers/mfd/ti-smusbdig.c >> create mode 100644 include/linux/mfd/ti-smusbdig.h > -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 1/2] mfd: ti-smusbdig: Add support for the TI SM-USB-DIG
The TI SM-USB-DIG is a USB to SPI/I2C/1Wire/GPIO adapter. Add MFD core support. Signed-off-by: Andrew F. Davis <a...@ti.com> --- Changes from v2: - Add missing dependency on USB, thanks kbuild test robot drivers/mfd/Kconfig | 9 +++ drivers/mfd/Makefile| 2 + drivers/mfd/ti-smusbdig.c | 138 include/linux/mfd/ti-smusbdig.h | 75 ++ 4 files changed, 224 insertions(+) create mode 100644 drivers/mfd/ti-smusbdig.c create mode 100644 include/linux/mfd/ti-smusbdig.h diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 1bcf601..af50230 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -1373,6 +1373,15 @@ config MFD_LM3533 additional drivers must be enabled in order to use the LED, backlight or ambient-light-sensor functionality of the device. +config MFD_TI_SMUSBDIG + tristate "Texas Instruments SM-USB-DIG interface adapter" + depends on USB + select MFD_CORE + help + Support for the TI SM-USB-DIG USB to SPI/I2C/1Wire/GPIO adapter. + Additional drivers such as SPI_TI_SMUSBDIG, I2C_TI_SMUSBDIG, etc. must + be enabled in order to use the functionality of the device. + config MFD_TIMBERDALE tristate "Timberdale FPGA" select MFD_CORE diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index 42a66e1..4533b95 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile @@ -68,6 +68,8 @@ obj-$(CONFIG_MFD_WM8350_I2C) += wm8350-i2c.o wm8994-objs:= wm8994-core.o wm8994-irq.o wm8994-regmap.o obj-$(CONFIG_MFD_WM8994) += wm8994.o +obj-$(CONFIG_MFD_TI_SMUSBDIG) += ti-smusbdig.o + obj-$(CONFIG_TPS6105X) += tps6105x.o obj-$(CONFIG_TPS65010) += tps65010.o obj-$(CONFIG_TPS6507X) += tps6507x.o diff --git a/drivers/mfd/ti-smusbdig.c b/drivers/mfd/ti-smusbdig.c new file mode 100644 index 000..19f48c6 --- /dev/null +++ b/drivers/mfd/ti-smusbdig.c @@ -0,0 +1,138 @@ +/* + * MFD Core driver for TI SM-USB-DIG + * + * Copyright (C) 2016 Texas Instruments Incorporated - http://www.ti.com/ + * Andrew F. Davis <a...@ti.com> + * + * 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. + * + * This program is distributed "as is" WITHOUT ANY WARRANTY of any + * kind, whether expressed or implied; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License version 2 for more details. + */ + +#include +#include +#include +#include + +#define TI_USB_VENDOR_ID0x0451 +#define TI_USB_DEVICE_ID_SM_USB_DIG 0x2f90 + +#define TI_SMUSBDIG_USB_TIMEOUT_MS 1000 + +struct ti_smusbdig_device { + struct usb_device *usb_dev; + struct usb_interface *interface; +}; + +int ti_smusbdig_xfer(struct ti_smusbdig_device *ti_smusbdig, +u8 *buffer, int size) +{ + struct device *dev = _smusbdig->interface->dev; + int actual_length, ret; + + if (!ti_smusbdig || !buffer || size <= 0) + return -EINVAL; + + ret = usb_interrupt_msg(ti_smusbdig->usb_dev, + usb_sndctrlpipe(ti_smusbdig->usb_dev, 1), + buffer, size, _length, + TI_SMUSBDIG_USB_TIMEOUT_MS); + if (ret) { + dev_err(dev, "USB transaction failed\n"); + return ret; + } + + ret = usb_interrupt_msg(ti_smusbdig->usb_dev, + usb_rcvctrlpipe(ti_smusbdig->usb_dev, 1), + buffer, TI_SMUSBDIG_PACKET_SIZE, _length, + TI_SMUSBDIG_USB_TIMEOUT_MS); + if (ret) { + dev_err(dev, "USB transaction failed\n"); + return ret; + } + + return 0; +} +EXPORT_SYMBOL_GPL(ti_smusbdig_xfer); + +static const struct mfd_cell ti_smusbdig_mfd_cells[] = { + { .name = "ti-sm-usb-dig-gpio", }, + { .name = "ti-sm-usb-dig-i2c", }, + { .name = "ti-sm-usb-dig-spi", }, + { .name = "ti-sm-usb-dig-w1", }, +}; + +static int ti_smusbdig_probe(struct usb_interface *interface, +const struct usb_device_id *usb_id) +{ + struct usb_host_interface *hostif = interface->cur_altsetting; + struct device *dev = >dev; + struct ti_smusbdig_device *ti_smusbdig; + u8 buffer[TI_SMUSBDIG_PACKET_SIZE]; + int ret; + + if (hostif->desc.bInterfaceNumber != 0 || + hostif->desc.bNumEndpoints < 2) + return -ENODEV; + + ti_smusbdig = devm_kzalloc(dev, sizeof(*ti_smusbdig), GFP_KER
[PATCH v3 2/2] i2c: ti-smusbdig: add TI SM-USB-DIG I2C bus driver
Add support for the I2C bus functionality of the TI SM-USB-DIG. Signed-off-by: Andrew F. Davis <a...@ti.com> --- drivers/i2c/busses/Kconfig | 10 ++ drivers/i2c/busses/Makefile | 1 + drivers/i2c/busses/i2c-ti-smusbdig.c | 189 +++ 3 files changed, 200 insertions(+) create mode 100644 drivers/i2c/busses/i2c-ti-smusbdig.c diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig index f167021..82be651 100644 --- a/drivers/i2c/busses/Kconfig +++ b/drivers/i2c/busses/Kconfig @@ -1076,6 +1076,16 @@ config I2C_ROBOTFUZZ_OSIF This driver can also be built as a module. If so, the module will be called i2c-osif. +config I2C_TI_SMUSBDIG + tristate "Texas Instruments SM-USB-DIG I2C interface" + depends on MFD_TI_SMUSBDIG + help + This adds support for the I2C bus functionality of the + TI SM-USB-DIG USB interface adapter. + + This driver can also be built as a module. If so, the module + will be called i2c-ti-smusbdig. + config I2C_TAOS_EVM tristate "TAOS evaluation module" depends on TTY diff --git a/drivers/i2c/busses/Makefile b/drivers/i2c/busses/Makefile index 37f2819..38c0d87 100644 --- a/drivers/i2c/busses/Makefile +++ b/drivers/i2c/busses/Makefile @@ -103,6 +103,7 @@ obj-$(CONFIG_I2C_DLN2) += i2c-dln2.o obj-$(CONFIG_I2C_PARPORT) += i2c-parport.o obj-$(CONFIG_I2C_PARPORT_LIGHT)+= i2c-parport-light.o obj-$(CONFIG_I2C_ROBOTFUZZ_OSIF) += i2c-robotfuzz-osif.o +obj-$(CONFIG_I2C_TI_SMUSBDIG) += i2c-ti-smusbdig.o obj-$(CONFIG_I2C_TAOS_EVM) += i2c-taos-evm.o obj-$(CONFIG_I2C_TINY_USB) += i2c-tiny-usb.o obj-$(CONFIG_I2C_VIPERBOARD) += i2c-viperboard.o diff --git a/drivers/i2c/busses/i2c-ti-smusbdig.c b/drivers/i2c/busses/i2c-ti-smusbdig.c new file mode 100644 index 000..dfd3ca0 --- /dev/null +++ b/drivers/i2c/busses/i2c-ti-smusbdig.c @@ -0,0 +1,189 @@ +/* + * I2C bus driver for TI SM-USB-DIG + * + * Copyright (C) 2016 Texas Instruments Incorporated - http://www.ti.com/ + * Andrew F. Davis <a...@ti.com> + * + * 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. + * + * This program is distributed "as is" WITHOUT ANY WARRANTY of any + * kind, whether expressed or implied; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License version 2 for more details. + */ + +#include +#include +#include +#include + +/* (data size - start condition - address - ACK) / ACK after data byte */ +#define TI_SMUSBDIG_I2C_MAX_MSG ((TI_SMUSBDIG_DATA_SIZE - 3) / 2) + +struct ti_smusbdig_i2c { + struct device *dev; + struct ti_smusbdig_device *ti_smusbdig; + struct i2c_adapter adapter; +}; + +enum ti_smusbdig_i2c_command { + TI_SMUSBDIG_I2C_START = 0x3, + TI_SMUSBDIG_I2C_STOP = 0x4, + TI_SMUSBDIG_I2C_ACKM = 0x5, + TI_SMUSBDIG_I2C_ACKS = 0x6, +}; + +static void ti_smusbdig_i2c_packet_init(struct ti_smusbdig_packet *packet) +{ + memset(packet, 0, sizeof(*packet)); + packet->function = TI_SMUSBDIG_I2C; + packet->channel = 0x1; +} + +static int ti_smusbdig_i2c_xfer(struct i2c_adapter *adapter, + struct i2c_msg *msgs, int num) +{ + struct ti_smusbdig_i2c *ti_smusbdig_i2c = i2c_get_adapdata(adapter); + struct ti_smusbdig_packet packet; + int i, j, k, ret; + + for (i = 0; i < num; i++) { + ti_smusbdig_i2c_packet_init(); + ti_smusbdig_packet_add_command(, TI_SMUSBDIG_I2C_START); + /* add read bit to address if needed */ + msgs[i].addr <<= 1; + if (msgs[i].flags & I2C_M_RD) + msgs[i].addr |= BIT(0); + ti_smusbdig_packet_add_data(, msgs[i].addr); + ti_smusbdig_packet_add_command(, TI_SMUSBDIG_I2C_ACKS); + if (msgs[i].flags & I2C_M_RD) { + for (j = 0; j < msgs[i].len; j++) { + ti_smusbdig_packet_add_data(, 0xff); + ti_smusbdig_packet_add_command(, TI_SMUSBDIG_I2C_ACKM); + } + } else { + for (j = 0; j < msgs[i].len; j++) { + ti_smusbdig_packet_add_data(, msgs[i].buf[j]); + ti_smusbdig_packet_add_command(, TI_SMUSBDIG_I2C_ACKS); + } + } + + ret = ti_smusbdig_xfer(ti_smusbdig_i2c->ti_smusbdig, + (u8 *), sizeof(packet)); + if (ret) + return ret; + + /* +* now we
[PATCH v2 2/2] i2c: ti-smusbdig: add TI SM-USB-DIG I2C bus driver
Add support for the I2C bus functionality of the TI SM-USB-DIG. Signed-off-by: Andrew F. Davis <a...@ti.com> --- drivers/i2c/busses/Kconfig | 10 ++ drivers/i2c/busses/Makefile | 1 + drivers/i2c/busses/i2c-ti-smusbdig.c | 189 +++ 3 files changed, 200 insertions(+) create mode 100644 drivers/i2c/busses/i2c-ti-smusbdig.c diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig index f167021..82be651 100644 --- a/drivers/i2c/busses/Kconfig +++ b/drivers/i2c/busses/Kconfig @@ -1076,6 +1076,16 @@ config I2C_ROBOTFUZZ_OSIF This driver can also be built as a module. If so, the module will be called i2c-osif. +config I2C_TI_SMUSBDIG + tristate "Texas Instruments SM-USB-DIG I2C interface" + depends on MFD_TI_SMUSBDIG + help + This adds support for the I2C bus functionality of the + TI SM-USB-DIG USB interface adapter. + + This driver can also be built as a module. If so, the module + will be called i2c-ti-smusbdig. + config I2C_TAOS_EVM tristate "TAOS evaluation module" depends on TTY diff --git a/drivers/i2c/busses/Makefile b/drivers/i2c/busses/Makefile index 37f2819..38c0d87 100644 --- a/drivers/i2c/busses/Makefile +++ b/drivers/i2c/busses/Makefile @@ -103,6 +103,7 @@ obj-$(CONFIG_I2C_DLN2) += i2c-dln2.o obj-$(CONFIG_I2C_PARPORT) += i2c-parport.o obj-$(CONFIG_I2C_PARPORT_LIGHT)+= i2c-parport-light.o obj-$(CONFIG_I2C_ROBOTFUZZ_OSIF) += i2c-robotfuzz-osif.o +obj-$(CONFIG_I2C_TI_SMUSBDIG) += i2c-ti-smusbdig.o obj-$(CONFIG_I2C_TAOS_EVM) += i2c-taos-evm.o obj-$(CONFIG_I2C_TINY_USB) += i2c-tiny-usb.o obj-$(CONFIG_I2C_VIPERBOARD) += i2c-viperboard.o diff --git a/drivers/i2c/busses/i2c-ti-smusbdig.c b/drivers/i2c/busses/i2c-ti-smusbdig.c new file mode 100644 index 000..dfd3ca0 --- /dev/null +++ b/drivers/i2c/busses/i2c-ti-smusbdig.c @@ -0,0 +1,189 @@ +/* + * I2C bus driver for TI SM-USB-DIG + * + * Copyright (C) 2016 Texas Instruments Incorporated - http://www.ti.com/ + * Andrew F. Davis <a...@ti.com> + * + * 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. + * + * This program is distributed "as is" WITHOUT ANY WARRANTY of any + * kind, whether expressed or implied; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License version 2 for more details. + */ + +#include +#include +#include +#include + +/* (data size - start condition - address - ACK) / ACK after data byte */ +#define TI_SMUSBDIG_I2C_MAX_MSG ((TI_SMUSBDIG_DATA_SIZE - 3) / 2) + +struct ti_smusbdig_i2c { + struct device *dev; + struct ti_smusbdig_device *ti_smusbdig; + struct i2c_adapter adapter; +}; + +enum ti_smusbdig_i2c_command { + TI_SMUSBDIG_I2C_START = 0x3, + TI_SMUSBDIG_I2C_STOP = 0x4, + TI_SMUSBDIG_I2C_ACKM = 0x5, + TI_SMUSBDIG_I2C_ACKS = 0x6, +}; + +static void ti_smusbdig_i2c_packet_init(struct ti_smusbdig_packet *packet) +{ + memset(packet, 0, sizeof(*packet)); + packet->function = TI_SMUSBDIG_I2C; + packet->channel = 0x1; +} + +static int ti_smusbdig_i2c_xfer(struct i2c_adapter *adapter, + struct i2c_msg *msgs, int num) +{ + struct ti_smusbdig_i2c *ti_smusbdig_i2c = i2c_get_adapdata(adapter); + struct ti_smusbdig_packet packet; + int i, j, k, ret; + + for (i = 0; i < num; i++) { + ti_smusbdig_i2c_packet_init(); + ti_smusbdig_packet_add_command(, TI_SMUSBDIG_I2C_START); + /* add read bit to address if needed */ + msgs[i].addr <<= 1; + if (msgs[i].flags & I2C_M_RD) + msgs[i].addr |= BIT(0); + ti_smusbdig_packet_add_data(, msgs[i].addr); + ti_smusbdig_packet_add_command(, TI_SMUSBDIG_I2C_ACKS); + if (msgs[i].flags & I2C_M_RD) { + for (j = 0; j < msgs[i].len; j++) { + ti_smusbdig_packet_add_data(, 0xff); + ti_smusbdig_packet_add_command(, TI_SMUSBDIG_I2C_ACKM); + } + } else { + for (j = 0; j < msgs[i].len; j++) { + ti_smusbdig_packet_add_data(, msgs[i].buf[j]); + ti_smusbdig_packet_add_command(, TI_SMUSBDIG_I2C_ACKS); + } + } + + ret = ti_smusbdig_xfer(ti_smusbdig_i2c->ti_smusbdig, + (u8 *), sizeof(packet)); + if (ret) + return ret; + + /* +* now we
[PATCH v2 1/2] mfd: ti-smusbdig: Add support for the TI SM-USB-DIG
The TI SM-USB-DIG is a USB to SPI/I2C/1Wire/GPIO adapter. Add MFD core support. Signed-off-by: Andrew F. Davis <a...@ti.com> --- drivers/mfd/Kconfig | 8 +++ drivers/mfd/Makefile| 2 + drivers/mfd/ti-smusbdig.c | 138 include/linux/mfd/ti-smusbdig.h | 75 ++ 4 files changed, 223 insertions(+) create mode 100644 drivers/mfd/ti-smusbdig.c create mode 100644 include/linux/mfd/ti-smusbdig.h diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 1bcf601..cabbf60 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -1373,6 +1373,14 @@ config MFD_LM3533 additional drivers must be enabled in order to use the LED, backlight or ambient-light-sensor functionality of the device. +config MFD_TI_SMUSBDIG + tristate "Texas Instruments SM-USB-DIG interface adapter" + select MFD_CORE + help + Support for the TI SM-USB-DIG USB to SPI/I2C/1Wire/GPIO adapter. + Additional drivers such as SPI_TI_SMUSBDIG, I2C_TI_SMUSBDIG, etc. must + be enabled in order to use the functionality of the device. + config MFD_TIMBERDALE tristate "Timberdale FPGA" select MFD_CORE diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index 42a66e1..4533b95 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile @@ -68,6 +68,8 @@ obj-$(CONFIG_MFD_WM8350_I2C) += wm8350-i2c.o wm8994-objs:= wm8994-core.o wm8994-irq.o wm8994-regmap.o obj-$(CONFIG_MFD_WM8994) += wm8994.o +obj-$(CONFIG_MFD_TI_SMUSBDIG) += ti-smusbdig.o + obj-$(CONFIG_TPS6105X) += tps6105x.o obj-$(CONFIG_TPS65010) += tps65010.o obj-$(CONFIG_TPS6507X) += tps6507x.o diff --git a/drivers/mfd/ti-smusbdig.c b/drivers/mfd/ti-smusbdig.c new file mode 100644 index 000..19f48c6 --- /dev/null +++ b/drivers/mfd/ti-smusbdig.c @@ -0,0 +1,138 @@ +/* + * MFD Core driver for TI SM-USB-DIG + * + * Copyright (C) 2016 Texas Instruments Incorporated - http://www.ti.com/ + * Andrew F. Davis <a...@ti.com> + * + * 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. + * + * This program is distributed "as is" WITHOUT ANY WARRANTY of any + * kind, whether expressed or implied; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License version 2 for more details. + */ + +#include +#include +#include +#include + +#define TI_USB_VENDOR_ID0x0451 +#define TI_USB_DEVICE_ID_SM_USB_DIG 0x2f90 + +#define TI_SMUSBDIG_USB_TIMEOUT_MS 1000 + +struct ti_smusbdig_device { + struct usb_device *usb_dev; + struct usb_interface *interface; +}; + +int ti_smusbdig_xfer(struct ti_smusbdig_device *ti_smusbdig, +u8 *buffer, int size) +{ + struct device *dev = _smusbdig->interface->dev; + int actual_length, ret; + + if (!ti_smusbdig || !buffer || size <= 0) + return -EINVAL; + + ret = usb_interrupt_msg(ti_smusbdig->usb_dev, + usb_sndctrlpipe(ti_smusbdig->usb_dev, 1), + buffer, size, _length, + TI_SMUSBDIG_USB_TIMEOUT_MS); + if (ret) { + dev_err(dev, "USB transaction failed\n"); + return ret; + } + + ret = usb_interrupt_msg(ti_smusbdig->usb_dev, + usb_rcvctrlpipe(ti_smusbdig->usb_dev, 1), + buffer, TI_SMUSBDIG_PACKET_SIZE, _length, + TI_SMUSBDIG_USB_TIMEOUT_MS); + if (ret) { + dev_err(dev, "USB transaction failed\n"); + return ret; + } + + return 0; +} +EXPORT_SYMBOL_GPL(ti_smusbdig_xfer); + +static const struct mfd_cell ti_smusbdig_mfd_cells[] = { + { .name = "ti-sm-usb-dig-gpio", }, + { .name = "ti-sm-usb-dig-i2c", }, + { .name = "ti-sm-usb-dig-spi", }, + { .name = "ti-sm-usb-dig-w1", }, +}; + +static int ti_smusbdig_probe(struct usb_interface *interface, +const struct usb_device_id *usb_id) +{ + struct usb_host_interface *hostif = interface->cur_altsetting; + struct device *dev = >dev; + struct ti_smusbdig_device *ti_smusbdig; + u8 buffer[TI_SMUSBDIG_PACKET_SIZE]; + int ret; + + if (hostif->desc.bInterfaceNumber != 0 || + hostif->desc.bNumEndpoints < 2) + return -ENODEV; + + ti_smusbdig = devm_kzalloc(dev, sizeof(*ti_smusbdig), GFP_KERNEL); + if (!ti_smusbdig) + return -ENOMEM; + + ti_smusbdig->usb_dev = usb_get_dev(inte
Re: [GIT PULL] On-demand device probing
On 10/23/2015 10:45 AM, Tim Bird wrote: I've been worried about DT overhead adding to boot time for a while. And IMHO probe deferral is just about the lamest way to solve boot order dependencies I can imagine, from a computer science perspective. (Well, there's a certain elegance to it, but it's a stupid "make everything re-doable, back up and start over, time-wasting" elegance.) It has a bogosort kind of elegance. :) Also this might be a silly question (I haven't been following this issue for very long), but as the only place that can really know what devices depend on each other, in a generic kernel, is the DT (or whatever abstraction) will we not eventually need to solve this issue there? Could we just add a "depends-on = <>;" to nodes when we know they are needed for our board? -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] usb: misc: usb3503: Use i2c_add_driver helper macro
Use i2c_add_driver as it will add THIS_MODULE for us. Signed-off-by: Andrew F. Davis <a...@ti.com> --- drivers/usb/misc/usb3503.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/misc/usb3503.c b/drivers/usb/misc/usb3503.c index 64ff5b9..b45cb77 100644 --- a/drivers/usb/misc/usb3503.c +++ b/drivers/usb/misc/usb3503.c @@ -410,7 +410,7 @@ static int __init usb3503_init(void) { int err; - err = i2c_register_driver(THIS_MODULE, _i2c_driver); + err = i2c_add_driver(_i2c_driver); if (err != 0) pr_err("usb3503: Failed to register I2C driver: %d\n", err); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html