samsung.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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. /* uart port features */
  23. unsigned int has_divslot:1;
  24. /* clock source control */
  25. int (*get_clksrc)(struct uart_port *, struct s3c24xx_uart_clksrc *clk);
  26. int (*set_clksrc)(struct uart_port *, struct s3c24xx_uart_clksrc *clk);
  27. /* uart controls */
  28. int (*reset_port)(struct uart_port *, struct s3c2410_uartcfg *);
  29. };
  30. struct s3c24xx_uart_port {
  31. unsigned char rx_claimed;
  32. unsigned char tx_claimed;
  33. unsigned int pm_level;
  34. unsigned long baudclk_rate;
  35. unsigned int rx_irq;
  36. unsigned int tx_irq;
  37. struct s3c24xx_uart_info *info;
  38. struct s3c24xx_uart_clksrc *clksrc;
  39. struct clk *clk;
  40. struct clk *baudclk;
  41. struct uart_port port;
  42. #ifdef CONFIG_CPU_FREQ
  43. struct notifier_block freq_transition;
  44. #endif
  45. };
  46. /* conversion functions */
  47. #define s3c24xx_dev_to_port(__dev) (struct uart_port *)dev_get_drvdata(__dev)
  48. #define s3c24xx_dev_to_cfg(__dev) (struct s3c2410_uartcfg *)((__dev)->platform_data)
  49. /* register access controls */
  50. #define portaddr(port, reg) ((port)->membase + (reg))
  51. #define rd_regb(port, reg) (__raw_readb(portaddr(port, reg)))
  52. #define rd_regl(port, reg) (__raw_readl(portaddr(port, reg)))
  53. #define wr_regb(port, reg, val) __raw_writeb(val, portaddr(port, reg))
  54. #define wr_regl(port, reg, val) __raw_writel(val, portaddr(port, reg))
  55. extern int s3c24xx_serial_probe(struct platform_device *dev,
  56. struct s3c24xx_uart_info *uart);
  57. extern int s3c24xx_serial_remove(struct platform_device *dev);
  58. extern int s3c24xx_serial_initconsole(struct platform_driver *drv,
  59. struct s3c24xx_uart_info *uart);
  60. extern int s3c24xx_serial_init(struct platform_driver *drv,
  61. struct s3c24xx_uart_info *info);
  62. #ifdef CONFIG_SERIAL_SAMSUNG_CONSOLE
  63. #define s3c24xx_console_init(__drv, __inf) \
  64. static int __init s3c_serial_console_init(void) \
  65. { \
  66. return s3c24xx_serial_initconsole(__drv, __inf); \
  67. } \
  68. \
  69. console_initcall(s3c_serial_console_init)
  70. #else
  71. #define s3c24xx_console_init(drv, inf) extern void no_console(void)
  72. #endif
  73. #ifdef CONFIG_SERIAL_SAMSUNG_DEBUG
  74. extern void printascii(const char *);
  75. static void dbg(const char *fmt, ...)
  76. {
  77. va_list va;
  78. char buff[256];
  79. va_start(va, fmt);
  80. vsprintf(buff, fmt, va);
  81. va_end(va);
  82. printascii(buff);
  83. }
  84. #else
  85. #define dbg(x...) do { } while (0)
  86. #endif