ip32-platform.c 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. /*
  15. * .iobase isn't a constant (in the sense of C) so we fill it in at runtime.
  16. */
  17. #define MACE_PORT(int) \
  18. { \
  19. .irq = int, \
  20. .uartclk = 1843200, \
  21. .iotype = UPIO_MEM, \
  22. .flags = UPF_SKIP_TEST, \
  23. .regshift = 8, \
  24. }
  25. static struct plat_serial8250_port uart8250_data[] = {
  26. MACE_PORT(MACEISA_SERIAL1_IRQ),
  27. MACE_PORT(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. uart8250_data[0].membase = (void __iomem *) &mace->isa.serial1;
  40. uart8250_data[1].membase = (void __iomem *) &mace->isa.serial1;
  41. return platform_device_register(&uart8250_device);
  42. }
  43. device_initcall(uart8250_init);
  44. static __init int meth_devinit(void)
  45. {
  46. struct platform_device *pd;
  47. int ret;
  48. pd = platform_device_alloc("meth", -1);
  49. if (!pd)
  50. return -ENOMEM;
  51. ret = platform_device_add(pd);
  52. if (ret)
  53. platform_device_put(pd);
  54. return ret;
  55. }
  56. device_initcall(meth_devinit);
  57. MODULE_AUTHOR("Ralf Baechle <ralf@linux-mips.org>");
  58. MODULE_LICENSE("GPL");
  59. MODULE_DESCRIPTION("8250 UART probe driver for SGI IP32 aka O2");