Commit 35dec07a authored by Linus Torvalds's avatar Linus Torvalds Committed by Linus Torvalds

Fix cyclades driver types, and add __iomem annotations.

Remove absolutely tons of totally unnecessary casts,
once the types are done right in the first place.

The driver is still ugly as hell and needs some serious
indentation fixing, but this makes it not spew hundreds
of warnings any more.
parent b5ddba69
...@@ -682,13 +682,13 @@ static void cy_send_xchar (struct tty_struct *tty, char ch); ...@@ -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 IS_CYC_Z(card) ((card).num_chips == -1)
#define Z_FPGA_CHECK(card) \ #define Z_FPGA_CHECK(card) \
((cy_readl(&((struct RUNTIME_9060 *) \ ((cy_readl(&((struct RUNTIME_9060 __iomem *) \
((card).ctl_addr))->init_ctrl) & (1<<17)) != 0) ((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)) || \ ((card).ctl_addr))->mail_box_0)) || \
Z_FPGA_CHECK(card)) && \ 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))) ((card).base_addr+ID_ADDRESS))->signature)))
#ifndef SERIAL_XMIT_SIZE #ifndef SERIAL_XMIT_SIZE
...@@ -712,16 +712,16 @@ static struct tty_driver *cy_serial_driver; ...@@ -712,16 +712,16 @@ static struct tty_driver *cy_serial_driver;
boot options line. The form is "cyclades=address,address..." boot options line. The form is "cyclades=address,address..."
*/ */
static unsigned char *cy_isa_addresses[] = { static unsigned int cy_isa_addresses[] = {
(unsigned char *) 0xD0000, 0xD0000,
(unsigned char *) 0xD2000, 0xD2000,
(unsigned char *) 0xD4000, 0xD4000,
(unsigned char *) 0xD6000, 0xD6000,
(unsigned char *) 0xD8000, 0xD8000,
(unsigned char *) 0xDA000, 0xDA000,
(unsigned char *) 0xDC000, 0xDC000,
(unsigned char *) 0xDE000, 0xDE000,
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL 0,0,0,0,0,0,0,0
}; };
#define NR_ISA_ADDRS (sizeof(cy_isa_addresses)/sizeof(unsigned char*)) #define NR_ISA_ADDRS (sizeof(cy_isa_addresses)/sizeof(unsigned char*))
...@@ -854,7 +854,7 @@ static void cy_start(struct tty_struct *); ...@@ -854,7 +854,7 @@ static void cy_start(struct tty_struct *);
static void set_line_char(struct cyclades_port *); static void set_line_char(struct cyclades_port *);
static int cyz_issue_cmd(struct cyclades_card *, uclong, ucchar, uclong); static int cyz_issue_cmd(struct cyclades_card *, uclong, ucchar, uclong);
#ifdef CONFIG_ISA #ifdef CONFIG_ISA
static unsigned detect_isa_irq (volatile ucchar *); static unsigned detect_isa_irq(void __iomem *);
#endif /* CONFIG_ISA */ #endif /* CONFIG_ISA */
static int cyclades_get_proc_info(char *, char **, off_t , int , int *, void *); static int cyclades_get_proc_info(char *, char **, off_t , int , int *, void *);
...@@ -992,7 +992,7 @@ do_softint(void *private_) ...@@ -992,7 +992,7 @@ do_softint(void *private_)
This function is only called from inside spinlock-protected code. This function is only called from inside spinlock-protected code.
*/ */
static int 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; volatile int i;
...@@ -1008,7 +1008,7 @@ cyy_issue_cmd(volatile ucchar *base_addr, u_char cmd, int index) ...@@ -1008,7 +1008,7 @@ cyy_issue_cmd(volatile ucchar *base_addr, u_char cmd, int index)
if (i == 100) return (-1); if (i == 100) return (-1);
/* Issue the new command */ /* Issue the new command */
cy_writeb((u_long)base_addr+(CyCCR<<index), cmd); cy_writeb(base_addr+(CyCCR<<index), cmd);
return(0); return(0);
} /* cyy_issue_cmd */ } /* cyy_issue_cmd */
...@@ -1016,7 +1016,7 @@ cyy_issue_cmd(volatile ucchar *base_addr, u_char cmd, int index) ...@@ -1016,7 +1016,7 @@ cyy_issue_cmd(volatile ucchar *base_addr, u_char cmd, int index)
#ifdef CONFIG_ISA #ifdef CONFIG_ISA
/* ISA interrupt detection code */ /* ISA interrupt detection code */
static unsigned static unsigned
detect_isa_irq (volatile ucchar *address) detect_isa_irq(void __iomem *address)
{ {
int irq; int irq;
unsigned long irqs, flags; unsigned long irqs, flags;
...@@ -1027,7 +1027,7 @@ detect_isa_irq (volatile ucchar *address) ...@@ -1027,7 +1027,7 @@ detect_isa_irq (volatile ucchar *address)
irq = probe_irq_off(probe_irq_on()); irq = probe_irq_off(probe_irq_on());
/* Clear interrupts on the board first */ /* 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 */ /* Cy_ClrIntr is 0x1800 */
irqs = probe_irq_on(); irqs = probe_irq_on();
...@@ -1036,11 +1036,11 @@ detect_isa_irq (volatile ucchar *address) ...@@ -1036,11 +1036,11 @@ detect_isa_irq (volatile ucchar *address)
/* Enable the Tx interrupts on the CD1400 */ /* Enable the Tx interrupts on the CD1400 */
local_irq_save(flags); 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); cyy_issue_cmd(address, CyCHAN_CTL|CyENB_XMTR, index);
cy_writeb((u_long)address + (CyCAR<<index), 0); cy_writeb(address + (CyCAR<<index), 0);
cy_writeb((u_long)address + (CySRER<<index), cy_writeb(address + (CySRER<<index),
cy_readb(address + (CySRER<<index)) | CyTxRdy); cy_readb(address + (CySRER<<index)) | CyTxRdy);
local_irq_restore(flags); local_irq_restore(flags);
...@@ -1053,12 +1053,12 @@ detect_isa_irq (volatile ucchar *address) ...@@ -1053,12 +1053,12 @@ detect_isa_irq (volatile ucchar *address)
/* Clean up */ /* Clean up */
save_xir = (u_char) cy_readb(address + (CyTIR<<index)); save_xir = (u_char) cy_readb(address + (CyTIR<<index));
save_car = cy_readb(address + (CyCAR<<index)); save_car = cy_readb(address + (CyCAR<<index));
cy_writeb((u_long)address + (CyCAR<<index), (save_xir & 0x3)); cy_writeb(address + (CyCAR<<index), (save_xir & 0x3));
cy_writeb((u_long)address + (CySRER<<index), cy_writeb(address + (CySRER<<index),
cy_readb(address + (CySRER<<index)) & ~CyTxRdy); cy_readb(address + (CySRER<<index)) & ~CyTxRdy);
cy_writeb((u_long)address + (CyTIR<<index), (save_xir & 0x3f)); cy_writeb(address + (CyTIR<<index), (save_xir & 0x3f));
cy_writeb((u_long)address + (CyCAR<<index), (save_car)); cy_writeb(address + (CyCAR<<index), (save_car));
cy_writeb((u_long)address + (Cy_ClrIntr<<index), 0); cy_writeb(address + (Cy_ClrIntr<<index), 0);
/* Cy_ClrIntr is 0x1800 */ /* Cy_ClrIntr is 0x1800 */
return (irq > 0)? irq : 0; return (irq > 0)? irq : 0;
...@@ -1076,7 +1076,7 @@ cyy_interrupt(int irq, void *dev_id, struct pt_regs *regs) ...@@ -1076,7 +1076,7 @@ cyy_interrupt(int irq, void *dev_id, struct pt_regs *regs)
int status; int status;
struct cyclades_card *cinfo; struct cyclades_card *cinfo;
struct cyclades_port *info; struct cyclades_port *info;
volatile unsigned char *base_addr, *card_base_addr; void __iomem *base_addr, *card_base_addr;
int chip; int chip;
int save_xir, channel, save_car; int save_xir, channel, save_car;
char data; char data;
...@@ -1095,7 +1095,7 @@ cyy_interrupt(int irq, void *dev_id, struct pt_regs *regs) ...@@ -1095,7 +1095,7 @@ cyy_interrupt(int irq, void *dev_id, struct pt_regs *regs)
return IRQ_NONE; /* spurious interrupt */ return IRQ_NONE; /* spurious interrupt */
} }
card_base_addr = (unsigned char *)cinfo->base_addr; card_base_addr = cinfo->base_addr;
index = cinfo->bus_index; index = cinfo->bus_index;
...@@ -1107,8 +1107,7 @@ cyy_interrupt(int irq, void *dev_id, struct pt_regs *regs) ...@@ -1107,8 +1107,7 @@ cyy_interrupt(int irq, void *dev_id, struct pt_regs *regs)
do{ do{
had_work = 0; had_work = 0;
for ( chip = 0 ; chip < cinfo->num_chips ; chip ++) { for ( chip = 0 ; chip < cinfo->num_chips ; chip ++) {
base_addr = (unsigned char *) base_addr = cinfo->base_addr + (cy_chip_offset[chip]<<index);
(cinfo->base_addr + (cy_chip_offset[chip]<<index));
too_many = 0; too_many = 0;
while ( (status = cy_readb(base_addr+(CySVRR<<index))) != 0x00) { while ( (status = cy_readb(base_addr+(CySVRR<<index))) != 0x00) {
had_work++; had_work++;
...@@ -1132,7 +1131,7 @@ cyy_interrupt(int irq, void *dev_id, struct pt_regs *regs) ...@@ -1132,7 +1131,7 @@ cyy_interrupt(int irq, void *dev_id, struct pt_regs *regs)
info = &cy_port[i]; info = &cy_port[i];
info->last_active = jiffies; info->last_active = jiffies;
save_car = cy_readb(base_addr+(CyCAR<<index)); 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 there is nowhere to put the data, discard it */
if(info->tty == 0){ if(info->tty == 0){
...@@ -1261,8 +1260,8 @@ cyy_interrupt(int irq, void *dev_id, struct pt_regs *regs) ...@@ -1261,8 +1260,8 @@ cyy_interrupt(int irq, void *dev_id, struct pt_regs *regs)
schedule_delayed_work(&tty->flip.work, 1); schedule_delayed_work(&tty->flip.work, 1);
} }
/* end of service */ /* end of service */
cy_writeb((u_long)base_addr+(CyRIR<<index), (save_xir & 0x3f)); cy_writeb(base_addr+(CyRIR<<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); spin_unlock(&cinfo->card_lock);
} }
...@@ -1281,18 +1280,18 @@ cyy_interrupt(int irq, void *dev_id, struct pt_regs *regs) ...@@ -1281,18 +1280,18 @@ cyy_interrupt(int irq, void *dev_id, struct pt_regs *regs)
channel = (u_short ) (save_xir & CyIRChannel); channel = (u_short ) (save_xir & CyIRChannel);
i = channel + chip * 4 + cinfo->first_line; i = channel + chip * 4 + cinfo->first_line;
save_car = cy_readb(base_addr+(CyCAR<<index)); 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) */ /* validate the port# (as configured and open) */
if( (i < 0) || (NR_PORTS <= i) ){ 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); cy_readb(base_addr+(CySRER<<index)) & ~CyTxRdy);
goto txend; goto txend;
} }
info = &cy_port[i]; info = &cy_port[i];
info->last_active = jiffies; info->last_active = jiffies;
if(info->tty == 0){ 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); cy_readb(base_addr+(CySRER<<index)) & ~CyTxRdy);
goto txdone; goto txdone;
} }
...@@ -1302,7 +1301,7 @@ cyy_interrupt(int irq, void *dev_id, struct pt_regs *regs) ...@@ -1302,7 +1301,7 @@ cyy_interrupt(int irq, void *dev_id, struct pt_regs *regs)
if(info->x_char) { /* send special char */ if(info->x_char) { /* send special char */
outch = info->x_char; outch = info->x_char;
cy_writeb((u_long)base_addr+(CyTDR<<index), outch); cy_writeb(base_addr+(CyTDR<<index), outch);
char_count--; char_count--;
info->icount.tx++; info->icount.tx++;
info->x_char = 0; info->x_char = 0;
...@@ -1310,14 +1309,14 @@ cyy_interrupt(int irq, void *dev_id, struct pt_regs *regs) ...@@ -1310,14 +1309,14 @@ cyy_interrupt(int irq, void *dev_id, struct pt_regs *regs)
if (info->breakon || info->breakoff) { if (info->breakon || info->breakoff) {
if (info->breakon) { if (info->breakon) {
cy_writeb((u_long)base_addr + (CyTDR<<index), 0); cy_writeb(base_addr + (CyTDR<<index), 0);
cy_writeb((u_long)base_addr + (CyTDR<<index), 0x81); cy_writeb(base_addr + (CyTDR<<index), 0x81);
info->breakon = 0; info->breakon = 0;
char_count -= 2; char_count -= 2;
} }
if (info->breakoff) { if (info->breakoff) {
cy_writeb((u_long)base_addr + (CyTDR<<index), 0); cy_writeb(base_addr + (CyTDR<<index), 0);
cy_writeb((u_long)base_addr + (CyTDR<<index), 0x83); cy_writeb(base_addr + (CyTDR<<index), 0x83);
info->breakoff = 0; info->breakoff = 0;
char_count -= 2; char_count -= 2;
} }
...@@ -1326,11 +1325,11 @@ cyy_interrupt(int irq, void *dev_id, struct pt_regs *regs) ...@@ -1326,11 +1325,11 @@ cyy_interrupt(int irq, void *dev_id, struct pt_regs *regs)
while (char_count-- > 0){ while (char_count-- > 0){
if (!info->xmit_cnt){ if (!info->xmit_cnt){
if (cy_readb(base_addr+(CySRER<<index))&CyTxMpty) { 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)) & cy_readb(base_addr+(CySRER<<index)) &
~CyTxMpty); ~CyTxMpty);
} else { } else {
cy_writeb((u_long)base_addr+(CySRER<<index), cy_writeb(base_addr+(CySRER<<index),
((cy_readb(base_addr+(CySRER<<index)) ((cy_readb(base_addr+(CySRER<<index))
& ~CyTxRdy) & ~CyTxRdy)
| CyTxMpty)); | CyTxMpty));
...@@ -1338,13 +1337,13 @@ cyy_interrupt(int irq, void *dev_id, struct pt_regs *regs) ...@@ -1338,13 +1337,13 @@ cyy_interrupt(int irq, void *dev_id, struct pt_regs *regs)
goto txdone; goto txdone;
} }
if (info->xmit_buf == 0){ 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)) & cy_readb(base_addr+(CySRER<<index)) &
~CyTxRdy); ~CyTxRdy);
goto txdone; goto txdone;
} }
if (info->tty->stopped || info->tty->hw_stopped){ 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)) & cy_readb(base_addr+(CySRER<<index)) &
~CyTxRdy); ~CyTxRdy);
goto txdone; goto txdone;
...@@ -1365,16 +1364,16 @@ cyy_interrupt(int irq, void *dev_id, struct pt_regs *regs) ...@@ -1365,16 +1364,16 @@ cyy_interrupt(int irq, void *dev_id, struct pt_regs *regs)
info->xmit_cnt--; info->xmit_cnt--;
info->xmit_tail = (info->xmit_tail + 1) info->xmit_tail = (info->xmit_tail + 1)
& (SERIAL_XMIT_SIZE - 1); & (SERIAL_XMIT_SIZE - 1);
cy_writeb((u_long)base_addr+(CyTDR<<index), outch); cy_writeb(base_addr+(CyTDR<<index), outch);
info->icount.tx++; info->icount.tx++;
}else{ }else{
if(char_count > 1){ if(char_count > 1){
info->xmit_cnt--; info->xmit_cnt--;
info->xmit_tail = (info->xmit_tail + 1) info->xmit_tail = (info->xmit_tail + 1)
& (SERIAL_XMIT_SIZE - 1); & (SERIAL_XMIT_SIZE - 1);
cy_writeb((u_long)base_addr+(CyTDR<<index), cy_writeb(base_addr+(CyTDR<<index),
outch); outch);
cy_writeb((u_long)base_addr+(CyTDR<<index), 0); cy_writeb(base_addr+(CyTDR<<index), 0);
info->icount.tx++; info->icount.tx++;
char_count--; char_count--;
}else{ }else{
...@@ -1388,9 +1387,9 @@ cyy_interrupt(int irq, void *dev_id, struct pt_regs *regs) ...@@ -1388,9 +1387,9 @@ cyy_interrupt(int irq, void *dev_id, struct pt_regs *regs)
} }
txend: txend:
/* end of service */ /* end of service */
cy_writeb((u_long)base_addr+(CyTIR<<index), cy_writeb(base_addr+(CyTIR<<index),
(save_xir & 0x3f)); (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); spin_unlock(&cinfo->card_lock);
} }
...@@ -1404,7 +1403,7 @@ cyy_interrupt(int irq, void *dev_id, struct pt_regs *regs) ...@@ -1404,7 +1403,7 @@ cyy_interrupt(int irq, void *dev_id, struct pt_regs *regs)
+ cinfo->first_line]; + cinfo->first_line];
info->last_active = jiffies; info->last_active = jiffies;
save_car = cy_readb(base_addr+(CyCAR<<index)); 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_change = cy_readb(base_addr+(CyMISR<<index));
mdm_status = cy_readb(base_addr+(CyMSVR1<<index)); mdm_status = cy_readb(base_addr+(CyMSVR1<<index));
...@@ -1439,7 +1438,7 @@ cyy_interrupt(int irq, void *dev_id, struct pt_regs *regs) ...@@ -1439,7 +1438,7 @@ cyy_interrupt(int irq, void *dev_id, struct pt_regs *regs)
/* cy_start isn't used /* cy_start isn't used
because... !!! */ because... !!! */
info->tty->hw_stopped = 0; 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)) | cy_readb(base_addr+(CySRER<<index)) |
CyTxRdy); CyTxRdy);
cy_sched_event(info, cy_sched_event(info,
...@@ -1450,7 +1449,7 @@ cyy_interrupt(int irq, void *dev_id, struct pt_regs *regs) ...@@ -1450,7 +1449,7 @@ cyy_interrupt(int irq, void *dev_id, struct pt_regs *regs)
/* cy_stop isn't used /* cy_stop isn't used
because ... !!! */ because ... !!! */
info->tty->hw_stopped = 1; 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)) & cy_readb(base_addr+(CySRER<<index)) &
~CyTxRdy); ~CyTxRdy);
} }
...@@ -1462,9 +1461,9 @@ cyy_interrupt(int irq, void *dev_id, struct pt_regs *regs) ...@@ -1462,9 +1461,9 @@ cyy_interrupt(int irq, void *dev_id, struct pt_regs *regs)
} }
} }
/* end of service */ /* end of service */
cy_writeb((u_long)base_addr+(CyMIR<<index), cy_writeb(base_addr+(CyMIR<<index),
(save_xir & 0x3f)); (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); spin_unlock(&cinfo->card_lock);
} }
} /* end while status != 0 */ } /* end while status != 0 */
...@@ -1473,7 +1472,7 @@ cyy_interrupt(int irq, void *dev_id, struct pt_regs *regs) ...@@ -1473,7 +1472,7 @@ cyy_interrupt(int irq, void *dev_id, struct pt_regs *regs)
/* clear interrupts */ /* clear interrupts */
spin_lock(&cinfo->card_lock); 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 */ /* Cy_ClrIntr is 0x1800 */
spin_unlock(&cinfo->card_lock); spin_unlock(&cinfo->card_lock);
return IRQ_HANDLED; return IRQ_HANDLED;
...@@ -1488,27 +1487,25 @@ static int ...@@ -1488,27 +1487,25 @@ static int
cyz_fetch_msg( struct cyclades_card *cinfo, cyz_fetch_msg( struct cyclades_card *cinfo,
uclong *channel, ucchar *cmd, uclong *param) uclong *channel, ucchar *cmd, uclong *param)
{ {
struct FIRM_ID *firm_id; struct FIRM_ID __iomem *firm_id;
struct ZFW_CTRL *zfw_ctrl; struct ZFW_CTRL __iomem *zfw_ctrl;
struct BOARD_CTRL *board_ctrl; struct BOARD_CTRL __iomem *board_ctrl;
unsigned long loc_doorbell; unsigned long loc_doorbell;
firm_id = (struct FIRM_ID *)(cinfo->base_addr + ID_ADDRESS); firm_id = cinfo->base_addr + ID_ADDRESS;
if (!ISZLOADED(*cinfo)){ if (!ISZLOADED(*cinfo)){
return (-1); return (-1);
} }
zfw_ctrl = (struct ZFW_CTRL *) zfw_ctrl = cinfo->base_addr + (cy_readl(&firm_id->zfwctrl_addr) & 0xfffff);
(cinfo->base_addr +
(cy_readl(&firm_id->zfwctrl_addr) & 0xfffff));
board_ctrl = &zfw_ctrl->board_ctrl; 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); (cinfo->ctl_addr))->loc_doorbell);
if (loc_doorbell){ if (loc_doorbell){
*cmd = (char)(0xff & loc_doorbell); *cmd = (char)(0xff & loc_doorbell);
*channel = cy_readl(&board_ctrl->fwcmd_channel); *channel = cy_readl(&board_ctrl->fwcmd_channel);
*param = (uclong)cy_readl(&board_ctrl->fwcmd_param); *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); 0xffffffff);
return 1; return 1;
} }
...@@ -1519,40 +1516,38 @@ static int ...@@ -1519,40 +1516,38 @@ static int
cyz_issue_cmd( struct cyclades_card *cinfo, cyz_issue_cmd( struct cyclades_card *cinfo,
uclong channel, ucchar cmd, uclong param) uclong channel, ucchar cmd, uclong param)
{ {
struct FIRM_ID *firm_id; struct FIRM_ID __iomem *firm_id;
struct ZFW_CTRL *zfw_ctrl; struct ZFW_CTRL __iomem *zfw_ctrl;
struct BOARD_CTRL *board_ctrl; struct BOARD_CTRL __iomem *board_ctrl;
volatile uclong *pci_doorbell; unsigned long __iomem *pci_doorbell;
int index; int index;
firm_id = (struct FIRM_ID *)(cinfo->base_addr + ID_ADDRESS); firm_id = cinfo->base_addr + ID_ADDRESS;
if (!ISZLOADED(*cinfo)){ if (!ISZLOADED(*cinfo)){
return (-1); return (-1);
} }
zfw_ctrl = (struct ZFW_CTRL *) zfw_ctrl = cinfo->base_addr + (cy_readl(&firm_id->zfwctrl_addr) & 0xfffff);
(cinfo->base_addr +
(cy_readl(&firm_id->zfwctrl_addr) & 0xfffff));
board_ctrl = &zfw_ctrl->board_ctrl; board_ctrl = &zfw_ctrl->board_ctrl;
index = 0; index = 0;
pci_doorbell = (uclong *)(&((struct RUNTIME_9060 *) pci_doorbell = &((struct RUNTIME_9060 __iomem *) (cinfo->ctl_addr))->pci_doorbell;
(cinfo->ctl_addr))->pci_doorbell);
while( (cy_readl(pci_doorbell) & 0xff) != 0){ while( (cy_readl(pci_doorbell) & 0xff) != 0){
if (index++ == 1000){ if (index++ == 1000){
return((int)(cy_readl(pci_doorbell) & 0xff)); return((int)(cy_readl(pci_doorbell) & 0xff));
} }
udelay(50L); udelay(50L);
} }
cy_writel((u_long)&board_ctrl->hcmd_channel, channel); cy_writel(&board_ctrl->hcmd_channel, channel);
cy_writel((u_long)&board_ctrl->hcmd_param , param); cy_writel(&board_ctrl->hcmd_param , param);
cy_writel((u_long)pci_doorbell, (long)cmd); cy_writel(pci_doorbell, (long)cmd);
return(0); return(0);
} /* cyz_issue_cmd */ } /* cyz_issue_cmd */
static void static void
cyz_handle_rx(struct cyclades_port *info, volatile struct CH_CTRL *ch_ctrl, cyz_handle_rx(struct cyclades_port *info,
volatile struct BUF_CTRL *buf_ctrl) volatile struct CH_CTRL __iomem *ch_ctrl,
volatile struct BUF_CTRL __iomem *buf_ctrl)
{ {
struct cyclades_card *cinfo = &cy_card[info->card]; struct cyclades_card *cinfo = &cy_card[info->card];
struct tty_struct *tty = info->tty; struct tty_struct *tty = info->tty;
...@@ -1649,8 +1644,9 @@ cyz_handle_rx(struct cyclades_port *info, volatile struct CH_CTRL *ch_ctrl, ...@@ -1649,8 +1644,9 @@ cyz_handle_rx(struct cyclades_port *info, volatile struct CH_CTRL *ch_ctrl,
} }
static void static void
cyz_handle_tx(struct cyclades_port *info, volatile struct CH_CTRL *ch_ctrl, cyz_handle_tx(struct cyclades_port *info,
volatile struct BUF_CTRL *buf_ctrl) volatile struct CH_CTRL __iomem *ch_ctrl,
volatile struct BUF_CTRL __iomem *buf_ctrl)
{ {
struct cyclades_card *cinfo = &cy_card[info->card]; struct cyclades_card *cinfo = &cy_card[info->card];
struct tty_struct *tty = info->tty; struct tty_struct *tty = info->tty;
...@@ -1737,11 +1733,11 @@ cyz_handle_cmd(struct cyclades_card *cinfo) ...@@ -1737,11 +1733,11 @@ cyz_handle_cmd(struct cyclades_card *cinfo)
{ {
struct tty_struct *tty; struct tty_struct *tty;
struct cyclades_port *info; struct cyclades_port *info;
static volatile struct FIRM_ID *firm_id; static volatile struct FIRM_ID __iomem *firm_id;
static volatile struct ZFW_CTRL *zfw_ctrl; static volatile struct ZFW_CTRL __iomem *zfw_ctrl;
static volatile struct BOARD_CTRL *board_ctrl; static volatile struct BOARD_CTRL __iomem *board_ctrl;
static volatile struct CH_CTRL *ch_ctrl; static volatile struct CH_CTRL __iomem *ch_ctrl;
static volatile struct BUF_CTRL *buf_ctrl; static volatile struct BUF_CTRL __iomem *buf_ctrl;
uclong channel; uclong channel;
ucchar cmd; ucchar cmd;
uclong param; uclong param;
...@@ -1749,13 +1745,11 @@ cyz_handle_cmd(struct cyclades_card *cinfo) ...@@ -1749,13 +1745,11 @@ cyz_handle_cmd(struct cyclades_card *cinfo)
int special_count; int special_count;
int delta_count; int delta_count;
firm_id = (struct FIRM_ID *)(cinfo->base_addr + ID_ADDRESS); firm_id = cinfo->base_addr + ID_ADDRESS;
zfw_ctrl = (struct ZFW_CTRL *) zfw_ctrl = cinfo->base_addr + (cy_readl(&firm_id->zfwctrl_addr) & 0xfffff);
(cinfo->base_addr + board_ctrl = &zfw_ctrl->board_ctrl;
(cy_readl(&firm_id->zfwctrl_addr) & 0xfffff));
board_ctrl = &(zfw_ctrl->board_ctrl);
fw_ver = cy_readl(&board_ctrl->fw_version); 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) { while(cyz_fetch_msg(cinfo, &channel, &cmd, &param) == 1) {
...@@ -1922,10 +1916,8 @@ cyz_poll(unsigned long arg) ...@@ -1922,10 +1916,8 @@ cyz_poll(unsigned long arg)
if (!IS_CYC_Z(*cinfo)) continue; if (!IS_CYC_Z(*cinfo)) continue;
if (!ISZLOADED(*cinfo)) continue; if (!ISZLOADED(*cinfo)) continue;
firm_id = (struct FIRM_ID *)(cinfo->base_addr + ID_ADDRESS); firm_id = cinfo->base_addr + ID_ADDRESS;
zfw_ctrl = (struct ZFW_CTRL *) zfw_ctrl = cinfo->base_addr + (cy_readl(&firm_id->zfwctrl_addr) & 0xfffff);
(cinfo->base_addr +
(cy_readl(&firm_id->zfwctrl_addr) & 0xfffff));
board_ctrl = &(zfw_ctrl->board_ctrl); board_ctrl = &(zfw_ctrl->board_ctrl);
/* Skip first polling cycle to avoid racing conditions with the FW */ /* Skip first polling cycle to avoid racing conditions with the FW */
...@@ -1969,7 +1961,7 @@ startup(struct cyclades_port * info) ...@@ -1969,7 +1961,7 @@ startup(struct cyclades_port * info)
{ {
unsigned long flags; unsigned long flags;
int retval = 0; int retval = 0;
unsigned char *base_addr; void __iomem *base_addr;
int card,chip,channel,index; int card,chip,channel,index;
unsigned long page; unsigned long page;
...@@ -2008,8 +2000,7 @@ startup(struct cyclades_port * info) ...@@ -2008,8 +2000,7 @@ startup(struct cyclades_port * info)
chip = channel>>2; chip = channel>>2;
channel &= 0x03; channel &= 0x03;
index = cy_card[card].bus_index; index = cy_card[card].bus_index;
base_addr = (unsigned char*) base_addr = cy_card[card].base_addr + (cy_chip_offset[chip]<<index);
(cy_card[card].base_addr + (cy_chip_offset[chip]<<index));
#ifdef CY_DEBUG_OPEN #ifdef CY_DEBUG_OPEN
printk("cyc startup card %d, chip %d, channel %d, base_addr %lx\n", printk("cyc startup card %d, chip %d, channel %d, base_addr %lx\n",
...@@ -2018,16 +2009,16 @@ startup(struct cyclades_port * info) ...@@ -2018,16 +2009,16 @@ startup(struct cyclades_port * info)
CY_LOCK(info, flags); 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 */ ? info->default_timeout : 0x02)); /* 10ms rx timeout */
cyy_issue_cmd(base_addr,CyCHAN_CTL|CyENB_RCVR|CyENB_XMTR,index); cyy_issue_cmd(base_addr,CyCHAN_CTL|CyENB_RCVR|CyENB_XMTR,index);
cy_writeb((ulong)base_addr+(CyCAR<<index), (u_char)channel); cy_writeb(base_addr+(CyCAR<<index), (u_char)channel);
cy_writeb((ulong)base_addr+(CyMSVR1<<index), CyRTS); cy_writeb(base_addr+(CyMSVR1<<index), CyRTS);
cy_writeb((ulong)base_addr+(CyMSVR2<<index), CyDTR); cy_writeb(base_addr+(CyMSVR2<<index), CyDTR);
#ifdef CY_DEBUG_DTR #ifdef CY_DEBUG_DTR
printk("cyc:startup raising DTR\n"); printk("cyc:startup raising DTR\n");
...@@ -2036,7 +2027,7 @@ startup(struct cyclades_port * info) ...@@ -2036,7 +2027,7 @@ startup(struct cyclades_port * info)
cy_readb(base_addr+(CyMSVR2<<index))); cy_readb(base_addr+(CyMSVR2<<index)));
#endif #endif
cy_writeb((u_long)base_addr+(CySRER<<index), cy_writeb(base_addr+(CySRER<<index),
cy_readb(base_addr+(CySRER<<index)) | CyRxData); cy_readb(base_addr+(CySRER<<index)) | CyRxData);
info->flags |= ASYNC_INITIALIZED; info->flags |= ASYNC_INITIALIZED;
...@@ -2053,22 +2044,20 @@ startup(struct cyclades_port * info) ...@@ -2053,22 +2044,20 @@ startup(struct cyclades_port * info)
CY_UNLOCK(info, flags); CY_UNLOCK(info, flags);
} else { } else {
struct FIRM_ID *firm_id; struct FIRM_ID __iomem *firm_id;
struct ZFW_CTRL *zfw_ctrl; struct ZFW_CTRL __iomem *zfw_ctrl;
struct BOARD_CTRL *board_ctrl; struct BOARD_CTRL __iomem *board_ctrl;
struct CH_CTRL *ch_ctrl; struct CH_CTRL __iomem *ch_ctrl;
int retval; 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])){ if (!ISZLOADED(cy_card[card])){
return -ENODEV; return -ENODEV;
} }
zfw_ctrl = (struct ZFW_CTRL *) zfw_ctrl = cy_card[card].base_addr + (cy_readl(&firm_id->zfwctrl_addr) & 0xfffff);
(cy_card[card].base_addr +
(cy_readl(&firm_id->zfwctrl_addr) & 0xfffff));
board_ctrl = &zfw_ctrl->board_ctrl; board_ctrl = &zfw_ctrl->board_ctrl;
ch_ctrl = zfw_ctrl->ch_ctrl; ch_ctrl = zfw_ctrl->ch_ctrl;
...@@ -2160,7 +2149,7 @@ static void ...@@ -2160,7 +2149,7 @@ static void
start_xmit( struct cyclades_port *info ) start_xmit( struct cyclades_port *info )
{ {
unsigned long flags; unsigned long flags;
unsigned char *base_addr; void __iomem *base_addr;
int card,chip,channel,index; int card,chip,channel,index;
card = info->card; card = info->card;
...@@ -2169,13 +2158,11 @@ start_xmit( struct cyclades_port *info ) ...@@ -2169,13 +2158,11 @@ start_xmit( struct cyclades_port *info )
chip = channel>>2; chip = channel>>2;
channel &= 0x03; channel &= 0x03;
index = cy_card[card].bus_index; index = cy_card[card].bus_index;
base_addr = (unsigned char*) base_addr = cy_card[card].base_addr + (cy_chip_offset[chip]<<index);
(cy_card[card].base_addr
+ (cy_chip_offset[chip]<<index));
CY_LOCK(info, flags); CY_LOCK(info, flags);
cy_writeb((u_long)base_addr+(CyCAR<<index), channel); cy_writeb(base_addr+(CyCAR<<index), channel);
cy_writeb((u_long)base_addr+(CySRER<<index), cy_writeb(base_addr+(CySRER<<index),
cy_readb(base_addr+(CySRER<<index)) | CyTxRdy); cy_readb(base_addr+(CySRER<<index)) | CyTxRdy);
CY_UNLOCK(info, flags); CY_UNLOCK(info, flags);
} else { } else {
...@@ -2203,7 +2190,7 @@ static void ...@@ -2203,7 +2190,7 @@ static void
shutdown(struct cyclades_port * info) shutdown(struct cyclades_port * info)
{ {
unsigned long flags; unsigned long flags;
unsigned char *base_addr; void __iomem *base_addr;
int card,chip,channel,index; int card,chip,channel,index;
if (!(info->flags & ASYNC_INITIALIZED)){ if (!(info->flags & ASYNC_INITIALIZED)){
...@@ -2216,9 +2203,7 @@ shutdown(struct cyclades_port * info) ...@@ -2216,9 +2203,7 @@ shutdown(struct cyclades_port * info)
chip = channel>>2; chip = channel>>2;
channel &= 0x03; channel &= 0x03;
index = cy_card[card].bus_index; index = cy_card[card].bus_index;
base_addr = (unsigned char*) base_addr = cy_card[card].base_addr + (cy_chip_offset[chip]<<index);
(cy_card[card].base_addr
+ (cy_chip_offset[chip]<<index));
#ifdef CY_DEBUG_OPEN #ifdef CY_DEBUG_OPEN
printk("cyc shutdown Y card %d, chip %d, channel %d, base_addr %lx\n", printk("cyc shutdown Y card %d, chip %d, channel %d, base_addr %lx\n",
...@@ -2236,10 +2221,10 @@ shutdown(struct cyclades_port * info) ...@@ -2236,10 +2221,10 @@ shutdown(struct cyclades_port * info)
info->xmit_buf = NULL; info->xmit_buf = NULL;
free_page((unsigned long) temp); 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)) { if (!info->tty || (info->tty->termios->c_cflag & HUPCL)) {
cy_writeb((u_long)base_addr+(CyMSVR1<<index), ~CyRTS); cy_writeb(base_addr+(CyMSVR1<<index), ~CyRTS);
cy_writeb((u_long)base_addr+(CyMSVR2<<index), ~CyDTR); cy_writeb(base_addr+(CyMSVR2<<index), ~CyDTR);
#ifdef CY_DEBUG_DTR #ifdef CY_DEBUG_DTR
printk("cyc shutdown dropping DTR\n"); printk("cyc shutdown dropping DTR\n");
printk(" status: 0x%x, 0x%x\n", printk(" status: 0x%x, 0x%x\n",
...@@ -2257,27 +2242,25 @@ shutdown(struct cyclades_port * info) ...@@ -2257,27 +2242,25 @@ shutdown(struct cyclades_port * info)
info->flags &= ~ASYNC_INITIALIZED; info->flags &= ~ASYNC_INITIALIZED;
CY_UNLOCK(info, flags); CY_UNLOCK(info, flags);
} else { } else {
struct FIRM_ID *firm_id; struct FIRM_ID __iomem *firm_id;
struct ZFW_CTRL *zfw_ctrl; struct ZFW_CTRL __iomem *zfw_ctrl;
struct BOARD_CTRL *board_ctrl; struct BOARD_CTRL __iomem *board_ctrl;
struct CH_CTRL *ch_ctrl; struct CH_CTRL __iomem *ch_ctrl;
int retval; int retval;
base_addr = (unsigned char*) (cy_card[card].base_addr); base_addr = cy_card[card].base_addr;
#ifdef CY_DEBUG_OPEN #ifdef CY_DEBUG_OPEN
printk("cyc shutdown Z card %d, channel %d, base_addr %lx\n", printk("cyc shutdown Z card %d, channel %d, base_addr %lx\n",
card, channel, (long)base_addr); card, channel, (long)base_addr);
#endif #endif
firm_id = (struct FIRM_ID *) (base_addr + ID_ADDRESS); firm_id = base_addr + ID_ADDRESS;
if (!ISZLOADED(cy_card[card])) { if (!ISZLOADED(cy_card[card])) {
return; return;
} }
zfw_ctrl = (struct ZFW_CTRL *) zfw_ctrl = cy_card[card].base_addr + (cy_readl(&firm_id->zfwctrl_addr) & 0xfffff);
(cy_card[card].base_addr + board_ctrl = &zfw_ctrl->board_ctrl;
(cy_readl(&firm_id->zfwctrl_addr) & 0xfffff));
board_ctrl = &(zfw_ctrl->board_ctrl);
ch_ctrl = zfw_ctrl->ch_ctrl; ch_ctrl = zfw_ctrl->ch_ctrl;
CY_LOCK(info, flags); CY_LOCK(info, flags);
...@@ -2290,7 +2273,7 @@ shutdown(struct cyclades_port * info) ...@@ -2290,7 +2273,7 @@ shutdown(struct cyclades_port * info)
} }
if (!info->tty || (info->tty->termios->c_cflag & HUPCL)) { 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) & (uclong)(cy_readl(&ch_ctrl[channel].rs_control) &
~(C_RS_RTS | C_RS_DTR))); ~(C_RS_RTS | C_RS_DTR)));
retval = cyz_issue_cmd(&cy_card[info->card], retval = cyz_issue_cmd(&cy_card[info->card],
...@@ -2334,7 +2317,7 @@ block_til_ready(struct tty_struct *tty, struct file * filp, ...@@ -2334,7 +2317,7 @@ block_til_ready(struct tty_struct *tty, struct file * filp,
unsigned long flags; unsigned long flags;
int chip, channel,index; int chip, channel,index;
int retval; int retval;
char *base_addr; void __iomem *base_addr;
cinfo = &cy_card[info->card]; cinfo = &cy_card[info->card];
channel = info->line - cinfo->first_line; channel = info->line - cinfo->first_line;
...@@ -2387,15 +2370,14 @@ block_til_ready(struct tty_struct *tty, struct file * filp, ...@@ -2387,15 +2370,14 @@ block_til_ready(struct tty_struct *tty, struct file * filp,
chip = channel>>2; chip = channel>>2;
channel &= 0x03; channel &= 0x03;
index = cinfo->bus_index; index = cinfo->bus_index;
base_addr = (char *)(cinfo->base_addr base_addr = cinfo->base_addr + (cy_chip_offset[chip]<<index);
+ (cy_chip_offset[chip]<<index));
while (1) { while (1) {
CY_LOCK(info, flags); CY_LOCK(info, flags);
if ((tty->termios->c_cflag & CBAUD)){ if ((tty->termios->c_cflag & CBAUD)){
cy_writeb((u_long)base_addr+(CyCAR<<index), (u_char)channel); cy_writeb(base_addr+(CyCAR<<index), (u_char)channel);
cy_writeb((u_long)base_addr+(CyMSVR1<<index), CyRTS); cy_writeb(base_addr+(CyMSVR1<<index), CyRTS);
cy_writeb((u_long)base_addr+(CyMSVR2<<index), CyDTR); cy_writeb(base_addr+(CyMSVR2<<index), CyDTR);
#ifdef CY_DEBUG_DTR #ifdef CY_DEBUG_DTR
printk("cyc:block_til_ready raising DTR\n"); printk("cyc:block_til_ready raising DTR\n");
printk(" status: 0x%x, 0x%x\n", printk(" status: 0x%x, 0x%x\n",
...@@ -2414,7 +2396,7 @@ block_til_ready(struct tty_struct *tty, struct file * filp, ...@@ -2414,7 +2396,7 @@ block_til_ready(struct tty_struct *tty, struct file * filp,
} }
CY_LOCK(info, flags); 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) if (!(info->flags & ASYNC_CLOSING)
&& (C_CLOCAL(tty) && (C_CLOCAL(tty)
|| (cy_readb(base_addr+(CyMSVR1<<index)) & CyDCD))) { || (cy_readb(base_addr+(CyMSVR1<<index)) & CyDCD))) {
...@@ -2434,23 +2416,21 @@ block_til_ready(struct tty_struct *tty, struct file * filp, ...@@ -2434,23 +2416,21 @@ block_til_ready(struct tty_struct *tty, struct file * filp,
schedule(); schedule();
} }
} else { } else {
struct FIRM_ID *firm_id; struct FIRM_ID __iomem *firm_id;
struct ZFW_CTRL *zfw_ctrl; struct ZFW_CTRL __iomem *zfw_ctrl;
struct BOARD_CTRL *board_ctrl; struct BOARD_CTRL __iomem *board_ctrl;
struct CH_CTRL *ch_ctrl; struct CH_CTRL __iomem *ch_ctrl;
int retval; int retval;
base_addr = (char *)(cinfo->base_addr); base_addr = cinfo->base_addr;
firm_id = (struct FIRM_ID *) firm_id = base_addr + ID_ADDRESS;
(base_addr + ID_ADDRESS);
if (!ISZLOADED(*cinfo)){ if (!ISZLOADED(*cinfo)){
current->state = TASK_RUNNING; current->state = TASK_RUNNING;
remove_wait_queue(&info->open_wait, &wait); remove_wait_queue(&info->open_wait, &wait);
return -EINVAL; return -EINVAL;
} }
zfw_ctrl = (struct ZFW_CTRL *) zfw_ctrl = base_addr + (cy_readl(&firm_id->zfwctrl_addr) & 0xfffff);
(base_addr + (cy_readl(&firm_id->zfwctrl_addr) & 0xfffff));
board_ctrl = &zfw_ctrl->board_ctrl; board_ctrl = &zfw_ctrl->board_ctrl;
ch_ctrl = zfw_ctrl->ch_ctrl; ch_ctrl = zfw_ctrl->ch_ctrl;
...@@ -2540,11 +2520,10 @@ cy_open(struct tty_struct *tty, struct file * filp) ...@@ -2540,11 +2520,10 @@ cy_open(struct tty_struct *tty, struct file * filp)
*/ */
if (IS_CYC_Z(cy_card[info->card])) { if (IS_CYC_Z(cy_card[info->card])) {
struct cyclades_card *cinfo = &cy_card[info->card]; struct cyclades_card *cinfo = &cy_card[info->card];
struct FIRM_ID *firm_id = (struct FIRM_ID *) struct FIRM_ID __iomem *firm_id = cinfo->base_addr + ID_ADDRESS;
(cinfo->base_addr + ID_ADDRESS);
if (!ISZLOADED(*cinfo)) { 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)) && (cinfo->ctl_addr))->mail_box_0)) &&
Z_FPGA_CHECK (*cinfo)) && Z_FPGA_CHECK (*cinfo)) &&
(ZFIRM_HLT == cy_readl (&firm_id->signature))) (ZFIRM_HLT == cy_readl (&firm_id->signature)))
...@@ -2561,12 +2540,10 @@ cy_open(struct tty_struct *tty, struct file * filp) ...@@ -2561,12 +2540,10 @@ cy_open(struct tty_struct *tty, struct file * filp)
interrupts should be enabled as soon as the first open happens interrupts should be enabled as soon as the first open happens
to one of its ports. */ to one of its ports. */
if (!cinfo->intr_enabled) { if (!cinfo->intr_enabled) {
struct ZFW_CTRL *zfw_ctrl; struct ZFW_CTRL __iomem *zfw_ctrl;
struct BOARD_CTRL *board_ctrl; struct BOARD_CTRL __iomem *board_ctrl;
zfw_ctrl = (struct ZFW_CTRL *) zfw_ctrl = cinfo->base_addr + (cy_readl (&firm_id->zfwctrl_addr) & 0xfffff);
(cinfo->base_addr +
(cy_readl (&firm_id->zfwctrl_addr) & 0xfffff));
board_ctrl = &zfw_ctrl->board_ctrl; board_ctrl = &zfw_ctrl->board_ctrl;
...@@ -2658,7 +2635,7 @@ static void ...@@ -2658,7 +2635,7 @@ static void
cy_wait_until_sent(struct tty_struct *tty, int timeout) cy_wait_until_sent(struct tty_struct *tty, int timeout)
{ {
struct cyclades_port * info = (struct cyclades_port *)tty->driver_data; struct cyclades_port * info = (struct cyclades_port *)tty->driver_data;
unsigned char *base_addr; void __iomem *base_addr;
int card,chip,channel,index; int card,chip,channel,index;
unsigned long orig_jiffies; unsigned long orig_jiffies;
int char_time; int char_time;
...@@ -2708,8 +2685,7 @@ cy_wait_until_sent(struct tty_struct *tty, int timeout) ...@@ -2708,8 +2685,7 @@ cy_wait_until_sent(struct tty_struct *tty, int timeout)
chip = channel>>2; chip = channel>>2;
channel &= 0x03; channel &= 0x03;
index = cy_card[card].bus_index; index = cy_card[card].bus_index;
base_addr = (unsigned char *) base_addr = cy_card[card].base_addr + (cy_chip_offset[chip]<<index);
(cy_card[card].base_addr + (cy_chip_offset[chip]<<index));
while (cy_readb(base_addr+(CySRER<<index)) & CyTxRdy) { while (cy_readb(base_addr+(CySRER<<index)) & CyTxRdy) {
#ifdef CY_DEBUG_WAIT_UNTIL_SENT #ifdef CY_DEBUG_WAIT_UNTIL_SENT
printk("Not clean (jiff=%lu)...", jiffies); printk("Not clean (jiff=%lu)...", jiffies);
...@@ -2802,13 +2778,11 @@ cy_close(struct tty_struct *tty, struct file *filp) ...@@ -2802,13 +2778,11 @@ cy_close(struct tty_struct *tty, struct file *filp)
if (!IS_CYC_Z(cy_card[info->card])) { if (!IS_CYC_Z(cy_card[info->card])) {
int channel = info->line - cy_card[info->card].first_line; int channel = info->line - cy_card[info->card].first_line;
int index = cy_card[info->card].bus_index; int index = cy_card[info->card].bus_index;
unsigned char *base_addr = (unsigned char *) void __iomem *base_addr = cy_card[info->card].base_addr + (cy_chip_offset[channel>>2] << index);
(cy_card[info->card].base_addr +
(cy_chip_offset[channel>>2] <<index));
/* Stop accepting input */ /* Stop accepting input */
channel &= 0x03; channel &= 0x03;
cy_writeb((ulong)base_addr+(CyCAR<<index), (u_char)channel); cy_writeb(base_addr+(CyCAR<<index), (u_char)channel);
cy_writeb((u_long)base_addr+(CySRER<<index), cy_writeb(base_addr+(CySRER<<index),
cy_readb(base_addr+(CySRER<<index)) & ~CyRxData); cy_readb(base_addr+(CySRER<<index)) & ~CyRxData);
if (info->flags & ASYNC_INITIALIZED) { if (info->flags & ASYNC_INITIALIZED) {
/* Waiting for on-board buffers to be empty before closing /* Waiting for on-board buffers to be empty before closing
...@@ -2820,12 +2794,10 @@ cy_close(struct tty_struct *tty, struct file *filp) ...@@ -2820,12 +2794,10 @@ cy_close(struct tty_struct *tty, struct file *filp)
} else { } else {
#ifdef Z_WAKE #ifdef Z_WAKE
/* Waiting for on-board buffers to be empty before closing the port */ /* Waiting for on-board buffers to be empty before closing the port */
unsigned char *base_addr = (unsigned char *) void __iomem *base_addr = cy_card[info->card].base_addr;
cy_card[info->card].base_addr; struct FIRM_ID __iomem *firm_id = base_addr + ID_ADDRESS;
struct FIRM_ID *firm_id = (struct FIRM_ID *) (base_addr + ID_ADDRESS); struct ZFW_CTRL __iomem *zfw_ctrl = base_addr + (cy_readl(&firm_id->zfwctrl_addr) & 0xfffff);
struct ZFW_CTRL *zfw_ctrl = (struct ZFW_CTRL *) struct CH_CTRL __iomem *ch_ctrl = zfw_ctrl->ch_ctrl;
(base_addr + (cy_readl(&firm_id->zfwctrl_addr) & 0xfffff));
struct CH_CTRL *ch_ctrl = zfw_ctrl->ch_ctrl;
int channel = info->line - cy_card[info->card].first_line; int channel = info->line - cy_card[info->card].first_line;
int retval; int retval;
...@@ -3084,10 +3056,8 @@ cy_chars_in_buffer(struct tty_struct *tty) ...@@ -3084,10 +3056,8 @@ cy_chars_in_buffer(struct tty_struct *tty)
int char_count; int char_count;
volatile uclong tx_put, tx_get, tx_bufsize; volatile uclong tx_put, tx_get, tx_bufsize;
firm_id = (struct FIRM_ID *)(cy_card[card].base_addr + ID_ADDRESS); firm_id = cy_card[card].base_addr + ID_ADDRESS;
zfw_ctrl = (struct ZFW_CTRL *) zfw_ctrl = cy_card[card].base_addr + (cy_readl(&firm_id->zfwctrl_addr) & 0xfffff);
(cy_card[card].base_addr +
(cy_readl(&firm_id->zfwctrl_addr) & 0xfffff));
ch_ctrl = &(zfw_ctrl->ch_ctrl[channel]); ch_ctrl = &(zfw_ctrl->ch_ctrl[channel]);
buf_ctrl = &(zfw_ctrl->buf_ctrl[channel]); buf_ctrl = &(zfw_ctrl->buf_ctrl[channel]);
...@@ -3147,7 +3117,7 @@ static void ...@@ -3147,7 +3117,7 @@ static void
set_line_char(struct cyclades_port * info) set_line_char(struct cyclades_port * info)
{ {
unsigned long flags; unsigned long flags;
unsigned char *base_addr; void __iomem *base_addr;
int card,chip,channel,index; int card,chip,channel,index;
unsigned cflag, iflag; unsigned cflag, iflag;
unsigned short chip_number; unsigned short chip_number;
...@@ -3299,76 +3269,74 @@ set_line_char(struct cyclades_port * info) ...@@ -3299,76 +3269,74 @@ set_line_char(struct cyclades_port * info)
chip = channel>>2; chip = channel>>2;
channel &= 0x03; channel &= 0x03;
base_addr = (unsigned char*) base_addr = cy_card[card].base_addr + (cy_chip_offset[chip]<<index);
(cy_card[card].base_addr
+ (cy_chip_offset[chip]<<index));
CY_LOCK(info, flags); 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 */ /* tx and rx baud rate */
cy_writeb((u_long)base_addr+(CyTCOR<<index), info->tco); cy_writeb(base_addr+(CyTCOR<<index), info->tco);
cy_writeb((u_long)base_addr+(CyTBPR<<index), info->tbpr); cy_writeb(base_addr+(CyTBPR<<index), info->tbpr);
cy_writeb((u_long)base_addr+(CyRCOR<<index), info->rco); cy_writeb(base_addr+(CyRCOR<<index), info->rco);
cy_writeb((u_long)base_addr+(CyRBPR<<index), info->rbpr); cy_writeb(base_addr+(CyRBPR<<index), info->rbpr);
/* set line characteristics according configuration */ /* set line characteristics according configuration */
cy_writeb((u_long)base_addr+(CySCHR1<<index), cy_writeb(base_addr+(CySCHR1<<index),
START_CHAR(info->tty)); START_CHAR(info->tty));
cy_writeb((u_long)base_addr+(CySCHR2<<index), cy_writeb(base_addr+(CySCHR2<<index),
STOP_CHAR(info->tty)); STOP_CHAR(info->tty));
cy_writeb((u_long)base_addr+(CyCOR1<<index), info->cor1); cy_writeb(base_addr+(CyCOR1<<index), info->cor1);
cy_writeb((u_long)base_addr+(CyCOR2<<index), info->cor2); cy_writeb(base_addr+(CyCOR2<<index), info->cor2);
cy_writeb((u_long)base_addr+(CyCOR3<<index), info->cor3); cy_writeb(base_addr+(CyCOR3<<index), info->cor3);
cy_writeb((u_long)base_addr+(CyCOR4<<index), info->cor4); cy_writeb(base_addr+(CyCOR4<<index), info->cor4);
cy_writeb((u_long)base_addr+(CyCOR5<<index), info->cor5); cy_writeb(base_addr+(CyCOR5<<index), info->cor5);
cyy_issue_cmd(base_addr, cyy_issue_cmd(base_addr,
CyCOR_CHANGE|CyCOR1ch|CyCOR2ch|CyCOR3ch,index); 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? */ (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 ? info->default_timeout
: 0x02)); /* 10ms rx timeout */ : 0x02)); /* 10ms rx timeout */
if (C_CLOCAL(info->tty)) { if (C_CLOCAL(info->tty)) {
/* without modem intr */ /* without modem intr */
cy_writeb((u_long)base_addr+(CySRER<<index), cy_writeb(base_addr+(CySRER<<index),
cy_readb(base_addr+(CySRER<<index)) | CyMdmCh); cy_readb(base_addr+(CySRER<<index)) | CyMdmCh);
/* act on 1->0 modem transitions */ /* act on 1->0 modem transitions */
if ((cflag & CRTSCTS) && info->rflow) { if ((cflag & CRTSCTS) && info->rflow) {
cy_writeb((u_long)base_addr+(CyMCOR1<<index), cy_writeb(base_addr+(CyMCOR1<<index),
(CyCTS|rflow_thr[i])); (CyCTS|rflow_thr[i]));
} else { } else {
cy_writeb((u_long)base_addr+(CyMCOR1<<index), CyCTS); cy_writeb(base_addr+(CyMCOR1<<index), CyCTS);
} }
/* act on 0->1 modem transitions */ /* act on 0->1 modem transitions */
cy_writeb((u_long)base_addr+(CyMCOR2<<index), CyCTS); cy_writeb(base_addr+(CyMCOR2<<index), CyCTS);
} else { } else {
/* without modem intr */ /* without modem intr */
cy_writeb((u_long)base_addr+(CySRER<<index), cy_writeb(base_addr+(CySRER<<index),
cy_readb(base_addr+(CySRER<<index)) | CyMdmCh); cy_readb(base_addr+(CySRER<<index)) | CyMdmCh);
/* act on 1->0 modem transitions */ /* act on 1->0 modem transitions */
if ((cflag & CRTSCTS) && info->rflow) { 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])); (CyDSR|CyCTS|CyRI|CyDCD|rflow_thr[i]));
} else { } else {
cy_writeb((u_long)base_addr+(CyMCOR1<<index), cy_writeb(base_addr+(CyMCOR1<<index),
CyDSR|CyCTS|CyRI|CyDCD); CyDSR|CyCTS|CyRI|CyDCD);
} }
/* act on 0->1 modem transitions */ /* act on 0->1 modem transitions */
cy_writeb((u_long)base_addr+(CyMCOR2<<index), cy_writeb(base_addr+(CyMCOR2<<index),
CyDSR|CyCTS|CyRI|CyDCD); CyDSR|CyCTS|CyRI|CyDCD);
} }
if(i == 0){ /* baud rate is zero, turn off line */ if(i == 0){ /* baud rate is zero, turn off line */
if (info->rtsdtr_inv) { if (info->rtsdtr_inv) {
cy_writeb((u_long)base_addr+(CyMSVR1<<index), ~CyRTS); cy_writeb(base_addr+(CyMSVR1<<index), ~CyRTS);
} else { } else {
cy_writeb((u_long)base_addr+(CyMSVR2<<index), ~CyDTR); cy_writeb(base_addr+(CyMSVR2<<index), ~CyDTR);
} }
#ifdef CY_DEBUG_DTR #ifdef CY_DEBUG_DTR
printk("cyc:set_line_char dropping DTR\n"); printk("cyc:set_line_char dropping DTR\n");
...@@ -3378,9 +3346,9 @@ set_line_char(struct cyclades_port * info) ...@@ -3378,9 +3346,9 @@ set_line_char(struct cyclades_port * info)
#endif #endif
}else{ }else{
if (info->rtsdtr_inv) { if (info->rtsdtr_inv) {
cy_writeb((u_long)base_addr+(CyMSVR1<<index), CyRTS); cy_writeb(base_addr+(CyMSVR1<<index), CyRTS);
} else { } else {
cy_writeb((u_long)base_addr+(CyMSVR2<<index), CyDTR); cy_writeb(base_addr+(CyMSVR2<<index), CyDTR);
} }
#ifdef CY_DEBUG_DTR #ifdef CY_DEBUG_DTR
printk("cyc:set_line_char raising DTR\n"); printk("cyc:set_line_char raising DTR\n");
...@@ -3396,23 +3364,20 @@ set_line_char(struct cyclades_port * info) ...@@ -3396,23 +3364,20 @@ set_line_char(struct cyclades_port * info)
CY_UNLOCK(info, flags); CY_UNLOCK(info, flags);
} else { } else {
struct FIRM_ID *firm_id; struct FIRM_ID __iomem *firm_id;
struct ZFW_CTRL *zfw_ctrl; struct ZFW_CTRL __iomem *zfw_ctrl;
struct BOARD_CTRL *board_ctrl; struct BOARD_CTRL __iomem *board_ctrl;
struct CH_CTRL *ch_ctrl; struct CH_CTRL __iomem *ch_ctrl;
struct BUF_CTRL *buf_ctrl; struct BUF_CTRL __iomem *buf_ctrl;
uclong sw_flow; uclong sw_flow;
int retval; int retval;
firm_id = (struct FIRM_ID *) firm_id = cy_card[card].base_addr + ID_ADDRESS;
(cy_card[card].base_addr + ID_ADDRESS);
if (!ISZLOADED(cy_card[card])) { if (!ISZLOADED(cy_card[card])) {
return; return;
} }
zfw_ctrl = (struct ZFW_CTRL *) zfw_ctrl = cy_card[card].base_addr + (cy_readl(&firm_id->zfwctrl_addr) & 0xfffff);
(cy_card[card].base_addr +
(cy_readl(&firm_id->zfwctrl_addr) & 0xfffff));
board_ctrl = &zfw_ctrl->board_ctrl; board_ctrl = &zfw_ctrl->board_ctrl;
ch_ctrl = &(zfw_ctrl->ch_ctrl[channel]); ch_ctrl = &(zfw_ctrl->ch_ctrl[channel]);
buf_ctrl = &zfw_ctrl->buf_ctrl[channel]; buf_ctrl = &zfw_ctrl->buf_ctrl[channel];
...@@ -3613,7 +3578,7 @@ static int get_lsr_info(struct cyclades_port *info, unsigned int __user *value) ...@@ -3613,7 +3578,7 @@ static int get_lsr_info(struct cyclades_port *info, unsigned int __user *value)
unsigned char status; unsigned char status;
unsigned int result; unsigned int result;
unsigned long flags; unsigned long flags;
unsigned char *base_addr; void __iomem *base_addr;
card = info->card; card = info->card;
channel = (info->line) - (cy_card[card].first_line); channel = (info->line) - (cy_card[card].first_line);
...@@ -3621,8 +3586,7 @@ static int get_lsr_info(struct cyclades_port *info, unsigned int __user *value) ...@@ -3621,8 +3586,7 @@ static int get_lsr_info(struct cyclades_port *info, unsigned int __user *value)
chip = channel>>2; chip = channel>>2;
channel &= 0x03; channel &= 0x03;
index = cy_card[card].bus_index; index = cy_card[card].bus_index;
base_addr = (unsigned char *) base_addr = cy_card[card].base_addr + (cy_chip_offset[chip]<<index);
(cy_card[card].base_addr + (cy_chip_offset[chip]<<index));
CY_LOCK(info, flags); CY_LOCK(info, flags);
status = cy_readb(base_addr+(CySRER<<index)) & (CyTxRdy|CyTxMpty); status = cy_readb(base_addr+(CySRER<<index)) & (CyTxRdy|CyTxMpty);
...@@ -3640,15 +3604,15 @@ cy_tiocmget(struct tty_struct *tty, struct file *file) ...@@ -3640,15 +3604,15 @@ cy_tiocmget(struct tty_struct *tty, struct file *file)
{ {
struct cyclades_port * info = (struct cyclades_port *)tty->driver_data; struct cyclades_port * info = (struct cyclades_port *)tty->driver_data;
int card,chip,channel,index; int card,chip,channel,index;
unsigned char *base_addr; void __iomem *base_addr;
unsigned long flags; unsigned long flags;
unsigned char status; unsigned char status;
unsigned long lstatus; unsigned long lstatus;
unsigned int result; unsigned int result;
struct FIRM_ID *firm_id; struct FIRM_ID __iomem *firm_id;
struct ZFW_CTRL *zfw_ctrl; struct ZFW_CTRL __iomem *zfw_ctrl;
struct BOARD_CTRL *board_ctrl; struct BOARD_CTRL __iomem *board_ctrl;
struct CH_CTRL *ch_ctrl; struct CH_CTRL __iomem *ch_ctrl;
if (serial_paranoia_check(info, tty->name, __FUNCTION__)) if (serial_paranoia_check(info, tty->name, __FUNCTION__))
return -ENODEV; return -ENODEV;
...@@ -3659,12 +3623,10 @@ cy_tiocmget(struct tty_struct *tty, struct file *file) ...@@ -3659,12 +3623,10 @@ cy_tiocmget(struct tty_struct *tty, struct file *file)
chip = channel>>2; chip = channel>>2;
channel &= 0x03; channel &= 0x03;
index = cy_card[card].bus_index; index = cy_card[card].bus_index;
base_addr = (unsigned char*) base_addr = cy_card[card].base_addr + (cy_chip_offset[chip]<<index);
(cy_card[card].base_addr
+ (cy_chip_offset[chip]<<index));
CY_LOCK(info, flags); 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+(CyMSVR1<<index));
status |= cy_readb(base_addr+(CyMSVR2<<index)); status |= cy_readb(base_addr+(CyMSVR2<<index));
CY_UNLOCK(info, flags); CY_UNLOCK(info, flags);
...@@ -3681,18 +3643,15 @@ cy_tiocmget(struct tty_struct *tty, struct file *file) ...@@ -3681,18 +3643,15 @@ cy_tiocmget(struct tty_struct *tty, struct file *file)
| ((status & CyDSR) ? TIOCM_DSR : 0) | ((status & CyDSR) ? TIOCM_DSR : 0)
| ((status & CyCTS) ? TIOCM_CTS : 0); | ((status & CyCTS) ? TIOCM_CTS : 0);
} else { } else {
base_addr = (unsigned char*) (cy_card[card].base_addr); base_addr = cy_card[card].base_addr;
if (cy_card[card].num_chips != -1){ if (cy_card[card].num_chips != -1){
return -EINVAL; return -EINVAL;
} }
firm_id = (struct FIRM_ID *) firm_id = cy_card[card].base_addr + ID_ADDRESS;
(cy_card[card].base_addr + ID_ADDRESS);
if (ISZLOADED(cy_card[card])) { if (ISZLOADED(cy_card[card])) {
zfw_ctrl = (struct ZFW_CTRL *) zfw_ctrl = cy_card[card].base_addr + (cy_readl(&firm_id->zfwctrl_addr) & 0xfffff);
(cy_card[card].base_addr +
(cy_readl(&firm_id->zfwctrl_addr) & 0xfffff));
board_ctrl = &zfw_ctrl->board_ctrl; board_ctrl = &zfw_ctrl->board_ctrl;
ch_ctrl = zfw_ctrl->ch_ctrl; ch_ctrl = zfw_ctrl->ch_ctrl;
lstatus = cy_readl(&ch_ctrl[channel].rs_status); lstatus = cy_readl(&ch_ctrl[channel].rs_status);
...@@ -3718,12 +3677,12 @@ cy_tiocmset(struct tty_struct *tty, struct file *file, ...@@ -3718,12 +3677,12 @@ cy_tiocmset(struct tty_struct *tty, struct file *file,
{ {
struct cyclades_port * info = (struct cyclades_port *)tty->driver_data; struct cyclades_port * info = (struct cyclades_port *)tty->driver_data;
int card,chip,channel,index; int card,chip,channel,index;
unsigned char *base_addr; void __iomem *base_addr;
unsigned long flags; unsigned long flags;
struct FIRM_ID *firm_id; struct FIRM_ID __iomem *firm_id;
struct ZFW_CTRL *zfw_ctrl; struct ZFW_CTRL __iomem *zfw_ctrl;
struct BOARD_CTRL *board_ctrl; struct BOARD_CTRL __iomem *board_ctrl;
struct CH_CTRL *ch_ctrl; struct CH_CTRL __iomem *ch_ctrl;
int retval; int retval;
if (serial_paranoia_check(info, tty->name, __FUNCTION__)) if (serial_paranoia_check(info, tty->name, __FUNCTION__))
...@@ -3735,37 +3694,35 @@ cy_tiocmset(struct tty_struct *tty, struct file *file, ...@@ -3735,37 +3694,35 @@ cy_tiocmset(struct tty_struct *tty, struct file *file,
chip = channel>>2; chip = channel>>2;
channel &= 0x03; channel &= 0x03;
index = cy_card[card].bus_index; index = cy_card[card].bus_index;
base_addr = (unsigned char*) base_addr = cy_card[card].base_addr + (cy_chip_offset[chip]<<index);
(cy_card[card].base_addr
+ (cy_chip_offset[chip]<<index));
if (set & TIOCM_RTS){ if (set & TIOCM_RTS){
CY_LOCK(info, flags); 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) { if (info->rtsdtr_inv) {
cy_writeb((u_long)base_addr+(CyMSVR2<<index), CyDTR); cy_writeb(base_addr+(CyMSVR2<<index), CyDTR);
} else { } else {
cy_writeb((u_long)base_addr+(CyMSVR1<<index), CyRTS); cy_writeb(base_addr+(CyMSVR1<<index), CyRTS);
} }
CY_UNLOCK(info, flags); CY_UNLOCK(info, flags);
} }
if (clear & TIOCM_RTS) { if (clear & TIOCM_RTS) {
CY_LOCK(info, flags); 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) { if (info->rtsdtr_inv) {
cy_writeb((u_long)base_addr+(CyMSVR2<<index), ~CyDTR); cy_writeb(base_addr+(CyMSVR2<<index), ~CyDTR);
} else { } else {
cy_writeb((u_long)base_addr+(CyMSVR1<<index), ~CyRTS); cy_writeb(base_addr+(CyMSVR1<<index), ~CyRTS);
} }
CY_UNLOCK(info, flags); CY_UNLOCK(info, flags);
} }
if (set & TIOCM_DTR){ if (set & TIOCM_DTR){
CY_LOCK(info, flags); 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) { if (info->rtsdtr_inv) {
cy_writeb((u_long)base_addr+(CyMSVR1<<index), CyRTS); cy_writeb(base_addr+(CyMSVR1<<index), CyRTS);
} else { } else {
cy_writeb((u_long)base_addr+(CyMSVR2<<index), CyDTR); cy_writeb(base_addr+(CyMSVR2<<index), CyDTR);
} }
#ifdef CY_DEBUG_DTR #ifdef CY_DEBUG_DTR
printk("cyc:set_modem_info raising DTR\n"); printk("cyc:set_modem_info raising DTR\n");
...@@ -3777,11 +3734,11 @@ cy_tiocmset(struct tty_struct *tty, struct file *file, ...@@ -3777,11 +3734,11 @@ cy_tiocmset(struct tty_struct *tty, struct file *file,
} }
if (clear & TIOCM_DTR) { if (clear & TIOCM_DTR) {
CY_LOCK(info, flags); 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) { if (info->rtsdtr_inv) {
cy_writeb((u_long)base_addr+(CyMSVR1<<index), ~CyRTS); cy_writeb(base_addr+(CyMSVR1<<index), ~CyRTS);
} else { } else {
cy_writeb((u_long)base_addr+(CyMSVR2<<index), ~CyDTR); cy_writeb(base_addr+(CyMSVR2<<index), ~CyDTR);
} }
#ifdef CY_DEBUG_DTR #ifdef CY_DEBUG_DTR
...@@ -3793,14 +3750,11 @@ cy_tiocmset(struct tty_struct *tty, struct file *file, ...@@ -3793,14 +3750,11 @@ cy_tiocmset(struct tty_struct *tty, struct file *file,
CY_UNLOCK(info, flags); CY_UNLOCK(info, flags);
} }
} else { } else {
base_addr = (unsigned char*) (cy_card[card].base_addr); base_addr = cy_card[card].base_addr;
firm_id = (struct FIRM_ID *) firm_id = cy_card[card].base_addr + ID_ADDRESS;
(cy_card[card].base_addr + ID_ADDRESS);
if (ISZLOADED(cy_card[card])) { if (ISZLOADED(cy_card[card])) {
zfw_ctrl = (struct ZFW_CTRL *) zfw_ctrl = cy_card[card].base_addr + (cy_readl(&firm_id->zfwctrl_addr) & 0xfffff);
(cy_card[card].base_addr +
(cy_readl(&firm_id->zfwctrl_addr) & 0xfffff));
board_ctrl = &zfw_ctrl->board_ctrl; board_ctrl = &zfw_ctrl->board_ctrl;
ch_ctrl = zfw_ctrl->ch_ctrl; ch_ctrl = zfw_ctrl->ch_ctrl;
...@@ -3926,7 +3880,7 @@ get_mon_info(struct cyclades_port * info, struct cyclades_monitor __user * mon) ...@@ -3926,7 +3880,7 @@ get_mon_info(struct cyclades_port * info, struct cyclades_monitor __user * mon)
static int static int
set_threshold(struct cyclades_port * info, unsigned long value) set_threshold(struct cyclades_port * info, unsigned long value)
{ {
unsigned char *base_addr; void __iomem *base_addr;
int card,channel,chip,index; int card,channel,chip,index;
unsigned long flags; unsigned long flags;
...@@ -3936,15 +3890,13 @@ set_threshold(struct cyclades_port * info, unsigned long value) ...@@ -3936,15 +3890,13 @@ set_threshold(struct cyclades_port * info, unsigned long value)
chip = channel>>2; chip = channel>>2;
channel &= 0x03; channel &= 0x03;
index = cy_card[card].bus_index; index = cy_card[card].bus_index;
base_addr = (unsigned char*) base_addr = cy_card[card].base_addr + (cy_chip_offset[chip]<<index);
(cy_card[card].base_addr
+ (cy_chip_offset[chip]<<index));
info->cor3 &= ~CyREC_FIFO; info->cor3 &= ~CyREC_FIFO;
info->cor3 |= value & CyREC_FIFO; info->cor3 |= value & CyREC_FIFO;
CY_LOCK(info, flags); 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); cyy_issue_cmd(base_addr,CyCOR_CHANGE|CyCOR3ch,index);
CY_UNLOCK(info, flags); CY_UNLOCK(info, flags);
} else { } else {
...@@ -3957,7 +3909,7 @@ set_threshold(struct cyclades_port * info, unsigned long value) ...@@ -3957,7 +3909,7 @@ set_threshold(struct cyclades_port * info, unsigned long value)
static int static int
get_threshold(struct cyclades_port * info, unsigned long __user *value) get_threshold(struct cyclades_port * info, unsigned long __user *value)
{ {
unsigned char *base_addr; void __iomem *base_addr;
int card,channel,chip,index; int card,channel,chip,index;
unsigned long tmp; unsigned long tmp;
...@@ -3967,9 +3919,7 @@ get_threshold(struct cyclades_port * info, unsigned long __user *value) ...@@ -3967,9 +3919,7 @@ get_threshold(struct cyclades_port * info, unsigned long __user *value)
chip = channel>>2; chip = channel>>2;
channel &= 0x03; channel &= 0x03;
index = cy_card[card].bus_index; index = cy_card[card].bus_index;
base_addr = (unsigned char*) base_addr = cy_card[card].base_addr + (cy_chip_offset[chip]<<index);
(cy_card[card].base_addr
+ (cy_chip_offset[chip]<<index));
tmp = cy_readb(base_addr+(CyCOR3<<index)) & CyREC_FIFO; tmp = cy_readb(base_addr+(CyCOR3<<index)) & CyREC_FIFO;
return put_user(tmp,value); return put_user(tmp,value);
...@@ -3998,7 +3948,7 @@ get_default_threshold(struct cyclades_port * info, unsigned long __user *value) ...@@ -3998,7 +3948,7 @@ get_default_threshold(struct cyclades_port * info, unsigned long __user *value)
static int static int
set_timeout(struct cyclades_port * info, unsigned long value) set_timeout(struct cyclades_port * info, unsigned long value)
{ {
unsigned char *base_addr; void __iomem *base_addr;
int card,channel,chip,index; int card,channel,chip,index;
unsigned long flags; unsigned long flags;
...@@ -4008,12 +3958,10 @@ set_timeout(struct cyclades_port * info, unsigned long value) ...@@ -4008,12 +3958,10 @@ set_timeout(struct cyclades_port * info, unsigned long value)
chip = channel>>2; chip = channel>>2;
channel &= 0x03; channel &= 0x03;
index = cy_card[card].bus_index; index = cy_card[card].bus_index;
base_addr = (unsigned char*) base_addr = cy_card[card].base_addr + (cy_chip_offset[chip]<<index);
(cy_card[card].base_addr
+ (cy_chip_offset[chip]<<index));
CY_LOCK(info, flags); 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); CY_UNLOCK(info, flags);
} else { } else {
// Nothing to do! // Nothing to do!
...@@ -4025,7 +3973,7 @@ set_timeout(struct cyclades_port * info, unsigned long value) ...@@ -4025,7 +3973,7 @@ set_timeout(struct cyclades_port * info, unsigned long value)
static int static int
get_timeout(struct cyclades_port * info, unsigned long __user *value) get_timeout(struct cyclades_port * info, unsigned long __user *value)
{ {
unsigned char *base_addr; void __iomem *base_addr;
int card,channel,chip,index; int card,channel,chip,index;
unsigned long tmp; unsigned long tmp;
...@@ -4035,9 +3983,7 @@ get_timeout(struct cyclades_port * info, unsigned long __user *value) ...@@ -4035,9 +3983,7 @@ get_timeout(struct cyclades_port * info, unsigned long __user *value)
chip = channel>>2; chip = channel>>2;
channel &= 0x03; channel &= 0x03;
index = cy_card[card].bus_index; index = cy_card[card].bus_index;
base_addr = (unsigned char*) base_addr = cy_card[card].base_addr + (cy_chip_offset[chip]<<index);
(cy_card[card].base_addr
+ (cy_chip_offset[chip]<<index));
tmp = cy_readb(base_addr+(CyRTPR<<index)); tmp = cy_readb(base_addr+(CyRTPR<<index));
return put_user(tmp,value); return put_user(tmp,value);
...@@ -4325,7 +4271,7 @@ cy_throttle(struct tty_struct * tty) ...@@ -4325,7 +4271,7 @@ cy_throttle(struct tty_struct * tty)
{ {
struct cyclades_port *info = (struct cyclades_port *)tty->driver_data; struct cyclades_port *info = (struct cyclades_port *)tty->driver_data;
unsigned long flags; unsigned long flags;
unsigned char *base_addr; void __iomem *base_addr;
int card,chip,channel,index; int card,chip,channel,index;
#ifdef CY_DEBUG_THROTTLE #ifdef CY_DEBUG_THROTTLE
...@@ -4355,16 +4301,14 @@ cy_throttle(struct tty_struct * tty) ...@@ -4355,16 +4301,14 @@ cy_throttle(struct tty_struct * tty)
chip = channel>>2; chip = channel>>2;
channel &= 0x03; channel &= 0x03;
index = cy_card[card].bus_index; index = cy_card[card].bus_index;
base_addr = (unsigned char*) base_addr = cy_card[card].base_addr + (cy_chip_offset[chip]<<index);
(cy_card[card].base_addr
+ (cy_chip_offset[chip]<<index));
CY_LOCK(info, flags); 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) { if (info->rtsdtr_inv) {
cy_writeb((u_long)base_addr+(CyMSVR2<<index), ~CyDTR); cy_writeb(base_addr+(CyMSVR2<<index), ~CyDTR);
} else { } else {
cy_writeb((u_long)base_addr+(CyMSVR1<<index), ~CyRTS); cy_writeb(base_addr+(CyMSVR1<<index), ~CyRTS);
} }
CY_UNLOCK(info, flags); CY_UNLOCK(info, flags);
} else { } else {
...@@ -4386,7 +4330,7 @@ cy_unthrottle(struct tty_struct * tty) ...@@ -4386,7 +4330,7 @@ cy_unthrottle(struct tty_struct * tty)
{ {
struct cyclades_port *info = (struct cyclades_port *)tty->driver_data; struct cyclades_port *info = (struct cyclades_port *)tty->driver_data;
unsigned long flags; unsigned long flags;
unsigned char *base_addr; void __iomem *base_addr;
int card,chip,channel,index; int card,chip,channel,index;
#ifdef CY_DEBUG_THROTTLE #ifdef CY_DEBUG_THROTTLE
...@@ -4415,16 +4359,14 @@ cy_unthrottle(struct tty_struct * tty) ...@@ -4415,16 +4359,14 @@ cy_unthrottle(struct tty_struct * tty)
chip = channel>>2; chip = channel>>2;
channel &= 0x03; channel &= 0x03;
index = cy_card[card].bus_index; index = cy_card[card].bus_index;
base_addr = (unsigned char*) base_addr = cy_card[card].base_addr + (cy_chip_offset[chip]<<index);
(cy_card[card].base_addr
+ (cy_chip_offset[chip]<<index));
CY_LOCK(info, flags); 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) { if (info->rtsdtr_inv) {
cy_writeb((u_long)base_addr+(CyMSVR2<<index), CyDTR); cy_writeb(base_addr+(CyMSVR2<<index), CyDTR);
} else { } else {
cy_writeb((u_long)base_addr+(CyMSVR1<<index), CyRTS); cy_writeb(base_addr+(CyMSVR1<<index), CyRTS);
} }
CY_UNLOCK(info, flags); CY_UNLOCK(info, flags);
} else { } else {
...@@ -4444,7 +4386,7 @@ cy_stop(struct tty_struct *tty) ...@@ -4444,7 +4386,7 @@ cy_stop(struct tty_struct *tty)
{ {
struct cyclades_card *cinfo; struct cyclades_card *cinfo;
struct cyclades_port *info = (struct cyclades_port *)tty->driver_data; struct cyclades_port *info = (struct cyclades_port *)tty->driver_data;
unsigned char *base_addr; void __iomem *base_addr;
int chip,channel,index; int chip,channel,index;
unsigned long flags; unsigned long flags;
...@@ -4461,14 +4403,12 @@ cy_stop(struct tty_struct *tty) ...@@ -4461,14 +4403,12 @@ cy_stop(struct tty_struct *tty)
index = cinfo->bus_index; index = cinfo->bus_index;
chip = channel>>2; chip = channel>>2;
channel &= 0x03; channel &= 0x03;
base_addr = (unsigned char*) base_addr = cy_card[info->card].base_addr + (cy_chip_offset[chip]<<index);
(cy_card[info->card].base_addr
+ (cy_chip_offset[chip]<<index));
CY_LOCK(info, flags); CY_LOCK(info, flags);
cy_writeb((u_long)base_addr+(CyCAR<<index), cy_writeb(base_addr+(CyCAR<<index),
(u_char)(channel & 0x0003)); /* index channel */ (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_readb(base_addr+(CySRER<<index)) & ~CyTxRdy);
CY_UNLOCK(info, flags); CY_UNLOCK(info, flags);
} else { } else {
...@@ -4484,7 +4424,7 @@ cy_start(struct tty_struct *tty) ...@@ -4484,7 +4424,7 @@ cy_start(struct tty_struct *tty)
{ {
struct cyclades_card *cinfo; struct cyclades_card *cinfo;
struct cyclades_port *info = (struct cyclades_port *)tty->driver_data; struct cyclades_port *info = (struct cyclades_port *)tty->driver_data;
unsigned char *base_addr; void __iomem *base_addr;
int chip,channel,index; int chip,channel,index;
unsigned long flags; unsigned long flags;
...@@ -4501,14 +4441,12 @@ cy_start(struct tty_struct *tty) ...@@ -4501,14 +4441,12 @@ cy_start(struct tty_struct *tty)
if (!IS_CYC_Z(*cinfo)) { if (!IS_CYC_Z(*cinfo)) {
chip = channel>>2; chip = channel>>2;
channel &= 0x03; channel &= 0x03;
base_addr = (unsigned char*) base_addr = cy_card[info->card].base_addr + (cy_chip_offset[chip]<<index);
(cy_card[info->card].base_addr
+ (cy_chip_offset[chip]<<index));
CY_LOCK(info, flags); CY_LOCK(info, flags);
cy_writeb((u_long)base_addr+(CyCAR<<index), cy_writeb(base_addr+(CyCAR<<index),
(u_char)(channel & 0x0003)); /* index channel */ (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_readb(base_addr+(CySRER<<index)) | CyTxRdy);
CY_UNLOCK(info, flags); CY_UNLOCK(info, flags);
} else { } else {
...@@ -4594,20 +4532,19 @@ cy_hangup(struct tty_struct *tty) ...@@ -4594,20 +4532,19 @@ cy_hangup(struct tty_struct *tty)
/* initialize chips on Cyclom-Y card -- return number of valid /* initialize chips on Cyclom-Y card -- return number of valid
chips (which is number of ports/4) */ chips (which is number of ports/4) */
static unsigned short __init 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; 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_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 */ /* Cy_ClrIntr is 0x1800 */
udelay(500L); udelay(500L);
for(chip_number=0; chip_number<CyMAX_CHIPS_PER_CARD; chip_number++){ for(chip_number=0; chip_number<CyMAX_CHIPS_PER_CARD; chip_number++){
base_addr = true_base_addr base_addr = true_base_addr + (cy_chip_offset[chip_number]<<index);
+ (cy_chip_offset[chip_number]<<index);
mdelay(1); mdelay(1);
if(cy_readb(base_addr+(CyCCR<<index)) != 0x00){ if(cy_readb(base_addr+(CyCCR<<index)) != 0x00){
/************* /*************
...@@ -4617,7 +4554,7 @@ cyy_init_card(volatile ucchar *true_base_addr,int index) ...@@ -4617,7 +4554,7 @@ cyy_init_card(volatile ucchar *true_base_addr,int index)
return chip_number; return chip_number;
} }
cy_writeb((u_long)base_addr+(CyGFRCR<<index), 0); cy_writeb(base_addr+(CyGFRCR<<index), 0);
udelay(10L); udelay(10L);
/* The Cyclom-16Y does not decode address bit 9 and therefore /* The Cyclom-16Y does not decode address bit 9 and therefore
...@@ -4633,7 +4570,7 @@ cyy_init_card(volatile ucchar *true_base_addr,int index) ...@@ -4633,7 +4570,7 @@ cyy_init_card(volatile ucchar *true_base_addr,int index)
return chip_number; return chip_number;
} }
cy_writeb((u_long)base_addr+(CyCCR<<index), CyCHIP_RESET); cy_writeb(base_addr+(CyCCR<<index), CyCHIP_RESET);
mdelay(1); mdelay(1);
if(cy_readb(base_addr+(CyGFRCR<<index)) == 0x00){ if(cy_readb(base_addr+(CyGFRCR<<index)) == 0x00){
...@@ -4652,15 +4589,15 @@ cyy_init_card(volatile ucchar *true_base_addr,int index) ...@@ -4652,15 +4589,15 @@ cyy_init_card(volatile ucchar *true_base_addr,int index)
*/ */
return chip_number; 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){ if (cy_readb(base_addr+(CyGFRCR<<index)) >= CD1400_REV_J){
/* It is a CD1400 rev. J or later */ /* It is a CD1400 rev. J or later */
/* Impossible to reach 5ms with this chip. /* Impossible to reach 5ms with this chip.
Changed to 2ms instead (f = 500 Hz). */ 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 { } else {
/* f = 200 Hz */ /* f = 200 Hz */
cy_writeb((u_long)base_addr+(CyPPR<<index), CyCLOCK_25_5MS); cy_writeb(base_addr+(CyPPR<<index), CyCLOCK_25_5MS);
} }
/* /*
...@@ -4683,7 +4620,7 @@ cy_detect_isa(void) ...@@ -4683,7 +4620,7 @@ cy_detect_isa(void)
{ {
#ifdef CONFIG_ISA #ifdef CONFIG_ISA
unsigned short cy_isa_irq,nboard; unsigned short cy_isa_irq,nboard;
volatile ucchar *cy_isa_address; void __iomem *cy_isa_address;
unsigned short i,j,cy_isa_nchan; unsigned short i,j,cy_isa_nchan;
#ifdef MODULE #ifdef MODULE
int isparam = 0; int isparam = 0;
...@@ -4696,7 +4633,7 @@ cy_detect_isa(void) ...@@ -4696,7 +4633,7 @@ cy_detect_isa(void)
for(i = 0 ; i < NR_CARDS; i++) { for(i = 0 ; i < NR_CARDS; i++) {
if (maddr[i] || i) { if (maddr[i] || i) {
isparam = 1; isparam = 1;
cy_isa_addresses[i] = (ucchar *)maddr[i]; cy_isa_addresses[i] = maddr[i];
} }
if (!maddr[i]) if (!maddr[i])
break; break;
...@@ -4705,15 +4642,13 @@ cy_detect_isa(void) ...@@ -4705,15 +4642,13 @@ cy_detect_isa(void)
/* scan the address table probing for Cyclom-Y/ISA boards */ /* scan the address table probing for Cyclom-Y/ISA boards */
for (i = 0 ; i < NR_ISA_ADDRS ; i++) { for (i = 0 ; i < NR_ISA_ADDRS ; i++) {
cy_isa_address = cy_isa_addresses[i]; unsigned int isa_address = cy_isa_addresses[i];
if (cy_isa_address == 0x0000) { if (isa_address == 0x0000) {
return(nboard); return(nboard);
} }
/* probe for CD1400... */ /* probe for CD1400... */
#if !defined(__alpha__) cy_isa_address = ioremap(isa_address, CyISA_Ywin);
cy_isa_address = ioremap((ulong)cy_isa_address, CyISA_Ywin);
#endif
cy_isa_nchan = CyPORTS_PER_CHIP * cy_isa_nchan = CyPORTS_PER_CHIP *
cyy_init_card(cy_isa_address,0); cyy_init_card(cy_isa_address,0);
if (cy_isa_nchan == 0) { if (cy_isa_nchan == 0) {
...@@ -4765,8 +4700,8 @@ cy_detect_isa(void) ...@@ -4765,8 +4700,8 @@ cy_detect_isa(void)
} }
/* set cy_card */ /* set cy_card */
cy_card[j].base_addr = (u_long) cy_isa_address; cy_card[j].base_addr = cy_isa_address;
cy_card[j].ctl_addr = 0; cy_card[j].ctl_addr = NULL;
cy_card[j].irq = (int) cy_isa_irq; cy_card[j].irq = (int) cy_isa_irq;
cy_card[j].bus_index = 0; cy_card[j].bus_index = 0;
cy_card[j].first_line = cy_next_channel; cy_card[j].first_line = cy_next_channel;
...@@ -4789,7 +4724,7 @@ cy_detect_isa(void) ...@@ -4789,7 +4724,7 @@ cy_detect_isa(void)
} /* cy_detect_isa */ } /* cy_detect_isa */
static void static void
plx_init(uclong addr, uclong initctl) plx_init(void __iomem *addr, uclong initctl)
{ {
/* Reset PLX */ /* Reset PLX */
cy_writel(addr + initctl, cy_readl(addr + initctl) | 0x40000000); cy_writel(addr + initctl, cy_readl(addr + initctl) | 0x40000000);
...@@ -4817,11 +4752,12 @@ cy_detect_pci(void) ...@@ -4817,11 +4752,12 @@ cy_detect_pci(void)
unsigned char cyy_rev_id; unsigned char cyy_rev_id;
unsigned char cy_pci_irq = 0; unsigned char cy_pci_irq = 0;
uclong cy_pci_phys0, cy_pci_phys2; 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 i,j,cy_pci_nchan, plx_ver;
unsigned short device_id,dev_index = 0; unsigned short device_id,dev_index = 0;
uclong mailbox; 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]; uclong Ze_phys0[NR_CARDS], Ze_phys2[NR_CARDS];
unsigned char Ze_irq[NR_CARDS]; unsigned char Ze_irq[NR_CARDS];
struct pci_dev *Ze_pdev[NR_CARDS]; struct pci_dev *Ze_pdev[NR_CARDS];
...@@ -4890,15 +4826,15 @@ cy_detect_pci(void) ...@@ -4890,15 +4826,15 @@ cy_detect_pci(void)
continue; continue;
} }
#endif #endif
cy_pci_addr0 = (ulong)ioremap(cy_pci_phys0, CyPCI_Yctl); cy_pci_addr0 = ioremap(cy_pci_phys0, CyPCI_Yctl);
cy_pci_addr2 = (ulong)ioremap(cy_pci_phys2, CyPCI_Ywin); cy_pci_addr2 = ioremap(cy_pci_phys2, CyPCI_Ywin);
#ifdef CY_PCI_DEBUG #ifdef CY_PCI_DEBUG
printk("Cyclom-Y/PCI: relocate winaddr=0x%lx ctladdr=0x%lx\n", printk("Cyclom-Y/PCI: relocate winaddr=0x%lx ctladdr=0x%lx\n",
(u_long)cy_pci_addr2, (u_long)cy_pci_addr0); (u_long)cy_pci_addr2, (u_long)cy_pci_addr0);
#endif #endif
cy_pci_nchan = (unsigned short)(CyPORTS_PER_CHIP * 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) { if(cy_pci_nchan == 0) {
printk("Cyclom-Y PCI host card with "); printk("Cyclom-Y PCI host card with ");
printk("no Serial-Modules at 0x%lx.\n", printk("no Serial-Modules at 0x%lx.\n",
...@@ -4939,8 +4875,8 @@ cy_detect_pci(void) ...@@ -4939,8 +4875,8 @@ cy_detect_pci(void)
/* set cy_card */ /* set cy_card */
cy_card[j].base_phys = (ulong)cy_pci_phys2; cy_card[j].base_phys = (ulong)cy_pci_phys2;
cy_card[j].ctl_phys = (ulong)cy_pci_phys0; cy_card[j].ctl_phys = (ulong)cy_pci_phys0;
cy_card[j].base_addr = (ulong)cy_pci_addr2; cy_card[j].base_addr = cy_pci_addr2;
cy_card[j].ctl_addr = (ulong)cy_pci_addr0; cy_card[j].ctl_addr = cy_pci_addr0;
cy_card[j].irq = (int) cy_pci_irq; cy_card[j].irq = (int) cy_pci_irq;
cy_card[j].bus_index = 1; cy_card[j].bus_index = 1;
cy_card[j].first_line = cy_next_channel; cy_card[j].first_line = cy_next_channel;
...@@ -5000,7 +4936,7 @@ cy_detect_pci(void) ...@@ -5000,7 +4936,7 @@ cy_detect_pci(void)
printk("Cyclades-Z/PCI: found winaddr=0x%lx ctladdr=0x%lx\n", printk("Cyclades-Z/PCI: found winaddr=0x%lx ctladdr=0x%lx\n",
(ulong)cy_pci_phys2, (ulong)cy_pci_phys0); (ulong)cy_pci_phys2, (ulong)cy_pci_phys0);
#endif #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 */ /* Disable interrupts on the PLX before resetting it */
cy_writew(cy_pci_addr0+0x68, cy_writew(cy_pci_addr0+0x68,
...@@ -5013,7 +4949,7 @@ cy_detect_pci(void) ...@@ -5013,7 +4949,7 @@ cy_detect_pci(void)
This will remain here until we find a permanent fix. */ This will remain here until we find a permanent fix. */
pci_write_config_byte(pdev, PCI_INTERRUPT_LINE, cy_pci_irq); 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); cy_pci_addr0)->mail_box_0);
if (pci_resource_flags(pdev, 2) & IORESOURCE_IO) { if (pci_resource_flags(pdev, 2) & IORESOURCE_IO) {
...@@ -5031,7 +4967,7 @@ cy_detect_pci(void) ...@@ -5031,7 +4967,7 @@ cy_detect_pci(void)
} }
if (mailbox == ZE_V1) { 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) { if (ZeIndex == NR_CARDS) {
printk("Cyclades-Ze/PCI found at 0x%lx ", printk("Cyclades-Ze/PCI found at 0x%lx ",
(ulong)cy_pci_phys2); (ulong)cy_pci_phys2);
...@@ -5049,7 +4985,7 @@ cy_detect_pci(void) ...@@ -5049,7 +4985,7 @@ cy_detect_pci(void)
i--; i--;
continue; continue;
} else { } else {
cy_pci_addr2 = (ulong)ioremap(cy_pci_phys2, CyPCI_Zwin); cy_pci_addr2 = ioremap(cy_pci_phys2, CyPCI_Zwin);
} }
#ifdef CY_PCI_DEBUG #ifdef CY_PCI_DEBUG
...@@ -5076,7 +5012,7 @@ cy_detect_pci(void) ...@@ -5076,7 +5012,7 @@ cy_detect_pci(void)
*/ */
PAUSE PAUSE
if ((mailbox == ZO_V1) || (mailbox == ZO_V2)) 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 /* This must be a Cyclades-8Zo/PCI. The extendable
version will have a different device_id and will version will have a different device_id and will
...@@ -5166,7 +5102,7 @@ cy_detect_pci(void) ...@@ -5166,7 +5102,7 @@ cy_detect_pci(void)
Ze_pdev[j] = Ze_pdev[j+1]; Ze_pdev[j] = Ze_pdev[j+1];
} }
ZeIndex--; ZeIndex--;
mailbox = (uclong)cy_readl(&((struct RUNTIME_9060 *) mailbox = (uclong)cy_readl(&((struct RUNTIME_9060 __iomem *)
cy_pci_addr0)->mail_box_0); cy_pci_addr0)->mail_box_0);
#ifdef CY_PCI_DEBUG #ifdef CY_PCI_DEBUG
printk("Cyclades-Z/PCI: relocate winaddr=0x%lx ctladdr=0x%lx\n", printk("Cyclades-Z/PCI: relocate winaddr=0x%lx ctladdr=0x%lx\n",
...@@ -5407,7 +5343,7 @@ cy_init(void) ...@@ -5407,7 +5343,7 @@ cy_init(void)
for (i = 0; i < NR_CARDS; i++) { for (i = 0; i < NR_CARDS; i++) {
/* base_addr=0 indicates board not found */ /* 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 /* the code below is responsible to find the boards. Each different
...@@ -5429,7 +5365,7 @@ cy_init(void) ...@@ -5429,7 +5365,7 @@ cy_init(void)
for (i = 0 ; i < NR_CARDS ; i++) { for (i = 0 ; i < NR_CARDS ; i++) {
if (cy_card[i].base_addr == 0) { if (cy_card[i].base_addr == 0) {
cy_card[i].first_line = -1; 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].irq = 0;
cy_card[i].bus_index = 0; cy_card[i].bus_index = 0;
cy_card[i].first_line = 0; cy_card[i].first_line = 0;
...@@ -5447,7 +5383,7 @@ cy_init(void) ...@@ -5447,7 +5383,7 @@ cy_init(void)
cinfo = &cy_card[board]; cinfo = &cy_card[board];
if (cinfo->num_chips == -1) { /* Cyclades-Z */ if (cinfo->num_chips == -1) { /* Cyclades-Z */
number_z_boards++; number_z_boards++;
mailbox = cy_readl(&((struct RUNTIME_9060 *) mailbox = cy_readl(&((struct RUNTIME_9060 __iomem *)
cy_card[board].ctl_addr)->mail_box_0); cy_card[board].ctl_addr)->mail_box_0);
nports = (mailbox == ZE_V1) ? ZE_V1_NPORTS : 8; nports = (mailbox == ZE_V1) ? ZE_V1_NPORTS : 8;
cinfo->intr_enabled = 0; cinfo->intr_enabled = 0;
...@@ -5617,10 +5553,10 @@ cy_cleanup_module(void) ...@@ -5617,10 +5553,10 @@ cy_cleanup_module(void)
put_tty_driver(cy_serial_driver); put_tty_driver(cy_serial_driver);
for (i = 0; i < NR_CARDS; i++) { for (i = 0; i < NR_CARDS; i++) {
if (cy_card[i].base_addr != 0) { if (cy_card[i].base_addr) {
iounmap((void *)cy_card[i].base_addr); iounmap(cy_card[i].base_addr);
if (cy_card[i].ctl_addr != 0) if (cy_card[i].ctl_addr)
iounmap((void *)cy_card[i].ctl_addr); iounmap(cy_card[i].ctl_addr);
if (cy_card[i].irq if (cy_card[i].irq
#ifndef CONFIG_CYZ_INTR #ifndef CONFIG_CYZ_INTR
&& cy_card[i].num_chips != -1 /* not a Z card */ && cy_card[i].num_chips != -1 /* not a Z card */
......
...@@ -511,8 +511,8 @@ struct resource; ...@@ -511,8 +511,8 @@ struct resource;
struct cyclades_card { struct cyclades_card {
unsigned long base_phys; unsigned long base_phys;
unsigned long ctl_phys; unsigned long ctl_phys;
unsigned long base_addr; void __iomem *base_addr;
unsigned long ctl_addr; void __iomem *ctl_addr;
int irq; int irq;
int num_chips; /* 0 if card absent, -1 if Z/PCI, else Y */ int num_chips; /* 0 if card absent, -1 if Z/PCI, else Y */
int first_line; /* minor number of first channel on card */ int first_line; /* minor number of first channel on card */
...@@ -539,9 +539,9 @@ struct cyclades_chip { ...@@ -539,9 +539,9 @@ struct cyclades_chip {
* (required to support Alpha systems) * * (required to support Alpha systems) *
***************************************/ ***************************************/
#define cy_writeb(port,val) {writeb((ucchar)(val),(ulong)(port)); mb();} #define cy_writeb(port,val) {writeb((val),(port)); mb();}
#define cy_writew(port,val) {writew((ushort)(val),(ulong)(port)); mb();} #define cy_writew(port,val) {writew((val),(port)); mb();}
#define cy_writel(port,val) {writel((uclong)(val),(ulong)(port)); mb();} #define cy_writel(port,val) {writel((val),(port)); mb();}
#define cy_readb(port) readb(port) #define cy_readb(port) readb(port)
#define cy_readw(port) readw(port) #define cy_readw(port) readw(port)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment