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.
Solved! Go to Solution.
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 /$
Craig, please click Correct Answer if your question hasbeen answered.
Thanks,
Yixing
That answer provides some useful information, but I would like to see a decent resolution (i.e. a fix).
Craig
We have not got your response yet and will close the discussion in 3 days. If you still need help, please feel free to reply with an update to this discussion.
Thanks,
Yixing
Craig, please keep exchange your questions with Grace if your need further answers.
Regards,
Yixing
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.
Craig,
Please try it with kernel 3.16.1.
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 have tested with kernel 3.14 and also found that mxs-auart can be removed. It seems that moving away from 2.6.35 and towards a more recent kernel is the way to go.
Yes, I agree.
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.