Skip to contentSkip to conversation

ioctl(tiocsserial) for devices which need ioremapping

PATCH Stefan Althoefer 1 participant 1 message Jan 23, 2007 TTY layer and serial drivers

lore
Share & tools
lore
#0 lore raw

hi,

I'm using the linux serial 8250 driver for an IXP425 based ARM device. The two on-chip serial ports work with no problem.

However, depending on the configuration of my system I have some more 8250 based serial ports, which I want to register to the driver after the system has booted (after I have detected how many ports are available).
For this I have written a tool to configure the serial port base address and interrupt with the TIOCSSERIAL ioctl.

Unfortunately, there is a problem with this: The new serial ports require that the memory mapped address must be remapped. Although there is a member in the serial_struct to specify this, the driver does not pay attention to the UPF_IOREMAP bit in serial_struct.flags.

The same appears to the UPF_SHARE_IRQ flag.

Is there any way to handle this (to attach my serial port and have the address relocation take place)?

To solve this problem, I have created the following patch. It checks for the UPF_IOREMAP and UPF_SHARE_IRQ flags when it detects that either port or interrupt are changed. Is it possible to integrate this into the kernel?

-----%<------------
diff -r -N -u linux-2.6.18.1/drivers/serial/serial_core.c linux-2.6.18.1-xscale-fordiff/drivers/serial/serial_core.c

drivers/serial/serial_core.c 2006-11-02 11:52:46.000000000 +0100 renamed from drivers/serial/serial_core.c 2006-10-14 05:34:03.000000000 +0200 +16 -0
@@ -706,6 +706,22 @@
                goto check_and_exit;
        }
 
+       /* FIXME: [email protected]
+        *
+        * If we change port and IOREMAP is requested, then we push it in.
+        * If we change irq  and SHARE_IRQ is requested, then we push it in.
+        */
+       if( change_port ){
+           if( (new_serial.flags & UPF_IOREMAP) && !(port->flags & UPF_IOREMAP) ){
+               port->flags |= UPF_IOREMAP;
+           }
+       }
+       if( change_irq ){
+           if( (new_serial.flags & UPF_SHARE_IRQ) && !(port->flags & UPF_SHARE_IRQ) ){
+               port->flags |= UPF_SHARE_IRQ;
+           }
+       }
+
        /*
         * Ask the low level driver to verify the settings.
         */

---------------------

Signature · 13 lines
----------------------
Stefan Althöfer ([email protected])
Janz Automationssysteme AG
  - Automation Intelligence -
Member of the Janz company group
Im Doerener Feld 8
33100 Paderborn - Germany


-
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html