bast_sio.c 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /* linux/drivers/serial/bast_sio.c
  2. *
  3. * Copyright (c) 2004 Simtec Electronics
  4. * Ben Dooks <ben@simtec.co.uk>
  5. *
  6. * http://www.simtec.co.uk/products/EB2410ITX/
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. *
  12. * Modifications:
  13. * 23-Sep-2004 BJD Added copyright header
  14. * 23-Sep-2004 BJD Added serial port remove code
  15. */
  16. #include <linux/module.h>
  17. #include <linux/config.h>
  18. #include <linux/kernel.h>
  19. #include <linux/init.h>
  20. #include <linux/tty.h>
  21. #include <linux/serial.h>
  22. #include <linux/serial_core.h>
  23. #include <linux/types.h>
  24. #include <asm/io.h>
  25. #include <asm/serial.h>
  26. #include <asm/mach-types.h>
  27. #include <asm/arch/map.h>
  28. #include <asm/arch/irqs.h>
  29. #include <asm/arch/bast-map.h>
  30. #include <asm/arch/bast-irq.h>
  31. static int __init serial_bast_register(unsigned long port, unsigned int irq)
  32. {
  33. struct serial_struct serial_req;
  34. serial_req.flags = UPF_AUTOPROBE | UPF_SHARE_IRQ;
  35. serial_req.baud_base = BASE_BAUD;
  36. serial_req.irq = irq;
  37. serial_req.io_type = UPIO_MEM;
  38. serial_req.iomap_base = port;
  39. serial_req.iomem_base = ioremap(port, 0x10);
  40. serial_req.iomem_reg_shift = 0;
  41. return register_serial(&serial_req);
  42. }
  43. #define SERIAL_BASE (S3C2410_CS2 + BAST_PA_SUPERIO)
  44. static int port[2] = { -1, -1 };
  45. static int __init serial_bast_init(void)
  46. {
  47. if (machine_is_bast()) {
  48. port[0] = serial_bast_register(SERIAL_BASE + 0x2f8, IRQ_PCSERIAL1);
  49. port[1] = serial_bast_register(SERIAL_BASE + 0x3f8, IRQ_PCSERIAL2);
  50. }
  51. return 0;
  52. }
  53. static void __exit serial_bast_exit(void)
  54. {
  55. if (port[0] != -1)
  56. unregister_serial(port[0]);
  57. if (port[1] != -1)
  58. unregister_serial(port[1]);
  59. }
  60. module_init(serial_bast_init);
  61. module_exit(serial_bast_exit);
  62. MODULE_LICENSE("GPL");
  63. MODULE_AUTHOR("Ben Dooks, ben@simtec.co.uk");
  64. MODULE_DESCRIPTION("BAST Onboard Serial setup");