aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/char/cyclades.c130
1 files changed, 71 insertions, 59 deletions
diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c
index cf191cc1c921..c9a503f4724a 100644
--- a/drivers/char/cyclades.c
+++ b/drivers/char/cyclades.c
@@ -663,15 +663,6 @@
663static void cy_throttle(struct tty_struct *tty); 663static void cy_throttle(struct tty_struct *tty);
664static void cy_send_xchar(struct tty_struct *tty, char ch); 664static void cy_send_xchar(struct tty_struct *tty, char ch);
665 665
666#define IS_CYC_Z(card) ((card).num_chips == (unsigned int)-1)
667
668#define Z_FPGA_CHECK(card) \
669 ((readl(&(card).ctl_addr.p9060->init_ctrl) & (1<<17)) != 0)
670
671#define ISZLOADED(card) ((ZO_V1 == (card).hw_ver || Z_FPGA_CHECK(card)) && \
672 (ZFIRM_ID == readl(&((struct FIRM_ID __iomem *) \
673 ((card).base_addr+ID_ADDRESS))->signature)))
674
675#ifndef SERIAL_XMIT_SIZE 666#ifndef SERIAL_XMIT_SIZE
676#define SERIAL_XMIT_SIZE (min(PAGE_SIZE, 4096)) 667#define SERIAL_XMIT_SIZE (min(PAGE_SIZE, 4096))
677#endif 668#endif
@@ -684,8 +675,6 @@ static void cy_send_xchar(struct tty_struct *tty, char ch);
684#define DRIVER_VERSION 0x02010203 675#define DRIVER_VERSION 0x02010203
685#define RAM_SIZE 0x80000 676#define RAM_SIZE 0x80000
686 677
687#define Z_FPGA_LOADED(X) ((readl(&(X)->init_ctrl) & (1<<17)) != 0)
688
689enum zblock_type { 678enum zblock_type {
690 ZBLOCK_PRG = 0, 679 ZBLOCK_PRG = 0,
691 ZBLOCK_FPGA = 1 680 ZBLOCK_FPGA = 1
@@ -880,6 +869,29 @@ static void cyz_rx_restart(unsigned long);
880static struct timer_list cyz_rx_full_timer[NR_PORTS]; 869static struct timer_list cyz_rx_full_timer[NR_PORTS];
881#endif /* CONFIG_CYZ_INTR */ 870#endif /* CONFIG_CYZ_INTR */
882 871
872static inline bool cy_is_Z(struct cyclades_card *card)
873{
874 return card->num_chips == (unsigned int)-1;
875}
876
877static inline bool __cyz_fpga_loaded(struct RUNTIME_9060 __iomem *ctl_addr)
878{
879 return readl(&ctl_addr->init_ctrl) & (1 << 17);
880}
881
882static inline bool cyz_fpga_loaded(struct cyclades_card *card)
883{
884 return __cyz_fpga_loaded(card->ctl_addr.p9060);
885}
886
887static inline bool cyz_is_loaded(struct cyclades_card *card)
888{
889 struct FIRM_ID __iomem *fw_id = card->base_addr + ID_ADDRESS;
890
891 return (card->hw_ver == ZO_V1 || cyz_fpga_loaded(card)) &&
892 readl(&fw_id->signature) == ZFIRM_ID;
893}
894
883static inline int serial_paranoia_check(struct cyclades_port *info, 895static inline int serial_paranoia_check(struct cyclades_port *info,
884 char *name, const char *routine) 896 char *name, const char *routine)
885{ 897{
@@ -1417,7 +1429,7 @@ cyz_issue_cmd(struct cyclades_card *cinfo,
1417 unsigned int index; 1429 unsigned int index;
1418 1430
1419 firm_id = cinfo->base_addr + ID_ADDRESS; 1431 firm_id = cinfo->base_addr + ID_ADDRESS;
1420 if (!ISZLOADED(*cinfo)) 1432 if (!cyz_is_loaded(cinfo))
1421 return -1; 1433 return -1;
1422 1434
1423 zfw_ctrl = cinfo->base_addr + (readl(&firm_id->zfwctrl_addr) & 0xfffff); 1435 zfw_ctrl = cinfo->base_addr + (readl(&firm_id->zfwctrl_addr) & 0xfffff);
@@ -1725,7 +1737,7 @@ static irqreturn_t cyz_interrupt(int irq, void *dev_id)
1725{ 1737{
1726 struct cyclades_card *cinfo = dev_id; 1738 struct cyclades_card *cinfo = dev_id;
1727 1739
1728 if (unlikely(!ISZLOADED(*cinfo))) { 1740 if (unlikely(!cyz_is_loaded(cinfo))) {
1729#ifdef CY_DEBUG_INTERRUPTS 1741#ifdef CY_DEBUG_INTERRUPTS
1730 printk(KERN_DEBUG "cyz_interrupt: board not yet loaded " 1742 printk(KERN_DEBUG "cyz_interrupt: board not yet loaded "
1731 "(IRQ%d).\n", irq); 1743 "(IRQ%d).\n", irq);
@@ -1773,9 +1785,9 @@ static void cyz_poll(unsigned long arg)
1773 for (card = 0; card < NR_CARDS; card++) { 1785 for (card = 0; card < NR_CARDS; card++) {
1774 cinfo = &cy_card[card]; 1786 cinfo = &cy_card[card];
1775 1787
1776 if (!IS_CYC_Z(*cinfo)) 1788 if (!cy_is_Z(cinfo))
1777 continue; 1789 continue;
1778 if (!ISZLOADED(*cinfo)) 1790 if (!cyz_is_loaded(cinfo))
1779 continue; 1791 continue;
1780 1792
1781 firm_id = cinfo->base_addr + ID_ADDRESS; 1793 firm_id = cinfo->base_addr + ID_ADDRESS;
@@ -1854,7 +1866,7 @@ static int startup(struct cyclades_port *info)
1854 1866
1855 set_line_char(info); 1867 set_line_char(info);
1856 1868
1857 if (!IS_CYC_Z(*card)) { 1869 if (!cy_is_Z(card)) {
1858 chip = channel >> 2; 1870 chip = channel >> 2;
1859 channel &= 0x03; 1871 channel &= 0x03;
1860 index = card->bus_index; 1872 index = card->bus_index;
@@ -1911,7 +1923,7 @@ static int startup(struct cyclades_port *info)
1911 base_addr = card->base_addr; 1923 base_addr = card->base_addr;
1912 1924
1913 firm_id = base_addr + ID_ADDRESS; 1925 firm_id = base_addr + ID_ADDRESS;
1914 if (!ISZLOADED(*card)) 1926 if (!cyz_is_loaded(card))
1915 return -ENODEV; 1927 return -ENODEV;
1916 1928
1917 zfw_ctrl = card->base_addr + 1929 zfw_ctrl = card->base_addr +
@@ -2006,7 +2018,7 @@ static void start_xmit(struct cyclades_port *info)
2006 2018
2007 card = info->card; 2019 card = info->card;
2008 channel = info->line - card->first_line; 2020 channel = info->line - card->first_line;
2009 if (!IS_CYC_Z(*card)) { 2021 if (!cy_is_Z(card)) {
2010 chip = channel >> 2; 2022 chip = channel >> 2;
2011 channel &= 0x03; 2023 channel &= 0x03;
2012 index = card->bus_index; 2024 index = card->bus_index;
@@ -2050,7 +2062,7 @@ static void shutdown(struct cyclades_port *info)
2050 2062
2051 card = info->card; 2063 card = info->card;
2052 channel = info->line - card->first_line; 2064 channel = info->line - card->first_line;
2053 if (!IS_CYC_Z(*card)) { 2065 if (!cy_is_Z(card)) {
2054 chip = channel >> 2; 2066 chip = channel >> 2;
2055 channel &= 0x03; 2067 channel &= 0x03;
2056 index = card->bus_index; 2068 index = card->bus_index;
@@ -2106,7 +2118,7 @@ static void shutdown(struct cyclades_port *info)
2106#endif 2118#endif
2107 2119
2108 firm_id = base_addr + ID_ADDRESS; 2120 firm_id = base_addr + ID_ADDRESS;
2109 if (!ISZLOADED(*card)) 2121 if (!cyz_is_loaded(card))
2110 return; 2122 return;
2111 2123
2112 zfw_ctrl = card->base_addr + 2124 zfw_ctrl = card->base_addr +
@@ -2213,7 +2225,7 @@ block_til_ready(struct tty_struct *tty, struct file *filp,
2213#endif 2225#endif
2214 info->port.blocked_open++; 2226 info->port.blocked_open++;
2215 2227
2216 if (!IS_CYC_Z(*cinfo)) { 2228 if (!cy_is_Z(cinfo)) {
2217 chip = channel >> 2; 2229 chip = channel >> 2;
2218 channel &= 0x03; 2230 channel &= 0x03;
2219 index = cinfo->bus_index; 2231 index = cinfo->bus_index;
@@ -2276,7 +2288,7 @@ block_til_ready(struct tty_struct *tty, struct file *filp,
2276 2288
2277 base_addr = cinfo->base_addr; 2289 base_addr = cinfo->base_addr;
2278 firm_id = base_addr + ID_ADDRESS; 2290 firm_id = base_addr + ID_ADDRESS;
2279 if (!ISZLOADED(*cinfo)) { 2291 if (!cyz_is_loaded(cinfo)) {
2280 __set_current_state(TASK_RUNNING); 2292 __set_current_state(TASK_RUNNING);
2281 remove_wait_queue(&info->port.open_wait, &wait); 2293 remove_wait_queue(&info->port.open_wait, &wait);
2282 return -EINVAL; 2294 return -EINVAL;
@@ -2377,12 +2389,12 @@ static int cy_open(struct tty_struct *tty, struct file *filp)
2377 treat it as absent from the system. This 2389 treat it as absent from the system. This
2378 will make the user pay attention. 2390 will make the user pay attention.
2379 */ 2391 */
2380 if (IS_CYC_Z(*info->card)) { 2392 if (cy_is_Z(info->card)) {
2381 struct cyclades_card *cinfo = info->card; 2393 struct cyclades_card *cinfo = info->card;
2382 struct FIRM_ID __iomem *firm_id = cinfo->base_addr + ID_ADDRESS; 2394 struct FIRM_ID __iomem *firm_id = cinfo->base_addr + ID_ADDRESS;
2383 2395
2384 if (!ISZLOADED(*cinfo)) { 2396 if (!cyz_is_loaded(cinfo)) {
2385 if (cinfo->hw_ver == ZE_V1 && Z_FPGA_CHECK(*cinfo) && 2397 if (cinfo->hw_ver == ZE_V1 && cyz_fpga_loaded(cinfo) &&
2386 readl(&firm_id->signature) == 2398 readl(&firm_id->signature) ==
2387 ZFIRM_HLT) { 2399 ZFIRM_HLT) {
2388 printk(KERN_ERR "cyc:Cyclades-Z Error: you " 2400 printk(KERN_ERR "cyc:Cyclades-Z Error: you "
@@ -2537,7 +2549,7 @@ static void cy_wait_until_sent(struct tty_struct *tty, int timeout)
2537#endif 2549#endif
2538 card = info->card; 2550 card = info->card;
2539 channel = (info->line) - (card->first_line); 2551 channel = (info->line) - (card->first_line);
2540 if (!IS_CYC_Z(*card)) { 2552 if (!cy_is_Z(card)) {
2541 chip = channel >> 2; 2553 chip = channel >> 2;
2542 channel &= 0x03; 2554 channel &= 0x03;
2543 index = card->bus_index; 2555 index = card->bus_index;
@@ -2582,7 +2594,7 @@ static void cy_flush_buffer(struct tty_struct *tty)
2582 info->xmit_cnt = info->xmit_head = info->xmit_tail = 0; 2594 info->xmit_cnt = info->xmit_head = info->xmit_tail = 0;
2583 spin_unlock_irqrestore(&card->card_lock, flags); 2595 spin_unlock_irqrestore(&card->card_lock, flags);
2584 2596
2585 if (IS_CYC_Z(*card)) { /* If it is a Z card, flush the on-board 2597 if (cy_is_Z(card)) { /* If it is a Z card, flush the on-board
2586 buffers as well */ 2598 buffers as well */
2587 spin_lock_irqsave(&card->card_lock, flags); 2599 spin_lock_irqsave(&card->card_lock, flags);
2588 retval = cyz_issue_cmd(card, channel, C_CM_FLUSH_TX, 0L); 2600 retval = cyz_issue_cmd(card, channel, C_CM_FLUSH_TX, 0L);
@@ -2663,7 +2675,7 @@ static void cy_close(struct tty_struct *tty, struct file *filp)
2663 2675
2664 spin_lock_irqsave(&card->card_lock, flags); 2676 spin_lock_irqsave(&card->card_lock, flags);
2665 2677
2666 if (!IS_CYC_Z(*card)) { 2678 if (!cy_is_Z(card)) {
2667 int channel = info->line - card->first_line; 2679 int channel = info->line - card->first_line;
2668 int index = card->bus_index; 2680 int index = card->bus_index;
2669 void __iomem *base_addr = card->base_addr + 2681 void __iomem *base_addr = card->base_addr +
@@ -2883,7 +2895,7 @@ static int cy_chars_in_buffer(struct tty_struct *tty)
2883 channel = (info->line) - (card->first_line); 2895 channel = (info->line) - (card->first_line);
2884 2896
2885#ifdef Z_EXT_CHARS_IN_BUFFER 2897#ifdef Z_EXT_CHARS_IN_BUFFER
2886 if (!IS_CYC_Z(cy_card[card])) { 2898 if (!cy_is_Z(card)) {
2887#endif /* Z_EXT_CHARS_IN_BUFFER */ 2899#endif /* Z_EXT_CHARS_IN_BUFFER */
2888#ifdef CY_DEBUG_IO 2900#ifdef CY_DEBUG_IO
2889 printk(KERN_DEBUG "cyc:cy_chars_in_buffer ttyC%d %d\n", 2901 printk(KERN_DEBUG "cyc:cy_chars_in_buffer ttyC%d %d\n",
@@ -2996,7 +3008,7 @@ static void set_line_char(struct cyclades_port *info)
2996 channel = info->line - card->first_line; 3008 channel = info->line - card->first_line;
2997 chip_number = channel / 4; 3009 chip_number = channel / 4;
2998 3010
2999 if (!IS_CYC_Z(*card)) { 3011 if (!cy_is_Z(card)) {
3000 3012
3001 index = card->bus_index; 3013 index = card->bus_index;
3002 3014
@@ -3221,7 +3233,7 @@ static void set_line_char(struct cyclades_port *info)
3221 int retval; 3233 int retval;
3222 3234
3223 firm_id = card->base_addr + ID_ADDRESS; 3235 firm_id = card->base_addr + ID_ADDRESS;
3224 if (!ISZLOADED(*card)) 3236 if (!cyz_is_loaded(card))
3225 return; 3237 return;
3226 3238
3227 zfw_ctrl = card->base_addr + 3239 zfw_ctrl = card->base_addr +
@@ -3438,7 +3450,7 @@ static int get_lsr_info(struct cyclades_port *info, unsigned int __user *value)
3438 3450
3439 card = info->card; 3451 card = info->card;
3440 channel = (info->line) - (card->first_line); 3452 channel = (info->line) - (card->first_line);
3441 if (!IS_CYC_Z(*card)) { 3453 if (!cy_is_Z(card)) {
3442 chip = channel >> 2; 3454 chip = channel >> 2;
3443 channel &= 0x03; 3455 channel &= 0x03;
3444 index = card->bus_index; 3456 index = card->bus_index;
@@ -3478,7 +3490,7 @@ static int cy_tiocmget(struct tty_struct *tty, struct file *file)
3478 3490
3479 card = info->card; 3491 card = info->card;
3480 channel = info->line - card->first_line; 3492 channel = info->line - card->first_line;
3481 if (!IS_CYC_Z(*card)) { 3493 if (!cy_is_Z(card)) {
3482 chip = channel >> 2; 3494 chip = channel >> 2;
3483 channel &= 0x03; 3495 channel &= 0x03;
3484 index = card->bus_index; 3496 index = card->bus_index;
@@ -3504,7 +3516,7 @@ static int cy_tiocmget(struct tty_struct *tty, struct file *file)
3504 } else { 3516 } else {
3505 base_addr = card->base_addr; 3517 base_addr = card->base_addr;
3506 firm_id = card->base_addr + ID_ADDRESS; 3518 firm_id = card->base_addr + ID_ADDRESS;
3507 if (ISZLOADED(*card)) { 3519 if (cyz_is_loaded(card)) {
3508 zfw_ctrl = card->base_addr + 3520 zfw_ctrl = card->base_addr +
3509 (readl(&firm_id->zfwctrl_addr) & 0xfffff); 3521 (readl(&firm_id->zfwctrl_addr) & 0xfffff);
3510 board_ctrl = &zfw_ctrl->board_ctrl; 3522 board_ctrl = &zfw_ctrl->board_ctrl;
@@ -3547,7 +3559,7 @@ cy_tiocmset(struct tty_struct *tty, struct file *file,
3547 3559
3548 card = info->card; 3560 card = info->card;
3549 channel = (info->line) - (card->first_line); 3561 channel = (info->line) - (card->first_line);
3550 if (!IS_CYC_Z(*card)) { 3562 if (!cy_is_Z(card)) {
3551 chip = channel >> 2; 3563 chip = channel >> 2;
3552 channel &= 0x03; 3564 channel &= 0x03;
3553 index = card->bus_index; 3565 index = card->bus_index;
@@ -3622,7 +3634,7 @@ cy_tiocmset(struct tty_struct *tty, struct file *file,
3622 base_addr = card->base_addr; 3634 base_addr = card->base_addr;
3623 3635
3624 firm_id = card->base_addr + ID_ADDRESS; 3636 firm_id = card->base_addr + ID_ADDRESS;
3625 if (ISZLOADED(*card)) { 3637 if (cyz_is_loaded(card)) {
3626 zfw_ctrl = card->base_addr + 3638 zfw_ctrl = card->base_addr +
3627 (readl(&firm_id->zfwctrl_addr) & 0xfffff); 3639 (readl(&firm_id->zfwctrl_addr) & 0xfffff);
3628 board_ctrl = &zfw_ctrl->board_ctrl; 3640 board_ctrl = &zfw_ctrl->board_ctrl;
@@ -3694,7 +3706,7 @@ static int cy_break(struct tty_struct *tty, int break_state)
3694 card = info->card; 3706 card = info->card;
3695 3707
3696 spin_lock_irqsave(&card->card_lock, flags); 3708 spin_lock_irqsave(&card->card_lock, flags);
3697 if (!IS_CYC_Z(*card)) { 3709 if (!cy_is_Z(card)) {
3698 /* Let the transmit ISR take care of this (since it 3710 /* Let the transmit ISR take care of this (since it
3699 requires stuffing characters into the output stream). 3711 requires stuffing characters into the output stream).
3700 */ 3712 */
@@ -3763,7 +3775,7 @@ static int set_threshold(struct cyclades_port *info, unsigned long value)
3763 3775
3764 card = info->card; 3776 card = info->card;
3765 channel = info->line - card->first_line; 3777 channel = info->line - card->first_line;
3766 if (!IS_CYC_Z(*card)) { 3778 if (!cy_is_Z(card)) {
3767 chip = channel >> 2; 3779 chip = channel >> 2;
3768 channel &= 0x03; 3780 channel &= 0x03;
3769 index = card->bus_index; 3781 index = card->bus_index;
@@ -3791,7 +3803,7 @@ static int get_threshold(struct cyclades_port *info,
3791 3803
3792 card = info->card; 3804 card = info->card;
3793 channel = info->line - card->first_line; 3805 channel = info->line - card->first_line;
3794 if (!IS_CYC_Z(*card)) { 3806 if (!cy_is_Z(card)) {
3795 chip = channel >> 2; 3807 chip = channel >> 2;
3796 channel &= 0x03; 3808 channel &= 0x03;
3797 index = card->bus_index; 3809 index = card->bus_index;
@@ -3825,7 +3837,7 @@ static int set_timeout(struct cyclades_port *info, unsigned long value)
3825 3837
3826 card = info->card; 3838 card = info->card;
3827 channel = info->line - card->first_line; 3839 channel = info->line - card->first_line;
3828 if (!IS_CYC_Z(*card)) { 3840 if (!cy_is_Z(card)) {
3829 chip = channel >> 2; 3841 chip = channel >> 2;
3830 channel &= 0x03; 3842 channel &= 0x03;
3831 index = card->bus_index; 3843 index = card->bus_index;
@@ -3848,7 +3860,7 @@ static int get_timeout(struct cyclades_port *info,
3848 3860
3849 card = info->card; 3861 card = info->card;
3850 channel = info->line - card->first_line; 3862 channel = info->line - card->first_line;
3851 if (!IS_CYC_Z(*card)) { 3863 if (!cy_is_Z(card)) {
3852 chip = channel >> 2; 3864 chip = channel >> 2;
3853 channel &= 0x03; 3865 channel &= 0x03;
3854 index = card->bus_index; 3866 index = card->bus_index;
@@ -4102,7 +4114,7 @@ static void cy_send_xchar(struct tty_struct *tty, char ch)
4102 card = info->card; 4114 card = info->card;
4103 channel = info->line - card->first_line; 4115 channel = info->line - card->first_line;
4104 4116
4105 if (IS_CYC_Z(*card)) { 4117 if (cy_is_Z(card)) {
4106 if (ch == STOP_CHAR(tty)) 4118 if (ch == STOP_CHAR(tty))
4107 cyz_issue_cmd(card, channel, C_CM_SENDXOFF, 0L); 4119 cyz_issue_cmd(card, channel, C_CM_SENDXOFF, 0L);
4108 else if (ch == START_CHAR(tty)) 4120 else if (ch == START_CHAR(tty))
@@ -4135,7 +4147,7 @@ static void cy_throttle(struct tty_struct *tty)
4135 card = info->card; 4147 card = info->card;
4136 4148
4137 if (I_IXOFF(tty)) { 4149 if (I_IXOFF(tty)) {
4138 if (!IS_CYC_Z(*card)) 4150 if (!cy_is_Z(card))
4139 cy_send_xchar(tty, STOP_CHAR(tty)); 4151 cy_send_xchar(tty, STOP_CHAR(tty));
4140 else 4152 else
4141 info->throttle = 1; 4153 info->throttle = 1;
@@ -4143,7 +4155,7 @@ static void cy_throttle(struct tty_struct *tty)
4143 4155
4144 if (tty->termios->c_cflag & CRTSCTS) { 4156 if (tty->termios->c_cflag & CRTSCTS) {
4145 channel = info->line - card->first_line; 4157 channel = info->line - card->first_line;
4146 if (!IS_CYC_Z(*card)) { 4158 if (!cy_is_Z(card)) {
4147 chip = channel >> 2; 4159 chip = channel >> 2;
4148 channel &= 0x03; 4160 channel &= 0x03;
4149 index = card->bus_index; 4161 index = card->bus_index;
@@ -4200,7 +4212,7 @@ static void cy_unthrottle(struct tty_struct *tty)
4200 if (tty->termios->c_cflag & CRTSCTS) { 4212 if (tty->termios->c_cflag & CRTSCTS) {
4201 card = info->card; 4213 card = info->card;
4202 channel = info->line - card->first_line; 4214 channel = info->line - card->first_line;
4203 if (!IS_CYC_Z(*card)) { 4215 if (!cy_is_Z(card)) {
4204 chip = channel >> 2; 4216 chip = channel >> 2;
4205 channel &= 0x03; 4217 channel &= 0x03;
4206 index = card->bus_index; 4218 index = card->bus_index;
@@ -4244,7 +4256,7 @@ static void cy_stop(struct tty_struct *tty)
4244 4256
4245 cinfo = info->card; 4257 cinfo = info->card;
4246 channel = info->line - cinfo->first_line; 4258 channel = info->line - cinfo->first_line;
4247 if (!IS_CYC_Z(*cinfo)) { 4259 if (!cy_is_Z(cinfo)) {
4248 index = cinfo->bus_index; 4260 index = cinfo->bus_index;
4249 chip = channel >> 2; 4261 chip = channel >> 2;
4250 channel &= 0x03; 4262 channel &= 0x03;
@@ -4277,7 +4289,7 @@ static void cy_start(struct tty_struct *tty)
4277 cinfo = info->card; 4289 cinfo = info->card;
4278 channel = info->line - cinfo->first_line; 4290 channel = info->line - cinfo->first_line;
4279 index = cinfo->bus_index; 4291 index = cinfo->bus_index;
4280 if (!IS_CYC_Z(*cinfo)) { 4292 if (!cy_is_Z(cinfo)) {
4281 chip = channel >> 2; 4293 chip = channel >> 2;
4282 channel &= 0x03; 4294 channel &= 0x03;
4283 base_addr = cinfo->base_addr + (cy_chip_offset[chip] << index); 4295 base_addr = cinfo->base_addr + (cy_chip_offset[chip] << index);
@@ -4334,7 +4346,7 @@ static int __devinit cy_init_card(struct cyclades_card *cinfo)
4334 4346
4335 spin_lock_init(&cinfo->card_lock); 4347 spin_lock_init(&cinfo->card_lock);
4336 4348
4337 if (IS_CYC_Z(*cinfo)) { /* Cyclades-Z */ 4349 if (cy_is_Z(cinfo)) { /* Cyclades-Z */
4338 nports = (cinfo->hw_ver == ZE_V1) ? ZE_V1_NPORTS : 8; 4350 nports = (cinfo->hw_ver == ZE_V1) ? ZE_V1_NPORTS : 8;
4339 cinfo->intr_enabled = 0; 4351 cinfo->intr_enabled = 0;
4340 cinfo->nports = 0; /* Will be correctly set later, after 4352 cinfo->nports = 0; /* Will be correctly set later, after
@@ -4365,7 +4377,7 @@ static int __devinit cy_init_card(struct cyclades_card *cinfo)
4365 init_completion(&info->shutdown_wait); 4377 init_completion(&info->shutdown_wait);
4366 init_waitqueue_head(&info->delta_msr_wait); 4378 init_waitqueue_head(&info->delta_msr_wait);
4367 4379
4368 if (IS_CYC_Z(*cinfo)) { 4380 if (cy_is_Z(cinfo)) {
4369 info->type = PORT_STARTECH; 4381 info->type = PORT_STARTECH;
4370 if (cinfo->hw_ver == ZO_V1) 4382 if (cinfo->hw_ver == ZO_V1)
4371 info->xmit_fifo_size = CYZ_FIFO_SIZE; 4383 info->xmit_fifo_size = CYZ_FIFO_SIZE;
@@ -4408,7 +4420,7 @@ static int __devinit cy_init_card(struct cyclades_card *cinfo)
4408 } 4420 }
4409 4421
4410#ifndef CONFIG_CYZ_INTR 4422#ifndef CONFIG_CYZ_INTR
4411 if (IS_CYC_Z(*cinfo) && !timer_pending(&cyz_timerlist)) { 4423 if (cy_is_Z(cinfo) && !timer_pending(&cyz_timerlist)) {
4412 mod_timer(&cyz_timerlist, jiffies + 1); 4424 mod_timer(&cyz_timerlist, jiffies + 1);
4413#ifdef CY_PCI_DEBUG 4425#ifdef CY_PCI_DEBUG
4414 printk(KERN_DEBUG "Cyclades-Z polling initialized\n"); 4426 printk(KERN_DEBUG "Cyclades-Z polling initialized\n");
@@ -4771,7 +4783,7 @@ static int __devinit cyz_load_fw(struct pci_dev *pdev, void __iomem *base_addr,
4771 4783
4772 /* Check whether the firmware is already loaded and running. If 4784 /* Check whether the firmware is already loaded and running. If
4773 positive, skip this board */ 4785 positive, skip this board */
4774 if (Z_FPGA_LOADED(ctl_addr) && readl(&fid->signature) == ZFIRM_ID) { 4786 if (__cyz_fpga_loaded(ctl_addr) && readl(&fid->signature) == ZFIRM_ID) {
4775 u32 cntval = readl(base_addr + 0x190); 4787 u32 cntval = readl(base_addr + 0x190);
4776 4788
4777 udelay(100); 4789 udelay(100);
@@ -4790,7 +4802,7 @@ static int __devinit cyz_load_fw(struct pci_dev *pdev, void __iomem *base_addr,
4790 4802
4791 mailbox = readl(&ctl_addr->mail_box_0); 4803 mailbox = readl(&ctl_addr->mail_box_0);
4792 4804
4793 if (mailbox == 0 || Z_FPGA_LOADED(ctl_addr)) { 4805 if (mailbox == 0 || __cyz_fpga_loaded(ctl_addr)) {
4794 /* stops CPU and set window to beginning of RAM */ 4806 /* stops CPU and set window to beginning of RAM */
4795 cy_writel(&ctl_addr->loc_addr_base, WIN_CREG); 4807 cy_writel(&ctl_addr->loc_addr_base, WIN_CREG);
4796 cy_writel(&cust->cpu_stop, 0); 4808 cy_writel(&cust->cpu_stop, 0);
@@ -4806,7 +4818,7 @@ static int __devinit cyz_load_fw(struct pci_dev *pdev, void __iomem *base_addr,
4806 base_addr); 4818 base_addr);
4807 if (retval) 4819 if (retval)
4808 goto err_rel; 4820 goto err_rel;
4809 if (!Z_FPGA_LOADED(ctl_addr)) { 4821 if (!__cyz_fpga_loaded(ctl_addr)) {
4810 dev_err(&pdev->dev, "fw upload successful, but fw is " 4822 dev_err(&pdev->dev, "fw upload successful, but fw is "
4811 "not loaded\n"); 4823 "not loaded\n");
4812 goto err_rel; 4824 goto err_rel;
@@ -4865,7 +4877,7 @@ static int __devinit cyz_load_fw(struct pci_dev *pdev, void __iomem *base_addr,
4865 "system before loading the new FW to the " 4877 "system before loading the new FW to the "
4866 "Cyclades-Z.\n"); 4878 "Cyclades-Z.\n");
4867 4879
4868 if (Z_FPGA_LOADED(ctl_addr)) 4880 if (__cyz_fpga_loaded(ctl_addr))
4869 plx_init(pdev, irq, ctl_addr); 4881 plx_init(pdev, irq, ctl_addr);
4870 4882
4871 retval = -EIO; 4883 retval = -EIO;
@@ -4889,7 +4901,7 @@ static int __devinit cyz_load_fw(struct pci_dev *pdev, void __iomem *base_addr,
4889 "check the connection between the Z host card and the " 4901 "check the connection between the Z host card and the "
4890 "serial expanders.\n"); 4902 "serial expanders.\n");
4891 4903
4892 if (Z_FPGA_LOADED(ctl_addr)) 4904 if (__cyz_fpga_loaded(ctl_addr))
4893 plx_init(pdev, irq, ctl_addr); 4905 plx_init(pdev, irq, ctl_addr);
4894 4906
4895 dev_info(&pdev->dev, "Null number of ports detected. Board " 4907 dev_info(&pdev->dev, "Null number of ports detected. Board "
@@ -5156,12 +5168,12 @@ static void __devexit cy_pci_remove(struct pci_dev *pdev)
5156 unsigned int i; 5168 unsigned int i;
5157 5169
5158 /* non-Z with old PLX */ 5170 /* non-Z with old PLX */
5159 if (!IS_CYC_Z(*cinfo) && (readb(cinfo->base_addr + CyPLX_VER) & 0x0f) == 5171 if (!cy_is_Z(cinfo) && (readb(cinfo->base_addr + CyPLX_VER) & 0x0f) ==
5160 PLX_9050) 5172 PLX_9050)
5161 cy_writeb(cinfo->ctl_addr.p9050 + 0x4c, 0); 5173 cy_writeb(cinfo->ctl_addr.p9050 + 0x4c, 0);
5162 else 5174 else
5163#ifndef CONFIG_CYZ_INTR 5175#ifndef CONFIG_CYZ_INTR
5164 if (!IS_CYC_Z(*cinfo)) 5176 if (!cy_is_Z(cinfo))
5165#endif 5177#endif
5166 cy_writew(&cinfo->ctl_addr.p9060->intr_ctrl_stat, 5178 cy_writew(&cinfo->ctl_addr.p9060->intr_ctrl_stat,
5167 readw(&cinfo->ctl_addr.p9060->intr_ctrl_stat) & 5179 readw(&cinfo->ctl_addr.p9060->intr_ctrl_stat) &
@@ -5172,7 +5184,7 @@ static void __devexit cy_pci_remove(struct pci_dev *pdev)
5172 iounmap(cinfo->ctl_addr.p9050); 5184 iounmap(cinfo->ctl_addr.p9050);
5173 if (cinfo->irq 5185 if (cinfo->irq
5174#ifndef CONFIG_CYZ_INTR 5186#ifndef CONFIG_CYZ_INTR
5175 && !IS_CYC_Z(*cinfo) 5187 && !cy_is_Z(cinfo)
5176#endif /* CONFIG_CYZ_INTR */ 5188#endif /* CONFIG_CYZ_INTR */
5177 ) 5189 )
5178 free_irq(cinfo->irq, cinfo); 5190 free_irq(cinfo->irq, cinfo);
@@ -5368,7 +5380,7 @@ static void __exit cy_cleanup_module(void)
5368 iounmap(card->ctl_addr.p9050); 5380 iounmap(card->ctl_addr.p9050);
5369 if (card->irq 5381 if (card->irq
5370#ifndef CONFIG_CYZ_INTR 5382#ifndef CONFIG_CYZ_INTR
5371 && !IS_CYC_Z(*card) 5383 && !cy_is_Z(card)
5372#endif /* CONFIG_CYZ_INTR */ 5384#endif /* CONFIG_CYZ_INTR */
5373 ) 5385 )
5374 free_irq(card->irq, card); 5386 free_irq(card->irq, card);