Lines Matching +full:irda +full:- +full:mode +full:- +full:ports
1 // SPDX-License-Identifier: GPL-2.0+
17 * 2004-08-06 Harald Welte <laforge@gnumonks.org>
18 * - Enable BREAK interrupt
19 * - Add support for sysreq
21 * TODO: - Add DMA support
22 * - Defer port shutdown to a few seconds after close
23 * - maybe put something right into uap->clk_divisor
67 MODULE_DESCRIPTION("Driver for the Mac and PowerMac serial ports.");
80 #define pmz_debug(fmt, arg...) pr_debug("ttyPZ%d: " fmt, uap->port.line, ## arg)
81 #define pmz_error(fmt, arg...) pr_err("ttyPZ%d: " fmt, uap->port.line, ## arg)
82 #define pmz_info(fmt, arg...) pr_info("ttyPZ%d: " fmt, uap->port.line, ## arg)
85 * For the sake of early serial console, we can do a pre-probe
86 * (optional) of the ports at rather early boot time.
141 /* make sure we use R7 "non-prime" on ESCC */ in pmz_load_zsregs()
144 /* Synchronous mode config. */ in pmz_load_zsregs()
151 /* Clock mode control. */ in pmz_load_zsregs()
188 uap->flags |= PMACZILOG_FLAG_REGS_HELD; in pmz_maybe_update_regs()
191 pmz_load_zsregs(uap, uap->curregs); in pmz_maybe_update_regs()
199 uap->curregs[1] |= INT_ALL_Rx | TxINT_ENAB; in pmz_interrupt_control()
201 uap->curregs[1] |= EXT_INT_ENAB; in pmz_interrupt_control()
203 uap->curregs[1] &= ~(EXT_INT_ENAB | TxINT_ENAB | RxINT_MASK); in pmz_interrupt_control()
205 write_zsreg(uap, R1, uap->curregs[1]); in pmz_interrupt_control()
209 __must_hold(&uap->port.lock) in pmz_receive_chars()
215 if (uap->port.state == NULL) { in pmz_receive_chars()
220 port = &uap->port.state->port; in pmz_receive_chars()
233 ch &= uap->parity_mask; in pmz_receive_chars()
234 if (ch == 0 && uap->flags & PMACZILOG_FLAG_BREAK) { in pmz_receive_chars()
235 uap->flags &= ~PMACZILOG_FLAG_BREAK; in pmz_receive_chars()
242 uap->port.sysrq = jiffies + HZ*5; in pmz_receive_chars()
246 if (uap->port.sysrq) { in pmz_receive_chars()
248 uart_port_unlock(&uap->port); in pmz_receive_chars()
249 swallow = uart_handle_sysrq_char(&uap->port, ch); in pmz_receive_chars()
250 uart_port_lock(&uap->port); in pmz_receive_chars()
261 uap->port.icount.rx++; in pmz_receive_chars()
267 uap->port.icount.brk++; in pmz_receive_chars()
268 if (uart_handle_break(&uap->port)) in pmz_receive_chars()
272 uap->port.icount.parity++; in pmz_receive_chars()
274 uap->port.icount.frame++; in pmz_receive_chars()
276 uap->port.icount.overrun++; in pmz_receive_chars()
277 r1 &= uap->port.read_status_mask; in pmz_receive_chars()
286 if (uap->port.ignore_status_mask == 0xff || in pmz_receive_chars()
287 (r1 & uap->port.ignore_status_mask) == 0) { in pmz_receive_chars()
311 uap->port.icount.dsr++; in pmz_status_handle()
316 * The CTS input is inverted for some reason. -- paulus in pmz_status_handle()
318 if ((status ^ uap->prev_status) & DCD) in pmz_status_handle()
319 uart_handle_dcd_change(&uap->port, in pmz_status_handle()
321 if ((status ^ uap->prev_status) & CTS) in pmz_status_handle()
322 uart_handle_cts_change(&uap->port, in pmz_status_handle()
325 wake_up_interruptible(&uap->port.state->port.delta_msr_wait); in pmz_status_handle()
329 uap->flags |= PMACZILOG_FLAG_BREAK; in pmz_status_handle()
331 uap->prev_status = status; in pmz_status_handle()
348 * to poll on enough port->xmit space becoming free. -DaveM in pmz_transmit_chars()
354 uap->flags &= ~PMACZILOG_FLAG_TX_ACTIVE; in pmz_transmit_chars()
357 pmz_load_zsregs(uap, uap->curregs); in pmz_transmit_chars()
358 uap->flags &= ~PMACZILOG_FLAG_REGS_HELD; in pmz_transmit_chars()
362 uap->flags &= ~PMACZILOG_FLAG_TX_STOPPED; in pmz_transmit_chars()
372 * bits, better safe than sorry). --BenH. in pmz_transmit_chars()
377 if (uap->port.x_char) { in pmz_transmit_chars()
378 uap->flags |= PMACZILOG_FLAG_TX_ACTIVE; in pmz_transmit_chars()
379 write_zsdata(uap, uap->port.x_char); in pmz_transmit_chars()
381 uap->port.icount.tx++; in pmz_transmit_chars()
382 uap->port.x_char = 0; in pmz_transmit_chars()
386 if (uap->port.state == NULL) in pmz_transmit_chars()
388 tport = &uap->port.state->port; in pmz_transmit_chars()
389 if (kfifo_is_empty(&tport->xmit_fifo)) { in pmz_transmit_chars()
390 uart_write_wakeup(&uap->port); in pmz_transmit_chars()
393 if (uart_tx_stopped(&uap->port)) in pmz_transmit_chars()
396 uap->flags |= PMACZILOG_FLAG_TX_ACTIVE; in pmz_transmit_chars()
397 WARN_ON(!uart_fifo_get(&uap->port, &ch)); in pmz_transmit_chars()
401 if (kfifo_len(&tport->xmit_fifo) < WAKEUP_CHARS) in pmz_transmit_chars()
402 uart_write_wakeup(&uap->port); in pmz_transmit_chars()
422 uap_b = uap_a->mate; in pmz_interrupt()
424 uart_port_lock(&uap_a->port); in pmz_interrupt()
445 uart_port_unlock(&uap_a->port); in pmz_interrupt()
447 tty_flip_buffer_push(&uap->port.state->port); in pmz_interrupt()
452 uart_port_lock(&uap_b->port); in pmz_interrupt()
470 uart_port_unlock(&uap_b->port); in pmz_interrupt()
472 tty_flip_buffer_push(&uap->port.state->port); in pmz_interrupt()
486 uart_port_lock_irqsave(&uap->port, &flags); in pmz_peek_status()
488 uart_port_unlock_irqrestore(&uap->port, flags); in pmz_peek_status()
510 * Note: Shall we really filter out RTS on external ports or
518 /* Do nothing for irda for now... */ in pmz_set_mctrl()
539 uap->curregs[R5] |= set_bits; in pmz_set_mctrl()
540 uap->curregs[R5] &= ~clear_bits; in pmz_set_mctrl()
542 write_zsreg(uap, R5, uap->curregs[R5]); in pmz_set_mctrl()
543 pmz_debug("pmz_set_mctrl: set bits: %x, clear bits: %x -> %x\n", in pmz_set_mctrl()
544 set_bits, clear_bits, uap->curregs[R5]); in pmz_set_mctrl()
579 to_pmz(port)->flags |= PMACZILOG_FLAG_TX_STOPPED; in pmz_stop_tx()
591 uap->flags |= PMACZILOG_FLAG_TX_ACTIVE; in pmz_start_tx()
592 uap->flags &= ~PMACZILOG_FLAG_TX_STOPPED; in pmz_start_tx()
600 /* Send the first character to jump-start the TX done in pmz_start_tx()
603 if (port->x_char) { in pmz_start_tx()
604 write_zsdata(uap, port->x_char); in pmz_start_tx()
606 port->icount.tx++; in pmz_start_tx()
607 port->x_char = 0; in pmz_start_tx()
609 struct tty_port *tport = &port->state->port; in pmz_start_tx()
612 if (!uart_fifo_get(&uap->port, &ch)) in pmz_start_tx()
617 if (kfifo_len(&tport->xmit_fifo) < WAKEUP_CHARS) in pmz_start_tx()
618 uart_write_wakeup(&uap->port); in pmz_start_tx()
633 uap->curregs[R1] &= ~RxINT_MASK; in pmz_stop_rx()
648 new_reg = uap->curregs[R15] | (DCDIE | SYNCIE | CTSIE); in pmz_enable_ms()
649 if (new_reg != uap->curregs[R15]) { in pmz_enable_ms()
650 uap->curregs[R15] = new_reg; in pmz_enable_ms()
653 write_zsreg(uap, R15, uap->curregs[R15]); in pmz_enable_ms()
676 new_reg = (uap->curregs[R5] | set_bits) & ~clear_bits; in pmz_break_ctl()
677 if (new_reg != uap->curregs[R5]) { in pmz_break_ctl()
678 uap->curregs[R5] = new_reg; in pmz_break_ctl()
679 write_zsreg(uap, R5, uap->curregs[R5]); in pmz_break_ctl()
700 PMAC_FTR_SCC_ENABLE, uap->node, uap->port_type, 1); in pmz_set_scc_power()
704 PMAC_FTR_MODEM_ENABLE, uap->node, 0, 1); in pmz_set_scc_power()
714 PMAC_FTR_MODEM_ENABLE, uap->node, 0, 0); in pmz_set_scc_power()
717 pmac_call_feature(PMAC_FTR_SCC_ENABLE, uap->node, uap->port_type, 0); in pmz_set_scc_power()
733 * Inspired from Darwin code, 15 Sept. 2000 -DanM
736 * (most versions -- also with some Heathrow and Hydra ASICs) where a zero
745 * The decoding mode is changed among NRZ, NRZI, FM0, or FM1.
748 * the SCC in synchronous loopback mode with a fast clock before programming
775 * Switch to asynchronous mode, disable the receiver, in pmz_fix_zero_bug_scc()
799 memset(&uap->curregs, 0, sizeof(uap->curregs)); in __pmz_startup()
801 /* Power up the SCC & underlying hardware (modem/irda) */ in __pmz_startup()
808 uap->curregs[R9] = 0; in __pmz_startup()
823 uap->curregs[R4] = X16CLK | SB1; in __pmz_startup()
824 uap->curregs[R3] = Rx8; in __pmz_startup()
825 uap->curregs[R5] = Tx8 | RTS; in __pmz_startup()
827 uap->curregs[R5] |= DTR; in __pmz_startup()
828 uap->curregs[R12] = 0; in __pmz_startup()
829 uap->curregs[R13] = 0; in __pmz_startup()
830 uap->curregs[R14] = BRENAB; in __pmz_startup()
833 uap->curregs[R15] = BRKIE; in __pmz_startup()
836 uap->curregs[R9] |= NV | MIE; in __pmz_startup()
838 pmz_load_zsregs(uap, uap->curregs); in __pmz_startup()
841 write_zsreg(uap, R3, uap->curregs[R3] |= RxENABLE); in __pmz_startup()
842 write_zsreg(uap, R5, uap->curregs[R5] |= TxENABLE); in __pmz_startup()
845 uap->prev_status = read_zsreg(uap, R0); in __pmz_startup()
854 uart_port_lock_irqsave(&uap->port, &flags); in pmz_irda_reset()
855 uap->curregs[R5] |= DTR; in pmz_irda_reset()
856 write_zsreg(uap, R5, uap->curregs[R5]); in pmz_irda_reset()
858 uart_port_unlock_irqrestore(&uap->port, flags); in pmz_irda_reset()
861 uart_port_lock_irqsave(&uap->port, &flags); in pmz_irda_reset()
862 uap->curregs[R5] &= ~DTR; in pmz_irda_reset()
863 write_zsreg(uap, R5, uap->curregs[R5]); in pmz_irda_reset()
865 uart_port_unlock_irqrestore(&uap->port, flags); in pmz_irda_reset()
879 uap->flags |= PMACZILOG_FLAG_IS_OPEN; in pmz_startup()
889 sprintf(uap->irq_name, PMACZILOG_NAME"%d", uap->port.line); in pmz_startup()
890 if (request_irq(uap->port.irq, pmz_interrupt, IRQF_SHARED, in pmz_startup()
891 uap->irq_name, uap)) { in pmz_startup()
894 return -ENXIO; in pmz_startup()
905 /* IrDA reset is done now */ in pmz_startup()
929 uap->curregs[R3] &= ~RxENABLE; in pmz_shutdown()
930 uap->curregs[R5] &= ~TxENABLE; in pmz_shutdown()
933 uap->curregs[R5] &= ~SND_BRK; in pmz_shutdown()
940 free_irq(uap->port.irq, uap); in pmz_shutdown()
944 uap->flags &= ~PMACZILOG_FLAG_IS_OPEN; in pmz_shutdown()
960 /* Switch to external clocking for IrDA high clock rates. That in pmz_convert_to_zs()
961 * code could be re-used for Midi interfaces with different in pmz_convert_to_zs()
965 uap->curregs[R4] = X1CLK; in pmz_convert_to_zs()
966 uap->curregs[R11] = RCTRxCP | TCTRxCP; in pmz_convert_to_zs()
967 uap->curregs[R14] = 0; /* BRG off */ in pmz_convert_to_zs()
968 uap->curregs[R12] = 0; in pmz_convert_to_zs()
969 uap->curregs[R13] = 0; in pmz_convert_to_zs()
970 uap->flags |= PMACZILOG_FLAG_IS_EXTCLK; in pmz_convert_to_zs()
974 uap->curregs[R4] = X16CLK; in pmz_convert_to_zs()
975 uap->curregs[R11] = 0; in pmz_convert_to_zs()
976 uap->curregs[R14] = 0; in pmz_convert_to_zs()
979 uap->curregs[R4] = X32CLK; in pmz_convert_to_zs()
980 uap->curregs[R11] = 0; in pmz_convert_to_zs()
981 uap->curregs[R14] = 0; in pmz_convert_to_zs()
984 uap->curregs[R4] = X16CLK; in pmz_convert_to_zs()
985 uap->curregs[R11] = TCBR | RCBR; in pmz_convert_to_zs()
987 uap->curregs[R12] = (brg & 255); in pmz_convert_to_zs()
988 uap->curregs[R13] = ((brg >> 8) & 255); in pmz_convert_to_zs()
989 uap->curregs[R14] = BRENAB; in pmz_convert_to_zs()
991 uap->flags &= ~PMACZILOG_FLAG_IS_EXTCLK; in pmz_convert_to_zs()
995 uap->curregs[3] &= ~RxN_MASK; in pmz_convert_to_zs()
996 uap->curregs[5] &= ~TxN_MASK; in pmz_convert_to_zs()
1000 uap->curregs[3] |= Rx5; in pmz_convert_to_zs()
1001 uap->curregs[5] |= Tx5; in pmz_convert_to_zs()
1002 uap->parity_mask = 0x1f; in pmz_convert_to_zs()
1005 uap->curregs[3] |= Rx6; in pmz_convert_to_zs()
1006 uap->curregs[5] |= Tx6; in pmz_convert_to_zs()
1007 uap->parity_mask = 0x3f; in pmz_convert_to_zs()
1010 uap->curregs[3] |= Rx7; in pmz_convert_to_zs()
1011 uap->curregs[5] |= Tx7; in pmz_convert_to_zs()
1012 uap->parity_mask = 0x7f; in pmz_convert_to_zs()
1016 uap->curregs[3] |= Rx8; in pmz_convert_to_zs()
1017 uap->curregs[5] |= Tx8; in pmz_convert_to_zs()
1018 uap->parity_mask = 0xff; in pmz_convert_to_zs()
1021 uap->curregs[4] &= ~(SB_MASK); in pmz_convert_to_zs()
1023 uap->curregs[4] |= SB2; in pmz_convert_to_zs()
1025 uap->curregs[4] |= SB1; in pmz_convert_to_zs()
1027 uap->curregs[4] |= PAR_ENAB; in pmz_convert_to_zs()
1029 uap->curregs[4] &= ~PAR_ENAB; in pmz_convert_to_zs()
1031 uap->curregs[4] |= PAR_EVEN; in pmz_convert_to_zs()
1033 uap->curregs[4] &= ~PAR_EVEN; in pmz_convert_to_zs()
1035 uap->port.read_status_mask = Rx_OVR; in pmz_convert_to_zs()
1037 uap->port.read_status_mask |= CRC_ERR | PAR_ERR; in pmz_convert_to_zs()
1039 uap->port.read_status_mask |= BRK_ABRT; in pmz_convert_to_zs()
1041 uap->port.ignore_status_mask = 0; in pmz_convert_to_zs()
1043 uap->port.ignore_status_mask |= CRC_ERR | PAR_ERR; in pmz_convert_to_zs()
1045 uap->port.ignore_status_mask |= BRK_ABRT; in pmz_convert_to_zs()
1047 uap->port.ignore_status_mask |= Rx_OVR; in pmz_convert_to_zs()
1051 uap->port.ignore_status_mask = 0xff; in pmz_convert_to_zs()
1056 * Set the irda codec on the imac to the specified baud rate.
1105 if (--t <= 0) { in pmz_irda_setup()
1121 if (--t <= 0) { in pmz_irda_setup()
1127 /* Switch to command mode */ in pmz_irda_setup()
1128 uap->curregs[R5] |= DTR; in pmz_irda_setup()
1129 write_zsreg(uap, R5, uap->curregs[R5]); in pmz_irda_setup()
1135 pmz_load_zsregs(uap, uap->curregs); in pmz_irda_setup()
1142 if (--t <= 0) { in pmz_irda_setup()
1151 pmz_info("IrDA: dongle version %d not supported\n", version); in pmz_irda_setup()
1155 /* Send speed mode */ in pmz_irda_setup()
1159 if (--t <= 0) { in pmz_irda_setup()
1160 pmz_error("irda_setup timed out on speed mode byte\n"); in pmz_irda_setup()
1167 pmz_error("irda_setup speed mode byte = %x (%x)\n", t, cmdbyte); in pmz_irda_setup()
1169 pmz_info("IrDA setup for %ld bps, dongle version: %d\n", in pmz_irda_setup()
1177 /* Switch back to data mode */ in pmz_irda_setup()
1178 uap->curregs[R5] &= ~DTR; in pmz_irda_setup()
1179 write_zsreg(uap, R5, uap->curregs[R5]); in pmz_irda_setup()
1196 * about the FIR mode and high speed modes. So these are unused. For in __pmz_set_termios()
1204 pmz_debug("pmz: switch IRDA to %ld bauds\n", baud); in __pmz_set_termios()
1205 /* Cet the irda codec to the right rate */ in __pmz_set_termios()
1208 pmz_convert_to_zs(uap, termios->c_cflag, termios->c_iflag, baud); in __pmz_set_termios()
1209 pmz_load_zsregs(uap, uap->curregs); in __pmz_set_termios()
1213 pmz_convert_to_zs(uap, termios->c_cflag, termios->c_iflag, baud); in __pmz_set_termios()
1215 if (UART_ENABLE_MS(&uap->port, termios->c_cflag)) { in __pmz_set_termios()
1216 uap->curregs[R15] |= DCDIE | SYNCIE | CTSIE; in __pmz_set_termios()
1217 uap->flags |= PMACZILOG_FLAG_MODEM_STATUS; in __pmz_set_termios()
1219 uap->curregs[R15] &= ~(DCDIE | SYNCIE | CTSIE); in __pmz_set_termios()
1220 uap->flags &= ~PMACZILOG_FLAG_MODEM_STATUS; in __pmz_set_termios()
1226 uart_update_timeout(port, termios->c_cflag, baud); in __pmz_set_termios()
1244 /* Re-enable IRQs on the port */ in pmz_set_termios()
1256 return "Z85c30 ESCC - Infrared port"; in pmz_type()
1258 return "Z85c30 ESCC - Internal modem"; in pmz_type()
1259 return "Z85c30 ESCC - Serial port"; in pmz_type()
1282 return -EINVAL; in pmz_verify_port()
1296 if (tries--) in pmz_poll_get_char()
1343 * Unlike sunzilog, we don't need to pre-init the spinlock as we don't
1348 struct device_node *np = uap->node; in pmz_init_port()
1361 return -ENODEV; in pmz_init_port()
1362 uap->port.mapbase = r_ports.start; in pmz_init_port()
1363 uap->port.membase = ioremap(uap->port.mapbase, 0x1000); in pmz_init_port()
1365 uap->control_reg = uap->port.membase; in pmz_init_port()
1366 uap->data_reg = uap->control_reg + 0x10; in pmz_init_port()
1372 uap->flags |= PMACZILOG_FLAG_IS_INTMODEM; in pmz_init_port()
1375 uap->flags |= PMACZILOG_FLAG_IS_IRDA; in pmz_init_port()
1376 uap->port_type = PMAC_SCC_ASYNC; in pmz_init_port()
1377 /* 1999 Powerbook G3 has slot-names property instead */ in pmz_init_port()
1378 slots = of_get_property(np, "slot-names", &len); in pmz_init_port()
1379 if (slots && slots->count > 0) { in pmz_init_port()
1380 if (strcmp(slots->name, "IrDA") == 0) in pmz_init_port()
1381 uap->flags |= PMACZILOG_FLAG_IS_IRDA; in pmz_init_port()
1382 else if (strcmp(slots->name, "Modem") == 0) in pmz_init_port()
1383 uap->flags |= PMACZILOG_FLAG_IS_INTMODEM; in pmz_init_port()
1386 uap->port_type = PMAC_SCC_IRDA; in pmz_init_port()
1389 of_find_node_by_name(NULL, "i2c-modem"); in pmz_init_port()
1392 of_get_property(i2c_modem, "modem-id", NULL); in pmz_init_port()
1400 uap->port_type = PMAC_SCC_I2S1; in pmz_init_port()
1402 printk(KERN_INFO "pmac_zilog: i2c-modem detected, id: %d\n", in pmz_init_port()
1413 uap->port.iotype = UPIO_MEM; in pmz_init_port()
1414 uap->port.irq = irq_of_parse_and_map(np, 0); in pmz_init_port()
1415 uap->port.uartclk = ZS_CLOCK; in pmz_init_port()
1416 uap->port.fifosize = 1; in pmz_init_port()
1417 uap->port.ops = &pmz_pops; in pmz_init_port()
1418 uap->port.type = PORT_PMAC_ZILOG; in pmz_init_port()
1419 uap->port.flags = 0; in pmz_init_port()
1422 * Fixup for the port on Gatwick for which the device-tree has in pmz_init_port()
1424 * fixed up interrupt info, but we use the device-tree directly in pmz_init_port()
1427 if (uap->port.irq == 0 && in pmz_init_port()
1428 np->parent && np->parent->parent && in pmz_init_port()
1429 of_device_is_compatible(np->parent->parent, "gatwick")) { in pmz_init_port()
1431 uap->port.irq = irq_create_mapping(NULL, 64 + 15); in pmz_init_port()
1450 np = uap->node; in pmz_dispose_port()
1451 iounmap(uap->control_reg); in pmz_dispose_port()
1452 uap->node = NULL; in pmz_dispose_port()
1458 * Called upon match with an escc node in the device-tree.
1468 if (pmz_ports[i].node == mdev->ofdev.dev.of_node) in pmz_attach()
1471 return -ENODEV; in pmz_attach()
1475 uap->dev = mdev; in pmz_attach()
1476 uap->port.dev = &mdev->ofdev.dev; in pmz_attach()
1477 dev_set_drvdata(&mdev->ofdev.dev, uap); in pmz_attach()
1480 * to work around bugs in ancient Apple device-trees in pmz_attach()
1482 if (macio_request_resources(uap->dev, "pmac_zilog")) in pmz_attach()
1485 uap->node); in pmz_attach()
1487 uap->flags |= PMACZILOG_FLAG_RSRC_REQUESTED; in pmz_attach()
1489 return uart_add_one_port(&pmz_uart_reg, &uap->port); in pmz_attach()
1494 * we don't expect one of those serial ports to go away...
1498 struct uart_pmac_port *uap = dev_get_drvdata(&mdev->ofdev.dev); in pmz_detach()
1503 uart_remove_one_port(&pmz_uart_reg, &uap->port); in pmz_detach()
1505 if (uap->flags & PMACZILOG_FLAG_RSRC_REQUESTED) { in pmz_detach()
1506 macio_release_resources(uap->dev); in pmz_detach()
1507 uap->flags &= ~PMACZILOG_FLAG_RSRC_REQUESTED; in pmz_detach()
1509 dev_set_drvdata(&mdev->ofdev.dev, NULL); in pmz_detach()
1510 uap->dev = NULL; in pmz_detach()
1511 uap->port.dev = NULL; in pmz_detach()
1516 struct uart_pmac_port *uap = dev_get_drvdata(&mdev->ofdev.dev); in pmz_suspend()
1523 uart_suspend_port(&pmz_uart_reg, &uap->port); in pmz_suspend()
1531 struct uart_pmac_port *uap = dev_get_drvdata(&mdev->ofdev.dev); in pmz_resume()
1536 uart_resume_port(&pmz_uart_reg, &uap->port); in pmz_resume()
1542 * Probe all ports in the system and build the ports array, we register
1564 if (of_node_name_prefix(np, "ch-a")) in pmz_probe()
1566 else if (of_node_name_prefix(np, "ch-b")) in pmz_probe()
1591 * Setup the ports for real in pmz_probe()
1624 r_ports = platform_get_resource(uap->pdev, IORESOURCE_MEM, 0); in pmz_init_port()
1626 return -ENODEV; in pmz_init_port()
1628 irq = platform_get_irq(uap->pdev, 0); in pmz_init_port()
1632 uap->port.mapbase = r_ports->start; in pmz_init_port()
1633 uap->port.membase = (unsigned char __iomem *) r_ports->start; in pmz_init_port()
1634 uap->port.iotype = UPIO_MEM; in pmz_init_port()
1635 uap->port.irq = irq; in pmz_init_port()
1636 uap->port.uartclk = ZS_CLOCK; in pmz_init_port()
1637 uap->port.fifosize = 1; in pmz_init_port()
1638 uap->port.ops = &pmz_pops; in pmz_init_port()
1639 uap->port.type = PORT_PMAC_ZILOG; in pmz_init_port()
1640 uap->port.flags = 0; in pmz_init_port()
1642 uap->control_reg = uap->port.membase; in pmz_init_port()
1643 uap->data_reg = uap->control_reg + 4; in pmz_init_port()
1644 uap->port_type = 0; in pmz_init_port()
1645 uap->port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_PMACZILOG_CONSOLE); in pmz_init_port()
1694 return -ENODEV; in pmz_attach()
1697 uap->port.dev = &pdev->dev; in pmz_attach()
1700 return uart_add_one_port(&pmz_uart_reg, &uap->port); in pmz_attach()
1707 uart_remove_one_port(&pmz_uart_reg, &uap->port); in pmz_detach()
1709 uap->port.dev = NULL; in pmz_detach()
1725 .index = -1,
1735 * Register the driver, console driver and ports with the serial
1754 .name = "ch-a",
1757 .name = "ch-b",
1792 * First, we need to do a direct OF-based probe pass. We in init_pmz()
1805 return -ENODEV; in init_pmz()
1836 /* Get rid of macio-driver (detach from macio) */ in exit_pmz()
1845 if (uport->node != NULL) in exit_pmz()
1848 if (uport->pdev != NULL) in exit_pmz()
1875 struct uart_pmac_port *uap = &pmz_ports[con->index]; in pmz_console_write()
1878 uart_port_lock_irqsave(&uap->port, &flags); in pmz_console_write()
1881 write_zsreg(uap, R1, uap->curregs[1] & ~TxINT_ENAB); in pmz_console_write()
1882 write_zsreg(uap, R5, uap->curregs[5] | TxENABLE | RTS | DTR); in pmz_console_write()
1884 uart_console_write(&uap->port, s, count, pmz_console_putchar); in pmz_console_write()
1887 write_zsreg(uap, R1, uap->curregs[1]); in pmz_console_write()
1890 uart_port_unlock_irqrestore(&uap->port, flags); in pmz_console_write()
1919 if (co->index >= pmz_ports_count) in pmz_console_setup()
1920 co->index = 0; in pmz_console_setup()
1921 uap = &pmz_ports[co->index]; in pmz_console_setup()
1923 if (uap->node == NULL) in pmz_console_setup()
1924 return -ENODEV; in pmz_console_setup()
1926 if (uap->pdev == NULL) in pmz_console_setup()
1927 return -ENODEV; in pmz_console_setup()
1929 port = &uap->port; in pmz_console_setup()
1934 uap->flags |= PMACZILOG_FLAG_IS_CONS; in pmz_console_setup()
1939 spin_lock_init(&port->lock); in pmz_console_setup()
1956 /* Probe ports */ in pmz_console_init()
1960 return -ENODEV; in pmz_console_init()