On Fri, May 27, 2022 at 1:34 AM Richard Weinberger <[email protected]> wrote:
> ----- Ursprüngliche Mail -----
> > An update:
> > If the 16550A driver is modprobed with no arguments, it apparently
> > probes the PCI subsystem, gets the irq, and interrupts are enabled OK.
> > The serial port can send/receive data.
> > But, if a port= or irq= argument is passed into the 16550A driver,
> > then the driver seems to skip probing the PCI syubsystem, and the
> > driver fails to enable the irq. No data can transmitted or received by
> > the port, even though the driver has done an rtdm_irq_request() of
> > the correct irq level.
> >
> > This is a problem for my application because I have 6 serial ports and
> > some must have different baud_base args, which is now impossible with
> > this inconsistent driver behavior.
>
> And just passing baud_base=X,Y,..,Z does not work?
> Sure this is still hacky since it depends on the PCI probe order...
>
> We could make baud_base configurable via ioctl, the driver supports already
> plenty of them.
> Or exposing this and other properties as sysfs attributes.
>
> Further I suggest splitting the driver in at at least two kernel modules.
> One for PCI and another one for legacy PIO/PNP.
> The current probe interface is IMHO confusing and error prone.
>
> Thanks,
> //richard
After a 16550A_pci.h driver modification, I got this all to work
finally, with interrupts enabled for all of my 6 serial ports. This is
the modprobe command line:
modprobe xeno_16550A io=0x3f8,0x2f8 irq=4,3
baud_base=115200,115200,460800,460800,460800,460800
Note that those first two ports above are are legacy (ISA) addresses,
not PCI cards. The last four baud_base args above are for the four
ports on the Moxa PCI card. By not specifying an io=,irq= for the PCI
ports we let the driver do a pci_resource_start() and the interrupts
are automagically enabled.
Here is the code I had to hack to get this to work.
static int rt_16550_pci_probe()
...
for (i = 0; i < MAX_DEVICES; i++) {
...
baud_base[i] = board->baud_base;
That last line was clobbering baud_base[] with defaults, even if I put
a new baud_base on the modprobe command line. With that last line
commented out the modprobe baud_base arguments succeed.
But per Richard W's other comments, this all only works if the PCI
probe gets things in the same order, but it seems to be consistent on
my system.
-C Smith