cp210x.c (8632987380765dee716d460640aa58d58d52998e) cp210x.c (83b67041f3eaf33f98a075249aa7f4c7617c2f85)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Silicon Laboratories CP210x USB to RS232 serial adaptor driver
4 *
5 * Copyright (C) 2005 Craig Shelley (craig@microtron.org.uk)
6 * Copyright (C) 2010-2021 Johan Hovold (johan@kernel.org)
7 *
8 * Support to set flow control line levels using TIOCMGET and TIOCMSET

--- 1621 unchanged lines hidden (view full) ---

1630 result = cp210x_read_vendor_block(serial, REQTYPE_DEVICE_TO_HOST,
1631 CP210X_GET_PORTCONFIG, &config,
1632 sizeof(config));
1633 if (result < 0)
1634 return result;
1635
1636 /* 2 banks of GPIO - One for the pins taken from each serial port */
1637 if (intf_num == 0) {
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Silicon Laboratories CP210x USB to RS232 serial adaptor driver
4 *
5 * Copyright (C) 2005 Craig Shelley (craig@microtron.org.uk)
6 * Copyright (C) 2010-2021 Johan Hovold (johan@kernel.org)
7 *
8 * Support to set flow control line levels using TIOCMGET and TIOCMSET

--- 1621 unchanged lines hidden (view full) ---

1630 result = cp210x_read_vendor_block(serial, REQTYPE_DEVICE_TO_HOST,
1631 CP210X_GET_PORTCONFIG, &config,
1632 sizeof(config));
1633 if (result < 0)
1634 return result;
1635
1636 /* 2 banks of GPIO - One for the pins taken from each serial port */
1637 if (intf_num == 0) {
1638 priv->gc.ngpio = 2;
1639
1638 if (mode.eci == CP210X_PIN_MODE_MODEM) {
1639 /* mark all GPIOs of this interface as reserved */
1640 priv->gpio_altfunc = 0xff;
1641 return 0;
1642 }
1643
1644 iface_config = config.eci_cfg;
1645 priv->gpio_pushpull = (u8)((le16_to_cpu(config.gpio_mode) &
1646 CP210X_ECI_GPIO_MODE_MASK) >>
1647 CP210X_ECI_GPIO_MODE_OFFSET);
1640 if (mode.eci == CP210X_PIN_MODE_MODEM) {
1641 /* mark all GPIOs of this interface as reserved */
1642 priv->gpio_altfunc = 0xff;
1643 return 0;
1644 }
1645
1646 iface_config = config.eci_cfg;
1647 priv->gpio_pushpull = (u8)((le16_to_cpu(config.gpio_mode) &
1648 CP210X_ECI_GPIO_MODE_MASK) >>
1649 CP210X_ECI_GPIO_MODE_OFFSET);
1648 priv->gc.ngpio = 2;
1649 } else if (intf_num == 1) {
1650 } else if (intf_num == 1) {
1651 priv->gc.ngpio = 3;
1652
1650 if (mode.sci == CP210X_PIN_MODE_MODEM) {
1651 /* mark all GPIOs of this interface as reserved */
1652 priv->gpio_altfunc = 0xff;
1653 return 0;
1654 }
1655
1656 iface_config = config.sci_cfg;
1657 priv->gpio_pushpull = (u8)((le16_to_cpu(config.gpio_mode) &
1658 CP210X_SCI_GPIO_MODE_MASK) >>
1659 CP210X_SCI_GPIO_MODE_OFFSET);
1653 if (mode.sci == CP210X_PIN_MODE_MODEM) {
1654 /* mark all GPIOs of this interface as reserved */
1655 priv->gpio_altfunc = 0xff;
1656 return 0;
1657 }
1658
1659 iface_config = config.sci_cfg;
1660 priv->gpio_pushpull = (u8)((le16_to_cpu(config.gpio_mode) &
1661 CP210X_SCI_GPIO_MODE_MASK) >>
1662 CP210X_SCI_GPIO_MODE_OFFSET);
1660 priv->gc.ngpio = 3;
1661 } else {
1662 return -ENODEV;
1663 }
1664
1665 /* mark all pins which are not in GPIO mode */
1666 if (iface_config & CP2105_GPIO0_TXLED_MODE) /* GPIO 0 */
1667 priv->gpio_altfunc |= BIT(0);
1668 if (iface_config & (CP2105_GPIO1_RXLED_MODE | /* GPIO 1 */

--- 493 unchanged lines hidden ---
1663 } else {
1664 return -ENODEV;
1665 }
1666
1667 /* mark all pins which are not in GPIO mode */
1668 if (iface_config & CP2105_GPIO0_TXLED_MODE) /* GPIO 0 */
1669 priv->gpio_altfunc |= BIT(0);
1670 if (iface_config & (CP2105_GPIO1_RXLED_MODE | /* GPIO 1 */

--- 493 unchanged lines hidden ---