Lines Matching full:up
108 #define ZS_IS_KEYB(UP) ((UP)->flags & SUNZILOG_FLAG_CONS_KEYB) argument
109 #define ZS_IS_MOUSE(UP) ((UP)->flags & SUNZILOG_FLAG_CONS_MOUSE) argument
110 #define ZS_IS_CONS(UP) ((UP)->flags & SUNZILOG_FLAG_IS_CONS) argument
111 #define ZS_IS_KGDB(UP) ((UP)->flags & SUNZILOG_FLAG_IS_KGDB) argument
112 #define ZS_WANTS_MODEM_STATUS(UP) ((UP)->flags & SUNZILOG_FLAG_MODEM_STATUS) argument
113 #define ZS_IS_CHANNEL_A(UP) ((UP)->flags & SUNZILOG_FLAG_IS_CHANNEL_A) argument
114 #define ZS_REGS_HELD(UP) ((UP)->flags & SUNZILOG_FLAG_REGS_HELD) argument
115 #define ZS_TX_STOPPED(UP) ((UP)->flags & SUNZILOG_FLAG_TX_STOPPED) argument
116 #define ZS_TX_ACTIVE(UP) ((UP)->flags & SUNZILOG_FLAG_TX_ACTIVE) argument
268 static void sunzilog_maybe_update_regs(struct uart_sunzilog_port *up, in sunzilog_maybe_update_regs() argument
271 if (!ZS_REGS_HELD(up)) { in sunzilog_maybe_update_regs()
272 if (ZS_TX_ACTIVE(up)) { in sunzilog_maybe_update_regs()
273 up->flags |= SUNZILOG_FLAG_REGS_HELD; in sunzilog_maybe_update_regs()
275 __load_zsregs(channel, up->curregs); in sunzilog_maybe_update_regs()
280 static void sunzilog_change_mouse_baud(struct uart_sunzilog_port *up) in sunzilog_change_mouse_baud() argument
282 unsigned int cur_cflag = up->cflag; in sunzilog_change_mouse_baud()
285 up->cflag &= ~CBAUD; in sunzilog_change_mouse_baud()
286 up->cflag |= suncore_mouse_baud_cflag_next(cur_cflag, &new_baud); in sunzilog_change_mouse_baud()
289 up->curregs[R12] = (brg & 0xff); in sunzilog_change_mouse_baud()
290 up->curregs[R13] = (brg >> 8) & 0xff; in sunzilog_change_mouse_baud()
291 sunzilog_maybe_update_regs(up, ZILOG_CHANNEL_FROM_PORT(&up->port)); in sunzilog_change_mouse_baud()
294 static void sunzilog_kbdms_receive_chars(struct uart_sunzilog_port *up, in sunzilog_kbdms_receive_chars() argument
297 if (ZS_IS_KEYB(up)) { in sunzilog_kbdms_receive_chars()
300 if (up->serio_open) in sunzilog_kbdms_receive_chars()
301 serio_interrupt(&up->serio, ch, 0); in sunzilog_kbdms_receive_chars()
303 } else if (ZS_IS_MOUSE(up)) { in sunzilog_kbdms_receive_chars()
308 sunzilog_change_mouse_baud(up); in sunzilog_kbdms_receive_chars()
315 if (up->serio_open) in sunzilog_kbdms_receive_chars()
316 serio_interrupt(&up->serio, ch, 0); in sunzilog_kbdms_receive_chars()
324 sunzilog_receive_chars(struct uart_sunzilog_port *up, in sunzilog_receive_chars() argument
330 if (up->port.state != NULL) /* Unopened serial console */ in sunzilog_receive_chars()
331 port = &up->port.state->port; in sunzilog_receive_chars()
357 ch &= up->parity_mask; in sunzilog_receive_chars()
359 if (unlikely(ZS_IS_KEYB(up)) || unlikely(ZS_IS_MOUSE(up))) { in sunzilog_receive_chars()
360 sunzilog_kbdms_receive_chars(up, ch, 0); in sunzilog_receive_chars()
366 up->port.icount.rx++; in sunzilog_receive_chars()
370 up->port.icount.brk++; in sunzilog_receive_chars()
371 if (uart_handle_break(&up->port)) in sunzilog_receive_chars()
375 up->port.icount.parity++; in sunzilog_receive_chars()
377 up->port.icount.frame++; in sunzilog_receive_chars()
379 up->port.icount.overrun++; in sunzilog_receive_chars()
380 r1 &= up->port.read_status_mask; in sunzilog_receive_chars()
388 if (uart_handle_sysrq_char(&up->port, ch) || !port) in sunzilog_receive_chars()
391 if (up->port.ignore_status_mask == 0xff || in sunzilog_receive_chars()
392 (r1 & up->port.ignore_status_mask) == 0) { in sunzilog_receive_chars()
402 static void sunzilog_status_handle(struct uart_sunzilog_port *up, in sunzilog_status_handle() argument
415 if (ZS_IS_MOUSE(up)) in sunzilog_status_handle()
416 sunzilog_kbdms_receive_chars(up, 0, 1); in sunzilog_status_handle()
417 if (ZS_IS_CONS(up)) { in sunzilog_status_handle()
432 if (ZS_WANTS_MODEM_STATUS(up)) { in sunzilog_status_handle()
434 up->port.icount.dsr++; in sunzilog_status_handle()
440 if ((status ^ up->prev_status) ^ DCD) in sunzilog_status_handle()
441 uart_handle_dcd_change(&up->port, in sunzilog_status_handle()
443 if ((status ^ up->prev_status) ^ CTS) in sunzilog_status_handle()
444 uart_handle_cts_change(&up->port, in sunzilog_status_handle()
447 wake_up_interruptible(&up->port.state->port.delta_msr_wait); in sunzilog_status_handle()
450 up->prev_status = status; in sunzilog_status_handle()
453 static void sunzilog_transmit_chars(struct uart_sunzilog_port *up, in sunzilog_transmit_chars() argument
459 if (ZS_IS_CONS(up)) { in sunzilog_transmit_chars()
475 up->flags &= ~SUNZILOG_FLAG_TX_ACTIVE; in sunzilog_transmit_chars()
477 if (ZS_REGS_HELD(up)) { in sunzilog_transmit_chars()
478 __load_zsregs(channel, up->curregs); in sunzilog_transmit_chars()
479 up->flags &= ~SUNZILOG_FLAG_REGS_HELD; in sunzilog_transmit_chars()
482 if (ZS_TX_STOPPED(up)) { in sunzilog_transmit_chars()
483 up->flags &= ~SUNZILOG_FLAG_TX_STOPPED; in sunzilog_transmit_chars()
487 if (up->port.x_char) { in sunzilog_transmit_chars()
488 up->flags |= SUNZILOG_FLAG_TX_ACTIVE; in sunzilog_transmit_chars()
489 writeb(up->port.x_char, &channel->data); in sunzilog_transmit_chars()
493 up->port.icount.tx++; in sunzilog_transmit_chars()
494 up->port.x_char = 0; in sunzilog_transmit_chars()
498 if (up->port.state == NULL) in sunzilog_transmit_chars()
500 tport = &up->port.state->port; in sunzilog_transmit_chars()
502 if (uart_tx_stopped(&up->port)) in sunzilog_transmit_chars()
505 if (!uart_fifo_get(&up->port, &ch)) in sunzilog_transmit_chars()
508 up->flags |= SUNZILOG_FLAG_TX_ACTIVE; in sunzilog_transmit_chars()
514 uart_write_wakeup(&up->port); in sunzilog_transmit_chars()
526 struct uart_sunzilog_port *up = dev_id; in sunzilog_interrupt() local
528 while (up) { in sunzilog_interrupt()
530 = ZILOG_CHANNEL_FROM_PORT(&up->port); in sunzilog_interrupt()
534 uart_port_lock(&up->port); in sunzilog_interrupt()
545 port = sunzilog_receive_chars(up, channel); in sunzilog_interrupt()
547 sunzilog_status_handle(up, channel); in sunzilog_interrupt()
549 sunzilog_transmit_chars(up, channel); in sunzilog_interrupt()
551 uart_port_unlock(&up->port); in sunzilog_interrupt()
557 up = up->next; in sunzilog_interrupt()
558 channel = ZILOG_CHANNEL_FROM_PORT(&up->port); in sunzilog_interrupt()
560 uart_port_lock(&up->port); in sunzilog_interrupt()
568 port = sunzilog_receive_chars(up, channel); in sunzilog_interrupt()
570 sunzilog_status_handle(up, channel); in sunzilog_interrupt()
572 sunzilog_transmit_chars(up, channel); in sunzilog_interrupt()
574 uart_port_unlock(&up->port); in sunzilog_interrupt()
579 up = up->next; in sunzilog_interrupt()
643 struct uart_sunzilog_port *up = in sunzilog_set_mctrl() local
660 up->curregs[R5] |= set_bits; in sunzilog_set_mctrl()
661 up->curregs[R5] &= ~clear_bits; in sunzilog_set_mctrl()
662 write_zsreg(channel, R5, up->curregs[R5]); in sunzilog_set_mctrl()
668 struct uart_sunzilog_port *up = in sunzilog_stop_tx() local
671 up->flags |= SUNZILOG_FLAG_TX_STOPPED; in sunzilog_stop_tx()
677 struct uart_sunzilog_port *up = in sunzilog_start_tx() local
682 up->flags |= SUNZILOG_FLAG_TX_ACTIVE; in sunzilog_start_tx()
683 up->flags &= ~SUNZILOG_FLAG_TX_STOPPED; in sunzilog_start_tx()
706 if (!uart_fifo_get(&up->port, &ch)) in sunzilog_start_tx()
713 uart_write_wakeup(&up->port); in sunzilog_start_tx()
720 struct uart_sunzilog_port *up = UART_ZILOG(port); in sunzilog_stop_rx() local
723 if (ZS_IS_CONS(up)) in sunzilog_stop_rx()
729 up->curregs[R1] &= ~RxINT_MASK; in sunzilog_stop_rx()
730 sunzilog_maybe_update_regs(up, channel); in sunzilog_stop_rx()
736 struct uart_sunzilog_port *up = in sunzilog_enable_ms() local
741 new_reg = up->curregs[R15] | (DCDIE | SYNCIE | CTSIE); in sunzilog_enable_ms()
742 if (new_reg != up->curregs[R15]) { in sunzilog_enable_ms()
743 up->curregs[R15] = new_reg; in sunzilog_enable_ms()
746 write_zsreg(channel, R15, up->curregs[R15] & ~WR7pEN); in sunzilog_enable_ms()
753 struct uart_sunzilog_port *up = in sunzilog_break_ctl() local
768 new_reg = (up->curregs[R5] | set_bits) & ~clear_bits; in sunzilog_break_ctl()
769 if (new_reg != up->curregs[R5]) { in sunzilog_break_ctl()
770 up->curregs[R5] = new_reg; in sunzilog_break_ctl()
773 write_zsreg(channel, R5, up->curregs[R5]); in sunzilog_break_ctl()
779 static void __sunzilog_startup(struct uart_sunzilog_port *up) in __sunzilog_startup() argument
783 channel = ZILOG_CHANNEL_FROM_PORT(&up->port); in __sunzilog_startup()
784 up->prev_status = readb(&channel->control); in __sunzilog_startup()
787 up->curregs[R3] |= RxENAB; in __sunzilog_startup()
788 up->curregs[R5] |= TxENAB; in __sunzilog_startup()
790 up->curregs[R1] |= EXT_INT_ENAB | INT_ALL_Rx | TxINT_ENAB; in __sunzilog_startup()
791 sunzilog_maybe_update_regs(up, channel); in __sunzilog_startup()
796 struct uart_sunzilog_port *up = UART_ZILOG(port); in sunzilog_startup() local
799 if (ZS_IS_CONS(up)) in sunzilog_startup()
803 __sunzilog_startup(up); in sunzilog_startup()
835 struct uart_sunzilog_port *up = UART_ZILOG(port); in sunzilog_shutdown() local
839 if (ZS_IS_CONS(up)) in sunzilog_shutdown()
847 up->curregs[R3] &= ~RxENAB; in sunzilog_shutdown()
848 up->curregs[R5] &= ~TxENAB; in sunzilog_shutdown()
851 up->curregs[R1] &= ~(EXT_INT_ENAB | TxINT_ENAB | RxINT_MASK); in sunzilog_shutdown()
852 up->curregs[R5] &= ~SND_BRK; in sunzilog_shutdown()
853 sunzilog_maybe_update_regs(up, channel); in sunzilog_shutdown()
862 sunzilog_convert_to_zs(struct uart_sunzilog_port *up, unsigned int cflag, in sunzilog_convert_to_zs() argument
866 up->curregs[R10] = NRZ; in sunzilog_convert_to_zs()
867 up->curregs[R11] = TCBR | RCBR; in sunzilog_convert_to_zs()
870 up->curregs[R4] &= ~XCLK_MASK; in sunzilog_convert_to_zs()
871 up->curregs[R4] |= X16CLK; in sunzilog_convert_to_zs()
872 up->curregs[R12] = brg & 0xff; in sunzilog_convert_to_zs()
873 up->curregs[R13] = (brg >> 8) & 0xff; in sunzilog_convert_to_zs()
874 up->curregs[R14] = BRSRC | BRENAB; in sunzilog_convert_to_zs()
877 up->curregs[R3] &= ~RxN_MASK; in sunzilog_convert_to_zs()
878 up->curregs[R5] &= ~TxN_MASK; in sunzilog_convert_to_zs()
881 up->curregs[R3] |= Rx5; in sunzilog_convert_to_zs()
882 up->curregs[R5] |= Tx5; in sunzilog_convert_to_zs()
883 up->parity_mask = 0x1f; in sunzilog_convert_to_zs()
886 up->curregs[R3] |= Rx6; in sunzilog_convert_to_zs()
887 up->curregs[R5] |= Tx6; in sunzilog_convert_to_zs()
888 up->parity_mask = 0x3f; in sunzilog_convert_to_zs()
891 up->curregs[R3] |= Rx7; in sunzilog_convert_to_zs()
892 up->curregs[R5] |= Tx7; in sunzilog_convert_to_zs()
893 up->parity_mask = 0x7f; in sunzilog_convert_to_zs()
897 up->curregs[R3] |= Rx8; in sunzilog_convert_to_zs()
898 up->curregs[R5] |= Tx8; in sunzilog_convert_to_zs()
899 up->parity_mask = 0xff; in sunzilog_convert_to_zs()
902 up->curregs[R4] &= ~0x0c; in sunzilog_convert_to_zs()
904 up->curregs[R4] |= SB2; in sunzilog_convert_to_zs()
906 up->curregs[R4] |= SB1; in sunzilog_convert_to_zs()
908 up->curregs[R4] |= PAR_ENAB; in sunzilog_convert_to_zs()
910 up->curregs[R4] &= ~PAR_ENAB; in sunzilog_convert_to_zs()
912 up->curregs[R4] |= PAR_EVEN; in sunzilog_convert_to_zs()
914 up->curregs[R4] &= ~PAR_EVEN; in sunzilog_convert_to_zs()
916 up->port.read_status_mask = Rx_OVR; in sunzilog_convert_to_zs()
918 up->port.read_status_mask |= CRC_ERR | PAR_ERR; in sunzilog_convert_to_zs()
920 up->port.read_status_mask |= BRK_ABRT; in sunzilog_convert_to_zs()
922 up->port.ignore_status_mask = 0; in sunzilog_convert_to_zs()
924 up->port.ignore_status_mask |= CRC_ERR | PAR_ERR; in sunzilog_convert_to_zs()
926 up->port.ignore_status_mask |= BRK_ABRT; in sunzilog_convert_to_zs()
928 up->port.ignore_status_mask |= Rx_OVR; in sunzilog_convert_to_zs()
932 up->port.ignore_status_mask = 0xff; in sunzilog_convert_to_zs()
940 struct uart_sunzilog_port *up = in sunzilog_set_termios() local
947 uart_port_lock_irqsave(&up->port, &flags); in sunzilog_set_termios()
951 sunzilog_convert_to_zs(up, termios->c_cflag, termios->c_iflag, brg); in sunzilog_set_termios()
953 if (UART_ENABLE_MS(&up->port, termios->c_cflag)) in sunzilog_set_termios()
954 up->flags |= SUNZILOG_FLAG_MODEM_STATUS; in sunzilog_set_termios()
956 up->flags &= ~SUNZILOG_FLAG_MODEM_STATUS; in sunzilog_set_termios()
958 up->cflag = termios->c_cflag; in sunzilog_set_termios()
960 sunzilog_maybe_update_regs(up, ZILOG_CHANNEL_FROM_PORT(port)); in sunzilog_set_termios()
964 uart_port_unlock_irqrestore(&up->port, flags); in sunzilog_set_termios()
969 struct uart_sunzilog_port *up = UART_ZILOG(port); in sunzilog_type() local
971 return (up->flags & SUNZILOG_FLAG_ESCC) ? "zs (ESCC)" : "zs"; in sunzilog_type()
1001 struct uart_sunzilog_port *up = in sunzilog_get_poll_char() local
1004 = ZILOG_CHANNEL_FROM_PORT(&up->port); in sunzilog_get_poll_char()
1029 ch &= up->parity_mask; in sunzilog_get_poll_char()
1036 struct uart_sunzilog_port *up = in sunzilog_put_poll_char() local
1039 sunzilog_putchar(&up->port, ch); in sunzilog_put_poll_char()
1081 struct uart_sunzilog_port *up; in sunzilog_alloc_tables() local
1092 up = &sunzilog_port_table[i]; in sunzilog_alloc_tables()
1094 spin_lock_init(&up->port.lock); in sunzilog_alloc_tables()
1097 sunzilog_irq_chain = up; in sunzilog_alloc_tables()
1100 up->next = up + 1; in sunzilog_alloc_tables()
1102 up->next = NULL; in sunzilog_alloc_tables()
1153 struct uart_sunzilog_port *up = serio->port_data; in sunzilog_serio_write() local
1158 sunzilog_putchar(&up->port, ch); in sunzilog_serio_write()
1167 struct uart_sunzilog_port *up = serio->port_data; in sunzilog_serio_open() local
1172 if (!up->serio_open) { in sunzilog_serio_open()
1173 up->serio_open = 1; in sunzilog_serio_open()
1184 struct uart_sunzilog_port *up = serio->port_data; in sunzilog_serio_close() local
1188 up->serio_open = 0; in sunzilog_serio_close()
1198 struct uart_sunzilog_port *up = &sunzilog_port_table[con->index]; in sunzilog_console_write() local
1202 if (up->port.sysrq || oops_in_progress) in sunzilog_console_write()
1203 locked = uart_port_trylock_irqsave(&up->port, &flags); in sunzilog_console_write()
1205 uart_port_lock_irqsave(&up->port, &flags); in sunzilog_console_write()
1207 uart_console_write(&up->port, s, count, sunzilog_putchar); in sunzilog_console_write()
1211 uart_port_unlock_irqrestore(&up->port, flags); in sunzilog_console_write()
1216 struct uart_sunzilog_port *up = &sunzilog_port_table[con->index]; in sunzilog_console_setup() local
1220 if (up->port.type != PORT_SUNZILOG) in sunzilog_console_setup()
1227 sunserial_console_termios(con, up->port.dev->of_node); in sunzilog_console_setup()
1246 uart_port_lock_irqsave(&up->port, &flags); in sunzilog_console_setup()
1248 up->curregs[R15] |= BRKIE; in sunzilog_console_setup()
1249 sunzilog_convert_to_zs(up, con->cflag, 0, brg); in sunzilog_console_setup()
1251 sunzilog_set_mctrl(&up->port, TIOCM_DTR | TIOCM_RTS); in sunzilog_console_setup()
1252 __sunzilog_startup(up); in sunzilog_console_setup()
1254 uart_port_unlock_irqrestore(&up->port, flags); in sunzilog_console_setup()
1278 static void sunzilog_init_kbdms(struct uart_sunzilog_port *up) in sunzilog_init_kbdms() argument
1282 if (up->flags & SUNZILOG_FLAG_CONS_KEYB) { in sunzilog_init_kbdms()
1283 up->cflag = B1200 | CS8 | CLOCAL | CREAD; in sunzilog_init_kbdms()
1286 up->cflag = B4800 | CS8 | CLOCAL | CREAD; in sunzilog_init_kbdms()
1290 up->curregs[R15] |= BRKIE; in sunzilog_init_kbdms()
1292 sunzilog_convert_to_zs(up, up->cflag, 0, brg); in sunzilog_init_kbdms()
1293 sunzilog_set_mctrl(&up->port, TIOCM_DTR | TIOCM_RTS); in sunzilog_init_kbdms()
1294 __sunzilog_startup(up); in sunzilog_init_kbdms()
1298 static void sunzilog_register_serio(struct uart_sunzilog_port *up) in sunzilog_register_serio() argument
1300 struct serio *serio = &up->serio; in sunzilog_register_serio()
1302 serio->port_data = up; in sunzilog_register_serio()
1305 if (up->flags & SUNZILOG_FLAG_CONS_KEYB) { in sunzilog_register_serio()
1314 ((up->flags & SUNZILOG_FLAG_CONS_KEYB) ? in sunzilog_register_serio()
1321 serio->dev.parent = up->port.dev; in sunzilog_register_serio()
1327 static void sunzilog_init_hw(struct uart_sunzilog_port *up) in sunzilog_init_hw() argument
1333 channel = ZILOG_CHANNEL_FROM_PORT(&up->port); in sunzilog_init_hw()
1335 uart_port_lock_irqsave(&up->port, &flags); in sunzilog_init_hw()
1336 if (ZS_IS_CHANNEL_A(up)) { in sunzilog_init_hw()
1342 if (up->flags & (SUNZILOG_FLAG_CONS_KEYB | in sunzilog_init_hw()
1344 up->curregs[R1] = EXT_INT_ENAB | INT_ALL_Rx | TxINT_ENAB; in sunzilog_init_hw()
1345 up->curregs[R4] = PAR_EVEN | X16CLK | SB1; in sunzilog_init_hw()
1346 up->curregs[R3] = RxENAB | Rx8; in sunzilog_init_hw()
1347 up->curregs[R5] = TxENAB | Tx8; in sunzilog_init_hw()
1348 up->curregs[R6] = 0x00; /* SDLC Address */ in sunzilog_init_hw()
1349 up->curregs[R7] = 0x7E; /* SDLC Flag */ in sunzilog_init_hw()
1350 up->curregs[R9] = NV; in sunzilog_init_hw()
1351 up->curregs[R7p] = 0x00; in sunzilog_init_hw()
1352 sunzilog_init_kbdms(up); in sunzilog_init_hw()
1354 if (up->flags & SUNZILOG_FLAG_ISR_HANDLER) in sunzilog_init_hw()
1355 up->curregs[R9] |= MIE; in sunzilog_init_hw()
1356 write_zsreg(channel, R9, up->curregs[R9]); in sunzilog_init_hw()
1359 up->parity_mask = 0xff; in sunzilog_init_hw()
1360 up->curregs[R1] = EXT_INT_ENAB | INT_ALL_Rx | TxINT_ENAB; in sunzilog_init_hw()
1361 up->curregs[R4] = PAR_EVEN | X16CLK | SB1; in sunzilog_init_hw()
1362 up->curregs[R3] = RxENAB | Rx8; in sunzilog_init_hw()
1363 up->curregs[R5] = TxENAB | Tx8; in sunzilog_init_hw()
1364 up->curregs[R6] = 0x00; /* SDLC Address */ in sunzilog_init_hw()
1365 up->curregs[R7] = 0x7E; /* SDLC Flag */ in sunzilog_init_hw()
1366 up->curregs[R9] = NV; in sunzilog_init_hw()
1367 up->curregs[R10] = NRZ; in sunzilog_init_hw()
1368 up->curregs[R11] = TCBR | RCBR; in sunzilog_init_hw()
1371 up->curregs[R12] = (brg & 0xff); in sunzilog_init_hw()
1372 up->curregs[R13] = (brg >> 8) & 0xff; in sunzilog_init_hw()
1373 up->curregs[R14] = BRSRC | BRENAB; in sunzilog_init_hw()
1374 up->curregs[R15] = FIFOEN; /* Use FIFO if on ESCC */ in sunzilog_init_hw()
1375 up->curregs[R7p] = TxFIFO_LVL | RxFIFO_LVL; in sunzilog_init_hw()
1376 if (__load_zsregs(channel, up->curregs)) { in sunzilog_init_hw()
1377 up->flags |= SUNZILOG_FLAG_ESCC; in sunzilog_init_hw()
1380 if (up->flags & SUNZILOG_FLAG_ISR_HANDLER) in sunzilog_init_hw()
1381 up->curregs[R9] |= MIE; in sunzilog_init_hw()
1382 write_zsreg(channel, R9, up->curregs[R9]); in sunzilog_init_hw()
1385 uart_port_unlock_irqrestore(&up->port, flags); in sunzilog_init_hw()
1388 if (up->flags & (SUNZILOG_FLAG_CONS_KEYB | in sunzilog_init_hw()
1390 sunzilog_register_serio(up); in sunzilog_init_hw()
1400 struct uart_sunzilog_port *up; in zs_probe() local
1425 up = &sunzilog_port_table[inst * 2]; in zs_probe()
1428 up[0].port.mapbase = op->resource[0].start + 0x00; in zs_probe()
1429 up[0].port.membase = (void __iomem *) &rp->channelA; in zs_probe()
1430 up[0].port.iotype = UPIO_MEM; in zs_probe()
1431 up[0].port.irq = op->archdata.irqs[0]; in zs_probe()
1432 up[0].port.uartclk = ZS_CLOCK; in zs_probe()
1433 up[0].port.fifosize = 1; in zs_probe()
1434 up[0].port.ops = &sunzilog_pops; in zs_probe()
1435 up[0].port.type = PORT_SUNZILOG; in zs_probe()
1436 up[0].port.flags = 0; in zs_probe()
1437 up[0].port.line = (inst * 2) + 0; in zs_probe()
1438 up[0].port.dev = &op->dev; in zs_probe()
1439 up[0].flags |= SUNZILOG_FLAG_IS_CHANNEL_A; in zs_probe()
1440 up[0].port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_SUNZILOG_CONSOLE); in zs_probe()
1442 up[0].flags |= SUNZILOG_FLAG_CONS_KEYB; in zs_probe()
1443 sunzilog_init_hw(&up[0]); in zs_probe()
1446 up[1].port.mapbase = op->resource[0].start + 0x04; in zs_probe()
1447 up[1].port.membase = (void __iomem *) &rp->channelB; in zs_probe()
1448 up[1].port.iotype = UPIO_MEM; in zs_probe()
1449 up[1].port.irq = op->archdata.irqs[0]; in zs_probe()
1450 up[1].port.uartclk = ZS_CLOCK; in zs_probe()
1451 up[1].port.fifosize = 1; in zs_probe()
1452 up[1].port.ops = &sunzilog_pops; in zs_probe()
1453 up[1].port.type = PORT_SUNZILOG; in zs_probe()
1454 up[1].port.flags = 0; in zs_probe()
1455 up[1].port.line = (inst * 2) + 1; in zs_probe()
1456 up[1].port.dev = &op->dev; in zs_probe()
1457 up[1].flags |= 0; in zs_probe()
1458 up[1].port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_SUNZILOG_CONSOLE); in zs_probe()
1460 up[1].flags |= SUNZILOG_FLAG_CONS_MOUSE; in zs_probe()
1461 sunzilog_init_hw(&up[1]); in zs_probe()
1465 &sunzilog_reg, up[0].port.line, in zs_probe()
1467 up->flags |= SUNZILOG_FLAG_IS_CONS; in zs_probe()
1468 err = uart_add_one_port(&sunzilog_reg, &up[0].port); in zs_probe()
1475 &sunzilog_reg, up[1].port.line, in zs_probe()
1477 up->flags |= SUNZILOG_FLAG_IS_CONS; in zs_probe()
1478 err = uart_add_one_port(&sunzilog_reg, &up[1].port); in zs_probe()
1480 uart_remove_one_port(&sunzilog_reg, &up[0].port); in zs_probe()
1490 (unsigned long long) up[0].port.mapbase, in zs_probe()
1491 op->archdata.irqs[0], sunzilog_type(&up[0].port)); in zs_probe()
1495 (unsigned long long) up[1].port.mapbase, in zs_probe()
1496 op->archdata.irqs[0], sunzilog_type(&up[1].port)); in zs_probe()
1500 platform_set_drvdata(op, &up[0]); in zs_probe()
1505 static void zs_remove_one(struct uart_sunzilog_port *up) in zs_remove_one() argument
1507 if (ZS_IS_KEYB(up) || ZS_IS_MOUSE(up)) { in zs_remove_one()
1509 serio_unregister_port(&up->serio); in zs_remove_one()
1512 uart_remove_one_port(&sunzilog_reg, &up->port); in zs_remove_one()
1517 struct uart_sunzilog_port *up = platform_get_drvdata(op); in zs_remove() local
1520 zs_remove_one(&up[0]); in zs_remove()
1521 zs_remove_one(&up[1]); in zs_remove()
1523 regs = sunzilog_chip_regs[up[0].port.line / 2]; in zs_remove()
1575 struct uart_sunzilog_port *up = sunzilog_irq_chain; in sunzilog_init() local
1582 while (up) { in sunzilog_init()
1585 /* printk (KERN_INFO "Enable IRQ for ZILOG Hardware %p\n", up); */ in sunzilog_init()
1586 channel = ZILOG_CHANNEL_FROM_PORT(&up->port); in sunzilog_init()
1587 up->flags |= SUNZILOG_FLAG_ISR_HANDLER; in sunzilog_init()
1588 up->curregs[R9] |= MIE; in sunzilog_init()
1589 write_zsreg(channel, R9, up->curregs[R9]); in sunzilog_init()
1590 up = up->next; in sunzilog_init()
1616 struct uart_sunzilog_port *up = sunzilog_irq_chain; in sunzilog_exit() local
1619 while (up) { in sunzilog_exit()
1622 /* printk (KERN_INFO "Disable IRQ for ZILOG Hardware %p\n", up); */ in sunzilog_exit()
1623 channel = ZILOG_CHANNEL_FROM_PORT(&up->port); in sunzilog_exit()
1624 up->flags &= ~SUNZILOG_FLAG_ISR_HANDLER; in sunzilog_exit()
1625 up->curregs[R9] &= ~MIE; in sunzilog_exit()
1626 write_zsreg(channel, R9, up->curregs[R9]); in sunzilog_exit()
1627 up = up->next; in sunzilog_exit()