samsung.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. /* linux/drivers/serial/samsung.h
  2. *
  3. * Driver for Samsung SoC onboard UARTs.
  4. *
  5. * Ben Dooks, Copyright (c) 2003-2005,2008 Simtec Electronics
  6. * http://armlinux.simtec.co.uk/
  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. struct s3c24xx_uart_info {
  13. char *name;
  14. unsigned int type;
  15. unsigned int fifosize;
  16. unsigned long rx_fifomask;
  17. unsigned long rx_fifoshift;
  18. unsigned long rx_fifofull;
  19. unsigned long tx_fifomask;
  20. unsigned long tx_fifoshift;
  21. unsigned long tx_fifofull;
  22. /* clock source control */
  23. int (*get_clksrc)(struct uart_port *, struct s3c24xx_uart_clksrc *clk);
  24. int (*set_clksrc)(struct uart_port *, struct s3c24xx_uart_clksrc *clk);
  25. /* uart controls */
  26. int (*reset_port)(struct uart_port *, struct s3c2410_uartcfg *);
  27. };
  28. struct s3c24xx_uart_port {
  29. unsigned char rx_claimed;
  30. unsigned char tx_claimed;
  31. unsigned int pm_level;
  32. unsigned long baudclk_rate;
  33. unsigned int rx_irq;
  34. unsigned int tx_irq;
  35. struct s3c24xx_uart_info *info;
  36. struct s3c24xx_uart_clksrc *clksrc;
  37. struct clk *clk;
  38. struct clk *baudclk;
  39. struct uart_port port;
  40. #ifdef CONFIG_CPU_FREQ
  41. struct notifier_block freq_transition;
  42. #endif
  43. };
  44. /* conversion functions */
  45. #define s3c24xx_dev_to_port(__dev) (struct uart_port *)dev_get_drvdata(__dev)
  46. #define s3c24xx_dev_to_cfg(__dev) (struct s3c2410_uartcfg *)((__dev)->platform_data)
  47. /* register access controls */
  48. #define portaddr(port, reg) ((port)->membase + (reg))
  49. #define rd_regb(port, reg) (__raw_readb(portaddr(port, reg)))
  50. #define rd_regl(port, reg) (__raw_readl(portaddr(port, reg)))
  51. #define wr_regb(port, reg, val) __raw_writeb(val, portaddr(port, reg))
  52. #define wr_regl(port, reg, val) __raw_writel(val, portaddr(port, reg))
  53. extern int s3c24xx_serial_probe(struct platform_device *dev,
  54. struct s3c24xx_uart_info *uart);
  55. extern int s3c24xx_serial_remove(struct platform_device *dev);
  56. extern int s3c24xx_serial_initconsole(struct platform_driver *drv,
  57. struct s3c24xx_uart_info *uart);
  58. extern int s3c24xx_serial_init(struct platform_driver *drv,
  59. struct s3c24xx_uart_info *info);
  60. #ifdef CONFIG_SERIAL_SAMSUNG_CONSOLE
  61. #define s3c24xx_console_init(__drv, __inf) \
  62. static int __init s3c_serial_console_init(void) \
  63. { \
  64. return s3c24xx_serial_initconsole(__drv, __inf); \
  65. } \
  66. \
  67. console_initcall(s3c_serial_console_init)
  68. #else
  69. #define s3c24xx_console_init(drv, inf) extern void no_console(void)
  70. #endif
  71. #ifdef CONFIG_SERIAL_SAMSUNG_DEBUG
  72. extern void printascii(const char *);
  73. static void dbg(const char *fmt, ...)
  74. {
  75. va_list va;
  76. char buff[256];
  77. va_start(va, fmt);
  78. vsprintf(buff, fmt, va);
  79. va_end(va);
  80. printascii(buff);
  81. }
  82. #else
  83. #define dbg(x...) do { } while (0)
  84. #endif