samsung.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /*
  2. * Driver for Samsung 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. struct s3c24xx_uart_info {
  12. char *name;
  13. unsigned int type;
  14. unsigned int fifosize;
  15. unsigned long rx_fifomask;
  16. unsigned long rx_fifoshift;
  17. unsigned long rx_fifofull;
  18. unsigned long tx_fifomask;
  19. unsigned long tx_fifoshift;
  20. unsigned long tx_fifofull;
  21. unsigned int def_clk_sel;
  22. unsigned long num_clks;
  23. unsigned long clksel_mask;
  24. unsigned long clksel_shift;
  25. /* uart port features */
  26. unsigned int has_divslot:1;
  27. /* uart controls */
  28. int (*reset_port)(struct uart_port *, struct s3c2410_uartcfg *);
  29. };
  30. struct s3c24xx_serial_drv_data {
  31. struct s3c24xx_uart_info *info;
  32. struct s3c2410_uartcfg *def_cfg;
  33. unsigned int fifosize[CONFIG_SERIAL_SAMSUNG_UARTS];
  34. };
  35. struct s3c24xx_uart_port {
  36. unsigned char rx_claimed;
  37. unsigned char tx_claimed;
  38. unsigned int pm_level;
  39. unsigned long baudclk_rate;
  40. unsigned int rx_irq;
  41. unsigned int tx_irq;
  42. struct s3c24xx_uart_info *info;
  43. struct clk *clk;
  44. struct clk *baudclk;
  45. struct uart_port port;
  46. struct s3c24xx_serial_drv_data *drv_data;
  47. /* reference to platform data */
  48. struct s3c2410_uartcfg *cfg;
  49. #ifdef CONFIG_CPU_FREQ
  50. struct notifier_block freq_transition;
  51. #endif
  52. };
  53. /* conversion functions */
  54. #define s3c24xx_dev_to_port(__dev) (struct uart_port *)dev_get_drvdata(__dev)
  55. /* register access controls */
  56. #define portaddr(port, reg) ((port)->membase + (reg))
  57. #define portaddrl(port, reg) ((unsigned long *)((port)->membase + (reg)))
  58. #define rd_regb(port, reg) (__raw_readb(portaddr(port, reg)))
  59. #define rd_regl(port, reg) (__raw_readl(portaddr(port, reg)))
  60. #define wr_regb(port, reg, val) __raw_writeb(val, portaddr(port, reg))
  61. #define wr_regl(port, reg, val) __raw_writel(val, portaddr(port, reg))
  62. #ifdef CONFIG_SERIAL_SAMSUNG_DEBUG
  63. extern void printascii(const char *);
  64. static void dbg(const char *fmt, ...)
  65. {
  66. va_list va;
  67. char buff[256];
  68. va_start(va, fmt);
  69. vsprintf(buff, fmt, va);
  70. va_end(va);
  71. printascii(buff);
  72. }
  73. #else
  74. #define dbg(x...) do { } while (0)
  75. #endif