• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/linux/linux-2.6/drivers/serial/

Lines Matching defs:zport

140 static u8 read_zsreg(struct zs_port *zport, int reg)
142 void __iomem *control = zport->port.membase + ZS_CHAN_IO_OFFSET;
155 static void write_zsreg(struct zs_port *zport, int reg, u8 value)
157 void __iomem *control = zport->port.membase + ZS_CHAN_IO_OFFSET;
169 static u8 read_zsdata(struct zs_port *zport)
171 void __iomem *data = zport->port.membase +
180 static void write_zsdata(struct zs_port *zport, u8 value)
182 void __iomem *data = zport->port.membase +
194 struct zs_port *zport;
198 zport = &zs_sccs[i / ZS_NUM_CHAN].zport[i % ZS_NUM_CHAN];
200 if (!zport->scc)
204 printk("W%-2d = 0x%02x\t", j, zport->regs[j]);
207 printk("R%-2d = 0x%02x\t", j, read_zsreg(zport, j));
230 static int zs_receive_drain(struct zs_port *zport)
234 while ((read_zsreg(zport, R0) & Rx_CH_AV) && --loops)
235 read_zsdata(zport);
239 static int zs_transmit_drain(struct zs_port *zport, int irq)
241 struct zs_scc *scc = zport->scc;
244 while (!(read_zsreg(zport, R0) & Tx_BUF_EMP) && --loops) {
252 static int zs_line_drain(struct zs_port *zport, int irq)
254 struct zs_scc *scc = zport->scc;
257 while (!(read_zsreg(zport, R1) & ALL_SNT) && --loops) {
266 static void load_zsregs(struct zs_port *zport, u8 *regs, int irq)
269 zs_line_drain(zport, irq);
271 write_zsreg(zport, R3, regs[3] & ~RxENABLE);
272 write_zsreg(zport, R5, regs[5] & ~TxENAB);
273 write_zsreg(zport, R4, regs[4]);
274 write_zsreg(zport, R9, regs[9]);
275 write_zsreg(zport, R1, regs[1]);
276 write_zsreg(zport, R2, regs[2]);
277 write_zsreg(zport, R10, regs[10]);
278 write_zsreg(zport, R14, regs[14] & ~BRENABL);
279 write_zsreg(zport, R11, regs[11]);
280 write_zsreg(zport, R12, regs[12]);
281 write_zsreg(zport, R13, regs[13]);
282 write_zsreg(zport, R14, regs[14]);
283 write_zsreg(zport, R15, regs[15]);
285 write_zsreg(zport, R3, regs[3]);
287 write_zsreg(zport, R5, regs[5]);
308 struct zs_port *zport = to_zport(uport);
309 struct zs_scc *scc = zport->scc;
314 status = read_zsreg(zport, R1);
337 static unsigned int zs_raw_get_mctrl(struct zs_port *zport)
339 struct zs_port *zport_a = &zport->scc->zport[ZS_CHAN_A];
341 return zport != zport_a ? zs_raw_get_ab_mctrl(zport_a, zport) : 0;
344 static unsigned int zs_raw_xor_mctrl(struct zs_port *zport)
346 struct zs_port *zport_a = &zport->scc->zport[ZS_CHAN_A];
350 if (zport == zport_a)
354 mask_b = zport->regs[15];
361 mctrl = zport->mctrl;
364 mctrl |= zs_raw_get_ab_mctrl(zport_a, zport) & mmask;
367 delta = mctrl ^ zport->mctrl;
369 zport->mctrl = mctrl;
376 struct zs_port *zport = to_zport(uport);
377 struct zs_scc *scc = zport->scc;
381 mctrl = zs_raw_get_mctrl(zport);
389 struct zs_port *zport = to_zport(uport);
390 struct zs_scc *scc = zport->scc;
391 struct zs_port *zport_a = &scc->zport[ZS_CHAN_A];
395 if (zport != zport_a) {
408 oldloop = zport->regs[14];
415 zport->regs[14] = newloop;
416 write_zsreg(zport, R14, zport->regs[14]);
421 static void zs_raw_stop_tx(struct zs_port *zport)
423 write_zsreg(zport, R0, RES_Tx_P);
424 zport->tx_stopped = 1;
429 struct zs_port *zport = to_zport(uport);
430 struct zs_scc *scc = zport->scc;
433 zs_raw_stop_tx(zport);
441 struct zs_port *zport = to_zport(uport);
442 struct zs_scc *scc = zport->scc;
445 if (zport->tx_stopped) {
446 zs_transmit_drain(zport, 0);
447 zport->tx_stopped = 0;
448 zs_raw_transmit_chars(zport);
455 struct zs_port *zport = to_zport(uport);
456 struct zs_scc *scc = zport->scc;
457 struct zs_port *zport_a = &scc->zport[ZS_CHAN_A];
460 zport->regs[15] &= ~BRKIE;
461 zport->regs[1] &= ~(RxINT_MASK | TxINT_ENAB);
462 zport->regs[1] |= RxINT_DISAB;
464 if (zport != zport_a) {
474 zport->regs[15] &= ~(DCDIE | CTSIE);
475 zport->regs[1] &= ~EXT_INT_ENAB;
478 if (!(zport->regs[15] & (DCDIE | SYNCIE)))
479 zport->regs[1] &= ~EXT_INT_ENAB;
482 write_zsreg(zport, R15, zport->regs[15]);
483 write_zsreg(zport, R1, zport->regs[1]);
489 struct zs_port *zport = to_zport(uport);
490 struct zs_scc *scc = zport->scc;
491 struct zs_port *zport_a = &scc->zport[ZS_CHAN_A];
493 if (zport == zport_a)
507 zport->regs[15] |= DCDIE | CTSIE;
509 zs_raw_xor_mctrl(zport);
513 write_zsreg(zport, R15, zport->regs[15]);
519 struct zs_port *zport = to_zport(uport);
520 struct zs_scc *scc = zport->scc;
525 zport->regs[5] |= SND_BRK;
527 zport->regs[5] &= ~SND_BRK;
528 write_zsreg(zport, R5, zport->regs[5]);
539 static void zs_receive_chars(struct zs_port *zport)
541 struct uart_port *uport = &zport->port;
542 struct zs_scc *scc = zport->scc;
549 avail = read_zsreg(zport, R0) & Rx_CH_AV;
555 status = read_zsreg(zport, R1) & (Rx_OVR | FRM_ERR | PAR_ERR);
556 ch = read_zsdata(zport);
566 status |= zport->tty_break;
569 zport->tty_break = 0;
574 write_zsreg(zport, R0, ERR_RES);
608 static void zs_raw_transmit_chars(struct zs_port *zport)
610 struct circ_buf *xmit = &zport->port.state->xmit;
613 if (zport->port.x_char) {
614 write_zsdata(zport, zport->port.x_char);
615 zport->port.icount.tx++;
616 zport->port.x_char = 0;
621 if (uart_circ_empty(xmit) || uart_tx_stopped(&zport->port)) {
622 zs_raw_stop_tx(zport);
627 write_zsdata(zport, xmit->buf[xmit->tail]);
629 zport->port.icount.tx++;
632 uart_write_wakeup(&zport->port);
636 zs_raw_stop_tx(zport);
639 static void zs_transmit_chars(struct zs_port *zport)
641 struct zs_scc *scc = zport->scc;
644 zs_raw_transmit_chars(zport);
648 static void zs_status_handle(struct zs_port *zport, struct zs_port *zport_a)
650 struct uart_port *uport = &zport->port;
651 struct zs_scc *scc = zport->scc;
658 status = read_zsreg(zport, R0);
660 if (zport->regs[15] & BRKIE) {
662 if (brk && !zport->brk) {
665 zport->tty_break = Rx_SYS;
667 zport->tty_break = Rx_BRK;
670 zport->brk = brk;
673 if (zport != zport_a) {
674 delta = zs_raw_xor_mctrl(zport);
679 zport->mctrl & TIOCM_CTS);
682 zport->mctrl & TIOCM_CAR);
695 write_zsreg(zport, R0, RES_EXT_INT);
706 struct zs_port *zport_a = &scc->zport[ZS_CHAN_A];
707 struct zs_port *zport_b = &scc->zport[ZS_CHAN_B];
756 struct zs_port *zport = to_zport(uport);
757 struct zs_scc *scc = zport->scc;
764 ret = request_irq(zport->port.irq, zs_interrupt,
769 zport->port.irq);
777 zs_receive_drain(zport);
780 write_zsreg(zport, R0, ERR_RES);
781 write_zsreg(zport, R0, RES_Tx_P);
783 if (!(zport->regs[1] & EXT_INT_ENAB))
784 write_zsreg(zport, R0, RES_EXT_INT);
787 zport->regs[1] &= ~RxINT_MASK;
788 zport->regs[1] |= RxINT_ALL | TxINT_ENAB | EXT_INT_ENAB;
789 zport->regs[3] |= RxENABLE;
790 zport->regs[15] |= BRKIE;
791 write_zsreg(zport, R1, zport->regs[1]);
792 write_zsreg(zport, R3, zport->regs[3]);
793 write_zsreg(zport, R5, zport->regs[5]);
794 write_zsreg(zport, R15, zport->regs[15]);
797 zport->mctrl = zs_raw_get_mctrl(zport);
798 zport->brk = read_zsreg(zport, R0) & BRK_ABRT;
800 zport->tx_stopped = 1;
809 struct zs_port *zport = to_zport(uport);
810 struct zs_scc *scc = zport->scc;
816 zport->regs[3] &= ~RxENABLE;
817 write_zsreg(zport, R5, zport->regs[5]);
818 write_zsreg(zport, R3, zport->regs[3]);
824 free_irq(zport->port.irq, scc);
828 static void zs_reset(struct zs_port *zport)
830 struct zs_scc *scc = zport->scc;
838 read_zsreg(zport, R0);
840 zs_line_drain(zport, irq);
841 write_zsreg(zport, R9, FHWRES);
843 write_zsreg(zport, R9, 0);
846 load_zsregs(zport, zport->regs, irq);
853 struct zs_port *zport = to_zport(uport);
854 struct zs_scc *scc = zport->scc;
855 struct zs_port *zport_a = &scc->zport[ZS_CHAN_A];
864 zport->regs[3] &= ~RxNBITS_MASK;
865 zport->regs[5] &= ~TxNBITS_MASK;
868 zport->regs[3] |= Rx5;
869 zport->regs[5] |= Tx5;
872 zport->regs[3] |= Rx6;
873 zport->regs[5] |= Tx6;
876 zport->regs[3] |= Rx7;
877 zport->regs[5] |= Tx7;
881 zport->regs[3] |= Rx8;
882 zport->regs[5] |= Tx8;
887 zport->regs[4] &= ~(XCLK_MASK | SB_MASK | PAR_ENA | PAR_EVEN);
889 zport->regs[4] |= SB2;
891 zport->regs[4] |= SB1;
893 zport->regs[4] |= PAR_ENA;
895 zport->regs[4] |= PAR_EVEN;
896 switch (zport->clk_mode) {
898 zport->regs[4] |= X64CLK;
901 zport->regs[4] |= X32CLK;
904 zport->regs[4] |= X16CLK;
907 zport->regs[4] |= X1CLK;
914 uport->uartclk / zport->clk_mode / 4);
916 brg = ZS_BPS_TO_BRG(baud, uport->uartclk / zport->clk_mode);
917 zport->regs[12] = brg & 0xff;
918 zport->regs[13] = (brg >> 8) & 0xff;
938 zport->regs[3] |= RxENABLE;
940 zport->regs[3] &= ~RxENABLE;
942 if (zport != zport_a) {
944 zport->regs[15] |= DCDIE;
946 zport->regs[15] &= ~DCDIE;
948 zport->regs[15] |= CTSIE;
950 zport->regs[15] &= ~CTSIE;
951 zs_raw_xor_mctrl(zport);
955 load_zsregs(zport, zport->regs, irq);
968 struct zs_port *zport = to_zport(uport);
971 zport->regs[5] |= TxENAB;
973 zport->regs[5] &= ~TxENAB;
974 write_zsreg(zport, R5, zport->regs[5]);
1020 struct zs_port *zport = to_zport(uport);
1028 zs_reset(zport);
1034 struct zs_port *zport = to_zport(uport);
1041 if (ser->baud_base != uport->uartclk / zport->clk_mode / 4)
1101 struct zs_port *zport = &zs_sccs[chip].zport[side];
1102 struct uart_port *uport = &zport->port;
1104 zport->scc = &zs_sccs[chip];
1105 zport->clk_mode = 16;
1119 zport->regs[i] = zs_init_regs[i];
1130 struct zs_port *zport = to_zport(uport);
1131 struct zs_scc *scc = zport->scc;
1137 if (zs_transmit_drain(zport, irq))
1138 write_zsdata(zport, ch);
1150 struct zs_port *zport = &zs_sccs[chip].zport[side];
1151 struct zs_scc *scc = zport->scc;
1158 txint = zport->regs[1];
1159 txenb = zport->regs[5];
1161 zport->regs[1] = txint & ~TxINT_ENAB;
1162 write_zsreg(zport, R1, zport->regs[1]);
1165 zport->regs[5] = txenb | TxENAB;
1166 write_zsreg(zport, R5, zport->regs[5]);
1170 uart_console_write(&zport->port, s, count, zs_console_putchar);
1175 zs_line_drain(zport, irq);
1177 zport->regs[5] &= ~TxENAB;
1178 write_zsreg(zport, R5, zport->regs[5]);
1181 zport->regs[1] |= TxINT_ENAB;
1182 write_zsreg(zport, R1, zport->regs[1]);
1196 struct zs_port *zport = &zs_sccs[chip].zport[side];
1197 struct uart_port *uport = &zport->port;
1208 zs_reset(zport);
1277 struct zs_port *zport = &scc->zport[i % ZS_NUM_CHAN];
1278 struct uart_port *uport = &zport->port;
1280 if (zport->scc)
1293 struct zs_port *zport = &scc->zport[i % ZS_NUM_CHAN];
1294 struct uart_port *uport = &zport->port;
1296 if (zport->scc)