Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 175355
b: refs/heads/master
c: f5c5a36
h: refs/heads/master
i:
  175353: bd19e9c
  175351: 46496dd
v: v3
  • Loading branch information
Alan Cox authored and Greg Kroah-Hartman committed Dec 11, 2009
1 parent e76c4db commit 2a6aa77
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f176178ba09d27cc33988435e2c9fe078b44998c
refs/heads/master: f5c5a36d27ae6d9e03c2f1b7890942bf84e92c5b
27 changes: 22 additions & 5 deletions trunk/drivers/char/moxa.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,25 @@ static void moxa_wait_finish(void __iomem *ofsAddr)

static void moxafunc(void __iomem *ofsAddr, u16 cmd, u16 arg)
{
unsigned long flags;
spin_lock_irqsave(&moxafunc_lock, flags);
writew(arg, ofsAddr + FuncArg);
writew(cmd, ofsAddr + FuncCode);
moxa_wait_finish(ofsAddr);
spin_unlock_irqrestore(&moxafunc_lock, flags);
}

static int moxafuncret(void __iomem *ofsAddr, u16 cmd, u16 arg)
{
unsigned long flags;
u16 ret;
spin_lock_irqsave(&moxafunc_lock, flags);
writew(arg, ofsAddr + FuncArg);
writew(cmd, ofsAddr + FuncCode);
moxa_wait_finish(ofsAddr);
ret = readw(ofsAddr + FuncArg);
spin_unlock_irqrestore(&moxafunc_lock, flags);
return ret;
}

static void moxa_low_water_check(void __iomem *ofsAddr)
Expand Down Expand Up @@ -417,6 +433,7 @@ static const struct tty_port_operations moxa_port_ops = {
static struct tty_driver *moxaDriver;
static DEFINE_TIMER(moxaTimer, moxa_poll, 0, 0);
static DEFINE_SPINLOCK(moxa_lock);
static DEFINE_SPINLOCK(moxafunc_lock);

/*
* HW init
Expand Down Expand Up @@ -1823,10 +1840,12 @@ static int MoxaPortSetTermio(struct moxa_port *port, struct ktermios *termio,
baud = MoxaPortSetBaud(port, baud);

if (termio->c_iflag & (IXON | IXOFF | IXANY)) {
spin_lock_irq(&moxafunc_lock);
writeb(termio->c_cc[VSTART], ofsAddr + FuncArg);
writeb(termio->c_cc[VSTOP], ofsAddr + FuncArg1);
writeb(FC_SetXonXoff, ofsAddr + FuncCode);
moxa_wait_finish(ofsAddr);
spin_unlock_irqrestore(&moxafunc_lock);

}
return baud;
Expand Down Expand Up @@ -1879,12 +1898,10 @@ static int MoxaPortLineStatus(struct moxa_port *port)
int val;

ofsAddr = port->tableAddr;
if (MOXA_IS_320(port->board)) {
moxafunc(ofsAddr, FC_LineStatus, 0);
val = readw(ofsAddr + FuncArg);
} else {
if (MOXA_IS_320(port->board))
val = moxafuncret(ofsAddr, FC_LineStatus, 0);
else
val = readw(ofsAddr + FlagStat) >> 4;
}
val &= 0x0B;
if (val & 8)
val |= 4;
Expand Down

0 comments on commit 2a6aa77

Please sign in to comment.