2 * drivers/serial/mpc52xx_uart.c
4 * Driver for the PSC of the Freescale MPC52xx PSCs configured as UARTs.
6 * FIXME According to the usermanual the status bits in the status register
7 * are only updated when the peripherals access the FIFO and not when the
8 * CPU access them. So since we use this bits to know when we stop writing
9 * and reading, they may not be updated in-time and a race condition may
10 * exists. But I haven't be able to prove this and I don't care. But if
11 * any problem arises, it might worth checking. The TX/RX FIFO Stats
12 * registers should be used in addition.
13 * Update: Actually, they seem updated ... At least the bits we use.
16 * Maintainer : Sylvain Munaut <tnt@246tNt.com>
18 * Some of the code has been inspired/copied from the 2.4 code written
19 * by Dale Farnsworth <dfarnsworth@mvista.com>.
21 * Copyright (C) 2004-2005 Sylvain Munaut <tnt@246tNt.com>
22 * Copyright (C) 2003 MontaVista, Software, Inc.
24 * This file is licensed under the terms of the GNU General Public License
25 * version 2. This program is licensed "as is" without any warranty of any
26 * kind, whether express or implied.
29 /* Platform device Usage :
31 * Since PSCs can have multiple function, the correct driver for each one
32 * is selected by calling mpc52xx_match_psc_function(...). The function
33 * handled by this driver is "uart".
35 * The driver init all necessary registers to place the PSC in uart mode without
36 * DCD. However, the pin multiplexing aren't changed and should be set either
37 * by the bootloader or in the platform init code.
39 * The idx field must be equal to the PSC index ( e.g. 0 for PSC1, 1 for PSC2,
40 * and so on). So the PSC1 is mapped to /dev/ttyS0, PSC2 to /dev/ttyS1 and so
41 * on. But be warned, it's an ABSOLUTE REQUIREMENT ! This is needed mainly for
42 * the console code : without this 1:1 mapping, at early boot time, when we are
43 * parsing the kernel args console=ttyS?, we wouldn't know wich PSC it will be
47 #include <linux/config.h>
48 #include <linux/platform_device.h>
49 #include <linux/module.h>
50 #include <linux/tty.h>
51 #include <linux/serial.h>
52 #include <linux/sysrq.h>
53 #include <linux/console.h>
55 #include <asm/delay.h>
58 #include <asm/mpc52xx.h>
59 #include <asm/mpc52xx_psc.h>
61 #if defined(CONFIG_SERIAL_MPC52xx_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
65 #include <linux/serial_core.h>
69 #define ISR_PASS_LIMIT 256 /* Max number of iteration in the interrupt */
72 static struct uart_port mpc52xx_uart_ports[MPC52xx_PSC_MAXNUM];
73 /* Rem: - We use the read_status_mask as a shadow of
74 * psc->mpc52xx_psc_imr
75 * - It's important that is array is all zero on start as we
76 * use it to know if it's initialized or not ! If it's not sure
77 * it's cleared, then a memset(...,0,...) should be added to
81 #define PSC(port) ((struct mpc52xx_psc __iomem *)((port)->membase))
84 /* Forward declaration of the interruption handling routine */
85 static irqreturn_t mpc52xx_uart_int(int irq,void *dev_id,struct pt_regs *regs);
88 /* Simple macro to test if a port is console or not. This one is taken
89 * for serial_core.c and maybe should be moved to serial_core.h ? */
90 #ifdef CONFIG_SERIAL_CORE_CONSOLE
91 #define uart_console(port) ((port)->cons && (port)->cons->index == (port)->line)
93 #define uart_console(port) (0)
97 /* ======================================================================== */
99 /* ======================================================================== */
102 mpc52xx_uart_tx_empty(struct uart_port *port)
104 int status = in_be16(&PSC(port)->mpc52xx_psc_status);
105 return (status & MPC52xx_PSC_SR_TXEMP) ? TIOCSER_TEMT : 0;
109 mpc52xx_uart_set_mctrl(struct uart_port *port, unsigned int mctrl)
111 /* Not implemented */
115 mpc52xx_uart_get_mctrl(struct uart_port *port)
117 /* Not implemented */
118 return TIOCM_CTS | TIOCM_DSR | TIOCM_CAR;
122 mpc52xx_uart_stop_tx(struct uart_port *port)
124 /* port->lock taken by caller */
125 port->read_status_mask &= ~MPC52xx_PSC_IMR_TXRDY;
126 out_be16(&PSC(port)->mpc52xx_psc_imr,port->read_status_mask);
130 mpc52xx_uart_start_tx(struct uart_port *port)
132 /* port->lock taken by caller */
133 port->read_status_mask |= MPC52xx_PSC_IMR_TXRDY;
134 out_be16(&PSC(port)->mpc52xx_psc_imr,port->read_status_mask);
138 mpc52xx_uart_send_xchar(struct uart_port *port, char ch)
141 spin_lock_irqsave(&port->lock, flags);
145 /* Make sure tx interrupts are on */
146 /* Truly necessary ??? They should be anyway */
147 port->read_status_mask |= MPC52xx_PSC_IMR_TXRDY;
148 out_be16(&PSC(port)->mpc52xx_psc_imr,port->read_status_mask);
151 spin_unlock_irqrestore(&port->lock, flags);
155 mpc52xx_uart_stop_rx(struct uart_port *port)
157 /* port->lock taken by caller */
158 port->read_status_mask &= ~MPC52xx_PSC_IMR_RXRDY;
159 out_be16(&PSC(port)->mpc52xx_psc_imr,port->read_status_mask);
163 mpc52xx_uart_enable_ms(struct uart_port *port)
165 /* Not implemented */
169 mpc52xx_uart_break_ctl(struct uart_port *port, int ctl)
172 spin_lock_irqsave(&port->lock, flags);
175 out_8(&PSC(port)->command,MPC52xx_PSC_START_BRK);
177 out_8(&PSC(port)->command,MPC52xx_PSC_STOP_BRK);
179 spin_unlock_irqrestore(&port->lock, flags);
183 mpc52xx_uart_startup(struct uart_port *port)
185 struct mpc52xx_psc __iomem *psc = PSC(port);
189 ret = request_irq(port->irq, mpc52xx_uart_int,
190 SA_INTERRUPT | SA_SAMPLE_RANDOM, "mpc52xx_psc_uart", port);
194 /* Reset/activate the port, clear and enable interrupts */
195 out_8(&psc->command,MPC52xx_PSC_RST_RX);
196 out_8(&psc->command,MPC52xx_PSC_RST_TX);
198 out_be32(&psc->sicr,0); /* UART mode DCD ignored */
200 out_be16(&psc->mpc52xx_psc_clock_select, 0xdd00); /* /16 prescaler on */
202 out_8(&psc->rfcntl, 0x00);
203 out_be16(&psc->rfalarm, 0x1ff);
204 out_8(&psc->tfcntl, 0x07);
205 out_be16(&psc->tfalarm, 0x80);
207 port->read_status_mask |= MPC52xx_PSC_IMR_RXRDY | MPC52xx_PSC_IMR_TXRDY;
208 out_be16(&psc->mpc52xx_psc_imr,port->read_status_mask);
210 out_8(&psc->command,MPC52xx_PSC_TX_ENABLE);
211 out_8(&psc->command,MPC52xx_PSC_RX_ENABLE);
217 mpc52xx_uart_shutdown(struct uart_port *port)
219 struct mpc52xx_psc __iomem *psc = PSC(port);
221 /* Shut down the port, interrupt and all */
222 out_8(&psc->command,MPC52xx_PSC_RST_RX);
223 out_8(&psc->command,MPC52xx_PSC_RST_TX);
225 port->read_status_mask = 0;
226 out_be16(&psc->mpc52xx_psc_imr,port->read_status_mask);
228 /* Release interrupt */
229 free_irq(port->irq, port);
233 mpc52xx_uart_set_termios(struct uart_port *port, struct termios *new,
236 struct mpc52xx_psc __iomem *psc = PSC(port);
238 unsigned char mr1, mr2;
240 unsigned int j, baud, quot;
242 /* Prepare what we're gonna write */
245 switch (new->c_cflag & CSIZE) {
246 case CS5: mr1 |= MPC52xx_PSC_MODE_5_BITS;
248 case CS6: mr1 |= MPC52xx_PSC_MODE_6_BITS;
250 case CS7: mr1 |= MPC52xx_PSC_MODE_7_BITS;
253 default: mr1 |= MPC52xx_PSC_MODE_8_BITS;
256 if (new->c_cflag & PARENB) {
257 mr1 |= (new->c_cflag & PARODD) ?
258 MPC52xx_PSC_MODE_PARODD : MPC52xx_PSC_MODE_PAREVEN;
260 mr1 |= MPC52xx_PSC_MODE_PARNONE;
265 if (new->c_cflag & CSTOPB)
266 mr2 |= MPC52xx_PSC_MODE_TWO_STOP;
268 mr2 |= ((new->c_cflag & CSIZE) == CS5) ?
269 MPC52xx_PSC_MODE_ONE_STOP_5_BITS :
270 MPC52xx_PSC_MODE_ONE_STOP;
273 baud = uart_get_baud_rate(port, new, old, 0, port->uartclk/16);
274 quot = uart_get_divisor(port, baud);
278 spin_lock_irqsave(&port->lock, flags);
280 /* Update the per-port timeout */
281 uart_update_timeout(port, new->c_cflag, baud);
283 /* Do our best to flush TX & RX, so we don't loose anything */
284 /* But we don't wait indefinitly ! */
285 j = 5000000; /* Maximum wait */
286 /* FIXME Can't receive chars since set_termios might be called at early
287 * boot for the console, all stuff is not yet ready to receive at that
288 * time and that just makes the kernel oops */
289 /* while (j-- && mpc52xx_uart_int_rx_chars(port)); */
290 while (!(in_be16(&psc->mpc52xx_psc_status) & MPC52xx_PSC_SR_TXEMP) &&
295 printk( KERN_ERR "mpc52xx_uart.c: "
296 "Unable to flush RX & TX fifos in-time in set_termios."
297 "Some chars may have been lost.\n" );
299 /* Reset the TX & RX */
300 out_8(&psc->command,MPC52xx_PSC_RST_RX);
301 out_8(&psc->command,MPC52xx_PSC_RST_TX);
303 /* Send new mode settings */
304 out_8(&psc->command,MPC52xx_PSC_SEL_MODE_REG_1);
305 out_8(&psc->mode,mr1);
306 out_8(&psc->mode,mr2);
307 out_8(&psc->ctur,ctr >> 8);
308 out_8(&psc->ctlr,ctr & 0xff);
310 /* Reenable TX & RX */
311 out_8(&psc->command,MPC52xx_PSC_TX_ENABLE);
312 out_8(&psc->command,MPC52xx_PSC_RX_ENABLE);
314 /* We're all set, release the lock */
315 spin_unlock_irqrestore(&port->lock, flags);
319 mpc52xx_uart_type(struct uart_port *port)
321 return port->type == PORT_MPC52xx ? "MPC52xx PSC" : NULL;
325 mpc52xx_uart_release_port(struct uart_port *port)
327 if (port->flags & UPF_IOREMAP) { /* remapped by us ? */
328 iounmap(port->membase);
329 port->membase = NULL;
332 release_mem_region(port->mapbase, MPC52xx_PSC_SIZE);
336 mpc52xx_uart_request_port(struct uart_port *port)
338 if (port->flags & UPF_IOREMAP) /* Need to remap ? */
339 port->membase = ioremap(port->mapbase, MPC52xx_PSC_SIZE);
344 return request_mem_region(port->mapbase, MPC52xx_PSC_SIZE,
345 "mpc52xx_psc_uart") != NULL ? 0 : -EBUSY;
349 mpc52xx_uart_config_port(struct uart_port *port, int flags)
351 if ( (flags & UART_CONFIG_TYPE) &&
352 (mpc52xx_uart_request_port(port) == 0) )
353 port->type = PORT_MPC52xx;
357 mpc52xx_uart_verify_port(struct uart_port *port, struct serial_struct *ser)
359 if ( ser->type != PORT_UNKNOWN && ser->type != PORT_MPC52xx )
362 if ( (ser->irq != port->irq) ||
363 (ser->io_type != SERIAL_IO_MEM) ||
364 (ser->baud_base != port->uartclk) ||
365 (ser->iomem_base != (void*)port->mapbase) ||
373 static struct uart_ops mpc52xx_uart_ops = {
374 .tx_empty = mpc52xx_uart_tx_empty,
375 .set_mctrl = mpc52xx_uart_set_mctrl,
376 .get_mctrl = mpc52xx_uart_get_mctrl,
377 .stop_tx = mpc52xx_uart_stop_tx,
378 .start_tx = mpc52xx_uart_start_tx,
379 .send_xchar = mpc52xx_uart_send_xchar,
380 .stop_rx = mpc52xx_uart_stop_rx,
381 .enable_ms = mpc52xx_uart_enable_ms,
382 .break_ctl = mpc52xx_uart_break_ctl,
383 .startup = mpc52xx_uart_startup,
384 .shutdown = mpc52xx_uart_shutdown,
385 .set_termios = mpc52xx_uart_set_termios,
386 /* .pm = mpc52xx_uart_pm, Not supported yet */
387 /* .set_wake = mpc52xx_uart_set_wake, Not supported yet */
388 .type = mpc52xx_uart_type,
389 .release_port = mpc52xx_uart_release_port,
390 .request_port = mpc52xx_uart_request_port,
391 .config_port = mpc52xx_uart_config_port,
392 .verify_port = mpc52xx_uart_verify_port
396 /* ======================================================================== */
397 /* Interrupt handling */
398 /* ======================================================================== */
401 mpc52xx_uart_int_rx_chars(struct uart_port *port, struct pt_regs *regs)
403 struct tty_struct *tty = port->info->tty;
405 unsigned short status;
407 /* While we can read, do so ! */
408 while ( (status = in_be16(&PSC(port)->mpc52xx_psc_status)) &
409 MPC52xx_PSC_SR_RXRDY) {
411 /* If we are full, just stop reading */
412 if (tty->flip.count >= TTY_FLIPBUF_SIZE)
416 ch = in_8(&PSC(port)->mpc52xx_psc_buffer_8);
418 /* Handle sysreq char */
420 if (uart_handle_sysrq_char(port, ch, regs)) {
427 *tty->flip.char_buf_ptr = ch;
428 *tty->flip.flag_buf_ptr = 0;
431 if ( status & (MPC52xx_PSC_SR_PE |
434 MPC52xx_PSC_SR_OE) ) {
436 if (status & MPC52xx_PSC_SR_RB) {
437 *tty->flip.flag_buf_ptr = TTY_BREAK;
438 uart_handle_break(port);
439 } else if (status & MPC52xx_PSC_SR_PE)
440 *tty->flip.flag_buf_ptr = TTY_PARITY;
441 else if (status & MPC52xx_PSC_SR_FE)
442 *tty->flip.flag_buf_ptr = TTY_FRAME;
443 if (status & MPC52xx_PSC_SR_OE) {
445 * Overrun is special, since it's
446 * reported immediately, and doesn't
447 * affect the current character
449 if (tty->flip.count < (TTY_FLIPBUF_SIZE-1)) {
450 tty->flip.flag_buf_ptr++;
451 tty->flip.char_buf_ptr++;
454 *tty->flip.flag_buf_ptr = TTY_OVERRUN;
457 /* Clear error condition */
458 out_8(&PSC(port)->command,MPC52xx_PSC_RST_ERR_STAT);
462 tty->flip.char_buf_ptr++;
463 tty->flip.flag_buf_ptr++;
468 tty_flip_buffer_push(tty);
470 return in_be16(&PSC(port)->mpc52xx_psc_status) & MPC52xx_PSC_SR_RXRDY;
474 mpc52xx_uart_int_tx_chars(struct uart_port *port)
476 struct circ_buf *xmit = &port->info->xmit;
478 /* Process out of band chars */
480 out_8(&PSC(port)->mpc52xx_psc_buffer_8, port->x_char);
486 /* Nothing to do ? */
487 if (uart_circ_empty(xmit) || uart_tx_stopped(port)) {
488 mpc52xx_uart_stop_tx(port);
493 while (in_be16(&PSC(port)->mpc52xx_psc_status) & MPC52xx_PSC_SR_TXRDY) {
494 out_8(&PSC(port)->mpc52xx_psc_buffer_8, xmit->buf[xmit->tail]);
495 xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
497 if (uart_circ_empty(xmit))
502 if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
503 uart_write_wakeup(port);
505 /* Maybe we're done after all */
506 if (uart_circ_empty(xmit)) {
507 mpc52xx_uart_stop_tx(port);
515 mpc52xx_uart_int(int irq, void *dev_id, struct pt_regs *regs)
517 struct uart_port *port = (struct uart_port *) dev_id;
518 unsigned long pass = ISR_PASS_LIMIT;
519 unsigned int keepgoing;
520 unsigned short status;
522 if ( irq != port->irq ) {
524 "mpc52xx_uart_int : " \
525 "Received wrong int %d. Waiting for %d\n",
530 spin_lock(&port->lock);
532 /* While we have stuff to do, we continue */
534 /* If we don't find anything to do, we stop */
538 status = in_be16(&PSC(port)->mpc52xx_psc_isr);
539 status &= port->read_status_mask;
541 /* Do we need to receive chars ? */
542 /* For this RX interrupts must be on and some chars waiting */
543 if ( status & MPC52xx_PSC_IMR_RXRDY )
544 keepgoing |= mpc52xx_uart_int_rx_chars(port, regs);
546 /* Do we need to send chars ? */
547 /* For this, TX must be ready and TX interrupt enabled */
548 if ( status & MPC52xx_PSC_IMR_TXRDY )
549 keepgoing |= mpc52xx_uart_int_tx_chars(port);
551 /* Limit number of iteration */
557 spin_unlock(&port->lock);
563 /* ======================================================================== */
564 /* Console ( if applicable ) */
565 /* ======================================================================== */
567 #ifdef CONFIG_SERIAL_MPC52xx_CONSOLE
570 mpc52xx_console_get_options(struct uart_port *port,
571 int *baud, int *parity, int *bits, int *flow)
573 struct mpc52xx_psc __iomem *psc = PSC(port);
576 /* Read the mode registers */
577 out_8(&psc->command,MPC52xx_PSC_SEL_MODE_REG_1);
578 mr1 = in_8(&psc->mode);
580 /* CT{U,L}R are write-only ! */
581 *baud = __res.bi_baudrate ?
582 __res.bi_baudrate : CONFIG_SERIAL_MPC52xx_CONSOLE_BAUD;
585 switch (mr1 & MPC52xx_PSC_MODE_BITS_MASK) {
586 case MPC52xx_PSC_MODE_5_BITS: *bits = 5; break;
587 case MPC52xx_PSC_MODE_6_BITS: *bits = 6; break;
588 case MPC52xx_PSC_MODE_7_BITS: *bits = 7; break;
589 case MPC52xx_PSC_MODE_8_BITS:
593 if (mr1 & MPC52xx_PSC_MODE_PARNONE)
596 *parity = mr1 & MPC52xx_PSC_MODE_PARODD ? 'o' : 'e';
600 mpc52xx_console_write(struct console *co, const char *s, unsigned int count)
602 struct uart_port *port = &mpc52xx_uart_ports[co->index];
603 struct mpc52xx_psc __iomem *psc = PSC(port);
606 /* Disable interrupts */
607 out_be16(&psc->mpc52xx_psc_imr, 0);
609 /* Wait the TX buffer to be empty */
610 j = 5000000; /* Maximum wait */
611 while (!(in_be16(&psc->mpc52xx_psc_status) & MPC52xx_PSC_SR_TXEMP) &&
615 /* Write all the chars */
616 for ( i=0 ; i<count ; i++ ) {
619 out_8(&psc->mpc52xx_psc_buffer_8, *s);
621 /* Line return handling */
623 out_8(&psc->mpc52xx_psc_buffer_8, '\r');
625 /* Wait the TX buffer to be empty */
626 j = 20000; /* Maximum wait */
627 while (!(in_be16(&psc->mpc52xx_psc_status) &
628 MPC52xx_PSC_SR_TXEMP) && --j)
632 /* Restore interrupt state */
633 out_be16(&psc->mpc52xx_psc_imr, port->read_status_mask);
637 mpc52xx_console_setup(struct console *co, char *options)
639 struct uart_port *port = &mpc52xx_uart_ports[co->index];
641 int baud = CONFIG_SERIAL_MPC52xx_CONSOLE_BAUD;
646 if (co->index < 0 || co->index >= MPC52xx_PSC_MAXNUM)
649 /* Basic port init. Needed since we use some uart_??? func before
650 * real init for early access */
651 spin_lock_init(&port->lock);
652 port->uartclk = __res.bi_ipbfreq / 2; /* Look at CTLR doc */
653 port->ops = &mpc52xx_uart_ops;
654 port->mapbase = MPC52xx_PA(MPC52xx_PSCx_OFFSET(co->index+1));
656 /* We ioremap ourself */
657 port->membase = ioremap(port->mapbase, MPC52xx_PSC_SIZE);
658 if (port->membase == NULL)
661 /* Setup the port parameters accoding to options */
663 uart_parse_options(options, &baud, &parity, &bits, &flow);
665 mpc52xx_console_get_options(port, &baud, &parity, &bits, &flow);
667 return uart_set_options(port, co, baud, parity, bits, flow);
671 extern struct uart_driver mpc52xx_uart_driver;
673 static struct console mpc52xx_console = {
675 .write = mpc52xx_console_write,
676 .device = uart_console_device,
677 .setup = mpc52xx_console_setup,
678 .flags = CON_PRINTBUFFER,
679 .index = -1, /* Specified on the cmdline (e.g. console=ttyS0 ) */
680 .data = &mpc52xx_uart_driver,
685 mpc52xx_console_init(void)
687 register_console(&mpc52xx_console);
691 console_initcall(mpc52xx_console_init);
693 #define MPC52xx_PSC_CONSOLE &mpc52xx_console
695 #define MPC52xx_PSC_CONSOLE NULL
699 /* ======================================================================== */
701 /* ======================================================================== */
703 static struct uart_driver mpc52xx_uart_driver = {
704 .owner = THIS_MODULE,
705 .driver_name = "mpc52xx_psc_uart",
707 .devfs_name = "ttyS",
710 .nr = MPC52xx_PSC_MAXNUM,
711 .cons = MPC52xx_PSC_CONSOLE,
715 /* ======================================================================== */
716 /* Platform Driver */
717 /* ======================================================================== */
720 mpc52xx_uart_probe(struct platform_device *dev)
722 struct resource *res = dev->resource;
724 struct uart_port *port = NULL;
727 /* Check validity & presence */
729 if (idx < 0 || idx >= MPC52xx_PSC_MAXNUM)
732 if (!mpc52xx_match_psc_function(idx,"uart"))
735 /* Init the port structure */
736 port = &mpc52xx_uart_ports[idx];
738 memset(port, 0x00, sizeof(struct uart_port));
740 spin_lock_init(&port->lock);
741 port->uartclk = __res.bi_ipbfreq / 2; /* Look at CTLR doc */
742 port->fifosize = 255; /* Should be 512 ! But it can't be */
743 /* stored in a unsigned char */
744 port->iotype = UPIO_MEM;
745 port->flags = UPF_BOOT_AUTOCONF |
746 ( uart_console(port) ? 0 : UPF_IOREMAP );
748 port->ops = &mpc52xx_uart_ops;
750 /* Search for IRQ and mapbase */
751 for (i=0 ; i<pdev->num_resources ; i++, res++) {
752 if (res->flags & IORESOURCE_MEM)
753 port->mapbase = res->start;
754 else if (res->flags & IORESOURCE_IRQ)
755 port->irq = res->start;
757 if (!port->irq || !port->mapbase)
760 /* Add the port to the uart sub-system */
761 ret = uart_add_one_port(&mpc52xx_uart_driver, port);
763 platform_set_drvdata(dev, (void*)port);
769 mpc52xx_uart_remove(struct platform_device *dev)
771 struct uart_port *port = (struct uart_port *) platform_get_drvdata(dev);
773 platform_set_drvdata(dev, NULL);
776 uart_remove_one_port(&mpc52xx_uart_driver, port);
783 mpc52xx_uart_suspend(struct platform_device *dev, pm_message_t state)
785 struct uart_port *port = (struct uart_port *) platform_get_drvdata(dev);
788 uart_suspend_port(&mpc52xx_uart_driver, port);
794 mpc52xx_uart_resume(struct platform_device *dev)
796 struct uart_port *port = (struct uart_port *) platform_get_drvdata(dev);
799 uart_resume_port(&mpc52xx_uart_driver, port);
805 static struct platform_driver mpc52xx_uart_platform_driver = {
806 .probe = mpc52xx_uart_probe,
807 .remove = mpc52xx_uart_remove,
809 .suspend = mpc52xx_uart_suspend,
810 .resume = mpc52xx_uart_resume,
813 .name = "mpc52xx-psc",
818 /* ======================================================================== */
820 /* ======================================================================== */
823 mpc52xx_uart_init(void)
827 printk(KERN_INFO "Serial: MPC52xx PSC driver\n");
829 ret = uart_register_driver(&mpc52xx_uart_driver);
831 ret = platform_driver_register(&mpc52xx_uart_platform_driver);
833 uart_unregister_driver(&mpc52xx_uart_driver);
840 mpc52xx_uart_exit(void)
842 platform_driver_unregister(&mpc52xx_uart_platform_driver);
843 uart_unregister_driver(&mpc52xx_uart_driver);
847 module_init(mpc52xx_uart_init);
848 module_exit(mpc52xx_uart_exit);
850 MODULE_AUTHOR("Sylvain Munaut <tnt@246tNt.com>");
851 MODULE_DESCRIPTION("Freescale MPC52xx PSC UART");
852 MODULE_LICENSE("GPL");