cp210x.c (de9c7e9f278492cee9f217ffc339a398536c7e51) cp210x.c (ba84190eab5ba27c171b610ec1d8e0957638d8ec)
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 *
7 * Support to set flow control line levels using TIOCMGET and TIOCMSET
8 * thanks to Karl Hiramoto karl@hiramoto.org. RTSCTS hardware flow

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

430
431
432/* CP210X_GET_FLOW/CP210X_SET_FLOW read/write these 0x10 bytes */
433struct cp210x_flow_ctl {
434 __le32 ulControlHandshake;
435 __le32 ulFlowReplace;
436 __le32 ulXonLimit;
437 __le32 ulXoffLimit;
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 *
7 * Support to set flow control line levels using TIOCMGET and TIOCMSET
8 * thanks to Karl Hiramoto karl@hiramoto.org. RTSCTS hardware flow

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

430
431
432/* CP210X_GET_FLOW/CP210X_SET_FLOW read/write these 0x10 bytes */
433struct cp210x_flow_ctl {
434 __le32 ulControlHandshake;
435 __le32 ulFlowReplace;
436 __le32 ulXonLimit;
437 __le32 ulXoffLimit;
438} __packed;
438};
439
440/* cp210x_flow_ctl::ulControlHandshake */
441#define CP210X_SERIAL_DTR_MASK GENMASK(1, 0)
442#define CP210X_SERIAL_DTR_SHIFT(_mode) (_mode)
443#define CP210X_SERIAL_CTS_HANDSHAKE BIT(3)
444#define CP210X_SERIAL_DSR_HANDSHAKE BIT(4)
445#define CP210X_SERIAL_DCD_HANDSHAKE BIT(5)
446#define CP210X_SERIAL_DSR_SENSITIVITY BIT(6)

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

464#define CP210X_SERIAL_RTS_INACTIVE 0
465#define CP210X_SERIAL_RTS_ACTIVE 1
466#define CP210X_SERIAL_RTS_FLOW_CTL 2
467
468/* CP210X_VENDOR_SPECIFIC, CP210X_GET_DEVICEMODE call reads these 0x2 bytes. */
469struct cp210x_pin_mode {
470 u8 eci;
471 u8 sci;
439
440/* cp210x_flow_ctl::ulControlHandshake */
441#define CP210X_SERIAL_DTR_MASK GENMASK(1, 0)
442#define CP210X_SERIAL_DTR_SHIFT(_mode) (_mode)
443#define CP210X_SERIAL_CTS_HANDSHAKE BIT(3)
444#define CP210X_SERIAL_DSR_HANDSHAKE BIT(4)
445#define CP210X_SERIAL_DCD_HANDSHAKE BIT(5)
446#define CP210X_SERIAL_DSR_SENSITIVITY BIT(6)

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

464#define CP210X_SERIAL_RTS_INACTIVE 0
465#define CP210X_SERIAL_RTS_ACTIVE 1
466#define CP210X_SERIAL_RTS_FLOW_CTL 2
467
468/* CP210X_VENDOR_SPECIFIC, CP210X_GET_DEVICEMODE call reads these 0x2 bytes. */
469struct cp210x_pin_mode {
470 u8 eci;
471 u8 sci;
472} __packed;
472};
473
474#define CP210X_PIN_MODE_MODEM 0
475#define CP210X_PIN_MODE_GPIO BIT(0)
476
477/*
478 * CP210X_VENDOR_SPECIFIC, CP210X_GET_PORTCONFIG call reads these 0xf bytes
479 * on a CP2105 chip. Structure needs padding due to unused/unspecified bytes.
480 */

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

527#define CP210X_2NCONFIG_GPIO_MODE_IDX 581
528#define CP210X_2NCONFIG_GPIO_RSTLATCH_IDX 587
529#define CP210X_2NCONFIG_GPIO_CONTROL_IDX 600
530
531/* CP210X_VENDOR_SPECIFIC, CP210X_WRITE_LATCH call writes these 0x2 bytes. */
532struct cp210x_gpio_write {
533 u8 mask;
534 u8 state;
473
474#define CP210X_PIN_MODE_MODEM 0
475#define CP210X_PIN_MODE_GPIO BIT(0)
476
477/*
478 * CP210X_VENDOR_SPECIFIC, CP210X_GET_PORTCONFIG call reads these 0xf bytes
479 * on a CP2105 chip. Structure needs padding due to unused/unspecified bytes.
480 */

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

527#define CP210X_2NCONFIG_GPIO_MODE_IDX 581
528#define CP210X_2NCONFIG_GPIO_RSTLATCH_IDX 587
529#define CP210X_2NCONFIG_GPIO_CONTROL_IDX 600
530
531/* CP210X_VENDOR_SPECIFIC, CP210X_WRITE_LATCH call writes these 0x2 bytes. */
532struct cp210x_gpio_write {
533 u8 mask;
534 u8 state;
535} __packed;
535};
536
537/*
538 * Helper to get interface number when we only have struct usb_serial.
539 */
540static u8 cp210x_interface_num(struct usb_serial *serial)
541{
542 struct usb_host_interface *cur_altsetting;
543

--- 1570 unchanged lines hidden ---
536
537/*
538 * Helper to get interface number when we only have struct usb_serial.
539 */
540static u8 cp210x_interface_num(struct usb_serial *serial)
541{
542 struct usb_host_interface *cur_altsetting;
543

--- 1570 unchanged lines hidden ---