ip32-platform.c 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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 Ralf Baechle (ralf@linux-mips.org)
  7. */
  8. #include <linux/module.h>
  9. #include <linux/init.h>
  10. #include <linux/platform_device.h>
  11. #include <linux/serial_8250.h>
  12. #include <asm/ip32/mace.h>
  13. #include <asm/ip32/ip32_ints.h>
  14. #define MACEISA_SERIAL1_OFFS offsetof(struct sgi_mace, isa.serial1)
  15. #define MACEISA_SERIAL2_OFFS offsetof(struct sgi_mace, isa.serial2)
  16. #define MACE_PORT(offset,_irq) \
  17. { \
  18. .mapbase = MACE_BASE + offset, \
  19. .irq = _irq, \
  20. .uartclk = 1843200, \
  21. .iotype = UPIO_MEM, \
  22. .flags = UPF_SKIP_TEST|UPF_IOREMAP, \
  23. .regshift = 8, \
  24. }
  25. static struct plat_serial8250_port uart8250_data[] = {
  26. MACE_PORT(MACEISA_SERIAL1_OFFS, MACEISA_SERIAL1_IRQ),
  27. MACE_PORT(MACEISA_SERIAL2_OFFS, MACEISA_SERIAL2_IRQ),
  28. { },
  29. };
  30. static struct platform_device uart8250_device = {
  31. .name = "serial8250",
  32. .id = PLAT8250_DEV_PLATFORM,
  33. .dev = {
  34. .platform_data = uart8250_data,
  35. },
  36. };
  37. static int __init uart8250_init(void)
  38. {
  39. return platform_device_register(&uart8250_device);
  40. }
  41. device_initcall(uart8250_init);
  42. static __init int meth_devinit(void)
  43. {
  44. struct platform_device *pd;
  45. int ret;
  46. pd = platform_device_alloc("meth", -1);
  47. if (!pd)
  48. return -ENOMEM;
  49. ret = platform_device_add(pd);
  50. if (ret)
  51. platform_device_put(pd);
  52. return ret;
  53. }
  54. device_initcall(meth_devinit);
  55. static __init int sgio2audio_devinit(void)
  56. {
  57. struct platform_device *pd;
  58. int ret;
  59. pd = platform_device_alloc("sgio2audio", -1);
  60. if (!pd)
  61. return -ENOMEM;
  62. ret = platform_device_add(pd);
  63. if (ret)
  64. platform_device_put(pd);
  65. return ret;
  66. }
  67. device_initcall(sgio2audio_devinit);
  68. static __init int sgio2btns_devinit(void)
  69. {
  70. return IS_ERR(platform_device_register_simple("sgibtns", -1, NULL, 0));
  71. }
  72. device_initcall(sgio2btns_devinit);
  73. static struct resource sgio2_cmos_rsrc[] = {
  74. {
  75. .start = 0x70,
  76. .end = 0x71,
  77. .flags = IORESOURCE_IO
  78. }
  79. };
  80. static __init int sgio2_cmos_devinit(void)
  81. {
  82. return IS_ERR(platform_device_register_simple("rtc_cmos", -1,
  83. sgio2_cmos_rsrc, 1));
  84. }
  85. device_initcall(sgio2_cmos_devinit);
  86. MODULE_AUTHOR("Ralf Baechle <ralf@linux-mips.org>");
  87. MODULE_LICENSE("GPL");
  88. MODULE_DESCRIPTION("8250 UART probe driver for SGI IP32 aka O2");