mtk_uart_intf.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. #ifndef __MTK_UART_INTF_H__
  2. #define __MTK_UART_INTF_H__
  3. #include "platform_uart.h"
  4. #include <linux/platform_device.h>
  5. /*---------------------------------------------------------------------------*/
  6. /* fiq debugger */
  7. /*---------------------------------------------------------------------------*/
  8. int fiq_uart_getc(struct platform_device *pdev);
  9. void fiq_uart_putc(struct platform_device *pdev, unsigned int c);
  10. void fiq_uart_fixup(int uart_port);
  11. irqreturn_t mt_debug_signal_irq(int irq, void *dev_id);
  12. int mt_fiq_init(void *arg);
  13. /*---------------------------------------------------------------------------*/
  14. struct mtk_uart_setting *get_uart_default_settings(int idx);
  15. #ifdef CONFIG_OF
  16. void *get_apdma_uart0_base(void);
  17. unsigned int get_uart_vfifo_irq_id(int idx);
  18. void set_uart_default_settings(int idx);
  19. #endif
  20. unsigned long get_uart_evt_mask(int idx);
  21. void mtk_uart_switch_tx_to_gpio(struct mtk_uart *uart);
  22. void mtk_uart_switch_to_tx(struct mtk_uart *uart);
  23. void mtk_uart_switch_rx_to_gpio(struct mtk_uart *uart);
  24. void mtk_uart_switch_to_rx(struct mtk_uart *uart);
  25. void set_uart_evt_mask(int idx, int value);
  26. unsigned long get_uart_lsr_status(int idx);
  27. void set_uart_lsr_status(int idx, int value);
  28. unsigned char get_modem_status(int idx);
  29. void dump_uart_reg(void);
  30. void mtk_uart_console_setting_switch(struct mtk_uart *uart);
  31. int mtk_uart_vfifo_is_empty(struct mtk_uart_vfifo *vfifo);
  32. void mtk_uart_tx_vfifo_flush(struct mtk_uart *uart, int timeout);
  33. int mtk_uart_vfifo_get_counts(struct mtk_uart_vfifo *vfifo);
  34. void mtk_uart_dma_vfifo_tx_tasklet(unsigned long arg);
  35. void mtk_uart_dma_vfifo_rx_tasklet(unsigned long arg);
  36. int mtk_uart_vfifo_enable(struct mtk_uart *uart, struct mtk_uart_vfifo *vfifo);
  37. int mtk_uart_vfifo_disable(struct mtk_uart *uart, struct mtk_uart_vfifo *vfifo);
  38. void mtk_uart_vfifo_enable_tx_intr(struct mtk_uart *uart);
  39. void mtk_uart_vfifo_disable_tx_intr(struct mtk_uart *uart);
  40. void mtk_uart_vfifo_enable_rx_intr(struct mtk_uart *uart);
  41. void mtk_uart_vfifo_disable_rx_intr(struct mtk_uart *uart);
  42. unsigned int mtk_uart_write_allow(struct mtk_uart *uart);
  43. void mtk_uart_enable_intrs(struct mtk_uart *uart, long mask);
  44. void mtk_uart_disable_intrs(struct mtk_uart *uart, long mask);
  45. int mtk_uart_vfifo_is_full(struct mtk_uart_vfifo *vfifo);
  46. void mtk_uart_stop_dma(struct mtk_uart_dma *dma);
  47. void mtk_uart_reset_dma(struct mtk_uart_dma *dma);
  48. void mtk_uart_set_mode(struct mtk_uart *uart, int mode);
  49. void mtk_uart_set_auto_baud(struct mtk_uart *uart);
  50. void mtk_uart_baud_setting(struct mtk_uart *uart, int baudrate);
  51. void mtk_uart_dma_setup(struct mtk_uart *uart, struct mtk_uart_dma *dma);
  52. int mtk_uart_dma_start(struct mtk_uart *uart, struct mtk_uart_dma *dma);
  53. void mtk_uart_vfifo_write_byte(struct mtk_uart *uart, unsigned int byte);
  54. unsigned int mtk_uart_vfifo_read_byte(struct mtk_uart *uart);
  55. unsigned int mtk_uart_read_status(struct mtk_uart *uart);
  56. unsigned int mtk_uart_read_allow(struct mtk_uart *uart);
  57. unsigned int mtk_uart_read_byte(struct mtk_uart *uart);
  58. void mtk_uart_write_byte(struct mtk_uart *uart, unsigned int byte);
  59. unsigned int mtk_uart_filter_line_status(struct mtk_uart *uart);
  60. void mtk_uart_fifo_set_trig(struct mtk_uart *uart, int tx_level, int rx_level);
  61. void mtk_uart_enable_sleep(struct mtk_uart *uart);
  62. void mtk_uart_fifo_init(struct mtk_uart *uart);
  63. void mtk_uart_fifo_flush(struct mtk_uart *uart);
  64. int mtk_uart_data_ready(struct mtk_uart *uart);
  65. void mtk_uart_config(struct mtk_uart *uart, int datalen, int stop, int parity);
  66. void mtk_uart_set_flow_ctrl(struct mtk_uart *uart, int mode);
  67. void mtk_uart_power_up(struct mtk_uart *uart);
  68. void mtk_uart_power_down(struct mtk_uart *uart);
  69. void mtk_uart_get_modem_status(struct mtk_uart *uart);
  70. void mtk_uart_rx_pre_handler(struct mtk_uart *uart, int intrs);
  71. int mtk_uart_get_interrupt(struct mtk_uart *uart);
  72. void mtk_uart_intr_last_check(struct mtk_uart *uart, int intrs);
  73. void mtk_uart_set_mctrl(struct uart_port *port, unsigned int mctrl);
  74. unsigned int mtk_uart_get_mctrl(struct uart_port *port);
  75. void mtk_uart_stop_rx(struct uart_port *port);
  76. void mtk_uart_break_ctl(struct uart_port *port, int break_state);
  77. void mtk_uart_save(struct mtk_uart *uart);
  78. void mtk_uart_restore(void);
  79. void mtk_uart_vfifo_clear_tx_intr(struct mtk_uart_vfifo *vfifo);
  80. void mtk_uart_vfifo_clear_rx_intr(struct mtk_uart_vfifo *vfifo);
  81. void mtk_uart_init_debug_spinlock(void);
  82. void reset_tx_raw_data(struct mtk_uart *uart);
  83. void mtk_uart_enable_dpidle(struct mtk_uart *uart);
  84. void mtk_uart_disable_dpidle(struct mtk_uart *uart);
  85. int mtk_uart_plat_info_query(const char str[]);
  86. #if !defined(CONFIG_MTK_LEGACY)
  87. void set_uart_dma_clk(int port_id, struct clk *dma_clk);
  88. void set_uart_pinctrl(int idx, struct pinctrl *ppinctrl);
  89. #endif /* !defined(CONFIG_MTK_LEGACY) */
  90. #endif /* MTK_UART_INTF_H */