Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Issues with usb gpio support
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
vespaman
Guru
Guru


Joined: 28 Aug 2002
Posts: 382
Location: Stockholm, Sweden

PostPosted: Sat Aug 12, 2023 3:24 pm    Post subject: Issues with usb gpio support Reply with quote

Hi all,

I have this USB/serial devkit from exar/maxlinear with XR21B1424, that I would like to use the gpio pins from. As far as I can understand the kernel module (xr_serial.c) should support gpio for this and many other chips in the same series.
But:- it does not show up in /dev/

Only an ftdi device that I also have connected shows up as gpiochip0, but not XR21B1424. There's also no sign of it in /sys/.

The kernel modules (xr_serial and cdc_acm) are loaded, there's no error in kernel log. The ttyUSBx shows up as they should.
Just no /dev/gpiochipX, and (of course) gpiodetect does not list it.

Does anyone have any idea or suggestion how to proceed, or what to look for? I must miss some dependency or something.

I am so stuck at this point .. :(
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54785
Location: 56N 3W

PostPosted: Sat Aug 12, 2023 4:20 pm    Post subject: Reply with quote

vespaman,

Start reading at XR21B1424
In particular the data sheet. That's a PDF.

Page 1 says
Quote:
The UART pins for each port may also be configured as GPIO; direction,
state, output driver type and input pull-up or pull-down resistors are pro-
grammed either through on chip OTP, or on the fly via memory mapped
registers.


So the device can be configured for four UARTs, or each UART can be swapped for 10 GPIO pins.
The default state is set in some One Time Programmable memory in the chip but it can be changed by commands sent over the USB bus.
If you see four UARTs now, there cannot be any GPIOs.

The Pin Configuration on page 4 may help. The same pins are used for the serial ports as for the GPIO pins, so one UART cannot do both at the same time.
Functional Block Diagram on page 9 probably makes it clearer.

The USB Control Commands table starting on page 20 tells how to go about configuring the device.
Hopefully, one of the drivers lets you send it high level commands so that you do not need to do all the bit twiddling yourself.
That's difficult to debug.

The comments in ./drivers/usb/serial/xr_serial.c in the function
Code:
static int xr_gpio_init(struct usb_serial_port *port, const struct xr_type *type)
look prominsing but

Code:
/usr/src/linux $ grep -i xr_gpio_init -R ./
./drivers/usb/serial/xr_serial.c:static int xr_gpio_init(struct usb_serial_port *port, const struct xr_type *type)
./drivers/usb/serial/xr_serial.c:   ret = xr_gpio_init(port, type);

suggests that that function is never called in the kernel.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
vespaman
Guru
Guru


Joined: 28 Aug 2002
Posts: 382
Location: Stockholm, Sweden

PostPosted: Sat Aug 12, 2023 7:07 pm    Post subject: Reply with quote

NeddySeagoon,

Thanks for digging, really appreciate!

The way I read the datasheet, is that each pin can be configured with either some control/status signal for UART or a GPIO, apart from RxD and TxD, which are fixed for UART. This is configured in GPIO_MODE register (p. 28).
I think I also read in some patch message in the kernel mailing list (post was about 3 yrs old), that the intention was for the libgpio to work simultaneously while the ttyUSB was open, since the set/get pin state was/is always accessible (but this is not true for the set-up registers, as I understood it).

And:- the grep line you used, actually gives that xr_port_probe() is returning it to the kernel, which kind of makes sense. xr_port_probe is setup as a function pointer in the usb_serial_driver struct. So I guess it must be run when loading the module(?).

Code:
static struct usb_serial_driver xr_device = {
   .driver = {
      .owner = THIS_MODULE,
      .name =   "xr_serial",
   },
   .id_table      = id_table,
   .num_ports      = 1,
   .probe         = xr_probe,
   .port_probe      = xr_port_probe,
   .port_remove      = xr_port_remove,
   .open         = xr_open,
   .close         = xr_close,
   .break_ctl      = xr_break_ctl,
   .set_termios      = xr_set_termios,
   .tiocmget      = xr_tiocmget,
   .tiocmset      = xr_tiocmset,
   .dtr_rts      = xr_dtr_rts
};





But while your input has shed a lot o _light_, I still don't see what is actually missing. But maybe it is somehow related to how the board is setup.
This part might be the core of it; either it is not setup as custom driver (but I can't see how) or xr_set_req_uart() returns a negative value. This looks to be most reasonable, but it relies on usb_get_serial_port_data() and usb_control_msg() whatever they do. Maybe they are somehow responsible for setting up the device functionality, and this configuration is what is missing?

Code:

   if (type->custom_driver) {
      ret = xr_set_reg_uart(port, type->custom_driver,
            XR_CUSTOM_DRIVER_ACTIVE);
      if (ret)
         goto err_free;
   }

   ret = xr_gpio_init(port, type);
   if (ret)
      goto err_free;



Thanks again!
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54785
Location: 56N 3W

PostPosted: Sat Aug 12, 2023 7:44 pm    Post subject: Reply with quote

vespaman,

I'm a retired hardware engineer - software mostly goes over my head.

You can certainly swap between GPIO mode and UART mode for whole UARTs
It's even possible to do that 'on the fly'.

You may be able to mix GPIO and UART in the same UART, say that you used the UART with no handshaking, the handshake pins may be usable as GPIO.
It's not possible to use that same pins for different functions an the same time. That would need some external multiplexing.

I don't see how to tell the kernel to set up either UART mode or GPIO mode. That's software, which is not my thing. :)
I'm not above adding some print statements to see what's happening though.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
vespaman
Guru
Guru


Joined: 28 Aug 2002
Posts: 382
Location: Stockholm, Sweden

PostPosted: Sat Aug 12, 2023 8:46 pm    Post subject: Reply with quote

NeddySeagoon,

While I'm not retired yet, I am also a hardware guy (intention was to use this board (or a couple of them) in a production test equipment for a product I am about to start produce). The XR21B1424 has a very low latency for receiving bytes on the serial port, which other don't (e.g. FTDI et al), and all the extra GPIO is also nice to use in the production test for testing/setting inputs and outputs of the boards. But of course I have to find out why it does not show up, otherwise I'll have to use some other solution for the GPIOs.
Print statements might be the way, if nothing else surfaces.

Thanks anyway, I'll follow the trace of the usb_* functions tomorrow, to see if they lead somewhere. Maybe libgpio has to have specific support for this IC, and that is what is missing. Who knows.

- Micael
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54785
Location: 56N 3W

PostPosted: Sat Aug 12, 2023 9:11 pm    Post subject: Reply with quote

vespaman,

I suspect that the default settings give you four /dev/ttyUSBx ports, with no pins left over for GPIO.
To have some GPIO, you need take some pins away from the UART(s)

That's just the start. Then the kernel GPIO driver needs to know about them.

What does
Code:
lsusb -vvv
say about the device. That probably needs to go to a pastebin.
How many serial ports does it provide in /dev ?
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
vespaman
Guru
Guru


Joined: 28 Aug 2002
Posts: 382
Location: Stockholm, Sweden

PostPosted: Sun Aug 13, 2023 6:37 am    Post subject: Reply with quote

So in /dev I have all 4 of the ttyUSB* and boot log shows no error, but also no mention about gpio (which I think might be normal).
Maybe you are right in that there are no default gpio available, and this is why nothing shows up. But then I would have thought it must be configurable somehow, or maybe this is a user space setup-app that needs to be run, before kernel picks up the gpios?

I have a FDTI USB-UART device also on this computer, and it shows its GPIO without any configuration from my side.

The lsusb -vvv gives;
Code:
Bus 006 Device 026: ID 04e2:1424 Exar Corp. XR21B1424 4-channel UART
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass          239 Miscellaneous Device
  bDeviceSubClass         2
  bDeviceProtocol         1 Interface Association
  bMaxPacketSize0        64
  idVendor           0x04e2 Exar Corp.
  idProduct          0x1424 XR21B1424 4-channel UART
  bcdDevice            0.02
  iManufacturer           1 Exar Corp.
  iProduct                2 Exar USB UART
  iSerial                 3 J821562192
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x0111
    bNumInterfaces          8
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0xa0
      (Bus Powered)
      Remote Wakeup
    MaxPower              100mA
    Interface Association:
      bLength                 8
      bDescriptorType        11
      bFirstInterface         0
      bInterfaceCount         2
      bFunctionClass          2 Communications
      bFunctionSubClass       2 Abstract (modem)
      bFunctionProtocol       1 AT-commands (v.25ter)
      iFunction               0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         2 Communications
      bInterfaceSubClass      2 Abstract (modem)
      bInterfaceProtocol      1 AT-commands (v.25ter)
      iInterface              0
      CDC Header:
        bcdCDC               1.10
      CDC ACM:
        bmCapabilities       0x06
          sends break
          line coding and serial state
      CDC Union:
        bMasterInterface        0
        bSlaveInterface         1
      CDC Call Management:
        bmCapabilities       0x01
          call management
        bDataInterface          1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x88  EP 8 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               8
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass        10 CDC Data
      bInterfaceSubClass      0
      bInterfaceProtocol      0
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x04  EP 4 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x84  EP 4 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
    Interface Association:
      bLength                 8
      bDescriptorType        11
      bFirstInterface         2
      bInterfaceCount         2
      bFunctionClass          2 Communications
      bFunctionSubClass       2 Abstract (modem)
      bFunctionProtocol       1 AT-commands (v.25ter)
      iFunction               0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         2 Communications
      bInterfaceSubClass      2 Abstract (modem)
      bInterfaceProtocol      1 AT-commands (v.25ter)
      iInterface              0
      CDC Header:
        bcdCDC               1.10
      CDC ACM:
        bmCapabilities       0x06
          sends break
          line coding and serial state
      CDC Union:
        bMasterInterface        2
        bSlaveInterface         3
      CDC Call Management:
        bmCapabilities       0x01
          call management
        bDataInterface          3
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x89  EP 9 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               8
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        3
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass        10 CDC Data
      bInterfaceSubClass      0
      bInterfaceProtocol      0
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x05  EP 5 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x85  EP 5 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
    Interface Association:
      bLength                 8
      bDescriptorType        11
      bFirstInterface         4
      bInterfaceCount         2
      bFunctionClass          2 Communications
      bFunctionSubClass       2 Abstract (modem)
      bFunctionProtocol       1 AT-commands (v.25ter)
      iFunction               0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        4
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         2 Communications
      bInterfaceSubClass      2 Abstract (modem)
      bInterfaceProtocol      1 AT-commands (v.25ter)
      iInterface              0
      CDC Header:
        bcdCDC               1.10
      CDC ACM:
        bmCapabilities       0x06
          sends break
          line coding and serial state
      CDC Union:
        bMasterInterface        4
        bSlaveInterface         5
      CDC Call Management:
        bmCapabilities       0x01
          call management
        bDataInterface          5
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x8a  EP 10 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               8
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        5
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass        10 CDC Data
      bInterfaceSubClass      0
      bInterfaceProtocol      0
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x06  EP 6 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x86  EP 6 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
    Interface Association:
      bLength                 8
      bDescriptorType        11
      bFirstInterface         6
      bInterfaceCount         2
      bFunctionClass          2 Communications
      bFunctionSubClass       2 Abstract (modem)
      bFunctionProtocol       1 AT-commands (v.25ter)
      iFunction               0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        6
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         2 Communications
      bInterfaceSubClass      2 Abstract (modem)
      bInterfaceProtocol      1 AT-commands (v.25ter)
      iInterface              0
      CDC Header:
        bcdCDC               1.10
      CDC ACM:
        bmCapabilities       0x06
          sends break
          line coding and serial state
      CDC Union:
        bMasterInterface        6
        bSlaveInterface         7
      CDC Call Management:
        bmCapabilities       0x01
          call management
        bDataInterface          7
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x8b  EP 11 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               8
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        7
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass        10 CDC Data
      bInterfaceSubClass      0
      bInterfaceProtocol      0
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x07  EP 7 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x87  EP 7 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
can't get device qualifier: Resource temporarily unavailable
can't get debug descriptor: Resource temporarily unavailable
Device Status:     0x0000
  (Bus Powered)



Looking at it, there's a lot of CDC stuff in there, perhaps indicating that xr_port_probe() does not allow for the gpio stuff of the xr_serial driver, hence back paddling to the CDC driver. (I am guessing wildly here :-) !!)


Compared to the working FDTI device (which, to be fair, is only one port, and not many gpios);

Code:

Bus 006 Device 025: ID 0856:ac11 B&B Electronics Model USOPTL4
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0         8
  idVendor           0x0856 B&B Electronics
  idProduct          0xac11
  bcdDevice            6.00
  iManufacturer           1 B&B Electronics
  iProduct                2 Model USOPTL4
  iSerial                 3 BBCH9PEI
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x0020
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              100mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass    255 Vendor Specific Subclass
      bInterfaceProtocol    255 Vendor Specific Protocol
      iInterface              2 Model USOPTL4
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
can't get device qualifier: Resource temporarily unavailable
can't get debug descriptor: Resource temporarily unavailable
Device Status:     0x0000
  (Bus Powered)



I'll see if I can put some printk or something working in the module code..
Back to top
View user's profile Send private message
vespaman
Guru
Guru


Joined: 28 Aug 2002
Posts: 382
Location: Stockholm, Sweden

PostPosted: Sun Aug 13, 2023 7:39 am    Post subject: Reply with quote

.. so I added printk's here and there. And it all checks out ok.

xr_gpio_init() sets most of the port functions to generic gpio, only leaving GPIO8 and GPIO8 as other function when plugging in the board (module loaded). Even reading out gpio mode register when opening the ttyUSBx gives that all are set to GPIO except the GPIO8/9, if I am opening the port without HW flow control.

So there's no new clues here.

Not sure what's the link to libgio and/or the gpiochip device in /dev is.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54785
Location: 56N 3W

PostPosted: Sun Aug 13, 2023 8:56 am    Post subject: Reply with quote

vespaman,

In ./drivers/usb/serial/xr_serial.c, the function
Code:
static void xr_set_flow_mode(struct tty_struct *tty,
                             struct usb_serial_port *port,
                             const struct ktermios *old_termios)

appears to me to set GPIO mode for the flow control pins.
Code:
        /* Set GPIO mode for controlling the pins manually by default. */
        gpio_mode &= ~XR_GPIO_MODE_SEL_MASK;

Then it does some bit twiddling to give the flow control pins back to the UART ... then
Code:
        xr_set_reg_uart(port, type->flow_control, flow);
        xr_set_reg_uart(port, type->gpio_mode, gpio_mode);

to actually configure the hardware.

If that reading is correct, if hardware flow control is off, the pins are configured for GPIO.

Actually using them that way will be a different piece of code.

Fire up minicom. Set flow control off, on one or more ports.
Are there any new GPIO entries in /dev now?
What does the end of dmesg say?

-- edit --

This code does the setup.

Quote:
- When specific IOCTLs are called by a user-space application, a
port_config file is created for the /dev/ttyXRUSB device at a
specific USB tree location, and some configuration data is stored.
The driver checks for the port_config file when the driver is loaded
for each port and loads the configuration settings if there is a
port_config file for the USB tree location.


Code:
+static struct reg_addr_map xr21b142x_reg_map;
That covers your UART.

Its in the kernel as
Code:
drivers/usb/serial/xrusb_serial.c

_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
vespaman
Guru
Guru


Joined: 28 Aug 2002
Posts: 382
Location: Stockholm, Sweden

PostPosted: Sun Aug 13, 2023 11:55 am    Post subject: Reply with quote

Hi NeddySeagoon,

So what I did this morning, was to add debug outputs (printk) in xr_set_flow_mode() amongst others. Hereby verifying that the mode is always gpio (apart from 8/9), as long as flow is off. If RTS/CTS is activated in e.g. minicom, the driver will take these from the gpio set.But there's still 6 gpio even if 8/9 is for the LED toggle, and RTS/CTS is activated.

I actually print out the register content from the chip in the beginning of xr_set_flow_mode, and what exactly is programmed into it, later on in the same function.

Here's dmesg with my debug printk's;

Code:
[ 6646.441817] usb 6-1.2.3: new full-speed USB device number 35 using xhci_hcd
[ 6646.556660] usb 6-1.2.3: New USB device found, idVendor=04e2, idProduct=1424, bcdDevice= 0.02
[ 6646.556675] usb 6-1.2.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 6646.556680] usb 6-1.2.3: Product: Exar USB UART
[ 6646.556684] usb 6-1.2.3: Manufacturer: Exar Corp.
[ 6646.556687] usb 6-1.2.3: SerialNumber: J821562192
[ 6646.790946] usbcore: registered new interface driver xr_serial
[ 6646.790982] usbserial: USB Serial support registered for xr_serial
[ 6646.791130] xr_serial 6-1.2.3:1.0: xr_serial converter detected
[ 6646.791188] xr_port_probe: type custom_driver
[ 6646.791321] xr_port_probe: xr_set_reg_uart() returned 0
[ 6646.793327] xr_gpio_init, mode setting: xr_set_reg_uart() returned 0
[ 6646.795326] xr_gpio_init, direction setting: xr_set_reg_uart() returned 0
[ 6646.797325] xr_gpio_init, gpio_set setting: xr_set_reg_uart() returned 0
[ 6646.797327] xr_port_probe: xr_gpio_init() returned 0
[ 6646.797409] usb 6-1.2.3: xr_serial converter now attached to ttyUSB1
[ 6646.797458] xr_serial 6-1.2.3:1.2: xr_serial converter detected
[ 6646.797479] xr_port_probe: type custom_driver
[ 6646.799327] xr_port_probe: xr_set_reg_uart() returned 0
[ 6646.801314] xr_gpio_init, mode setting: xr_set_reg_uart() returned 0
[ 6646.803359] xr_gpio_init, direction setting: xr_set_reg_uart() returned 0
[ 6646.805322] xr_gpio_init, gpio_set setting: xr_set_reg_uart() returned 0
[ 6646.805328] xr_port_probe: xr_gpio_init() returned 0
[ 6646.805405] usb 6-1.2.3: xr_serial converter now attached to ttyUSB2
[ 6646.805456] xr_serial 6-1.2.3:1.4: xr_serial converter detected
[ 6646.805481] xr_port_probe: type custom_driver
[ 6646.807343] xr_port_probe: xr_set_reg_uart() returned 0
[ 6646.809347] xr_gpio_init, mode setting: xr_set_reg_uart() returned 0
[ 6646.811342] xr_gpio_init, direction setting: xr_set_reg_uart() returned 0
[ 6646.813341] xr_gpio_init, gpio_set setting: xr_set_reg_uart() returned 0
[ 6646.813345] xr_port_probe: xr_gpio_init() returned 0
[ 6646.813462] usb 6-1.2.3: xr_serial converter now attached to ttyUSB3
[ 6646.813547] xr_serial 6-1.2.3:1.6: xr_serial converter detected
[ 6646.813579] xr_port_probe: type custom_driver
[ 6646.815340] xr_port_probe: xr_set_reg_uart() returned 0
[ 6646.817381] xr_gpio_init, mode setting: xr_set_reg_uart() returned 0
[ 6646.819592] xr_gpio_init, direction setting: xr_set_reg_uart() returned 0
[ 6646.821370] xr_gpio_init, gpio_set setting: xr_set_reg_uart() returned 0
[ 6646.821377] xr_port_probe: xr_gpio_init() returned 0
[ 6646.821542] usb 6-1.2.3: xr_serial converter now attached to ttyUSB4
[ 6691.178004] xr_set_flow_mode:, get mode setting: gpio_mode=0300
[ 6691.183758] xr_set_flow_mode, mode setting: gpio_mode=0300
[ 6691.194764] xr_set_flow_mode:, get mode setting: gpio_mode=0300
[ 6691.194878] xr_set_flow_mode, mode setting: gpio_mode=0300
[ 6691.202761] xr_set_flow_mode:, get mode setting: gpio_mode=0300
[ 6691.202870] xr_set_flow_mode, mode setting: gpio_mode=0300
[ 6691.208764] xr_set_flow_mode:, get mode setting: gpio_mode=0300
[ 6691.208876] xr_set_flow_mode, mode setting: gpio_mode=0300
[ 6691.214766] xr_set_flow_mode:, get mode setting: gpio_mode=0300
[ 6691.214874] xr_set_flow_mode, mode setting: gpio_mode=0300
think


From time 6691, onwards, is when I started minicom on one of the tty/USB without flow control
Nothing happened in regards to /dev/gpiochip


But:- your quote looks interesting. I don't have a xrusb_serial.c in my drivers directory though. Only the xr_serial.c. Maybe xr_serial.c is a descendant of xrusb_serial.c? The copyright "Copyright (c) 2018 Patong Yang <patong.mxl@gmail.com>" seems to indicate this.

Now I re-read the threads I can find around xr_serial.c that I can find, and maybe the gpiolib patches never made it into the kernel. It is kind of disappearing in beginning of 2021 :-o that would certainly explain why there's no gpiochip in /dev...
So maybe I need to try to apply these patches, or use tiocmset etc. But then I guess I need to create a program that does both serial comms and "gpio" (tiocmset), which is not what I had intended. Hmm
I'll see if the patches are at all compatible with the current version or xr_serial.c, or if the code rot has finished them off.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54785
Location: 56N 3W

PostPosted: Sun Aug 13, 2023 1:44 pm    Post subject: Reply with quote

vespaman,

That patch is a new file
Code:
diff --git a/drivers/usb/serial/xrusb_serial.c b/drivers/usb/serial/xrusb_serial.c
new file mode 100644
index 000000000000..16a5bcff9103
--- /dev/null
+++ b/drivers/usb/serial/xrusb_serial.c
Its against /dev/null

and
Code:
git log | grep xrusb_serial
on the kernel git tree says that there are no commit messages mentioning xrusb_serial.
There in a date though. Wed, 4 Apr 2018 00:06:34 -0700.

That's not to say it did not get renamed/refactored and still get into the kernel.

-- edit --

The whole story is on the linux-usb ml. At least the story of xrusb_serial.c
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
vespaman
Guru
Guru


Joined: 28 Aug 2002
Posts: 382
Location: Stockholm, Sweden

PostPosted: Sun Aug 13, 2023 2:07 pm    Post subject: Reply with quote

Ah, yes, but I was talking about this patch-set https://lore.kernel.org/all/20210226113709.733f6526@coco.lan/ which I guess was dropped somewhere.

But maybe you are correct in that the xrusb_serial.c is a complete (hopefully still) working file. Another route to try out, thanks! Will see if it compiles, and what happens when loaded.
Back to top
View user's profile Send private message
vespaman
Guru
Guru


Joined: 28 Aug 2002
Posts: 382
Location: Stockholm, Sweden

PostPosted: Sun Aug 13, 2023 2:44 pm    Post subject: Reply with quote

vespaman wrote:
Will see if it compiles, and what happens when loaded.


Looks to be some work to compile with newer kernels unfortunately, so it looks like a dead end. :(
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum