modify spi_dpram for bp

This commit is contained in:
luowei
2010-08-27 19:10:40 +08:00
parent b704af97ff
commit fe23050812
3 changed files with 234 additions and 126 deletions

View File

@@ -13,12 +13,17 @@ defines of FPGA chip ICE65L08's register
#define SPI_FPGA_STANDBY_PIN RK2818_PIN_PH7
#define SPI_FPGA_RST_PIN RK2818_PIN_PF4
#define SPI_FPGA_POLL_WAIT 1
#define SPI_FPGA_TRANS_WORK 0
#define SPI_FPGA_TEST_DEBUG 0
#if SPI_FPGA_TEST_DEBUG
#define SPI_FPGA_TEST_DEBUG_PIN RK2818_PIN_PE0
extern int spi_test_wrong_handle(void);
#endif
#define TRUE 1
#define FALSE 0
struct uart_icount {
__u32 cts;
__u32 dsr;
@@ -108,6 +113,8 @@ struct spi_dpram
unsigned short int dpram_addr;
struct semaphore rec_sem;
struct semaphore send_sem;
struct mutex rec_lock,send_lock;
spinlock_t spin_rec_lock,spin_send_lock;
wait_queue_head_t recq, sendq;
struct miscdevice miscdev;
@@ -130,6 +137,19 @@ struct spi_fpga_port {
struct workqueue_struct *fpga_irq_workqueue;
struct work_struct fpga_irq_work;
struct timer_list fpga_timer;
#if SPI_FPGA_TRANS_WORK
struct workqueue_struct *fpga_trans_workqueue;
struct work_struct fpga_trans_work;
int write_en;
int read_en;
wait_queue_head_t wait_wq, wait_rq;
struct list_head trans_queue;
#endif
#if SPI_FPGA_POLL_WAIT
wait_queue_head_t spi_wait_q;
#endif
/*spi2uart*/
#ifdef CONFIG_SPI_FPGA_UART
struct spi_uart uart;
@@ -490,6 +510,9 @@ typedef enum eSpiGpioPinIntIsr
}eSpiGpioPinIntIsr_t;
extern struct spi_fpga_port *pFpgaPort;
#if SPI_FPGA_TRANS_WORK
extern int spi_write_work(struct spi_device *spi, const u8 *buf, size_t len);
#endif
extern unsigned int spi_in(struct spi_fpga_port *port, int reg, int type);
extern void spi_out(struct spi_fpga_port *port, int reg, int value, int type);

View File

@@ -85,9 +85,8 @@
#define PIN_BPSEND_ACK RK2818_PIN_PE0
#define PIN_APSEND_ACK RK2818_PIN_PF7
#define MAX_SPI_LEN 768 //the bytes of spi write or read one time
#define TRUE 1
#define FALSE 0
#define MAX_SPI_LEN 512 //the bytes of spi write or read one time
static int spi_dpram_write_buf(struct spi_dpram *dpram, unsigned short int addr, unsigned char *buf, unsigned int len)
{
@@ -292,10 +291,10 @@ static void spi_dpram_irq_work_handler(struct work_struct *work)
container_of(work, struct spi_fpga_port, dpram.spi_dpram_irq_work);
unsigned short int mbox = port->dpram.read_irq(&port->dpram);
unsigned int ptr;
unsigned int len;
//int i,ret;
unsigned int ptr,len;
int i;
char temp,*p;
printk("Enter::%s,mbox=%d\n",__FUNCTION__,mbox);
//gNumRecInt = mbox & 0x1fff;
//if(gNumRecInt - gNumLastRecInt !=1)
//if(++gNumLastRecInt > (1<<12))
@@ -306,17 +305,36 @@ static void spi_dpram_irq_work_handler(struct work_struct *work)
{
//RAM0
ptr = port->dpram.read_ptr(&port->dpram,SPI_DPRAM_PTR0_BPWRITE_APREAD);
len = ptr;
if(ptr%2)
len = ptr+1;
else
len = ptr;
port->dpram.read_dpram(&port->dpram, SPI_DPRAM_BPWRITE_START, port->dpram.prx, len);
port->dpram.rec_len += len;
printk("%s:ram0:len=%d\n",__FUNCTION__,len);
port->dpram.rec_len += ptr;
printk("%s:ram0:ptr=%d,len=%d\n",__FUNCTION__,ptr,len);
//send ack
//if(++gNumSendAck > (1<<12))
//gNumSendAck = 0;
//port->dpram.write_ack(&port->dpram, (MAILBOX_APSEND_ACK | MAILBOX_RAM0 | gNumSendAck));
p = port->dpram.prx;
for(i=0;i<(len>>1);i++)
{
temp = *(p+(i<<1));
*(p+(i<<1))= *(p+(i<<1)+1);
*(p+(i<<1)+1) = temp;
}
for(i=0;i<ptr;i++)
printk("%s:prx[%d]=0x%x\n",__FUNCTION__,i,*p++);
//wake up ap to read data
wake_up_interruptible(&port->dpram.recq);
mutex_lock(&port->dpram.rec_lock);
//allow bp write ram0 again
port->dpram.write_ack(&port->dpram, (MAILBOX_APSEND_ACK | MAILBOX_RAM0));
//printk("%s:r_irq=0x%x,s_ack=0x%x\n",__FUNCTION__,mbox, (MAILBOX_APSEND_ACK | MAILBOX_RAM0 | gNumSendAck));
}
@@ -324,21 +342,35 @@ static void spi_dpram_irq_work_handler(struct work_struct *work)
{
//RAM2
ptr = port->dpram.read_ptr(&port->dpram,SPI_DPRAM_PTR2_BPWRITE_APREAD);
len = ptr;
if(ptr%2)
len = ptr+1;
else
len = ptr;
port->dpram.read_dpram(&port->dpram, SPI_DPRAM_LOG_BPWRITE_START, port->dpram.prx, len);
port->dpram.rec_len += len;
printk("%s:ram2:len=%d\n",__FUNCTION__,len);
port->dpram.rec_len += ptr;
printk("%s:ram2:ptr=%d,len=%d\n",__FUNCTION__,ptr,len);
//if(++gNumSendAck > (1<<12))
//gNumSendAck = 0;
//port->dpram.write_ack(&port->dpram, (MAILBOX_APSEND_ACK | MAILBOX_RAM2 | gNumSendAck));
p = port->dpram.prx;
for(i=0;i<(len>>1);i++)
{
temp = *(p+(i<<1));
*(p+(i<<1))= *(p+(i<<1)+1);
*(p+(i<<1)+1) = temp;
}
//wake up ap to read data
wake_up_interruptible(&port->dpram.recq);
mutex_lock(&port->dpram.rec_lock);
//allow bp write ram0 again
port->dpram.write_ack(&port->dpram, (MAILBOX_APSEND_ACK | MAILBOX_RAM2));
//printk("%s:r_irq=0x%x,s_ack=0x%x\n",__FUNCTION__, mbox, (MAILBOX_APSEND_ACK | MAILBOX_RAM2 | gNumSendAck));
}
}
@@ -465,7 +497,7 @@ static void spi_testdpram_timer(unsigned long data)
int spi_dpram_handle_ack(struct spi_device *spi)
{
struct spi_fpga_port *port = spi_get_drvdata(spi);
printk("Enter::%s,LINE=%d\n",__FUNCTION__,__LINE__);
//clear ack interrupt
port->dpram.read_ack(&port->dpram);
@@ -507,13 +539,17 @@ static int dpr_close(struct inode *inode, struct file *filp)
return 0;
}
int gRecCount = 0;
static ssize_t dpr_read (struct file *filp, char __user *buffer, size_t count, loff_t *ppos)
{
//int ret;
int ret=0;
struct spi_fpga_port *port = filp->private_data;
printk("%s:line=%d,port=0x%x\n",__FUNCTION__,__LINE__,(int)port);
down_interruptible(&port->dpram.rec_sem);
printk("%s, port=0x%x , count=%d, port->dpram.rec_len=%d \n",__FUNCTION__, (int)port, count, port->dpram.rec_len);
//printk("%s:CURRENT_TASK=0x%x\n",__FUNCTION__,current);
while(port->dpram.rec_len == 0)
{
if( filp->f_flags&O_NONBLOCK )
@@ -524,22 +560,50 @@ static ssize_t dpr_read (struct file *filp, char __user *buffer, size_t count, l
printk("%s:NO data in dpram!\n",__FUNCTION__);
return -ERESTARTSYS;
}
gRecCount = port->dpram.rec_len;
}
/*read data from buffer*/
if(copy_to_user((char*)buffer, (char *)port->dpram.prx, port->dpram.rec_len))
{
printk("%s:copy_to_user err!\n",__FUNCTION__);
return -EFAULT;
}
if(port->dpram.rec_len >=count){
if(copy_to_user((char*)buffer, (char *)(port->dpram.prx + gRecCount - port->dpram.rec_len), count))
{
printk("%s:copy_to_user err!\n",__FUNCTION__);
return -EFAULT;
}
ret = count;
}else{
if(copy_to_user((char*)buffer, (char *)(port->dpram.prx + gRecCount - port->dpram.rec_len), port->dpram.rec_len))
{
printk("%s:copy_to_user err!\n",__FUNCTION__);
return -EFAULT;
}
ret = port->dpram.rec_len;
}
#if 1
int i;
char *p = buffer;
for(i=0;i<ret;i++)
{
printk("dpr_read, prx[%d]=0x%x\n", i, *p++);
}
#endif
if(port->dpram.rec_len >= count){
port->dpram.rec_len -= count;
}else{
port->dpram.rec_len = 0;
}
if(port->dpram.rec_len == 0){
printk("port->dpram.rec_len to 0 \n");
mutex_unlock(&port->dpram.rec_lock);
}
up(&port->dpram.rec_sem);
count = port->dpram.rec_len;
port->dpram.rec_len = 0;
//allow bp write ram0 again
port->dpram.write_ack(&port->dpram, (MAILBOX_APSEND_ACK | MAILBOX_RAM0));
return count;
return ret;
}
@@ -585,7 +649,6 @@ static ssize_t dpr_write (struct file *filp, const char __user *buffer, size_t c
temp = *(p+(i<<1));
*(p+(i<<1))= *(p+(i<<1)+1);
*(p+(i<<1)+1) = temp;
p=p+2;
}
#if 1
@@ -604,7 +667,7 @@ static ssize_t dpr_write (struct file *filp, const char __user *buffer, size_t c
gNumSendInt = 0;
//send irq to bp after ap write data to dpram
port->dpram.write_irq(&port->dpram, MAILBOX_APSEND_IRQ);
port->dpram.write_irq(&port->dpram, MAILBOX_APSEND_IRQ | MAILBOX_RAM1);
return count;
@@ -618,6 +681,23 @@ unsigned int dpr_poll(struct file *filp, struct poll_table_struct * wait)
port = filp->private_data;
printk("%s:line=%d\n",__FUNCTION__,__LINE__);
#if 1
poll_wait(filp, &port->dpram.recq, wait);
poll_wait(filp, &port->dpram.sendq, wait);
if(port->dpram.rec_len >0)
{
mask |= POLLIN|POLLRDNORM;
DBG("%s:exsram_poll_____1\n",__FUNCTION__);
}
if(port->dpram.apwrite_en == TRUE)
{
mask |= POLLOUT|POLLWRNORM;
DBG("%s:exsram_poll_____2\n",__FUNCTION__);
}
#endif
return mask;
}
@@ -677,6 +757,12 @@ int spi_dpram_register(struct spi_fpga_port *port)
//init the struct spi_dpram
init_waitqueue_head(&port->dpram.recq);
init_waitqueue_head(&port->dpram.sendq);
mutex_init(&port->dpram.rec_lock);
mutex_init(&port->dpram.send_lock);
init_MUTEX(&port->dpram.rec_sem);
init_MUTEX(&port->dpram.send_sem);
spin_lock_init(&port->dpram.spin_rec_lock);
spin_lock_init(&port->dpram.spin_send_lock);
port->dpram.rec_len = 0;
port->dpram.send_len = 0;
port->dpram.apwrite_en = TRUE;

View File

@@ -2,6 +2,7 @@
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/mutex.h>
#include <linux/seq_file.h>
#include <linux/serial_reg.h>
#include <linux/circ_buf.h>
#include <linux/gfp.h>
@@ -45,7 +46,7 @@ static struct tty_driver *spi_uart_tty_driver;
#define UART_NR 1 /* Number of UARTs this driver can handle */
#define UART_XMIT_SIZE (PAGE_SIZE<<1)
#define UART_XMIT_SIZE PAGE_SIZE
#define WAKEUP_CHARS 1024
#define circ_empty(circ) ((circ)->head == (circ)->tail)
@@ -70,17 +71,17 @@ static int spi_uart_write_buf(struct spi_uart *uart, unsigned char *buf, int len
int index = port->uart.index;
int reg = 0, stat = 0;
int i;
for(i=len+2;i>1;i--)
buf[i] = buf[i-2];
unsigned char tx_buf[SPI_UART_FIFO_LEN+2];
memcpy(tx_buf + 2, buf, len);
reg = ((((reg) | ICE_SEL_UART) & ICE_SEL_WRITE) | ICE_SEL_UART_CH(index));
buf[0] = reg & 0xff;
buf[1] = 0;
tx_buf[0] = reg & 0xff;
tx_buf[1] = 0;
stat = spi_write(port->spi, buf, len+2);
stat = spi_write(port->spi, tx_buf, len+2);
if(stat)
printk("%s:spi_write err!!!\n\n\n",__FUNCTION__);
DBG("%s:reg=0x%x,buf=0x%x,len=0x%x\n",__FUNCTION__,reg&0xff,(int)buf,len);
DBG("%s:reg=0x%x,buf=0x%x,len=0x%x\n",__FUNCTION__,reg&0xff,(int)tx_buf,len);
return 0;
}
@@ -183,11 +184,11 @@ static void spi_uart_port_remove(struct spi_uart *uart)
* Beware: the lock ordering is critical.
*/
mutex_lock(&uart->open_lock);
//mutex_lock(&port->spi_lock);
mutex_lock(&port->spi_lock);
spi = port->spi;
port->spi = NULL;
//mutex_unlock(&port->spi_lock);
mutex_unlock(&port->spi_lock);
if (uart->opened)
tty_hangup(uart->tty);
mutex_unlock(&uart->open_lock);
@@ -432,13 +433,16 @@ static void spi_uart_receive_chars(struct spi_uart *uart, unsigned int *status)
while (count-- >0 )
{
flag = TTY_NORMAL;
uart->icount.rx++;
ch = buf[num++];
tty_insert_flip_char(tty, ch, flag);
//printk("%c,",ch);
}
//printk("\n");
tty_flip_buffer_push(tty);
}
tty_flip_buffer_push(tty);
#else
//printk("rx:");
while (--max_count >0 )
@@ -775,7 +779,7 @@ static int spi_uart_startup(struct spi_uart *uart)
uart->xmit.buf = (unsigned char *)page;
circ_clear(&uart->xmit);
//mutex_lock(&port->spi_lock);
mutex_lock(&port->spi_lock);
/*
* Clear the FIFO buffers and disable them.
@@ -816,7 +820,7 @@ static int spi_uart_startup(struct spi_uart *uart)
DBG("%s:LINE=%d,uart->ier=0x%x\n",__FUNCTION__,__LINE__,uart->ier);
/* Kick the IRQ handler once while we're still holding the host lock */
//spi_uart_handle_irq(port->spi);
//mutex_unlock(&port->spi_lock);
mutex_unlock(&port->spi_lock);
return 0;
//err1:
@@ -829,7 +833,7 @@ static void spi_uart_shutdown(struct spi_uart *uart)
struct spi_fpga_port *port = container_of(uart, struct spi_fpga_port, uart);
DBG("%s:LINE=%d\n",__FUNCTION__,__LINE__);
//mutex_lock(&port->spi_lock);
mutex_lock(&port->spi_lock);
#if 1
spi_uart_stop_rx(uart);
@@ -854,7 +858,7 @@ static void spi_uart_shutdown(struct spi_uart *uart)
UART_FCR_CLEAR_XMIT, SEL_UART);
spi_out(port, UART_FCR, 0, SEL_UART);
#endif
//mutex_unlock(&port->spi_lock);
mutex_unlock(&port->spi_lock);
//skip:
/* Free the transmit buffer page. */
@@ -973,13 +977,13 @@ static int spi_uart_write(struct tty_struct * tty, const unsigned char *buf,
#if 1
if ( !(uart->ier & UART_IER_THRI)) {
//mutex_lock(&port->spi_lock);
mutex_lock(&port->spi_lock);
DBG("%s:LINE=%d\n",__FUNCTION__,__LINE__);
/*Note:ICE65L08 output a 'Transmitter holding register interrupt' after 1us*/
printk("s,");
spi_uart_start_tx(uart);
// spi_uart_handle_irq(port->spi);
//mutex_unlock(&port->spi_lock);
//spi_uart_handle_irq(port->spi);
mutex_unlock(&port->spi_lock);
}
#endif
@@ -1008,11 +1012,11 @@ static void spi_uart_send_xchar(struct tty_struct *tty, char ch)
printk("%s:LINE=%d\n",__FUNCTION__,__LINE__);
uart->x_char = ch;
if (ch && !(uart->ier & UART_IER_THRI)) {
//mutex_lock(&port->spi_lock);
mutex_lock(&port->spi_lock);
spi_uart_start_tx(uart);
printk("%s:UART_IER=0x%x\n",__FUNCTION__,uart->ier);
spi_uart_handle_irq(port->spi);
//mutex_unlock(&port->spi_lock);
mutex_unlock(&port->spi_lock);
}
}
@@ -1024,7 +1028,7 @@ static void spi_uart_throttle(struct tty_struct *tty)
if (!I_IXOFF(tty) && !(tty->termios->c_cflag & CRTSCTS))
return;
printk("%s:LINE=%d\n",__FUNCTION__,__LINE__);
//mutex_lock(&port->spi_lock);
mutex_lock(&port->spi_lock);
if (I_IXOFF(tty)) {
uart->x_char = STOP_CHAR(tty);
spi_uart_start_tx(uart);
@@ -1035,7 +1039,7 @@ static void spi_uart_throttle(struct tty_struct *tty)
spi_uart_clear_mctrl(uart, TIOCM_RTS);
spi_uart_handle_irq(port->spi);
//mutex_unlock(&port->spi_lock);
mutex_unlock(&port->spi_lock);
}
static void spi_uart_unthrottle(struct tty_struct *tty)
@@ -1045,7 +1049,7 @@ static void spi_uart_unthrottle(struct tty_struct *tty)
printk("%s:LINE=%d\n",__FUNCTION__,__LINE__);
if (!I_IXOFF(tty) && !(tty->termios->c_cflag & CRTSCTS))
return;
//mutex_lock(&port->spi_lock);
mutex_lock(&port->spi_lock);
if (I_IXOFF(tty)) {
if (uart->x_char) {
uart->x_char = 0;
@@ -1060,13 +1064,13 @@ static void spi_uart_unthrottle(struct tty_struct *tty)
spi_uart_set_mctrl(uart, TIOCM_RTS);
spi_uart_handle_irq(port->spi);
//mutex_unlock(&port->spi_lock);
mutex_unlock(&port->spi_lock);
}
static void spi_uart_set_termios(struct tty_struct *tty, struct ktermios *old_termios)
{
struct spi_uart *uart = tty->driver_data;
//struct spi_fpga_port *port = container_of(uart, struct spi_fpga_port, uart);
struct spi_fpga_port *port = container_of(uart, struct spi_fpga_port, uart);
unsigned int cflag = tty->termios->c_cflag;
unsigned int mask = TIOCM_DTR;
DBG("%s:LINE=%d\n",__FUNCTION__,__LINE__);
@@ -1077,7 +1081,7 @@ static void spi_uart_set_termios(struct tty_struct *tty, struct ktermios *old_te
RELEVANT_IFLAG(tty->termios->c_iflag ^ old_termios->c_iflag) == 0)
return;
//mutex_lock(&port->spi_lock);
mutex_lock(&port->spi_lock);
spi_uart_change_speed(uart, tty->termios, old_termios);
/* Handle transition to B0 status */
@@ -1111,7 +1115,7 @@ static void spi_uart_set_termios(struct tty_struct *tty, struct ktermios *old_te
spi_uart_stop_tx(uart);
}
}
//mutex_unlock(&port->spi_lock);
mutex_unlock(&port->spi_lock);
}
@@ -1120,25 +1124,25 @@ static int spi_uart_break_ctl(struct tty_struct *tty, int break_state)
struct spi_uart *uart = tty->driver_data;
struct spi_fpga_port *port = container_of(uart, struct spi_fpga_port, uart);
DBG("%s:LINE=%d\n",__FUNCTION__,__LINE__);
//mutex_lock(&port->spi_lock);
mutex_lock(&port->spi_lock);
if (break_state == -1)
uart->lcr |= UART_LCR_SBC;
else
uart->lcr &= ~UART_LCR_SBC;
spi_out(port, UART_LCR, uart->lcr, SEL_UART);
//mutex_unlock(&port->spi_lock);
mutex_unlock(&port->spi_lock);
return 0;
}
static int spi_uart_tiocmget(struct tty_struct *tty, struct file *file)
{
struct spi_uart *uart = tty->driver_data;
//struct spi_fpga_port *port = container_of(uart, struct spi_fpga_port, uart);
struct spi_fpga_port *port = container_of(uart, struct spi_fpga_port, uart);
int result;
DBG("%s:LINE=%d\n",__FUNCTION__,__LINE__);
//mutex_lock(&port->spi_lock);
mutex_lock(&port->spi_lock);
result = uart->mctrl | spi_uart_get_mctrl(uart);
//mutex_unlock(&port->spi_lock);
mutex_unlock(&port->spi_lock);
return result;
}
@@ -1146,77 +1150,72 @@ static int spi_uart_tiocmset(struct tty_struct *tty, struct file *file,
unsigned int set, unsigned int clear)
{
struct spi_uart *uart = tty->driver_data;
//struct spi_fpga_port *port = container_of(uart, struct spi_fpga_port, uart);
struct spi_fpga_port *port = container_of(uart, struct spi_fpga_port, uart);
DBG("%s:LINE=%d\n",__FUNCTION__,__LINE__);
//mutex_lock(&port->spi_lock);
mutex_lock(&port->spi_lock);
spi_uart_update_mctrl(uart, set, clear);
//mutex_unlock(&port->spi_lock);
mutex_unlock(&port->spi_lock);
return 0;
}
#if 0
static int spi_uart_read_proc(char *page, char **start, off_t off,
int count, int *eof, void *data)
static int spi_uart_proc_show(struct seq_file *m, void *v)
{
int i, len = 0;
off_t begin = 0;
DBG("%s:LINE=%d************************\n",__FUNCTION__,__LINE__);
len += sprintf(page, "serinfo:1.0 driver%s%s revision:%s\n",
"", "", "");
for (i = 0; i < UART_NR && len < PAGE_SIZE - 96; i++) {
struct spi_uart *uart = spi_uart_port_get(i);
if (uart) {
len += sprintf(page+len, "%d: uart:SPI", i);
if(capable(CAP_SYS_ADMIN)) {
len += sprintf(page + len, " tx:%d rx:%d",
uart->icount.tx, uart->icount.rx);
if (uart->icount.frame)
len += sprintf(page + len, " fe:%d",
uart->icount.frame);
if (uart->icount.parity)
len += sprintf(page + len, " pe:%d",
uart->icount.parity);
if (uart->icount.brk)
len += sprintf(page + len, " brk:%d",
uart->icount.brk);
if (uart->icount.overrun)
len += sprintf(page + len, " oe:%d",
uart->icount.overrun);
if (uart->icount.cts)
len += sprintf(page + len, " cts:%d",
uart->icount.cts);
if (uart->icount.dsr)
len += sprintf(page + len, " dsr:%d",
uart->icount.dsr);
if (uart->icount.rng)
len += sprintf(page + len, " rng:%d",
uart->icount.rng);
if (uart->icount.dcd)
len += sprintf(page + len, " dcd:%d",
uart->icount.dcd);
}
strcat(page, "\n");
len++;
spi_uart_port_put(uart);
}
int i;
if (len + begin > off + count)
goto done;
if (len + begin < off) {
begin += len;
len = 0;
seq_printf(m, "serinfo:1.0 driver%s%s revision:%s\n",
"", "", "");
for (i = 0; i < UART_NR; i++) {
struct spi_uart *port = spi_uart_port_get(i);
if (port) {
seq_printf(m, "%d: uart:SPI", i);
if(capable(CAP_SYS_ADMIN)) {
seq_printf(m, " tx:%d rx:%d",
port->icount.tx, port->icount.rx);
if (port->icount.frame)
seq_printf(m, " fe:%d",
port->icount.frame);
if (port->icount.parity)
seq_printf(m, " pe:%d",
port->icount.parity);
if (port->icount.brk)
seq_printf(m, " brk:%d",
port->icount.brk);
if (port->icount.overrun)
seq_printf(m, " oe:%d",
port->icount.overrun);
if (port->icount.cts)
seq_printf(m, " cts:%d",
port->icount.cts);
if (port->icount.dsr)
seq_printf(m, " dsr:%d",
port->icount.dsr);
if (port->icount.rng)
seq_printf(m, " rng:%d",
port->icount.rng);
if (port->icount.dcd)
seq_printf(m, " dcd:%d",
port->icount.dcd);
}
spi_uart_port_put(port);
seq_putc(m, '\n');
}
}
*eof = 1;
done:
if (off >= len + begin)
return 0;
*start = page + (off - begin);
return (count < begin + len - off) ? count : (begin + len - off);
return 0;
}
#endif
static int spi_uart_proc_open(struct inode *inode, struct file *file)
{
return single_open(file, spi_uart_proc_show, NULL);
}
static const struct file_operations spi_uart_proc_fops = {
.owner = THIS_MODULE,
.open = spi_uart_proc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static const struct tty_operations spi_uart_ops = {
.open = spi_uart_open,
@@ -1231,7 +1230,7 @@ static const struct tty_operations spi_uart_ops = {
.break_ctl = spi_uart_break_ctl,
.tiocmget = spi_uart_tiocmget,
.tiocmset = spi_uart_tiocmset,
//.read_proc = spi_uart_read_proc,
.proc_fops = &spi_uart_proc_fops,
};