samsung.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. #ifndef __SAMSUNG_H
  2. #define __SAMSUNG_H
  3. /*
  4. * Driver for Samsung SoC onboard UARTs.
  5. *
  6. * Ben Dooks, Copyright (c) 2003-2008 Simtec Electronics
  7. * http://armlinux.simtec.co.uk/
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License version 2 as
  11. * published by the Free Software Foundation.
  12. */
  13. struct s3c24xx_uart_info {
  14. char *name;
  15. unsigned int type;
  16. unsigned int fifosize;
  17. unsigned long rx_fifomask;
  18. unsigned long rx_fifoshift;
  19. unsigned long rx_fifofull;
  20. unsigned long tx_fifomask;
  21. unsigned long tx_fifoshift;
  22. unsigned long tx_fifofull;
  23. unsigned int def_clk_sel;
  24. unsigned long num_clks;
  25. unsigned long clksel_mask;
  26. unsigned long clksel_shift;
  27. /* uart port features */
  28. unsigned int has_divslot:1;
  29. /* uart controls */
  30. int (*reset_port)(struct uart_port *, struct s3c2410_uartcfg *);
  31. };
  32. struct s3c24xx_serial_drv_data {
  33. struct s3c24xx_uart_info *info;
  34. struct s3c2410_uartcfg *def_cfg;
  35. unsigned int fifosize[CONFIG_SERIAL_SAMSUNG_UARTS];
  36. };
  37. struct s3c24xx_uart_port {
  38. unsigned char rx_claimed;
  39. unsigned char tx_claimed;
  40. unsigned int pm_level;
  41. unsigned long baudclk_rate;
  42. unsigned int rx_irq;
  43. unsigned int tx_irq;
  44. struct s3c24xx_uart_info *info;
  45. struct clk *clk;
  46. struct clk *baudclk;
  47. struct uart_port port;
  48. struct s3c24xx_serial_drv_data *drv_data;
  49. /* reference to platform data */
  50. struct s3c2410_uartcfg *cfg;
  51. #ifdef CONFIG_CPU_FREQ
  52. struct notifier_block freq_transition;
  53. #endif
  54. };
  55. /* conversion functions */
  56. #define s3c24xx_dev_to_port(__dev) dev_get_drvdata(__dev)
  57. /* register access controls */
  58. #define portaddr(port, reg) ((port)->membase + (reg))
  59. #define portaddrl(port, reg) \
  60. ((unsigned long *)(unsigned long)((port)->membase + (reg)))
  61. #define rd_regb(port, reg) (__raw_readb(portaddr(port, reg)))
  62. #define rd_regl(port, reg) (__raw_readl(portaddr(port, reg)))
  63. #define wr_regb(port, reg, val) __raw_writeb(val, portaddr(port, reg))
  64. #define wr_regl(port, reg, val) __raw_writel(val, portaddr(port, reg))
  65. #endif