patch-2.3.99-pre8 linux/drivers/char/cyclades.c
Next file: linux/drivers/char/nwbutton.c
Previous file: linux/drivers/block/xor.c
Back to the patch index
Back to the overall index
- Lines: 932
- Date:
Fri May 12 11:22:31 2000
- Orig file:
v2.3.99-pre7/linux/drivers/char/cyclades.c
- Orig date:
Thu May 11 15:30:06 2000
diff -u --recursive --new-file v2.3.99-pre7/linux/drivers/char/cyclades.c linux/drivers/char/cyclades.c
@@ -1,12 +1,12 @@
#undef BLOCKMOVE
#define Z_WAKE
static char rcsid[] =
-"$Revision: 2.3.2.4 $$Date: 2000/01/17 09:19:40 $";
+"$Revision: 2.3.2.6 $$Date: 2000/05/05 13:56:05 $";
/*
* linux/drivers/char/cyclades.c
*
- * This file contains the driver for the Cyclades Cyclom-Y multiport
+ * This file contains the driver for the Cyclades async multiport
* serial boards.
*
* Initially written by Randolph Bentson <bentson@grieg.seaslug.org>.
@@ -23,14 +23,22 @@
*
* This version supports shared IRQ's (only for PCI boards).
*
- * This module exports the following rs232 io functions:
- * int cy_init(void);
- * int cy_open(struct tty_struct *tty, struct file *filp);
- * and the following functions for modularization.
- * int init_module(void);
- * void cleanup_module(void);
- *
* $Log: cyclades.c,v $
+ * Revision 2.3.2.6 2000/05/05 13:56:05 ivan
+ * Driver now reports physical instead of virtual memory addresses.
+ * Masks were added to some Cyclades-Z read accesses.
+ * Implemented workaround for PLX9050 bug that would cause a system lockup
+ * in certain systems, depending on the MMIO addresses allocated to the
+ * board.
+ * Changed the Tx interrupt programming in the CD1400 chips to boost up
+ * performance (Cyclom-Y only).
+ * Code is now compliant with the new module interface (module_[init|exit]).
+ * Make use of the PCI helper functions to access PCI resources.
+ * Did some code "housekeeping".
+ *
+ * Revision 2.3.2.5 2000/01/19 14:35:33 ivan
+ * Fixed bug in cy_set_termios on CRTSCTS flag turnoff.
+ *
* Revision 2.3.2.4 2000/01/17 09:19:40 ivan
* Fixed SMP locking in Cyclom-Y interrupt handler.
*
@@ -695,7 +703,7 @@
#ifndef SERIAL_XMIT_SIZE
#define SERIAL_XMIT_SIZE (MIN(PAGE_SIZE, 4096))
#endif
-#define WAKEUP_CHARS (SERIAL_XMIT_SIZE-256)
+#define WAKEUP_CHARS 256
#define STD_COM_FLAGS (0)
@@ -706,7 +714,7 @@
static struct tty_driver cy_serial_driver, cy_callout_driver;
static int serial_refcount;
-#ifndef CONFIG_COBALT_27
+#ifdef CONFIG_ISA
/* This is the address lookup table. The driver will probe for
Cyclom-Y/ISA boards at all addresses in here. If you want the
driver to probe addresses at a different address, add it to
@@ -737,7 +745,7 @@
MODULE_PARM(irq, "1-" __MODULE_STRING(NR_CARDS) "i");
#endif
-#endif /* CONFIG_COBALT_27 */
+#endif /* CONFIG_ISA */
/* This is the per-card data structure containing address, irq, number of
channels, etc. This driver supports a maximum of NR_CARDS cards.
@@ -861,12 +869,9 @@
static void cy_start(struct tty_struct *);
static void set_line_char(struct cyclades_port *);
static int cyz_issue_cmd(struct cyclades_card *, uclong, ucchar, uclong);
-#ifndef CONFIG_COBALT_27
+#ifdef CONFIG_ISA
static unsigned detect_isa_irq (volatile ucchar *);
-#endif /* CONFIG_COBALT_27 */
-#ifdef CYCLOM_SHOW_STATUS
-static void show_status(int);
-#endif
+#endif /* CONFIG_ISA */
static int cyclades_get_proc_info(char *, char **, off_t , int , int *, void *);
@@ -877,23 +882,15 @@
static long cyz_polling_cycle = CZ_DEF_POLL;
static int cyz_timeron = 0;
-static struct timer_list cyz_timerlist = {
- function: cyz_poll
+static struct timer_list
+cyz_timerlist = {
+ NULL, NULL, 0, 0, cyz_poll
};
#else /* CONFIG_CYZ_INTR */
static void cyz_rx_restart(unsigned long);
static struct timer_list cyz_rx_full_timer[NR_PORTS];
#endif /* CONFIG_CYZ_INTR */
-/**************************************************
-error = verify_area(VERIFY_WRITE, (void *) arg, sizeof(unsigned long));
-copy_to_user (to, from, count);
-***************************************************************
-error = verify_area(VERIFY_READ, (void *) arg, sizeof(unsigned long *));
-copy_from_user(to, from, count);
-**************************************************/
-
-
static inline int
serial_paranoia_check(struct cyclades_port *info,
kdev_t device, const char *routine)
@@ -1047,7 +1044,8 @@
return(0);
} /* cyy_issue_cmd */
-#ifndef CONFIG_COBALT_27 /* ISA interrupt detection code */
+#ifdef CONFIG_ISA
+/* ISA interrupt detection code */
static unsigned
detect_isa_irq (volatile ucchar *address)
{
@@ -1074,7 +1072,7 @@
cy_writeb((u_long)address + (CyCAR<<index), 0);
cy_writeb((u_long)address + (CySRER<<index),
- cy_readb(address + (CySRER<<index)) | CyTxMpty);
+ cy_readb(address + (CySRER<<index)) | CyTxRdy);
restore_flags(flags);
/* Wait ... */
@@ -1088,7 +1086,7 @@
save_car = cy_readb(address + (CyCAR<<index));
cy_writeb((u_long)address + (CyCAR<<index), (save_xir & 0x3));
cy_writeb((u_long)address + (CySRER<<index),
- cy_readb(address + (CySRER<<index)) & ~CyTxMpty);
+ cy_readb(address + (CySRER<<index)) & ~CyTxRdy);
cy_writeb((u_long)address + (CyTIR<<index), (save_xir & 0x3f));
cy_writeb((u_long)address + (CyCAR<<index), (save_car));
cy_writeb((u_long)address + (Cy_ClrIntr<<index), 0);
@@ -1096,7 +1094,7 @@
return (irq > 0)? irq : 0;
}
-#endif /* CONFIG_COBALT_27 */
+#endif /* CONFIG_ISA */
/* The real interrupt service routine is called
whenever the card wants its hand held--chars
@@ -1319,14 +1317,14 @@
/* validate the port# (as configured and open) */
if( (i < 0) || (NR_PORTS <= i) ){
cy_writeb((u_long)base_addr+(CySRER<<index),
- cy_readb(base_addr+(CySRER<<index)) & ~CyTxMpty);
+ cy_readb(base_addr+(CySRER<<index)) & ~CyTxRdy);
goto txend;
}
info = &cy_port[i];
info->last_active = jiffies;
if(info->tty == 0){
cy_writeb((u_long)base_addr+(CySRER<<index),
- cy_readb(base_addr+(CySRER<<index)) & ~CyTxMpty);
+ cy_readb(base_addr+(CySRER<<index)) & ~CyTxRdy);
goto txdone;
}
@@ -1360,19 +1358,19 @@
if (!info->xmit_cnt){
cy_writeb((u_long)base_addr+(CySRER<<index),
cy_readb(base_addr+(CySRER<<index)) &
- ~CyTxMpty);
+ ~CyTxRdy);
goto txdone;
}
if (info->xmit_buf == 0){
cy_writeb((u_long)base_addr+(CySRER<<index),
cy_readb(base_addr+(CySRER<<index)) &
- ~CyTxMpty);
+ ~CyTxRdy);
goto txdone;
}
if (info->tty->stopped || info->tty->hw_stopped){
cy_writeb((u_long)base_addr+(CySRER<<index),
cy_readb(base_addr+(CySRER<<index)) &
- ~CyTxMpty);
+ ~CyTxRdy);
goto txdone;
}
/* Because the Embedded Transmit Commands have
@@ -1470,7 +1468,7 @@
info->tty->hw_stopped = 0;
cy_writeb((u_long)base_addr+(CySRER<<index),
cy_readb(base_addr+(CySRER<<index)) |
- CyTxMpty);
+ CyTxRdy);
cy_sched_event(info,
Cy_EVENT_WRITE_WAKEUP);
}
@@ -1481,7 +1479,7 @@
info->tty->hw_stopped = 1;
cy_writeb((u_long)base_addr+(CySRER<<index),
cy_readb(base_addr+(CySRER<<index)) &
- ~CyTxMpty);
+ ~CyTxRdy);
}
}
}
@@ -1526,7 +1524,8 @@
return (-1);
}
zfw_ctrl = (struct ZFW_CTRL *)
- (cinfo->base_addr + cy_readl(&firm_id->zfwctrl_addr));
+ (cinfo->base_addr +
+ (cy_readl(&firm_id->zfwctrl_addr) & 0xfffff));
board_ctrl = &zfw_ctrl->board_ctrl;
loc_doorbell = cy_readl(&((struct RUNTIME_9060 *)
@@ -1557,7 +1556,8 @@
return (-1);
}
zfw_ctrl = (struct ZFW_CTRL *)
- (cinfo->base_addr + cy_readl(&firm_id->zfwctrl_addr));
+ (cinfo->base_addr +
+ (cy_readl(&firm_id->zfwctrl_addr) & 0xfffff));
board_ctrl = &zfw_ctrl->board_ctrl;
index = 0;
@@ -1774,7 +1774,8 @@
firm_id = (struct FIRM_ID *)(cinfo->base_addr + ID_ADDRESS);
zfw_ctrl = (struct ZFW_CTRL *)
- (cinfo->base_addr + cy_readl(&firm_id->zfwctrl_addr));
+ (cinfo->base_addr +
+ (cy_readl(&firm_id->zfwctrl_addr) & 0xfffff));
board_ctrl = &(zfw_ctrl->board_ctrl);
fw_ver = cy_readl(&board_ctrl->fw_version);
hw_ver = cy_readl(&((struct RUNTIME_9060 *)(cinfo->ctl_addr))->mail_box_0);
@@ -1951,7 +1952,8 @@
firm_id = (struct FIRM_ID *)(cinfo->base_addr + ID_ADDRESS);
zfw_ctrl = (struct ZFW_CTRL *)
- (cinfo->base_addr + cy_readl(&firm_id->zfwctrl_addr));
+ (cinfo->base_addr +
+ (cy_readl(&firm_id->zfwctrl_addr) & 0xfffff));
board_ctrl = &(zfw_ctrl->board_ctrl);
/* Skip first polling cycle to avoid racing conditions with the FW */
@@ -2091,9 +2093,9 @@
return -ENODEV;
}
- zfw_ctrl =
- (struct ZFW_CTRL *)
- (cy_card[card].base_addr + cy_readl(&firm_id->zfwctrl_addr));
+ zfw_ctrl = (struct ZFW_CTRL *)
+ (cy_card[card].base_addr +
+ (cy_readl(&firm_id->zfwctrl_addr) & 0xfffff));
board_ctrl = &zfw_ctrl->board_ctrl;
ch_ctrl = zfw_ctrl->ch_ctrl;
@@ -2201,7 +2203,7 @@
CY_LOCK(info, flags);
cy_writeb((u_long)base_addr+(CyCAR<<index), channel);
cy_writeb((u_long)base_addr+(CySRER<<index),
- cy_readb(base_addr+(CySRER<<index)) | CyTxMpty);
+ cy_readb(base_addr+(CySRER<<index)) | CyTxRdy);
CY_UNLOCK(info, flags);
} else {
#ifdef CONFIG_CYZ_INTR
@@ -2299,9 +2301,9 @@
return;
}
- zfw_ctrl =
- (struct ZFW_CTRL *)
- (cy_card[card].base_addr + cy_readl(&firm_id->zfwctrl_addr));
+ zfw_ctrl = (struct ZFW_CTRL *)
+ (cy_card[card].base_addr +
+ (cy_readl(&firm_id->zfwctrl_addr) & 0xfffff));
board_ctrl = &(zfw_ctrl->board_ctrl);
ch_ctrl = zfw_ctrl->ch_ctrl;
@@ -2499,9 +2501,8 @@
return -EINVAL;
}
- zfw_ctrl =
- (struct ZFW_CTRL *)
- (base_addr + cy_readl(&firm_id->zfwctrl_addr));
+ zfw_ctrl = (struct ZFW_CTRL *)
+ (base_addr + (cy_readl(&firm_id->zfwctrl_addr) & 0xfffff));
board_ctrl = &zfw_ctrl->board_ctrl;
ch_ctrl = zfw_ctrl->ch_ctrl;
@@ -2758,7 +2759,7 @@
index = cy_card[card].bus_index;
base_addr = (unsigned char *)
(cy_card[card].base_addr + (cy_chip_offset[chip]<<index));
- while (cy_readb(base_addr+(CySRER<<index)) & CyTxMpty) {
+ while (cy_readb(base_addr+(CySRER<<index)) & CyTxRdy) {
#ifdef CY_DEBUG_WAIT_UNTIL_SENT
printk("Not clean (jiff=%lu)...", jiffies);
#endif
@@ -2882,8 +2883,8 @@
unsigned char *base_addr = (unsigned char *)
cy_card[info->card].base_addr;
struct FIRM_ID *firm_id = (struct FIRM_ID *) (base_addr + ID_ADDRESS);
- struct ZFW_CTRL *zfw_ctrl =
- (struct ZFW_CTRL *) (base_addr + cy_readl(&firm_id->zfwctrl_addr));
+ struct ZFW_CTRL *zfw_ctrl = (struct ZFW_CTRL *)
+ (base_addr + (cy_readl(&firm_id->zfwctrl_addr) & 0xfffff));
struct CH_CTRL *ch_ctrl = zfw_ctrl->ch_ctrl;
int channel = info->line - cy_card[info->card].first_line;
int retval;
@@ -3136,8 +3137,9 @@
volatile uclong tx_put, tx_get, tx_bufsize;
firm_id = (struct FIRM_ID *)(cy_card[card].base_addr + ID_ADDRESS);
- zfw_ctrl = (struct ZFW_CTRL *) (cy_card[card].base_addr +
- cy_readl(&firm_id->zfwctrl_addr));
+ zfw_ctrl = (struct ZFW_CTRL *)
+ (cy_card[card].base_addr +
+ (cy_readl(&firm_id->zfwctrl_addr) & 0xfffff));
ch_ctrl = &(zfw_ctrl->ch_ctrl[channel]);
buf_ctrl = &(zfw_ctrl->buf_ctrl[channel]);
@@ -3427,7 +3429,8 @@
}
zfw_ctrl = (struct ZFW_CTRL *)
- (cy_card[card].base_addr + cy_readl(&firm_id->zfwctrl_addr));
+ (cy_card[card].base_addr +
+ (cy_readl(&firm_id->zfwctrl_addr) & 0xfffff));
board_ctrl = &zfw_ctrl->board_ctrl;
ch_ctrl = &(zfw_ctrl->ch_ctrl[channel]);
buf_ctrl = &zfw_ctrl->buf_ctrl[channel];
@@ -3660,7 +3663,8 @@
(cy_card[card].base_addr + ID_ADDRESS);
if (ISZLOADED(cy_card[card])) {
zfw_ctrl = (struct ZFW_CTRL *)
- (cy_card[card].base_addr + cy_readl(&firm_id->zfwctrl_addr));
+ (cy_card[card].base_addr +
+ (cy_readl(&firm_id->zfwctrl_addr) & 0xfffff));
board_ctrl = &zfw_ctrl->board_ctrl;
ch_ctrl = zfw_ctrl->ch_ctrl;
lstatus = cy_readl(&ch_ctrl[channel].rs_status);
@@ -3825,7 +3829,8 @@
(cy_card[card].base_addr + ID_ADDRESS);
if (ISZLOADED(cy_card[card])) {
zfw_ctrl = (struct ZFW_CTRL *)
- (cy_card[card].base_addr + cy_readl(&firm_id->zfwctrl_addr));
+ (cy_card[card].base_addr +
+ (cy_readl(&firm_id->zfwctrl_addr) & 0xfffff));
board_ctrl = &zfw_ctrl->board_ctrl;
ch_ctrl = zfw_ctrl->ch_ctrl;
@@ -4337,7 +4342,7 @@
if ((old_termios->c_cflag & CRTSCTS) &&
!(tty->termios->c_cflag & CRTSCTS)) {
- tty->stopped = 0;
+ tty->hw_stopped = 0;
cy_start(tty);
}
#if 0
@@ -4502,7 +4507,7 @@
cy_writeb((u_long)base_addr+(CyCAR<<index),
(u_char)(channel & 0x0003)); /* index channel */
cy_writeb((u_long)base_addr+(CySRER<<index),
- cy_readb(base_addr+(CySRER<<index)) & ~CyTxMpty);
+ cy_readb(base_addr+(CySRER<<index)) & ~CyTxRdy);
CY_UNLOCK(info, flags);
} else {
// Nothing to do!
@@ -4542,7 +4547,7 @@
cy_writeb((u_long)base_addr+(CyCAR<<index),
(u_char)(channel & 0x0003)); /* index channel */
cy_writeb((u_long)base_addr+(CySRER<<index),
- cy_readb(base_addr+(CySRER<<index)) | CyTxMpty);
+ cy_readb(base_addr+(CySRER<<index)) | CyTxRdy);
CY_UNLOCK(info, flags);
} else {
// Nothing to do!
@@ -4707,7 +4712,6 @@
return chip_number;
} /* cyy_init_card */
-#ifndef CONFIG_COBALT_27
/*
* ---------------------------------------------------------------------
* cy_detect_isa() - Probe for Cyclom-Y/ISA boards.
@@ -4717,6 +4721,7 @@
static int __init
cy_detect_isa(void)
{
+#ifdef CONFIG_ISA
unsigned short cy_isa_irq,nboard;
volatile ucchar *cy_isa_address;
unsigned short i,j,cy_isa_nchan;
@@ -4746,7 +4751,6 @@
}
/* probe for CD1400... */
-
#if !defined(__alpha__)
cy_isa_address = ioremap((ulong)cy_isa_address, CyISA_Ywin);
#endif
@@ -4819,9 +4823,10 @@
cy_next_channel += cy_isa_nchan;
}
return(nboard);
-
+#else
+ return(0);
+#endif /* CONFIG_ISA */
} /* cy_detect_isa */
-#endif /* CONFIG_COBALT_27 */
static void
plx_init(uclong addr, uclong initctl)
@@ -4851,11 +4856,13 @@
struct pci_dev *pdev = NULL;
unsigned char cyy_rev_id;
unsigned char cy_pci_irq = 0;
- uclong cy_pci_addr0, cy_pci_addr1, cy_pci_addr2;
+ uclong cy_pci_phys0, cy_pci_phys2;
+ uclong cy_pci_addr0, cy_pci_addr2;
unsigned short i,j,cy_pci_nchan, plx_ver;
unsigned short device_id,dev_index = 0;
uclong mailbox;
uclong Ze_addr0[NR_CARDS], Ze_addr2[NR_CARDS], ZeIndex = 0;
+ uclong Ze_phys0[NR_CARDS], Ze_phys2[NR_CARDS];
unsigned char Ze_irq[NR_CARDS];
for (i = 0; i < NR_CARDS; i++) {
@@ -4877,10 +4884,9 @@
/* read PCI configuration area */
cy_pci_irq = pdev->irq;
- cy_pci_addr0 = pci_resource_start(pdev, 0);
- cy_pci_addr1 = pci_resource_start(pdev, 1);
- cy_pci_addr2 = pci_resource_start(pdev, 2);
- pci_read_config_byte(pdev, PCI_REVISION_ID, &cyy_rev_id);
+ cy_pci_phys0 = pci_resource_start(pdev, 0);
+ cy_pci_phys2 = pci_resource_start(pdev, 2);
+ pci_read_config_byte(pdev, PCI_REVISION_ID, &cyy_rev_id);
device_id &= ~PCI_DEVICE_ID_MASK;
@@ -4892,13 +4898,13 @@
printk("rev_id=%d) IRQ%d\n",
cyy_rev_id, (int)cy_pci_irq);
printk("Cyclom-Y/PCI:found winaddr=0x%lx ctladdr=0x%lx\n",
- (ulong)cy_pci_addr2, (ulong)cy_pci_addr0);
+ (ulong)cy_pci_phys2, (ulong)cy_pci_phys0);
#endif
- if (pdev->resource[2].flags & ~PCI_BASE_ADDRESS_IO_MASK) {
+ if (pci_resource_flags(pdev, 2) & IORESOURCE_IO) {
printk(" Warning: PCI I/O bit incorrectly set. "
"Ignoring it...\n");
- pdev->resource[2].flags &= PCI_BASE_ADDRESS_IO_MASK;
+ pdev->resource[2].flags &= ~IORESOURCE_IO;
}
#if defined(__alpha__)
@@ -4908,15 +4914,15 @@
printk("rev_id=%d) IRQ%d\n",
cyy_rev_id, (int)cy_pci_irq);
printk("Cyclom-Y/PCI:found winaddr=0x%lx ctladdr=0x%lx\n",
- (ulong)cy_pci_addr2, (ulong)cy_pci_addr0);
+ (ulong)cy_pci_phys2, (ulong)cy_pci_phys0);
printk("Cyclom-Y/PCI not supported for low addresses in "
"Alpha systems.\n");
i--;
continue;
}
#else
- cy_pci_addr0 = (ulong)ioremap(cy_pci_addr0, CyPCI_Yctl);
- cy_pci_addr2 = (ulong)ioremap(cy_pci_addr2, CyPCI_Ywin);
+ cy_pci_addr0 = (ulong)ioremap(cy_pci_phys0, CyPCI_Yctl);
+ cy_pci_addr2 = (ulong)ioremap(cy_pci_phys2, CyPCI_Ywin);
#endif
#ifdef CY_PCI_DEBUG
@@ -4928,13 +4934,13 @@
if(cy_pci_nchan == 0) {
printk("Cyclom-Y PCI host card with ");
printk("no Serial-Modules at 0x%lx.\n",
- (ulong) cy_pci_addr2);
+ (ulong) cy_pci_phys2);
i--;
continue;
}
if((cy_next_channel+cy_pci_nchan) > NR_PORTS) {
printk("Cyclom-Y/PCI found at 0x%lx ",
- (ulong) cy_pci_addr2);
+ (ulong) cy_pci_phys2);
printk("but no channels are available.\n");
printk("Change NR_PORTS in cyclades.c and recompile kernel.\n");
return(i);
@@ -4945,7 +4951,7 @@
}
if (j == NR_CARDS) { /* no more cy_cards available */
printk("Cyclom-Y/PCI found at 0x%lx ",
- (ulong) cy_pci_addr2);
+ (ulong) cy_pci_phys2);
printk("but no more cards can be used.\n");
printk("Change NR_CARDS in cyclades.c and recompile kernel.\n");
return(i);
@@ -4956,13 +4962,15 @@
SA_SHIRQ, "Cyclom-Y", &cy_card[j]))
{
printk("Cyclom-Y/PCI found at 0x%lx ",
- (ulong) cy_pci_addr2);
+ (ulong) cy_pci_phys2);
printk("but could not allocate IRQ%d.\n",
cy_pci_irq);
return(i);
}
/* set cy_card */
+ cy_card[j].base_phys = (ulong)cy_pci_phys2;
+ cy_card[j].ctl_phys = (ulong)cy_pci_phys0;
cy_card[j].base_addr = (ulong)cy_pci_addr2;
cy_card[j].ctl_addr = (ulong)cy_pci_addr0;
cy_card[j].irq = (int) cy_pci_irq;
@@ -4975,10 +4983,7 @@
switch (plx_ver) {
case PLX_9050:
- plx_init(cy_pci_addr0, 0x50);
-
- cy_writew(cy_pci_addr0+0x4c,
- cy_readw(cy_pci_addr0+0x4c)|0x0040);
+ cy_writeb(cy_pci_addr0+0x4c, 0x43);
break;
case PLX_9060:
@@ -5000,8 +5005,8 @@
/* print message */
printk("Cyclom-Y/PCI #%d: 0x%lx-0x%lx, IRQ%d, ",
j+1,
- (ulong)cy_pci_addr2,
- (ulong)(cy_pci_addr2 + CyPCI_Ywin - 1),
+ (ulong)cy_pci_phys2,
+ (ulong)(cy_pci_phys2 + CyPCI_Ywin - 1),
(int)cy_pci_irq);
printk("%d channels starting from port %d.\n",
cy_pci_nchan, cy_next_channel);
@@ -5014,7 +5019,7 @@
printk("rev_id=%d) IRQ%d\n",
cyy_rev_id, (int)cy_pci_irq);
printk("Cyclades-Z/PCI: found winaddr=0x%lx ctladdr=0x%lx\n",
- (ulong)cy_pci_addr2, (ulong)cy_pci_addr0);
+ (ulong)cy_pci_phys2, (ulong)cy_pci_phys0);
printk("Cyclades-Z/PCI not supported for low addresses\n");
break;
}else if (device_id == PCI_DEVICE_ID_CYCLOM_Z_Hi){
@@ -5024,10 +5029,10 @@
printk("rev_id=%d) IRQ%d\n",
cyy_rev_id, (int)cy_pci_irq);
printk("Cyclades-Z/PCI: found winaddr=0x%lx ctladdr=0x%lx\n",
- (ulong)cy_pci_addr2, (ulong)cy_pci_addr0);
+ (ulong)cy_pci_phys2, (ulong)cy_pci_phys0);
#endif
#if !defined(__alpha__)
- cy_pci_addr0 = (ulong)ioremap(cy_pci_addr0, CyPCI_Zctl);
+ cy_pci_addr0 = (ulong)ioremap(cy_pci_phys0, CyPCI_Zctl);
#endif
/* Disable interrupts on the PLX before resetting it */
@@ -5044,21 +5049,23 @@
mailbox = (uclong)cy_readl(&((struct RUNTIME_9060 *)
cy_pci_addr0)->mail_box_0);
- if (pdev->resource[2].flags & ~PCI_BASE_ADDRESS_IO_MASK) {
+ if (pci_resource_flags(pdev, 2) & IORESOURCE_IO) {
printk(" Warning: PCI I/O bit incorrectly set. "
"Ignoring it...\n");
- pdev->resource[2].flags &= PCI_BASE_ADDRESS_IO_MASK;
+ pdev->resource[2].flags &= ~IORESOURCE_IO;
}
if (mailbox == ZE_V1) {
#if !defined(__alpha__)
- cy_pci_addr2 = (ulong)ioremap(cy_pci_addr2, CyPCI_Ze_win);
+ cy_pci_addr2 = (ulong)ioremap(cy_pci_phys2, CyPCI_Ze_win);
#endif
if (ZeIndex == NR_CARDS) {
printk("Cyclades-Ze/PCI found at 0x%lx ",
- (ulong)cy_pci_addr2);
+ (ulong)cy_pci_phys2);
printk("but no more cards can be used.\n");
printk("Change NR_CARDS in cyclades.c and recompile kernel.\n");
} else {
+ Ze_phys0[ZeIndex] = cy_pci_phys0;
+ Ze_phys2[ZeIndex] = cy_pci_phys2;
Ze_addr0[ZeIndex] = cy_pci_addr0;
Ze_addr2[ZeIndex] = cy_pci_addr2;
Ze_irq[ZeIndex] = cy_pci_irq;
@@ -5068,7 +5075,7 @@
continue;
} else {
#if !defined(__alpha__)
- cy_pci_addr2 = (ulong)ioremap(cy_pci_addr2, CyPCI_Zwin);
+ cy_pci_addr2 = (ulong)ioremap(cy_pci_phys2, CyPCI_Zwin);
#endif
}
@@ -5105,7 +5112,7 @@
if((cy_next_channel+cy_pci_nchan) > NR_PORTS) {
printk("Cyclades-8Zo/PCI found at 0x%lx ",
- (ulong)cy_pci_addr2);
+ (ulong)cy_pci_phys2);
printk("but no channels are available.\n");
printk("Change NR_PORTS in cyclades.c and recompile kernel.\n");
return(i);
@@ -5117,7 +5124,7 @@
}
if (j == NR_CARDS) { /* no more cy_cards available */
printk("Cyclades-8Zo/PCI found at 0x%lx ",
- (ulong)cy_pci_addr2);
+ (ulong)cy_pci_phys2);
printk("but no more cards can be used.\n");
printk("Change NR_CARDS in cyclades.c and recompile kernel.\n");
return(i);
@@ -5129,10 +5136,10 @@
if(request_irq(cy_pci_irq, cyz_interrupt,
SA_SHIRQ, "Cyclades-Z", &cy_card[j]))
{
- printk("Could not allocate IRQ%d ",
+ printk("Cyclom-8Zo/PCI found at 0x%lx ",
+ (ulong) cy_pci_phys2);
+ printk("but could not allocate IRQ%d.\n",
cy_pci_irq);
- printk("for Cyclades-8Zo/PCI at 0x%lx.\n",
- (ulong)cy_pci_addr2);
return(i);
}
}
@@ -5140,6 +5147,8 @@
/* set cy_card */
+ cy_card[j].base_phys = cy_pci_phys2;
+ cy_card[j].ctl_phys = cy_pci_phys0;
cy_card[j].base_addr = cy_pci_addr2;
cy_card[j].ctl_addr = cy_pci_addr0;
cy_card[j].irq = (int) cy_pci_irq;
@@ -5152,14 +5161,14 @@
/* don't report IRQ if board is no IRQ */
if( (cy_pci_irq != 0) && (cy_pci_irq != 255) )
printk("Cyclades-8Zo/PCI #%d: 0x%lx-0x%lx, IRQ%d, ",
- j+1,(ulong)cy_pci_addr2,
- (ulong)(cy_pci_addr2 + CyPCI_Zwin - 1),
+ j+1,(ulong)cy_pci_phys2,
+ (ulong)(cy_pci_phys2 + CyPCI_Zwin - 1),
(int)cy_pci_irq);
else
#endif /* CONFIG_CYZ_INTR */
printk("Cyclades-8Zo/PCI #%d: 0x%lx-0x%lx, ",
- j+1,(ulong)cy_pci_addr2,
- (ulong)(cy_pci_addr2 + CyPCI_Zwin - 1));
+ j+1,(ulong)cy_pci_phys2,
+ (ulong)(cy_pci_phys2 + CyPCI_Zwin - 1));
printk("%d channels starting from port %d.\n",
cy_pci_nchan,cy_next_channel);
@@ -5168,10 +5177,14 @@
}
for (; ZeIndex != 0 && i < NR_CARDS; i++) {
+ cy_pci_phys0 = Ze_phys0[0];
+ cy_pci_phys2 = Ze_phys2[0];
cy_pci_addr0 = Ze_addr0[0];
cy_pci_addr2 = Ze_addr2[0];
cy_pci_irq = Ze_irq[0];
for (j = 0 ; j < ZeIndex-1 ; j++) {
+ Ze_phys0[j] = Ze_phys0[j+1];
+ Ze_phys2[j] = Ze_phys2[j+1];
Ze_addr0[j] = Ze_addr0[j+1];
Ze_addr2[j] = Ze_addr2[j+1];
Ze_irq[j] = Ze_irq[j+1];
@@ -5190,7 +5203,7 @@
if((cy_next_channel+cy_pci_nchan) > NR_PORTS) {
printk("Cyclades-Ze/PCI found at 0x%lx ",
- (ulong)cy_pci_addr2);
+ (ulong)cy_pci_phys2);
printk("but no channels are available.\n");
printk("Change NR_PORTS in cyclades.c and recompile kernel.\n");
return(i);
@@ -5202,7 +5215,7 @@
}
if (j == NR_CARDS) { /* no more cy_cards available */
printk("Cyclades-Ze/PCI found at 0x%lx ",
- (ulong)cy_pci_addr2);
+ (ulong)cy_pci_phys2);
printk("but no more cards can be used.\n");
printk("Change NR_CARDS in cyclades.c and recompile kernel.\n");
return(i);
@@ -5214,16 +5227,18 @@
if(request_irq(cy_pci_irq, cyz_interrupt,
SA_SHIRQ, "Cyclades-Z", &cy_card[j]))
{
- printk("Could not allocate IRQ%d ",
+ printk("Cyclom-Ze/PCI found at 0x%lx ",
+ (ulong) cy_pci_phys2);
+ printk("but could not allocate IRQ%d.\n",
cy_pci_irq);
- printk("for Cyclades-Ze/PCI at 0x%lx.\n",
- (ulong) cy_pci_addr2);
return(i);
}
}
#endif /* CONFIG_CYZ_INTR */
/* set cy_card */
+ cy_card[j].base_phys = cy_pci_phys2;
+ cy_card[j].ctl_phys = cy_pci_phys0;
cy_card[j].base_addr = cy_pci_addr2;
cy_card[j].ctl_addr = cy_pci_addr0;
cy_card[j].irq = (int) cy_pci_irq;
@@ -5236,14 +5251,14 @@
/* don't report IRQ if board is no IRQ */
if( (cy_pci_irq != 0) && (cy_pci_irq != 255) )
printk("Cyclades-Ze/PCI #%d: 0x%lx-0x%lx, IRQ%d, ",
- j+1,(ulong)cy_pci_addr2,
- (ulong)(cy_pci_addr2 + CyPCI_Ze_win - 1),
+ j+1,(ulong)cy_pci_phys2,
+ (ulong)(cy_pci_phys2 + CyPCI_Ze_win - 1),
(int)cy_pci_irq);
else
#endif /* CONFIG_CYZ_INTR */
printk("Cyclades-Ze/PCI #%d: 0x%lx-0x%lx, ",
- j+1,(ulong)cy_pci_addr2,
- (ulong)(cy_pci_addr2 + CyPCI_Ze_win - 1));
+ j+1,(ulong)cy_pci_phys2,
+ (ulong)(cy_pci_phys2 + CyPCI_Ze_win - 1));
printk("%d channels starting from port %d.\n",
cy_pci_nchan,cy_next_channel);
@@ -5251,7 +5266,7 @@
}
if (ZeIndex != 0) {
printk("Cyclades-Ze/PCI found at 0x%x ",
- (unsigned int) Ze_addr2[0]);
+ (unsigned int) Ze_phys2[0]);
printk("but no more cards can be used.\n");
printk("Change NR_CARDS in cyclades.c and recompile kernel.\n");
}
@@ -5438,10 +5453,8 @@
availability of cy_card and cy_port data structures and updating
the cy_next_channel. */
-#ifndef CONFIG_COBALT_27
/* look for isa boards */
cy_isa_nboard = cy_detect_isa();
-#endif /* CONFIG_COBALT_27 */
/* look for pci boards */
cy_pci_nboard = cy_detect_pci();
@@ -5568,9 +5581,10 @@
info->icount.frame = info->icount.parity = 0;
info->icount.overrun = info->icount.brk = 0;
chip_number = (port - cinfo->first_line) / 4;
- if ((info->chip_rev = cy_readb(cinfo->base_addr +
- (cy_chip_offset[chip_number]<<index) +
- (CyGFRCR<<index))) >= CD1400_REV_J) {
+ if ((info->chip_rev =
+ cy_readb(cinfo->base_addr +
+ (cy_chip_offset[chip_number]<<index) +
+ (CyGFRCR<<index))) >= CD1400_REV_J) {
/* It is a CD1400 rev. J or later */
info->tbpr = baud_bpr_60[13]; /* Tx BPR */
info->tco = baud_co_60[13]; /* Tx CO */
@@ -5628,16 +5642,8 @@
} /* cy_init */
#ifdef MODULE
-/* See linux/drivers/char/riscom.c for ideas on how to
- pass additional base addresses to the driver!!! */
-int
-init_module(void)
-{
- return(cy_init());
-} /* init_module */
-
void
-cleanup_module(void)
+cy_cleanup_module(void)
{
int i;
int e1, e2;
@@ -5679,13 +5685,18 @@
free_page((unsigned long) tmp_buf);
tmp_buf = NULL;
}
-} /* cleanup_module */
-#else
+} /* cy_cleanup_module */
+
+/* Module entry-points */
+module_init(cy_init);
+module_exit(cy_cleanup_module);
+
+#else /* MODULE */
/* called by linux/init/main.c to parse command line options */
void
cy_setup(char *str, int *ints)
{
-#ifndef CONFIG_COBALT_27
+#ifdef CONFIG_ISA
int i, j;
for (i = 0 ; i < NR_ISA_ADDRS ; i++) {
@@ -5696,110 +5707,7 @@
cy_isa_addresses[i++] = (unsigned char *)(ints[j]);
}
}
-#endif /* CONFIG_COBALT_27 */
-
+#endif /* CONFIG_ISA */
} /* cy_setup */
-#endif
-
-
-#ifdef CYCLOM_SHOW_STATUS
-static void
-show_status(int line_num)
-{
- unsigned char *base_addr;
- int card,chip,channel,index;
- struct cyclades_port * info;
- unsigned long flags;
-
- info = &cy_port[line_num];
- card = info->card;
- index = cy_card[card].bus_index;
- channel = (info->line) - (cy_card[card].first_line);
- chip = channel>>2;
- channel &= 0x03;
- printk(" card %d, chip %d, channel %d\n", card, chip, channel);/**/
-
- printk(" cy_card\n");
- printk(" irq base_addr num_chips first_line = %d %lx %d %d\n",
- cy_card[card].irq, (long)cy_card[card].base_addr,
- cy_card[card].num_chips, cy_card[card].first_line);
-
- printk(" cy_port\n");
- printk(" card line flags = %d %d %x\n",
- info->card, info->line, info->flags);
- printk(" *tty read_status_mask timeout xmit_fifo_size ",
- printk("= %lx %x %x %x\n",
- (long)info->tty, info->read_status_mask,
- info->timeout, info->xmit_fifo_size);
- printk(" cor1,cor2,cor3,cor4,cor5 = %x %x %x %x %x\n",
- info->cor1, info->cor2, info->cor3, info->cor4, info->cor5);
- printk(" tbpr,tco,rbpr,rco = %d %d %d %d\n",
- info->tbpr, info->tco, info->rbpr, info->rco);
- printk(" close_delay event count = %d %d %d\n",
- info->close_delay, info->event, info->count);
- printk(" x_char blocked_open = %x %x\n",
- info->x_char, info->blocked_open);
- printk(" session pgrp open_wait = %lx %lx %lx\n",
- info->session, info->pgrp, (long)info->open_wait);
-
- CY_LOCK(info, flags);
-
- base_addr = (unsigned char*)
- (cy_card[card].base_addr
- + (cy_chip_offset[chip]<<index));
-
-/* Global Registers */
-
- printk(" CyGFRCR %x\n", cy_readb(base_addr + CyGFRCR<<index));
- printk(" CyCAR %x\n", cy_readb(base_addr + CyCAR<<index));
- printk(" CyGCR %x\n", cy_readb(base_addr + CyGCR<<index));
- printk(" CySVRR %x\n", cy_readb(base_addr + CySVRR<<index));
- printk(" CyRICR %x\n", cy_readb(base_addr + CyRICR<<index));
- printk(" CyTICR %x\n", cy_readb(base_addr + CyTICR<<index));
- printk(" CyMICR %x\n", cy_readb(base_addr + CyMICR<<index));
- printk(" CyRIR %x\n", cy_readb(base_addr + CyRIR<<index));
- printk(" CyTIR %x\n", cy_readb(base_addr + CyTIR<<index));
- printk(" CyMIR %x\n", cy_readb(base_addr + CyMIR<<index));
- printk(" CyPPR %x\n", cy_readb(base_addr + CyPPR<<index));
-
- cy_writeb(base_addr + CyCAR<<index, (u_char)channel);
-
-/* Virtual Registers */
-
- printk(" CyRIVR %x\n", cy_readb(base_addr + CyRIVR<<index));
- printk(" CyTIVR %x\n", cy_readb(base_addr + CyTIVR<<index));
- printk(" CyMIVR %x\n", cy_readb(base_addr + CyMIVR<<index));
- printk(" CyMISR %x\n", cy_readb(base_addr + CyMISR<<index));
-
-/* Channel Registers */
-
- printk(" CyCCR %x\n", cy_readb(base_addr + CyCCR<<index));
- printk(" CySRER %x\n", cy_readb(base_addr + CySRER<<index));
- printk(" CyCOR1 %x\n", cy_readb(base_addr + CyCOR1<<index));
- printk(" CyCOR2 %x\n", cy_readb(base_addr + CyCOR2<<index));
- printk(" CyCOR3 %x\n", cy_readb(base_addr + CyCOR3<<index));
- printk(" CyCOR4 %x\n", cy_readb(base_addr + CyCOR4<<index));
- printk(" CyCOR5 %x\n", cy_readb(base_addr + CyCOR5<<index));
- printk(" CyCCSR %x\n", cy_readb(base_addr + CyCCSR<<index));
- printk(" CyRDCR %x\n", cy_readb(base_addr + CyRDCR<<index));
- printk(" CySCHR1 %x\n", cy_readb(base_addr + CySCHR1<<index));
- printk(" CySCHR2 %x\n", cy_readb(base_addr + CySCHR2<<index));
- printk(" CySCHR3 %x\n", cy_readb(base_addr + CySCHR3<<index));
- printk(" CySCHR4 %x\n", cy_readb(base_addr + CySCHR4<<index));
- printk(" CySCRL %x\n", cy_readb(base_addr + CySCRL<<index));
- printk(" CySCRH %x\n", cy_readb(base_addr + CySCRH<<index));
- printk(" CyLNC %x\n", cy_readb(base_addr + CyLNC<<index));
- printk(" CyMCOR1 %x\n", cy_readb(base_addr + CyMCOR1<<index));
- printk(" CyMCOR2 %x\n", cy_readb(base_addr + CyMCOR2<<index));
- printk(" CyRTPR %x\n", cy_readb(base_addr + CyRTPR<<index));
- printk(" CyMSVR1 %x\n", cy_readb(base_addr + CyMSVR1<<index));
- printk(" CyMSVR2 %x\n", cy_readb(base_addr + CyMSVR2<<index));
- printk(" CyRBPR %x\n", cy_readb(base_addr + CyRBPR<<index));
- printk(" CyRCOR %x\n", cy_readb(base_addr + CyRCOR<<index));
- printk(" CyTBPR %x\n", cy_readb(base_addr + CyTBPR<<index));
- printk(" CyTCOR %x\n", cy_readb(base_addr + CyTCOR<<index));
-
- CY_UNLOCK(info, flags);
-} /* show_status */
-#endif
+#endif /* MODULE */
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)