I am adding some hardware handshaking via GPIO lines to the mxs-auart driver. So I am compiling it as a module. I can insert the module fine:
# modprobe mxs_auart
mxs-auart.0: ttySP0 at MMIO 0x8006a000 (irq = 112) is a mxs-auart.0
Found APPUART 3.1.0
mxs-auart.1: ttySP1 at MMIO 0x8006c000 (irq = 113) is a mxs-auart.1
Found APPUART 3.1.0
mxs-auart.2: ttySP2 at MMIO 0x8006e000 (irq = 114) is a mxs-auart.2
Found APPUART 3.1.0
But if I try to remove the module, it gives an error, and also locks up the debug serial port.
# modprobe -r mxs_auart
Trying to free nonexistent resource <000000008006e000-000000008006efff>
Trying to free nonexistent resource <000000008006c000-000000008006cfff>
Any pointers on this? I'm guessing those messages are something to do with the following code:
static void mxs_auart_release_port(struct uart_port *u)
{
release_mem_region(u->mapbase, SZ_4K);
}
But I don't know if that's the root cause of the lock-up. I'm fairly new to Linux kernel device driver programming, and I haven't tried debugging this.
已解决! 转到解答。
Ok, I have just tried it on 3.16.1 and the removal of mxs_auart works as expected:
root@freescale /$ modprobe mxs_auart
[ 224.383850] 8006a000.serial: ttyAPP0 at MMIO 0x8006a000 (irq = 234, base_baud = 1500000) is a 8006a000.serial
[ 224.422657] mxs-auart 8006a000.serial: Found APPUART 3.1.0
[ 224.449611] 80070000.serial: ttyAPP3 at MMIO 0x80070000 (irq = 235, base_baud = 1500000) is a 80070000.serial
[ 224.471767] mxs-auart 80070000.serial: Found APPUART 3.1.0
root@freescale /$ rmmod mxs_auart
root@freescale /$
I don't want to "keep up an exchange", or mark some non-solution from Freescale as an "answer".
Here is what I hope to see: Freescale assigns an engineer to improve the driver so it can be removed. Then includes the improved driver in a new kernel release.
Ok, I have just tried it on 3.16.1 and the removal of mxs_auart works as expected:
root@freescale /$ modprobe mxs_auart
[ 224.383850] 8006a000.serial: ttyAPP0 at MMIO 0x8006a000 (irq = 234, base_baud = 1500000) is a 8006a000.serial
[ 224.422657] mxs-auart 8006a000.serial: Found APPUART 3.1.0
[ 224.449611] 80070000.serial: ttyAPP3 at MMIO 0x80070000 (irq = 235, base_baud = 1500000) is a 80070000.serial
[ 224.471767] mxs-auart 80070000.serial: Found APPUART 3.1.0
root@freescale /$ rmmod mxs_auart
root@freescale /$
I tried to build mxs_auart as loadable module and saw the error message
"Trying to free nonexistent resource <000000008006e000-000000008006efff>" when unload module, and then the system hangs. But the hang-up is not caused by this error message. The mxs_auart_request_port is not called in probe function, but mxs_auart_release_port is called in remove function. I think mxs_auart is not tested as loadable module. There may be still other errors which causes the hang-up.