s3c2410.c 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /*
  2. * Driver for Samsung S3C2410 SoC onboard UARTs.
  3. *
  4. * Ben Dooks, Copyright (c) 2003-2008 Simtec Electronics
  5. * http://armlinux.simtec.co.uk/
  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 version 2 as
  9. * published by the Free Software Foundation.
  10. */
  11. #include <linux/module.h>
  12. #include <linux/ioport.h>
  13. #include <linux/io.h>
  14. #include <linux/platform_device.h>
  15. #include <linux/init.h>
  16. #include <linux/serial_core.h>
  17. #include <linux/serial.h>
  18. #include <asm/irq.h>
  19. #include <mach/hardware.h>
  20. #include <plat/regs-serial.h>
  21. #include <mach/regs-gpio.h>
  22. #include "samsung.h"
  23. static int s3c2410_serial_resetport(struct uart_port *port,
  24. struct s3c2410_uartcfg *cfg)
  25. {
  26. dbg("s3c2410_serial_resetport: port=%p (%08lx), cfg=%p\n",
  27. port, port->mapbase, cfg);
  28. wr_regl(port, S3C2410_UCON, cfg->ucon);
  29. wr_regl(port, S3C2410_ULCON, cfg->ulcon);
  30. /* reset both fifos */
  31. wr_regl(port, S3C2410_UFCON, cfg->ufcon | S3C2410_UFCON_RESETBOTH);
  32. wr_regl(port, S3C2410_UFCON, cfg->ufcon);
  33. return 0;
  34. }
  35. static struct s3c24xx_uart_info s3c2410_uart_inf = {
  36. .name = "Samsung S3C2410 UART",
  37. .type = PORT_S3C2410,
  38. .fifosize = 16,
  39. .rx_fifomask = S3C2410_UFSTAT_RXMASK,
  40. .rx_fifoshift = S3C2410_UFSTAT_RXSHIFT,
  41. .rx_fifofull = S3C2410_UFSTAT_RXFULL,
  42. .tx_fifofull = S3C2410_UFSTAT_TXFULL,
  43. .tx_fifomask = S3C2410_UFSTAT_TXMASK,
  44. .tx_fifoshift = S3C2410_UFSTAT_TXSHIFT,
  45. .def_clk_sel = S3C2410_UCON_CLKSEL0,
  46. .num_clks = 2,
  47. .clksel_mask = S3C2410_UCON_CLKMASK,
  48. .clksel_shift = S3C2410_UCON_CLKSHIFT,
  49. .reset_port = s3c2410_serial_resetport,
  50. };
  51. static int s3c2410_serial_probe(struct platform_device *dev)
  52. {
  53. return s3c24xx_serial_probe(dev, &s3c2410_uart_inf);
  54. }
  55. static struct platform_driver s3c2410_serial_driver = {
  56. .probe = s3c2410_serial_probe,
  57. .remove = __devexit_p(s3c24xx_serial_remove),
  58. .driver = {
  59. .name = "s3c2410-uart",
  60. .owner = THIS_MODULE,
  61. },
  62. };
  63. static int __init s3c2410_serial_init(void)
  64. {
  65. return s3c24xx_serial_init(&s3c2410_serial_driver, &s3c2410_uart_inf);
  66. }
  67. static void __exit s3c2410_serial_exit(void)
  68. {
  69. platform_driver_unregister(&s3c2410_serial_driver);
  70. }
  71. module_init(s3c2410_serial_init);
  72. module_exit(s3c2410_serial_exit);
  73. MODULE_LICENSE("GPL v2");
  74. MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>");
  75. MODULE_DESCRIPTION("Samsung S3C2410 SoC Serial port driver");
  76. MODULE_ALIAS("platform:s3c2410-uart");