Second serial updates (please discard previous)
Subsystems (3)
cover Second serial updates (please discard previous)
This time hopefully without a corrupt header which confused everything.
---
Adrian Bunk (1):
tty: Correct inline types for tty_driver_kref_get()
Alan Cox (2):
lanana: assign a device name and numbering for MAX3100
serqt: initial clean up pass for tty side
Breno Leitao (1):
Here are some cleanups, mainly removing unused variables and silly
Christian Pellegrin (1):
Add support for the MAX3100 SPI UART.
Claudio Scordino (1):
tty: Use the generic RS485 ioctl on CRIS
Mike Frysinger (3):
Adjust path to gpio headers
KGDB_SERIAL_CONSOLE check for module
Change KCONFIG name
Sonic Zhang (2):
Both software emulated and hardware based CTS and RTS are enabled in Only CTS bit is affected.
Documentation/devices.txt | 4 .../mach-bf518/include/mach/bfin_serial_5xx.h | 10 .../mach-bf527/include/mach/bfin_serial_5xx.h | 36 -- .../mach-bf533/include/mach/bfin_serial_5xx.h | 29 - .../mach-bf537/include/mach/bfin_serial_5xx.h | 37 -- .../mach-bf538/include/mach/bfin_serial_5xx.h | 10 .../mach-bf548/include/mach/bfin_serial_5xx.h | 117 +---- .../mach-bf561/include/mach/bfin_serial_5xx.h | 29 - arch/cris/include/asm/ioctls.h | 5 arch/cris/include/asm/rs485.h | 8 arch/cris/include/asm/termios.h | 1 drivers/serial/Kconfig | 47 ++ drivers/serial/Makefile | 1 drivers/serial/bfin_5xx.c | 282 ++++++++----- drivers/serial/crisv10.c | 79 +++- drivers/serial/crisv10.h | 2 drivers/serial/jsm/jsm_neo.c | 14 - drivers/serial/jsm/jsm_tty.c | 19 - drivers/staging/serqt_usb/serqt_usb.c | 449 +++++++------------- include/linux/serial_core.h | 3 include/linux/tty_driver.h | 3 21 files changed, 547 insertions(+), 638 deletions(-)
PATCH 1/11 tty: Correct inline types for tty_driver_kref_get()
From: Adrian Bunk <[email protected]>
tty_driver_kref_get() should be static inline and not extern inline (the latter even changed it's semantics in gcc >= 4.3).
---
include/linux/tty_driver.h | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
include/linux/tty_driver.h +2 -1
@@ -309,7 +309,8 @@ extern void tty_set_operations(struct tty_driver *driver,extern struct tty_driver *tty_find_polling_driver (char *name,int *line);extern void tty_driver_kref_put (struct tty_driver *driver); -extern inline struct tty_driver *tty_driver_kref_get (struct tty_driver *d) + +static inline struct tty_driver *tty_driver_kref_get (struct tty_driver *d) {kref_get (&d->kref);return d;
PATCH 2/11 tty: Use the generic RS485 ioctl on CRIS
In reply to Alan CoxFrom: Claudio Scordino <[email protected]>
Use the new general RS485 Linux data structure (introduced by Alan with commit number c26c56c0f40e200e61d1390629c806f6adaffbcc) in the Cris architecture too (currently, Cris still uses the old private data structure instead of the new one).
---
arch/cris/include/asm/ioctls.h | 5 +- arch/cris/include/asm/rs485.h | 8 +--- arch/cris/include/asm/termios.h | 1 drivers/serial/crisv10.c | 79 +++++++++++++++++++++++++++++---------- drivers/serial/crisv10.h | 2 - 5 files changed, 66 insertions(+), 29 deletions(-)
arch/cris/include/asm/ioctls.h +3 -2
@@ -74,8 +74,9 @@#define TIOCSHAYESESP 0x545F/* Set Hayes ESP configuration */ #define FIOQSIZE 0x5460 -#define TIOCSERSETRS485 0x5461/* enable rs-485 */ -#define TIOCSERWRRS485 0x5462/* write rs-485 */ +#define TIOCSERSETRS485 0x5461/* enable rs-485 (deprecated) */ +#define TIOCSERWRRS485 0x5462/* write rs-485 */ +#define TIOCSRS485 0x5463/* enable rs-485 */ /* Used for packet mode */ #define TIOCPKT_DATA 0
arch/cris/include/asm/rs485.h +3 -5
@@ -1,15 +1,13 @@/* RS-485 structures */ -/* RS-485 support */ -/* Used with ioctl() TIOCSERSETRS485 */ +/* Used with ioctl() TIOCSERSETRS485 for backward compatibility! +* XXX: Do not use it for new code! +*/ struct rs485_control {unsigned short rts_on_send;unsigned short rts_after_sent;unsigned long delay_rts_before_send;unsigned short enabled; -#ifdef __KERNEL__ -int disable_serial_loopback; -#endif };/* Used with ioctl() TIOCSERWRRS485 */
arch/cris/include/asm/termios.h +1 -0
@@ -4,6 +4,7 @@#include <asm/termbits.h> #include <asm/ioctls.h> #include <asm/rs485.h> +#include <linux/serial.h> struct winsize {unsigned short ws_row;
drivers/serial/crisv10.c +58 -21
176 lines not on this page · raw message
drivers/serial/crisv10.h +1 -1
@@ -125,7 +125,7 @@ struct e100_serial {int errorcode;#ifdef CONFIG_ETRAX_RS485 -struct rs485_control rs485;/* RS-485 support */ +struct serial_rs485 rs485;/* RS-485 support */ #endif };
PATCH 3/11 serqt: initial clean up pass for tty side
In reply to Alan CoxAvoid using port->tty where possible (makes refcount fixing easier later) Remove unused code (the ioctl path is not used if the device has mget/mset functions)
Remove various un-needed typecasts and long names so it could read it to do the changes
---
drivers/staging/serqt_usb/serqt_usb.c | 449 ++++++++++++--------------------- 1 files changed, 163 insertions(+), 286 deletions(-)
drivers/staging/serqt_usb/serqt_usb.c +163 -286
@@ -289,7 +289,8 @@ static void serial_unthrottle(struct tty_struct *tty);static int serial_break (struct tty_struct *tty,int break_state);static int serial_chars_in_buffer (struct tty_struct *tty); -static int qt_open (struct usb_serial_port *port,struct file *filp); +static int qt_open (struct tty_struct *tty,struct usb_serial_port *port, +struct file *filp);static int BoxSetPrebufferLevel (struct usb_serial *serial);static int BoxSetATC (struct usb_serial *serial,__u16 n_Mode);
@@ -300,24 +301,26 @@ static int BoxSetUart(struct usb_serial *serial, unsigned short Uart_Number,static int BoxOPenCloseChannel (struct usb_serial *serial,__u16 Uart_Number,__u16 OpenClose,struct qt_open_channel_data *pDeviceData); -static void qt_close (struct usb_serial_port *port,struct file *filp); +static void qt_close (struct tty_struct *tty,struct usb_serial_port *port, +struct file *filp);static int BoxGetRegister (struct usb_serial *serial,unsigned short Uart_Number,unsigned short Register_Num,__u8 *pValue);static int BoxSetRegister (struct usb_serial *serial,unsigned short Uart_Number,unsigned short Register_Num,unsigned short Value);static void qt_write_bulk_callback (struct urb *urb); -static int qt_write (struct usb_serial_port *port,int from_user, +static int qt_write (struct tty_struct *tty,struct usb_serial_port *port,const unsigned char *buf,int count);static void port_softint (struct work_struct *work);static int qt_write_room (struct usb_serial_port *port);static int qt_chars_in_buffer (struct usb_serial_port *port); -static int qt_ioctl (struct usb_serial_port *port,struct file *file, -unsigned int cmd,unsigned long arg); -static void qt_set_termios (struct usb_serial_port *port, +static int qt_ioctl (struct tty_struct *tty,struct usb_serial_port *port, +struct file *file,unsigned int cmd,unsigned long arg); +static void qt_set_termios (struct tty_struct *tty, +struct usb_serial_port *port,struct ktermios *old_termios); -static int BoxSetHW_FlowCtrl (struct usb_serial *serial,unsigned int UartNumber, +static int BoxSetHW_FlowCtrl (struct usb_serial *serial,unsigned int index,int bSet); -static int BoxDisable_SW_FlowCtrl (struct usb_serial *serial,__u16 UartNumber); +static int BoxDisable_SW_FlowCtrl (struct usb_serial *serial,__u16 index);static int EmulateWriteQMCR_Reg (int index,unsigned uc_value);static int EmulateReadQMCR_Reg (int index,unsigned *uc_value);static struct usb_serial *find_the_box (unsigned int index);
@@ -336,10 +339,11 @@ static int serial_tiocmset(struct tty_struct *tty, struct file *file, unsigned int set, unsigned int clear);static int serial_tiocmget (struct tty_struct *tty,struct file *file); -static int qt_tiocmset (struct usb_serial_port *port,struct file *file, -unsigned int value); +static int qt_tiocmset (struct tty_struct *tty,struct usb_serial_port *port, +struct file *file,unsigned int value); -static int qt_tiocmget (struct usb_serial_port *port,struct file *file); +static int qt_tiocmget (struct tty_struct *tty,struct usb_serial_port *port, +struct file *file);/* Version Information */ #define DRIVER_VERSION "v2.14"
@@ -818,7 +822,7 @@ static struct usb_serial *get_free_serial(int num_ports, int *minor)return NULL ; } -static int flip_that (struct tty_struct *tty,__u16 UartNumber, +static int flip_that (struct tty_struct *tty,__u16 index,struct usb_serial *serial) {tty_flip_buffer_push (tty);
@@ -829,18 +833,18 @@ static int flip_that(struct tty_struct *tty, __u16 UartNumber,/* Handles processing and moving data to the tty layer */ static void port_sofrint (void *private) { -struct usb_serial_port *port = (struct usb_serial_port *)private; +struct usb_serial_port *port = private;struct usb_serial *serial =get_usb_serial (port, __func__);struct tty_struct *tty = port->tty;unsigned char *data = port->read_urb->transfer_buffer; -unsigned int UartNumber; +unsigned int index;struct urb *urb = port->read_urb;unsigned int RxCount = urb->actual_length;int i, result;int flag, flag_data; -/* UartNumber = MINOR(port->tty->device) - serial->minor; */ - UartNumber = tty->index - serial->minor; +/* index = MINOR(port->tty->device) - serial->minor; */ + index = tty->index - serial->minor;mydbg ("%s - port %d\n" , __func__, port->number);mydbg ("%s - port->RxHolding = %d\n" , __func__, port->RxHolding);
@@ -948,7 +952,7 @@ static void port_sofrint(void *private) __func__, result); else {if (tty && RxCount) -flip_that (tty, UartNumber, serial); +flip_that (tty, index, serial); }return ;
@@ -1097,7 +1101,7 @@ static int serial_open(struct tty_struct *tty, struct file *filp) port->RxHolding =0 ;mydbg ("%s port->RxHolding = 0\n" , __func__); - retval =qt_open (port, filp); + retval =qt_open (tty, port, filp); }if (retval)
@@ -1112,11 +1116,12 @@ static int serial_open(struct tty_struct *tty, struct file *filp)/***************************************************************************** *device's specific driver functions *****************************************************************************/ -static int qt_open (struct usb_serial_port *port,struct file *filp) +static int qt_open (struct tty_struct *tty,struct usb_serial_port *port, +struct file *filp) {struct usb_serial *serial = port->serial;int result =0 ; -unsigned int UartNumber; +unsigned int index;struct qt_get_device_data DeviceData;struct qt_open_channel_data ChannelData;unsigned short default_divisor =0x30 ;/* gives 9600 baud rate */
@@ -1128,13 +1133,7 @@ static int qt_open(struct usb_serial_port *port, struct file *filp)mydbg ("%s - port %d\n" , __func__, port->number); -/* force low_latency on so that our tty_push actually forces the data through, -otherwise it is scheduled, and with high data rates (like with OHCI) data -can get lost. */ -if (port->tty) - port->tty->low_latency =0 ; - - UartNumber = port->tty->index - serial->minor; + index = tty->index - serial->minor; status =box_get_device (serial, &DeviceData);if (status <0 ) {
@@ -1147,7 +1146,7 @@ static int qt_open(struct usb_serial_port *port, struct file *filp)/* Open uart channel */ /* Port specific setups */ - status =BoxOPenCloseChannel (serial, UartNumber,1 , &ChannelData); + status =BoxOPenCloseChannel (serial, index,1 , &ChannelData);if (status <0 ) {mydbg (__FILE__"BoxOPenCloseChannel failed\n" );return status;
@@ -1161,7 +1160,7 @@ static int qt_open(struct usb_serial_port *port, struct file *filp) (SERIAL_MSR_CTS |SERIAL_MSR_DSR |SERIAL_MSR_RI |SERIAL_MSR_CD );/* Set Baud rate to default and turn off (default)flow control here */ - status =BoxSetUart (serial, UartNumber, default_divisor, default_LCR); + status =BoxSetUart (serial, index, default_divisor, default_LCR);if (status <0 ) {mydbg (__FILE__"BoxSetUart failed\n" );return status;
@@ -1169,7 +1168,7 @@ static int qt_open(struct usb_serial_port *port, struct file *filp)mydbg (__FILE__"BoxSetUart completed.\n" );/* Put this here to make it responsive to stty and defauls set by the tty layer */ -qt_set_termios (port,NULL ); +qt_set_termios (tty, port,NULL );/* Initialize the wait que head */ init_waitqueue_head (&(port->wait));
@@ -1203,7 +1202,7 @@ static int qt_open(struct usb_serial_port *port, struct file *filp)static void serial_close (struct tty_struct *tty,struct file *filp) {struct usb_serial_port *port = - (struct usb_serial_port *)tty->driver_data; + tty->driver_data;struct usb_serial *serial =get_usb_serial (port, __func__);if (!serial)
@@ -1226,7 +1225,7 @@ static void serial_close(struct tty_struct *tty, struct file *filp)mydbg ("%s - port->closePending = 1\n" , __func__);if (serial->dev) { -qt_close (port, filp); +qt_close (tty, port, filp); port->open_count =0 ; } }
@@ -1240,20 +1239,21 @@ exit: } -static void qt_close (struct usb_serial_port *port,struct file *filp) +static void qt_close (struct tty_struct *tty,struct usb_serial_port *port, +struct file *filp) {unsigned long jift = jiffies +10 *HZ ; -__u8 LSR_Value, MCR_Value; +u8 lsr, mcr;struct usb_serial *serial = port->serial;int status; -unsigned int UartNumber; +unsigned int index;struct qt_open_channel_data ChannelData; status =0 ; - LSR_Value =0 ; + lsr =0 ;mydbg ("%s - port %d\n" , __func__, port->number); - UartNumber = port->tty->index - serial->minor; + index = tty->index - serial->minor;/* shutdown any bulk reads that might be going on */ if (serial->num_bulk_out)
@@ -1263,20 +1263,19 @@ static void qt_close(struct usb_serial_port *port, struct file *filp)/* wait up to 30 seconds for transmitter to empty */ do { - status =BoxGetRegister (serial, UartNumber,LINE_STATUS_REGISTER , &LSR_Value); + status =BoxGetRegister (serial, index,LINE_STATUS_REGISTER , &lsr);if (status <0 ) {mydbg (__FILE__"box_get_device failed\n" );break ; } -if ((LSR_Value &SERIAL_LSR_TEMT ) +if ((lsr &SERIAL_LSR_TEMT ) && (port->ReadBulkStopped ==1 ))break ;schedule (); } -while (jiffies <= jift) - ; +while (jiffies <= jift);if (jiffies > jift) mydbg("%s - port %d timout of checking transmitter empty\n",
@@ -1286,17 +1285,17 @@ static void qt_close(struct usb_serial_port *port, struct file *filp) __func__, port->number); status = -BoxGetRegister (serial, UartNumber,MODEM_CONTROL_REGISTER , - &MCR_Value); -mydbg (__FILE__"BoxGetRegister MCR = 0x%x.\n" , MCR_Value); +BoxGetRegister (serial, index,MODEM_CONTROL_REGISTER , + &mcr); +mydbg (__FILE__"BoxGetRegister MCR = 0x%x.\n" , mcr);if (status >=0 ) { - MCR_Value &= ~(SERIAL_MCR_DTR |SERIAL_MCR_RTS ); -/* status = BoxSetRegister(serial, UartNumber, MODEM_CONTROL_REGISTER, MCR_Value); */ + mcr &= ~(SERIAL_MCR_DTR |SERIAL_MCR_RTS ); +/* status = BoxSetRegister(serial, index, MODEM_CONTROL_REGISTER, mcr); */ }/* Close uart channel */ - status =BoxOPenCloseChannel (serial, UartNumber,0 , &ChannelData); + status =BoxOPenCloseChannel (serial, index,0 , &ChannelData);if (status <0 )mydbg ("%s - port %d BoxOPenCloseChannel failed.\n" , __func__, port->number);
@@ -1308,12 +1307,10 @@ static void qt_close(struct usb_serial_port *port, struct file *filp)static int serial_write (struct tty_struct *tty,const unsigned char *buf,int count) { -struct usb_serial_port *port = - (struct usb_serial_port *)tty->driver_data; +struct usb_serial_port *port = tty->driver_data;struct usb_serial *serial;int retval = -EINVAL ; -unsigned int UartNumber; -int from_user =0 ; +unsigned int index; serial =get_usb_serial (port, __func__);if (serial ==NULL )
@@ -1321,7 +1318,7 @@ static int serial_write(struct tty_struct *tty, const unsigned char *buf,/* This can happen if we get disconnected a */ if (port->open_count ==0 )return -ENODEV ; - UartNumber = port->tty->index - serial->minor; + index = tty->index - serial->minor;mydbg ("%s - port %d, %d byte(s)\n" , __func__, port->number, count);mydbg ("%s - port->RxHolding = %d\n" , __func__, port->RxHolding);
@@ -1331,19 +1328,19 @@ static int serial_write(struct tty_struct *tty, const unsigned char *buf, goto exit; } - retval =qt_write (port, from_user, buf, count); + retval =qt_write (tty, port, buf, count); exit:return retval; } -static int qt_write (struct usb_serial_port *port,int from_user, -const unsigned char *buf,int count) +static int qt_write (struct tty_struct *tty,struct usb_serial_port *port, +const unsigned char *buf,int count) {int result; -unsigned int UartNumber; - +unsigned int index;struct usb_serial *serial =get_usb_serial (port, __func__); +if (serial ==NULL )return -ENODEV ;
@@ -1354,7 +1351,7 @@ static int qt_write(struct usb_serial_port *port, int from_user,return 0 ; } - UartNumber = port->tty->index - serial->minor; + index = tty->index - serial->minor;/* only do something if we have a bulk out endpoint */ if (serial->num_bulk_out) {if (port->write_urb->status == -EINPROGRESS ) {
@@ -1364,14 +1361,7 @@ static int qt_write(struct usb_serial_port *port, int from_user, count = (count > port->bulk_out_size) ? port->bulk_out_size : count; - -if (from_user) { -if (copy_from_user - (port->write_urb->transfer_buffer, buf, count)) -return -EFAULT ; - }else { -memcpy (port->write_urb->transfer_buffer, buf, count); - } +memcpy (port->write_urb->transfer_buffer, buf, count);/* usb_serial_debug_data(__FILE__, __func__, count, port->write_urb->transfer_buffer); */
@@ -1449,8 +1439,7 @@ static void port_softint(struct work_struct *work) }static int serial_write_room (struct tty_struct *tty) { -struct usb_serial_port *port = - (struct usb_serial_port *)tty->driver_data; +struct usb_serial_port *port = tty->driver_data;struct usb_serial *serial =get_usb_serial (port, __func__);int retval = -EINVAL ;
@@ -1493,8 +1482,7 @@ static int qt_write_room(struct usb_serial_port *port) }static int serial_chars_in_buffer (struct tty_struct *tty) { -struct usb_serial_port *port = - (struct usb_serial_port *)tty->driver_data; +struct usb_serial_port *port = tty->driver_data;struct usb_serial *serial =get_usb_serial (port, __func__);int retval = -EINVAL ;
@@ -1537,17 +1525,16 @@ static int serial_tiocmset(struct tty_struct *tty, struct file *file, unsigned int set, unsigned int clear) { -struct usb_serial_port *port = - (struct usb_serial_port *)tty->driver_data; +struct usb_serial_port *port = tty->driver_data;struct usb_serial *serial =get_usb_serial (port, __func__);int retval = -ENODEV ; -unsigned int UartNumber; +unsigned int index;mydbg ("In %s \n" , __func__);if (!serial)return -ENODEV ; - UartNumber = port->tty->index - serial->minor; + index = tty->index - serial->minor;down (&port->sem);
@@ -1559,22 +1546,22 @@ static int serial_tiocmset(struct tty_struct *tty, struct file *file, goto exit; } - retval =qt_tiocmset (port, file, set); + retval =qt_tiocmset (tty, port, file, set); exit:up (&port->sem);return retval; } -static int qt_tiocmset (struct usb_serial_port *port,struct file *file, -unsigned int value) +static int qt_tiocmset (struct tty_struct *tty,struct usb_serial_port *port, +struct file *file,unsigned int value) { -__u8 MCR_Value; +u8 mcr;int status; -unsigned int UartNumber; - +unsigned int index;struct usb_serial *serial =get_usb_serial (port, __func__); +if (serial ==NULL )return -ENODEV ;
@@ -1583,10 +1570,10 @@ static int qt_tiocmset(struct usb_serial_port *port, struct file *file,/**************************************************************************************/ /** TIOCMGET */ - UartNumber = port->tty->index - serial->minor; + index = tty->index - serial->minor; status = -BoxGetRegister (port->serial, UartNumber,MODEM_CONTROL_REGISTER , - &MCR_Value); +BoxGetRegister (port->serial, index,MODEM_CONTROL_REGISTER , + &mcr);if (status <0 )return -ESPIPE ;
@@ -1594,17 +1581,17 @@ static int qt_tiocmset(struct usb_serial_port *port, struct file *file,* Turn off the RTS and DTR and loopbcck and then only turn on what was * asked for */ - MCR_Value &= ~(SERIAL_MCR_RTS |SERIAL_MCR_DTR |SERIAL_MCR_LOOP ); + mcr &= ~(SERIAL_MCR_RTS |SERIAL_MCR_DTR |SERIAL_MCR_LOOP );if (value &TIOCM_RTS ) - MCR_Value |=SERIAL_MCR_RTS ; + mcr |=SERIAL_MCR_RTS ;if (value &TIOCM_DTR ) - MCR_Value |=SERIAL_MCR_DTR ; + mcr |=SERIAL_MCR_DTR ;if (value &TIOCM_LOOP ) - MCR_Value |=SERIAL_MCR_LOOP ; + mcr |=SERIAL_MCR_LOOP ; status = -BoxSetRegister (port->serial, UartNumber,MODEM_CONTROL_REGISTER , - MCR_Value); +BoxSetRegister (port->serial, index,MODEM_CONTROL_REGISTER , + mcr);if (status <0 )return -ESPIPE ;else
@@ -1614,18 +1601,16 @@ static int qt_tiocmset(struct usb_serial_port *port, struct file *file,static int serial_tiocmget (struct tty_struct *tty,struct file *file) { -struct usb_serial_port *port = - (struct usb_serial_port *)tty->driver_data; - +struct usb_serial_port *port = tty->driver_data;struct usb_serial *serial =get_usb_serial (port, __func__);int retval = -ENODEV ; -unsigned int UartNumber; +unsigned int index;mydbg ("In %s \n" , __func__);if (!serial)return -ENODEV ; - UartNumber = port->tty->index - serial->minor; + index = tty->index - serial->minor;down (&port->sem);
@@ -1637,56 +1622,55 @@ static int serial_tiocmget(struct tty_struct *tty, struct file *file) goto exit; } - retval =qt_tiocmget (port, file); + retval =qt_tiocmget (tty, port, file); exit:up (&port->sem);return retval; } -static int qt_tiocmget (struct usb_serial_port *port,struct file *file) +static int qt_tiocmget (struct tty_struct *tty, +struct usb_serial_port *port,struct file *file) { -__u8 MCR_Value; -__u8 MSR_Value; +u8 mcr; +u8 msr;unsigned int result =0 ;int status; -unsigned int UartNumber; -struct tty_struct *tty; +unsigned int index;struct usb_serial *serial =get_usb_serial (port, __func__);if (serial ==NULL )return -ENODEV ; - tty = port->tty;mydbg ("%s - port %d, tty =0x%p\n" , __func__, port->number, tty);/**************************************************************************************/ /** TIOCMGET */ - UartNumber = port->tty->index - serial->minor; + index = tty->index - serial->minor; status = -BoxGetRegister (port->serial, UartNumber,MODEM_CONTROL_REGISTER , - &MCR_Value); +BoxGetRegister (port->serial, index,MODEM_CONTROL_REGISTER , + &mcr);if (status >=0 ) { status = -BoxGetRegister (port->serial, UartNumber, -MODEM_STATUS_REGISTER , &MSR_Value); +BoxGetRegister (port->serial, index, +MODEM_STATUS_REGISTER , &msr); }if (status >=0 ) { - result = ((MCR_Value &SERIAL_MCR_DTR ) ?TIOCM_DTR :0 ) + result = ((mcr &SERIAL_MCR_DTR ) ?TIOCM_DTR :0 )/* DTR IS SET */ - | ((MCR_Value &SERIAL_MCR_RTS ) ?TIOCM_RTS :0 ) + | ((mcr &SERIAL_MCR_RTS ) ?TIOCM_RTS :0 )/* RTS IS SET */ - | ((MSR_Value &SERIAL_MSR_CTS ) ?TIOCM_CTS :0 ) + | ((msr &SERIAL_MSR_CTS ) ?TIOCM_CTS :0 )/* CTS is set */ - | ((MSR_Value &SERIAL_MSR_CD ) ?TIOCM_CAR :0 ) + | ((msr &SERIAL_MSR_CD ) ?TIOCM_CAR :0 )/* Carrier detect is set */ - | ((MSR_Value &SERIAL_MSR_RI ) ?TIOCM_RI :0 ) + | ((msr &SERIAL_MSR_RI ) ?TIOCM_RI :0 )/* Ring indicator set */ - | ((MSR_Value &SERIAL_MSR_DSR ) ?TIOCM_DSR :0 ); + | ((msr &SERIAL_MSR_DSR ) ?TIOCM_DSR :0 );/* DSR is set */ return result;
@@ -1698,17 +1682,16 @@ static int serial_ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg) { -struct usb_serial_port *port = - (struct usb_serial_port *)tty->driver_data; +struct usb_serial_port *port = tty->driver_data;struct usb_serial *serial =get_usb_serial (port, __func__);int retval = -ENODEV ; -unsigned int UartNumber; +unsigned int index;mydbg ("In %s \n" , __func__);if (!serial)return -ENODEV ; - UartNumber = port->tty->index - serial->minor; + index = tty->index - serial->minor;down (&port->sem);
@@ -1720,125 +1703,34 @@ static int serial_ioctl(struct tty_struct *tty, struct file *file, goto exit; } - retval =qt_ioctl (port, file, cmd, arg); + retval =qt_ioctl (tty, port, file, cmd, arg); exit:up (&port->sem);return retval; } -static int qt_ioctl (struct usb_serial_port *port,struct file *file, -unsigned int cmd,unsigned long arg) +static int qt_ioctl (struct tty_struct *tty,struct usb_serial_port *port, +struct file *file,unsigned int cmd,unsigned long arg) { -__u8 MCR_Value; -__u8 MSR_Value; -unsigned short Prev_MSR_Value; +__u8 mcr; +__u8 msr; +unsigned short prev_msr;unsigned int value, result =0 ;int status; -unsigned int UartNumber; -struct tty_struct *tty; +unsigned int index;struct usb_serial *serial =get_usb_serial (port, __func__);if (serial ==NULL )return -ENODEV ; - tty = port->tty;mydbg ("%s - port %d, tty =0x%p\n" , __func__, port->number, tty);/* TIOCMGET */ - UartNumber = port->tty->index - serial->minor; - -if (cmd ==TIOCMGET ) { - MCR_Value = port->shadowMCR; - MSR_Value = port->shadowMSR; - - { - result = ((MCR_Value &SERIAL_MCR_DTR ) ?TIOCM_DTR :0 ) -/* DTR IS SET */ - | ((MCR_Value &SERIAL_MCR_RTS ) ?TIOCM_RTS :0 ) -/* RTS IS SET */ - | ((MSR_Value &SERIAL_MSR_CTS ) ?TIOCM_CTS :0 ) -/* CTS is set */ - | ((MSR_Value &SERIAL_MSR_CD ) ?TIOCM_CAR :0 ) -/* Carrier detect is set */ - | ((MSR_Value &SERIAL_MSR_RI ) ?TIOCM_RI :0 ) -/* Ring indicator set */ - | ((MSR_Value &SERIAL_MSR_DSR ) ?TIOCM_DSR :0 ); -/* DSR is set */ -if (copy_to_user - ((unsigned int *)arg, &result, -sizeof (unsigned int ))) -return -EFAULT ; -return 0 ; - - } - } - -/* TIOCMBIS, TIOCMBIC, AND TIOCMSET */ -if (cmd ==TIOCMBIS || cmd ==TIOCMBIC || cmd ==TIOCMSET ) { - status = -BoxGetRegister (port->serial, UartNumber, -MODEM_CONTROL_REGISTER , &MCR_Value); -if (status <0 ) -return -ESPIPE ; -if (copy_from_user - (&value, (unsigned int *)arg,sizeof (unsigned int ))) -return -EFAULT ; - -switch (cmd) { -case TIOCMBIS : -if (value &TIOCM_RTS ) - MCR_Value |=SERIAL_MCR_RTS ; -if (value &TIOCM_DTR ) - MCR_Value |=SERIAL_MCR_DTR ; -if (value &TIOCM_LOOP ) - MCR_Value |=SERIAL_MCR_LOOP ; -break ; -case TIOCMBIC : -if (value &TIOCM_RTS ) - MCR_Value &= ~SERIAL_MCR_RTS ; -if (value &TIOCM_DTR ) - MCR_Value &= ~SERIAL_MCR_DTR ; -if (value &TIOCM_LOOP ) - MCR_Value &= ~SERIAL_MCR_LOOP ; -break ; -case TIOCMSET : -/* -* Turn off the RTS and DTR and loopbcck and then only -* turn on what was asked for -*/ - MCR_Value &= - ~(SERIAL_MCR_RTS |SERIAL_MCR_DTR | -SERIAL_MCR_LOOP ); -if (value &TIOCM_RTS ) - MCR_Value |=SERIAL_MCR_RTS ; -if (value &TIOCM_DTR ) - MCR_Value |=SERIAL_MCR_DTR ; -if (value &TIOCM_LOOP ) - MCR_Value |=SERIAL_MCR_LOOP ; -break ; -default : -break ; - - } - status = -BoxSetRegister (port->serial, UartNumber, -MODEM_CONTROL_REGISTER , MCR_Value); -if (status <0 ) -return -ESPIPE ; -else { - port->shadowMCR = MCR_Value; -return 0 ; - } - - } -/**************************************************************************************/ -/** TIOCMBIS, TIOCMBIC, AND TIOCMSET end -*/ -/**************************************************************************************/ + index = tty->index - serial->minor;if (cmd ==TIOCMIWAIT ) {DECLARE_WAITQUEUE (wait, current); - Prev_MSR_Value = port->shadowMSR &SERIAL_MSR_MASK ; + prev_msr = port->shadowMSR &SERIAL_MSR_MASK ;while (1 ) {add_wait_queue (&port->wait, &wait);set_current_state (TASK_INTERRUPTIBLE );
@@ -1847,22 +1739,22 @@ static int qt_ioctl(struct usb_serial_port *port, struct file *file,/* see if a signal woke us up */ if (signal_pending (current))return -ERESTARTSYS ; - MSR_Value = port->shadowMSR &SERIAL_MSR_MASK ; -if (MSR_Value == Prev_MSR_Value) + msr = port->shadowMSR &SERIAL_MSR_MASK ; +if (msr == prev_msr)return -EIO ;/* no change error */ if ((arg &TIOCM_RNG - && ((Prev_MSR_Value &SERIAL_MSR_RI ) == - (MSR_Value &SERIAL_MSR_RI ))) + && ((prev_msr &SERIAL_MSR_RI ) == + (msr &SERIAL_MSR_RI ))) || (arg &TIOCM_DSR - && ((Prev_MSR_Value &SERIAL_MSR_DSR ) == - (MSR_Value &SERIAL_MSR_DSR ))) + && ((prev_msr &SERIAL_MSR_DSR ) == + (msr &SERIAL_MSR_DSR ))) || (arg &TIOCM_CD - && ((Prev_MSR_Value &SERIAL_MSR_CD ) == - (MSR_Value &SERIAL_MSR_CD ))) + && ((prev_msr &SERIAL_MSR_CD ) == + (msr &SERIAL_MSR_CD ))) || (arg &TIOCM_CTS - && ((Prev_MSR_Value &SERIAL_MSR_CTS ) == - (MSR_Value &SERIAL_MSR_CTS )))) { + && ((prev_msr &SERIAL_MSR_CTS ) == + (msr &SERIAL_MSR_CTS )))) {return 0 ; }
@@ -1878,7 +1770,7 @@ static int qt_ioctl(struct usb_serial_port *port, struct file *file,static void serial_set_termios (struct tty_struct *tty,struct ktermios *old) {struct usb_serial_port *port = - (struct usb_serial_port *)tty->driver_data; + tty->driver_data;struct usb_serial *serial =get_usb_serial (port, __func__);if (!serial)
@@ -1894,22 +1786,22 @@ static void serial_set_termios(struct tty_struct *tty, struct ktermios *old) }/* pass on to the driver specific version of this function if it is available */ -qt_set_termios (port, old); +qt_set_termios (tty, port, old); exit:up (&port->sem); } -static void qt_set_termios (struct usb_serial_port *port, +static void qt_set_termios (struct tty_struct *tty, +struct usb_serial_port *port,struct ktermios *old_termios) {unsigned int cflag;int baud, divisor, remainder; -unsigned char LCR_change_to =0 ; -struct tty_struct *tty; +unsigned char new_LCR =0 ;int status;struct usb_serial *serial; -__u16 UartNumber; +__u16 index;__u16 tmp, tmp2;mydbg ("%s - port %d\n" , __func__, port->number);
@@ -1921,59 +1813,46 @@ static void qt_set_termios(struct usb_serial_port *port, tmp2 = serial->minor;mydbg ("%s - serial->minor = %d\n" , __func__, tmp2); - UartNumber = port->tty->index - serial->minor; - - tty = port->tty; + index = port->tty->index - serial->minor; cflag = tty->termios->c_cflag; -if (old_termios) { -if ((cflag == old_termios->c_cflag) - && (RELEVANT_IFLAG (tty->termios->c_iflag) == -RELEVANT_IFLAG (old_termios->c_iflag))) { -mydbg ("%s - Nothing to change\n" , __func__); -return ; - } - - } -mydbg ("%s - 3\n" , __func__);switch (cflag) {case CS5 : - LCR_change_to |=SERIAL_5_DATA ; + new_LCR |=SERIAL_5_DATA ;break ;case CS6 : - LCR_change_to |=SERIAL_6_DATA ; + new_LCR |=SERIAL_6_DATA ;break ;case CS7 : - LCR_change_to |=SERIAL_7_DATA ; + new_LCR |=SERIAL_7_DATA ;break ;default :case CS8 : - LCR_change_to |=SERIAL_8_DATA ; + new_LCR |=SERIAL_8_DATA ;break ; }/* Parity stuff */ if (cflag &PARENB ) {if (cflag &PARODD ) - LCR_change_to |=SERIAL_ODD_PARITY ; + new_LCR |=SERIAL_ODD_PARITY ;else - LCR_change_to |=SERIAL_EVEN_PARITY ; + new_LCR |=SERIAL_EVEN_PARITY ; }if (cflag &CSTOPB ) - LCR_change_to |=SERIAL_TWO_STOPB ; + new_LCR |=SERIAL_TWO_STOPB ;else - LCR_change_to |=SERIAL_TWO_STOPB ; + new_LCR |=SERIAL_TWO_STOPB ;mydbg ("%s - 4\n" , __func__);/* Thats the LCR stuff, go ahead and set it */ baud =tty_get_baud_rate (tty); -if (!baud) { +if (!baud)/* pick a default, any default... */ baud =9600 ; - }mydbg ("%s - got baud = %d\n" , __func__, baud);
@@ -1986,9 +1865,7 @@ static void qt_set_termios(struct usb_serial_port *port,/* * Set Baud rate to default and turn off (default)flow control here */ - status = -BoxSetUart (serial, UartNumber, (unsigned short )divisor, - LCR_change_to); + status =BoxSetUart (serial, index, (unsigned short )divisor, new_LCR);if (status <0 ) {mydbg (__FILE__"BoxSetUart failed\n" );return ;
@@ -2000,7 +1877,7 @@ static void qt_set_termios(struct usb_serial_port *port, port->number);/* Enable RTS/CTS flow control */ - status =BoxSetHW_FlowCtrl (serial, UartNumber,1 ); + status =BoxSetHW_FlowCtrl (serial, index,1 );if (status <0 ) {mydbg (__FILE__"BoxSetHW_FlowCtrl failed\n" );
@@ -2011,7 +1888,7 @@ static void qt_set_termios(struct usb_serial_port *port,mydbg ("%s - disabling HW flow control port %d\n" , __func__, port->number); - status =BoxSetHW_FlowCtrl (serial, UartNumber,0 ); + status =BoxSetHW_FlowCtrl (serial, index,0 );if (status <0 ) {mydbg (__FILE__"BoxSetHW_FlowCtrl failed\n" );return ;
@@ -2025,19 +1902,20 @@ static void qt_set_termios(struct usb_serial_port *port,unsigned char stop_char =STOP_CHAR (tty);unsigned char start_char =START_CHAR (tty); status = -BoxSetSW_FlowCtrl (serial, UartNumber, stop_char, +BoxSetSW_FlowCtrl (serial, index, stop_char, start_char);if (status <0 )mydbg (__FILE__"BoxSetSW_FlowCtrl (enabled) failed\n" ); }else {/* disable SW flow control */ - status =BoxDisable_SW_FlowCtrl (serial, UartNumber); + status =BoxDisable_SW_FlowCtrl (serial, index);if (status <0 )mydbg (__FILE__"BoxSetSW_FlowCtrl (diabling) failed\n" ); } - + tty->termios->c_cflag &= ~CMSPAR ; +/* FIXME: Error cases should be returning the actual bits changed only */ }/****************************************************************************
@@ -2237,11 +2115,11 @@ static int BoxSetUart(struct usb_serial *serial, unsigned short Uart_Number,return result; } -static int BoxSetHW_FlowCtrl (struct usb_serial *serial,unsigned int UartNumber, +static int BoxSetHW_FlowCtrl (struct usb_serial *serial,unsigned int index,int bSet) { -__u8 MCR_Value =0 ; -__u8 MSR_Value =0 , MOUT_Value =0 ; +__u8 mcr =0 ; +__u8 msr =0 , MOUT_Value =0 ;struct usb_serial_port *port;unsigned int status;
@@ -2249,34 +2127,34 @@ static int BoxSetHW_FlowCtrl(struct usb_serial *serial, unsigned int UartNumber,if (bSet ==1 ) {/* flow control, box will clear RTS line to prevent remote */ - MCR_Value =SERIAL_MCR_RTS ; + mcr =SERIAL_MCR_RTS ; }/* device from xmitting more chars */ else {/* no flow control to remote device */ - MCR_Value =0 ; + mcr =0 ; } - MOUT_Value = MCR_Value <<8 ; + MOUT_Value = mcr <<8 ;if (bSet ==1 ) {/* flow control, box will inhibit xmit data if CTS line is * asserted */ - MSR_Value =SERIAL_MSR_CTS ; + msr =SERIAL_MSR_CTS ; }else {/* Box will not inhimbe xmit data due to CTS line */ - MSR_Value =0 ; + msr =0 ; } - MOUT_Value |= MSR_Value; + MOUT_Value |= msr; status =usb_control_msg (serial->dev,usb_sndctrlpipe (serial->dev,0 ),QT_HW_FLOW_CONTROL_MASK ,0x40 , MOUT_Value, - UartNumber,NULL ,0 ,300 ); + index,NULL ,0 ,300 );return status; } -static int BoxSetSW_FlowCtrl (struct usb_serial *serial,__u16 UartNumber, +static int BoxSetSW_FlowCtrl (struct usb_serial *serial,__u16 index,unsigned char stop_char,unsigned char start_char) {__u16 nSWflowout;
@@ -2288,17 +2166,17 @@ static int BoxSetSW_FlowCtrl(struct usb_serial *serial, __u16 UartNumber, result =usb_control_msg (serial->dev,usb_sndctrlpipe (serial->dev,0 ),QT_SW_FLOW_CONTROL_MASK ,0x40 , nSWflowout, - UartNumber,NULL ,0 ,300 ); + index,NULL ,0 ,300 );return result; } -static int BoxDisable_SW_FlowCtrl (struct usb_serial *serial,__u16 UartNumber) +static int BoxDisable_SW_FlowCtrl (struct usb_serial *serial,__u16 index) {int result; result =usb_control_msg (serial->dev,usb_sndctrlpipe (serial->dev,0 ), -QT_SW_FLOW_CONTROL_DISABLE ,0x40 ,0 , UartNumber, +QT_SW_FLOW_CONTROL_DISABLE ,0x40 ,0 , index,NULL ,0 ,300 );return result;
@@ -2307,7 +2185,7 @@ static int BoxDisable_SW_FlowCtrl(struct usb_serial *serial, __u16 UartNumber)static void serial_throttle (struct tty_struct *tty) {struct usb_serial_port *port = - (struct usb_serial_port *)tty->driver_data; + tty->driver_data;struct usb_serial *serial =get_usb_serial (port, __func__);mydbg ("%s - port %d\n" , __func__, port->number);
@@ -2334,7 +2212,7 @@ exit:static void serial_unthrottle (struct tty_struct *tty) {struct usb_serial_port *port = - (struct usb_serial_port *)tty->driver_data; + tty->driver_data;struct usb_serial *serial =get_usb_serial (port, __func__);unsigned int result;
@@ -2380,20 +2258,19 @@ exit:static int serial_break (struct tty_struct *tty,int break_state) { -struct usb_serial_port *port = - (struct usb_serial_port *)tty->driver_data; +struct usb_serial_port *port = tty->driver_data;struct usb_serial *serial =get_usb_serial (port, __func__); -__u16 UartNumber, Break_Value; +u16 index, onoff;unsigned int result; - UartNumber = port->tty->index - serial->minor; + index = tty->index - serial->minor;if (!serial)return -ENODEV ;if (break_state ==-1 ) - Break_Value =1 ; + onoff =1 ;else - Break_Value =0 ; + onoff =0 ;down (&port->sem);
@@ -2406,7 +2283,7 @@ static int serial_break(struct tty_struct *tty, int break_state) result =usb_control_msg (serial->dev,usb_sndctrlpipe (serial->dev,0 ), -QT_BREAK_CONTROL ,0x40 , Break_Value, UartNumber, +QT_BREAK_CONTROL ,0x40 , onoff, index,NULL ,0 ,300 ); exit:
PATCH 4/11 lanana: assign a device name and numbering for MAX3100
In reply to Alan CoxThis is a low density serial port so needs a real major/minor
---
Documentation/devices.txt | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
Documentation/devices.txt +4 -0
@@ -2797,6 +2797,10 @@ Your cooperation is appreciated. 206 = /dev/ttySC1 SC26xx serial port 1 207 = /dev/ttySC2 SC26xx serial port 2 208 = /dev/ttySC3 SC26xx serial port 3 + 209 = /dev/ttyMAX0 MAX3100 serial port 0 + 210 = /dev/ttyMAX1 MAX3100 serial port 1 + 211 = /dev/ttyMAX2 MAX3100 serial port 2 + 212 = /dev/ttyMAX3 MAX3100 serial port 3 205 char Low-density serial ports (alternate device) 0 = /dev/culu0 Callout device for ttyLU0
PATCH 5/11 Add support for the MAX3100 SPI UART.
In reply to Alan CoxFrom: Christian Pellegrin <[email protected]>
(akpm: queued pending confirmation of the new major number)
---
drivers/serial/Kconfig | 7 +++++++ drivers/serial/Makefile | 1 + include/linux/serial_core.h | 3 +++ 3 files changed, 11 insertions(+), 0 deletions(-)
drivers/serial/Kconfig +7 -0
@@ -533,6 +533,13 @@ config SERIAL_S3C6400 Serial port support for the Samsung S3C6400 and S3C6410 SoCs +config SERIAL_MAX3100 + tristate "MAX3100 support" + depends on SPI + select SERIAL_CORE + help + MAX3100 chip support + config SERIAL_DZ bool "DECstation DZ serial driver" depends on MACH_DECSTATION && 32BIT
drivers/serial/Makefile +1 -0
@@ -43,6 +43,7 @@ obj-$(CONFIG_SERIAL_S3C2412) += s3c2412.o obj-$(CONFIG_SERIAL_S3C2440) += s3c2440.o obj-$(CONFIG_SERIAL_S3C24A0) += s3c24a0.o obj-$(CONFIG_SERIAL_S3C6400) += s3c6400.o +obj-$(CONFIG_SERIAL_MAX3100) += max3100.o obj-$(CONFIG_SERIAL_IP22_ZILOG) += ip22zilog.o obj-$(CONFIG_SERIAL_MUX) += mux.o obj-$(CONFIG_SERIAL_68328) += 68328serial.o
include/linux/serial_core.h +3 -0
@@ -164,6 +164,9 @@/* NWPSERIAL */ #define PORT_NWPSERIAL 85 +/* MAX3100 */ +#define PORT_MAX3100 86 +#ifdef __KERNEL__#include <linux/compiler.h>
[-rc1, build bug] Re: [PATCH 05/11] Add support for the MAX3100 SPI UART.
Quoted 8 lines · Alan Cox
From: Christian Pellegrin <[email protected]>
(akpm: queued pending confirmation of the new major number)
[[email protected]: select SERIAL_CORE]Signed-off-by Christian Pellegrin <[email protected]>Signed-off-by Andrew Morton <[email protected]>Signed-off-by Alan Cox <[email protected]>
Quoted 6 lines
---
drivers/serial/Kconfig | 7 +++++++ drivers/serial/Makefile | 1 + include/linux/serial_core.h | 3 +++ 3 files changed, 11 insertions(+), 0 deletions(-)
This is now upstream as:
1dcb884: Add support for the MAX3100 SPI UART.
i'm not sure whether it has been reported already, but the new driver does not even build:
CHK include/linux/compile.h
make[2]: *** No rule to make target drivers/serial/max3100.o', needed by drivers/serial/built-in.o'. Stop. make[1]: *** [drivers/serial] Error 2
make[1]: *** Waiting for unfinished jobs....
... and it has no chance to build, because the commit adds no max3100.c driver file, at all.
The straight revert of 1dcb884 got the build going.
Ingo
Re: [-rc1, build bug] Re: [PATCH 05/11] Add support for the MAX3100 SPI UART.
Quoted 21 lines · Ingo Molnar
Quoted 8 lines · Alan Cox
From: Christian Pellegrin <[email protected]>
(akpm: queued pending confirmation of the new major number)
[[email protected]: select SERIAL_CORE]Signed-off-by Christian Pellegrin <[email protected]>Signed-off-by Andrew Morton <[email protected]>Signed-off-by Alan Cox <[email protected]>Quoted 6 lines
---
drivers/serial/Kconfig | 7 +++++++ drivers/serial/Makefile | 1 + include/linux/serial_core.h | 3 +++ 3 files changed, 11 insertions(+), 0 deletions(-)This is now upstream as:
1dcb884: Add support for the MAX3100 SPI UART.
Quoted 7 lines
i'm not sure whether it has been reported already, but the new driver does not even build:
CHK
include/linux/compile.h
make[2]: *** No rule to make targetdrivers/serial/max3100.o', needed bydrivers/serial/built-in.o'. Stop. make[1]: *** [drivers/serial] Error 2
make[1]: *** Waiting for unfinished jobs....
I hit the same build error just now...
Quoted 14 lines
... and it has no chance to build, because the commit adds no
max3100.cdriver file, at all.The straight revert of 1dcb884 got the build going.
Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Signature · 2 lines
Regards Yang Hongyang
Re: [-rc1, build bug] Re: [PATCH 05/11] Add support for the MAX3100 SPI UART.
Quoted 6 lines
Quoted 4 lines
CHK
include/linux/compile.h
make[2]: *** No rule to make targetdrivers/serial/max3100.o', needed bydrivers/serial/built-in.o'. Stop. make[1]: *** [drivers/serial] Error 2
make[1]: *** Waiting for unfinished jobs....I hit the same build error just now...
I'll take a look - but yes I did build it here so I'm not sure what is up right now.
Re: [-rc1, build bug] Re: [PATCH 05/11] Add support for the MAX3100 SPI UART.
From: Alan Cox <[email protected]>
Date: Wed, 8 Apr 2009 11:24:56 +0100
Quoted 9 lines
Quoted 6 lines
Quoted 4 lines
CHK
include/linux/compile.h
make[2]: *** No rule to make targetdrivers/serial/max3100.o', needed bydrivers/serial/built-in.o'. Stop. make[1]: *** [drivers/serial] Error 2
make[1]: *** Waiting for unfinished jobs....I hit the same build error just now...
I'll take a look - but yes I did build it here so I'm not sure what is up right now.
Missing "git add", or something like that, for sure.
[-rc1, build bug] Re: [PATCH 05/11] Add support for the MAX3100 SPI UART.
In reply to Ingo MolnarThis patch adds files that were missing from 2.6.30-rc1:
max3100.c and serial_max3100.h are taken from max3100-spi-uart-driver.patch in 2.6.28-rc2-mm1
max3100-spi-uart-driver-fix.patch from 2.6.28-rc2-mm1 is applied
the assigned major/minor number is changed to 204/209 according to Documentation/devices.txt
I tested just the compilation and checkpatch.pl since I still have to port 2.6.30-rc1 to my ARM board.
--- drivers/serial/max3100.c | 927 ++++++++++++++++++++++++++++++++++++++++ include/linux/serial_core.h | 3 + include/linux/serial_max3100.h | 53 +++ 3 files changed, 983 insertions(+), 0 deletions(-) create mode 100644 drivers/serial/max3100.c create mode 100644 include/linux/serial_max3100.h
drivers/serial/max3100.c new file +927 -0
@@ -0,0 +1,927 @@ +/* +* +* Copyright (C) 2008 Christian Pellegrin <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* +* Notes: the MAX3100 doesn't provide an interrupt on CTS so we have +* to use polling for flow control. TX empty IRQ is unusable, since +* writing conf clears FIFO buffer and we cannot have this interrupt +* always asking us for attention. +* +* Example platform data: + +static struct plat_max3100 max3100_plat_data = { +.loopback = 0, +.crystal = 0, +.poll_time = 100, +}; + +static struct spi_board_info spi_board_info[] = { +{ +.modalias = "max3100", +.platform_data = &max3100_plat_data, +.irq = IRQ_EINT12, +.max_speed_hz = 5*1000*1000, +.chip_select = 0, +}, +}; + +* The initial minor number is 209 in the low-density serial port: +* mknod /dev/ttyMAX0 c 204 209 +*/ + +#define MAX3100_MAJOR 204 +#define MAX3100_MINOR 209 +/* 4 MAX3100s should be enough for everyone */ +#define MAX_MAX3100 4 + +#include <linux/delay.h> +#include <linux/device.h> +#include <linux/serial_core.h> +#include <linux/serial.h> +#include <linux/spi/spi.h> +#include <linux/freezer.h> + +#include <linux/serial_max3100.h> + +#define MAX3100_C (1<<14) +#define MAX3100_D (0<<14) +#define MAX3100_W (1<<15) +#define MAX3100_RX (0<<15) + +#define MAX3100_WC (MAX3100_W | MAX3100_C) +#define MAX3100_RC (MAX3100_RX | MAX3100_C) +#define MAX3100_WD (MAX3100_W | MAX3100_D) +#define MAX3100_RD (MAX3100_RX | MAX3100_D) +#define MAX3100_CMD (3 << 14) + +#define MAX3100_T (1<<14) +#define MAX3100_R (1<<15) + +#define MAX3100_FEN (1<<13) +#define MAX3100_SHDN (1<<12) +#define MAX3100_TM (1<<11) +#define MAX3100_RM (1<<10) +#define MAX3100_PM (1<<9) +#define MAX3100_RAM (1<<8) +#define MAX3100_IR (1<<7) +#define MAX3100_ST (1<<6) +#define MAX3100_PE (1<<5) +#define MAX3100_L (1<<4) +#define MAX3100_BAUD (0xf) + +#define MAX3100_TE (1<<10) +#define MAX3100_RAFE (1<<10) +#define MAX3100_RTS (1<<9) +#define MAX3100_CTS (1<<9) +#define MAX3100_PT (1<<8) +#define MAX3100_DATA (0xff) + +#define MAX3100_RT (MAX3100_R | MAX3100_T) +#define MAX3100_RTC (MAX3100_RT | MAX3100_CTS | MAX3100_RAFE) + +/* the following simulate a status reg for ignore_status_mask */ +#define MAX3100_STATUS_PE 1 +#define MAX3100_STATUS_FE 2 +#define MAX3100_STATUS_OE 4 + +struct max3100_port { +struct uart_port port; +struct spi_device *spi; + +int cts;/* last CTS received for flow ctrl */ +int tx_empty;/* last TX empty bit */ + +spinlock_t conf_lock;/* shared data */ +int conf_commit;/* need to make changes */ +int conf;/* configuration for the MAX31000 +* (bits 0-7, bits 8-11 are irqs) */ +int rts_commit;/* need to change rts */ +int rts;/* rts status */ +int baud;/* current baud rate */ + +int parity;/* keeps track if we should send parity */ +#define MAX3100_PARITY_ON 1 +#define MAX3100_PARITY_ODD 2 +#define MAX3100_7BIT 4 +int rx_enabled;/* if we should rx chars */ + +int irq;/* irq assigned to the max3100 */ + +int minor;/* minor number */ +int crystal;/* 1 if 3.6864Mhz crystal 0 for 1.8432 */ +int loopback;/* 1 if we are in loopback mode */ + +/* for handling irqs: need workqueue since we do spi_sync */ +struct workqueue_struct *workqueue; +struct work_struct work; +/* set to 1 to make the workhandler exit as soon as possible */ +int force_end_work; +/* need to know we are suspending to avoid deadlock on workqueue */ +int suspending; + +/* hook for suspending MAX3100 via dedicated pin */ +void (*max3100_hw_suspend) (int suspend); + +/* poll time (in ms) for ctrl lines */ +int poll_time; +/* and its timer */ +struct timer_list timer; +}; + +static struct max3100_port *max3100s[MAX_MAX3100 ];/* the chips */ +static DEFINE_MUTEX (max3100s_lock);/* race on probe */ + +static int max3100_do_parity (struct max3100_port *s,u16 c) +{ +int parity; + +if (s->parity &MAX3100_PARITY_ODD ) + parity =1 ; +else + parity =0 ; + +if (s->parity &MAX3100_7BIT ) + c &=0x7f ; +else + c &=0xff ; + + parity = parity ^ (hweight8 (c) &1 ); +return parity; +} + +static int max3100_check_parity (struct max3100_port *s,u16 c) +{ +return max3100_do_parity (s, c) == ((c >>8 ) &1 ); +} + +static void max3100_calc_parity (struct max3100_port *s,u16 *c) +{ +if (s->parity &MAX3100_7BIT ) + *c &=0x7f ; +else + *c &=0xff ; + +if (s->parity &MAX3100_PARITY_ON ) + *c |=max3100_do_parity (s, *c) <<8 ; +} + +static void max3100_work (struct work_struct *w); + +static void max3100_dowork (struct max3100_port *s) +{ +if (!s->force_end_work && !work_pending (&s->work) && + !freezing (current) && !s->suspending) +queue_work (s->workqueue, &s->work); +} + +static void max3100_timeout (unsigned long data) +{ +struct max3100_port *s = (struct max3100_port *)data; + +if (s->port.info) { +max3100_dowork (s); +mod_timer (&s->timer, jiffies + s->poll_time); + } +} + +static int max3100_sr (struct max3100_port *s,u16 tx,u16 *rx) +{ +struct spi_message message; +u16 etx, erx; +int status; +struct spi_transfer tran = { + .tx_buf = &etx, + .rx_buf = &erx, + .len =2 , + }; + + etx =cpu_to_be16 (tx); +spi_message_init (&message); +spi_message_add_tail (&tran, &message); + status =spi_sync (s->spi, &message); +if (status) { +dev_warn (&s->spi->dev,"error while calling spi_sync\n" ); +return -EIO ; + } + *rx =be16_to_cpu (erx); + s->tx_empty = (*rx &MAX3100_T ) >0 ; +dev_dbg (&s->spi->dev,"%04x - %04x\n" , tx, *rx); +return 0 ; +} + +static int max3100_handlerx (struct max3100_port *s,u16 rx) +{ +unsigned int ch, flg, status =0 ; +int ret =0 , cts; + +if (rx &MAX3100_R && s->rx_enabled) { +dev_dbg (&s->spi->dev,"%s\n" , __func__); + ch = rx & (s->parity &MAX3100_7BIT ?0x7f :0xff ); +if (rx &MAX3100_RAFE ) { + s->port.icount.frame++; + flg =TTY_FRAME ; + status |=MAX3100_STATUS_FE ; + }else { +if (s->parity &MAX3100_PARITY_ON ) { +if (max3100_check_parity (s, rx)) { + s->port.icount.rx++; + flg =TTY_NORMAL ; + }else { + s->port.icount.parity++; + flg =TTY_PARITY ; + status |=MAX3100_STATUS_PE ; + } + }else { + s->port.icount.rx++; + flg =TTY_NORMAL ; + } + } +uart_insert_char (&s->port, status,MAX3100_STATUS_OE , ch, flg); + ret =1 ; + } + + cts = (rx &MAX3100_CTS ) >0 ; +if (s->cts != cts) { + s->cts = cts; +uart_handle_cts_change (&s->port, cts ?TIOCM_CTS :0 ); + } + +return ret; +} + +static void max3100_work (struct work_struct *w) +{ + struct max3100_port *s = container_of(w, struct max3100_port, work); +int rxchars; +u16 tx, rx; +int conf, cconf, rts, crts; +struct circ_buf *xmit = &s->port.info->xmit; + +dev_dbg (&s->spi->dev,"%s\n" , __func__); + + rxchars =0 ; +do { +spin_lock (&s->conf_lock); + conf = s->conf; + cconf = s->conf_commit; + s->conf_commit =0 ; + rts = s->rts; + crts = s->rts_commit; + s->rts_commit =0 ; +spin_unlock (&s->conf_lock); +if (cconf) +max3100_sr (s,MAX3100_WC | conf, &rx); +if (crts) { +max3100_sr (s,MAX3100_WD |MAX3100_TE | + (s->rts ?MAX3100_RTS :0 ), &rx); + rxchars +=max3100_handlerx (s, rx); + } + +max3100_sr (s,MAX3100_RD , &rx); + rxchars +=max3100_handlerx (s, rx); + +if (rx &MAX3100_T ) { + tx =0xffff ; +if (s->port.x_char) { + tx = s->port.x_char; + s->port.icount.tx++; + s->port.x_char =0 ; + }else if (!uart_circ_empty (xmit) && + !uart_tx_stopped (&s->port)) { + tx = xmit->buf[xmit->tail]; + xmit->tail = (xmit->tail +1 ) & + (UART_XMIT_SIZE -1 ); + s->port.icount.tx++; + } +if (tx !=0xffff ) { +max3100_calc_parity (s, &tx); + tx |=MAX3100_WD | (s->rts ?MAX3100_RTS :0 ); +max3100_sr (s, tx, &rx); + rxchars +=max3100_handlerx (s, rx); + } + } + +if (rxchars >16 && s->port.info->port.tty !=NULL ) { +tty_flip_buffer_push (s->port.info->port.tty); + rxchars =0 ; + } +if (uart_circ_chars_pending (xmit) <WAKEUP_CHARS ) +uart_write_wakeup (&s->port); + + }while (!s->force_end_work && + !freezing (current) && + ((rx &MAX3100_R ) || + (!uart_circ_empty (xmit) && + !uart_tx_stopped (&s->port)))); + +if (rxchars >0 && s->port.info->port.tty !=NULL ) +tty_flip_buffer_push (s->port.info->port.tty); +} + +static irqreturn_t max3100_irq (int irqno,void *dev_id) +{ +struct max3100_port *s = dev_id; + +dev_dbg (&s->spi->dev,"%s\n" , __func__); + +max3100_dowork (s); +return IRQ_HANDLED ; +} + +static void max3100_enable_ms (struct uart_port *port) +{ +struct max3100_port *s =container_of (port, + struct max3100_port, + port); + +if (s->poll_time >0 ) +mod_timer (&s->timer, jiffies); +dev_dbg (&s->spi->dev,"%s\n" , __func__); +} + +static void max3100_start_tx (struct uart_port *port) +{ +struct max3100_port *s =container_of (port, + struct max3100_port, + port); + +dev_dbg (&s->spi->dev,"%s\n" , __func__); + +max3100_dowork (s); +} + +static void max3100_stop_rx (struct uart_port *port) +{ +struct max3100_port *s =container_of (port, + struct max3100_port, + port); + +dev_dbg (&s->spi->dev,"%s\n" , __func__); + + s->rx_enabled =0 ; +spin_lock (&s->conf_lock); + s->conf &= ~MAX3100_RM ; + s->conf_commit =1 ; +spin_unlock (&s->conf_lock); +max3100_dowork (s); +} + +static unsigned int max3100_tx_empty (struct uart_port *port) +{ +struct max3100_port *s =container_of (port, + struct max3100_port, + port); + +dev_dbg (&s->spi->dev,"%s\n" , __func__); + +/* may not be truly up-to-date */ +max3100_dowork (s); +return s->tx_empty; +} + +static unsigned int max3100_get_mctrl (struct uart_port *port) +{ +struct max3100_port *s =container_of (port, + struct max3100_port, + port); + +dev_dbg (&s->spi->dev,"%s\n" , __func__); + +/* may not be truly up-to-date */ +max3100_dowork (s); +/* always assert DCD and DSR since these lines are not wired */ +return (s->cts ?TIOCM_CTS :0 ) |TIOCM_DSR |TIOCM_CAR ; +} + +static void max3100_set_mctrl (struct uart_port *port,unsigned int mctrl) +{ +struct max3100_port *s =container_of (port, + struct max3100_port, + port); +int rts; + +dev_dbg (&s->spi->dev,"%s\n" , __func__); + + rts = (mctrl &TIOCM_RTS ) >0 ; + +spin_lock (&s->conf_lock); +if (s->rts != rts) { + s->rts = rts; + s->rts_commit =1 ; +max3100_dowork (s); + } +spin_unlock (&s->conf_lock); +} + +static void +max3100_set_termios (struct uart_port *port,struct ktermios *termios, +struct ktermios *old) +{ +struct max3100_port *s =container_of (port, + struct max3100_port, + port); +int baud =0 ; +unsigned cflag; +u32 param_new, param_mask, parity =0 ; +struct tty_struct *tty = s->port.info->port.tty; + +dev_dbg (&s->spi->dev,"%s\n" , __func__); +if (!tty) +return ; + + cflag = termios->c_cflag; + param_new =0 ; + param_mask =0 ; + + baud =tty_get_baud_rate (tty); + param_new = s->conf &MAX3100_BAUD ; +switch (baud) { +case 300 : +if (s->crystal) + baud = s->baud; +else + param_new =15 ; +break ; +case 600 : + param_new =14 + s->crystal; +break ; +case 1200 : + param_new =13 + s->crystal; +break ; +case 2400 : + param_new =12 + s->crystal; +break ; +case 4800 : + param_new =11 + s->crystal; +break ; +case 9600 : + param_new =10 + s->crystal; +break ; +case 19200 : + param_new =9 + s->crystal; +break ; +case 38400 : + param_new =8 + s->crystal; +break ; +case 57600 : + param_new =1 + s->crystal; +break ; +case 115200 : + param_new =0 + s->crystal; +break ; +case 230400 : +if (s->crystal) + param_new =0 ; +else + baud = s->baud; +break ; +default : + baud = s->baud; + } +tty_encode_baud_rate (tty, baud, baud); + s->baud = baud; + param_mask |=MAX3100_BAUD ; + +if ((cflag &CSIZE ) ==CS8 ) { + param_new &= ~MAX3100_L ; + parity &= ~MAX3100_7BIT ; + }else { + param_new |=MAX3100_L ; + parity |=MAX3100_7BIT ; + cflag = (cflag & ~CSIZE ) |CS7 ; + } + param_mask |=MAX3100_L ; + +if (cflag &CSTOPB ) + param_new |=MAX3100_ST ; +else + param_new &= ~MAX3100_ST ; + param_mask |=MAX3100_ST ; + +if (cflag &PARENB ) { + param_new |=MAX3100_PE ; + parity |=MAX3100_PARITY_ON ; + }else { + param_new &= ~MAX3100_PE ; + parity &= ~MAX3100_PARITY_ON ; + } + param_mask |=MAX3100_PE ; + +if (cflag &PARODD ) + parity |=MAX3100_PARITY_ODD ; +else + parity &= ~MAX3100_PARITY_ODD ; + +/* mask termios capabilities we don't support */ + cflag &= ~CMSPAR ; + termios->c_cflag = cflag; + + s->port.ignore_status_mask =0 ; +if (termios->c_iflag &IGNPAR ) + s->port.ignore_status_mask |= +MAX3100_STATUS_PE |MAX3100_STATUS_FE | +MAX3100_STATUS_OE ; + +/* we are sending char from a workqueue so enable */ + s->port.info->port.tty->low_latency =1 ; + +if (s->poll_time >0 ) +del_timer_sync (&s->timer); + +uart_update_timeout (port, termios->c_cflag, baud); + +spin_lock (&s->conf_lock); + s->conf = (s->conf & ~param_mask) | (param_new & param_mask); + s->conf_commit =1 ; + s->parity = parity; +spin_unlock (&s->conf_lock); +max3100_dowork (s); + +if (UART_ENABLE_MS (&s->port, termios->c_cflag)) +max3100_enable_ms (&s->port); +} + +static void max3100_shutdown (struct uart_port *port) +{ +struct max3100_port *s =container_of (port, + struct max3100_port, + port); + +dev_dbg (&s->spi->dev,"%s\n" , __func__); + +if (s->suspending) +return ; + + s->force_end_work =1 ; + +if (s->poll_time >0 ) +del_timer_sync (&s->timer); + +if (s->workqueue) { +flush_workqueue (s->workqueue); +destroy_workqueue (s->workqueue); + s->workqueue =NULL ; + } +if (s->irq) +free_irq (s->irq, s); + +/* set shutdown mode to save power */ +if (s->max3100_hw_suspend) + s->max3100_hw_suspend (1 ); +else { +u16 tx, rx; + + tx =MAX3100_WC |MAX3100_SHDN ; +max3100_sr (s, tx, &rx); + } +} + +static int max3100_startup (struct uart_port *port) +{ +struct max3100_port *s =container_of (port, + struct max3100_port, + port); +char b[12 ]; + +dev_dbg (&s->spi->dev,"%s\n" , __func__); + + s->conf =MAX3100_RM ; + s->baud = s->crystal ?230400 :115200 ; + s->rx_enabled =1 ; + +if (s->suspending) +return 0 ; + + s->force_end_work =0 ; + s->parity =0 ; + s->rts =0 ; + +sprintf (b,"max3100-%d" , s->minor); + s->workqueue =create_freezeable_workqueue (b); +if (!s->workqueue) { +dev_warn (&s->spi->dev,"cannot create workqueue\n" ); +return -EBUSY ; + } +INIT_WORK (&s->work, max3100_work); + +if (request_irq (s->irq, max3100_irq, +IRQF_TRIGGER_FALLING ,"max3100" , s) <0 ) { +dev_warn (&s->spi->dev,"cannot allocate irq %d\n" , s->irq); + s->irq =0 ; +destroy_workqueue (s->workqueue); + s->workqueue =NULL ; +return -EBUSY ; + } + +if (s->loopback) { +u16 tx, rx; + tx =0x4001 ; +max3100_sr (s, tx, &rx); + } + +if (s->max3100_hw_suspend) + s->max3100_hw_suspend (0 ); + s->conf_commit =1 ; +max3100_dowork (s); +/* wait for clock to settle */ +msleep (50 ); + +max3100_enable_ms (&s->port); + +return 0 ; +} + +static const char *max3100_type (struct uart_port *port) +{ +struct max3100_port *s =container_of (port, + struct max3100_port, + port); + +dev_dbg (&s->spi->dev,"%s\n" , __func__); + +return s->port.type ==PORT_MAX3100 ?"MAX3100" :NULL ; +} + +static void max3100_release_port (struct uart_port *port) +{ +struct max3100_port *s =container_of (port, + struct max3100_port, + port); + +dev_dbg (&s->spi->dev,"%s\n" , __func__); +} + +static void max3100_config_port (struct uart_port *port,int flags) +{ +struct max3100_port *s =container_of (port, + struct max3100_port, + port); + +dev_dbg (&s->spi->dev,"%s\n" , __func__); + +if (flags &UART_CONFIG_TYPE ) + s->port.type =PORT_MAX3100 ; +} + +static int max3100_verify_port (struct uart_port *port, +struct serial_struct *ser) +{ +struct max3100_port *s =container_of (port, + struct max3100_port, + port); +int ret = -EINVAL ; + +dev_dbg (&s->spi->dev,"%s\n" , __func__); + +if (ser->type ==PORT_UNKNOWN || ser->type ==PORT_MAX3100 ) + ret =0 ; +return ret; +} + +static void max3100_stop_tx (struct uart_port *port) +{ +struct max3100_port *s =container_of (port, + struct max3100_port, + port); + +dev_dbg (&s->spi->dev,"%s\n" , __func__); +} + +static int max3100_request_port (struct uart_port *port) +{ +struct max3100_port *s =container_of (port, + struct max3100_port, + port); + +dev_dbg (&s->spi->dev,"%s\n" , __func__); +return 0 ; +} + +static void max3100_break_ctl (struct uart_port *port,int break_state) +{ +struct max3100_port *s =container_of (port, + struct max3100_port, + port); + +dev_dbg (&s->spi->dev,"%s\n" , __func__); +} + +static struct uart_ops max3100_ops = { + .tx_empty = max3100_tx_empty, + .set_mctrl = max3100_set_mctrl, + .get_mctrl = max3100_get_mctrl, + .stop_tx = max3100_stop_tx, + .start_tx = max3100_start_tx, + .stop_rx = max3100_stop_rx, + .enable_ms = max3100_enable_ms, + .break_ctl = max3100_break_ctl, + .startup = max3100_startup, + .shutdown = max3100_shutdown, + .set_termios = max3100_set_termios, + .type = max3100_type, + .release_port = max3100_release_port, + .request_port = max3100_request_port, + .config_port = max3100_config_port, + .verify_port = max3100_verify_port, +}; + +static struct uart_driver max3100_uart_driver = { + .owner =THIS_MODULE , + .driver_name ="ttyMAX" , + .dev_name ="ttyMAX" , + .major =MAX3100_MAJOR , + .minor =MAX3100_MINOR , + .nr =MAX_MAX3100 , +}; +static int uart_driver_registered; + +static int __devinit max3100_probe (struct spi_device *spi) +{ +int i, retval; +struct plat_max3100 *pdata; +u16 tx, rx; + +mutex_lock (&max3100s_lock); + +if (!uart_driver_registered) { + uart_driver_registered =1 ; + retval =uart_register_driver (&max3100_uart_driver); +if (retval) { +printk (KERN_ERR "Couldn't register max3100 uart driver\n" ); +mutex_unlock (&max3100s_lock); +return retval; + } + } + +for (i =0 ; i <MAX_MAX3100 ; i++) +if (!max3100s[i]) +break ; +if (i ==MAX_MAX3100 ) { +dev_warn (&spi->dev,"too many MAX3100 chips\n" ); +mutex_unlock (&max3100s_lock); +return -ENOMEM ; + } + + max3100s[i] =kzalloc (sizeof (struct max3100_port ),GFP_KERNEL ); +if (!max3100s[i]) { +dev_warn (&spi->dev, +"kmalloc for max3100 structure %d failed!\n" , i); +mutex_unlock (&max3100s_lock); +return -ENOMEM ; + } + max3100s[i]->spi = spi; + max3100s[i]->irq = spi->irq; +spin_lock_init (&max3100s[i]->conf_lock); +dev_set_drvdata (&spi->dev, max3100s[i]); + pdata = spi->dev.platform_data; + max3100s[i]->crystal = pdata->crystal; + max3100s[i]->loopback = pdata->loopback; + max3100s[i]->poll_time = pdata->poll_time *HZ /1000 ; +if (pdata->poll_time >0 && max3100s[i]->poll_time ==0 ) + max3100s[i]->poll_time =1 ; + max3100s[i]->max3100_hw_suspend = pdata->max3100_hw_suspend; + max3100s[i]->minor = i; +init_timer (&max3100s[i]->timer); + max3100s[i]->timer.function = max3100_timeout; + max3100s[i]->timer.data = (unsigned long ) max3100s[i]; + +dev_dbg (&spi->dev,"%s: adding port %d\n" , __func__, i); + max3100s[i]->port.irq = max3100s[i]->irq; + max3100s[i]->port.uartclk = max3100s[i]->crystal ?3686400 :1843200 ; + max3100s[i]->port.fifosize =16 ; + max3100s[i]->port.ops = &max3100_ops; + max3100s[i]->port.flags =UPF_SKIP_TEST |UPF_BOOT_AUTOCONF ; + max3100s[i]->port.line = i; + max3100s[i]->port.type =PORT_MAX3100 ; + max3100s[i]->port.dev = &spi->dev; + retval =uart_add_one_port (&max3100_uart_driver, &max3100s[i]->port); +if (retval <0 ) +dev_warn (&spi->dev, +"uart_add_one_port failed for line %d with error %d\n" , + i, retval); + +/* set shutdown mode to save power. Will be woken-up on open */ +if (max3100s[i]->max3100_hw_suspend) + max3100s[i]->max3100_hw_suspend (1 ); +else { + tx =MAX3100_WC |MAX3100_SHDN ; +max3100_sr (max3100s[i], tx, &rx); + } +mutex_unlock (&max3100s_lock); +return 0 ; +} + +static int __devexit max3100_remove(struct spi_device *spi) +{ +struct max3100_port *s =dev_get_drvdata (&spi->dev); +int i; + +mutex_lock (&max3100s_lock); + +/* find out the index for the chip we are removing */ +for (i =0 ; i <MAX_MAX3100 ; i++) +if (max3100s[i] == s) +break ; + +dev_dbg (&spi->dev,"%s: removing port %d\n" , __func__, i); +uart_remove_one_port (&max3100_uart_driver, &max3100s[i]->port); +kfree (max3100s[i]); + max3100s[i] =NULL ; + +/* check if this is the last chip we have */ +for (i =0 ; i <MAX_MAX3100 ; i++) +if (max3100s[i]) { +mutex_unlock (&max3100s_lock); +return 0 ; + } +pr_debug ("removing max3100 driver\n" ); +uart_unregister_driver (&max3100_uart_driver); + +mutex_unlock (&max3100s_lock); +return 0 ; +} + +#ifdef CONFIG_PM + +static int max3100_suspend (struct spi_device *spi,pm_message_t state) +{ +struct max3100_port *s =dev_get_drvdata (&spi->dev); + +dev_dbg (&s->spi->dev,"%s\n" , __func__); + +disable_irq (s->irq); + + s->suspending =1 ; +uart_suspend_port (&max3100_uart_driver, &s->port); + +if (s->max3100_hw_suspend) + s->max3100_hw_suspend (1 ); +else { +/* no HW suspend, so do SW one */ +u16 tx, rx; + + tx =MAX3100_WC |MAX3100_SHDN ; +max3100_sr (s, tx, &rx); + } +return 0 ; +} + +static int max3100_resume (struct spi_device *spi) +{ +struct max3100_port *s =dev_get_drvdata (&spi->dev); + +dev_dbg (&s->spi->dev,"%s\n" , __func__); + +if (s->max3100_hw_suspend) + s->max3100_hw_suspend (0 ); +uart_resume_port (&max3100_uart_driver, &s->port); + s->suspending =0 ; + +enable_irq (s->irq); + + s->conf_commit =1 ; +if (s->workqueue) +max3100_dowork (s); + +return 0 ; +} + +#else +#define max3100_suspend NULL +#define max3100_resume NULL +#endif + +static struct spi_driver max3100_driver = { + .driver = { + .name ="max3100" , + .bus = &spi_bus_type, + .owner =THIS_MODULE , + }, + + .probe = max3100_probe, + .remove =__devexit_p (max3100_remove), + .suspend = max3100_suspend, + .resume = max3100_resume, +}; + +static int __init max3100_init (void ) +{ +return spi_register_driver (&max3100_driver); +} +module_init (max3100_init); + +static void __exit max3100_exit(void) +{ +spi_unregister_driver (&max3100_driver); +} +module_exit (max3100_exit); + +MODULE_DESCRIPTION ("MAX3100 driver" ); +MODULE_AUTHOR ("Christian Pellegrin <[email protected]>" ); +MODULE_LICENSE ("GPL" );
include/linux/serial_core.h +3 -0
@@ -167,6 +167,9 @@/* MAX3100 */ #define PORT_MAX3100 86 +/* MAX3100 */ +#define PORT_MAX3100 83 +#ifdef __KERNEL__#include <linux/compiler.h>
include/linux/serial_max3100.h new file +53 -0
53 lines not on this page · raw message
Signature · 6 lines
1.5.6.5 Signed-off-by: Christian Pellegrin <[email protected]> --- include/linux/serial_core.h | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-)
include/linux/serial_core.h +0 -3
@@ -167,9 +167,6 @@/* MAX3100 */ #define PORT_MAX3100 86 -/* MAX3100 */ -#define PORT_MAX3100 83 -#ifdef __KERNEL__#include <linux/compiler.h>
Signature · 1 line
1.5.6.5
PATCH 6/11 Change hardware flow control from poll to interrupt driven
In reply to Alan CoxFrom: Sonic Zhang <[email protected]>
Only the CTS bit is affected.
---
.../mach-bf527/include/mach/bfin_serial_5xx.h | 26 ---- .../mach-bf533/include/mach/bfin_serial_5xx.h | 20 --- .../mach-bf537/include/mach/bfin_serial_5xx.h | 27 ---- .../mach-bf548/include/mach/bfin_serial_5xx.h | 45 ------- .../mach-bf561/include/mach/bfin_serial_5xx.h | 20 --- drivers/serial/bfin_5xx.c | 131 +++++++++++++------- 6 files changed, 82 insertions(+), 187 deletions(-)
arch/blackfin/mach-bf527/include/mach/bfin_serial_5xx.h +0 -26
@@ -167,29 +167,3 @@ struct bfin_serial_res bfin_serial_resource[] = { };#define DRIVER_NAME "bfin-uart" - -static void bfin_serial_hw_init (struct bfin_serial_port *uart) -{ - -#ifdef CONFIG_SERIAL_BFIN_UART0 -peripheral_request (P_UART0_TX ,DRIVER_NAME ); -peripheral_request (P_UART0_RX ,DRIVER_NAME ); -#endif - -#ifdef CONFIG_SERIAL_BFIN_UART1 -peripheral_request (P_UART1_TX ,DRIVER_NAME ); -peripheral_request (P_UART1_RX ,DRIVER_NAME ); -#endif - -#ifdef CONFIG_SERIAL_BFIN_CTSRTS -if (uart->cts_pin >=0 ) { -gpio_request (uart->cts_pin,DRIVER_NAME ); -gpio_direction_input (uart->cts_pin); - } - -if (uart->rts_pin >=0 ) { -gpio_request (uart->rts_pin,DRIVER_NAME ); -gpio_direction_output (uart->rts_pin,0 ); - } -#endif -}
arch/blackfin/mach-bf533/include/mach/bfin_serial_5xx.h +0 -20
@@ -142,23 +142,3 @@ struct bfin_serial_res bfin_serial_resource[] = { };#define DRIVER_NAME "bfin-uart" - -static void bfin_serial_hw_init (struct bfin_serial_port *uart) -{ - -#ifdef CONFIG_SERIAL_BFIN_UART0 -peripheral_request (P_UART0_TX ,DRIVER_NAME ); -peripheral_request (P_UART0_RX ,DRIVER_NAME ); -#endif - -#ifdef CONFIG_SERIAL_BFIN_CTSRTS -if (uart->cts_pin >=0 ) { -gpio_request (uart->cts_pin,DRIVER_NAME ); -gpio_direction_input (uart->cts_pin); - } -if (uart->rts_pin >=0 ) { -gpio_request (uart->rts_pin,DRIVER_NAME ); -gpio_direction_output (uart->rts_pin,0 ); - } -#endif -}
arch/blackfin/mach-bf537/include/mach/bfin_serial_5xx.h +0 -27
@@ -99,7 +99,6 @@ struct bfin_serial_port {struct work_struct tx_dma_workqueue;#endif #ifdef CONFIG_SERIAL_BFIN_CTSRTS -struct timer_list cts_timer;int cts_pin;int rts_pin;#endif
@@ -167,29 +166,3 @@ struct bfin_serial_res bfin_serial_resource[] = { };#define DRIVER_NAME "bfin-uart" - -static void bfin_serial_hw_init (struct bfin_serial_port *uart) -{ - -#ifdef CONFIG_SERIAL_BFIN_UART0 -peripheral_request (P_UART0_TX ,DRIVER_NAME ); -peripheral_request (P_UART0_RX ,DRIVER_NAME ); -#endif - -#ifdef CONFIG_SERIAL_BFIN_UART1 -peripheral_request (P_UART1_TX ,DRIVER_NAME ); -peripheral_request (P_UART1_RX ,DRIVER_NAME ); -#endif - -#ifdef CONFIG_SERIAL_BFIN_CTSRTS -if (uart->cts_pin >=0 ) { -gpio_request (uart->cts_pin,DRIVER_NAME ); -gpio_direction_input (uart->cts_pin); - } - -if (uart->rts_pin >=0 ) { -gpio_request (uart->rts_pin,DRIVER_NAME ); -gpio_direction_output (uart->rts_pin,0 ); - } -#endif -}
arch/blackfin/mach-bf548/include/mach/bfin_serial_5xx.h +0 -45
48 lines not on this page · raw message
arch/blackfin/mach-bf561/include/mach/bfin_serial_5xx.h +0 -20
@@ -142,23 +142,3 @@ struct bfin_serial_res bfin_serial_resource[] = { };#define DRIVER_NAME "bfin-uart" - -static void bfin_serial_hw_init (struct bfin_serial_port *uart) -{ - -#ifdef CONFIG_SERIAL_BFIN_UART0 -peripheral_request (P_UART0_TX ,DRIVER_NAME ); -peripheral_request (P_UART0_RX ,DRIVER_NAME ); -#endif - -#ifdef CONFIG_SERIAL_BFIN_CTSRTS -if (uart->cts_pin >=0 ) { -gpio_request (uart->cts_pin,DRIVER_NAME ); -gpio_direction_input (uart->cts_pin); - } -if (uart->rts_pin >=0 ) { -gpio_request (uart->rts_pin,DRIVER_NAME ); -gpio_direction_output (uart->rts_pin,0 ); - } -#endif -}
drivers/serial/bfin_5xx.c +82 -49
227 lines not on this page · raw message
PATCH 7/11 tty: Blackin CTS/RTS
In reply to Alan CoxFrom: Sonic Zhang <[email protected]>
Both software emulated and hardware based CTS and RTS are enabled in serial driver.
The CTS RTS PIN connection on BF548 UART port is defined as a modem device not as a host device. In order to test it under Linux, please nake a cross UART cable to exchange CTS and RTS signal.
---
.../mach-bf518/include/mach/bfin_serial_5xx.h | 10 + .../mach-bf527/include/mach/bfin_serial_5xx.h | 10 + .../mach-bf533/include/mach/bfin_serial_5xx.h | 9 + .../mach-bf537/include/mach/bfin_serial_5xx.h | 10 + .../mach-bf538/include/mach/bfin_serial_5xx.h | 10 + .../mach-bf548/include/mach/bfin_serial_5xx.h | 72 ++++----- .../mach-bf561/include/mach/bfin_serial_5xx.h | 9 + drivers/serial/Kconfig | 26 ++- drivers/serial/bfin_5xx.c | 169 ++++++++++++++------ 9 files changed, 209 insertions(+), 116 deletions(-)
arch/blackfin/mach-bf518/include/mach/bfin_serial_5xx.h +7 -3
@@ -53,9 +53,9 @@#define UART_SET_DLAB (uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) | DLAB); SSYNC(); } while (0)#define UART_CLEAR_DLAB (uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) & ~DLAB); SSYNC(); } while (0) -#define UART_GET_CTS (x) gpio_get_value(x->cts_pin) -#define UART_SET_RTS (x) gpio_set_value(x->rts_pin, 1) -#define UART_CLEAR_RTS (x) gpio_set_value(x->rts_pin, 0) +#define UART_GET_CTS (x) (!gpio_get_value(x->cts_pin)) +#define UART_DISABLE_RTS (x) gpio_set_value(x->rts_pin, 1) +#define UART_ENABLE_RTS (x) gpio_set_value(x->rts_pin, 0)#define UART_ENABLE_INTS (x, v) UART_PUT_IER(x, v)#define UART_DISABLE_INTS (x) UART_PUT_IER(x, 0)
@@ -87,6 +87,7 @@struct bfin_serial_port {struct uart_port port;unsigned int old_status; +int status_irq;unsigned int lsr;#ifdef CONFIG_SERIAL_BFIN_DMA int tx_done;
@@ -125,6 +126,7 @@ static inline void UART_CLEAR_LSR(struct bfin_serial_port *uart)struct bfin_serial_res {unsigned long uart_base_addr;int uart_irq; +int uart_status_irq;#ifdef CONFIG_SERIAL_BFIN_DMA unsigned int uart_tx_dma_channel;unsigned int uart_rx_dma_channel;
@@ -140,6 +142,7 @@ struct bfin_serial_res bfin_serial_resource[] = { {0xFFC00400 ,IRQ_UART0_RX , +IRQ_UART0_ERROR , #ifdef CONFIG_SERIAL_BFIN_DMACH_UART0_TX , CH_UART0_RX,
@@ -154,6 +157,7 @@ struct bfin_serial_res bfin_serial_resource[] = { {0xFFC02000 ,IRQ_UART1_RX , +IRQ_UART1_ERROR , #ifdef CONFIG_SERIAL_BFIN_DMACH_UART1_TX , CH_UART1_RX,
arch/blackfin/mach-bf527/include/mach/bfin_serial_5xx.h +7 -3
@@ -53,9 +53,9 @@#define UART_SET_DLAB (uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) | DLAB); SSYNC(); } while (0)#define UART_CLEAR_DLAB (uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) & ~DLAB); SSYNC(); } while (0) -#define UART_GET_CTS (x) gpio_get_value(x->cts_pin) -#define UART_SET_RTS (x) gpio_set_value(x->rts_pin, 1) -#define UART_CLEAR_RTS (x) gpio_set_value(x->rts_pin, 0) +#define UART_GET_CTS (x) (!gpio_get_value(x->cts_pin)) +#define UART_DISABLE_RTS (x) gpio_set_value(x->rts_pin, 1) +#define UART_ENABLE_RTS (x) gpio_set_value(x->rts_pin, 0)#define UART_ENABLE_INTS (x, v) UART_PUT_IER(x, v)#define UART_DISABLE_INTS (x) UART_PUT_IER(x, 0)
@@ -87,6 +87,7 @@struct bfin_serial_port {struct uart_port port;unsigned int old_status; +int status_irq;unsigned int lsr;#ifdef CONFIG_SERIAL_BFIN_DMA int tx_done;
@@ -125,6 +126,7 @@ static inline void UART_CLEAR_LSR(struct bfin_serial_port *uart)struct bfin_serial_res {unsigned long uart_base_addr;int uart_irq; +int uart_status_irq;#ifdef CONFIG_SERIAL_BFIN_DMA unsigned int uart_tx_dma_channel;unsigned int uart_rx_dma_channel;
@@ -140,6 +142,7 @@ struct bfin_serial_res bfin_serial_resource[] = { {0xFFC00400 ,IRQ_UART0_RX , +IRQ_UART0_ERROR , #ifdef CONFIG_SERIAL_BFIN_DMACH_UART0_TX , CH_UART0_RX,
@@ -154,6 +157,7 @@ struct bfin_serial_res bfin_serial_resource[] = { {0xFFC02000 ,IRQ_UART1_RX , +IRQ_UART1_ERROR , #ifdef CONFIG_SERIAL_BFIN_DMACH_UART1_TX , CH_UART1_RX,
arch/blackfin/mach-bf533/include/mach/bfin_serial_5xx.h +6 -3
@@ -53,9 +53,9 @@#define UART_SET_DLAB (uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) | DLAB); SSYNC(); } while (0)#define UART_CLEAR_DLAB (uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) & ~DLAB); SSYNC(); } while (0) -#define UART_GET_CTS (x) gpio_get_value(x->cts_pin) -#define UART_SET_RTS (x) gpio_set_value(x->rts_pin, 1) -#define UART_CLEAR_RTS (x) gpio_set_value(x->rts_pin, 0) +#define UART_GET_CTS (x) (!gpio_get_value(x->cts_pin)) +#define UART_DISABLE_RTS (x) gpio_set_value(x->rts_pin, 1) +#define UART_ENABLE_RTS (x) gpio_set_value(x->rts_pin, 0)#define UART_ENABLE_INTS (x, v) UART_PUT_IER(x, v)#define UART_DISABLE_INTS (x) UART_PUT_IER(x, 0)
@@ -74,6 +74,7 @@struct bfin_serial_port {struct uart_port port;unsigned int old_status; +int status_irq;unsigned int lsr;#ifdef CONFIG_SERIAL_BFIN_DMA int tx_done;
@@ -116,6 +117,7 @@ static inline void UART_CLEAR_LSR(struct bfin_serial_port *uart)struct bfin_serial_res {unsigned long uart_base_addr;int uart_irq; +int uart_status_irq;#ifdef CONFIG_SERIAL_BFIN_DMA unsigned int uart_tx_dma_channel;unsigned int uart_rx_dma_channel;
@@ -130,6 +132,7 @@ struct bfin_serial_res bfin_serial_resource[] = { {0xFFC00400 ,IRQ_UART_RX , +IRQ_UART_ERROR , #ifdef CONFIG_SERIAL_BFIN_DMACH_UART_TX , CH_UART_RX,
arch/blackfin/mach-bf537/include/mach/bfin_serial_5xx.h +7 -3
@@ -53,9 +53,9 @@#define UART_SET_DLAB (uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) | DLAB); SSYNC(); } while (0)#define UART_CLEAR_DLAB (uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) & ~DLAB); SSYNC(); } while (0) -#define UART_GET_CTS (x) gpio_get_value(x->cts_pin) -#define UART_SET_RTS (x) gpio_set_value(x->rts_pin, 1) -#define UART_CLEAR_RTS (x) gpio_set_value(x->rts_pin, 0) +#define UART_GET_CTS (x) (!gpio_get_value(x->cts_pin)) +#define UART_DISABLE_RTS (x) gpio_set_value(x->rts_pin, 1) +#define UART_ENABLE_RTS (x) gpio_set_value(x->rts_pin, 0)#define UART_ENABLE_INTS (x, v) UART_PUT_IER(x, v)#define UART_DISABLE_INTS (x) UART_PUT_IER(x, 0)
@@ -87,6 +87,7 @@struct bfin_serial_port {struct uart_port port;unsigned int old_status; +int status_irq;unsigned int lsr;#ifdef CONFIG_SERIAL_BFIN_DMA int tx_done;
@@ -124,6 +125,7 @@ static inline void UART_CLEAR_LSR(struct bfin_serial_port *uart)struct bfin_serial_res {unsigned long uart_base_addr;int uart_irq; +int uart_status_irq;#ifdef CONFIG_SERIAL_BFIN_DMA unsigned int uart_tx_dma_channel;unsigned int uart_rx_dma_channel;
@@ -139,6 +141,7 @@ struct bfin_serial_res bfin_serial_resource[] = { {0xFFC00400 ,IRQ_UART0_RX , +IRQ_UART0_ERROR , #ifdef CONFIG_SERIAL_BFIN_DMACH_UART0_TX , CH_UART0_RX,
@@ -153,6 +156,7 @@ struct bfin_serial_res bfin_serial_resource[] = { {0xFFC02000 ,IRQ_UART1_RX , +IRQ_UART1_ERROR , #ifdef CONFIG_SERIAL_BFIN_DMACH_UART1_TX , CH_UART1_RX,
arch/blackfin/mach-bf538/include/mach/bfin_serial_5xx.h +7 -3
@@ -53,9 +53,9 @@#define UART_SET_DLAB (uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) | DLAB); SSYNC(); } while (0)#define UART_CLEAR_DLAB (uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) & ~DLAB); SSYNC(); } while (0) -#define UART_GET_CTS (x) gpio_get_value(x->cts_pin) -#define UART_SET_RTS (x) gpio_set_value(x->rts_pin, 1) -#define UART_CLEAR_RTS (x) gpio_set_value(x->rts_pin, 0) +#define UART_GET_CTS (x) (!gpio_get_value(x->cts_pin)) +#define UART_DISABLE_RTS (x) gpio_set_value(x->rts_pin, 1) +#define UART_ENABLE_RTS (x) gpio_set_value(x->rts_pin, 0)#define UART_ENABLE_INTS (x, v) UART_PUT_IER(x, v)#define UART_DISABLE_INTS (x) UART_PUT_IER(x, 0)
@@ -87,6 +87,7 @@struct bfin_serial_port {struct uart_port port;unsigned int old_status; +int status_irq;unsigned int lsr;#ifdef CONFIG_SERIAL_BFIN_DMA int tx_done;
@@ -125,6 +126,7 @@ static inline void UART_CLEAR_LSR(struct bfin_serial_port *uart)struct bfin_serial_res {unsigned long uart_base_addr;int uart_irq; +int uart_status_irq;#ifdef CONFIG_SERIAL_BFIN_DMA unsigned int uart_tx_dma_channel;unsigned int uart_rx_dma_channel;
@@ -140,6 +142,7 @@ struct bfin_serial_res bfin_serial_resource[] = { {0xFFC00400 ,IRQ_UART0_RX , +IRQ_UART0_ERROR , #ifdef CONFIG_SERIAL_BFIN_DMACH_UART0_TX , CH_UART0_RX,
@@ -154,6 +157,7 @@ struct bfin_serial_res bfin_serial_resource[] = { {0xFFC02000 ,IRQ_UART1_RX , +IRQ_UART1_ERROR , #ifdef CONFIG_SERIAL_BFIN_DMACH_UART1_TX , CH_UART1_RX,
arch/blackfin/mach-bf548/include/mach/bfin_serial_5xx.h +32 -40
154 lines not on this page · raw message
arch/blackfin/mach-bf561/include/mach/bfin_serial_5xx.h +6 -3
@@ -53,9 +53,9 @@#define UART_SET_DLAB (uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) | DLAB); SSYNC(); } while (0)#define UART_CLEAR_DLAB (uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) & ~DLAB); SSYNC(); } while (0) -#define UART_GET_CTS (x) gpio_get_value(x->cts_pin) -#define UART_SET_RTS (x) gpio_set_value(x->rts_pin, 1) -#define UART_CLEAR_RTS (x) gpio_set_value(x->rts_pin, 0) +#define UART_GET_CTS (x) (!gpio_get_value(x->cts_pin)) +#define UART_DISABLE_RTS (x) gpio_set_value(x->rts_pin, 1) +#define UART_ENABLE_RTS (x) gpio_set_value(x->rts_pin, 0)#define UART_ENABLE_INTS (x, v) UART_PUT_IER(x, v)#define UART_DISABLE_INTS (x) UART_PUT_IER(x, 0)
@@ -74,6 +74,7 @@struct bfin_serial_port {struct uart_port port;unsigned int old_status; +int status_irq;unsigned int lsr;#ifdef CONFIG_SERIAL_BFIN_DMA int tx_done;
@@ -116,6 +117,7 @@ static inline void UART_CLEAR_LSR(struct bfin_serial_port *uart)struct bfin_serial_res {unsigned long uart_base_addr;int uart_irq; +int uart_status_irq;#ifdef CONFIG_SERIAL_BFIN_DMA unsigned int uart_tx_dma_channel;unsigned int uart_rx_dma_channel;
@@ -130,6 +132,7 @@ struct bfin_serial_res bfin_serial_resource[] = { {0xFFC00400 ,IRQ_UART_RX , +IRQ_UART_ERROR , #ifdef CONFIG_SERIAL_BFIN_DMACH_UART_TX , CH_UART_RX,
drivers/serial/Kconfig +20 -6
@@ -734,7 +734,7 @@ config BFIN_UART0_CTSRTS config UART0_CTS_PIN int "UART0 CTS pin" - depends on BFIN_UART0_CTSRTS + depends on BFIN_UART0_CTSRTS && !BF548 default 23 help The default pin is GPIO_GP7.
@@ -742,7 +742,7 @@ config UART0_CTS_PIN config UART0_RTS_PIN int "UART0 RTS pin" - depends on BFIN_UART0_CTSRTS + depends on BFIN_UART0_CTSRTS && !BF548 default 22 help The default pin is GPIO_GP6.
@@ -763,14 +763,14 @@ config BFIN_UART1_CTSRTS config UART1_CTS_PIN int "UART1 CTS pin" - depends on BFIN_UART1_CTSRTS && !BF54x + depends on BFIN_UART1_CTSRTS && !BF548 default -1 help Refer to ./include/asm-blackfin/gpio.h to see the GPIO map. config UART1_RTS_PIN int "UART1 RTS pin" - depends on BFIN_UART1_CTSRTS && !BF54x + depends on BFIN_UART1_CTSRTS && !BF548 default -1 help Refer to ./include/asm-blackfin/gpio.h to see the GPIO map.
@@ -790,14 +790,14 @@ config BFIN_UART2_CTSRTS config UART2_CTS_PIN int "UART2 CTS pin" - depends on BFIN_UART2_CTSRTS + depends on BFIN_UART2_CTSRTS && !BF548 default -1 help Refer to ./include/asm-blackfin/gpio.h to see the GPIO map. config UART2_RTS_PIN int "UART2 RTS pin" - depends on BFIN_UART2_CTSRTS + depends on BFIN_UART2_CTSRTS && !BF548 default -1 help Refer to ./include/asm-blackfin/gpio.h to see the GPIO map.
@@ -815,6 +815,20 @@ config BFIN_UART3_CTSRTS Enable hardware flow control in the driver. Using GPIO emulate the CTS/RTS signal. +config UART3_CTS_PIN + int "UART3 CTS pin" + depends on BFIN_UART3_CTSRTS && !BF548 + default -1 + help + Refer to ./include/asm-blackfin/gpio.h to see the GPIO map. + +config UART3_RTS_PIN + int "UART3 RTS pin" + depends on BFIN_UART3_CTSRTS && !BF548 + default -1 + help + Refer to ./include/asm-blackfin/gpio.h to see the GPIO map. + config SERIAL_IMX bool "IMX serial port support" depends on ARM && (ARCH_IMX || ARCH_MXC)
drivers/serial/bfin_5xx.c +117 -52
239 lines not on this page · raw message
PATCH 8/11 Change KCONFIG name
In reply to Alan CoxFrom: Mike Frysinger <[email protected]>
---
drivers/serial/Kconfig | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/serial/Kconfig +1 -1
@@ -707,7 +707,7 @@ choice config SERIAL_BFIN_DMA bool "DMA mode" - depends on !DMA_UNCACHED_NONE && !KGDB_UART + depends on !DMA_UNCACHED_NONE && !KGDB_SERIAL_CONSOLE help This driver works under DMA mode. If this option is selected, the blackfin simple dma driver is also enabled.
PATCH 9/11 KGDB_SERIAL_CONSOLE check for module
In reply to Alan CoxFrom: Mike Frysinger <[email protected]>
Depend on KGDB_SERIAL_CONSOLE being set to N rather than !Y, since it can be built as a module.
---
drivers/serial/Kconfig | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/serial/Kconfig +1 -1
@@ -707,7 +707,7 @@ choice config SERIAL_BFIN_DMA bool "DMA mode" - depends on !DMA_UNCACHED_NONE && !KGDB_SERIAL_CONSOLE + depends on !DMA_UNCACHED_NONE && KGDB_SERIAL_CONSOLE=n help This driver works under DMA mode. If this option is selected, the blackfin simple dma driver is also enabled.
PATCH 10/11 Adjust path to gpio headers
In reply to Alan CoxFrom: Mike Frysinger <[email protected]>
---
drivers/serial/Kconfig | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-)
drivers/serial/Kconfig +8 -8
@@ -738,7 +738,7 @@ config UART0_CTS_PIN default 23 help The default pin is GPIO_GP7. - Refer to ./include/asm-blackfin/gpio.h to see the GPIO map. + Refer to arch/blackfin/mach-*/include/mach/gpio.h to see the GPIO map. config UART0_RTS_PIN int "UART0 RTS pin"
@@ -746,7 +746,7 @@ config UART0_RTS_PIN default 22 help The default pin is GPIO_GP6. - Refer to ./include/asm-blackfin/gpio.h to see the GPIO map. + Refer to arch/blackfin/mach-*/include/mach/gpio.h to see the GPIO map. config SERIAL_BFIN_UART1 bool "Enable UART1"
@@ -766,14 +766,14 @@ config UART1_CTS_PIN depends on BFIN_UART1_CTSRTS && !BF548 default -1 help - Refer to ./include/asm-blackfin/gpio.h to see the GPIO map. + Refer to arch/blackfin/mach-*/include/mach/gpio.h to see the GPIO map. config UART1_RTS_PIN int "UART1 RTS pin" depends on BFIN_UART1_CTSRTS && !BF548 default -1 help - Refer to ./include/asm-blackfin/gpio.h to see the GPIO map. + Refer to arch/blackfin/mach-*/include/mach/gpio.h to see the GPIO map. config SERIAL_BFIN_UART2 bool "Enable UART2"
@@ -793,14 +793,14 @@ config UART2_CTS_PIN depends on BFIN_UART2_CTSRTS && !BF548 default -1 help - Refer to ./include/asm-blackfin/gpio.h to see the GPIO map. + Refer to arch/blackfin/mach-*/include/mach/gpio.h to see the GPIO map. config UART2_RTS_PIN int "UART2 RTS pin" depends on BFIN_UART2_CTSRTS && !BF548 default -1 help - Refer to ./include/asm-blackfin/gpio.h to see the GPIO map. + Refer to arch/blackfin/mach-*/include/mach/gpio.h to see the GPIO map. config SERIAL_BFIN_UART3 bool "Enable UART3"
@@ -820,14 +820,14 @@ config UART3_CTS_PIN depends on BFIN_UART3_CTSRTS && !BF548 default -1 help - Refer to ./include/asm-blackfin/gpio.h to see the GPIO map. + Refer to arch/blackfin/mach-*/include/mach/gpio.h to see the GPIO map. config UART3_RTS_PIN int "UART3 RTS pin" depends on BFIN_UART3_CTSRTS && !BF548 default -1 help - Refer to ./include/asm-blackfin/gpio.h to see the GPIO map. + Refer to arch/blackfin/mach-*/include/mach/gpio.h to see the GPIO map. config SERIAL_IMX bool "IMX serial port support"
PATCH 11/11 tty: jsm cleanups
In reply to Alan CoxFrom: Breno Leitao <[email protected]>
Here are some cleanups, mainly removing unused variables and silly declarations.
---
drivers/serial/jsm/jsm_neo.c | 14 ++++---------- drivers/serial/jsm/jsm_tty.c | 19 ++++++++----------- 2 files changed, 12 insertions(+), 21 deletions(-)
drivers/serial/jsm/jsm_neo.c +4 -10
@@ -533,7 +533,6 @@ static void neo_copy_data_from_queue_to_uart(struct jsm_channel *ch)if (!(ch->ch_flags & (CH_TX_FIFO_EMPTY |CH_TX_FIFO_LWM )))return ; - len_written =0 ; n =UART_17158_TX_FIFOSIZE - ch->ch_t_tlevel;/* cache head and tail of queue */
@@ -619,14 +618,10 @@ static void neo_parse_modem(struct jsm_channel *ch, u8 signals)/* Make the UART raise any of the output signals we want up */ static void neo_assert_modem_signals (struct jsm_channel *ch) { -u8 out; -if (!ch)return ; - out = ch->ch_mostat; - -writeb (out, &ch->ch_neo_uart->mcr); +writeb (ch->ch_mostat, &ch->ch_neo_uart->mcr);/* flush write operation */ neo_pci_posting_flush (ch->ch_bd);
@@ -936,10 +931,9 @@ static inline void neo_parse_lsr(struct jsm_board *brd, u32 port)static void neo_param (struct jsm_channel *ch) {u8 lcr =0 ; -u8 uart_lcr =0 ; -u8 ier =0 ; -u32 baud =9600 ; -int quot =0 ; +u8 uart_lcr, ier; +u32 baud; +int quot;struct jsm_board *bd; bd = ch->ch_bd;
drivers/serial/jsm/jsm_tty.c +8 -11
@@ -183,7 +183,6 @@ static void jsm_tty_break(struct uart_port *port, int break_state)static int jsm_tty_open (struct uart_port *port) {struct jsm_board *brd; -int rc =0 ;struct jsm_channel *channel = (struct jsm_channel *)port;struct ktermios *termios;
@@ -265,7 +264,7 @@ static int jsm_tty_open(struct uart_port *port) channel->ch_open_count++;jsm_printk (OPEN ,INFO , &channel->ch_bd->pci_dev,"finish\n" ); -return rc; +return 0 ; }static void jsm_tty_close (struct uart_port *port)
@@ -748,7 +747,7 @@ static void jsm_carrier(struct jsm_channel *ch)void jsm_check_queue_flow_control (struct jsm_channel *ch) {struct board_ops *bd_ops = ch->ch_bd->bd_ops; -int qleft =0 ; +int qleft;/* Store how much space we have left in the queue */ if ((qleft = ch->ch_r_tail - ch->ch_r_head -1 ) <0 )
@@ -834,7 +833,7 @@ void jsm_check_queue_flow_control(struct jsm_channel *ch)*/ int jsm_tty_write (struct uart_port *port) { -int bufcount =0 , n =0 ; +int bufcount;int data_count =0 ,data_count1 =0 ;u16 head;u16 tail;
@@ -850,14 +849,12 @@ int jsm_tty_write(struct uart_port *port)if ((bufcount = tail - head -1 ) <0 ) bufcount +=WQUEUESIZE ; - n = bufcount; - - n =min (n,56 ); + bufcount =min (bufcount,56 ); remain =WQUEUESIZE - head; data_count =0 ; -if (n >= remain) { - n -= remain; +if (bufcount >= remain) { + bufcount -= remain;while ((port->info->xmit.head != temp_tail) && (data_count < remain)) { channel->ch_wqueue[head++] =
@@ -871,8 +868,8 @@ int jsm_tty_write(struct uart_port *port) } data_count1 =0 ; -if (n >0 ) { - remain = n; +if (bufcount >0 ) { + remain = bufcount;while ((port->info->xmit.head != temp_tail) && (data_count1 < remain)) { channel->ch_wqueue[head++] =