Commit db05c3b1 authored by Jiri Slaby's avatar Jiri Slaby Committed by Linus Torvalds

Char: cyclades, cy_readX/writeX cleanup

cyclades, cy_readX/writeX cleanup

- cy_readX are placeholders for readX, remove it
- move cy_writeX macros into do {} while(0) to be safe
Signed-off-by: default avatarJiri Slaby <jirislaby@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent ffa68e79
...@@ -675,13 +675,13 @@ static void cy_send_xchar(struct tty_struct *tty, char ch); ...@@ -675,13 +675,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 __iomem *) \ ((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 __iomem *) \ #define ISZLOADED(card) (((ZO_V1==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 __iomem *) \ (ZFIRM_ID==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
...@@ -972,7 +972,7 @@ static int cyy_issue_cmd(void __iomem * base_addr, u_char cmd, int index) ...@@ -972,7 +972,7 @@ static int cyy_issue_cmd(void __iomem * base_addr, u_char cmd, int index)
/* Check to see that the previous command has completed */ /* Check to see that the previous command has completed */
for (i = 0; i < 100; i++) { for (i = 0; i < 100; i++) {
if (cy_readb(base_addr + (CyCCR << index)) == 0) { if (readb(base_addr + (CyCCR << index)) == 0) {
break; break;
} }
udelay(10L); udelay(10L);
...@@ -1015,7 +1015,7 @@ static unsigned detect_isa_irq(void __iomem * address) ...@@ -1015,7 +1015,7 @@ static unsigned detect_isa_irq(void __iomem * address)
cy_writeb(address + (CyCAR << index), 0); cy_writeb(address + (CyCAR << index), 0);
cy_writeb(address + (CySRER << index), cy_writeb(address + (CySRER << index),
cy_readb(address + (CySRER << index)) | CyTxRdy); readb(address + (CySRER << index)) | CyTxRdy);
local_irq_restore(flags); local_irq_restore(flags);
/* Wait ... */ /* Wait ... */
...@@ -1025,11 +1025,11 @@ static unsigned detect_isa_irq(void __iomem * address) ...@@ -1025,11 +1025,11 @@ static unsigned detect_isa_irq(void __iomem * address)
irq = probe_irq_off(irqs); irq = probe_irq_off(irqs);
/* Clean up */ /* Clean up */
save_xir = (u_char) cy_readb(address + (CyTIR << index)); save_xir = (u_char) readb(address + (CyTIR << index));
save_car = cy_readb(address + (CyCAR << index)); save_car = readb(address + (CyCAR << index));
cy_writeb(address + (CyCAR << index), (save_xir & 0x3)); cy_writeb(address + (CyCAR << index), (save_xir & 0x3));
cy_writeb(address + (CySRER << index), cy_writeb(address + (CySRER << index),
cy_readb(address + (CySRER << index)) & ~CyTxRdy); readb(address + (CySRER << index)) & ~CyTxRdy);
cy_writeb(address + (CyTIR << index), (save_xir & 0x3f)); cy_writeb(address + (CyTIR << index), (save_xir & 0x3f));
cy_writeb(address + (CyCAR << index), (save_car)); cy_writeb(address + (CyCAR << index), (save_car));
cy_writeb(address + (Cy_ClrIntr << index), 0); cy_writeb(address + (Cy_ClrIntr << index), 0);
...@@ -1055,34 +1055,34 @@ static void cyy_intr_chip(struct cyclades_card *cinfo, int chip, ...@@ -1055,34 +1055,34 @@ static void cyy_intr_chip(struct cyclades_card *cinfo, int chip,
#endif #endif
/* determine the channel & change to that context */ /* determine the channel & change to that context */
spin_lock(&cinfo->card_lock); spin_lock(&cinfo->card_lock);
save_xir = (u_char) cy_readb(base_addr + (CyRIR << index)); save_xir = (u_char) readb(base_addr + (CyRIR << index));
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;
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 = readb(base_addr + (CyCAR << index));
cy_writeb(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) {
j = (cy_readb(base_addr + (CyRIVR << index)) & j = (readb(base_addr + (CyRIVR << index)) &
CyIVRMask); CyIVRMask);
if (j == CyIVRRxEx) { /* exception */ if (j == CyIVRRxEx) { /* exception */
data = cy_readb(base_addr + (CyRDSR << index)); data = readb(base_addr + (CyRDSR << index));
} else { /* normal character reception */ } else { /* normal character reception */
char_count = cy_readb(base_addr + char_count = readb(base_addr +
(CyRDCR << index)); (CyRDCR << index));
while (char_count--) { while (char_count--) {
data = cy_readb(base_addr + data = readb(base_addr +
(CyRDSR << index)); (CyRDSR << index));
} }
} }
} else { /* there is an open port for this data */ } else { /* there is an open port for this data */
tty = info->tty; tty = info->tty;
j = (cy_readb(base_addr + (CyRIVR << index)) & j = (readb(base_addr + (CyRIVR << index)) &
CyIVRMask); CyIVRMask);
if (j == CyIVRRxEx) { /* exception */ if (j == CyIVRRxEx) { /* exception */
data = cy_readb(base_addr + (CyRDSR << index)); data = readb(base_addr + (CyRDSR << index));
/* For statistics only */ /* For statistics only */
if (data & CyBREAK) if (data & CyBREAK)
...@@ -1103,7 +1103,7 @@ static void cyy_intr_chip(struct cyclades_card *cinfo, int chip, ...@@ -1103,7 +1103,7 @@ static void cyy_intr_chip(struct cyclades_card *cinfo, int chip,
if (data & CyBREAK) { if (data & CyBREAK) {
tty_insert_flip_char( tty_insert_flip_char(
tty, tty,
cy_readb( readb(
base_addr + base_addr +
(CyRDSR << (CyRDSR <<
index)), index)),
...@@ -1116,7 +1116,7 @@ static void cyy_intr_chip(struct cyclades_card *cinfo, int chip, ...@@ -1116,7 +1116,7 @@ static void cyy_intr_chip(struct cyclades_card *cinfo, int chip,
} else if (data & CyFRAME) { } else if (data & CyFRAME) {
tty_insert_flip_char( tty_insert_flip_char(
tty, tty,
cy_readb( readb(
base_addr + base_addr +
(CyRDSR << (CyRDSR <<
index)), index)),
...@@ -1128,7 +1128,7 @@ static void cyy_intr_chip(struct cyclades_card *cinfo, int chip, ...@@ -1128,7 +1128,7 @@ static void cyy_intr_chip(struct cyclades_card *cinfo, int chip,
/* Pieces of seven... */ /* Pieces of seven... */
tty_insert_flip_char( tty_insert_flip_char(
tty, tty,
cy_readb( readb(
base_addr + base_addr +
(CyRDSR << (CyRDSR <<
index)), index)),
...@@ -1147,7 +1147,7 @@ static void cyy_intr_chip(struct cyclades_card *cinfo, int chip, ...@@ -1147,7 +1147,7 @@ static void cyy_intr_chip(struct cyclades_card *cinfo, int chip,
*/ */
tty_insert_flip_char( tty_insert_flip_char(
tty, tty,
cy_readb( readb(
base_addr + base_addr +
(CyRDSR << (CyRDSR <<
index)), index)),
...@@ -1179,7 +1179,7 @@ static void cyy_intr_chip(struct cyclades_card *cinfo, int chip, ...@@ -1179,7 +1179,7 @@ static void cyy_intr_chip(struct cyclades_card *cinfo, int chip,
} }
} else { /* normal character reception */ } else { /* normal character reception */
/* load # chars available from the chip */ /* load # chars available from the chip */
char_count = cy_readb(base_addr + char_count = readb(base_addr +
(CyRDCR << index)); (CyRDCR << index));
#ifdef CY_ENABLE_MONITORING #ifdef CY_ENABLE_MONITORING
...@@ -1191,7 +1191,7 @@ static void cyy_intr_chip(struct cyclades_card *cinfo, int chip, ...@@ -1191,7 +1191,7 @@ static void cyy_intr_chip(struct cyclades_card *cinfo, int chip,
#endif #endif
len = tty_buffer_request_room(tty, char_count); len = tty_buffer_request_room(tty, char_count);
while (len--) { while (len--) {
data = cy_readb(base_addr + data = readb(base_addr +
(CyRDSR << index)); (CyRDSR << index));
tty_insert_flip_char(tty, data, tty_insert_flip_char(tty, data,
TTY_NORMAL); TTY_NORMAL);
...@@ -1221,16 +1221,16 @@ static void cyy_intr_chip(struct cyclades_card *cinfo, int chip, ...@@ -1221,16 +1221,16 @@ static void cyy_intr_chip(struct cyclades_card *cinfo, int chip,
/* determine the channel & change to that context */ /* determine the channel & change to that context */
spin_lock(&cinfo->card_lock); spin_lock(&cinfo->card_lock);
save_xir = (u_char) cy_readb(base_addr + (CyTIR << index)); save_xir = (u_char) readb(base_addr + (CyTIR << index));
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 = readb(base_addr + (CyCAR << index));
cy_writeb(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(base_addr + (CySRER << index), cy_writeb(base_addr + (CySRER << index),
cy_readb(base_addr + (CySRER << index)) & readb(base_addr + (CySRER << index)) &
~CyTxRdy); ~CyTxRdy);
goto txend; goto txend;
} }
...@@ -1238,7 +1238,7 @@ static void cyy_intr_chip(struct cyclades_card *cinfo, int chip, ...@@ -1238,7 +1238,7 @@ static void cyy_intr_chip(struct cyclades_card *cinfo, int chip,
info->last_active = jiffies; info->last_active = jiffies;
if (info->tty == 0) { if (info->tty == 0) {
cy_writeb(base_addr + (CySRER << index), cy_writeb(base_addr + (CySRER << index),
cy_readb(base_addr + (CySRER << index)) & readb(base_addr + (CySRER << index)) &
~CyTxRdy); ~CyTxRdy);
goto txdone; goto txdone;
} }
...@@ -1271,15 +1271,15 @@ static void cyy_intr_chip(struct cyclades_card *cinfo, int chip, ...@@ -1271,15 +1271,15 @@ static void cyy_intr_chip(struct cyclades_card *cinfo, int chip,
while (char_count-- > 0) { while (char_count-- > 0) {
if (!info->xmit_cnt) { if (!info->xmit_cnt) {
if (cy_readb(base_addr + (CySRER << index)) & if (readb(base_addr + (CySRER << index)) &
CyTxMpty) { CyTxMpty) {
cy_writeb(base_addr + (CySRER << index), cy_writeb(base_addr + (CySRER << index),
cy_readb(base_addr + readb(base_addr +
(CySRER << index)) & (CySRER << index)) &
~CyTxMpty); ~CyTxMpty);
} else { } else {
cy_writeb(base_addr + (CySRER << index), cy_writeb(base_addr + (CySRER << index),
(cy_readb(base_addr + (readb(base_addr +
(CySRER << index)) & (CySRER << index)) &
~CyTxRdy) | CyTxMpty); ~CyTxRdy) | CyTxMpty);
} }
...@@ -1287,13 +1287,13 @@ static void cyy_intr_chip(struct cyclades_card *cinfo, int chip, ...@@ -1287,13 +1287,13 @@ static void cyy_intr_chip(struct cyclades_card *cinfo, int chip,
} }
if (info->xmit_buf == 0) { if (info->xmit_buf == 0) {
cy_writeb(base_addr + (CySRER << index), cy_writeb(base_addr + (CySRER << index),
cy_readb(base_addr + (CySRER << index))& 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(base_addr + (CySRER << index), cy_writeb(base_addr + (CySRER << index),
cy_readb(base_addr + (CySRER << index))& readb(base_addr + (CySRER << index)) &
~CyTxRdy); ~CyTxRdy);
goto txdone; goto txdone;
} }
...@@ -1346,15 +1346,15 @@ static void cyy_intr_chip(struct cyclades_card *cinfo, int chip, ...@@ -1346,15 +1346,15 @@ static void cyy_intr_chip(struct cyclades_card *cinfo, int chip,
/* determine the channel & change to that context */ /* determine the channel & change to that context */
spin_lock(&cinfo->card_lock); spin_lock(&cinfo->card_lock);
save_xir = (u_char) cy_readb(base_addr + (CyMIR << index)); save_xir = (u_char) readb(base_addr + (CyMIR << index));
channel = (u_short) (save_xir & CyIRChannel); channel = (u_short) (save_xir & CyIRChannel);
info = &cy_port[channel + chip * 4 + cinfo->first_line]; info = &cy_port[channel + chip * 4 + cinfo->first_line];
info->last_active = jiffies; info->last_active = jiffies;
save_car = cy_readb(base_addr + (CyCAR << index)); save_car = readb(base_addr + (CyCAR << index));
cy_writeb(base_addr + (CyCAR << index), save_xir); cy_writeb(base_addr + (CyCAR << index), save_xir);
mdm_change = cy_readb(base_addr + (CyMISR << index)); mdm_change = readb(base_addr + (CyMISR << index));
mdm_status = cy_readb(base_addr + (CyMSVR1 << index)); mdm_status = readb(base_addr + (CyMSVR1 << index));
if (info->tty == 0) { /* no place for data, ignore it */ if (info->tty == 0) { /* no place for data, ignore it */
; ;
...@@ -1391,7 +1391,7 @@ static void cyy_intr_chip(struct cyclades_card *cinfo, int chip, ...@@ -1391,7 +1391,7 @@ static void cyy_intr_chip(struct cyclades_card *cinfo, int chip,
info->tty->hw_stopped = 0; info->tty->hw_stopped = 0;
cy_writeb(base_addr + cy_writeb(base_addr +
(CySRER << index), (CySRER << index),
cy_readb(base_addr + readb(base_addr +
(CySRER << (CySRER <<
index))| index))|
CyTxRdy); CyTxRdy);
...@@ -1405,7 +1405,7 @@ static void cyy_intr_chip(struct cyclades_card *cinfo, int chip, ...@@ -1405,7 +1405,7 @@ static void cyy_intr_chip(struct cyclades_card *cinfo, int chip,
info->tty->hw_stopped = 1; info->tty->hw_stopped = 1;
cy_writeb(base_addr + cy_writeb(base_addr +
(CySRER << index), (CySRER << index),
cy_readb(base_addr + readb(base_addr +
(CySRER << (CySRER <<
index)) & index)) &
~CyTxRdy); ~CyTxRdy);
...@@ -1459,7 +1459,7 @@ static irqreturn_t cyy_interrupt(int irq, void *dev_id) ...@@ -1459,7 +1459,7 @@ static irqreturn_t cyy_interrupt(int irq, void *dev_id)
base_addr = cinfo->base_addr + base_addr = cinfo->base_addr +
(cy_chip_offset[chip] << index); (cy_chip_offset[chip] << index);
too_many = 0; too_many = 0;
while ((status = cy_readb(base_addr + while ((status = readb(base_addr +
(CySVRR << index))) != 0x00) { (CySVRR << index))) != 0x00) {
had_work++; had_work++;
/* The purpose of the following test is to ensure that /* The purpose of the following test is to ensure that
...@@ -1502,16 +1502,15 @@ cyz_fetch_msg(struct cyclades_card *cinfo, ...@@ -1502,16 +1502,15 @@ cyz_fetch_msg(struct cyclades_card *cinfo,
if (!ISZLOADED(*cinfo)) { if (!ISZLOADED(*cinfo)) {
return -1; return -1;
} }
zfw_ctrl = cinfo->base_addr + (cy_readl(&firm_id->zfwctrl_addr) & zfw_ctrl = cinfo->base_addr + (readl(&firm_id->zfwctrl_addr) & 0xfffff);
0xfffff);
board_ctrl = &zfw_ctrl->board_ctrl; board_ctrl = &zfw_ctrl->board_ctrl;
loc_doorbell = cy_readl(&((struct RUNTIME_9060 __iomem *) loc_doorbell = 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 = readl(&board_ctrl->fwcmd_channel);
*param = (__u32) cy_readl(&board_ctrl->fwcmd_param); *param = (__u32) readl(&board_ctrl->fwcmd_param);
cy_writel(&((struct RUNTIME_9060 __iomem *)(cinfo->ctl_addr))-> cy_writel(&((struct RUNTIME_9060 __iomem *)(cinfo->ctl_addr))->
loc_doorbell, 0xffffffff); loc_doorbell, 0xffffffff);
return 1; return 1;
...@@ -1533,16 +1532,15 @@ cyz_issue_cmd(struct cyclades_card *cinfo, ...@@ -1533,16 +1532,15 @@ cyz_issue_cmd(struct cyclades_card *cinfo,
if (!ISZLOADED(*cinfo)) { if (!ISZLOADED(*cinfo)) {
return -1; return -1;
} }
zfw_ctrl = cinfo->base_addr + (cy_readl(&firm_id->zfwctrl_addr) & zfw_ctrl = cinfo->base_addr + (readl(&firm_id->zfwctrl_addr) & 0xfffff);
0xfffff);
board_ctrl = &zfw_ctrl->board_ctrl; board_ctrl = &zfw_ctrl->board_ctrl;
index = 0; index = 0;
pci_doorbell = pci_doorbell =
&((struct RUNTIME_9060 __iomem *)(cinfo->ctl_addr))->pci_doorbell; &((struct RUNTIME_9060 __iomem *)(cinfo->ctl_addr))->pci_doorbell;
while ((cy_readl(pci_doorbell) & 0xff) != 0) { while ((readl(pci_doorbell) & 0xff) != 0) {
if (index++ == 1000) { if (index++ == 1000) {
return (int)(cy_readl(pci_doorbell) & 0xff); return (int)(readl(pci_doorbell) & 0xff);
} }
udelay(50L); udelay(50L);
} }
...@@ -1569,10 +1567,10 @@ cyz_handle_rx(struct cyclades_port *info, ...@@ -1569,10 +1567,10 @@ cyz_handle_rx(struct cyclades_port *info,
#endif #endif
volatile __u32 rx_put, rx_get, new_rx_get, rx_bufsize, rx_bufaddr; volatile __u32 rx_put, rx_get, new_rx_get, rx_bufsize, rx_bufaddr;
rx_get = new_rx_get = cy_readl(&buf_ctrl->rx_get); rx_get = new_rx_get = readl(&buf_ctrl->rx_get);
rx_put = cy_readl(&buf_ctrl->rx_put); rx_put = readl(&buf_ctrl->rx_put);
rx_bufsize = cy_readl(&buf_ctrl->rx_bufsize); rx_bufsize = readl(&buf_ctrl->rx_bufsize);
rx_bufaddr = cy_readl(&buf_ctrl->rx_bufaddr); rx_bufaddr = readl(&buf_ctrl->rx_bufaddr);
if (rx_put >= rx_get) if (rx_put >= rx_get)
char_count = rx_put - rx_get; char_count = rx_put - rx_get;
else else
...@@ -1622,7 +1620,7 @@ cyz_handle_rx(struct cyclades_port *info, ...@@ -1622,7 +1620,7 @@ cyz_handle_rx(struct cyclades_port *info,
#else #else
len = tty_buffer_request_room(tty, char_count); len = tty_buffer_request_room(tty, char_count);
while (len--) { while (len--) {
data = cy_readb(cinfo->base_addr + rx_bufaddr + data = readb(cinfo->base_addr + rx_bufaddr +
new_rx_get); new_rx_get);
new_rx_get = (new_rx_get + 1)& (rx_bufsize - 1); new_rx_get = (new_rx_get + 1)& (rx_bufsize - 1);
tty_insert_flip_char(tty, data, TTY_NORMAL); tty_insert_flip_char(tty, data, TTY_NORMAL);
...@@ -1633,13 +1631,12 @@ cyz_handle_rx(struct cyclades_port *info, ...@@ -1633,13 +1631,12 @@ cyz_handle_rx(struct cyclades_port *info,
#ifdef CONFIG_CYZ_INTR #ifdef CONFIG_CYZ_INTR
/* Recalculate the number of chars in the RX buffer and issue /* Recalculate the number of chars in the RX buffer and issue
a cmd in case it's higher than the RX high water mark */ a cmd in case it's higher than the RX high water mark */
rx_put = cy_readl(&buf_ctrl->rx_put); rx_put = readl(&buf_ctrl->rx_put);
if (rx_put >= rx_get) if (rx_put >= rx_get)
char_count = rx_put - rx_get; char_count = rx_put - rx_get;
else else
char_count = rx_put - rx_get + rx_bufsize; char_count = rx_put - rx_get + rx_bufsize;
if (char_count >= (int)cy_readl(&buf_ctrl-> if (char_count >= (int)readl(&buf_ctrl->rx_threshold)) {
rx_threshold)) {
cy_sched_event(info, Cy_EVENT_Z_RX_FULL); cy_sched_event(info, Cy_EVENT_Z_RX_FULL);
} }
#endif #endif
...@@ -1668,10 +1665,10 @@ cyz_handle_tx(struct cyclades_port *info, ...@@ -1668,10 +1665,10 @@ cyz_handle_tx(struct cyclades_port *info,
if (info->xmit_cnt <= 0) /* Nothing to transmit */ if (info->xmit_cnt <= 0) /* Nothing to transmit */
return; return;
tx_get = cy_readl(&buf_ctrl->tx_get); tx_get = readl(&buf_ctrl->tx_get);
tx_put = cy_readl(&buf_ctrl->tx_put); tx_put = readl(&buf_ctrl->tx_put);
tx_bufsize = cy_readl(&buf_ctrl->tx_bufsize); tx_bufsize = readl(&buf_ctrl->tx_bufsize);
tx_bufaddr = cy_readl(&buf_ctrl->tx_bufaddr); tx_bufaddr = readl(&buf_ctrl->tx_bufaddr);
if (tx_put >= tx_get) if (tx_put >= tx_get)
char_count = tx_get - tx_put - 1 + tx_bufsize; char_count = tx_get - tx_put - 1 + tx_bufsize;
else else
...@@ -1756,11 +1753,10 @@ static void cyz_handle_cmd(struct cyclades_card *cinfo) ...@@ -1756,11 +1753,10 @@ static void cyz_handle_cmd(struct cyclades_card *cinfo)
int delta_count; int delta_count;
firm_id = cinfo->base_addr + ID_ADDRESS; firm_id = cinfo->base_addr + ID_ADDRESS;
zfw_ctrl = cinfo->base_addr + (cy_readl(&firm_id->zfwctrl_addr) & zfw_ctrl = cinfo->base_addr + (readl(&firm_id->zfwctrl_addr) & 0xfffff);
0xfffff);
board_ctrl = &zfw_ctrl->board_ctrl; board_ctrl = &zfw_ctrl->board_ctrl;
fw_ver = cy_readl(&board_ctrl->fw_version); fw_ver = readl(&board_ctrl->fw_version);
hw_ver = cy_readl(&((struct RUNTIME_9060 __iomem *)(cinfo->ctl_addr))-> hw_ver = readl(&((struct RUNTIME_9060 __iomem *)(cinfo->ctl_addr))->
mail_box_0); mail_box_0);
while (cyz_fetch_msg(cinfo, &channel, &cmd, &param) == 1) { while (cyz_fetch_msg(cinfo, &channel, &cmd, &param) == 1) {
...@@ -1794,7 +1790,7 @@ static void cyz_handle_cmd(struct cyclades_card *cinfo) ...@@ -1794,7 +1790,7 @@ static void cyz_handle_cmd(struct cyclades_card *cinfo)
delta_count++; delta_count++;
if (info->flags & ASYNC_CHECK_CD) { if (info->flags & ASYNC_CHECK_CD) {
if ((fw_ver > 241 ? ((u_long) param) : if ((fw_ver > 241 ? ((u_long) param) :
cy_readl(&ch_ctrl->rs_status)) & readl(&ch_ctrl->rs_status)) &
C_RS_DCD) { C_RS_DCD) {
cy_sched_event(info, cy_sched_event(info,
Cy_EVENT_OPEN_WAKEUP); Cy_EVENT_OPEN_WAKEUP);
...@@ -1923,12 +1919,12 @@ static void cyz_poll(unsigned long arg) ...@@ -1923,12 +1919,12 @@ static void cyz_poll(unsigned long arg)
firm_id = cinfo->base_addr + ID_ADDRESS; firm_id = cinfo->base_addr + ID_ADDRESS;
zfw_ctrl = cinfo->base_addr + zfw_ctrl = cinfo->base_addr +
(cy_readl(&firm_id->zfwctrl_addr) & 0xfffff); (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 */
if (!cinfo->intr_enabled) { if (!cinfo->intr_enabled) {
cinfo->nports = (int)cy_readl(&board_ctrl->n_channel); cinfo->nports = (int)readl(&board_ctrl->n_channel);
cinfo->intr_enabled = 1; cinfo->intr_enabled = 1;
continue; continue;
} }
...@@ -2029,12 +2025,12 @@ static int startup(struct cyclades_port *info) ...@@ -2029,12 +2025,12 @@ static int startup(struct cyclades_port *info)
#ifdef CY_DEBUG_DTR #ifdef CY_DEBUG_DTR
printk("cyc:startup raising DTR\n"); printk("cyc:startup raising DTR\n");
printk(" status: 0x%x, 0x%x\n", printk(" status: 0x%x, 0x%x\n",
cy_readb(base_addr + (CyMSVR1 << index)), readb(base_addr + (CyMSVR1 << index)),
cy_readb(base_addr + (CyMSVR2 << index))); readb(base_addr + (CyMSVR2 << index)));
#endif #endif
cy_writeb(base_addr + (CySRER << index), cy_writeb(base_addr + (CySRER << index),
cy_readb(base_addr + (CySRER << index)) | CyRxData); readb(base_addr + (CySRER << index)) | CyRxData);
info->flags |= ASYNC_INITIALIZED; info->flags |= ASYNC_INITIALIZED;
if (info->tty) { if (info->tty) {
...@@ -2064,7 +2060,7 @@ static int startup(struct cyclades_port *info) ...@@ -2064,7 +2060,7 @@ static int startup(struct cyclades_port *info)
} }
zfw_ctrl = cy_card[card].base_addr + zfw_ctrl = cy_card[card].base_addr +
(cy_readl(&firm_id->zfwctrl_addr) & 0xfffff); (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;
...@@ -2112,7 +2108,7 @@ static int startup(struct cyclades_port *info) ...@@ -2112,7 +2108,7 @@ static int startup(struct cyclades_port *info)
/* set timeout !!! */ /* set timeout !!! */
/* set RTS and DTR !!! */ /* set RTS and DTR !!! */
cy_writel(&ch_ctrl[channel].rs_control, cy_writel(&ch_ctrl[channel].rs_control,
cy_readl(&ch_ctrl[channel].rs_control) | C_RS_RTS | readl(&ch_ctrl[channel].rs_control) | C_RS_RTS |
C_RS_DTR); C_RS_DTR);
retval = cyz_issue_cmd(&cy_card[info->card], channel, retval = cyz_issue_cmd(&cy_card[info->card], channel,
C_CM_IOCTLM, 0L); C_CM_IOCTLM, 0L);
...@@ -2168,7 +2164,7 @@ static void start_xmit(struct cyclades_port *info) ...@@ -2168,7 +2164,7 @@ static void start_xmit(struct cyclades_port *info)
CY_LOCK(info, flags); CY_LOCK(info, flags);
cy_writeb(base_addr + (CyCAR << index), channel); cy_writeb(base_addr + (CyCAR << index), channel);
cy_writeb(base_addr + (CySRER << index), cy_writeb(base_addr + (CySRER << index),
cy_readb(base_addr + (CySRER << index)) | CyTxRdy); readb(base_addr + (CySRER << index)) | CyTxRdy);
CY_UNLOCK(info, flags); CY_UNLOCK(info, flags);
} else { } else {
#ifdef CONFIG_CYZ_INTR #ifdef CONFIG_CYZ_INTR
...@@ -2235,8 +2231,8 @@ static void shutdown(struct cyclades_port *info) ...@@ -2235,8 +2231,8 @@ static void shutdown(struct cyclades_port *info)
#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",
cy_readb(base_addr + (CyMSVR1 << index)), readb(base_addr + (CyMSVR1 << index)),
cy_readb(base_addr + (CyMSVR2 << index))); readb(base_addr + (CyMSVR2 << index)));
#endif #endif
} }
cyy_issue_cmd(base_addr, CyCHAN_CTL | CyDIS_RCVR, index); cyy_issue_cmd(base_addr, CyCHAN_CTL | CyDIS_RCVR, index);
...@@ -2267,7 +2263,7 @@ static void shutdown(struct cyclades_port *info) ...@@ -2267,7 +2263,7 @@ static void shutdown(struct cyclades_port *info)
} }
zfw_ctrl = cy_card[card].base_addr + zfw_ctrl = cy_card[card].base_addr +
(cy_readl(&firm_id->zfwctrl_addr) & 0xfffff); (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;
...@@ -2282,7 +2278,7 @@ static void shutdown(struct cyclades_port *info) ...@@ -2282,7 +2278,7 @@ static void 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(&ch_ctrl[channel].rs_control, cy_writel(&ch_ctrl[channel].rs_control,
(__u32)(cy_readl(&ch_ctrl[channel].rs_control)& (__u32)(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], channel, retval = cyz_issue_cmd(&cy_card[info->card], channel,
C_CM_IOCTLM, 0L); C_CM_IOCTLM, 0L);
...@@ -2390,10 +2386,8 @@ block_til_ready(struct tty_struct *tty, struct file *filp, ...@@ -2390,10 +2386,8 @@ block_til_ready(struct tty_struct *tty, struct file *filp,
#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",
cy_readb(base_addr + readb(base_addr + (CyMSVR1 << index)),
(CyMSVR1 << index)), readb(base_addr + (CyMSVR2 << index)));
cy_readb(base_addr +
(CyMSVR2 << index)));
#endif #endif
} }
CY_UNLOCK(info, flags); CY_UNLOCK(info, flags);
...@@ -2410,7 +2404,7 @@ block_til_ready(struct tty_struct *tty, struct file *filp, ...@@ -2410,7 +2404,7 @@ block_til_ready(struct tty_struct *tty, struct file *filp,
cy_writeb(base_addr + (CyCAR << index), cy_writeb(base_addr + (CyCAR << index),
(u_char) channel); (u_char) channel);
if (!(info->flags & ASYNC_CLOSING) && (C_CLOCAL(tty) || if (!(info->flags & ASYNC_CLOSING) && (C_CLOCAL(tty) ||
(cy_readb(base_addr + (readb(base_addr +
(CyMSVR1 << index)) & CyDCD))) { (CyMSVR1 << index)) & CyDCD))) {
CY_UNLOCK(info, flags); CY_UNLOCK(info, flags);
break; break;
...@@ -2444,19 +2438,17 @@ block_til_ready(struct tty_struct *tty, struct file *filp, ...@@ -2444,19 +2438,17 @@ block_til_ready(struct tty_struct *tty, struct file *filp,
return -EINVAL; return -EINVAL;
} }
zfw_ctrl = base_addr + (cy_readl(&firm_id->zfwctrl_addr) & zfw_ctrl = base_addr + (readl(&firm_id->zfwctrl_addr)& 0xfffff);
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;
while (1) { while (1) {
if ((tty->termios->c_cflag & CBAUD)) { if ((tty->termios->c_cflag & CBAUD)) {
cy_writel(&ch_ctrl[channel].rs_control, cy_writel(&ch_ctrl[channel].rs_control,
cy_readl(&ch_ctrl[channel]. readl(&ch_ctrl[channel].rs_control) |
rs_control) | (C_RS_RTS | C_RS_RTS | C_RS_DTR);
C_RS_DTR));
retval = cyz_issue_cmd(&cy_card[info->card], retval = cyz_issue_cmd(&cy_card[info->card],
channel, C_CM_IOCTLM, 0L); channel, C_CM_IOCTLM, 0L);
if (retval != 0) { if (retval != 0) {
printk("cyc:block_til_ready retval on " printk("cyc:block_til_ready retval on "
"ttyC%d was %x\n", "ttyC%d was %x\n",
...@@ -2475,7 +2467,7 @@ block_til_ready(struct tty_struct *tty, struct file *filp, ...@@ -2475,7 +2467,7 @@ block_til_ready(struct tty_struct *tty, struct file *filp,
break; break;
} }
if (!(info->flags & ASYNC_CLOSING) && (C_CLOCAL(tty) || if (!(info->flags & ASYNC_CLOSING) && (C_CLOCAL(tty) ||
(cy_readl(&ch_ctrl[channel].rs_status) & (readl(&ch_ctrl[channel].rs_status) &
C_RS_DCD))) { C_RS_DCD))) {
break; break;
} }
...@@ -2540,11 +2532,10 @@ static int cy_open(struct tty_struct *tty, struct file *filp) ...@@ -2540,11 +2532,10 @@ static int cy_open(struct tty_struct *tty, struct file *filp)
struct FIRM_ID __iomem *firm_id = cinfo->base_addr + ID_ADDRESS; struct FIRM_ID __iomem *firm_id = cinfo->base_addr + ID_ADDRESS;
if (!ISZLOADED(*cinfo)) { if (!ISZLOADED(*cinfo)) {
if (((ZE_V1 == cy_readl( if (((ZE_V1 == readl(&((struct RUNTIME_9060 __iomem *)
&((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( (ZFIRM_HLT == readl(
&firm_id->signature))) { &firm_id->signature))) {
printk("cyc:Cyclades-Z Error: you need an " printk("cyc:Cyclades-Z Error: you need an "
"external power supply for this number " "external power supply for this number "
...@@ -2565,15 +2556,14 @@ static int cy_open(struct tty_struct *tty, struct file *filp) ...@@ -2565,15 +2556,14 @@ static int cy_open(struct tty_struct *tty, struct file *filp)
struct BOARD_CTRL __iomem *board_ctrl; struct BOARD_CTRL __iomem *board_ctrl;
zfw_ctrl = cinfo->base_addr + zfw_ctrl = cinfo->base_addr +
(cy_readl(&firm_id->zfwctrl_addr) & (readl(&firm_id->zfwctrl_addr) &
0xfffff); 0xfffff);
board_ctrl = &zfw_ctrl->board_ctrl; board_ctrl = &zfw_ctrl->board_ctrl;
/* Enable interrupts on the PLX chip */ /* Enable interrupts on the PLX chip */
cy_writew(cinfo->ctl_addr + 0x68, cy_writew(cinfo->ctl_addr + 0x68,
cy_readw(cinfo->ctl_addr + readw(cinfo->ctl_addr + 0x68) | 0x0900);
0x68) | 0x0900);
/* Enable interrupts on the FW */ /* Enable interrupts on the FW */
retval = cyz_issue_cmd(cinfo, 0, retval = cyz_issue_cmd(cinfo, 0,
C_CM_IRQ_ENBL, 0L); C_CM_IRQ_ENBL, 0L);
...@@ -2582,7 +2572,7 @@ static int cy_open(struct tty_struct *tty, struct file *filp) ...@@ -2582,7 +2572,7 @@ static int cy_open(struct tty_struct *tty, struct file *filp)
retval); retval);
} }
cinfo->nports = cinfo->nports =
(int)cy_readl(&board_ctrl->n_channel); (int)readl(&board_ctrl->n_channel);
cinfo->intr_enabled = 1; cinfo->intr_enabled = 1;
} }
} }
...@@ -2701,7 +2691,7 @@ static void cy_wait_until_sent(struct tty_struct *tty, int timeout) ...@@ -2701,7 +2691,7 @@ static void cy_wait_until_sent(struct tty_struct *tty, int timeout)
index = cy_card[card].bus_index; index = cy_card[card].bus_index;
base_addr = 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 (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);
#endif #endif
...@@ -2794,7 +2784,7 @@ static void cy_close(struct tty_struct *tty, struct file *filp) ...@@ -2794,7 +2784,7 @@ static void cy_close(struct tty_struct *tty, struct file *filp)
channel &= 0x03; channel &= 0x03;
cy_writeb(base_addr + (CyCAR << index), (u_char) channel); cy_writeb(base_addr + (CyCAR << index), (u_char) channel);
cy_writeb(base_addr + (CySRER << index), cy_writeb(base_addr + (CySRER << index),
cy_readb(base_addr + (CySRER << index)) & ~CyRxData); 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
the port */ the port */
...@@ -2808,12 +2798,12 @@ static void cy_close(struct tty_struct *tty, struct file *filp) ...@@ -2808,12 +2798,12 @@ static void cy_close(struct tty_struct *tty, struct file *filp)
void __iomem *base_addr = cy_card[info->card].base_addr; void __iomem *base_addr = cy_card[info->card].base_addr;
struct FIRM_ID __iomem *firm_id = base_addr + ID_ADDRESS; struct FIRM_ID __iomem *firm_id = base_addr + ID_ADDRESS;
struct ZFW_CTRL __iomem *zfw_ctrl = struct ZFW_CTRL __iomem *zfw_ctrl =
base_addr + (cy_readl(&firm_id->zfwctrl_addr) & 0xfffff); base_addr + (readl(&firm_id->zfwctrl_addr) & 0xfffff);
struct CH_CTRL __iomem *ch_ctrl = zfw_ctrl->ch_ctrl; struct CH_CTRL __iomem *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;
if (cy_readl(&ch_ctrl[channel].flow_status) != C_FS_TXIDLE) { if (readl(&ch_ctrl[channel].flow_status) != C_FS_TXIDLE) {
retval = cyz_issue_cmd(&cy_card[info->card], channel, retval = cyz_issue_cmd(&cy_card[info->card], channel,
C_CM_IOCTLW, 0L); C_CM_IOCTLW, 0L);
if (retval != 0) { if (retval != 0) {
...@@ -3023,13 +3013,13 @@ static int cy_chars_in_buffer(struct tty_struct *tty) ...@@ -3023,13 +3013,13 @@ static int cy_chars_in_buffer(struct tty_struct *tty)
firm_id = cy_card[card].base_addr + ID_ADDRESS; firm_id = cy_card[card].base_addr + ID_ADDRESS;
zfw_ctrl = cy_card[card].base_addr + zfw_ctrl = cy_card[card].base_addr +
(cy_readl(&firm_id->zfwctrl_addr) & 0xfffff); (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]);
tx_get = cy_readl(&buf_ctrl->tx_get); tx_get = readl(&buf_ctrl->tx_get);
tx_put = cy_readl(&buf_ctrl->tx_put); tx_put = readl(&buf_ctrl->tx_put);
tx_bufsize = cy_readl(&buf_ctrl->tx_bufsize); tx_bufsize = readl(&buf_ctrl->tx_bufsize);
if (tx_put >= tx_get) if (tx_put >= tx_get)
char_count = tx_put - tx_get; char_count = tx_put - tx_get;
else else
...@@ -3269,8 +3259,7 @@ static void set_line_char(struct cyclades_port *info) ...@@ -3269,8 +3259,7 @@ static void set_line_char(struct cyclades_port *info)
if (C_CLOCAL(info->tty)) { if (C_CLOCAL(info->tty)) {
/* without modem intr */ /* without modem intr */
cy_writeb(base_addr + (CySRER << index), cy_writeb(base_addr + (CySRER << index),
cy_readb(base_addr + readb(base_addr + (CySRER << index)) | CyMdmCh);
(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(base_addr + (CyMCOR1 << index), cy_writeb(base_addr + (CyMCOR1 << index),
...@@ -3284,7 +3273,7 @@ static void set_line_char(struct cyclades_port *info) ...@@ -3284,7 +3273,7 @@ static void set_line_char(struct cyclades_port *info)
} else { } else {
/* without modem intr */ /* without modem intr */
cy_writeb(base_addr + (CySRER << index), cy_writeb(base_addr + (CySRER << index),
cy_readb(base_addr + readb(base_addr +
(CySRER << index)) | CyMdmCh); (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) {
...@@ -3311,8 +3300,8 @@ static void set_line_char(struct cyclades_port *info) ...@@ -3311,8 +3300,8 @@ static void set_line_char(struct cyclades_port *info)
#ifdef CY_DEBUG_DTR #ifdef CY_DEBUG_DTR
printk("cyc:set_line_char dropping DTR\n"); printk("cyc:set_line_char dropping DTR\n");
printk(" status: 0x%x, 0x%x\n", printk(" status: 0x%x, 0x%x\n",
cy_readb(base_addr + (CyMSVR1 << index)), readb(base_addr + (CyMSVR1 << index)),
cy_readb(base_addr + (CyMSVR2 << index))); readb(base_addr + (CyMSVR2 << index)));
#endif #endif
} else { } else {
if (info->rtsdtr_inv) { if (info->rtsdtr_inv) {
...@@ -3325,8 +3314,8 @@ static void set_line_char(struct cyclades_port *info) ...@@ -3325,8 +3314,8 @@ static void set_line_char(struct cyclades_port *info)
#ifdef CY_DEBUG_DTR #ifdef CY_DEBUG_DTR
printk("cyc:set_line_char raising DTR\n"); printk("cyc:set_line_char raising DTR\n");
printk(" status: 0x%x, 0x%x\n", printk(" status: 0x%x, 0x%x\n",
cy_readb(base_addr + (CyMSVR1 << index)), readb(base_addr + (CyMSVR1 << index)),
cy_readb(base_addr + (CyMSVR2 << index))); readb(base_addr + (CyMSVR2 << index)));
#endif #endif
} }
...@@ -3350,7 +3339,7 @@ static void set_line_char(struct cyclades_port *info) ...@@ -3350,7 +3339,7 @@ static void set_line_char(struct cyclades_port *info)
} }
zfw_ctrl = cy_card[card].base_addr + zfw_ctrl = cy_card[card].base_addr +
(cy_readl(&firm_id->zfwctrl_addr) & 0xfffff); (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];
...@@ -3401,10 +3390,10 @@ static void set_line_char(struct cyclades_port *info) ...@@ -3401,10 +3390,10 @@ static void set_line_char(struct cyclades_port *info)
} }
if (cflag & CSTOPB) { if (cflag & CSTOPB) {
cy_writel(&ch_ctrl->comm_data_l, cy_writel(&ch_ctrl->comm_data_l,
cy_readl(&ch_ctrl->comm_data_l) | C_DL_2STOP); readl(&ch_ctrl->comm_data_l) | C_DL_2STOP);
} else { } else {
cy_writel(&ch_ctrl->comm_data_l, cy_writel(&ch_ctrl->comm_data_l,
cy_readl(&ch_ctrl->comm_data_l) | C_DL_1STOP); readl(&ch_ctrl->comm_data_l) | C_DL_1STOP);
} }
if (cflag & PARENB) { if (cflag & PARENB) {
if (cflag & PARODD) { if (cflag & PARODD) {
...@@ -3419,12 +3408,10 @@ static void set_line_char(struct cyclades_port *info) ...@@ -3419,12 +3408,10 @@ static void set_line_char(struct cyclades_port *info)
/* CTS flow control flag */ /* CTS flow control flag */
if (cflag & CRTSCTS) { if (cflag & CRTSCTS) {
cy_writel(&ch_ctrl->hw_flow, cy_writel(&ch_ctrl->hw_flow,
cy_readl(&ch_ctrl-> readl(&ch_ctrl->hw_flow) | C_RS_CTS | C_RS_RTS);
hw_flow) | C_RS_CTS | C_RS_RTS);
} else { } else {
cy_writel(&ch_ctrl->hw_flow, cy_writel(&ch_ctrl->hw_flow, readl(&ch_ctrl->hw_flow) &
cy_readl(&ch_ctrl-> ~(C_RS_CTS | C_RS_RTS));
hw_flow) & ~(C_RS_CTS | C_RS_RTS));
} }
/* As the HW flow control is done in firmware, the driver /* As the HW flow control is done in firmware, the driver
doesn't need to care about it */ doesn't need to care about it */
...@@ -3454,13 +3441,13 @@ static void set_line_char(struct cyclades_port *info) ...@@ -3454,13 +3441,13 @@ static void set_line_char(struct cyclades_port *info)
if (baud == 0) { /* baud rate is zero, turn off line */ if (baud == 0) { /* baud rate is zero, turn off line */
cy_writel(&ch_ctrl->rs_control, cy_writel(&ch_ctrl->rs_control,
cy_readl(&ch_ctrl->rs_control) & ~C_RS_DTR); readl(&ch_ctrl->rs_control) & ~C_RS_DTR);
#ifdef CY_DEBUG_DTR #ifdef CY_DEBUG_DTR
printk("cyc:set_line_char dropping Z DTR\n"); printk("cyc:set_line_char dropping Z DTR\n");
#endif #endif
} else { } else {
cy_writel(&ch_ctrl->rs_control, cy_writel(&ch_ctrl->rs_control,
cy_readl(&ch_ctrl->rs_control) | C_RS_DTR); readl(&ch_ctrl->rs_control) | C_RS_DTR);
#ifdef CY_DEBUG_DTR #ifdef CY_DEBUG_DTR
printk("cyc:set_line_char raising Z DTR\n"); printk("cyc:set_line_char raising Z DTR\n");
#endif #endif
...@@ -3575,7 +3562,7 @@ static int get_lsr_info(struct cyclades_port *info, unsigned int __user * value) ...@@ -3575,7 +3562,7 @@ static int get_lsr_info(struct cyclades_port *info, unsigned int __user * value)
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)) & status = readb(base_addr + (CySRER << index)) &
(CyTxRdy | CyTxMpty); (CyTxRdy | CyTxMpty);
CY_UNLOCK(info, flags); CY_UNLOCK(info, flags);
result = (status ? 0 : TIOCSER_TEMT); result = (status ? 0 : TIOCSER_TEMT);
...@@ -3614,8 +3601,8 @@ static int cy_tiocmget(struct tty_struct *tty, struct file *file) ...@@ -3614,8 +3601,8 @@ static int cy_tiocmget(struct tty_struct *tty, struct file *file)
CY_LOCK(info, flags); CY_LOCK(info, flags);
cy_writeb(base_addr + (CyCAR << index), (u_char) channel); cy_writeb(base_addr + (CyCAR << index), (u_char) channel);
status = cy_readb(base_addr + (CyMSVR1 << index)); status = readb(base_addr + (CyMSVR1 << index));
status |= cy_readb(base_addr + (CyMSVR2 << index)); status |= readb(base_addr + (CyMSVR2 << index));
CY_UNLOCK(info, flags); CY_UNLOCK(info, flags);
if (info->rtsdtr_inv) { if (info->rtsdtr_inv) {
...@@ -3639,10 +3626,10 @@ static int cy_tiocmget(struct tty_struct *tty, struct file *file) ...@@ -3639,10 +3626,10 @@ static int cy_tiocmget(struct tty_struct *tty, struct file *file)
firm_id = cy_card[card].base_addr + ID_ADDRESS; firm_id = cy_card[card].base_addr + ID_ADDRESS;
if (ISZLOADED(cy_card[card])) { if (ISZLOADED(cy_card[card])) {
zfw_ctrl = cy_card[card].base_addr + zfw_ctrl = cy_card[card].base_addr +
(cy_readl(&firm_id->zfwctrl_addr) & 0xfffff); (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 = readl(&ch_ctrl[channel].rs_status);
result = ((lstatus & C_RS_RTS) ? TIOCM_RTS : 0) | result = ((lstatus & C_RS_RTS) ? TIOCM_RTS : 0) |
((lstatus & C_RS_DTR) ? TIOCM_DTR : 0) | ((lstatus & C_RS_DTR) ? TIOCM_DTR : 0) |
((lstatus & C_RS_DCD) ? TIOCM_CAR : 0) | ((lstatus & C_RS_DCD) ? TIOCM_CAR : 0) |
...@@ -3724,8 +3711,8 @@ cy_tiocmset(struct tty_struct *tty, struct file *file, ...@@ -3724,8 +3711,8 @@ cy_tiocmset(struct tty_struct *tty, struct file *file,
#ifdef CY_DEBUG_DTR #ifdef CY_DEBUG_DTR
printk("cyc:set_modem_info raising DTR\n"); printk("cyc:set_modem_info raising DTR\n");
printk(" status: 0x%x, 0x%x\n", printk(" status: 0x%x, 0x%x\n",
cy_readb(base_addr + (CyMSVR1 << index)), readb(base_addr + (CyMSVR1 << index)),
cy_readb(base_addr + (CyMSVR2 << index))); readb(base_addr + (CyMSVR2 << index)));
#endif #endif
CY_UNLOCK(info, flags); CY_UNLOCK(info, flags);
} }
...@@ -3744,8 +3731,8 @@ cy_tiocmset(struct tty_struct *tty, struct file *file, ...@@ -3744,8 +3731,8 @@ cy_tiocmset(struct tty_struct *tty, struct file *file,
#ifdef CY_DEBUG_DTR #ifdef CY_DEBUG_DTR
printk("cyc:set_modem_info dropping DTR\n"); printk("cyc:set_modem_info dropping DTR\n");
printk(" status: 0x%x, 0x%x\n", printk(" status: 0x%x, 0x%x\n",
cy_readb(base_addr + (CyMSVR1 << index)), readb(base_addr + (CyMSVR1 << index)),
cy_readb(base_addr + (CyMSVR2 << index))); readb(base_addr + (CyMSVR2 << index)));
#endif #endif
CY_UNLOCK(info, flags); CY_UNLOCK(info, flags);
} }
...@@ -3755,29 +3742,29 @@ cy_tiocmset(struct tty_struct *tty, struct file *file, ...@@ -3755,29 +3742,29 @@ cy_tiocmset(struct tty_struct *tty, struct file *file,
firm_id = cy_card[card].base_addr + ID_ADDRESS; firm_id = cy_card[card].base_addr + ID_ADDRESS;
if (ISZLOADED(cy_card[card])) { if (ISZLOADED(cy_card[card])) {
zfw_ctrl = cy_card[card].base_addr + zfw_ctrl = cy_card[card].base_addr +
(cy_readl(&firm_id->zfwctrl_addr) & 0xfffff); (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;
if (set & TIOCM_RTS) { if (set & TIOCM_RTS) {
CY_LOCK(info, flags); CY_LOCK(info, flags);
cy_writel(&ch_ctrl[channel].rs_control, cy_writel(&ch_ctrl[channel].rs_control,
cy_readl(&ch_ctrl[channel]. readl(&ch_ctrl[channel].rs_control) |
rs_control) | C_RS_RTS); C_RS_RTS);
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_writel(&ch_ctrl[channel].rs_control, cy_writel(&ch_ctrl[channel].rs_control,
cy_readl(&ch_ctrl[channel]. readl(&ch_ctrl[channel].rs_control) &
rs_control) & ~C_RS_RTS); ~C_RS_RTS);
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_writel(&ch_ctrl[channel].rs_control, cy_writel(&ch_ctrl[channel].rs_control,
cy_readl(&ch_ctrl[channel]. readl(&ch_ctrl[channel].rs_control) |
rs_control) | C_RS_DTR); C_RS_DTR);
#ifdef CY_DEBUG_DTR #ifdef CY_DEBUG_DTR
printk("cyc:set_modem_info raising Z DTR\n"); printk("cyc:set_modem_info raising Z DTR\n");
#endif #endif
...@@ -3786,8 +3773,8 @@ cy_tiocmset(struct tty_struct *tty, struct file *file, ...@@ -3786,8 +3773,8 @@ 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_writel(&ch_ctrl[channel].rs_control, cy_writel(&ch_ctrl[channel].rs_control,
cy_readl(&ch_ctrl[channel]. readl(&ch_ctrl[channel].rs_control) &
rs_control) & ~C_RS_DTR); ~C_RS_DTR);
#ifdef CY_DEBUG_DTR #ifdef CY_DEBUG_DTR
printk("cyc:set_modem_info clearing Z DTR\n"); printk("cyc:set_modem_info clearing Z DTR\n");
#endif #endif
...@@ -3924,7 +3911,7 @@ get_threshold(struct cyclades_port *info, unsigned long __user * value) ...@@ -3924,7 +3911,7 @@ get_threshold(struct cyclades_port *info, unsigned long __user * value)
base_addr = 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 = readb(base_addr + (CyCOR3 << index)) & CyREC_FIFO;
return put_user(tmp, value); return put_user(tmp, value);
} else { } else {
/* Nothing to do! */ /* Nothing to do! */
...@@ -3984,7 +3971,7 @@ static int get_timeout(struct cyclades_port *info, unsigned long __user * value) ...@@ -3984,7 +3971,7 @@ static int get_timeout(struct cyclades_port *info, unsigned long __user * value)
base_addr = 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 = readb(base_addr + (CyRTPR << index));
return put_user(tmp, value); return put_user(tmp, value);
} else { } else {
/* Nothing to do! */ /* Nothing to do! */
...@@ -4410,7 +4397,7 @@ static void cy_stop(struct tty_struct *tty) ...@@ -4410,7 +4397,7 @@ static void cy_stop(struct tty_struct *tty)
cy_writeb(base_addr + (CyCAR << index), cy_writeb(base_addr + (CyCAR << index),
(u_char)(channel & 0x0003)); /* index channel */ (u_char)(channel & 0x0003)); /* index channel */
cy_writeb(base_addr + (CySRER << index), cy_writeb(base_addr + (CySRER << index),
cy_readb(base_addr + (CySRER << index)) & ~CyTxRdy); readb(base_addr + (CySRER << index)) & ~CyTxRdy);
CY_UNLOCK(info, flags); CY_UNLOCK(info, flags);
} else { } else {
/* Nothing to do! */ /* Nothing to do! */
...@@ -4444,7 +4431,7 @@ static void cy_start(struct tty_struct *tty) ...@@ -4444,7 +4431,7 @@ static void cy_start(struct tty_struct *tty)
CY_LOCK(info, flags); CY_LOCK(info, flags);
cy_writeb(base_addr + (CyCAR << index), (u_char) (channel & 0x0003)); /* index channel */ cy_writeb(base_addr + (CyCAR << index), (u_char) (channel & 0x0003)); /* index channel */
cy_writeb(base_addr + (CySRER << index), cy_writeb(base_addr + (CySRER << index),
cy_readb(base_addr + (CySRER << index)) | CyTxRdy); readb(base_addr + (CySRER << index)) | CyTxRdy);
CY_UNLOCK(info, flags); CY_UNLOCK(info, flags);
} else { } else {
/* Nothing to do! */ /* Nothing to do! */
...@@ -4537,7 +4524,7 @@ cyy_init_card(void __iomem * true_base_addr, int index) ...@@ -4537,7 +4524,7 @@ cyy_init_card(void __iomem * true_base_addr, int index)
base_addr = base_addr =
true_base_addr + (cy_chip_offset[chip_number] << index); true_base_addr + (cy_chip_offset[chip_number] << index);
mdelay(1); mdelay(1);
if (cy_readb(base_addr + (CyCCR << index)) != 0x00) { if (readb(base_addr + (CyCCR << index)) != 0x00) {
/************* /*************
printk(" chip #%d at %#6lx is never idle (CCR != 0)\n", printk(" chip #%d at %#6lx is never idle (CCR != 0)\n",
chip_number, (unsigned long)base_addr); chip_number, (unsigned long)base_addr);
...@@ -4554,7 +4541,7 @@ cyy_init_card(void __iomem * true_base_addr, int index) ...@@ -4554,7 +4541,7 @@ cyy_init_card(void __iomem * true_base_addr, int index)
chip 4 GFRCR register appears at chip 0, there is no chip 4 chip 4 GFRCR register appears at chip 0, there is no chip 4
and this must be a Cyclom-16Y, not a Cyclom-32Ye. and this must be a Cyclom-16Y, not a Cyclom-32Ye.
*/ */
if (chip_number == 4 && cy_readb(true_base_addr + if (chip_number == 4 && readb(true_base_addr +
(cy_chip_offset[0] << index) + (cy_chip_offset[0] << index) +
(CyGFRCR << index)) == 0) { (CyGFRCR << index)) == 0) {
return chip_number; return chip_number;
...@@ -4563,7 +4550,7 @@ cyy_init_card(void __iomem * true_base_addr, int index) ...@@ -4563,7 +4550,7 @@ cyy_init_card(void __iomem * true_base_addr, int index)
cy_writeb(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 (readb(base_addr + (CyGFRCR << index)) == 0x00) {
/* /*
printk(" chip #%d at %#6lx is not responding ", printk(" chip #%d at %#6lx is not responding ",
chip_number, (unsigned long)base_addr); chip_number, (unsigned long)base_addr);
...@@ -4571,7 +4558,7 @@ cyy_init_card(void __iomem * true_base_addr, int index) ...@@ -4571,7 +4558,7 @@ cyy_init_card(void __iomem * true_base_addr, int index)
*/ */
return chip_number; return chip_number;
} }
if ((0xf0 & (cy_readb(base_addr + (CyGFRCR << index)))) != if ((0xf0 & (readb(base_addr + (CyGFRCR << index)))) !=
0x40) { 0x40) {
/* /*
printk(" chip #%d at %#6lx is not valid (GFRCR == " printk(" chip #%d at %#6lx is not valid (GFRCR == "
...@@ -4582,7 +4569,7 @@ cyy_init_card(void __iomem * true_base_addr, int index) ...@@ -4582,7 +4569,7 @@ cyy_init_card(void __iomem * true_base_addr, int index)
return chip_number; return chip_number;
} }
cy_writeb(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 (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). */
...@@ -4595,7 +4582,7 @@ cyy_init_card(void __iomem * true_base_addr, int index) ...@@ -4595,7 +4582,7 @@ cyy_init_card(void __iomem * true_base_addr, int index)
/* /*
printk(" chip #%d at %#6lx is rev 0x%2x\n", printk(" chip #%d at %#6lx is rev 0x%2x\n",
chip_number, (unsigned long)base_addr, chip_number, (unsigned long)base_addr,
cy_readb(base_addr+(CyGFRCR<<index))); readb(base_addr+(CyGFRCR<<index)));
*/ */
} }
return chip_number; return chip_number;
...@@ -4717,14 +4704,14 @@ static int __init cy_detect_isa(void) ...@@ -4717,14 +4704,14 @@ static int __init cy_detect_isa(void)
static void plx_init(void __iomem * addr, __u32 initctl) static void plx_init(void __iomem * addr, __u32 initctl)
{ {
/* Reset PLX */ /* Reset PLX */
cy_writel(addr + initctl, cy_readl(addr + initctl) | 0x40000000); cy_writel(addr + initctl, readl(addr + initctl) | 0x40000000);
udelay(100L); udelay(100L);
cy_writel(addr + initctl, cy_readl(addr + initctl) & ~0x40000000); cy_writel(addr + initctl, readl(addr + initctl) & ~0x40000000);
/* Reload Config. Registers from EEPROM */ /* Reload Config. Registers from EEPROM */
cy_writel(addr + initctl, cy_readl(addr + initctl) | 0x20000000); cy_writel(addr + initctl, readl(addr + initctl) | 0x20000000);
udelay(100L); udelay(100L);
cy_writel(addr + initctl, cy_readl(addr + initctl) & ~0x20000000); cy_writel(addr + initctl, readl(addr + initctl) & ~0x20000000);
} }
/* /*
...@@ -4879,7 +4866,7 @@ static int __init cy_detect_pci(void) ...@@ -4879,7 +4866,7 @@ static int __init cy_detect_pci(void)
cy_card[j].pdev = pdev; cy_card[j].pdev = pdev;
/* enable interrupts in the PCI interface */ /* enable interrupts in the PCI interface */
plx_ver = cy_readb(cy_pci_addr2 + CyPLX_VER) & 0x0f; plx_ver = readb(cy_pci_addr2 + CyPLX_VER) & 0x0f;
switch (plx_ver) { switch (plx_ver) {
case PLX_9050: case PLX_9050:
...@@ -4900,8 +4887,7 @@ static int __init cy_detect_pci(void) ...@@ -4900,8 +4887,7 @@ static int __init cy_detect_pci(void)
cy_pci_irq); cy_pci_irq);
cy_writew(cy_pci_addr0 + 0x68, cy_writew(cy_pci_addr0 + 0x68,
cy_readw(cy_pci_addr0 + readw(cy_pci_addr0 + 0x68) | 0x0900);
0x68) | 0x0900);
break; break;
} }
...@@ -4940,7 +4926,7 @@ static int __init cy_detect_pci(void) ...@@ -4940,7 +4926,7 @@ static int __init cy_detect_pci(void)
/* 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,
cy_readw(cy_pci_addr0 + 0x68) & ~0x0900); readw(cy_pci_addr0 + 0x68) & ~0x0900);
plx_init(cy_pci_addr0, 0x6c); plx_init(cy_pci_addr0, 0x6c);
/* For some yet unknown reason, once the PLX9060 reloads /* For some yet unknown reason, once the PLX9060 reloads
...@@ -4951,9 +4937,8 @@ static int __init cy_detect_pci(void) ...@@ -4951,9 +4937,8 @@ static int __init cy_detect_pci(void)
pci_write_config_byte(pdev, PCI_INTERRUPT_LINE, pci_write_config_byte(pdev, PCI_INTERRUPT_LINE,
cy_pci_irq); cy_pci_irq);
mailbox = mailbox = (__u32)readl(&((struct RUNTIME_9060 __iomem *)
(__u32)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) {
printk(" Warning: PCI I/O bit incorrectly " printk(" Warning: PCI I/O bit incorrectly "
...@@ -5005,10 +4990,10 @@ static int __init cy_detect_pci(void) ...@@ -5005,10 +4990,10 @@ static int __init cy_detect_pci(void)
WIN_CREG); WIN_CREG);
printk("Cyclades-8Zo/PCI: FPGA id %lx, ver " printk("Cyclades-8Zo/PCI: FPGA id %lx, ver "
"%lx\n", (ulong) (0xff & "%lx\n", (ulong) (0xff &
cy_readl(&((struct CUSTOM_REG *) readl(&((struct CUSTOM_REG *)
(cy_pci_addr2))->fpga_id)), (cy_pci_addr2))->fpga_id)),
(ulong)(0xff & (ulong)(0xff &
cy_readl(&((struct CUSTOM_REG *) readl(&((struct CUSTOM_REG *)
(cy_pci_addr2))-> (cy_pci_addr2))->
fpga_version))); fpga_version)));
cy_writel(&((struct RUNTIME_9060 *) cy_writel(&((struct RUNTIME_9060 *)
...@@ -5113,7 +5098,7 @@ static int __init cy_detect_pci(void) ...@@ -5113,7 +5098,7 @@ static int __init cy_detect_pci(void)
Ze_pdev[j] = Ze_pdev[j + 1]; Ze_pdev[j] = Ze_pdev[j + 1];
} }
ZeIndex--; ZeIndex--;
mailbox = (__u32)cy_readl(&((struct RUNTIME_9060 __iomem *) mailbox = (__u32)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",
...@@ -5382,7 +5367,7 @@ static int __init cy_init(void) ...@@ -5382,7 +5367,7 @@ static int __init 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 __iomem *) mailbox = readl(&((struct RUNTIME_9060 __iomem *)
cy_card[board].ctl_addr)-> cy_card[board].ctl_addr)->
mail_box_0); mail_box_0);
nports = (mailbox == ZE_V1) ? ZE_V1_NPORTS : 8; nports = (mailbox == ZE_V1) ? ZE_V1_NPORTS : 8;
...@@ -5478,7 +5463,7 @@ static int __init cy_init(void) ...@@ -5478,7 +5463,7 @@ static int __init cy_init(void)
info->icount.overrun = info->icount.brk = 0; info->icount.overrun = info->icount.brk = 0;
chip_number = (port - cinfo->first_line) / 4; chip_number = (port - cinfo->first_line) / 4;
if ((info->chip_rev = if ((info->chip_rev =
cy_readb(cinfo->base_addr + readb(cinfo->base_addr +
(cy_chip_offset[chip_number] << (cy_chip_offset[chip_number] <<
index) + (CyGFRCR << index))) >= index) + (CyGFRCR << index))) >=
CD1400_REV_J) { CD1400_REV_J) {
......
...@@ -539,13 +539,9 @@ struct cyclades_chip { ...@@ -539,13 +539,9 @@ struct cyclades_chip {
* (required to support Alpha systems) * * (required to support Alpha systems) *
***************************************/ ***************************************/
#define cy_writeb(port,val) {writeb((val),(port)); mb();} #define cy_writeb(port,val) do { writeb((val), (port)); mb(); } while (0)
#define cy_writew(port,val) {writew((val),(port)); mb();} #define cy_writew(port,val) do { writew((val), (port)); mb(); } while (0)
#define cy_writel(port,val) {writel((val),(port)); mb();} #define cy_writel(port,val) do { writel((val), (port)); mb(); } while (0)
#define cy_readb(port) readb(port)
#define cy_readw(port) readw(port)
#define cy_readl(port) readl(port)
/* /*
* Statistics counters * Statistics counters
......
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