Merge to Fedora kernel-2.6.18-1.2224_FC5 patched with stable patch-2.6.18.1-vs2.0...
[linux-2.6.git] / drivers / char / cyclades.c
index e69dc6d..c1c6728 100644 (file)
@@ -281,7 +281,7 @@ static char rcsid[] =
  * make sure "cyc" appears in all kernel messages; all soft interrupts
  * handled by same routine; recognize out-of-band reception; comment
  * out some diagnostic messages; leave RTS/CTS flow control to hardware;
- * fix race condition in -Z buffer management; only -Y needs to explictly
+ * fix race condition in -Z buffer management; only -Y needs to explicitly
  * flush chars; tidy up some startup messages;
  *
  * Revision 1.36.4.18  1996/07/25 18:57:31  bentson
@@ -633,7 +633,6 @@ static char rcsid[] =
 /*
  * Include section 
  */
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/errno.h>
 #include <linux/signal.h>
@@ -641,6 +640,7 @@ static char rcsid[] =
 #include <linux/timer.h>
 #include <linux/interrupt.h>
 #include <linux/tty.h>
+#include <linux/tty_flip.h>
 #include <linux/serial.h>
 #include <linux/major.h>
 #include <linux/string.h>
@@ -652,12 +652,12 @@ static char rcsid[] =
 #include <linux/init.h>
 #include <linux/delay.h>
 #include <linux/spinlock.h>
+#include <linux/bitops.h>
 
 #include <asm/system.h>
 #include <asm/io.h>
 #include <asm/irq.h>
 #include <asm/uaccess.h>
-#include <asm/bitops.h>
 
 #define        CY_LOCK(info,flags)                                     \
                do {                                            \
@@ -682,13 +682,13 @@ static void cy_send_xchar (struct tty_struct *tty, char ch);
 #define IS_CYC_Z(card) ((card).num_chips == -1)
 
 #define Z_FPGA_CHECK(card) \
-    ((cy_readl(&((struct RUNTIME_9060 *) \
+    ((cy_readl(&((struct RUNTIME_9060 __iomem *) \
                 ((card).ctl_addr))->init_ctrl) & (1<<17)) != 0)
 
-#define ISZLOADED(card)        (((ZO_V1==cy_readl(&((struct RUNTIME_9060 *) \
+#define ISZLOADED(card)        (((ZO_V1==cy_readl(&((struct RUNTIME_9060 __iomem *) \
                        ((card).ctl_addr))->mail_box_0)) || \
                        Z_FPGA_CHECK(card)) && \
-                       (ZFIRM_ID==cy_readl(&((struct FIRM_ID *) \
+                       (ZFIRM_ID==cy_readl(&((struct FIRM_ID __iomem *) \
                        ((card).base_addr+ID_ADDRESS))->signature)))
 
 #ifndef SERIAL_XMIT_SIZE
@@ -712,25 +712,25 @@ static struct tty_driver *cy_serial_driver;
    boot options line.  The form is "cyclades=address,address..."
 */
 
-static unsigned char *cy_isa_addresses[] = {
-        (unsigned char *) 0xD0000,
-        (unsigned char *) 0xD2000,
-        (unsigned char *) 0xD4000,
-        (unsigned char *) 0xD6000,
-        (unsigned char *) 0xD8000,
-        (unsigned char *) 0xDA000,
-        (unsigned char *) 0xDC000,
-        (unsigned char *) 0xDE000,
-        NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL
+static unsigned int cy_isa_addresses[] = {
+        0xD0000,
+        0xD2000,
+        0xD4000,
+        0xD6000,
+        0xD8000,
+        0xDA000,
+        0xDC000,
+        0xDE000,
+        0,0,0,0,0,0,0,0
 };
-#define NR_ISA_ADDRS (sizeof(cy_isa_addresses)/sizeof(unsigned char*))
+#define NR_ISA_ADDRS ARRAY_SIZE(cy_isa_addresses)
 
 #ifdef MODULE
 static long maddr[NR_CARDS] = { 0, };
 static int irq[NR_CARDS]  = { 0, };
 
-MODULE_PARM(maddr, "1-" __MODULE_STRING(NR_CARDS) "l");
-MODULE_PARM(irq, "1-" __MODULE_STRING(NR_CARDS) "i");
+module_param_array(maddr, long, NULL, 0);
+module_param_array(irq, int, NULL, 0);
 #endif
 
 #endif /* CONFIG_ISA */
@@ -758,7 +758,6 @@ static int cy_next_channel; /* next minor available */
  * allocated when the first cy_open occurs.
  */
 static unsigned char *tmp_buf;
-DECLARE_MUTEX(tmp_buf_sem);
 
 /*
  * This is used to look up the divisor speeds and the timeouts
@@ -854,7 +853,7 @@ static void cy_start(struct tty_struct *);
 static void set_line_char(struct cyclades_port *);
 static int cyz_issue_cmd(struct cyclades_card *, uclong, ucchar, uclong);
 #ifdef CONFIG_ISA
-static unsigned detect_isa_irq (volatile ucchar *);
+static unsigned detect_isa_irq(void __iomem *);
 #endif /* CONFIG_ISA */
 
 static int cyclades_get_proc_info(char *, char **, off_t , int , int *, void *);
@@ -866,7 +865,7 @@ static void cyz_poll(unsigned long);
 static long cyz_polling_cycle = CZ_DEF_POLL;
 
 static int cyz_timeron = 0;
-static struct timer_list cyz_timerlist = TIMER_INITIALIZER(cyz_poll, 0, 0);
+static DEFINE_TIMER(cyz_timerlist, cyz_poll, 0, 0);
 
 #else /* CONFIG_CYZ_INTR */
 static void cyz_rx_restart(unsigned long);
@@ -970,10 +969,7 @@ do_softint(void *private_)
        wake_up_interruptible(&info->delta_msr_wait);
     }
     if (test_and_clear_bit(Cy_EVENT_WRITE_WAKEUP, &info->event)) {
-        if((tty->flags & (1<< TTY_DO_WRITE_WAKEUP))
-        && tty->ldisc.write_wakeup){
-            (tty->ldisc.write_wakeup)(tty);
-        }
+        tty_wakeup(tty);
         wake_up_interruptible(&tty->write_wait);
     }
 #ifdef Z_WAKE
@@ -995,7 +991,7 @@ do_softint(void *private_)
    This function is only called from inside spinlock-protected code.
  */
 static int
-cyy_issue_cmd(volatile ucchar *base_addr, u_char cmd, int index)
+cyy_issue_cmd(void __iomem *base_addr, u_char cmd, int index)
 {
   volatile int  i;
 
@@ -1011,7 +1007,7 @@ cyy_issue_cmd(volatile ucchar *base_addr, u_char cmd, int index)
     if (i == 100)      return (-1);
 
     /* Issue the new command */
-    cy_writeb((u_long)base_addr+(CyCCR<<index), cmd);
+    cy_writeb(base_addr+(CyCCR<<index), cmd);
 
     return(0);
 } /* cyy_issue_cmd */
@@ -1019,7 +1015,7 @@ cyy_issue_cmd(volatile ucchar *base_addr, u_char cmd, int index)
 #ifdef CONFIG_ISA
 /* ISA interrupt detection code */
 static unsigned 
-detect_isa_irq (volatile ucchar *address)
+detect_isa_irq(void __iomem *address)
 {
   int irq;
   unsigned long irqs, flags;
@@ -1030,7 +1026,7 @@ detect_isa_irq (volatile ucchar *address)
     irq = probe_irq_off(probe_irq_on());
 
     /* Clear interrupts on the board first */
-    cy_writeb((u_long)address + (Cy_ClrIntr<<index), 0);
+    cy_writeb(address + (Cy_ClrIntr<<index), 0);
                              /* Cy_ClrIntr is 0x1800 */
 
     irqs = probe_irq_on();
@@ -1039,11 +1035,11 @@ detect_isa_irq (volatile ucchar *address)
 
     /* Enable the Tx interrupts on the CD1400 */
     local_irq_save(flags);
-       cy_writeb((u_long)address + (CyCAR<<index), 0);
+       cy_writeb(address + (CyCAR<<index), 0);
        cyy_issue_cmd(address, CyCHAN_CTL|CyENB_XMTR, index);
 
-       cy_writeb((u_long)address + (CyCAR<<index), 0);
-       cy_writeb((u_long)address + (CySRER<<index), 
+       cy_writeb(address + (CyCAR<<index), 0);
+       cy_writeb(address + (CySRER<<index), 
                cy_readb(address + (CySRER<<index)) | CyTxRdy);
     local_irq_restore(flags);
 
@@ -1056,12 +1052,12 @@ detect_isa_irq (volatile ucchar *address)
     /* Clean up */
     save_xir = (u_char) cy_readb(address + (CyTIR<<index));
     save_car = cy_readb(address + (CyCAR<<index));
-    cy_writeb((u_long)address + (CyCAR<<index), (save_xir & 0x3));
-    cy_writeb((u_long)address + (CySRER<<index),
+    cy_writeb(address + (CyCAR<<index), (save_xir & 0x3));
+    cy_writeb(address + (CySRER<<index),
        cy_readb(address + (CySRER<<index)) & ~CyTxRdy);
-    cy_writeb((u_long)address + (CyTIR<<index), (save_xir & 0x3f));
-    cy_writeb((u_long)address + (CyCAR<<index), (save_car));
-    cy_writeb((u_long)address + (Cy_ClrIntr<<index), 0);
+    cy_writeb(address + (CyTIR<<index), (save_xir & 0x3f));
+    cy_writeb(address + (CyCAR<<index), (save_car));
+    cy_writeb(address + (Cy_ClrIntr<<index), 0);
                              /* Cy_ClrIntr is 0x1800 */
 
     return (irq > 0)? irq : 0;
@@ -1079,7 +1075,7 @@ cyy_interrupt(int irq, void *dev_id, struct pt_regs *regs)
   int status;
   struct cyclades_card *cinfo;
   struct cyclades_port *info;
-  volatile unsigned char *base_addr, *card_base_addr;
+  void __iomem *base_addr, *card_base_addr;
   int chip;
   int save_xir, channel, save_car;
   char data;
@@ -1090,7 +1086,7 @@ cyy_interrupt(int irq, void *dev_id, struct pt_regs *regs)
   int had_work;
   int mdm_change;
   int mdm_status;
-
+  int len;
     if((cinfo = (struct cyclades_card *)dev_id) == 0){
 #ifdef CY_DEBUG_INTERRUPTS
        printk("cyy_interrupt: spurious interrupt %d\n\r", irq);
@@ -1098,7 +1094,7 @@ cyy_interrupt(int irq, void *dev_id, struct pt_regs *regs)
         return IRQ_NONE; /* spurious interrupt */
     }
 
-    card_base_addr = (unsigned char *)cinfo->base_addr;
+    card_base_addr = cinfo->base_addr;
     index = cinfo->bus_index;
 
 
@@ -1110,8 +1106,7 @@ cyy_interrupt(int irq, void *dev_id, struct pt_regs *regs)
     do{
         had_work = 0;
         for ( chip = 0 ; chip < cinfo->num_chips ; chip ++) {
-            base_addr = (unsigned char *)
-                      (cinfo->base_addr + (cy_chip_offset[chip]<<index));
+            base_addr = cinfo->base_addr + (cy_chip_offset[chip]<<index);
             too_many = 0;
             while ( (status = cy_readb(base_addr+(CySVRR<<index))) != 0x00) {
                 had_work++;
@@ -1135,7 +1130,7 @@ cyy_interrupt(int irq, void *dev_id, struct pt_regs *regs)
                     info = &cy_port[i];
                     info->last_active = jiffies;
                     save_car = cy_readb(base_addr+(CyCAR<<index));
-                    cy_writeb((u_long)base_addr+(CyCAR<<index), save_xir);
+                    cy_writeb(base_addr+(CyCAR<<index), save_xir);
 
                     /* if there is nowhere to put the data, discard it */
                     if(info->tty == 0){
@@ -1168,63 +1163,43 @@ cyy_interrupt(int irq, void *dev_id, struct pt_regs *regs)
                                info->icount.rx++;
                                 continue;
                             }
-                            if (tty->flip.count < TTY_FLIPBUF_SIZE){
-                                tty->flip.count++;
+                            if (tty_buffer_request_room(tty, 1)) {
                                 if (data & info->read_status_mask){
                                     if(data & CyBREAK){
-                                        *tty->flip.flag_buf_ptr++ =
-                                                           TTY_BREAK;
-                                        *tty->flip.char_buf_ptr++ =
-                                         cy_readb(base_addr+(CyRDSR<<index));
+                                        tty_insert_flip_char(tty, cy_readb(base_addr+(CyRDSR<<index)), TTY_BREAK);
                                        info->icount.rx++;
                                         if (info->flags & ASYNC_SAK){
                                             do_SAK(tty);
                                         }
                                     }else if(data & CyFRAME){
-                                        *tty->flip.flag_buf_ptr++ =
-                                                           TTY_FRAME;
-                                        *tty->flip.char_buf_ptr++ =
-                                         cy_readb(base_addr+(CyRDSR<<index));
+                                        tty_insert_flip_char(tty, cy_readb(base_addr+(CyRDSR<<index)), TTY_FRAME);
                                        info->icount.rx++;
                                        info->idle_stats.frame_errs++;
                                     }else if(data & CyPARITY){
-                                        *tty->flip.flag_buf_ptr++ =
-                                                           TTY_PARITY;
-                                        *tty->flip.char_buf_ptr++ =
-                                         cy_readb(base_addr+(CyRDSR<<index));
+                                       /* Pieces of seven... */
+                                        tty_insert_flip_char(tty, cy_readb(base_addr+(CyRDSR<<index)), TTY_PARITY);
                                        info->icount.rx++;
                                        info->idle_stats.parity_errs++;
                                     }else if(data & CyOVERRUN){
-                                        *tty->flip.flag_buf_ptr++ =
-                                                           TTY_OVERRUN;
-                                        *tty->flip.char_buf_ptr++ = 0;
+                                        tty_insert_flip_char(tty, 0, TTY_OVERRUN);
                                        info->icount.rx++;
                                         /* If the flip buffer itself is
                                            overflowing, we still lose
                                            the next incoming character.
                                          */
-                                        if(tty->flip.count
-                                                  < TTY_FLIPBUF_SIZE){
-                                            tty->flip.count++;
-                                            *tty->flip.flag_buf_ptr++ =
-                                                            TTY_NORMAL;
-                                           *tty->flip.char_buf_ptr++ =
-                                           cy_readb(base_addr+(CyRDSR<<index));
-                                           info->icount.rx++;
-                                        }
+                                        tty_insert_flip_char(tty, cy_readb(base_addr+(CyRDSR<<index)), TTY_FRAME);
+                                       info->icount.rx++;
                                        info->idle_stats.overruns++;
                                     /* These two conditions may imply */
                                     /* a normal read should be done. */
                                     /* }else if(data & CyTIMEOUT){ */
                                     /* }else if(data & CySPECHAR){ */
-                                    }else{
-                                        *tty->flip.flag_buf_ptr++ = 0;
-                                        *tty->flip.char_buf_ptr++ = 0;
-                                       info->icount.rx++;
+                                    }else {
+                                       tty_insert_flip_char(tty, 0, TTY_NORMAL);
+                                       info->icount.rx++;
                                     }
                                 }else{
-                                    *tty->flip.flag_buf_ptr++ = 0;
-                                    *tty->flip.char_buf_ptr++ = 0;
+                                   tty_insert_flip_char(tty, 0, TTY_NORMAL);
                                    info->icount.rx++;
                                 }
                             }else{
@@ -1245,14 +1220,10 @@ cyy_interrupt(int irq, void *dev_id, struct pt_regs *regs)
                                info->mon.char_max = char_count;
                             info->mon.char_last = char_count;
 #endif
-                            while(char_count--){
-                                if (tty->flip.count >= TTY_FLIPBUF_SIZE){
-                                        break;
-                                }
-                                tty->flip.count++;
+                           len = tty_buffer_request_room(tty, char_count);
+                            while(len--){
                                 data = cy_readb(base_addr+(CyRDSR<<index));
-                                *tty->flip.flag_buf_ptr++ = TTY_NORMAL;
-                                *tty->flip.char_buf_ptr++ = data;
+                               tty_insert_flip_char(tty, data, TTY_NORMAL);
                                info->idle_stats.recv_bytes++;
                                info->icount.rx++;
 #ifdef CY_16Y_HACK
@@ -1261,11 +1232,11 @@ cyy_interrupt(int irq, void *dev_id, struct pt_regs *regs)
                             }
                              info->idle_stats.recv_idle = jiffies;
                         }
-                        schedule_delayed_work(&tty->flip.work, 1);
+                       tty_schedule_flip(tty);
                     }
                     /* end of service */
-                    cy_writeb((u_long)base_addr+(CyRIR<<index), (save_xir & 0x3f));
-                    cy_writeb((u_long)base_addr+(CyCAR<<index), (save_car));
+                    cy_writeb(base_addr+(CyRIR<<index), (save_xir & 0x3f));
+                    cy_writeb(base_addr+(CyCAR<<index), (save_car));
                    spin_unlock(&cinfo->card_lock);
                 }
 
@@ -1284,18 +1255,18 @@ cyy_interrupt(int irq, void *dev_id, struct pt_regs *regs)
                     channel = (u_short ) (save_xir & CyIRChannel);
                     i = channel + chip * 4 + cinfo->first_line;
                     save_car = cy_readb(base_addr+(CyCAR<<index));
-                    cy_writeb((u_long)base_addr+(CyCAR<<index), save_xir);
+                    cy_writeb(base_addr+(CyCAR<<index), save_xir);
 
                     /* validate the port# (as configured and open) */
                     if( (i < 0) || (NR_PORTS <= i) ){
-                        cy_writeb((u_long)base_addr+(CySRER<<index),
+                        cy_writeb(base_addr+(CySRER<<index),
                              cy_readb(base_addr+(CySRER<<index)) & ~CyTxRdy);
                         goto txend;
                     }
                     info = &cy_port[i];
                     info->last_active = jiffies;
                     if(info->tty == 0){
-                        cy_writeb((u_long)base_addr+(CySRER<<index),
+                        cy_writeb(base_addr+(CySRER<<index),
                              cy_readb(base_addr+(CySRER<<index)) & ~CyTxRdy);
                         goto txdone;
                     }
@@ -1305,7 +1276,7 @@ cyy_interrupt(int irq, void *dev_id, struct pt_regs *regs)
 
                     if(info->x_char) { /* send special char */
                         outch = info->x_char;
-                        cy_writeb((u_long)base_addr+(CyTDR<<index), outch);
+                        cy_writeb(base_addr+(CyTDR<<index), outch);
                         char_count--;
                        info->icount.tx++;
                         info->x_char = 0;
@@ -1313,14 +1284,14 @@ cyy_interrupt(int irq, void *dev_id, struct pt_regs *regs)
 
                     if (info->breakon || info->breakoff) {
                        if (info->breakon) {
-                           cy_writeb((u_long)base_addr + (CyTDR<<index), 0); 
-                           cy_writeb((u_long)base_addr + (CyTDR<<index), 0x81);
+                           cy_writeb(base_addr + (CyTDR<<index), 0); 
+                           cy_writeb(base_addr + (CyTDR<<index), 0x81);
                            info->breakon = 0;
                             char_count -= 2;
                        }
                        if (info->breakoff) {
-                           cy_writeb((u_long)base_addr + (CyTDR<<index), 0); 
-                           cy_writeb((u_long)base_addr + (CyTDR<<index), 0x83);
+                           cy_writeb(base_addr + (CyTDR<<index), 0); 
+                           cy_writeb(base_addr + (CyTDR<<index), 0x83);
                            info->breakoff = 0;
                             char_count -= 2;
                        }
@@ -1329,11 +1300,11 @@ cyy_interrupt(int irq, void *dev_id, struct pt_regs *regs)
                     while (char_count-- > 0){
                        if (!info->xmit_cnt){
                            if (cy_readb(base_addr+(CySRER<<index))&CyTxMpty) {
-                               cy_writeb((u_long)base_addr+(CySRER<<index),
+                               cy_writeb(base_addr+(CySRER<<index),
                                          cy_readb(base_addr+(CySRER<<index)) &
                                          ~CyTxMpty);
                            } else {
-                               cy_writeb((u_long)base_addr+(CySRER<<index),
+                               cy_writeb(base_addr+(CySRER<<index),
                                          ((cy_readb(base_addr+(CySRER<<index))
                                            & ~CyTxRdy)
                                           | CyTxMpty));
@@ -1341,13 +1312,13 @@ cyy_interrupt(int irq, void *dev_id, struct pt_regs *regs)
                            goto txdone;
                        }
                        if (info->xmit_buf == 0){
-                            cy_writeb((u_long)base_addr+(CySRER<<index),
+                            cy_writeb(base_addr+(CySRER<<index),
                                cy_readb(base_addr+(CySRER<<index)) & 
                                        ~CyTxRdy);
                             goto txdone;
                        }
                        if (info->tty->stopped || info->tty->hw_stopped){
-                            cy_writeb((u_long)base_addr+(CySRER<<index),
+                            cy_writeb(base_addr+(CySRER<<index),
                                cy_readb(base_addr+(CySRER<<index)) & 
                                        ~CyTxRdy);
                             goto txdone;
@@ -1368,16 +1339,16 @@ cyy_interrupt(int irq, void *dev_id, struct pt_regs *regs)
                             info->xmit_cnt--;
                             info->xmit_tail = (info->xmit_tail + 1)
                                                       & (SERIAL_XMIT_SIZE - 1);
-                            cy_writeb((u_long)base_addr+(CyTDR<<index), outch);
+                            cy_writeb(base_addr+(CyTDR<<index), outch);
                            info->icount.tx++;
                         }else{
                             if(char_count > 1){
                                 info->xmit_cnt--;
                                 info->xmit_tail = (info->xmit_tail + 1)
                                                      & (SERIAL_XMIT_SIZE - 1);
-                                cy_writeb((u_long)base_addr+(CyTDR<<index), 
+                                cy_writeb(base_addr+(CyTDR<<index), 
                                          outch);
-                                cy_writeb((u_long)base_addr+(CyTDR<<index), 0);
+                                cy_writeb(base_addr+(CyTDR<<index), 0);
                                info->icount.tx++;
                                 char_count--;
                             }else{
@@ -1391,9 +1362,9 @@ cyy_interrupt(int irq, void *dev_id, struct pt_regs *regs)
                     }
         txend:
                     /* end of service */
-                    cy_writeb((u_long)base_addr+(CyTIR<<index), 
+                    cy_writeb(base_addr+(CyTIR<<index), 
                              (save_xir & 0x3f));
-                    cy_writeb((u_long)base_addr+(CyCAR<<index), (save_car));
+                    cy_writeb(base_addr+(CyCAR<<index), (save_car));
                    spin_unlock(&cinfo->card_lock);
                 }
 
@@ -1407,7 +1378,7 @@ cyy_interrupt(int irq, void *dev_id, struct pt_regs *regs)
                                           + cinfo->first_line];
                     info->last_active = jiffies;
                     save_car = cy_readb(base_addr+(CyCAR<<index));
-                    cy_writeb((u_long)base_addr+(CyCAR<<index), save_xir);
+                    cy_writeb(base_addr+(CyCAR<<index), save_xir);
 
                     mdm_change = cy_readb(base_addr+(CyMISR<<index));
                     mdm_status = cy_readb(base_addr+(CyMSVR1<<index));
@@ -1442,7 +1413,7 @@ cyy_interrupt(int irq, void *dev_id, struct pt_regs *regs)
                                     /* cy_start isn't used
                                         because... !!! */
                                     info->tty->hw_stopped = 0;
-                                  cy_writeb((u_long)base_addr+(CySRER<<index),
+                                  cy_writeb(base_addr+(CySRER<<index),
                                        cy_readb(base_addr+(CySRER<<index)) | 
                                        CyTxRdy);
                                     cy_sched_event(info,
@@ -1453,7 +1424,7 @@ cyy_interrupt(int irq, void *dev_id, struct pt_regs *regs)
                                     /* cy_stop isn't used
                                         because ... !!! */
                                     info->tty->hw_stopped = 1;
-                                  cy_writeb((u_long)base_addr+(CySRER<<index),
+                                  cy_writeb(base_addr+(CySRER<<index),
                                        cy_readb(base_addr+(CySRER<<index)) & 
                                        ~CyTxRdy);
                                 }
@@ -1465,9 +1436,9 @@ cyy_interrupt(int irq, void *dev_id, struct pt_regs *regs)
                         }
                     }
                     /* end of service */
-                    cy_writeb((u_long)base_addr+(CyMIR<<index), 
+                    cy_writeb(base_addr+(CyMIR<<index), 
                              (save_xir & 0x3f));
-                    cy_writeb((u_long)base_addr+(CyCAR<<index), save_car);
+                    cy_writeb(base_addr+(CyCAR<<index), save_car);
                    spin_unlock(&cinfo->card_lock);
                 }
             }          /* end while status != 0 */
@@ -1476,7 +1447,7 @@ cyy_interrupt(int irq, void *dev_id, struct pt_regs *regs)
 
    /* clear interrupts */
    spin_lock(&cinfo->card_lock);
-   cy_writeb((u_long)card_base_addr + (Cy_ClrIntr<<index), 0);
+   cy_writeb(card_base_addr + (Cy_ClrIntr<<index), 0);
                                 /* Cy_ClrIntr is 0x1800 */
    spin_unlock(&cinfo->card_lock);
    return IRQ_HANDLED;
@@ -1491,27 +1462,25 @@ static int
 cyz_fetch_msg( struct cyclades_card *cinfo,
            uclong *channel, ucchar *cmd, uclong *param)
 {
-  struct FIRM_ID *firm_id;
-  struct ZFW_CTRL *zfw_ctrl;
-  struct BOARD_CTRL *board_ctrl;
+  struct FIRM_ID __iomem *firm_id;
+  struct ZFW_CTRL __iomem *zfw_ctrl;
+  struct BOARD_CTRL __iomem *board_ctrl;
   unsigned long loc_doorbell;
 
-    firm_id = (struct FIRM_ID *)(cinfo->base_addr + ID_ADDRESS);
+    firm_id = cinfo->base_addr + ID_ADDRESS;
     if (!ISZLOADED(*cinfo)){
        return (-1);
     }
-    zfw_ctrl = (struct ZFW_CTRL *)
-               (cinfo->base_addr + 
-                (cy_readl(&firm_id->zfwctrl_addr) & 0xfffff));
+    zfw_ctrl = cinfo->base_addr + (cy_readl(&firm_id->zfwctrl_addr) & 0xfffff);
     board_ctrl = &zfw_ctrl->board_ctrl;
 
-    loc_doorbell = cy_readl(&((struct RUNTIME_9060 *)
+    loc_doorbell = cy_readl(&((struct RUNTIME_9060 __iomem *)
                      (cinfo->ctl_addr))->loc_doorbell);
     if (loc_doorbell){
        *cmd = (char)(0xff & loc_doorbell);
        *channel = cy_readl(&board_ctrl->fwcmd_channel);
        *param = (uclong)cy_readl(&board_ctrl->fwcmd_param);
-       cy_writel(&((struct RUNTIME_9060 *)(cinfo->ctl_addr))->loc_doorbell, 
+       cy_writel(&((struct RUNTIME_9060 __iomem *)(cinfo->ctl_addr))->loc_doorbell, 
                  0xffffffff);
        return 1;
     }
@@ -1522,44 +1491,43 @@ static int
 cyz_issue_cmd( struct cyclades_card *cinfo,
            uclong channel, ucchar cmd, uclong param)
 {
-  struct FIRM_ID *firm_id;
-  struct ZFW_CTRL *zfw_ctrl;
-  struct BOARD_CTRL *board_ctrl;
-  volatile uclong *pci_doorbell;
+  struct FIRM_ID __iomem *firm_id;
+  struct ZFW_CTRL __iomem *zfw_ctrl;
+  struct BOARD_CTRL __iomem *board_ctrl;
+  unsigned long __iomem *pci_doorbell;
   int index;
 
-    firm_id = (struct FIRM_ID *)(cinfo->base_addr + ID_ADDRESS);
+    firm_id = cinfo->base_addr + ID_ADDRESS;
     if (!ISZLOADED(*cinfo)){
        return (-1);
     }
-    zfw_ctrl = (struct ZFW_CTRL *)
-               (cinfo->base_addr + 
-                (cy_readl(&firm_id->zfwctrl_addr) & 0xfffff));
+    zfw_ctrl = cinfo->base_addr + (cy_readl(&firm_id->zfwctrl_addr) & 0xfffff);
     board_ctrl = &zfw_ctrl->board_ctrl;
 
     index = 0;
-    pci_doorbell = (uclong *)(&((struct RUNTIME_9060 *)
-                               (cinfo->ctl_addr))->pci_doorbell);
+    pci_doorbell = &((struct RUNTIME_9060 __iomem *) (cinfo->ctl_addr))->pci_doorbell;
     while( (cy_readl(pci_doorbell) & 0xff) != 0){
         if (index++ == 1000){
            return((int)(cy_readl(pci_doorbell) & 0xff));
         }
        udelay(50L);
     }
-    cy_writel((u_long)&board_ctrl->hcmd_channel, channel);
-    cy_writel((u_long)&board_ctrl->hcmd_param , param);
-    cy_writel((u_long)pci_doorbell, (long)cmd);
+    cy_writel(&board_ctrl->hcmd_channel, channel);
+    cy_writel(&board_ctrl->hcmd_param , param);
+    cy_writel(pci_doorbell, (long)cmd);
 
     return(0);
 } /* cyz_issue_cmd */
 
 static void
-cyz_handle_rx(struct cyclades_port *info, volatile struct CH_CTRL *ch_ctrl,
-             volatile struct BUF_CTRL *buf_ctrl)
+cyz_handle_rx(struct cyclades_port *info,
+             volatile struct CH_CTRL __iomem *ch_ctrl,
+             volatile struct BUF_CTRL __iomem *buf_ctrl)
 {
   struct cyclades_card *cinfo = &cy_card[info->card];
   struct tty_struct *tty = info->tty;
   volatile int char_count;
+  int len;
 #ifdef BLOCKMOVE
   int small_count;
 #else
@@ -1615,18 +1583,11 @@ cyz_handle_rx(struct cyclades_port *info, volatile struct CH_CTRL *ch_ctrl,
                tty->flip.count += small_count;
            }
 #else
-           while(char_count--){
-               if (tty->flip.count >= N_TTY_BUF_SIZE - tty->read_cnt)
-                    break;
-
-               if (tty->flip.count >= TTY_FLIPBUF_SIZE)
-                   break;
-
+           len = tty_buffer_request_room(tty, char_count);
+           while(len--){
                data = cy_readb(cinfo->base_addr + rx_bufaddr + new_rx_get);
                new_rx_get = (new_rx_get + 1) & (rx_bufsize - 1);
-               tty->flip.count++;
-               *tty->flip.flag_buf_ptr++ = TTY_NORMAL;
-               *tty->flip.char_buf_ptr++ = data;
+               tty_insert_flip_char(tty, data, TTY_NORMAL);
                info->idle_stats.recv_bytes++;
                info->icount.rx++;
            }
@@ -1644,7 +1605,7 @@ cyz_handle_rx(struct cyclades_port *info, volatile struct CH_CTRL *ch_ctrl,
            }
 #endif
            info->idle_stats.recv_idle = jiffies;
-           schedule_delayed_work(&tty->flip.work, 1);
+           tty_schedule_flip(tty);
        }
        /* Update rx_get */
        cy_writel(&buf_ctrl->rx_get, new_rx_get);
@@ -1652,8 +1613,9 @@ cyz_handle_rx(struct cyclades_port *info, volatile struct CH_CTRL *ch_ctrl,
 }
 
 static void
-cyz_handle_tx(struct cyclades_port *info, volatile struct CH_CTRL *ch_ctrl,
-             volatile struct BUF_CTRL *buf_ctrl)
+cyz_handle_tx(struct cyclades_port *info,
+             volatile struct CH_CTRL __iomem *ch_ctrl,
+             volatile struct BUF_CTRL __iomem *buf_ctrl)
 {
   struct cyclades_card *cinfo = &cy_card[info->card];
   struct tty_struct *tty = info->tty;
@@ -1740,11 +1702,11 @@ cyz_handle_cmd(struct cyclades_card *cinfo)
 {
   struct tty_struct *tty;
   struct cyclades_port *info;
-  static volatile struct FIRM_ID *firm_id;
-  static volatile struct ZFW_CTRL *zfw_ctrl;
-  static volatile struct BOARD_CTRL *board_ctrl;
-  static volatile struct CH_CTRL *ch_ctrl;
-  static volatile struct BUF_CTRL *buf_ctrl;
+  static volatile struct FIRM_ID __iomem *firm_id;
+  static volatile struct ZFW_CTRL __iomem *zfw_ctrl;
+  static volatile struct BOARD_CTRL __iomem *board_ctrl;
+  static volatile struct CH_CTRL __iomem *ch_ctrl;
+  static volatile struct BUF_CTRL __iomem *buf_ctrl;
   uclong channel;
   ucchar cmd;
   uclong param;
@@ -1752,13 +1714,11 @@ cyz_handle_cmd(struct cyclades_card *cinfo)
   int special_count;
   int delta_count;
 
-    firm_id = (struct FIRM_ID *)(cinfo->base_addr + ID_ADDRESS);
-    zfw_ctrl = (struct ZFW_CTRL *)
-               (cinfo->base_addr + 
-                (cy_readl(&firm_id->zfwctrl_addr) & 0xfffff));
-    board_ctrl = &(zfw_ctrl->board_ctrl);
+    firm_id = cinfo->base_addr + ID_ADDRESS;
+    zfw_ctrl = cinfo->base_addr + (cy_readl(&firm_id->zfwctrl_addr) & 0xfffff);
+    board_ctrl = &zfw_ctrl->board_ctrl;
     fw_ver = cy_readl(&board_ctrl->fw_version);
-    hw_ver = cy_readl(&((struct RUNTIME_9060 *)(cinfo->ctl_addr))->mail_box_0);
+    hw_ver = cy_readl(&((struct RUNTIME_9060 __iomem *)(cinfo->ctl_addr))->mail_box_0);
 
 
     while(cyz_fetch_msg(cinfo, &channel, &cmd, &param) == 1) {
@@ -1773,23 +1733,17 @@ cyz_handle_cmd(struct cyclades_card *cinfo)
 
        switch(cmd) {
            case C_CM_PR_ERROR:
-               tty->flip.count++;
-               *tty->flip.flag_buf_ptr++ = TTY_PARITY;
-               *tty->flip.char_buf_ptr++ = 0;
+               tty_insert_flip_char(tty, 0, TTY_PARITY);
                info->icount.rx++;
                special_count++;
                break;
            case C_CM_FR_ERROR:
-               tty->flip.count++;
-               *tty->flip.flag_buf_ptr++ = TTY_FRAME;
-               *tty->flip.char_buf_ptr++ = 0;
+               tty_insert_flip_char(tty, 0, TTY_FRAME);
                info->icount.rx++;
                special_count++;
                break;
            case C_CM_RXBRK:
-               tty->flip.count++;
-               *tty->flip.flag_buf_ptr++ = TTY_BREAK;
-               *tty->flip.char_buf_ptr++ = 0;
+               tty_insert_flip_char(tty, 0, TTY_BREAK);
                info->icount.rx++;
                special_count++;
                break;
@@ -1854,7 +1808,7 @@ cyz_handle_cmd(struct cyclades_card *cinfo)
        if(delta_count)
            cy_sched_event(info, Cy_EVENT_DELTA_WAKEUP);
        if(special_count)
-           schedule_delayed_work(&tty->flip.work, 1);
+           tty_schedule_flip(tty);
     }
 }
 
@@ -1925,10 +1879,8 @@ cyz_poll(unsigned long arg)
        if (!IS_CYC_Z(*cinfo)) continue;
        if (!ISZLOADED(*cinfo)) continue;
 
-       firm_id = (struct FIRM_ID *)(cinfo->base_addr + ID_ADDRESS);
-       zfw_ctrl = (struct ZFW_CTRL *)
-                   (cinfo->base_addr + 
-                    (cy_readl(&firm_id->zfwctrl_addr) & 0xfffff));
+       firm_id = cinfo->base_addr + ID_ADDRESS;
+       zfw_ctrl = cinfo->base_addr + (cy_readl(&firm_id->zfwctrl_addr) & 0xfffff);
        board_ctrl = &(zfw_ctrl->board_ctrl);
 
        /* Skip first polling cycle to avoid racing conditions with the FW */
@@ -1972,7 +1924,7 @@ startup(struct cyclades_port * info)
 {
   unsigned long flags;
   int retval = 0;
-  unsigned char *base_addr;
+  void __iomem *base_addr;
   int card,chip,channel,index;
   unsigned long page;
 
@@ -2011,8 +1963,7 @@ startup(struct cyclades_port * info)
        chip = channel>>2;
        channel &= 0x03;
        index = cy_card[card].bus_index;
-       base_addr = (unsigned char*)
-                  (cy_card[card].base_addr + (cy_chip_offset[chip]<<index));
+       base_addr = cy_card[card].base_addr + (cy_chip_offset[chip]<<index);
 
 #ifdef CY_DEBUG_OPEN
        printk("cyc startup card %d, chip %d, channel %d, base_addr %lx\n",
@@ -2021,16 +1972,16 @@ startup(struct cyclades_port * info)
 
        CY_LOCK(info, flags);
 
-       cy_writeb((ulong)base_addr+(CyCAR<<index), (u_char)channel);
+       cy_writeb(base_addr+(CyCAR<<index), (u_char)channel);
 
-       cy_writeb((ulong)base_addr+(CyRTPR<<index), (info->default_timeout
+       cy_writeb(base_addr+(CyRTPR<<index), (info->default_timeout
                 ? info->default_timeout : 0x02)); /* 10ms rx timeout */
 
        cyy_issue_cmd(base_addr,CyCHAN_CTL|CyENB_RCVR|CyENB_XMTR,index);
 
-       cy_writeb((ulong)base_addr+(CyCAR<<index), (u_char)channel);
-       cy_writeb((ulong)base_addr+(CyMSVR1<<index), CyRTS);
-       cy_writeb((ulong)base_addr+(CyMSVR2<<index), CyDTR);
+       cy_writeb(base_addr+(CyCAR<<index), (u_char)channel);
+       cy_writeb(base_addr+(CyMSVR1<<index), CyRTS);
+       cy_writeb(base_addr+(CyMSVR2<<index), CyDTR);
 
 #ifdef CY_DEBUG_DTR
        printk("cyc:startup raising DTR\n");
@@ -2039,7 +1990,7 @@ startup(struct cyclades_port * info)
                 cy_readb(base_addr+(CyMSVR2<<index)));
 #endif
 
-       cy_writeb((u_long)base_addr+(CySRER<<index),
+       cy_writeb(base_addr+(CySRER<<index),
                cy_readb(base_addr+(CySRER<<index)) | CyRxData);
        info->flags |= ASYNC_INITIALIZED;
 
@@ -2056,22 +2007,20 @@ startup(struct cyclades_port * info)
        CY_UNLOCK(info, flags);
 
     } else {
-      struct FIRM_ID *firm_id;
-      struct ZFW_CTRL *zfw_ctrl;
-      struct BOARD_CTRL *board_ctrl;
-      struct CH_CTRL *ch_ctrl;
+      struct FIRM_ID __iomem *firm_id;
+      struct ZFW_CTRL __iomem *zfw_ctrl;
+      struct BOARD_CTRL __iomem *board_ctrl;
+      struct CH_CTRL __iomem *ch_ctrl;
       int retval;
 
-       base_addr = (unsigned char*) (cy_card[card].base_addr);
+       base_addr = cy_card[card].base_addr;
 
-        firm_id = (struct FIRM_ID *) (base_addr + ID_ADDRESS);
+        firm_id = base_addr + ID_ADDRESS;
         if (!ISZLOADED(cy_card[card])){
            return -ENODEV;
        }
 
-       zfw_ctrl = (struct ZFW_CTRL *)
-                   (cy_card[card].base_addr + 
-                    (cy_readl(&firm_id->zfwctrl_addr) & 0xfffff));
+       zfw_ctrl = cy_card[card].base_addr + (cy_readl(&firm_id->zfwctrl_addr) & 0xfffff);
        board_ctrl = &zfw_ctrl->board_ctrl;
        ch_ctrl = zfw_ctrl->ch_ctrl;
 
@@ -2163,7 +2112,7 @@ static void
 start_xmit( struct cyclades_port *info )
 {
   unsigned long flags;
-  unsigned char *base_addr;
+  void __iomem *base_addr;
   int card,chip,channel,index;
 
     card = info->card;
@@ -2172,13 +2121,11 @@ start_xmit( struct cyclades_port *info )
        chip = channel>>2;
        channel &= 0x03;
        index = cy_card[card].bus_index;
-       base_addr = (unsigned char*)
-                      (cy_card[card].base_addr
-                      + (cy_chip_offset[chip]<<index));
+       base_addr = cy_card[card].base_addr + (cy_chip_offset[chip]<<index);
 
        CY_LOCK(info, flags);
-           cy_writeb((u_long)base_addr+(CyCAR<<index), channel);
-           cy_writeb((u_long)base_addr+(CySRER<<index), 
+           cy_writeb(base_addr+(CyCAR<<index), channel);
+           cy_writeb(base_addr+(CySRER<<index), 
                cy_readb(base_addr+(CySRER<<index)) | CyTxRdy);
        CY_UNLOCK(info, flags);
     } else {
@@ -2206,7 +2153,7 @@ static void
 shutdown(struct cyclades_port * info)
 {
   unsigned long flags;
-  unsigned char *base_addr;
+  void __iomem *base_addr;
   int card,chip,channel,index;
 
     if (!(info->flags & ASYNC_INITIALIZED)){
@@ -2219,9 +2166,7 @@ shutdown(struct cyclades_port * info)
        chip = channel>>2;
        channel &= 0x03;
        index = cy_card[card].bus_index;
-       base_addr = (unsigned char*)
-                      (cy_card[card].base_addr
-                      + (cy_chip_offset[chip]<<index));
+       base_addr = cy_card[card].base_addr + (cy_chip_offset[chip]<<index);
 
 #ifdef CY_DEBUG_OPEN
     printk("cyc shutdown Y card %d, chip %d, channel %d, base_addr %lx\n",
@@ -2239,10 +2184,10 @@ shutdown(struct cyclades_port * info)
                info->xmit_buf = NULL;
                free_page((unsigned long) temp);
            }
-           cy_writeb((u_long)base_addr+(CyCAR<<index), (u_char)channel);
+           cy_writeb(base_addr+(CyCAR<<index), (u_char)channel);
            if (!info->tty || (info->tty->termios->c_cflag & HUPCL)) {
-               cy_writeb((u_long)base_addr+(CyMSVR1<<index), ~CyRTS);
-               cy_writeb((u_long)base_addr+(CyMSVR2<<index), ~CyDTR);
+               cy_writeb(base_addr+(CyMSVR1<<index), ~CyRTS);
+               cy_writeb(base_addr+(CyMSVR2<<index), ~CyDTR);
 #ifdef CY_DEBUG_DTR
                printk("cyc shutdown dropping DTR\n");
                printk("     status: 0x%x, 0x%x\n",
@@ -2260,27 +2205,25 @@ shutdown(struct cyclades_port * info)
            info->flags &= ~ASYNC_INITIALIZED;
        CY_UNLOCK(info, flags);
     } else {
-      struct FIRM_ID *firm_id;
-      struct ZFW_CTRL *zfw_ctrl;
-      struct BOARD_CTRL *board_ctrl;
-      struct CH_CTRL *ch_ctrl;
+      struct FIRM_ID __iomem *firm_id;
+      struct ZFW_CTRL __iomem *zfw_ctrl;
+      struct BOARD_CTRL __iomem *board_ctrl;
+      struct CH_CTRL __iomem *ch_ctrl;
       int retval;
 
-       base_addr = (unsigned char*) (cy_card[card].base_addr);
+       base_addr = cy_card[card].base_addr;
 #ifdef CY_DEBUG_OPEN
     printk("cyc shutdown Z card %d, channel %d, base_addr %lx\n",
                card, channel, (long)base_addr);
 #endif
 
-        firm_id = (struct FIRM_ID *) (base_addr + ID_ADDRESS);
+        firm_id = base_addr + ID_ADDRESS;
         if (!ISZLOADED(cy_card[card])) {
            return;
        }
 
-       zfw_ctrl = (struct ZFW_CTRL *)
-                   (cy_card[card].base_addr + 
-                    (cy_readl(&firm_id->zfwctrl_addr) & 0xfffff));
-       board_ctrl = &(zfw_ctrl->board_ctrl);
+       zfw_ctrl = cy_card[card].base_addr + (cy_readl(&firm_id->zfwctrl_addr) & 0xfffff);
+       board_ctrl = &zfw_ctrl->board_ctrl;
        ch_ctrl = zfw_ctrl->ch_ctrl;
 
        CY_LOCK(info, flags);
@@ -2293,7 +2236,7 @@ shutdown(struct cyclades_port * info)
            }
            
            if (!info->tty || (info->tty->termios->c_cflag & HUPCL)) {
-               cy_writel((u_long)&ch_ctrl[channel].rs_control,
+               cy_writel(&ch_ctrl[channel].rs_control,
                    (uclong)(cy_readl(&ch_ctrl[channel].rs_control) & 
                    ~(C_RS_RTS | C_RS_DTR)));
                retval = cyz_issue_cmd(&cy_card[info->card],
@@ -2337,7 +2280,7 @@ block_til_ready(struct tty_struct *tty, struct file * filp,
   unsigned long flags;
   int chip, channel,index;
   int retval;
-  char *base_addr;
+  void __iomem *base_addr;
 
     cinfo = &cy_card[info->card];
     channel = info->line - cinfo->first_line;
@@ -2390,15 +2333,14 @@ block_til_ready(struct tty_struct *tty, struct file * filp,
        chip = channel>>2;
        channel &= 0x03;
        index = cinfo->bus_index;
-       base_addr = (char *)(cinfo->base_addr
-                           + (cy_chip_offset[chip]<<index));
+       base_addr = cinfo->base_addr + (cy_chip_offset[chip]<<index);
 
        while (1) {
            CY_LOCK(info, flags);
                if ((tty->termios->c_cflag & CBAUD)){
-                   cy_writeb((u_long)base_addr+(CyCAR<<index), (u_char)channel);
-                   cy_writeb((u_long)base_addr+(CyMSVR1<<index), CyRTS);
-                   cy_writeb((u_long)base_addr+(CyMSVR2<<index), CyDTR);
+                   cy_writeb(base_addr+(CyCAR<<index), (u_char)channel);
+                   cy_writeb(base_addr+(CyMSVR1<<index), CyRTS);
+                   cy_writeb(base_addr+(CyMSVR2<<index), CyDTR);
 #ifdef CY_DEBUG_DTR
                    printk("cyc:block_til_ready raising DTR\n");
                    printk("     status: 0x%x, 0x%x\n",
@@ -2417,7 +2359,7 @@ block_til_ready(struct tty_struct *tty, struct file * filp,
            }
 
            CY_LOCK(info, flags);
-               cy_writeb((u_long)base_addr+(CyCAR<<index), (u_char)channel);
+               cy_writeb(base_addr+(CyCAR<<index), (u_char)channel);
                if (!(info->flags & ASYNC_CLOSING)
                && (C_CLOCAL(tty)
                    || (cy_readb(base_addr+(CyMSVR1<<index)) & CyDCD))) {
@@ -2437,23 +2379,21 @@ block_til_ready(struct tty_struct *tty, struct file * filp,
            schedule();
        }
     } else {
-      struct FIRM_ID *firm_id;
-      struct ZFW_CTRL *zfw_ctrl;
-      struct BOARD_CTRL *board_ctrl;
-      struct CH_CTRL *ch_ctrl;
+      struct FIRM_ID __iomem *firm_id;
+      struct ZFW_CTRL __iomem *zfw_ctrl;
+      struct BOARD_CTRL __iomem *board_ctrl;
+      struct CH_CTRL __iomem *ch_ctrl;
       int retval;
 
-       base_addr = (char *)(cinfo->base_addr);
-       firm_id = (struct FIRM_ID *)
-                       (base_addr + ID_ADDRESS);
+       base_addr = cinfo->base_addr;
+       firm_id = base_addr + ID_ADDRESS;
         if (!ISZLOADED(*cinfo)){
             current->state = TASK_RUNNING;
            remove_wait_queue(&info->open_wait, &wait);
            return -EINVAL;
        }
 
-       zfw_ctrl = (struct ZFW_CTRL *)
-                   (base_addr + (cy_readl(&firm_id->zfwctrl_addr) & 0xfffff));
+       zfw_ctrl = base_addr + (cy_readl(&firm_id->zfwctrl_addr) & 0xfffff);
        board_ctrl = &zfw_ctrl->board_ctrl;
        ch_ctrl = zfw_ctrl->ch_ctrl;
 
@@ -2543,11 +2483,10 @@ cy_open(struct tty_struct *tty, struct file * filp)
     */
     if (IS_CYC_Z(cy_card[info->card])) {
        struct cyclades_card *cinfo = &cy_card[info->card];
-       struct FIRM_ID *firm_id = (struct FIRM_ID *)
-               (cinfo->base_addr + ID_ADDRESS);
+       struct FIRM_ID __iomem *firm_id = cinfo->base_addr + ID_ADDRESS;
 
         if (!ISZLOADED(*cinfo)) {
-           if (((ZE_V1 ==cy_readl(&((struct RUNTIME_9060 *)
+           if (((ZE_V1 ==cy_readl(&((struct RUNTIME_9060 __iomem *)
                (cinfo->ctl_addr))->mail_box_0)) &&
                Z_FPGA_CHECK (*cinfo)) &&
                (ZFIRM_HLT == cy_readl (&firm_id->signature)))
@@ -2564,12 +2503,10 @@ cy_open(struct tty_struct *tty, struct file * filp)
               interrupts should be enabled as soon as the first open happens 
               to one of its ports. */
             if (!cinfo->intr_enabled) {
-               struct ZFW_CTRL *zfw_ctrl;
-               struct BOARD_CTRL *board_ctrl;
+               struct ZFW_CTRL __iomem *zfw_ctrl;
+               struct BOARD_CTRL __iomem *board_ctrl;
 
-               zfw_ctrl = (struct ZFW_CTRL *)
-                (cinfo->base_addr +
-                 (cy_readl (&firm_id->zfwctrl_addr) & 0xfffff));
+               zfw_ctrl = cinfo->base_addr + (cy_readl (&firm_id->zfwctrl_addr) & 0xfffff);
 
                board_ctrl = &zfw_ctrl->board_ctrl;
 
@@ -2661,7 +2598,7 @@ static void
 cy_wait_until_sent(struct tty_struct *tty, int timeout)
 {
   struct cyclades_port * info = (struct cyclades_port *)tty->driver_data;
-  unsigned char *base_addr;
+  void __iomem *base_addr;
   int card,chip,channel,index;
   unsigned long orig_jiffies;
   int char_time;
@@ -2711,26 +2648,21 @@ cy_wait_until_sent(struct tty_struct *tty, int timeout)
        chip = channel>>2;
        channel &= 0x03;
        index = cy_card[card].bus_index;
-       base_addr = (unsigned char *)
-               (cy_card[card].base_addr + (cy_chip_offset[chip]<<index));
+       base_addr = cy_card[card].base_addr + (cy_chip_offset[chip]<<index);
        while (cy_readb(base_addr+(CySRER<<index)) & CyTxRdy) {
 #ifdef CY_DEBUG_WAIT_UNTIL_SENT
            printk("Not clean (jiff=%lu)...", jiffies);
 #endif
-           current->state = TASK_INTERRUPTIBLE;
-           schedule_timeout(char_time);
-           if (signal_pending(current))
+           if (msleep_interruptible(jiffies_to_msecs(char_time)))
                break;
            if (timeout && time_after(jiffies, orig_jiffies + timeout))
                break;
        }
-       current->state = TASK_RUNNING;
     } else {
        // Nothing to do!
     }
     /* Run one more char cycle */
-    current->state = TASK_INTERRUPTIBLE;
-    schedule_timeout(char_time * 5);
+    msleep_interruptible(jiffies_to_msecs(char_time * 5));
 #ifdef CY_DEBUG_WAIT_UNTIL_SENT
     printk("Clean (jiff=%lu)...done\n", jiffies);
 #endif
@@ -2805,13 +2737,11 @@ cy_close(struct tty_struct *tty, struct file *filp)
     if (!IS_CYC_Z(cy_card[info->card])) {
        int channel = info->line - cy_card[info->card].first_line;
        int index = cy_card[info->card].bus_index;
-       unsigned char *base_addr = (unsigned char *)
-                       (cy_card[info->card].base_addr +
-                        (cy_chip_offset[channel>>2] <<index));
+       void __iomem *base_addr = cy_card[info->card].base_addr + (cy_chip_offset[channel>>2] << index);
        /* Stop accepting input */
        channel &= 0x03;
-       cy_writeb((ulong)base_addr+(CyCAR<<index), (u_char)channel);
-       cy_writeb((u_long)base_addr+(CySRER<<index),
+       cy_writeb(base_addr+(CyCAR<<index), (u_char)channel);
+       cy_writeb(base_addr+(CySRER<<index),
                        cy_readb(base_addr+(CySRER<<index)) & ~CyRxData);
        if (info->flags & ASYNC_INITIALIZED) {
            /* Waiting for on-board buffers to be empty before closing 
@@ -2823,12 +2753,10 @@ cy_close(struct tty_struct *tty, struct file *filp)
     } else {
 #ifdef Z_WAKE
        /* Waiting for on-board buffers to be empty before closing the port */
-       unsigned char *base_addr = (unsigned char *) 
-                                       cy_card[info->card].base_addr;
-       struct FIRM_ID *firm_id = (struct FIRM_ID *) (base_addr + ID_ADDRESS);
-       struct ZFW_CTRL *zfw_ctrl = (struct ZFW_CTRL *)
-               (base_addr + (cy_readl(&firm_id->zfwctrl_addr) & 0xfffff));
-       struct CH_CTRL *ch_ctrl = zfw_ctrl->ch_ctrl;
+       void __iomem *base_addr = cy_card[info->card].base_addr;
+       struct FIRM_ID __iomem *firm_id = base_addr + ID_ADDRESS;
+       struct ZFW_CTRL __iomem *zfw_ctrl = base_addr + (cy_readl(&firm_id->zfwctrl_addr) & 0xfffff);
+       struct CH_CTRL __iomem *ch_ctrl = zfw_ctrl->ch_ctrl;
        int channel = info->line - cy_card[info->card].first_line;
        int retval;
 
@@ -2850,8 +2778,7 @@ cy_close(struct tty_struct *tty, struct file *filp)
     shutdown(info);
     if (tty->driver->flush_buffer)
         tty->driver->flush_buffer(tty);
-    if (tty->ldisc.flush_buffer)
-        tty->ldisc.flush_buffer(tty);
+    tty_ldisc_flush(tty);        
     CY_LOCK(info, flags);
 
     tty->closing = 0;
@@ -2860,8 +2787,7 @@ cy_close(struct tty_struct *tty, struct file *filp)
     if (info->blocked_open) {
        CY_UNLOCK(info, flags);
         if (info->close_delay) {
-            current->state = TASK_INTERRUPTIBLE;
-            schedule_timeout(info->close_delay);
+            msleep_interruptible(jiffies_to_msecs(info->close_delay));
         }
         wake_up_interruptible(&info->open_wait);
        CY_LOCK(info, flags);
@@ -2892,8 +2818,7 @@ cy_close(struct tty_struct *tty, struct file *filp)
  *
  */
 static int
-cy_write(struct tty_struct * tty, int from_user,
-           const unsigned char *buf, int count)
+cy_write(struct tty_struct * tty, const unsigned char *buf, int count)
 {
   struct cyclades_port *info = (struct cyclades_port *)tty->driver_data;
   unsigned long flags;
@@ -2907,60 +2832,25 @@ cy_write(struct tty_struct * tty, int from_user,
         return 0;
     }
         
-    if (!tty || !info->xmit_buf || !tmp_buf){
-        return 0;
-    }
-
-    if (from_user) {
-       down(&tmp_buf_sem);
-       while (1) {
-           int c1;
-           
-           c = min(count, min((int)(SERIAL_XMIT_SIZE - info->xmit_cnt - 1),
-                               (int)(SERIAL_XMIT_SIZE - info->xmit_head)));
-           if (c <= 0)
-               break;
+    if (!info->xmit_buf || !tmp_buf)
+       return 0;
 
-           c -= copy_from_user(tmp_buf, buf, c);
-           if (!c) {
-               if (!ret) {
-                   ret = -EFAULT;
-               }
-               break;
-           }
-           CY_LOCK(info, flags);
-           c1 = min(c, min((int)(SERIAL_XMIT_SIZE - info->xmit_cnt - 1),
-                       (int)(SERIAL_XMIT_SIZE - info->xmit_head)));
-                       
-           if (c1 < c)
-               c = c1;
-           memcpy(info->xmit_buf + info->xmit_head, tmp_buf, c);
-           info->xmit_head = ((info->xmit_head + c) & (SERIAL_XMIT_SIZE-1));
-           info->xmit_cnt += c;
-            CY_UNLOCK(info, flags);
-           buf += c;
-           count -= c;
-           ret += c;
-       }
-       up(&tmp_buf_sem);
-    } else {
-       CY_LOCK(info, flags);
-       while (1) {
-           c = min(count, min((int)(SERIAL_XMIT_SIZE - info->xmit_cnt - 1),
+    CY_LOCK(info, flags);
+    while (1) {
+       c = min(count, min((int)(SERIAL_XMIT_SIZE - info->xmit_cnt - 1),
                        (int)(SERIAL_XMIT_SIZE - info->xmit_head)));
                
-           if (c <= 0)
-               break;
+       if (c <= 0)
+           break;
 
-           memcpy(info->xmit_buf + info->xmit_head, buf, c);
-           info->xmit_head = (info->xmit_head + c) & (SERIAL_XMIT_SIZE-1);
-           info->xmit_cnt += c;
-           buf += c;
-           count -= c;
-           ret += c;
-       }
-        CY_UNLOCK(info, flags);
+       memcpy(info->xmit_buf + info->xmit_head, buf, c);
+       info->xmit_head = (info->xmit_head + c) & (SERIAL_XMIT_SIZE-1);
+       info->xmit_cnt += c;
+       buf += c;
+       count -= c;
+       ret += c;
     }
+    CY_UNLOCK(info, flags);
 
     info->idle_stats.xmit_bytes += ret;
     info->idle_stats.xmit_idle   = jiffies;
@@ -2992,7 +2882,7 @@ cy_put_char(struct tty_struct *tty, unsigned char ch)
     if (serial_paranoia_check(info, tty->name, "cy_put_char"))
         return;
 
-    if (!tty || !info->xmit_buf)
+    if (!info->xmit_buf)
         return;
 
     CY_LOCK(info, flags);
@@ -3088,10 +2978,8 @@ cy_chars_in_buffer(struct tty_struct *tty)
        int char_count;
        volatile uclong tx_put, tx_get, tx_bufsize;
 
-       firm_id = (struct FIRM_ID *)(cy_card[card].base_addr + ID_ADDRESS);
-       zfw_ctrl = (struct ZFW_CTRL *)
-                   (cy_card[card].base_addr + 
-                    (cy_readl(&firm_id->zfwctrl_addr) & 0xfffff));
+       firm_id = cy_card[card].base_addr + ID_ADDRESS;
+       zfw_ctrl = cy_card[card].base_addr + (cy_readl(&firm_id->zfwctrl_addr) & 0xfffff);
        ch_ctrl = &(zfw_ctrl->ch_ctrl[channel]);
        buf_ctrl = &(zfw_ctrl->buf_ctrl[channel]);
 
@@ -3151,7 +3039,7 @@ static void
 set_line_char(struct cyclades_port * info)
 {
   unsigned long flags;
-  unsigned char *base_addr;
+  void __iomem *base_addr;
   int card,chip,channel,index;
   unsigned cflag, iflag;
   unsigned short chip_number;
@@ -3303,76 +3191,74 @@ set_line_char(struct cyclades_port * info)
 
        chip = channel>>2;
        channel &= 0x03;
-       base_addr = (unsigned char*)
-                      (cy_card[card].base_addr
-                      + (cy_chip_offset[chip]<<index));
+       base_addr = cy_card[card].base_addr + (cy_chip_offset[chip]<<index);
 
        CY_LOCK(info, flags);
-           cy_writeb((u_long)base_addr+(CyCAR<<index), (u_char)channel);
+           cy_writeb(base_addr+(CyCAR<<index), (u_char)channel);
 
           /* tx and rx baud rate */
 
-           cy_writeb((u_long)base_addr+(CyTCOR<<index), info->tco);
-           cy_writeb((u_long)base_addr+(CyTBPR<<index), info->tbpr);
-           cy_writeb((u_long)base_addr+(CyRCOR<<index), info->rco);
-           cy_writeb((u_long)base_addr+(CyRBPR<<index), info->rbpr);
+           cy_writeb(base_addr+(CyTCOR<<index), info->tco);
+           cy_writeb(base_addr+(CyTBPR<<index), info->tbpr);
+           cy_writeb(base_addr+(CyRCOR<<index), info->rco);
+           cy_writeb(base_addr+(CyRBPR<<index), info->rbpr);
 
            /* set line characteristics  according configuration */
 
-           cy_writeb((u_long)base_addr+(CySCHR1<<index), 
+           cy_writeb(base_addr+(CySCHR1<<index), 
                      START_CHAR(info->tty));
-           cy_writeb((u_long)base_addr+(CySCHR2<<index), 
+           cy_writeb(base_addr+(CySCHR2<<index), 
                      STOP_CHAR(info->tty));
-           cy_writeb((u_long)base_addr+(CyCOR1<<index), info->cor1);
-           cy_writeb((u_long)base_addr+(CyCOR2<<index), info->cor2);
-           cy_writeb((u_long)base_addr+(CyCOR3<<index), info->cor3);
-           cy_writeb((u_long)base_addr+(CyCOR4<<index), info->cor4);
-           cy_writeb((u_long)base_addr+(CyCOR5<<index), info->cor5);
+           cy_writeb(base_addr+(CyCOR1<<index), info->cor1);
+           cy_writeb(base_addr+(CyCOR2<<index), info->cor2);
+           cy_writeb(base_addr+(CyCOR3<<index), info->cor3);
+           cy_writeb(base_addr+(CyCOR4<<index), info->cor4);
+           cy_writeb(base_addr+(CyCOR5<<index), info->cor5);
 
            cyy_issue_cmd(base_addr,
                     CyCOR_CHANGE|CyCOR1ch|CyCOR2ch|CyCOR3ch,index);
 
-           cy_writeb((u_long)base_addr+(CyCAR<<index), 
+           cy_writeb(base_addr+(CyCAR<<index), 
                      (u_char)channel); /* !!! Is this needed? */
-           cy_writeb((u_long)base_addr+(CyRTPR<<index), (info->default_timeout
+           cy_writeb(base_addr+(CyRTPR<<index), (info->default_timeout
                                                 ? info->default_timeout
                                                 : 0x02)); /* 10ms rx timeout */
 
            if (C_CLOCAL(info->tty)) {
                /* without modem intr */
-               cy_writeb((u_long)base_addr+(CySRER<<index),
+               cy_writeb(base_addr+(CySRER<<index),
                    cy_readb(base_addr+(CySRER<<index)) | CyMdmCh); 
                                        /* act on 1->0 modem transitions */
                 if ((cflag & CRTSCTS) && info->rflow) {
-                        cy_writeb((u_long)base_addr+(CyMCOR1<<index), 
+                        cy_writeb(base_addr+(CyMCOR1<<index), 
                                   (CyCTS|rflow_thr[i]));
                 } else {
-                        cy_writeb((u_long)base_addr+(CyMCOR1<<index), CyCTS);
+                        cy_writeb(base_addr+(CyMCOR1<<index), CyCTS);
                 }
                                        /* act on 0->1 modem transitions */
-               cy_writeb((u_long)base_addr+(CyMCOR2<<index), CyCTS);
+               cy_writeb(base_addr+(CyMCOR2<<index), CyCTS);
            } else {
                /* without modem intr */
-               cy_writeb((u_long)base_addr+(CySRER<<index),
+               cy_writeb(base_addr+(CySRER<<index),
                    cy_readb(base_addr+(CySRER<<index)) | CyMdmCh); 
                                        /* act on 1->0 modem transitions */
                 if ((cflag & CRTSCTS) && info->rflow) {
-                       cy_writeb((u_long)base_addr+(CyMCOR1<<index), 
+                       cy_writeb(base_addr+(CyMCOR1<<index), 
                                  (CyDSR|CyCTS|CyRI|CyDCD|rflow_thr[i]));
                 } else {
-                       cy_writeb((u_long)base_addr+(CyMCOR1<<index), 
+                       cy_writeb(base_addr+(CyMCOR1<<index), 
                                   CyDSR|CyCTS|CyRI|CyDCD);
                 }
                                        /* act on 0->1 modem transitions */
-               cy_writeb((u_long)base_addr+(CyMCOR2<<index), 
+               cy_writeb(base_addr+(CyMCOR2<<index), 
                          CyDSR|CyCTS|CyRI|CyDCD);
            }
 
            if(i == 0){ /* baud rate is zero, turn off line */
                if (info->rtsdtr_inv) {
-                       cy_writeb((u_long)base_addr+(CyMSVR1<<index), ~CyRTS);
+                       cy_writeb(base_addr+(CyMSVR1<<index), ~CyRTS);
                } else {
-                        cy_writeb((u_long)base_addr+(CyMSVR2<<index), ~CyDTR);
+                        cy_writeb(base_addr+(CyMSVR2<<index), ~CyDTR);
                }
 #ifdef CY_DEBUG_DTR
                printk("cyc:set_line_char dropping DTR\n");
@@ -3382,9 +3268,9 @@ set_line_char(struct cyclades_port * info)
 #endif
            }else{
                 if (info->rtsdtr_inv) {
-                       cy_writeb((u_long)base_addr+(CyMSVR1<<index), CyRTS);
+                       cy_writeb(base_addr+(CyMSVR1<<index), CyRTS);
                 } else {
-                       cy_writeb((u_long)base_addr+(CyMSVR2<<index), CyDTR);
+                       cy_writeb(base_addr+(CyMSVR2<<index), CyDTR);
                 }
 #ifdef CY_DEBUG_DTR
                printk("cyc:set_line_char raising DTR\n");
@@ -3400,23 +3286,20 @@ set_line_char(struct cyclades_port * info)
        CY_UNLOCK(info, flags);
 
     } else {
-      struct FIRM_ID *firm_id;
-      struct ZFW_CTRL *zfw_ctrl;
-      struct BOARD_CTRL *board_ctrl;
-      struct CH_CTRL *ch_ctrl;
-      struct BUF_CTRL *buf_ctrl;
+      struct FIRM_ID __iomem *firm_id;
+      struct ZFW_CTRL __iomem *zfw_ctrl;
+      struct BOARD_CTRL __iomem *board_ctrl;
+      struct CH_CTRL __iomem *ch_ctrl;
+      struct BUF_CTRL __iomem *buf_ctrl;
       uclong sw_flow;
       int retval;
 
-        firm_id = (struct FIRM_ID *)
-                       (cy_card[card].base_addr + ID_ADDRESS);
+        firm_id = cy_card[card].base_addr + ID_ADDRESS;
         if (!ISZLOADED(cy_card[card])) {
            return;
        }
 
-       zfw_ctrl = (struct ZFW_CTRL *)
-                   (cy_card[card].base_addr + 
-                    (cy_readl(&firm_id->zfwctrl_addr) & 0xfffff));
+       zfw_ctrl = cy_card[card].base_addr + (cy_readl(&firm_id->zfwctrl_addr) & 0xfffff);
        board_ctrl = &zfw_ctrl->board_ctrl;
        ch_ctrl = &(zfw_ctrl->ch_ctrl[channel]);
        buf_ctrl = &zfw_ctrl->buf_ctrl[channel];
@@ -3617,7 +3500,7 @@ static int get_lsr_info(struct cyclades_port *info, unsigned int __user *value)
     unsigned char status;
     unsigned int result;
     unsigned long flags;
-    unsigned char *base_addr;
+    void __iomem *base_addr;
 
     card = info->card;
     channel = (info->line) - (cy_card[card].first_line);
@@ -3625,8 +3508,7 @@ static int get_lsr_info(struct cyclades_port *info, unsigned int __user *value)
        chip = channel>>2;
        channel &= 0x03;
        index = cy_card[card].bus_index;
-       base_addr = (unsigned char *)
-                    (cy_card[card].base_addr + (cy_chip_offset[chip]<<index));
+       base_addr = cy_card[card].base_addr + (cy_chip_offset[chip]<<index);
 
        CY_LOCK(info, flags);
        status = cy_readb(base_addr+(CySRER<<index)) & (CyTxRdy|CyTxMpty);
@@ -3644,15 +3526,15 @@ cy_tiocmget(struct tty_struct *tty, struct file *file)
 {
   struct cyclades_port * info = (struct cyclades_port *)tty->driver_data;
   int card,chip,channel,index;
-  unsigned char *base_addr;
+  void __iomem *base_addr;
   unsigned long flags;
   unsigned char status;
   unsigned long lstatus;
   unsigned int result;
-  struct FIRM_ID *firm_id;
-  struct ZFW_CTRL *zfw_ctrl;
-  struct BOARD_CTRL *board_ctrl;
-  struct CH_CTRL *ch_ctrl;
+  struct FIRM_ID __iomem *firm_id;
+  struct ZFW_CTRL __iomem *zfw_ctrl;
+  struct BOARD_CTRL __iomem *board_ctrl;
+  struct CH_CTRL __iomem *ch_ctrl;
 
     if (serial_paranoia_check(info, tty->name, __FUNCTION__))
        return -ENODEV;
@@ -3663,12 +3545,10 @@ cy_tiocmget(struct tty_struct *tty, struct file *file)
        chip = channel>>2;
        channel &= 0x03;
        index = cy_card[card].bus_index;
-       base_addr = (unsigned char*)
-                      (cy_card[card].base_addr
-                      + (cy_chip_offset[chip]<<index));
+       base_addr = cy_card[card].base_addr + (cy_chip_offset[chip]<<index);
 
        CY_LOCK(info, flags);
-           cy_writeb((u_long)base_addr+(CyCAR<<index), (u_char)channel);
+           cy_writeb(base_addr+(CyCAR<<index), (u_char)channel);
            status = cy_readb(base_addr+(CyMSVR1<<index));
            status |= cy_readb(base_addr+(CyMSVR2<<index));
        CY_UNLOCK(info, flags);
@@ -3685,18 +3565,15 @@ cy_tiocmget(struct tty_struct *tty, struct file *file)
                 | ((status  & CyDSR) ? TIOCM_DSR : 0)
                 | ((status  & CyCTS) ? TIOCM_CTS : 0);
     } else {
-       base_addr = (unsigned char*) (cy_card[card].base_addr);
+       base_addr = cy_card[card].base_addr;
 
         if (cy_card[card].num_chips != -1){
            return -EINVAL;
        }
 
-       firm_id = (struct FIRM_ID *)
-                   (cy_card[card].base_addr + ID_ADDRESS);
+       firm_id = cy_card[card].base_addr + ID_ADDRESS;
         if (ISZLOADED(cy_card[card])) {
-           zfw_ctrl = (struct ZFW_CTRL *)
-                       (cy_card[card].base_addr + 
-                        (cy_readl(&firm_id->zfwctrl_addr) & 0xfffff));
+           zfw_ctrl = cy_card[card].base_addr + (cy_readl(&firm_id->zfwctrl_addr) & 0xfffff);
            board_ctrl = &zfw_ctrl->board_ctrl;
            ch_ctrl = zfw_ctrl->ch_ctrl;
            lstatus = cy_readl(&ch_ctrl[channel].rs_status);
@@ -3722,12 +3599,12 @@ cy_tiocmset(struct tty_struct *tty, struct file *file,
 {
   struct cyclades_port * info = (struct cyclades_port *)tty->driver_data;
   int card,chip,channel,index;
-  unsigned char *base_addr;
+  void __iomem *base_addr;
   unsigned long flags;
-  struct FIRM_ID *firm_id;
-  struct ZFW_CTRL *zfw_ctrl;
-  struct BOARD_CTRL *board_ctrl;
-  struct CH_CTRL *ch_ctrl;
+  struct FIRM_ID __iomem *firm_id;
+  struct ZFW_CTRL __iomem *zfw_ctrl;
+  struct BOARD_CTRL __iomem *board_ctrl;
+  struct CH_CTRL __iomem *ch_ctrl;
   int retval;
 
     if (serial_paranoia_check(info, tty->name, __FUNCTION__))
@@ -3739,37 +3616,35 @@ cy_tiocmset(struct tty_struct *tty, struct file *file,
        chip = channel>>2;
        channel &= 0x03;
        index = cy_card[card].bus_index;
-       base_addr = (unsigned char*)
-                      (cy_card[card].base_addr
-                      + (cy_chip_offset[chip]<<index));
+       base_addr = cy_card[card].base_addr + (cy_chip_offset[chip]<<index);
 
        if (set & TIOCM_RTS){
                CY_LOCK(info, flags);
-               cy_writeb((u_long)base_addr+(CyCAR<<index), (u_char)channel);
+               cy_writeb(base_addr+(CyCAR<<index), (u_char)channel);
                 if (info->rtsdtr_inv) {
-                       cy_writeb((u_long)base_addr+(CyMSVR2<<index), CyDTR);
+                       cy_writeb(base_addr+(CyMSVR2<<index), CyDTR);
                 } else {
-                       cy_writeb((u_long)base_addr+(CyMSVR1<<index), CyRTS);
+                       cy_writeb(base_addr+(CyMSVR1<<index), CyRTS);
                 }
                CY_UNLOCK(info, flags);
        }
        if (clear & TIOCM_RTS) {
                CY_LOCK(info, flags);
-               cy_writeb((u_long)base_addr+(CyCAR<<index), (u_char)channel);
+               cy_writeb(base_addr+(CyCAR<<index), (u_char)channel);
                 if (info->rtsdtr_inv) {
-                       cy_writeb((u_long)base_addr+(CyMSVR2<<index), ~CyDTR);
+                       cy_writeb(base_addr+(CyMSVR2<<index), ~CyDTR);
                 } else {
-                       cy_writeb((u_long)base_addr+(CyMSVR1<<index), ~CyRTS);
+                       cy_writeb(base_addr+(CyMSVR1<<index), ~CyRTS);
                 }
                CY_UNLOCK(info, flags);
        }
        if (set & TIOCM_DTR){
                CY_LOCK(info, flags);
-               cy_writeb((u_long)base_addr+(CyCAR<<index), (u_char)channel);
+               cy_writeb(base_addr+(CyCAR<<index), (u_char)channel);
                 if (info->rtsdtr_inv) {
-                       cy_writeb((u_long)base_addr+(CyMSVR1<<index), CyRTS);
+                       cy_writeb(base_addr+(CyMSVR1<<index), CyRTS);
                 } else {
-                       cy_writeb((u_long)base_addr+(CyMSVR2<<index), CyDTR);
+                       cy_writeb(base_addr+(CyMSVR2<<index), CyDTR);
                 }
 #ifdef CY_DEBUG_DTR
                printk("cyc:set_modem_info raising DTR\n");
@@ -3781,11 +3656,11 @@ cy_tiocmset(struct tty_struct *tty, struct file *file,
        }
        if (clear & TIOCM_DTR) {
                CY_LOCK(info, flags);
-               cy_writeb((u_long)base_addr+(CyCAR<<index), (u_char)channel);
+               cy_writeb(base_addr+(CyCAR<<index), (u_char)channel);
                 if (info->rtsdtr_inv) {
-                       cy_writeb((u_long)base_addr+(CyMSVR1<<index), ~CyRTS);
+                       cy_writeb(base_addr+(CyMSVR1<<index), ~CyRTS);
                 } else {
-                       cy_writeb((u_long)base_addr+(CyMSVR2<<index), ~CyDTR);
+                       cy_writeb(base_addr+(CyMSVR2<<index), ~CyDTR);
                 }
 
 #ifdef CY_DEBUG_DTR
@@ -3797,14 +3672,11 @@ cy_tiocmset(struct tty_struct *tty, struct file *file,
                CY_UNLOCK(info, flags);
        }
     } else {
-       base_addr = (unsigned char*) (cy_card[card].base_addr);
+       base_addr = cy_card[card].base_addr;
 
-       firm_id = (struct FIRM_ID *)
-                   (cy_card[card].base_addr + ID_ADDRESS);
+       firm_id = cy_card[card].base_addr + ID_ADDRESS;
         if (ISZLOADED(cy_card[card])) {
-           zfw_ctrl = (struct ZFW_CTRL *)
-                       (cy_card[card].base_addr + 
-                        (cy_readl(&firm_id->zfwctrl_addr) & 0xfffff));
+           zfw_ctrl = cy_card[card].base_addr + (cy_readl(&firm_id->zfwctrl_addr) & 0xfffff);
            board_ctrl = &zfw_ctrl->board_ctrl;
            ch_ctrl = zfw_ctrl->ch_ctrl;
 
@@ -3930,7 +3802,7 @@ get_mon_info(struct cyclades_port * info, struct cyclades_monitor __user * mon)
 static int
 set_threshold(struct cyclades_port * info, unsigned long value)
 {
-  unsigned char *base_addr;
+  void __iomem *base_addr;
   int card,channel,chip,index;
   unsigned long flags;
    
@@ -3940,15 +3812,13 @@ set_threshold(struct cyclades_port * info, unsigned long value)
        chip = channel>>2;
        channel &= 0x03;
        index = cy_card[card].bus_index;
-       base_addr = (unsigned char*)
-                      (cy_card[card].base_addr
-                      + (cy_chip_offset[chip]<<index));
+       base_addr = cy_card[card].base_addr + (cy_chip_offset[chip]<<index);
 
        info->cor3 &= ~CyREC_FIFO;
        info->cor3 |= value & CyREC_FIFO;
 
        CY_LOCK(info, flags);
-           cy_writeb((u_long)base_addr+(CyCOR3<<index), info->cor3);
+           cy_writeb(base_addr+(CyCOR3<<index), info->cor3);
            cyy_issue_cmd(base_addr,CyCOR_CHANGE|CyCOR3ch,index);
        CY_UNLOCK(info, flags);
     } else {
@@ -3961,7 +3831,7 @@ set_threshold(struct cyclades_port * info, unsigned long value)
 static int
 get_threshold(struct cyclades_port * info, unsigned long __user *value)
 {
-  unsigned char *base_addr;
+  void __iomem *base_addr;
   int card,channel,chip,index;
   unsigned long tmp;
    
@@ -3971,9 +3841,7 @@ get_threshold(struct cyclades_port * info, unsigned long __user *value)
        chip = channel>>2;
        channel &= 0x03;
        index = cy_card[card].bus_index;
-       base_addr = (unsigned char*)
-                      (cy_card[card].base_addr
-                      + (cy_chip_offset[chip]<<index));
+       base_addr = cy_card[card].base_addr + (cy_chip_offset[chip]<<index);
 
        tmp = cy_readb(base_addr+(CyCOR3<<index)) & CyREC_FIFO;
        return put_user(tmp,value);
@@ -4002,7 +3870,7 @@ get_default_threshold(struct cyclades_port * info, unsigned long __user *value)
 static int
 set_timeout(struct cyclades_port * info, unsigned long value)
 {
-  unsigned char *base_addr;
+  void __iomem *base_addr;
   int card,channel,chip,index;
   unsigned long flags;
    
@@ -4012,12 +3880,10 @@ set_timeout(struct cyclades_port * info, unsigned long value)
        chip = channel>>2;
        channel &= 0x03;
        index = cy_card[card].bus_index;
-       base_addr = (unsigned char*)
-                      (cy_card[card].base_addr
-                      + (cy_chip_offset[chip]<<index));
+       base_addr = cy_card[card].base_addr + (cy_chip_offset[chip]<<index);
 
        CY_LOCK(info, flags);
-           cy_writeb((u_long)base_addr+(CyRTPR<<index), value & 0xff);
+           cy_writeb(base_addr+(CyRTPR<<index), value & 0xff);
        CY_UNLOCK(info, flags);
     } else {
        // Nothing to do!
@@ -4029,7 +3895,7 @@ set_timeout(struct cyclades_port * info, unsigned long value)
 static int
 get_timeout(struct cyclades_port * info, unsigned long __user *value)
 {
-  unsigned char *base_addr;
+  void __iomem *base_addr;
   int card,channel,chip,index;
   unsigned long tmp;
    
@@ -4039,9 +3905,7 @@ get_timeout(struct cyclades_port * info, unsigned long __user *value)
        chip = channel>>2;
        channel &= 0x03;
        index = cy_card[card].bus_index;
-       base_addr = (unsigned char*)
-                      (cy_card[card].base_addr
-                      + (cy_chip_offset[chip]<<index));
+       base_addr = cy_card[card].base_addr + (cy_chip_offset[chip]<<index);
 
        tmp = cy_readb(base_addr+(CyRTPR<<index));
        return put_user(tmp,value);
@@ -4329,7 +4193,7 @@ cy_throttle(struct tty_struct * tty)
 {
   struct cyclades_port *info = (struct cyclades_port *)tty->driver_data;
   unsigned long flags;
-  unsigned char *base_addr;
+  void __iomem *base_addr;
   int card,chip,channel,index;
 
 #ifdef CY_DEBUG_THROTTLE
@@ -4359,16 +4223,14 @@ cy_throttle(struct tty_struct * tty)
             chip = channel>>2;
             channel &= 0x03;
             index = cy_card[card].bus_index;
-            base_addr = (unsigned char*)
-             (cy_card[card].base_addr
-               + (cy_chip_offset[chip]<<index));
+            base_addr = cy_card[card].base_addr + (cy_chip_offset[chip]<<index);
 
             CY_LOCK(info, flags);
-            cy_writeb((u_long)base_addr+(CyCAR<<index), (u_char)channel);
+            cy_writeb(base_addr+(CyCAR<<index), (u_char)channel);
             if (info->rtsdtr_inv) {
-                cy_writeb((u_long)base_addr+(CyMSVR2<<index), ~CyDTR);
+                cy_writeb(base_addr+(CyMSVR2<<index), ~CyDTR);
              } else {
-                cy_writeb((u_long)base_addr+(CyMSVR1<<index), ~CyRTS);
+                cy_writeb(base_addr+(CyMSVR1<<index), ~CyRTS);
             }
            CY_UNLOCK(info, flags);
        } else {
@@ -4390,7 +4252,7 @@ cy_unthrottle(struct tty_struct * tty)
 {
   struct cyclades_port *info = (struct cyclades_port *)tty->driver_data;
   unsigned long flags;
-  unsigned char *base_addr;
+  void __iomem *base_addr;
   int card,chip,channel,index;
 
 #ifdef CY_DEBUG_THROTTLE
@@ -4419,16 +4281,14 @@ cy_unthrottle(struct tty_struct * tty)
            chip = channel>>2;
            channel &= 0x03;
            index = cy_card[card].bus_index;
-           base_addr = (unsigned char*)
-                      (cy_card[card].base_addr
-                      + (cy_chip_offset[chip]<<index));
+           base_addr = cy_card[card].base_addr + (cy_chip_offset[chip]<<index);
 
            CY_LOCK(info, flags);
-           cy_writeb((u_long)base_addr+(CyCAR<<index), (u_char)channel);
+           cy_writeb(base_addr+(CyCAR<<index), (u_char)channel);
            if (info->rtsdtr_inv) {
-                   cy_writeb((u_long)base_addr+(CyMSVR2<<index), CyDTR);
+                   cy_writeb(base_addr+(CyMSVR2<<index), CyDTR);
            } else {
-                   cy_writeb((u_long)base_addr+(CyMSVR1<<index), CyRTS);
+                   cy_writeb(base_addr+(CyMSVR1<<index), CyRTS);
            }
            CY_UNLOCK(info, flags);
         } else {
@@ -4448,7 +4308,7 @@ cy_stop(struct tty_struct *tty)
 {
   struct cyclades_card *cinfo;
   struct cyclades_port *info = (struct cyclades_port *)tty->driver_data;
-  unsigned char *base_addr;
+  void __iomem *base_addr;
   int chip,channel,index;
   unsigned long flags;
 
@@ -4465,14 +4325,12 @@ cy_stop(struct tty_struct *tty)
         index = cinfo->bus_index;
         chip = channel>>2;
         channel &= 0x03;
-        base_addr = (unsigned char*)
-                   (cy_card[info->card].base_addr
-                           + (cy_chip_offset[chip]<<index));
+        base_addr = cy_card[info->card].base_addr + (cy_chip_offset[chip]<<index);
 
        CY_LOCK(info, flags);
-            cy_writeb((u_long)base_addr+(CyCAR<<index),
+            cy_writeb(base_addr+(CyCAR<<index),
               (u_char)(channel & 0x0003)); /* index channel */
-            cy_writeb((u_long)base_addr+(CySRER<<index), 
+            cy_writeb(base_addr+(CySRER<<index), 
                cy_readb(base_addr+(CySRER<<index)) & ~CyTxRdy);
        CY_UNLOCK(info, flags);
     } else {
@@ -4488,7 +4346,7 @@ cy_start(struct tty_struct *tty)
 {
   struct cyclades_card *cinfo;
   struct cyclades_port *info = (struct cyclades_port *)tty->driver_data;
-  unsigned char *base_addr;
+  void __iomem *base_addr;
   int chip,channel,index;
   unsigned long flags;
 
@@ -4505,14 +4363,12 @@ cy_start(struct tty_struct *tty)
     if (!IS_CYC_Z(*cinfo)) {
         chip = channel>>2;
         channel &= 0x03;
-        base_addr = (unsigned char*)
-                       (cy_card[info->card].base_addr
-                      + (cy_chip_offset[chip]<<index));
+        base_addr = cy_card[info->card].base_addr + (cy_chip_offset[chip]<<index);
 
        CY_LOCK(info, flags);
-            cy_writeb((u_long)base_addr+(CyCAR<<index),
+            cy_writeb(base_addr+(CyCAR<<index),
               (u_char)(channel & 0x0003)); /* index channel */
-            cy_writeb((u_long)base_addr+(CySRER<<index), 
+            cy_writeb(base_addr+(CySRER<<index), 
                cy_readb(base_addr+(CySRER<<index)) | CyTxRdy);
        CY_UNLOCK(info, flags);
     } else {
@@ -4554,10 +4410,8 @@ cy_flush_buffer(struct tty_struct *tty)
        }
        CY_UNLOCK(info, flags);
     }
+    tty_wakeup(tty);
     wake_up_interruptible(&tty->write_wait);
-    if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP))
-       && tty->ldisc.write_wakeup)
-           (tty->ldisc.write_wakeup)(tty);
 } /* cy_flush_buffer */
 
 
@@ -4600,20 +4454,19 @@ cy_hangup(struct tty_struct *tty)
 /* initialize chips on Cyclom-Y card -- return number of valid
    chips (which is number of ports/4) */
 static unsigned short __init
-cyy_init_card(volatile ucchar *true_base_addr,int index)
+cyy_init_card(void __iomem *true_base_addr,int index)
 {
   unsigned int chip_number;
-  volatile ucchar* base_addr;
+  void __iomem *base_addr;
 
-    cy_writeb((u_long)true_base_addr+(Cy_HwReset<<index), 0); 
+    cy_writeb(true_base_addr+(Cy_HwReset<<index), 0); 
                                                /* Cy_HwReset is 0x1400 */
-    cy_writeb((u_long)true_base_addr+(Cy_ClrIntr<<index), 0); 
+    cy_writeb(true_base_addr+(Cy_ClrIntr<<index), 0); 
                                                /* Cy_ClrIntr is 0x1800 */
     udelay(500L);
 
     for(chip_number=0; chip_number<CyMAX_CHIPS_PER_CARD; chip_number++){
-        base_addr = true_base_addr
-                      + (cy_chip_offset[chip_number]<<index);
+        base_addr = true_base_addr + (cy_chip_offset[chip_number]<<index);
         mdelay(1);
         if(cy_readb(base_addr+(CyCCR<<index)) != 0x00){
             /*************
@@ -4623,7 +4476,7 @@ cyy_init_card(volatile ucchar *true_base_addr,int index)
             return chip_number;
         }
 
-        cy_writeb((u_long)base_addr+(CyGFRCR<<index), 0);
+        cy_writeb(base_addr+(CyGFRCR<<index), 0);
         udelay(10L);
 
         /* The Cyclom-16Y does not decode address bit 9 and therefore
@@ -4639,7 +4492,7 @@ cyy_init_card(volatile ucchar *true_base_addr,int index)
             return chip_number;
         }
 
-        cy_writeb((u_long)base_addr+(CyCCR<<index), CyCHIP_RESET);
+        cy_writeb(base_addr+(CyCCR<<index), CyCHIP_RESET);
         mdelay(1);
 
         if(cy_readb(base_addr+(CyGFRCR<<index)) == 0x00){
@@ -4658,15 +4511,15 @@ cyy_init_card(volatile ucchar *true_base_addr,int index)
             */
             return chip_number;
         }
-        cy_writeb((u_long)base_addr+(CyGCR<<index), CyCH0_SERIAL);
+        cy_writeb(base_addr+(CyGCR<<index), CyCH0_SERIAL);
         if (cy_readb(base_addr+(CyGFRCR<<index)) >= CD1400_REV_J){
            /* It is a CD1400 rev. J or later */
            /* Impossible to reach 5ms with this chip. 
               Changed to 2ms instead (f = 500 Hz). */
-           cy_writeb((u_long)base_addr+(CyPPR<<index), CyCLOCK_60_2MS);
+           cy_writeb(base_addr+(CyPPR<<index), CyCLOCK_60_2MS);
        } else {
            /* f = 200 Hz */
-           cy_writeb((u_long)base_addr+(CyPPR<<index), CyCLOCK_25_5MS);
+           cy_writeb(base_addr+(CyPPR<<index), CyCLOCK_25_5MS);
        }
 
     /*
@@ -4689,7 +4542,7 @@ cy_detect_isa(void)
 {
 #ifdef CONFIG_ISA
   unsigned short       cy_isa_irq,nboard;
-  volatile ucchar      *cy_isa_address;
+  void __iomem         *cy_isa_address;
   unsigned short       i,j,cy_isa_nchan;
 #ifdef MODULE
   int isparam = 0;
@@ -4702,7 +4555,7 @@ cy_detect_isa(void)
        for(i = 0 ; i < NR_CARDS; i++) {
            if (maddr[i] || i) {
                isparam = 1;
-               cy_isa_addresses[i] = (ucchar *)maddr[i];
+               cy_isa_addresses[i] = maddr[i];
            }
            if (!maddr[i])
                break;
@@ -4711,15 +4564,13 @@ cy_detect_isa(void)
 
         /* scan the address table probing for Cyclom-Y/ISA boards */
         for (i = 0 ; i < NR_ISA_ADDRS ; i++) {
-                cy_isa_address = cy_isa_addresses[i];
-                if (cy_isa_address  == 0x0000) {
+               unsigned int isa_address = cy_isa_addresses[i];
+                if (isa_address  == 0x0000) {
                         return(nboard);
                 }
 
                 /* probe for CD1400... */
-#if !defined(__alpha__)
-               cy_isa_address = ioremap((ulong)cy_isa_address, CyISA_Ywin);
-#endif
+               cy_isa_address = ioremap(isa_address, CyISA_Ywin);
                 cy_isa_nchan = CyPORTS_PER_CHIP * 
                      cyy_init_card(cy_isa_address,0);
                 if (cy_isa_nchan == 0) {
@@ -4761,7 +4612,7 @@ cy_detect_isa(void)
 
                 /* allocate IRQ */
                 if(request_irq(cy_isa_irq, cyy_interrupt,
-                                  SA_INTERRUPT, "Cyclom-Y", &cy_card[j]))
+                                  IRQF_DISABLED, "Cyclom-Y", &cy_card[j]))
                 {
                         printk("Cyclom-Y/ISA found at 0x%lx ",
                                 (unsigned long) cy_isa_address);
@@ -4771,8 +4622,8 @@ cy_detect_isa(void)
                 }
 
                 /* set cy_card */
-                cy_card[j].base_addr = (u_long) cy_isa_address;
-                cy_card[j].ctl_addr = 0;
+                cy_card[j].base_addr = cy_isa_address;
+                cy_card[j].ctl_addr = NULL;
                 cy_card[j].irq = (int) cy_isa_irq;
                 cy_card[j].bus_index = 0;
                 cy_card[j].first_line = cy_next_channel;
@@ -4795,7 +4646,7 @@ cy_detect_isa(void)
 } /* cy_detect_isa */
 
 static void 
-plx_init(uclong addr, uclong initctl)
+plx_init(void __iomem *addr, uclong initctl)
 {
     /* Reset PLX */
     cy_writel(addr + initctl, cy_readl(addr + initctl) | 0x40000000);
@@ -4823,11 +4674,12 @@ cy_detect_pci(void)
   unsigned char                cyy_rev_id;
   unsigned char                cy_pci_irq = 0;
   uclong               cy_pci_phys0, cy_pci_phys2;
-  uclong               cy_pci_addr0, cy_pci_addr2;
+  void __iomem         *cy_pci_addr0, *cy_pci_addr2;
   unsigned short       i,j,cy_pci_nchan, plx_ver;
   unsigned short       device_id,dev_index = 0;
   uclong               mailbox;
-  uclong               Ze_addr0[NR_CARDS], Ze_addr2[NR_CARDS], ZeIndex = 0;
+  uclong               ZeIndex = 0;
+  void __iomem         *Ze_addr0[NR_CARDS], *Ze_addr2[NR_CARDS];
   uclong               Ze_phys0[NR_CARDS], Ze_phys2[NR_CARDS];
   unsigned char                Ze_irq[NR_CARDS];
   struct pci_dev       *Ze_pdev[NR_CARDS];
@@ -4835,7 +4687,7 @@ cy_detect_pci(void)
         for (i = 0; i < NR_CARDS; i++) {
                 /* look for a Cyclades card by vendor and device id */
                 while((device_id = cy_pci_dev_id[dev_index]) != 0) {
-                        if((pdev = pci_find_device(PCI_VENDOR_ID_CYCLADES,
+                        if((pdev = pci_get_device(PCI_VENDOR_ID_CYCLADES,
                                         device_id, pdev)) == NULL) {
                                 dev_index++;    /* try next device id */
                         } else {
@@ -4896,15 +4748,15 @@ cy_detect_pci(void)
                    continue;
                 }
 #endif
-               cy_pci_addr0 = (ulong)ioremap(cy_pci_phys0, CyPCI_Yctl);
-               cy_pci_addr2 = (ulong)ioremap(cy_pci_phys2, CyPCI_Ywin);
+               cy_pci_addr0 = ioremap(cy_pci_phys0, CyPCI_Yctl);
+               cy_pci_addr2 = ioremap(cy_pci_phys2, CyPCI_Ywin);
 
 #ifdef CY_PCI_DEBUG
             printk("Cyclom-Y/PCI: relocate winaddr=0x%lx ctladdr=0x%lx\n",
                (u_long)cy_pci_addr2, (u_long)cy_pci_addr0);
 #endif
                 cy_pci_nchan = (unsigned short)(CyPORTS_PER_CHIP * 
-                       cyy_init_card((volatile ucchar *)cy_pci_addr2, 1));
+                       cyy_init_card(cy_pci_addr2, 1));
                 if(cy_pci_nchan == 0) {
                         printk("Cyclom-Y PCI host card with ");
                         printk("no Serial-Modules at 0x%lx.\n",
@@ -4933,7 +4785,7 @@ cy_detect_pci(void)
 
                 /* allocate IRQ */
                 if(request_irq(cy_pci_irq, cyy_interrupt,
-                       SA_SHIRQ, "Cyclom-Y", &cy_card[j]))
+                       IRQF_SHARED, "Cyclom-Y", &cy_card[j]))
                 {
                         printk("Cyclom-Y/PCI found at 0x%lx ",
                            (ulong) cy_pci_phys2);
@@ -4945,8 +4797,8 @@ cy_detect_pci(void)
                 /* set cy_card */
                 cy_card[j].base_phys = (ulong)cy_pci_phys2;
                 cy_card[j].ctl_phys = (ulong)cy_pci_phys0;
-                cy_card[j].base_addr = (ulong)cy_pci_addr2;
-                cy_card[j].ctl_addr = (ulong)cy_pci_addr0;
+                cy_card[j].base_addr = cy_pci_addr2;
+                cy_card[j].ctl_addr = cy_pci_addr0;
                 cy_card[j].irq = (int) cy_pci_irq;
                 cy_card[j].bus_index = 1;
                 cy_card[j].first_line = cy_next_channel;
@@ -5006,7 +4858,7 @@ cy_detect_pci(void)
             printk("Cyclades-Z/PCI: found winaddr=0x%lx ctladdr=0x%lx\n",
                 (ulong)cy_pci_phys2, (ulong)cy_pci_phys0);
 #endif
-               cy_pci_addr0 = (ulong)ioremap(cy_pci_phys0, CyPCI_Zctl);
+               cy_pci_addr0 = ioremap(cy_pci_phys0, CyPCI_Zctl);
 
                /* Disable interrupts on the PLX before resetting it */
                cy_writew(cy_pci_addr0+0x68,
@@ -5019,7 +4871,7 @@ cy_detect_pci(void)
                   This will remain here until we find a permanent fix. */
                pci_write_config_byte(pdev, PCI_INTERRUPT_LINE, cy_pci_irq);
 
-               mailbox = (uclong)cy_readl(&((struct RUNTIME_9060 *) 
+               mailbox = (uclong)cy_readl(&((struct RUNTIME_9060 __iomem *) 
                           cy_pci_addr0)->mail_box_0);
 
                if (pci_resource_flags(pdev, 2) & IORESOURCE_IO) {
@@ -5037,7 +4889,7 @@ cy_detect_pci(void)
                }
        
                if (mailbox == ZE_V1) {
-                   cy_pci_addr2 = (ulong)ioremap(cy_pci_phys2, CyPCI_Ze_win);
+                   cy_pci_addr2 = ioremap(cy_pci_phys2, CyPCI_Ze_win);
                    if (ZeIndex == NR_CARDS) {
                        printk("Cyclades-Ze/PCI found at 0x%lx ",
                                (ulong)cy_pci_phys2);
@@ -5055,7 +4907,7 @@ cy_detect_pci(void)
                    i--;
                    continue;
                } else {
-                   cy_pci_addr2 = (ulong)ioremap(cy_pci_phys2, CyPCI_Zwin);
+                   cy_pci_addr2 = ioremap(cy_pci_phys2, CyPCI_Zwin);
                }
 
 #ifdef CY_PCI_DEBUG
@@ -5082,7 +4934,7 @@ cy_detect_pci(void)
             */
                PAUSE
                if ((mailbox == ZO_V1) || (mailbox == ZO_V2))
-                   cy_writel((ulong)(cy_pci_addr2+ID_ADDRESS), 0L);
+                   cy_writel(cy_pci_addr2 + ID_ADDRESS, 0L);
 
                 /* This must be a Cyclades-8Zo/PCI.  The extendable
                    version will have a different device_id and will
@@ -5113,7 +4965,7 @@ cy_detect_pci(void)
                 /* allocate IRQ only if board has an IRQ */
                if( (cy_pci_irq != 0) && (cy_pci_irq != 255) ) {
                    if(request_irq(cy_pci_irq, cyz_interrupt,
-                       SA_SHIRQ, "Cyclades-Z", &cy_card[j]))
+                       IRQF_SHARED, "Cyclades-Z", &cy_card[j]))
                    {
                         printk("Cyclom-8Zo/PCI found at 0x%lx ",
                            (ulong) cy_pci_phys2);
@@ -5172,7 +5024,7 @@ cy_detect_pci(void)
                Ze_pdev[j] = Ze_pdev[j+1];
            }
            ZeIndex--;
-               mailbox = (uclong)cy_readl(&((struct RUNTIME_9060 *) 
+               mailbox = (uclong)cy_readl(&((struct RUNTIME_9060 __iomem *) 
                                           cy_pci_addr0)->mail_box_0);
 #ifdef CY_PCI_DEBUG
             printk("Cyclades-Z/PCI: relocate winaddr=0x%lx ctladdr=0x%lx\n",
@@ -5207,7 +5059,7 @@ cy_detect_pci(void)
                 /* allocate IRQ only if board has an IRQ */
                if( (cy_pci_irq != 0) && (cy_pci_irq != 255) ) {
                    if(request_irq(cy_pci_irq, cyz_interrupt,
-                       SA_SHIRQ, "Cyclades-Z", &cy_card[j]))
+                       IRQF_SHARED, "Cyclades-Z", &cy_card[j]))
                    {
                         printk("Cyclom-Ze/PCI found at 0x%lx ",
                            (ulong) cy_pci_phys2);
@@ -5397,7 +5249,6 @@ cy_init(void)
     cy_serial_driver->owner = THIS_MODULE;
     cy_serial_driver->driver_name = "cyclades";
     cy_serial_driver->name = "ttyC";
-    cy_serial_driver->devfs_name = "tts/C";
     cy_serial_driver->major = CYCLADES_MAJOR;
     cy_serial_driver->minor_start = 0;
     cy_serial_driver->type = TTY_DRIVER_TYPE_SERIAL;
@@ -5413,7 +5264,7 @@ cy_init(void)
 
     for (i = 0; i < NR_CARDS; i++) {
             /* base_addr=0 indicates board not found */
-            cy_card[i].base_addr = 0;
+            cy_card[i].base_addr = NULL;
     }
 
     /* the code below is responsible to find the boards. Each different
@@ -5435,7 +5286,7 @@ cy_init(void)
     for (i = 0 ; i < NR_CARDS ; i++) {
         if (cy_card[i].base_addr == 0) {
                 cy_card[i].first_line = -1;
-                cy_card[i].ctl_addr = 0;
+                cy_card[i].ctl_addr = NULL;
                 cy_card[i].irq = 0;
                 cy_card[i].bus_index = 0;
                 cy_card[i].first_line = 0;
@@ -5453,7 +5304,7 @@ cy_init(void)
             cinfo = &cy_card[board];
             if (cinfo->num_chips == -1) { /* Cyclades-Z */
                number_z_boards++;
-               mailbox = cy_readl(&((struct RUNTIME_9060 *)
+               mailbox = cy_readl(&((struct RUNTIME_9060 __iomem *)
                             cy_card[board].ctl_addr)->mail_box_0);
                nports = (mailbox == ZE_V1) ? ZE_V1_NPORTS : 8;
                cinfo->intr_enabled = 0;
@@ -5623,10 +5474,10 @@ cy_cleanup_module(void)
     put_tty_driver(cy_serial_driver);
 
     for (i = 0; i < NR_CARDS; i++) {
-        if (cy_card[i].base_addr != 0) {
-           iounmap((void *)cy_card[i].base_addr);
-           if (cy_card[i].ctl_addr != 0)
-               iounmap((void *)cy_card[i].ctl_addr);
+        if (cy_card[i].base_addr) {
+           iounmap(cy_card[i].base_addr);
+           if (cy_card[i].ctl_addr)
+               iounmap(cy_card[i].ctl_addr);
            if (cy_card[i].irq
 #ifndef CONFIG_CYZ_INTR
                && cy_card[i].num_chips != -1 /* not a Z card */
@@ -5648,24 +5499,4 @@ cy_cleanup_module(void)
 module_init(cy_init);
 module_exit(cy_cleanup_module);
 
-#ifndef MODULE
-/* called by linux/init/main.c to parse command line options */
-void
-cy_setup(char *str, int *ints)
-{
-#ifdef CONFIG_ISA
-  int i, j;
-
-    for (i = 0 ; i < NR_ISA_ADDRS ; i++) {
-        if (cy_isa_addresses[i] == 0) break;
-    }
-    for (j = 1; j <= ints[0]; j++){
-        if ( i < NR_ISA_ADDRS ){
-            cy_isa_addresses[i++] = (unsigned char *)(ints[j]);
-        }
-    }
-#endif /* CONFIG_ISA */
-} /* cy_setup */
-#endif /* MODULE */
-
 MODULE_LICENSE("GPL");