aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/char/cyclades.c32
-rw-r--r--include/linux/cyclades.h1
2 files changed, 12 insertions, 21 deletions
diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c
index 2cbf74134f1b..cf191cc1c921 100644
--- a/drivers/char/cyclades.c
+++ b/drivers/char/cyclades.c
@@ -668,8 +668,7 @@ static void cy_send_xchar(struct tty_struct *tty, char ch);
668#define Z_FPGA_CHECK(card) \ 668#define Z_FPGA_CHECK(card) \
669 ((readl(&(card).ctl_addr.p9060->init_ctrl) & (1<<17)) != 0) 669 ((readl(&(card).ctl_addr.p9060->init_ctrl) & (1<<17)) != 0)
670 670
671#define ISZLOADED(card) (((ZO_V1 == readl(&(card).ctl_addr.p9060->mail_box_0)) \ 671#define ISZLOADED(card) ((ZO_V1 == (card).hw_ver || Z_FPGA_CHECK(card)) && \
672 || Z_FPGA_CHECK(card)) && \
673 (ZFIRM_ID == readl(&((struct FIRM_ID __iomem *) \ 672 (ZFIRM_ID == readl(&((struct FIRM_ID __iomem *) \
674 ((card).base_addr+ID_ADDRESS))->signature))) 673 ((card).base_addr+ID_ADDRESS))->signature)))
675 674
@@ -1393,8 +1392,6 @@ cyz_fetch_msg(struct cyclades_card *cinfo,
1393 unsigned long loc_doorbell; 1392 unsigned long loc_doorbell;
1394 1393
1395 firm_id = cinfo->base_addr + ID_ADDRESS; 1394 firm_id = cinfo->base_addr + ID_ADDRESS;
1396 if (!ISZLOADED(*cinfo))
1397 return -1;
1398 zfw_ctrl = cinfo->base_addr + (readl(&firm_id->zfwctrl_addr) & 0xfffff); 1395 zfw_ctrl = cinfo->base_addr + (readl(&firm_id->zfwctrl_addr) & 0xfffff);
1399 board_ctrl = &zfw_ctrl->board_ctrl; 1396 board_ctrl = &zfw_ctrl->board_ctrl;
1400 1397
@@ -1619,10 +1616,8 @@ static void cyz_handle_cmd(struct cyclades_card *cinfo)
1619 static struct BOARD_CTRL __iomem *board_ctrl; 1616 static struct BOARD_CTRL __iomem *board_ctrl;
1620 static struct CH_CTRL __iomem *ch_ctrl; 1617 static struct CH_CTRL __iomem *ch_ctrl;
1621 static struct BUF_CTRL __iomem *buf_ctrl; 1618 static struct BUF_CTRL __iomem *buf_ctrl;
1622 __u32 channel; 1619 __u32 channel, param, fw_ver;
1623 __u8 cmd; 1620 __u8 cmd;
1624 __u32 param;
1625 __u32 hw_ver, fw_ver;
1626 int special_count; 1621 int special_count;
1627 int delta_count; 1622 int delta_count;
1628 1623
@@ -1630,7 +1625,6 @@ static void cyz_handle_cmd(struct cyclades_card *cinfo)
1630 zfw_ctrl = cinfo->base_addr + (readl(&firm_id->zfwctrl_addr) & 0xfffff); 1625 zfw_ctrl = cinfo->base_addr + (readl(&firm_id->zfwctrl_addr) & 0xfffff);
1631 board_ctrl = &zfw_ctrl->board_ctrl; 1626 board_ctrl = &zfw_ctrl->board_ctrl;
1632 fw_ver = readl(&board_ctrl->fw_version); 1627 fw_ver = readl(&board_ctrl->fw_version);
1633 hw_ver = readl(&cinfo->ctl_addr.p9060->mail_box_0);
1634 1628
1635 while (cyz_fetch_msg(cinfo, &channel, &cmd, &param) == 1) { 1629 while (cyz_fetch_msg(cinfo, &channel, &cmd, &param) == 1) {
1636 special_count = 0; 1630 special_count = 0;
@@ -2388,11 +2382,9 @@ static int cy_open(struct tty_struct *tty, struct file *filp)
2388 struct FIRM_ID __iomem *firm_id = cinfo->base_addr + ID_ADDRESS; 2382 struct FIRM_ID __iomem *firm_id = cinfo->base_addr + ID_ADDRESS;
2389 2383
2390 if (!ISZLOADED(*cinfo)) { 2384 if (!ISZLOADED(*cinfo)) {
2391 if (((ZE_V1 == readl(&cinfo->ctl_addr.p9060-> 2385 if (cinfo->hw_ver == ZE_V1 && Z_FPGA_CHECK(*cinfo) &&
2392 mail_box_0)) && 2386 readl(&firm_id->signature) ==
2393 Z_FPGA_CHECK(*cinfo)) && 2387 ZFIRM_HLT) {
2394 (ZFIRM_HLT == readl(
2395 &firm_id->signature))) {
2396 printk(KERN_ERR "cyc:Cyclades-Z Error: you " 2388 printk(KERN_ERR "cyc:Cyclades-Z Error: you "
2397 "need an external power supply for " 2389 "need an external power supply for "
2398 "this number of ports.\nFirmware " 2390 "this number of ports.\nFirmware "
@@ -4336,7 +4328,6 @@ static void cy_hangup(struct tty_struct *tty)
4336static int __devinit cy_init_card(struct cyclades_card *cinfo) 4328static int __devinit cy_init_card(struct cyclades_card *cinfo)
4337{ 4329{
4338 struct cyclades_port *info; 4330 struct cyclades_port *info;
4339 u32 uninitialized_var(mailbox);
4340 unsigned int nports, port; 4331 unsigned int nports, port;
4341 unsigned short chip_number; 4332 unsigned short chip_number;
4342 int uninitialized_var(index); 4333 int uninitialized_var(index);
@@ -4344,8 +4335,7 @@ static int __devinit cy_init_card(struct cyclades_card *cinfo)
4344 spin_lock_init(&cinfo->card_lock); 4335 spin_lock_init(&cinfo->card_lock);
4345 4336
4346 if (IS_CYC_Z(*cinfo)) { /* Cyclades-Z */ 4337 if (IS_CYC_Z(*cinfo)) { /* Cyclades-Z */
4347 mailbox = readl(&cinfo->ctl_addr.p9060->mail_box_0); 4338 nports = (cinfo->hw_ver == ZE_V1) ? ZE_V1_NPORTS : 8;
4348 nports = (mailbox == ZE_V1) ? ZE_V1_NPORTS : 8;
4349 cinfo->intr_enabled = 0; 4339 cinfo->intr_enabled = 0;
4350 cinfo->nports = 0; /* Will be correctly set later, after 4340 cinfo->nports = 0; /* Will be correctly set later, after
4351 Z FW is loaded */ 4341 Z FW is loaded */
@@ -4377,7 +4367,7 @@ static int __devinit cy_init_card(struct cyclades_card *cinfo)
4377 4367
4378 if (IS_CYC_Z(*cinfo)) { 4368 if (IS_CYC_Z(*cinfo)) {
4379 info->type = PORT_STARTECH; 4369 info->type = PORT_STARTECH;
4380 if (mailbox == ZO_V1) 4370 if (cinfo->hw_ver == ZO_V1)
4381 info->xmit_fifo_size = CYZ_FIFO_SIZE; 4371 info->xmit_fifo_size = CYZ_FIFO_SIZE;
4382 else 4372 else
4383 info->xmit_fifo_size = 4 * CYZ_FIFO_SIZE; 4373 info->xmit_fifo_size = 4 * CYZ_FIFO_SIZE;
@@ -4932,7 +4922,7 @@ static int __devinit cy_pci_probe(struct pci_dev *pdev,
4932{ 4922{
4933 void __iomem *addr0 = NULL, *addr2 = NULL; 4923 void __iomem *addr0 = NULL, *addr2 = NULL;
4934 char *card_name = NULL; 4924 char *card_name = NULL;
4935 u32 mailbox; 4925 u32 uninitialized_var(mailbox);
4936 unsigned int device_id, nchan = 0, card_no, i; 4926 unsigned int device_id, nchan = 0, card_no, i;
4937 unsigned char plx_ver; 4927 unsigned char plx_ver;
4938 int retval, irq; 4928 int retval, irq;
@@ -5014,7 +5004,7 @@ static int __devinit cy_pci_probe(struct pci_dev *pdev,
5014 5004
5015 plx_init(pdev, irq, addr0); 5005 plx_init(pdev, irq, addr0);
5016 5006
5017 mailbox = (u32)readl(&ctl_addr->mail_box_0); 5007 mailbox = readl(&ctl_addr->mail_box_0);
5018 5008
5019 addr2 = ioremap_nocache(pci_resource_start(pdev, 2), 5009 addr2 = ioremap_nocache(pci_resource_start(pdev, 2),
5020 mailbox == ZE_V1 ? CyPCI_Ze_win : CyPCI_Zwin); 5010 mailbox == ZE_V1 ? CyPCI_Ze_win : CyPCI_Zwin);
@@ -5026,7 +5016,6 @@ static int __devinit cy_pci_probe(struct pci_dev *pdev,
5026 if (mailbox == ZE_V1) { 5016 if (mailbox == ZE_V1) {
5027 card_name = "Cyclades-Ze"; 5017 card_name = "Cyclades-Ze";
5028 5018
5029 readl(&ctl_addr->mail_box_0);
5030 nchan = ZE_V1_NPORTS; 5019 nchan = ZE_V1_NPORTS;
5031 } else { 5020 } else {
5032 card_name = "Cyclades-8Zo"; 5021 card_name = "Cyclades-8Zo";
@@ -5089,6 +5078,8 @@ static int __devinit cy_pci_probe(struct pci_dev *pdev,
5089 } 5078 }
5090 cy_card[card_no].num_chips = nchan / 4; 5079 cy_card[card_no].num_chips = nchan / 4;
5091 } else { 5080 } else {
5081 cy_card[card_no].hw_ver = mailbox;
5082 cy_card[card_no].num_chips = (unsigned int)-1;
5092#ifdef CONFIG_CYZ_INTR 5083#ifdef CONFIG_CYZ_INTR
5093 /* allocate IRQ only if board has an IRQ */ 5084 /* allocate IRQ only if board has an IRQ */
5094 if (irq != 0 && irq != 255) { 5085 if (irq != 0 && irq != 255) {
@@ -5101,7 +5092,6 @@ static int __devinit cy_pci_probe(struct pci_dev *pdev,
5101 } 5092 }
5102 } 5093 }
5103#endif /* CONFIG_CYZ_INTR */ 5094#endif /* CONFIG_CYZ_INTR */
5104 cy_card[card_no].num_chips = (unsigned int)-1;
5105 } 5095 }
5106 5096
5107 /* set cy_card */ 5097 /* set cy_card */
diff --git a/include/linux/cyclades.h b/include/linux/cyclades.h
index 9ae03d5b3590..a14fe3079761 100644
--- a/include/linux/cyclades.h
+++ b/include/linux/cyclades.h
@@ -518,6 +518,7 @@ struct cyclades_card {
518 unsigned int nports; /* Number of ports in the card */ 518 unsigned int nports; /* Number of ports in the card */
519 int bus_index; /* address shift - 0 for ISA, 1 for PCI */ 519 int bus_index; /* address shift - 0 for ISA, 1 for PCI */
520 int intr_enabled; /* FW Interrupt flag - 0 disabled, 1 enabled */ 520 int intr_enabled; /* FW Interrupt flag - 0 disabled, 1 enabled */
521 u32 hw_ver;
521 spinlock_t card_lock; 522 spinlock_t card_lock;
522 struct cyclades_port *ports; 523 struct cyclades_port *ports;
523}; 524};