Merge branch 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus
[linux-drm-fsl-dcu.git] / drivers / char / rio / riointr.c
index 97f0fa550652d84af87985079c99b9d3a1ec0655..ebc76342712c1485da63b58eb01d83be38e34a4d 100644 (file)
@@ -102,7 +102,7 @@ void RIOTxEnable(char *en)
        struct rio_info *p;
        struct tty_struct *tty;
        int c;
-       struct PKT *PacketP;
+       struct PKT __iomem *PacketP;
        unsigned long flags;
 
        PortP = (struct Port *) en;
@@ -144,7 +144,7 @@ void RIOTxEnable(char *en)
                if (c == 0)
                        break;
 
-               rio_memcpy_toio(PortP->HostP->Caddr, (caddr_t) PacketP->data, PortP->gs.xmit_buf + PortP->gs.xmit_tail, c);
+               rio_memcpy_toio(PortP->HostP->Caddr, PacketP->data, PortP->gs.xmit_buf + PortP->gs.xmit_tail, c);
                /*    udelay (1); */
 
                writeb(c, &(PacketP->len));
@@ -162,13 +162,8 @@ void RIOTxEnable(char *en)
 
        rio_spin_unlock_irqrestore(&PortP->portSem, flags);
 
-       if (PortP->gs.xmit_cnt <= (PortP->gs.wakeup_chars + 2 * PKT_MAX_DATA_LEN)) {
-               rio_dprintk(RIO_DEBUG_INTR, "Waking up.... ldisc:%d (%d/%d)....", (int) (PortP->gs.tty->flags & (1 << TTY_DO_WRITE_WAKEUP)), PortP->gs.wakeup_chars, PortP->gs.xmit_cnt);
-               if ((PortP->gs.tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && PortP->gs.tty->ldisc.write_wakeup)
-                       (PortP->gs.tty->ldisc.write_wakeup) (PortP->gs.tty);
-               rio_dprintk(RIO_DEBUG_INTR, "(%d/%d)\n", PortP->gs.wakeup_chars, PortP->gs.xmit_cnt);
-               wake_up_interruptible(&PortP->gs.tty->write_wait);
-       }
+       if (PortP->gs.xmit_cnt <= (PortP->gs.wakeup_chars + 2 * PKT_MAX_DATA_LEN))
+               tty_wakeup(PortP->gs.tty);
 
 }
 
@@ -181,7 +176,7 @@ static int RupIntr;
 static int RxIntr;
 static int TxIntr;
 
-void RIOServiceHost(struct rio_info *p, struct Host *HostP, int From)
+void RIOServiceHost(struct rio_info *p, struct Host *HostP)
 {
        rio_spin_lock(&HostP->HostLock);
        if ((HostP->Flags & RUN_STATE) != RC_RUNNING) {
@@ -219,7 +214,7 @@ void RIOServiceHost(struct rio_info *p, struct Host *HostP, int From)
                for (port = p->RIOFirstPortsBooted; port < p->RIOLastPortsBooted + PORTS_PER_RTA; port++) {
                        struct Port *PortP = p->RIOPortp[port];
                        struct tty_struct *ttyP;
-                       struct PKT *PacketP;
+                       struct PKT __iomem *PacketP;
 
                        /*
                         ** not mapped in - most of the RIOPortp[] information
@@ -298,7 +293,7 @@ void RIOServiceHost(struct rio_info *p, struct Host *HostP, int From)
                for (port = p->RIOFirstPortsBooted; port < p->RIOLastPortsBooted + PORTS_PER_RTA; port++) {
                        struct Port *PortP = p->RIOPortp[port];
                        struct tty_struct *ttyP;
-                       struct PKT *PacketP;
+                       struct PKT __iomem *PacketP;
 
                        /*
                         ** not mapped in - most of the RIOPortp[] information
@@ -427,13 +422,13 @@ void RIOServiceHost(struct rio_info *p, struct Host *HostP, int From)
 
                                while (PortP->WflushFlag && can_add_transmit(&PacketP, PortP) && (PortP->InUse == NOT_INUSE)) {
                                        int p;
-                                       struct PktCmd *PktCmdP;
+                                       struct PktCmd __iomem *PktCmdP;
 
                                        rio_dprintk(RIO_DEBUG_INTR, "Add WFLUSH marker to data queue\n");
                                        /*
                                         ** make it look just like a WFLUSH command
                                         */
-                                       PktCmdP = (struct PktCmd *) &PacketP->data[0];
+                                       PktCmdP = (struct PktCmd __iomem *) &PacketP->data[0];
 
                                        writeb(WFLUSH, &PktCmdP->Command);
 
@@ -525,9 +520,9 @@ static void RIOReceive(struct rio_info *p, struct Port *PortP)
 {
        struct tty_struct *TtyP;
        unsigned short transCount;
-       struct PKT *PacketP;
+       struct PKT __iomem *PacketP;
        register unsigned int DataCnt;
-       unsigned char *ptr;
+       unsigned char __iomem *ptr;
        unsigned char *buf;
        int copied = 0;
 
@@ -546,7 +541,7 @@ static void RIOReceive(struct rio_info *p, struct Port *PortP)
         ** run out of space it will be set to the offset of the
         ** next byte to copy from the packet data area. The packet
         ** length field is decremented by the number of bytes that
-        ** we succesfully removed from the packet. When this reaches
+        ** we successfully removed from the packet. When this reaches
         ** zero, we reset the offset pointer to be zero, and free
         ** the packet from the front of the queue.
         */
@@ -585,19 +580,19 @@ static void RIOReceive(struct rio_info *p, struct Port *PortP)
                        /*
                         ** check that it is not a command!
                         */
-                       if (PacketP->len & PKT_CMD_BIT) {
+                       if (readb(&PacketP->len) & PKT_CMD_BIT) {
                                rio_dprintk(RIO_DEBUG_INTR, "RIO: unexpected command packet received on PHB\n");
                                /*      rio_dprint(RIO_DEBUG_INTR, (" sysport   = %d\n", p->RIOPortp->PortNum)); */
-                               rio_dprintk(RIO_DEBUG_INTR, " dest_unit = %d\n", PacketP->dest_unit);
-                               rio_dprintk(RIO_DEBUG_INTR, " dest_port = %d\n", PacketP->dest_port);
-                               rio_dprintk(RIO_DEBUG_INTR, " src_unit  = %d\n", PacketP->src_unit);
-                               rio_dprintk(RIO_DEBUG_INTR, " src_port  = %d\n", PacketP->src_port);
-                               rio_dprintk(RIO_DEBUG_INTR, " len          = %d\n", PacketP->len);
-                               rio_dprintk(RIO_DEBUG_INTR, " control   = %d\n", PacketP->control);
-                               rio_dprintk(RIO_DEBUG_INTR, " csum         = %d\n", PacketP->csum);
+                               rio_dprintk(RIO_DEBUG_INTR, " dest_unit = %d\n", readb(&PacketP->dest_unit));
+                               rio_dprintk(RIO_DEBUG_INTR, " dest_port = %d\n", readb(&PacketP->dest_port));
+                               rio_dprintk(RIO_DEBUG_INTR, " src_unit  = %d\n", readb(&PacketP->src_unit));
+                               rio_dprintk(RIO_DEBUG_INTR, " src_port  = %d\n", readb(&PacketP->src_port));
+                               rio_dprintk(RIO_DEBUG_INTR, " len          = %d\n", readb(&PacketP->len));
+                               rio_dprintk(RIO_DEBUG_INTR, " control   = %d\n", readb(&PacketP->control));
+                               rio_dprintk(RIO_DEBUG_INTR, " csum         = %d\n", readw(&PacketP->csum));
                                rio_dprintk(RIO_DEBUG_INTR, "    data bytes: ");
                                for (DataCnt = 0; DataCnt < PKT_MAX_DATA_LEN; DataCnt++)
-                                       rio_dprintk(RIO_DEBUG_INTR, "%d\n", PacketP->data[DataCnt]);
+                                       rio_dprintk(RIO_DEBUG_INTR, "%d\n", readb(&PacketP->data[DataCnt]));
                                remove_receive(PortP);
                                put_free_end(PortP->HostP, PacketP);
                                continue;       /* with next packet */
@@ -618,24 +613,24 @@ static void RIOReceive(struct rio_info *p, struct Port *PortP)
                         ** and available space.
                         */
 
-                       transCount = tty_buffer_request_room(TtyP, PacketP->len & PKT_LEN_MASK);
+                       transCount = tty_buffer_request_room(TtyP, readb(&PacketP->len) & PKT_LEN_MASK);
                        rio_dprintk(RIO_DEBUG_REC, "port %d: Copy %d bytes\n", PortP->PortNum, transCount);
                        /*
                         ** To use the following 'kkprintfs' for debugging - change the '#undef'
                         ** to '#define', (this is the only place ___DEBUG_IT___ occurs in the
                         ** driver).
                         */
-                       ptr = (unsigned char *) PacketP->data + PortP->RxDataStart;
+                       ptr = (unsigned char __iomem *) PacketP->data + PortP->RxDataStart;
 
                        tty_prepare_flip_string(TtyP, &buf, transCount);
                        rio_memcpy_fromio(buf, ptr, transCount);
                        PortP->RxDataStart += transCount;
-                       PacketP->len -= transCount;
+                       writeb(readb(&PacketP->len)-transCount, &PacketP->len);
                        copied += transCount;
 
 
 
-                       if (PacketP->len == 0) {
+                       if (readb(&PacketP->len) == 0) {
                                /*
                                 ** If we have emptied the packet, then we can
                                 ** free it, and reset the start pointer for