serial.c 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. * Copyright 2001 MontaVista Software Inc.
  3. * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
  4. *
  5. * arch/mips/vr4181/common/serial.c
  6. * initialize serial port on vr4181.
  7. *
  8. * This program is free software; you can redistribute it and/or modify it
  9. * under the terms of the GNU General Public License as published by the
  10. * Free Software Foundation; either version 2 of the License, or (at your
  11. * option) any later version.
  12. *
  13. */
  14. /*
  15. * [jsun, 010925]
  16. * You need to make sure rs_table has at least one element in
  17. * drivers/char/serial.c file. There is no good way to do it right
  18. * now. A workaround is to include CONFIG_SERIAL_MANY_PORTS in your
  19. * configure file, which would gives you 64 ports and wastes 11K ram.
  20. */
  21. #include <linux/types.h>
  22. #include <linux/kernel.h>
  23. #include <linux/init.h>
  24. #include <linux/serial.h>
  25. #include <asm/vr4181/vr4181.h>
  26. void __init vr4181_init_serial(void)
  27. {
  28. struct serial_struct s;
  29. /* turn on UART clock */
  30. *VR4181_CMUCLKMSK |= VR4181_CMUCLKMSK_MSKSIU;
  31. /* clear memory */
  32. memset(&s, 0, sizeof(s));
  33. s.line = 0; /* we set the first one */
  34. s.baud_base = 1152000;
  35. s.irq = VR4181_IRQ_SIU;
  36. s.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST; /* STD_COM_FLAGS */
  37. s.iomem_base = (u8*)VR4181_SIURB;
  38. s.iomem_reg_shift = 0;
  39. s.io_type = SERIAL_IO_MEM;
  40. if (early_serial_setup(&s) != 0) {
  41. panic("vr4181_init_serial() failed!");
  42. }
  43. }