Lines Matching refs:port
26 static int scif_rxfill(struct uart_port *port) in scif_rxfill() argument
28 return sci_in(port, SCRFDR) & 0xff; in scif_rxfill()
31 static int scif_rxfill(struct uart_port *port) in scif_rxfill() argument
33 if ((port->mapbase == 0xffe00000) || in scif_rxfill()
34 (port->mapbase == 0xffe08000)) { in scif_rxfill()
36 return sci_in(port, SCRFDR) & 0xff; in scif_rxfill()
39 return sci_in(port, SCFDR) & SCIF2_RFDC_MASK; in scif_rxfill()
43 static int scif_rxfill(struct uart_port *port) in scif_rxfill() argument
45 if (port->type == PORT_SCIFA) in scif_rxfill()
46 return sci_in(port, SCFDR) & SCIF_RFDC_MASK; in scif_rxfill()
48 return sci_in(port, SCRFDR); in scif_rxfill()
51 static int scif_rxfill(struct uart_port *port) in scif_rxfill() argument
53 return sci_in(port, SCFDR) & SCIF_RFDC_MASK; in scif_rxfill()
57 static void sh_serial_init_generic(struct uart_port *port) in sh_serial_init_generic() argument
59 sci_out(port, SCSCR , SCSCR_INIT(port)); in sh_serial_init_generic()
60 sci_out(port, SCSCR , SCSCR_INIT(port)); in sh_serial_init_generic()
61 sci_out(port, SCSMR, 0); in sh_serial_init_generic()
62 sci_out(port, SCSMR, 0); in sh_serial_init_generic()
63 sci_out(port, SCFCR, SCFCR_RFRST|SCFCR_TFRST); in sh_serial_init_generic()
64 sci_in(port, SCFCR); in sh_serial_init_generic()
65 sci_out(port, SCFCR, 0); in sh_serial_init_generic()
69 sh_serial_setbrg_generic(struct uart_port *port, int clk, int baudrate) in sh_serial_setbrg_generic() argument
71 if (port->clk_mode == EXT_CLK) { in sh_serial_setbrg_generic()
73 sci_out(port, DL, dl); in sh_serial_setbrg_generic()
77 sci_out(port, SCBRR, SCBRR_VALUE(baudrate, clk)); in sh_serial_setbrg_generic()
81 static void handle_error(struct uart_port *port) in handle_error() argument
83 sci_in(port, SCxSR); in handle_error()
84 sci_out(port, SCxSR, SCxSR_ERROR_CLEAR(port)); in handle_error()
85 sci_in(port, SCLSR); in handle_error()
86 sci_out(port, SCLSR, 0x00); in handle_error()
89 static int serial_raw_putc(struct uart_port *port, const char c) in serial_raw_putc() argument
92 if (!(sci_in(port, SCxSR) & SCxSR_TEND(port))) in serial_raw_putc()
95 sci_out(port, SCxTDR, c); in serial_raw_putc()
96 sci_out(port, SCxSR, sci_in(port, SCxSR) & ~SCxSR_TEND(port)); in serial_raw_putc()
101 static int serial_rx_fifo_level(struct uart_port *port) in serial_rx_fifo_level() argument
103 return scif_rxfill(port); in serial_rx_fifo_level()
106 static int sh_serial_tstc_generic(struct uart_port *port) in sh_serial_tstc_generic() argument
108 if (sci_in(port, SCxSR) & SCIF_ERRORS) { in sh_serial_tstc_generic()
109 handle_error(port); in sh_serial_tstc_generic()
113 return serial_rx_fifo_level(port) ? 1 : 0; in sh_serial_tstc_generic()
116 static int serial_getc_check(struct uart_port *port) in serial_getc_check() argument
120 status = sci_in(port, SCxSR); in serial_getc_check()
123 handle_error(port); in serial_getc_check()
124 if (sci_in(port, SCLSR) & SCxSR_ORER(port)) in serial_getc_check()
125 handle_error(port); in serial_getc_check()
126 return status & (SCIF_DR | SCxSR_RDxF(port)); in serial_getc_check()
129 static int sh_serial_getc_generic(struct uart_port *port) in sh_serial_getc_generic() argument
134 if (!serial_getc_check(port)) in sh_serial_getc_generic()
137 ch = sci_in(port, SCxRDR); in sh_serial_getc_generic()
138 status = sci_in(port, SCxSR); in sh_serial_getc_generic()
140 sci_out(port, SCxSR, SCxSR_RDxF_CLEAR(port)); in sh_serial_getc_generic()
143 handle_error(port); in sh_serial_getc_generic()
145 if (sci_in(port, SCLSR) & SCxSR_ORER(port)) in sh_serial_getc_generic()
146 handle_error(port); in sh_serial_getc_generic()
298 struct uart_port *port = &sh_sci; in sh_serial_setbrg() local
300 sh_serial_setbrg_generic(port, CONFIG_SH_SCIF_CLK_FREQ, gd->baudrate); in sh_serial_setbrg()
305 struct uart_port *port = &sh_sci; in sh_serial_init() local
307 sh_serial_init_generic(port); in sh_serial_init()
315 struct uart_port *port = &sh_sci; in sh_serial_putc() local
319 if (serial_raw_putc(port, '\r') != -EAGAIN) in sh_serial_putc()
324 if (serial_raw_putc(port, c) != -EAGAIN) in sh_serial_putc()
331 struct uart_port *port = &sh_sci; in sh_serial_tstc() local
333 return sh_serial_tstc_generic(port); in sh_serial_tstc()
338 struct uart_port *port = &sh_sci; in sh_serial_getc() local
342 ch = sh_serial_getc_generic(port); in sh_serial_getc()