malta-platform.c 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. * This file is subject to the terms and conditions of the GNU General Public
  3. * License. See the file "COPYING" in the main directory of this archive
  4. * for more details.
  5. *
  6. * Copyright (C) 2007 MIPS Technologies, Inc.
  7. * written by Ralf Baechle (ralf@linux-mips.org)
  8. *
  9. * Probe driver for the Malta's UART ports:
  10. *
  11. * o 2 ports in the SMC SuperIO
  12. * o 1 port in the CBUS UART, a discrete 16550 which normally is only used
  13. * for bringups.
  14. *
  15. * We don't use 8250_platform.c on Malta as it would result in the CBUS
  16. * UART becoming ttyS0.
  17. */
  18. #include <linux/module.h>
  19. #include <linux/init.h>
  20. #include <linux/serial_8250.h>
  21. #define SMC_PORT(base, int) \
  22. { \
  23. .iobase = base, \
  24. .irq = int, \
  25. .uartclk = 1843200, \
  26. .iotype = UPIO_PORT, \
  27. .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, \
  28. .regshift = 0, \
  29. }
  30. #define CBUS_UART_FLAGS (UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP)
  31. static struct plat_serial8250_port uart8250_data[] = {
  32. SMC_PORT(0x3F8, 4),
  33. SMC_PORT(0x2F8, 3),
  34. {
  35. .mapbase = 0x1f000900, /* The CBUS UART */
  36. .irq = MIPS_CPU_IRQ_BASE + 2,
  37. .uartclk = 3686400, /* Twice the usual clk! */
  38. .iotype = UPIO_MEM32,
  39. .flags = CBUS_UART_FLAGS,
  40. .regshift = 3,
  41. },
  42. { },
  43. };
  44. static struct platform_device uart8250_device = {
  45. .name = "serial8250",
  46. .id = PLAT8250_DEV_PLATFORM2,
  47. .dev = {
  48. .platform_data = uart8250_data,
  49. },
  50. };
  51. static int __init uart8250_init(void)
  52. {
  53. return platform_device_register(&uart8250_device);
  54. }
  55. module_init(uart8250_init);
  56. MODULE_AUTHOR("Ralf Baechle <ralf@linux-mips.org>");
  57. MODULE_LICENSE("GPL");
  58. MODULE_DESCRIPTION("8250 UART probe driver for the Malta CBUS UART");