Support for hispeed serial ports
Hi!
This is lying on my hdd for around forever. I used to have it in kernel, but tytso convinced me to push it into userspace. Could it be merged into setserial?
Pavel
Makefile +2 -2
@@ -14,8 +14,8 @@ all: setserial setserial.cat -setserial: setserial.c - $(CC) $(CFLAGS) $(DEFS) setserial.c -o setserial +setserial: setserial.c hispeed.c + $(CC) $(CFLAGS) $(DEFS) setserial.c hispeed.c -o setserial setserial.cat: setserial.8 nroff -man setserial.8 > setserial.cat
Makefile.in +2 -2
@@ -14,8 +14,8 @@ all: setserial setserial.cat -setserial: setserial.c - $(CC) $(CFLAGS) $(DEFS) setserial.c -o setserial +setserial: setserial.c hispeed.c + $(CC) $(CFLAGS) $(DEFS) setserial.c hispeed.c -o setserial setserial.cat: setserial.8 nroff -man setserial.8 > setserial.cat
hispeed.c +626 -0
626 lines not on this page · raw message
Only in setserial-2.14: setserial
setserial.8 +13 -2
@@ -138,7 +138,7 @@ .B skip_test parameter also often must be specified. .TP -.B autoconfigure +.B autoconfig When this parameter is given, .B setserial will ask the kernel to attempt to automatically configure the serial
@@ -147,10 +147,21 @@ .B auto_irq parameter is set, Linux will attempt to automatically determine the IRQ. The -.B autoconfigure +.B autoconfig parameter should be given after the .BR port , auto_irq ", and" skip_test parameters have been specified. +.TP +.B hispeed +Some SMC/NS/Winbond Multi-I/O chips and ALI south bridge chips have High +Speed mode, in which baud rate can be set to 230400, 460800 (or 921600 +at NS/Winbond chips) bps. With this option, +.B setserial +try to detect such chips and make kernel capable of using higher speeds. +(ALI: M1543(Aladdin V south bridge) - 460800 max, +NS: PC8730[789], PC[89]3[01]7, PC87338 - 921600 max, +SMC:37C665IR/666IR, 37C669/669FR,37N769, 37B72x/77x/78x/80x, 37C67x/68x/93x/93xAPM/93xFR, 37M60x/61x, 37N958FR - 450800 max, +WinBond: W83877TF(TF ONLY, A/F/AF NOT supported) W83977A/AF/TF/ATF - 460800 max). .TP .B auto_irq During autoconfiguration, try to determine the IRQ. This feature is
setserial.8.in +13 -2
@@ -138,7 +138,7 @@ .B skip_test parameter also often must be specified. .TP -.B autoconfigure +.B autoconfig When this parameter is given, .B setserial will ask the kernel to attempt to automatically configure the serial
@@ -147,10 +147,21 @@ .B auto_irq parameter is set, Linux will attempt to automatically determine the IRQ. The -.B autoconfigure +.B autoconfig parameter should be given after the .BR port , auto_irq ", and" skip_test parameters have been specified. +.TP +.B hispeed +Some SMC/NS/Winbond Multi-I/O chips and ALI south bridge chips have High +Speed mode, in which baud rate can be set to 230400, 460800 (or 921600 +at NS/Winbond chips) bps. With this option, +.B setserial +try to detect such chips and make kernel capable of using higher speeds. +(ALI: M1543(Aladdin V south bridge) - 460800 max, +NS: PC8730[789], PC[89]3[01]7, PC87338 - 921600 max, +SMC:37C665IR/666IR, 37C669/669FR,37N769, 37B72x/77x/78x/80x, 37C67x/68x/93x/93xAPM/93xFR, 37M60x/61x, 37N958FR - 450800 max, +WinBond: W83877TF(TF ONLY, A/F/AF NOT supported) W83977A/AF/TF/ATF - 460800 max). .TP .B auto_irq During autoconfiguration, try to determine the IRQ. This feature is
setserial.c +25 -1
@@ -66,6 +66,7 @@#define CMD_CONFIG 10#define CMD_GETMULTI 11#define CMD_SETMULTI 12 +#define CMD_HISPEED 13#define FLAG_CAN_INVERT 0x0001#define FLAG_NEED_ARG 0x0002
@@ -109,6 +110,7 @@CMD_WAIT2 ,"closing_wait2" ,0 ,0 ,0 ,FLAG_NEED_ARG , #endifCMD_CONFIG ,"autoconfig" ,0 ,0 ,0 ,0 , +CMD_HISPEED ,"hispeed" ,0 ,0 ,0 ,0 ,CMD_GETMULTI ,"get_multiport" ,0 ,0 ,0 ,0 ,CMD_SETMULTI ,"set_multiport" ,0 ,0 ,0 ,0 , 0, 0, 0, 0, 0, 0,
@@ -484,6 +486,27 @@ }set_multiport (device, fd, &arg);break ; +case CMD_HISPEED : + { +struct serial_struct serinfo; +int baud_base; + +if (ioctl (fd,TIOCGSERIAL , &serinfo) <0 ) { +perror ("Cannot get serial info" ); +exit (1 ); + } + baud_base =enable_hispeed (serinfo.port); +if (!baud_base) +printf ("Hispeed serial not detected\n" ); +else { + serinfo.baud_base = baud_base; +if (ioctl (fd,TIOCSSERIAL , &new_serinfo) <0 ) { +perror ("Cannot set serial info" ); +exit (1 ); + } + } + } +break ;default :fprintf (stderr,"Internal error: unhandled cmd #%d\n" , p->cmd);
@@ -561,7 +584,8 @@fprintf (stderr,"\t\t\t\tafter the reciver is disabled\n" );#endif fprintf (stderr,"\t^ fourport\tconfigure the port as an AST Fourport\n" ); -fprintf (stderr,"\t autoconfigure\tautomatically configure the serial port\n" ); +fprintf (stderr,"\t autoconfig\tautomatically configure the serial port\n" ); +fprintf (stderr,"\t hispeed\ttry to make serail port capable of faster speeds\n" );fprintf (stderr,"\t^ auto_irq\ttry to determine irq during autoconfiguration\n" );fprintf (stderr,"\t^ skip_test\tskip UART test during autoconfiguration\n" );fprintf (stderr,"\n" );
Only in setserial-2.14: setserial.cat
Only in setserial-2.14: setserial2
Only in setserial-2.14: setserial3
Signature · 2 lines
STOP THE WAR! Someone killed innocent Americans. That does not give U.S. right to kill people in Afganistan.