static void __init ks8695_console_get_options(struct uart_port *port, int *baud, int *parity, int *bits) { unsigned int lcr; lcr = UART_GET_LCR(port); switch (lcr & URLC_PARITY) { case URPE_ODD: *parity = 'o'; break; case URPE_EVEN: *parity = 'e'; break; default: *parity = 'n'; } switch (lcr & URLC_URCL) { case URCL_5: *bits = 5; break; case URCL_6: *bits = 6; break; case URCL_7: *bits = 7; break; default: *bits = 8; } *baud = port->uartclk / (UART_GET_BRDR(port) & 0x0FFF); *baud /= 16; *baud &= 0xFFFFFFF0; }
static void ambauart_break_ctl(struct uart_port *port, int break_state) { unsigned int lcr; lcr = UART_GET_LCR(port); if (break_state == -1) lcr |= KS8695_UART_LINEC_BRK; else lcr &= ~KS8695_UART_LINEC_BRK; UART_PUT_LCR(port, lcr); }
/* * Interrupts are always disabled. */ static void bfin_serial_break_ctl(struct uart_port *port, int break_state) { struct bfin_serial_port *uart = (struct bfin_serial_port *)port; u16 lcr = UART_GET_LCR(uart); if (break_state) lcr |= SB; else lcr &= ~SB; UART_PUT_LCR(uart, lcr); SSYNC(); }
static void ks8695uart_shutdown(struct uart_port *port) { free_irq(KS8695_IRQ_UART_RX, port); free_irq(KS8695_IRQ_UART_TX, port); free_irq(KS8695_IRQ_UART_MODEM_STATUS, port); free_irq(KS8695_IRQ_UART_LINE_STATUS, port); UART_PUT_LCR(port, UART_GET_LCR(port) & ~URLC_URSBC); UART_PUT_FCR(port, UART_GET_FCR(port) & ~URFC_URFE); }
static void ks8695uart_break_ctl(struct uart_port *port, int break_state) { unsigned int lcr; lcr = UART_GET_LCR(port); if (break_state == -1) lcr |= URLC_URSBC; else lcr &= ~URLC_URSBC; UART_PUT_LCR(port, lcr); }
static void ks8695uart_shutdown(struct uart_port *port) { /* * Free the interrupt */ free_irq(KS8695_IRQ_UART_RX, port); free_irq(KS8695_IRQ_UART_TX, port); free_irq(KS8695_IRQ_UART_MODEM_STATUS, port); free_irq(KS8695_IRQ_UART_LINE_STATUS, port); /* disable break condition and fifos */ UART_PUT_LCR(port, UART_GET_LCR(port) & ~URLC_URSBC); UART_PUT_FCR(port, UART_GET_FCR(port) & ~URFC_URFE); }
static void ambauart_shutdown(struct uart_port *port) { #if DEBUG printk("ambauart_shutdown\n"); #endif /* * disable all interrupts, disable the port */ UART_PUT_IER(port, UART_GET_IER(port) & 0xFFFFF0FF); /* disable break condition and fifos */ UART_PUT_LCR(port, UART_GET_LCR(port) & ~KS8695_UART_LINEC_BRK); UART_PUT_FCR(port, UART_GET_FCR(port) & ~KS8695_UART_FIFO_FEN); free_irq(KS8695_INT_UART_RX, port); free_irq(KS8695_INT_UART_TX, port); free_irq(KS8695_INT_UART_MODEMS, port); free_irq(KS8695_INT_UART_LINE_ERR, port); }
/* * If the port was already initialised (eg, by a boot loader), * try to determine the current setup. */ static void __init bfin_serial_console_get_options(struct bfin_serial_port *uart, int *baud, int *parity, int *bits) { unsigned short status; status = UART_GET_IER(uart) & (ERBFI | ETBEI); if (status == (ERBFI | ETBEI)) { /* ok, the port was enabled */ u16 lcr, dlh, dll; lcr = UART_GET_LCR(uart); *parity = 'n'; if (lcr & PEN) { if (lcr & EPS) *parity = 'e'; else *parity = 'o'; } switch (lcr & 0x03) { case 0: *bits = 5; break; case 1: *bits = 6; break; case 2: *bits = 7; break; case 3: *bits = 8; break; } /* Set DLAB in LCR to Access DLL and DLH */ UART_SET_DLAB(uart); dll = UART_GET_DLL(uart); dlh = UART_GET_DLH(uart); /* Clear DLAB in LCR to Access THR RBR IER */ UART_CLEAR_DLAB(uart); *baud = get_sclk() / (16*(dll | dlh << 8)); } pr_debug("%s:baud = %d, parity = %c, bits= %d\n", __func__, *baud, *parity, *bits); }
static void ssauart_change_speed (struct uart_port *port, u_int cflag, u_int iflag, u_int quot) { u_int lcr_h; unsigned long flags; #if DEBUG printk("ssauart_set_cflag(0x%x) called\n", cflag); #endif /* byte size and parity */ switch (cflag & CSIZE) { case CS5: lcr_h = UART_LCR_WLEN5; break; case CS6: lcr_h = UART_LCR_WLEN6; break; case CS7: lcr_h = UART_LCR_WLEN7; break; default: lcr_h = UART_LCR_WLEN8; break; // CS8 } if (cflag & CSTOPB) lcr_h |= UART_LCR_STOP; if (cflag & PARENB) { lcr_h |= UART_LCR_PARITY; } local_irq_save(flags); port->read_status_mask = UART_LSR_OE | UART_LSR_THRE | UART_LSR_DR; if (iflag & INPCK) port->read_status_mask |= UART_LSR_FE | UART_LSR_PE; if (iflag & (BRKINT | PARMRK)) port->read_status_mask |= UART_LSR_BI; /* * Characters to ignore */ port->ignore_status_mask = 0; if (iflag & IGNPAR) port->ignore_status_mask |= UART_LSR_PE | UART_LSR_FE; if (iflag & IGNBRK) { port->ignore_status_mask |= UART_LSR_BI; /* * If we're ignore parity and break indicators, ignore * overruns too. (For real raw support). */ if (iflag & IGNPAR) port->ignore_status_mask |= UART_LSR_OE; } /* * !!! ignore all characters if CREAD is not set */ if ((cflag & CREAD) == 0) port->ignore_status_mask |= UART_LSR_DR; /* Turn on DLAB */ UART_PUT_LCR(port, UART_GET_LCR(port) | UART_LCR_DLAB); /* Set baud rate */ UART_PUT_DLM(port, ((quot & 0xff00) >> 8)); UART_PUT_DLL(port, (quot & 0xff)); /* Turn off DLAB */ UART_PUT_LCR(port, UART_GET_LCR(port) & ~UART_LCR_DLAB); local_irq_restore(flags); }