8250_au1x00.c 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /*
  2. * Serial Device Initialisation for Au1x00
  3. *
  4. * (C) Copyright Embedded Alley Solutions, Inc 2005
  5. * Author: Pantelis Antoniou <pantelis@embeddedalley.com>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. */
  12. #include <linux/errno.h>
  13. #include <linux/init.h>
  14. #include <linux/interrupt.h>
  15. #include <linux/ioport.h>
  16. #include <linux/module.h>
  17. #include <linux/serial_core.h>
  18. #include <linux/signal.h>
  19. #include <linux/slab.h>
  20. #include <linux/types.h>
  21. #include <linux/serial_8250.h>
  22. #include <asm/mach-au1x00/au1000.h>
  23. #include "8250.h"
  24. #define PORT(_base, _irq) \
  25. { \
  26. .iobase = _base, \
  27. .membase = (void __iomem *)_base,\
  28. .mapbase = _base, \
  29. .irq = _irq, \
  30. .uartclk = 0, /* filled */ \
  31. .regshift = 2, \
  32. .iotype = UPIO_AU, \
  33. .flags = UPF_SKIP_TEST | \
  34. UPF_IOREMAP, \
  35. }
  36. static struct plat_serial8250_port au1x00_data[] = {
  37. #if defined(CONFIG_SOC_AU1000)
  38. PORT(UART0_ADDR, AU1000_UART0_INT),
  39. PORT(UART1_ADDR, AU1000_UART1_INT),
  40. PORT(UART2_ADDR, AU1000_UART2_INT),
  41. PORT(UART3_ADDR, AU1000_UART3_INT),
  42. #elif defined(CONFIG_SOC_AU1500)
  43. PORT(UART0_ADDR, AU1500_UART0_INT),
  44. PORT(UART3_ADDR, AU1500_UART3_INT),
  45. #elif defined(CONFIG_SOC_AU1100)
  46. PORT(UART0_ADDR, AU1100_UART0_INT),
  47. PORT(UART1_ADDR, AU1100_UART1_INT),
  48. /* The internal UART2 does not exist on the AU1100 processor. */
  49. PORT(UART3_ADDR, AU1100_UART3_INT),
  50. #elif defined(CONFIG_SOC_AU1550)
  51. PORT(UART0_ADDR, AU1550_UART0_INT),
  52. PORT(UART1_ADDR, AU1550_UART1_INT),
  53. PORT(UART3_ADDR, AU1550_UART3_INT),
  54. #elif defined(CONFIG_SOC_AU1200)
  55. PORT(UART0_ADDR, AU1200_UART0_INT),
  56. PORT(UART1_ADDR, AU1200_UART1_INT),
  57. #endif
  58. { },
  59. };
  60. static struct platform_device au1x00_device = {
  61. .name = "serial8250",
  62. .id = PLAT8250_DEV_AU1X00,
  63. .dev = {
  64. .platform_data = au1x00_data,
  65. },
  66. };
  67. static int __init au1x00_init(void)
  68. {
  69. int i;
  70. unsigned int uartclk;
  71. /* get uart clock */
  72. uartclk = get_au1x00_uart_baud_base() * 16;
  73. /* fill up uartclk */
  74. for (i = 0; au1x00_data[i].flags ; i++)
  75. au1x00_data[i].uartclk = uartclk;
  76. return platform_device_register(&au1x00_device);
  77. }
  78. /* XXX: Yes, I know this doesn't yet work. */
  79. static void __exit au1x00_exit(void)
  80. {
  81. platform_device_unregister(&au1x00_device);
  82. }
  83. module_init(au1x00_init);
  84. module_exit(au1x00_exit);
  85. MODULE_AUTHOR("Pantelis Antoniou <pantelis@embeddedalley.com>");
  86. MODULE_DESCRIPTION("8250 serial probe module for Au1x000 cards");
  87. MODULE_LICENSE("GPL");