diff options
Diffstat (limited to 'drivers/char/cyclades.c')
-rw-r--r-- | drivers/char/cyclades.c | 323 |
1 files changed, 162 insertions, 161 deletions
diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c index 01c835a466bc..9bec4ef876f2 100644 --- a/drivers/char/cyclades.c +++ b/drivers/char/cyclades.c | |||
@@ -655,12 +655,12 @@ | |||
655 | 655 | ||
656 | #define CY_LOCK(info,flags) \ | 656 | #define CY_LOCK(info,flags) \ |
657 | do { \ | 657 | do { \ |
658 | spin_lock_irqsave(&cy_card[info->card].card_lock, flags); \ | 658 | spin_lock_irqsave(&info->card->card_lock, flags); \ |
659 | } while (0) | 659 | } while (0) |
660 | 660 | ||
661 | #define CY_UNLOCK(info,flags) \ | 661 | #define CY_UNLOCK(info,flags) \ |
662 | do { \ | 662 | do { \ |
663 | spin_unlock_irqrestore(&cy_card[info->card].card_lock, flags); \ | 663 | spin_unlock_irqrestore(&info->card->card_lock, flags); \ |
664 | } while (0) | 664 | } while (0) |
665 | 665 | ||
666 | #include <linux/kernel.h> | 666 | #include <linux/kernel.h> |
@@ -1555,7 +1555,7 @@ static void | |||
1555 | cyz_handle_rx(struct cyclades_port *info, struct CH_CTRL __iomem *ch_ctrl, | 1555 | cyz_handle_rx(struct cyclades_port *info, struct CH_CTRL __iomem *ch_ctrl, |
1556 | struct BUF_CTRL __iomem *buf_ctrl) | 1556 | struct BUF_CTRL __iomem *buf_ctrl) |
1557 | { | 1557 | { |
1558 | struct cyclades_card *cinfo = &cy_card[info->card]; | 1558 | struct cyclades_card *cinfo = info->card; |
1559 | struct tty_struct *tty = info->tty; | 1559 | struct tty_struct *tty = info->tty; |
1560 | int char_count; | 1560 | int char_count; |
1561 | int len; | 1561 | int len; |
@@ -1651,7 +1651,7 @@ static void | |||
1651 | cyz_handle_tx(struct cyclades_port *info, struct CH_CTRL __iomem *ch_ctrl, | 1651 | cyz_handle_tx(struct cyclades_port *info, struct CH_CTRL __iomem *ch_ctrl, |
1652 | struct BUF_CTRL __iomem *buf_ctrl) | 1652 | struct BUF_CTRL __iomem *buf_ctrl) |
1653 | { | 1653 | { |
1654 | struct cyclades_card *cinfo = &cy_card[info->card]; | 1654 | struct cyclades_card *cinfo = info->card; |
1655 | struct tty_struct *tty = info->tty; | 1655 | struct tty_struct *tty = info->tty; |
1656 | char data; | 1656 | char data; |
1657 | int char_count; | 1657 | int char_count; |
@@ -1878,13 +1878,13 @@ static irqreturn_t cyz_interrupt(int irq, void *dev_id) | |||
1878 | static void cyz_rx_restart(unsigned long arg) | 1878 | static void cyz_rx_restart(unsigned long arg) |
1879 | { | 1879 | { |
1880 | struct cyclades_port *info = (struct cyclades_port *)arg; | 1880 | struct cyclades_port *info = (struct cyclades_port *)arg; |
1881 | struct cyclades_card *card = info->card; | ||
1881 | int retval; | 1882 | int retval; |
1882 | int card = info->card; | 1883 | __u32 channel = info->line - card->first_line; |
1883 | __u32 channel = (info->line) - (cy_card[card].first_line); | ||
1884 | unsigned long flags; | 1884 | unsigned long flags; |
1885 | 1885 | ||
1886 | CY_LOCK(info, flags); | 1886 | CY_LOCK(info, flags); |
1887 | retval = cyz_issue_cmd(&cy_card[card], channel, C_CM_INTBACK2, 0L); | 1887 | retval = cyz_issue_cmd(card, channel, C_CM_INTBACK2, 0L); |
1888 | if (retval != 0) { | 1888 | if (retval != 0) { |
1889 | printk(KERN_ERR "cyc:cyz_rx_restart retval on ttyC%d was %x\n", | 1889 | printk(KERN_ERR "cyc:cyz_rx_restart retval on ttyC%d was %x\n", |
1890 | info->line, retval); | 1890 | info->line, retval); |
@@ -1956,14 +1956,15 @@ static void cyz_poll(unsigned long arg) | |||
1956 | */ | 1956 | */ |
1957 | static int startup(struct cyclades_port *info) | 1957 | static int startup(struct cyclades_port *info) |
1958 | { | 1958 | { |
1959 | struct cyclades_card *card; | ||
1959 | unsigned long flags; | 1960 | unsigned long flags; |
1960 | int retval = 0; | 1961 | int retval = 0; |
1961 | void __iomem *base_addr; | 1962 | void __iomem *base_addr; |
1962 | int card, chip, channel, index; | 1963 | int chip, channel, index; |
1963 | unsigned long page; | 1964 | unsigned long page; |
1964 | 1965 | ||
1965 | card = info->card; | 1966 | card = info->card; |
1966 | channel = (info->line) - (cy_card[card].first_line); | 1967 | channel = info->line - card->first_line; |
1967 | 1968 | ||
1968 | page = get_zeroed_page(GFP_KERNEL); | 1969 | page = get_zeroed_page(GFP_KERNEL); |
1969 | if (!page) | 1970 | if (!page) |
@@ -1993,12 +1994,11 @@ static int startup(struct cyclades_port *info) | |||
1993 | 1994 | ||
1994 | set_line_char(info); | 1995 | set_line_char(info); |
1995 | 1996 | ||
1996 | if (!IS_CYC_Z(cy_card[card])) { | 1997 | if (!IS_CYC_Z(*card)) { |
1997 | chip = channel >> 2; | 1998 | chip = channel >> 2; |
1998 | channel &= 0x03; | 1999 | channel &= 0x03; |
1999 | index = cy_card[card].bus_index; | 2000 | index = card->bus_index; |
2000 | base_addr = cy_card[card].base_addr + | 2001 | base_addr = card->base_addr + (cy_chip_offset[chip] << index); |
2001 | (cy_chip_offset[chip] << index); | ||
2002 | 2002 | ||
2003 | #ifdef CY_DEBUG_OPEN | 2003 | #ifdef CY_DEBUG_OPEN |
2004 | printk(KERN_DEBUG "cyc startup card %d, chip %d, channel %d, " | 2004 | printk(KERN_DEBUG "cyc startup card %d, chip %d, channel %d, " |
@@ -2050,14 +2050,14 @@ static int startup(struct cyclades_port *info) | |||
2050 | struct CH_CTRL __iomem *ch_ctrl; | 2050 | struct CH_CTRL __iomem *ch_ctrl; |
2051 | int retval; | 2051 | int retval; |
2052 | 2052 | ||
2053 | base_addr = cy_card[card].base_addr; | 2053 | base_addr = card->base_addr; |
2054 | 2054 | ||
2055 | firm_id = base_addr + ID_ADDRESS; | 2055 | firm_id = base_addr + ID_ADDRESS; |
2056 | if (!ISZLOADED(cy_card[card])) { | 2056 | if (!ISZLOADED(*card)) { |
2057 | return -ENODEV; | 2057 | return -ENODEV; |
2058 | } | 2058 | } |
2059 | 2059 | ||
2060 | zfw_ctrl = cy_card[card].base_addr + | 2060 | zfw_ctrl = card->base_addr + |
2061 | (readl(&firm_id->zfwctrl_addr) & 0xfffff); | 2061 | (readl(&firm_id->zfwctrl_addr) & 0xfffff); |
2062 | board_ctrl = &zfw_ctrl->board_ctrl; | 2062 | board_ctrl = &zfw_ctrl->board_ctrl; |
2063 | ch_ctrl = zfw_ctrl->ch_ctrl; | 2063 | ch_ctrl = zfw_ctrl->ch_ctrl; |
@@ -2088,15 +2088,14 @@ static int startup(struct cyclades_port *info) | |||
2088 | #endif /* CONFIG_CYZ_INTR */ | 2088 | #endif /* CONFIG_CYZ_INTR */ |
2089 | #endif /* Z_WAKE */ | 2089 | #endif /* Z_WAKE */ |
2090 | 2090 | ||
2091 | retval = cyz_issue_cmd(&cy_card[card], channel, C_CM_IOCTL, 0L); | 2091 | retval = cyz_issue_cmd(card, channel, C_CM_IOCTL, 0L); |
2092 | if (retval != 0) { | 2092 | if (retval != 0) { |
2093 | printk(KERN_ERR "cyc:startup(1) retval on ttyC%d was " | 2093 | printk(KERN_ERR "cyc:startup(1) retval on ttyC%d was " |
2094 | "%x\n", info->line, retval); | 2094 | "%x\n", info->line, retval); |
2095 | } | 2095 | } |
2096 | 2096 | ||
2097 | /* Flush RX buffers before raising DTR and RTS */ | 2097 | /* Flush RX buffers before raising DTR and RTS */ |
2098 | retval = cyz_issue_cmd(&cy_card[card], channel, C_CM_FLUSH_RX, | 2098 | retval = cyz_issue_cmd(card, channel, C_CM_FLUSH_RX, 0L); |
2099 | 0L); | ||
2100 | if (retval != 0) { | 2099 | if (retval != 0) { |
2101 | printk(KERN_ERR "cyc:startup(2) retval on ttyC%d was " | 2100 | printk(KERN_ERR "cyc:startup(2) retval on ttyC%d was " |
2102 | "%x\n", info->line, retval); | 2101 | "%x\n", info->line, retval); |
@@ -2107,7 +2106,7 @@ static int startup(struct cyclades_port *info) | |||
2107 | cy_writel(&ch_ctrl[channel].rs_control, | 2106 | cy_writel(&ch_ctrl[channel].rs_control, |
2108 | readl(&ch_ctrl[channel].rs_control) | C_RS_RTS | | 2107 | readl(&ch_ctrl[channel].rs_control) | C_RS_RTS | |
2109 | C_RS_DTR); | 2108 | C_RS_DTR); |
2110 | retval = cyz_issue_cmd(&cy_card[info->card], channel, | 2109 | retval = cyz_issue_cmd(info->card, channel, |
2111 | C_CM_IOCTLM, 0L); | 2110 | C_CM_IOCTLM, 0L); |
2112 | if (retval != 0) { | 2111 | if (retval != 0) { |
2113 | printk(KERN_ERR "cyc:startup(3) retval on ttyC%d was " | 2112 | printk(KERN_ERR "cyc:startup(3) retval on ttyC%d was " |
@@ -2145,18 +2144,18 @@ errout: | |||
2145 | 2144 | ||
2146 | static void start_xmit(struct cyclades_port *info) | 2145 | static void start_xmit(struct cyclades_port *info) |
2147 | { | 2146 | { |
2147 | struct cyclades_card *card; | ||
2148 | unsigned long flags; | 2148 | unsigned long flags; |
2149 | void __iomem *base_addr; | 2149 | void __iomem *base_addr; |
2150 | int card, chip, channel, index; | 2150 | int chip, channel, index; |
2151 | 2151 | ||
2152 | card = info->card; | 2152 | card = info->card; |
2153 | channel = (info->line) - (cy_card[card].first_line); | 2153 | channel = info->line - card->first_line; |
2154 | if (!IS_CYC_Z(cy_card[card])) { | 2154 | if (!IS_CYC_Z(*card)) { |
2155 | chip = channel >> 2; | 2155 | chip = channel >> 2; |
2156 | channel &= 0x03; | 2156 | channel &= 0x03; |
2157 | index = cy_card[card].bus_index; | 2157 | index = card->bus_index; |
2158 | base_addr = cy_card[card].base_addr + | 2158 | base_addr = card->base_addr + (cy_chip_offset[chip] << index); |
2159 | (cy_chip_offset[chip] << index); | ||
2160 | 2159 | ||
2161 | CY_LOCK(info, flags); | 2160 | CY_LOCK(info, flags); |
2162 | cy_writeb(base_addr + (CyCAR << index), channel); | 2161 | cy_writeb(base_addr + (CyCAR << index), channel); |
@@ -2168,8 +2167,7 @@ static void start_xmit(struct cyclades_port *info) | |||
2168 | int retval; | 2167 | int retval; |
2169 | 2168 | ||
2170 | CY_LOCK(info, flags); | 2169 | CY_LOCK(info, flags); |
2171 | retval = cyz_issue_cmd(&cy_card[card], channel, C_CM_INTBACK, | 2170 | retval = cyz_issue_cmd(card, channel, C_CM_INTBACK, 0L); |
2172 | 0L); | ||
2173 | if (retval != 0) { | 2171 | if (retval != 0) { |
2174 | printk(KERN_ERR "cyc:start_xmit retval on ttyC%d was " | 2172 | printk(KERN_ERR "cyc:start_xmit retval on ttyC%d was " |
2175 | "%x\n", info->line, retval); | 2173 | "%x\n", info->line, retval); |
@@ -2187,22 +2185,22 @@ static void start_xmit(struct cyclades_port *info) | |||
2187 | */ | 2185 | */ |
2188 | static void shutdown(struct cyclades_port *info) | 2186 | static void shutdown(struct cyclades_port *info) |
2189 | { | 2187 | { |
2188 | struct cyclades_card *card; | ||
2190 | unsigned long flags; | 2189 | unsigned long flags; |
2191 | void __iomem *base_addr; | 2190 | void __iomem *base_addr; |
2192 | int card, chip, channel, index; | 2191 | int chip, channel, index; |
2193 | 2192 | ||
2194 | if (!(info->flags & ASYNC_INITIALIZED)) { | 2193 | if (!(info->flags & ASYNC_INITIALIZED)) { |
2195 | return; | 2194 | return; |
2196 | } | 2195 | } |
2197 | 2196 | ||
2198 | card = info->card; | 2197 | card = info->card; |
2199 | channel = info->line - cy_card[card].first_line; | 2198 | channel = info->line - card->first_line; |
2200 | if (!IS_CYC_Z(cy_card[card])) { | 2199 | if (!IS_CYC_Z(*card)) { |
2201 | chip = channel >> 2; | 2200 | chip = channel >> 2; |
2202 | channel &= 0x03; | 2201 | channel &= 0x03; |
2203 | index = cy_card[card].bus_index; | 2202 | index = card->bus_index; |
2204 | base_addr = cy_card[card].base_addr + | 2203 | base_addr = card->base_addr + (cy_chip_offset[chip] << index); |
2205 | (cy_chip_offset[chip] << index); | ||
2206 | 2204 | ||
2207 | #ifdef CY_DEBUG_OPEN | 2205 | #ifdef CY_DEBUG_OPEN |
2208 | printk(KERN_DEBUG "cyc shutdown Y card %d, chip %d, " | 2206 | printk(KERN_DEBUG "cyc shutdown Y card %d, chip %d, " |
@@ -2248,18 +2246,18 @@ static void shutdown(struct cyclades_port *info) | |||
2248 | struct CH_CTRL __iomem *ch_ctrl; | 2246 | struct CH_CTRL __iomem *ch_ctrl; |
2249 | int retval; | 2247 | int retval; |
2250 | 2248 | ||
2251 | base_addr = cy_card[card].base_addr; | 2249 | base_addr = card->base_addr; |
2252 | #ifdef CY_DEBUG_OPEN | 2250 | #ifdef CY_DEBUG_OPEN |
2253 | printk(KERN_DEBUG "cyc shutdown Z card %d, channel %d, " | 2251 | printk(KERN_DEBUG "cyc shutdown Z card %d, channel %d, " |
2254 | "base_addr %p\n", card, channel, base_addr); | 2252 | "base_addr %p\n", card, channel, base_addr); |
2255 | #endif | 2253 | #endif |
2256 | 2254 | ||
2257 | firm_id = base_addr + ID_ADDRESS; | 2255 | firm_id = base_addr + ID_ADDRESS; |
2258 | if (!ISZLOADED(cy_card[card])) { | 2256 | if (!ISZLOADED(*card)) { |
2259 | return; | 2257 | return; |
2260 | } | 2258 | } |
2261 | 2259 | ||
2262 | zfw_ctrl = cy_card[card].base_addr + | 2260 | zfw_ctrl = card->base_addr + |
2263 | (readl(&firm_id->zfwctrl_addr) & 0xfffff); | 2261 | (readl(&firm_id->zfwctrl_addr) & 0xfffff); |
2264 | board_ctrl = &zfw_ctrl->board_ctrl; | 2262 | board_ctrl = &zfw_ctrl->board_ctrl; |
2265 | ch_ctrl = zfw_ctrl->ch_ctrl; | 2263 | ch_ctrl = zfw_ctrl->ch_ctrl; |
@@ -2277,7 +2275,7 @@ static void shutdown(struct cyclades_port *info) | |||
2277 | cy_writel(&ch_ctrl[channel].rs_control, | 2275 | cy_writel(&ch_ctrl[channel].rs_control, |
2278 | (__u32)(readl(&ch_ctrl[channel].rs_control) & | 2276 | (__u32)(readl(&ch_ctrl[channel].rs_control) & |
2279 | ~(C_RS_RTS | C_RS_DTR))); | 2277 | ~(C_RS_RTS | C_RS_DTR))); |
2280 | retval = cyz_issue_cmd(&cy_card[info->card], channel, | 2278 | retval = cyz_issue_cmd(info->card, channel, |
2281 | C_CM_IOCTLM, 0L); | 2279 | C_CM_IOCTLM, 0L); |
2282 | if (retval != 0) { | 2280 | if (retval != 0) { |
2283 | printk(KERN_ERR"cyc:shutdown retval on ttyC%d " | 2281 | printk(KERN_ERR"cyc:shutdown retval on ttyC%d " |
@@ -2318,7 +2316,7 @@ block_til_ready(struct tty_struct *tty, struct file *filp, | |||
2318 | int retval; | 2316 | int retval; |
2319 | void __iomem *base_addr; | 2317 | void __iomem *base_addr; |
2320 | 2318 | ||
2321 | cinfo = &cy_card[info->card]; | 2319 | cinfo = info->card; |
2322 | channel = info->line - cinfo->first_line; | 2320 | channel = info->line - cinfo->first_line; |
2323 | 2321 | ||
2324 | /* | 2322 | /* |
@@ -2443,7 +2441,7 @@ block_til_ready(struct tty_struct *tty, struct file *filp, | |||
2443 | cy_writel(&ch_ctrl[channel].rs_control, | 2441 | cy_writel(&ch_ctrl[channel].rs_control, |
2444 | readl(&ch_ctrl[channel].rs_control) | | 2442 | readl(&ch_ctrl[channel].rs_control) | |
2445 | C_RS_RTS | C_RS_DTR); | 2443 | C_RS_RTS | C_RS_DTR); |
2446 | retval = cyz_issue_cmd(&cy_card[info->card], | 2444 | retval = cyz_issue_cmd(info->card, |
2447 | channel, C_CM_IOCTLM, 0L); | 2445 | channel, C_CM_IOCTLM, 0L); |
2448 | if (retval != 0) { | 2446 | if (retval != 0) { |
2449 | printk(KERN_ERR "cyc:block_til_ready " | 2447 | printk(KERN_ERR "cyc:block_til_ready " |
@@ -2522,8 +2520,8 @@ static int cy_open(struct tty_struct *tty, struct file *filp) | |||
2522 | treat it as absent from the system. This | 2520 | treat it as absent from the system. This |
2523 | will make the user pay attention. | 2521 | will make the user pay attention. |
2524 | */ | 2522 | */ |
2525 | if (IS_CYC_Z(cy_card[info->card])) { | 2523 | if (IS_CYC_Z(*info->card)) { |
2526 | struct cyclades_card *cinfo = &cy_card[info->card]; | 2524 | struct cyclades_card *cinfo = info->card; |
2527 | struct FIRM_ID __iomem *firm_id = cinfo->base_addr + ID_ADDRESS; | 2525 | struct FIRM_ID __iomem *firm_id = cinfo->base_addr + ID_ADDRESS; |
2528 | 2526 | ||
2529 | if (!ISZLOADED(*cinfo)) { | 2527 | if (!ISZLOADED(*cinfo)) { |
@@ -2634,9 +2632,10 @@ static int cy_open(struct tty_struct *tty, struct file *filp) | |||
2634 | */ | 2632 | */ |
2635 | static void cy_wait_until_sent(struct tty_struct *tty, int timeout) | 2633 | static void cy_wait_until_sent(struct tty_struct *tty, int timeout) |
2636 | { | 2634 | { |
2635 | struct cyclades_card *card; | ||
2637 | struct cyclades_port *info = tty->driver_data; | 2636 | struct cyclades_port *info = tty->driver_data; |
2638 | void __iomem *base_addr; | 2637 | void __iomem *base_addr; |
2639 | int card, chip, channel, index; | 2638 | int chip, channel, index; |
2640 | unsigned long orig_jiffies; | 2639 | unsigned long orig_jiffies; |
2641 | int char_time; | 2640 | int char_time; |
2642 | 2641 | ||
@@ -2679,13 +2678,12 @@ static void cy_wait_until_sent(struct tty_struct *tty, int timeout) | |||
2679 | timeout, char_time, jiffies); | 2678 | timeout, char_time, jiffies); |
2680 | #endif | 2679 | #endif |
2681 | card = info->card; | 2680 | card = info->card; |
2682 | channel = (info->line) - (cy_card[card].first_line); | 2681 | channel = (info->line) - (card->first_line); |
2683 | if (!IS_CYC_Z(cy_card[card])) { | 2682 | if (!IS_CYC_Z(*card)) { |
2684 | chip = channel >> 2; | 2683 | chip = channel >> 2; |
2685 | channel &= 0x03; | 2684 | channel &= 0x03; |
2686 | index = cy_card[card].bus_index; | 2685 | index = card->bus_index; |
2687 | base_addr = | 2686 | base_addr = card->base_addr + (cy_chip_offset[chip] << index); |
2688 | cy_card[card].base_addr + (cy_chip_offset[chip] << index); | ||
2689 | while (readb(base_addr + (CySRER << index)) & CyTxRdy) { | 2687 | while (readb(base_addr + (CySRER << index)) & CyTxRdy) { |
2690 | #ifdef CY_DEBUG_WAIT_UNTIL_SENT | 2688 | #ifdef CY_DEBUG_WAIT_UNTIL_SENT |
2691 | printk(KERN_DEBUG "Not clean (jiff=%lu)...", jiffies); | 2689 | printk(KERN_DEBUG "Not clean (jiff=%lu)...", jiffies); |
@@ -2771,10 +2769,10 @@ static void cy_close(struct tty_struct *tty, struct file *filp) | |||
2771 | } | 2769 | } |
2772 | CY_LOCK(info, flags); | 2770 | CY_LOCK(info, flags); |
2773 | 2771 | ||
2774 | if (!IS_CYC_Z(cy_card[info->card])) { | 2772 | if (!IS_CYC_Z(*info->card)) { |
2775 | int channel = info->line - cy_card[info->card].first_line; | 2773 | int channel = info->line - info->card->first_line; |
2776 | int index = cy_card[info->card].bus_index; | 2774 | int index = info->card->bus_index; |
2777 | void __iomem *base_addr = cy_card[info->card].base_addr + | 2775 | void __iomem *base_addr = info->card->base_addr + |
2778 | (cy_chip_offset[channel >> 2] << index); | 2776 | (cy_chip_offset[channel >> 2] << index); |
2779 | /* Stop accepting input */ | 2777 | /* Stop accepting input */ |
2780 | channel &= 0x03; | 2778 | channel &= 0x03; |
@@ -2791,16 +2789,16 @@ static void cy_close(struct tty_struct *tty, struct file *filp) | |||
2791 | } else { | 2789 | } else { |
2792 | #ifdef Z_WAKE | 2790 | #ifdef Z_WAKE |
2793 | /* Waiting for on-board buffers to be empty before closing the port */ | 2791 | /* Waiting for on-board buffers to be empty before closing the port */ |
2794 | void __iomem *base_addr = cy_card[info->card].base_addr; | 2792 | void __iomem *base_addr = info->card->base_addr; |
2795 | struct FIRM_ID __iomem *firm_id = base_addr + ID_ADDRESS; | 2793 | struct FIRM_ID __iomem *firm_id = base_addr + ID_ADDRESS; |
2796 | struct ZFW_CTRL __iomem *zfw_ctrl = | 2794 | struct ZFW_CTRL __iomem *zfw_ctrl = |
2797 | base_addr + (readl(&firm_id->zfwctrl_addr) & 0xfffff); | 2795 | base_addr + (readl(&firm_id->zfwctrl_addr) & 0xfffff); |
2798 | struct CH_CTRL __iomem *ch_ctrl = zfw_ctrl->ch_ctrl; | 2796 | struct CH_CTRL __iomem *ch_ctrl = zfw_ctrl->ch_ctrl; |
2799 | int channel = info->line - cy_card[info->card].first_line; | 2797 | int channel = info->line - info->card->first_line; |
2800 | int retval; | 2798 | int retval; |
2801 | 2799 | ||
2802 | if (readl(&ch_ctrl[channel].flow_status) != C_FS_TXIDLE) { | 2800 | if (readl(&ch_ctrl[channel].flow_status) != C_FS_TXIDLE) { |
2803 | retval = cyz_issue_cmd(&cy_card[info->card], channel, | 2801 | retval = cyz_issue_cmd(info->card, channel, |
2804 | C_CM_IOCTLW, 0L); | 2802 | C_CM_IOCTLW, 0L); |
2805 | if (retval != 0) { | 2803 | if (retval != 0) { |
2806 | printk(KERN_DEBUG "cyc:cy_close retval on " | 2804 | printk(KERN_DEBUG "cyc:cy_close retval on " |
@@ -2982,14 +2980,15 @@ static int cy_write_room(struct tty_struct *tty) | |||
2982 | 2980 | ||
2983 | static int cy_chars_in_buffer(struct tty_struct *tty) | 2981 | static int cy_chars_in_buffer(struct tty_struct *tty) |
2984 | { | 2982 | { |
2983 | struct cyclades_card *card; | ||
2985 | struct cyclades_port *info = tty->driver_data; | 2984 | struct cyclades_port *info = tty->driver_data; |
2986 | int card, channel; | 2985 | int channel; |
2987 | 2986 | ||
2988 | if (serial_paranoia_check(info, tty->name, "cy_chars_in_buffer")) | 2987 | if (serial_paranoia_check(info, tty->name, "cy_chars_in_buffer")) |
2989 | return 0; | 2988 | return 0; |
2990 | 2989 | ||
2991 | card = info->card; | 2990 | card = info->card; |
2992 | channel = (info->line) - (cy_card[card].first_line); | 2991 | channel = (info->line) - (card->first_line); |
2993 | 2992 | ||
2994 | #ifdef Z_EXT_CHARS_IN_BUFFER | 2993 | #ifdef Z_EXT_CHARS_IN_BUFFER |
2995 | if (!IS_CYC_Z(cy_card[card])) { | 2994 | if (!IS_CYC_Z(cy_card[card])) { |
@@ -3008,8 +3007,8 @@ static int cy_chars_in_buffer(struct tty_struct *tty) | |||
3008 | int char_count; | 3007 | int char_count; |
3009 | __u32 tx_put, tx_get, tx_bufsize; | 3008 | __u32 tx_put, tx_get, tx_bufsize; |
3010 | 3009 | ||
3011 | firm_id = cy_card[card].base_addr + ID_ADDRESS; | 3010 | firm_id = card->base_addr + ID_ADDRESS; |
3012 | zfw_ctrl = cy_card[card].base_addr + | 3011 | zfw_ctrl = card->base_addr + |
3013 | (readl(&firm_id->zfwctrl_addr) & 0xfffff); | 3012 | (readl(&firm_id->zfwctrl_addr) & 0xfffff); |
3014 | ch_ctrl = &(zfw_ctrl->ch_ctrl[channel]); | 3013 | ch_ctrl = &(zfw_ctrl->ch_ctrl[channel]); |
3015 | buf_ctrl = &(zfw_ctrl->buf_ctrl[channel]); | 3014 | buf_ctrl = &(zfw_ctrl->buf_ctrl[channel]); |
@@ -3067,9 +3066,10 @@ static void cyy_baud_calc(struct cyclades_port *info, __u32 baud) | |||
3067 | */ | 3066 | */ |
3068 | static void set_line_char(struct cyclades_port *info) | 3067 | static void set_line_char(struct cyclades_port *info) |
3069 | { | 3068 | { |
3069 | struct cyclades_card *card; | ||
3070 | unsigned long flags; | 3070 | unsigned long flags; |
3071 | void __iomem *base_addr; | 3071 | void __iomem *base_addr; |
3072 | int card, chip, channel, index; | 3072 | int chip, channel, index; |
3073 | unsigned cflag, iflag; | 3073 | unsigned cflag, iflag; |
3074 | unsigned short chip_number; | 3074 | unsigned short chip_number; |
3075 | int baud, baud_rate = 0; | 3075 | int baud, baud_rate = 0; |
@@ -3099,12 +3099,12 @@ static void set_line_char(struct cyclades_port *info) | |||
3099 | } | 3099 | } |
3100 | 3100 | ||
3101 | card = info->card; | 3101 | card = info->card; |
3102 | channel = (info->line) - (cy_card[card].first_line); | 3102 | channel = info->line - card->first_line; |
3103 | chip_number = channel / 4; | 3103 | chip_number = channel / 4; |
3104 | 3104 | ||
3105 | if (!IS_CYC_Z(cy_card[card])) { | 3105 | if (!IS_CYC_Z(*card)) { |
3106 | 3106 | ||
3107 | index = cy_card[card].bus_index; | 3107 | index = card->bus_index; |
3108 | 3108 | ||
3109 | /* baud rate */ | 3109 | /* baud rate */ |
3110 | baud = tty_get_baud_rate(info->tty); | 3110 | baud = tty_get_baud_rate(info->tty); |
@@ -3222,8 +3222,7 @@ static void set_line_char(struct cyclades_port *info) | |||
3222 | 3222 | ||
3223 | chip = channel >> 2; | 3223 | chip = channel >> 2; |
3224 | channel &= 0x03; | 3224 | channel &= 0x03; |
3225 | base_addr = cy_card[card].base_addr + | 3225 | base_addr = card->base_addr + (cy_chip_offset[chip] << index); |
3226 | (cy_chip_offset[chip] << index); | ||
3227 | 3226 | ||
3228 | CY_LOCK(info, flags); | 3227 | CY_LOCK(info, flags); |
3229 | cy_writeb(base_addr + (CyCAR << index), (u_char) channel); | 3228 | cy_writeb(base_addr + (CyCAR << index), (u_char) channel); |
@@ -3331,12 +3330,12 @@ static void set_line_char(struct cyclades_port *info) | |||
3331 | __u32 sw_flow; | 3330 | __u32 sw_flow; |
3332 | int retval; | 3331 | int retval; |
3333 | 3332 | ||
3334 | firm_id = cy_card[card].base_addr + ID_ADDRESS; | 3333 | firm_id = card->base_addr + ID_ADDRESS; |
3335 | if (!ISZLOADED(cy_card[card])) { | 3334 | if (!ISZLOADED(*card)) { |
3336 | return; | 3335 | return; |
3337 | } | 3336 | } |
3338 | 3337 | ||
3339 | zfw_ctrl = cy_card[card].base_addr + | 3338 | zfw_ctrl = card->base_addr + |
3340 | (readl(&firm_id->zfwctrl_addr) & 0xfffff); | 3339 | (readl(&firm_id->zfwctrl_addr) & 0xfffff); |
3341 | board_ctrl = &zfw_ctrl->board_ctrl; | 3340 | board_ctrl = &zfw_ctrl->board_ctrl; |
3342 | ch_ctrl = &(zfw_ctrl->ch_ctrl[channel]); | 3341 | ch_ctrl = &(zfw_ctrl->ch_ctrl[channel]); |
@@ -3424,7 +3423,7 @@ static void set_line_char(struct cyclades_port *info) | |||
3424 | } | 3423 | } |
3425 | cy_writel(&ch_ctrl->sw_flow, sw_flow); | 3424 | cy_writel(&ch_ctrl->sw_flow, sw_flow); |
3426 | 3425 | ||
3427 | retval = cyz_issue_cmd(&cy_card[card], channel, C_CM_IOCTL, 0L); | 3426 | retval = cyz_issue_cmd(card, channel, C_CM_IOCTL, 0L); |
3428 | if (retval != 0) { | 3427 | if (retval != 0) { |
3429 | printk(KERN_ERR "cyc:set_line_char retval on ttyC%d " | 3428 | printk(KERN_ERR "cyc:set_line_char retval on ttyC%d " |
3430 | "was %x\n", info->line, retval); | 3429 | "was %x\n", info->line, retval); |
@@ -3451,7 +3450,7 @@ static void set_line_char(struct cyclades_port *info) | |||
3451 | #endif | 3450 | #endif |
3452 | } | 3451 | } |
3453 | 3452 | ||
3454 | retval = cyz_issue_cmd(&cy_card[card], channel, C_CM_IOCTLM,0L); | 3453 | retval = cyz_issue_cmd(card, channel, C_CM_IOCTLM,0L); |
3455 | if (retval != 0) { | 3454 | if (retval != 0) { |
3456 | printk(KERN_ERR "cyc:set_line_char(2) retval on ttyC%d " | 3455 | printk(KERN_ERR "cyc:set_line_char(2) retval on ttyC%d " |
3457 | "was %x\n", info->line, retval); | 3456 | "was %x\n", info->line, retval); |
@@ -3468,14 +3467,15 @@ get_serial_info(struct cyclades_port *info, | |||
3468 | struct serial_struct __user * retinfo) | 3467 | struct serial_struct __user * retinfo) |
3469 | { | 3468 | { |
3470 | struct serial_struct tmp; | 3469 | struct serial_struct tmp; |
3471 | struct cyclades_card *cinfo = &cy_card[info->card]; | 3470 | struct cyclades_card *cinfo = info->card; |
3472 | 3471 | ||
3473 | if (!retinfo) | 3472 | if (!retinfo) |
3474 | return -EFAULT; | 3473 | return -EFAULT; |
3475 | memset(&tmp, 0, sizeof(tmp)); | 3474 | memset(&tmp, 0, sizeof(tmp)); |
3476 | tmp.type = info->type; | 3475 | tmp.type = info->type; |
3477 | tmp.line = info->line; | 3476 | tmp.line = info->line; |
3478 | tmp.port = info->card * 0x100 + info->line - cinfo->first_line; | 3477 | tmp.port = (info->card - cy_card) * 0x100 + info->line - |
3478 | cinfo->first_line; | ||
3479 | tmp.irq = cinfo->irq; | 3479 | tmp.irq = cinfo->irq; |
3480 | tmp.flags = info->flags; | 3480 | tmp.flags = info->flags; |
3481 | tmp.close_delay = info->close_delay; | 3481 | tmp.close_delay = info->close_delay; |
@@ -3544,20 +3544,20 @@ check_and_exit: | |||
3544 | */ | 3544 | */ |
3545 | static int get_lsr_info(struct cyclades_port *info, unsigned int __user * value) | 3545 | static int get_lsr_info(struct cyclades_port *info, unsigned int __user * value) |
3546 | { | 3546 | { |
3547 | int card, chip, channel, index; | 3547 | struct cyclades_card *card; |
3548 | int chip, channel, index; | ||
3548 | unsigned char status; | 3549 | unsigned char status; |
3549 | unsigned int result; | 3550 | unsigned int result; |
3550 | unsigned long flags; | 3551 | unsigned long flags; |
3551 | void __iomem *base_addr; | 3552 | void __iomem *base_addr; |
3552 | 3553 | ||
3553 | card = info->card; | 3554 | card = info->card; |
3554 | channel = (info->line) - (cy_card[card].first_line); | 3555 | channel = (info->line) - (card->first_line); |
3555 | if (!IS_CYC_Z(cy_card[card])) { | 3556 | if (!IS_CYC_Z(*card)) { |
3556 | chip = channel >> 2; | 3557 | chip = channel >> 2; |
3557 | channel &= 0x03; | 3558 | channel &= 0x03; |
3558 | index = cy_card[card].bus_index; | 3559 | index = card->bus_index; |
3559 | base_addr = | 3560 | base_addr = card->base_addr + (cy_chip_offset[chip] << index); |
3560 | cy_card[card].base_addr + (cy_chip_offset[chip] << index); | ||
3561 | 3561 | ||
3562 | CY_LOCK(info, flags); | 3562 | CY_LOCK(info, flags); |
3563 | status = readb(base_addr + (CySRER << index)) & | 3563 | status = readb(base_addr + (CySRER << index)) & |
@@ -3574,7 +3574,8 @@ static int get_lsr_info(struct cyclades_port *info, unsigned int __user * value) | |||
3574 | static int cy_tiocmget(struct tty_struct *tty, struct file *file) | 3574 | static int cy_tiocmget(struct tty_struct *tty, struct file *file) |
3575 | { | 3575 | { |
3576 | struct cyclades_port *info = tty->driver_data; | 3576 | struct cyclades_port *info = tty->driver_data; |
3577 | int card, chip, channel, index; | 3577 | struct cyclades_card *card; |
3578 | int chip, channel, index; | ||
3578 | void __iomem *base_addr; | 3579 | void __iomem *base_addr; |
3579 | unsigned long flags; | 3580 | unsigned long flags; |
3580 | unsigned char status; | 3581 | unsigned char status; |
@@ -3589,13 +3590,12 @@ static int cy_tiocmget(struct tty_struct *tty, struct file *file) | |||
3589 | return -ENODEV; | 3590 | return -ENODEV; |
3590 | 3591 | ||
3591 | card = info->card; | 3592 | card = info->card; |
3592 | channel = (info->line) - (cy_card[card].first_line); | 3593 | channel = info->line - card->first_line; |
3593 | if (!IS_CYC_Z(cy_card[card])) { | 3594 | if (!IS_CYC_Z(*card)) { |
3594 | chip = channel >> 2; | 3595 | chip = channel >> 2; |
3595 | channel &= 0x03; | 3596 | channel &= 0x03; |
3596 | index = cy_card[card].bus_index; | 3597 | index = card->bus_index; |
3597 | base_addr = | 3598 | base_addr = card->base_addr + (cy_chip_offset[chip] << index); |
3598 | cy_card[card].base_addr + (cy_chip_offset[chip] << index); | ||
3599 | 3599 | ||
3600 | CY_LOCK(info, flags); | 3600 | CY_LOCK(info, flags); |
3601 | cy_writeb(base_addr + (CyCAR << index), (u_char) channel); | 3601 | cy_writeb(base_addr + (CyCAR << index), (u_char) channel); |
@@ -3615,10 +3615,10 @@ static int cy_tiocmget(struct tty_struct *tty, struct file *file) | |||
3615 | ((status & CyDSR) ? TIOCM_DSR : 0) | | 3615 | ((status & CyDSR) ? TIOCM_DSR : 0) | |
3616 | ((status & CyCTS) ? TIOCM_CTS : 0); | 3616 | ((status & CyCTS) ? TIOCM_CTS : 0); |
3617 | } else { | 3617 | } else { |
3618 | base_addr = cy_card[card].base_addr; | 3618 | base_addr = card->base_addr; |
3619 | firm_id = cy_card[card].base_addr + ID_ADDRESS; | 3619 | firm_id = card->base_addr + ID_ADDRESS; |
3620 | if (ISZLOADED(cy_card[card])) { | 3620 | if (ISZLOADED(*card)) { |
3621 | zfw_ctrl = cy_card[card].base_addr + | 3621 | zfw_ctrl = card->base_addr + |
3622 | (readl(&firm_id->zfwctrl_addr) & 0xfffff); | 3622 | (readl(&firm_id->zfwctrl_addr) & 0xfffff); |
3623 | board_ctrl = &zfw_ctrl->board_ctrl; | 3623 | board_ctrl = &zfw_ctrl->board_ctrl; |
3624 | ch_ctrl = zfw_ctrl->ch_ctrl; | 3624 | ch_ctrl = zfw_ctrl->ch_ctrl; |
@@ -3643,7 +3643,8 @@ cy_tiocmset(struct tty_struct *tty, struct file *file, | |||
3643 | unsigned int set, unsigned int clear) | 3643 | unsigned int set, unsigned int clear) |
3644 | { | 3644 | { |
3645 | struct cyclades_port *info = tty->driver_data; | 3645 | struct cyclades_port *info = tty->driver_data; |
3646 | int card, chip, channel, index; | 3646 | struct cyclades_card *card; |
3647 | int chip, channel, index; | ||
3647 | void __iomem *base_addr; | 3648 | void __iomem *base_addr; |
3648 | unsigned long flags; | 3649 | unsigned long flags; |
3649 | struct FIRM_ID __iomem *firm_id; | 3650 | struct FIRM_ID __iomem *firm_id; |
@@ -3656,13 +3657,12 @@ cy_tiocmset(struct tty_struct *tty, struct file *file, | |||
3656 | return -ENODEV; | 3657 | return -ENODEV; |
3657 | 3658 | ||
3658 | card = info->card; | 3659 | card = info->card; |
3659 | channel = (info->line) - (cy_card[card].first_line); | 3660 | channel = (info->line) - (card->first_line); |
3660 | if (!IS_CYC_Z(cy_card[card])) { | 3661 | if (!IS_CYC_Z(*card)) { |
3661 | chip = channel >> 2; | 3662 | chip = channel >> 2; |
3662 | channel &= 0x03; | 3663 | channel &= 0x03; |
3663 | index = cy_card[card].bus_index; | 3664 | index = card->bus_index; |
3664 | base_addr = | 3665 | base_addr = card->base_addr + (cy_chip_offset[chip] << index); |
3665 | cy_card[card].base_addr + (cy_chip_offset[chip] << index); | ||
3666 | 3666 | ||
3667 | if (set & TIOCM_RTS) { | 3667 | if (set & TIOCM_RTS) { |
3668 | CY_LOCK(info, flags); | 3668 | CY_LOCK(info, flags); |
@@ -3730,11 +3730,11 @@ cy_tiocmset(struct tty_struct *tty, struct file *file, | |||
3730 | CY_UNLOCK(info, flags); | 3730 | CY_UNLOCK(info, flags); |
3731 | } | 3731 | } |
3732 | } else { | 3732 | } else { |
3733 | base_addr = cy_card[card].base_addr; | 3733 | base_addr = card->base_addr; |
3734 | 3734 | ||
3735 | firm_id = cy_card[card].base_addr + ID_ADDRESS; | 3735 | firm_id = card->base_addr + ID_ADDRESS; |
3736 | if (ISZLOADED(cy_card[card])) { | 3736 | if (ISZLOADED(*card)) { |
3737 | zfw_ctrl = cy_card[card].base_addr + | 3737 | zfw_ctrl = card->base_addr + |
3738 | (readl(&firm_id->zfwctrl_addr) & 0xfffff); | 3738 | (readl(&firm_id->zfwctrl_addr) & 0xfffff); |
3739 | board_ctrl = &zfw_ctrl->board_ctrl; | 3739 | board_ctrl = &zfw_ctrl->board_ctrl; |
3740 | ch_ctrl = zfw_ctrl->ch_ctrl; | 3740 | ch_ctrl = zfw_ctrl->ch_ctrl; |
@@ -3779,7 +3779,7 @@ cy_tiocmset(struct tty_struct *tty, struct file *file, | |||
3779 | return -ENODEV; | 3779 | return -ENODEV; |
3780 | } | 3780 | } |
3781 | CY_LOCK(info, flags); | 3781 | CY_LOCK(info, flags); |
3782 | retval = cyz_issue_cmd(&cy_card[info->card], | 3782 | retval = cyz_issue_cmd(info->card, |
3783 | channel, C_CM_IOCTLM, 0L); | 3783 | channel, C_CM_IOCTLM, 0L); |
3784 | if (retval != 0) { | 3784 | if (retval != 0) { |
3785 | printk(KERN_ERR "cyc:set_modem_info retval on ttyC%d " | 3785 | printk(KERN_ERR "cyc:set_modem_info retval on ttyC%d " |
@@ -3802,7 +3802,7 @@ static void cy_break(struct tty_struct *tty, int break_state) | |||
3802 | return; | 3802 | return; |
3803 | 3803 | ||
3804 | CY_LOCK(info, flags); | 3804 | CY_LOCK(info, flags); |
3805 | if (!IS_CYC_Z(cy_card[info->card])) { | 3805 | if (!IS_CYC_Z(*info->card)) { |
3806 | /* Let the transmit ISR take care of this (since it | 3806 | /* Let the transmit ISR take care of this (since it |
3807 | requires stuffing characters into the output stream). | 3807 | requires stuffing characters into the output stream). |
3808 | */ | 3808 | */ |
@@ -3829,16 +3829,16 @@ static void cy_break(struct tty_struct *tty, int break_state) | |||
3829 | int retval; | 3829 | int retval; |
3830 | 3830 | ||
3831 | if (break_state == -1) { | 3831 | if (break_state == -1) { |
3832 | retval = cyz_issue_cmd(&cy_card[info->card], | 3832 | retval = cyz_issue_cmd(info->card, |
3833 | info->line - cy_card[info->card].first_line, | 3833 | info->line - info->card->first_line, |
3834 | C_CM_SET_BREAK, 0L); | 3834 | C_CM_SET_BREAK, 0L); |
3835 | if (retval != 0) { | 3835 | if (retval != 0) { |
3836 | printk(KERN_ERR "cyc:cy_break (set) retval on " | 3836 | printk(KERN_ERR "cyc:cy_break (set) retval on " |
3837 | "ttyC%d was %x\n", info->line, retval); | 3837 | "ttyC%d was %x\n", info->line, retval); |
3838 | } | 3838 | } |
3839 | } else { | 3839 | } else { |
3840 | retval = cyz_issue_cmd(&cy_card[info->card], | 3840 | retval = cyz_issue_cmd(info->card, |
3841 | info->line - cy_card[info->card].first_line, | 3841 | info->line - info->card->first_line, |
3842 | C_CM_CLR_BREAK, 0L); | 3842 | C_CM_CLR_BREAK, 0L); |
3843 | if (retval != 0) { | 3843 | if (retval != 0) { |
3844 | printk(KERN_DEBUG "cyc:cy_break (clr) retval " | 3844 | printk(KERN_DEBUG "cyc:cy_break (clr) retval " |
@@ -3865,18 +3865,19 @@ get_mon_info(struct cyclades_port *info, struct cyclades_monitor __user * mon) | |||
3865 | 3865 | ||
3866 | static int set_threshold(struct cyclades_port *info, unsigned long value) | 3866 | static int set_threshold(struct cyclades_port *info, unsigned long value) |
3867 | { | 3867 | { |
3868 | struct cyclades_card *card; | ||
3868 | void __iomem *base_addr; | 3869 | void __iomem *base_addr; |
3869 | int card, channel, chip, index; | 3870 | int channel, chip, index; |
3870 | unsigned long flags; | 3871 | unsigned long flags; |
3871 | 3872 | ||
3872 | card = info->card; | 3873 | card = info->card; |
3873 | channel = info->line - cy_card[card].first_line; | 3874 | channel = info->line - card->first_line; |
3874 | if (!IS_CYC_Z(cy_card[card])) { | 3875 | if (!IS_CYC_Z(*card)) { |
3875 | chip = channel >> 2; | 3876 | chip = channel >> 2; |
3876 | channel &= 0x03; | 3877 | channel &= 0x03; |
3877 | index = cy_card[card].bus_index; | 3878 | index = card->bus_index; |
3878 | base_addr = | 3879 | base_addr = |
3879 | cy_card[card].base_addr + (cy_chip_offset[chip] << index); | 3880 | card->base_addr + (cy_chip_offset[chip] << index); |
3880 | 3881 | ||
3881 | info->cor3 &= ~CyREC_FIFO; | 3882 | info->cor3 &= ~CyREC_FIFO; |
3882 | info->cor3 |= value & CyREC_FIFO; | 3883 | info->cor3 |= value & CyREC_FIFO; |
@@ -3894,18 +3895,18 @@ static int set_threshold(struct cyclades_port *info, unsigned long value) | |||
3894 | static int | 3895 | static int |
3895 | get_threshold(struct cyclades_port *info, unsigned long __user * value) | 3896 | get_threshold(struct cyclades_port *info, unsigned long __user * value) |
3896 | { | 3897 | { |
3898 | struct cyclades_card *card; | ||
3897 | void __iomem *base_addr; | 3899 | void __iomem *base_addr; |
3898 | int card, channel, chip, index; | 3900 | int channel, chip, index; |
3899 | unsigned long tmp; | 3901 | unsigned long tmp; |
3900 | 3902 | ||
3901 | card = info->card; | 3903 | card = info->card; |
3902 | channel = info->line - cy_card[card].first_line; | 3904 | channel = info->line - card->first_line; |
3903 | if (!IS_CYC_Z(cy_card[card])) { | 3905 | if (!IS_CYC_Z(*card)) { |
3904 | chip = channel >> 2; | 3906 | chip = channel >> 2; |
3905 | channel &= 0x03; | 3907 | channel &= 0x03; |
3906 | index = cy_card[card].bus_index; | 3908 | index = card->bus_index; |
3907 | base_addr = | 3909 | base_addr = card->base_addr + (cy_chip_offset[chip] << index); |
3908 | cy_card[card].base_addr + (cy_chip_offset[chip] << index); | ||
3909 | 3910 | ||
3910 | tmp = readb(base_addr + (CyCOR3 << index)) & CyREC_FIFO; | 3911 | tmp = readb(base_addr + (CyCOR3 << index)) & CyREC_FIFO; |
3911 | return put_user(tmp, value); | 3912 | return put_user(tmp, value); |
@@ -3930,18 +3931,18 @@ get_default_threshold(struct cyclades_port *info, unsigned long __user * value) | |||
3930 | 3931 | ||
3931 | static int set_timeout(struct cyclades_port *info, unsigned long value) | 3932 | static int set_timeout(struct cyclades_port *info, unsigned long value) |
3932 | { | 3933 | { |
3934 | struct cyclades_card *card; | ||
3933 | void __iomem *base_addr; | 3935 | void __iomem *base_addr; |
3934 | int card, channel, chip, index; | 3936 | int channel, chip, index; |
3935 | unsigned long flags; | 3937 | unsigned long flags; |
3936 | 3938 | ||
3937 | card = info->card; | 3939 | card = info->card; |
3938 | channel = info->line - cy_card[card].first_line; | 3940 | channel = info->line - card->first_line; |
3939 | if (!IS_CYC_Z(cy_card[card])) { | 3941 | if (!IS_CYC_Z(*card)) { |
3940 | chip = channel >> 2; | 3942 | chip = channel >> 2; |
3941 | channel &= 0x03; | 3943 | channel &= 0x03; |
3942 | index = cy_card[card].bus_index; | 3944 | index = card->bus_index; |
3943 | base_addr = | 3945 | base_addr = card->base_addr + (cy_chip_offset[chip] << index); |
3944 | cy_card[card].base_addr + (cy_chip_offset[chip] << index); | ||
3945 | 3946 | ||
3946 | CY_LOCK(info, flags); | 3947 | CY_LOCK(info, flags); |
3947 | cy_writeb(base_addr + (CyRTPR << index), value & 0xff); | 3948 | cy_writeb(base_addr + (CyRTPR << index), value & 0xff); |
@@ -3954,18 +3955,18 @@ static int set_timeout(struct cyclades_port *info, unsigned long value) | |||
3954 | 3955 | ||
3955 | static int get_timeout(struct cyclades_port *info, unsigned long __user * value) | 3956 | static int get_timeout(struct cyclades_port *info, unsigned long __user * value) |
3956 | { | 3957 | { |
3958 | struct cyclades_card *card; | ||
3957 | void __iomem *base_addr; | 3959 | void __iomem *base_addr; |
3958 | int card, channel, chip, index; | 3960 | int channel, chip, index; |
3959 | unsigned long tmp; | 3961 | unsigned long tmp; |
3960 | 3962 | ||
3961 | card = info->card; | 3963 | card = info->card; |
3962 | channel = info->line - cy_card[card].first_line; | 3964 | channel = info->line - card->first_line; |
3963 | if (!IS_CYC_Z(cy_card[card])) { | 3965 | if (!IS_CYC_Z(*card)) { |
3964 | chip = channel >> 2; | 3966 | chip = channel >> 2; |
3965 | channel &= 0x03; | 3967 | channel &= 0x03; |
3966 | index = cy_card[card].bus_index; | 3968 | index = card->bus_index; |
3967 | base_addr = | 3969 | base_addr = card->base_addr + (cy_chip_offset[chip] << index); |
3968 | cy_card[card].base_addr + (cy_chip_offset[chip] << index); | ||
3969 | 3970 | ||
3970 | tmp = readb(base_addr + (CyRTPR << index)); | 3971 | tmp = readb(base_addr + (CyRTPR << index)); |
3971 | return put_user(tmp, value); | 3972 | return put_user(tmp, value); |
@@ -4218,7 +4219,8 @@ static void cy_set_termios(struct tty_struct *tty, struct ktermios *old_termios) | |||
4218 | static void cy_send_xchar(struct tty_struct *tty, char ch) | 4219 | static void cy_send_xchar(struct tty_struct *tty, char ch) |
4219 | { | 4220 | { |
4220 | struct cyclades_port *info = tty->driver_data; | 4221 | struct cyclades_port *info = tty->driver_data; |
4221 | int card, channel; | 4222 | struct cyclades_card *card; |
4223 | int channel; | ||
4222 | 4224 | ||
4223 | if (serial_paranoia_check(info, tty->name, "cy_send_xchar")) | 4225 | if (serial_paranoia_check(info, tty->name, "cy_send_xchar")) |
4224 | return; | 4226 | return; |
@@ -4229,15 +4231,13 @@ static void cy_send_xchar(struct tty_struct *tty, char ch) | |||
4229 | cy_start(tty); | 4231 | cy_start(tty); |
4230 | 4232 | ||
4231 | card = info->card; | 4233 | card = info->card; |
4232 | channel = info->line - cy_card[card].first_line; | 4234 | channel = info->line - card->first_line; |
4233 | 4235 | ||
4234 | if (IS_CYC_Z(cy_card[card])) { | 4236 | if (IS_CYC_Z(*card)) { |
4235 | if (ch == STOP_CHAR(tty)) | 4237 | if (ch == STOP_CHAR(tty)) |
4236 | cyz_issue_cmd(&cy_card[card], channel, C_CM_SENDXOFF, | 4238 | cyz_issue_cmd(card, channel, C_CM_SENDXOFF, 0L); |
4237 | 0L); | ||
4238 | else if (ch == START_CHAR(tty)) | 4239 | else if (ch == START_CHAR(tty)) |
4239 | cyz_issue_cmd(&cy_card[card], channel, C_CM_SENDXON, | 4240 | cyz_issue_cmd(card, channel, C_CM_SENDXON, 0L); |
4240 | 0L); | ||
4241 | } | 4241 | } |
4242 | } | 4242 | } |
4243 | 4243 | ||
@@ -4248,9 +4248,10 @@ static void cy_send_xchar(struct tty_struct *tty, char ch) | |||
4248 | static void cy_throttle(struct tty_struct *tty) | 4248 | static void cy_throttle(struct tty_struct *tty) |
4249 | { | 4249 | { |
4250 | struct cyclades_port *info = tty->driver_data; | 4250 | struct cyclades_port *info = tty->driver_data; |
4251 | struct cyclades_card *card; | ||
4251 | unsigned long flags; | 4252 | unsigned long flags; |
4252 | void __iomem *base_addr; | 4253 | void __iomem *base_addr; |
4253 | int card, chip, channel, index; | 4254 | int chip, channel, index; |
4254 | 4255 | ||
4255 | #ifdef CY_DEBUG_THROTTLE | 4256 | #ifdef CY_DEBUG_THROTTLE |
4256 | char buf[64]; | 4257 | char buf[64]; |
@@ -4266,19 +4267,19 @@ static void cy_throttle(struct tty_struct *tty) | |||
4266 | card = info->card; | 4267 | card = info->card; |
4267 | 4268 | ||
4268 | if (I_IXOFF(tty)) { | 4269 | if (I_IXOFF(tty)) { |
4269 | if (!IS_CYC_Z(cy_card[card])) | 4270 | if (!IS_CYC_Z(*card)) |
4270 | cy_send_xchar(tty, STOP_CHAR(tty)); | 4271 | cy_send_xchar(tty, STOP_CHAR(tty)); |
4271 | else | 4272 | else |
4272 | info->throttle = 1; | 4273 | info->throttle = 1; |
4273 | } | 4274 | } |
4274 | 4275 | ||
4275 | if (tty->termios->c_cflag & CRTSCTS) { | 4276 | if (tty->termios->c_cflag & CRTSCTS) { |
4276 | channel = info->line - cy_card[card].first_line; | 4277 | channel = info->line - card->first_line; |
4277 | if (!IS_CYC_Z(cy_card[card])) { | 4278 | if (!IS_CYC_Z(*card)) { |
4278 | chip = channel >> 2; | 4279 | chip = channel >> 2; |
4279 | channel &= 0x03; | 4280 | channel &= 0x03; |
4280 | index = cy_card[card].bus_index; | 4281 | index = card->bus_index; |
4281 | base_addr = cy_card[card].base_addr + | 4282 | base_addr = card->base_addr + |
4282 | (cy_chip_offset[chip] << index); | 4283 | (cy_chip_offset[chip] << index); |
4283 | 4284 | ||
4284 | CY_LOCK(info, flags); | 4285 | CY_LOCK(info, flags); |
@@ -4306,9 +4307,10 @@ static void cy_throttle(struct tty_struct *tty) | |||
4306 | static void cy_unthrottle(struct tty_struct *tty) | 4307 | static void cy_unthrottle(struct tty_struct *tty) |
4307 | { | 4308 | { |
4308 | struct cyclades_port *info = tty->driver_data; | 4309 | struct cyclades_port *info = tty->driver_data; |
4310 | struct cyclades_card *card; | ||
4309 | unsigned long flags; | 4311 | unsigned long flags; |
4310 | void __iomem *base_addr; | 4312 | void __iomem *base_addr; |
4311 | int card, chip, channel, index; | 4313 | int chip, channel, index; |
4312 | 4314 | ||
4313 | #ifdef CY_DEBUG_THROTTLE | 4315 | #ifdef CY_DEBUG_THROTTLE |
4314 | char buf[64]; | 4316 | char buf[64]; |
@@ -4330,12 +4332,12 @@ static void cy_unthrottle(struct tty_struct *tty) | |||
4330 | 4332 | ||
4331 | if (tty->termios->c_cflag & CRTSCTS) { | 4333 | if (tty->termios->c_cflag & CRTSCTS) { |
4332 | card = info->card; | 4334 | card = info->card; |
4333 | channel = info->line - cy_card[card].first_line; | 4335 | channel = info->line - card->first_line; |
4334 | if (!IS_CYC_Z(cy_card[card])) { | 4336 | if (!IS_CYC_Z(*card)) { |
4335 | chip = channel >> 2; | 4337 | chip = channel >> 2; |
4336 | channel &= 0x03; | 4338 | channel &= 0x03; |
4337 | index = cy_card[card].bus_index; | 4339 | index = card->bus_index; |
4338 | base_addr = cy_card[card].base_addr + | 4340 | base_addr = card->base_addr + |
4339 | (cy_chip_offset[chip] << index); | 4341 | (cy_chip_offset[chip] << index); |
4340 | 4342 | ||
4341 | CY_LOCK(info, flags); | 4343 | CY_LOCK(info, flags); |
@@ -4373,13 +4375,13 @@ static void cy_stop(struct tty_struct *tty) | |||
4373 | if (serial_paranoia_check(info, tty->name, "cy_stop")) | 4375 | if (serial_paranoia_check(info, tty->name, "cy_stop")) |
4374 | return; | 4376 | return; |
4375 | 4377 | ||
4376 | cinfo = &cy_card[info->card]; | 4378 | cinfo = info->card; |
4377 | channel = info->line - cinfo->first_line; | 4379 | channel = info->line - cinfo->first_line; |
4378 | if (!IS_CYC_Z(*cinfo)) { | 4380 | if (!IS_CYC_Z(*cinfo)) { |
4379 | index = cinfo->bus_index; | 4381 | index = cinfo->bus_index; |
4380 | chip = channel >> 2; | 4382 | chip = channel >> 2; |
4381 | channel &= 0x03; | 4383 | channel &= 0x03; |
4382 | base_addr = cy_card[info->card].base_addr + | 4384 | base_addr = info->card->base_addr + |
4383 | (cy_chip_offset[chip] << index); | 4385 | (cy_chip_offset[chip] << index); |
4384 | 4386 | ||
4385 | CY_LOCK(info, flags); | 4387 | CY_LOCK(info, flags); |
@@ -4408,13 +4410,13 @@ static void cy_start(struct tty_struct *tty) | |||
4408 | if (serial_paranoia_check(info, tty->name, "cy_start")) | 4410 | if (serial_paranoia_check(info, tty->name, "cy_start")) |
4409 | return; | 4411 | return; |
4410 | 4412 | ||
4411 | cinfo = &cy_card[info->card]; | 4413 | cinfo = info->card; |
4412 | channel = info->line - cinfo->first_line; | 4414 | channel = info->line - cinfo->first_line; |
4413 | index = cinfo->bus_index; | 4415 | index = cinfo->bus_index; |
4414 | if (!IS_CYC_Z(*cinfo)) { | 4416 | if (!IS_CYC_Z(*cinfo)) { |
4415 | chip = channel >> 2; | 4417 | chip = channel >> 2; |
4416 | channel &= 0x03; | 4418 | channel &= 0x03; |
4417 | base_addr = cy_card[info->card].base_addr + | 4419 | base_addr = info->card->base_addr + |
4418 | (cy_chip_offset[chip] << index); | 4420 | (cy_chip_offset[chip] << index); |
4419 | 4421 | ||
4420 | CY_LOCK(info, flags); | 4422 | CY_LOCK(info, flags); |
@@ -4430,7 +4432,8 @@ static void cy_start(struct tty_struct *tty) | |||
4430 | static void cy_flush_buffer(struct tty_struct *tty) | 4432 | static void cy_flush_buffer(struct tty_struct *tty) |
4431 | { | 4433 | { |
4432 | struct cyclades_port *info = tty->driver_data; | 4434 | struct cyclades_port *info = tty->driver_data; |
4433 | int card, channel, retval; | 4435 | struct cyclades_card *card; |
4436 | int channel, retval; | ||
4434 | unsigned long flags; | 4437 | unsigned long flags; |
4435 | 4438 | ||
4436 | #ifdef CY_DEBUG_IO | 4439 | #ifdef CY_DEBUG_IO |
@@ -4441,17 +4444,16 @@ static void cy_flush_buffer(struct tty_struct *tty) | |||
4441 | return; | 4444 | return; |
4442 | 4445 | ||
4443 | card = info->card; | 4446 | card = info->card; |
4444 | channel = (info->line) - (cy_card[card].first_line); | 4447 | channel = info->line - card->first_line; |
4445 | 4448 | ||
4446 | CY_LOCK(info, flags); | 4449 | CY_LOCK(info, flags); |
4447 | info->xmit_cnt = info->xmit_head = info->xmit_tail = 0; | 4450 | info->xmit_cnt = info->xmit_head = info->xmit_tail = 0; |
4448 | CY_UNLOCK(info, flags); | 4451 | CY_UNLOCK(info, flags); |
4449 | 4452 | ||
4450 | if (IS_CYC_Z(cy_card[card])) { /* If it is a Z card, flush the on-board | 4453 | if (IS_CYC_Z(*card)) { /* If it is a Z card, flush the on-board |
4451 | buffers as well */ | 4454 | buffers as well */ |
4452 | CY_LOCK(info, flags); | 4455 | CY_LOCK(info, flags); |
4453 | retval = | 4456 | retval = cyz_issue_cmd(card, channel, C_CM_FLUSH_TX, 0L); |
4454 | cyz_issue_cmd(&cy_card[card], channel, C_CM_FLUSH_TX, 0L); | ||
4455 | if (retval != 0) { | 4457 | if (retval != 0) { |
4456 | printk(KERN_ERR "cyc: flush_buffer retval on ttyC%d " | 4458 | printk(KERN_ERR "cyc: flush_buffer retval on ttyC%d " |
4457 | "was %x\n", info->line, retval); | 4459 | "was %x\n", info->line, retval); |
@@ -4496,8 +4498,7 @@ static void cy_hangup(struct tty_struct *tty) | |||
4496 | * --------------------------------------------------------------------- | 4498 | * --------------------------------------------------------------------- |
4497 | */ | 4499 | */ |
4498 | 4500 | ||
4499 | static void __devinit cy_init_card(struct cyclades_card *cinfo, | 4501 | static void __devinit cy_init_card(struct cyclades_card *cinfo) |
4500 | const unsigned int board) | ||
4501 | { | 4502 | { |
4502 | struct cyclades_port *info; | 4503 | struct cyclades_port *info; |
4503 | u32 mailbox; | 4504 | u32 mailbox; |
@@ -4524,7 +4525,7 @@ static void __devinit cy_init_card(struct cyclades_card *cinfo, | |||
4524 | info = &cy_port[port]; | 4525 | info = &cy_port[port]; |
4525 | memset(info, 0, sizeof(*info)); | 4526 | memset(info, 0, sizeof(*info)); |
4526 | info->magic = CYCLADES_MAGIC; | 4527 | info->magic = CYCLADES_MAGIC; |
4527 | info->card = board; | 4528 | info->card = cinfo; |
4528 | info->line = port; | 4529 | info->line = port; |
4529 | info->flags = STD_COM_FLAGS; | 4530 | info->flags = STD_COM_FLAGS; |
4530 | info->closing_wait = CLOSING_WAIT_DELAY; | 4531 | info->closing_wait = CLOSING_WAIT_DELAY; |
@@ -4763,7 +4764,7 @@ static int __init cy_detect_isa(void) | |||
4763 | cy_card[j].bus_index = 0; | 4764 | cy_card[j].bus_index = 0; |
4764 | cy_card[j].first_line = cy_next_channel; | 4765 | cy_card[j].first_line = cy_next_channel; |
4765 | cy_card[j].num_chips = cy_isa_nchan / 4; | 4766 | cy_card[j].num_chips = cy_isa_nchan / 4; |
4766 | cy_init_card(&cy_card[j], j); | 4767 | cy_init_card(&cy_card[j]); |
4767 | nboard++; | 4768 | nboard++; |
4768 | 4769 | ||
4769 | printk(KERN_INFO "Cyclom-Y/ISA #%d: 0x%lx-0x%lx, IRQ%d found: " | 4770 | printk(KERN_INFO "Cyclom-Y/ISA #%d: 0x%lx-0x%lx, IRQ%d found: " |
@@ -4849,7 +4850,7 @@ static int __devinit cy_init_Ze(struct RUNTIME_9060 __iomem *cy_pci_addr0, | |||
4849 | cy_card[j].bus_index = 1; | 4850 | cy_card[j].bus_index = 1; |
4850 | cy_card[j].first_line = cy_next_channel; | 4851 | cy_card[j].first_line = cy_next_channel; |
4851 | cy_card[j].num_chips = -1; | 4852 | cy_card[j].num_chips = -1; |
4852 | cy_init_card(&cy_card[j], j); | 4853 | cy_init_card(&cy_card[j]); |
4853 | pci_set_drvdata(pdev, &cy_card[j]); | 4854 | pci_set_drvdata(pdev, &cy_card[j]); |
4854 | 4855 | ||
4855 | dev_info(&pdev->dev, "Cyclades-Ze/PCI #%d found: %d channels starting " | 4856 | dev_info(&pdev->dev, "Cyclades-Ze/PCI #%d found: %d channels starting " |
@@ -4956,7 +4957,7 @@ static int __devinit cy_pci_probe(struct pci_dev *pdev, | |||
4956 | cy_card[j].bus_index = 1; | 4957 | cy_card[j].bus_index = 1; |
4957 | cy_card[j].first_line = cy_next_channel; | 4958 | cy_card[j].first_line = cy_next_channel; |
4958 | cy_card[j].num_chips = cy_pci_nchan / 4; | 4959 | cy_card[j].num_chips = cy_pci_nchan / 4; |
4959 | cy_init_card(&cy_card[j], j); | 4960 | cy_init_card(&cy_card[j]); |
4960 | pci_set_drvdata(pdev, &cy_card[j]); | 4961 | pci_set_drvdata(pdev, &cy_card[j]); |
4961 | 4962 | ||
4962 | /* enable interrupts in the PCI interface */ | 4963 | /* enable interrupts in the PCI interface */ |
@@ -5110,7 +5111,7 @@ static int __devinit cy_pci_probe(struct pci_dev *pdev, | |||
5110 | cy_card[j].bus_index = 1; | 5111 | cy_card[j].bus_index = 1; |
5111 | cy_card[j].first_line = cy_next_channel; | 5112 | cy_card[j].first_line = cy_next_channel; |
5112 | cy_card[j].num_chips = -1; | 5113 | cy_card[j].num_chips = -1; |
5113 | cy_init_card(&cy_card[j], j); | 5114 | cy_init_card(&cy_card[j]); |
5114 | pci_set_drvdata(pdev, &cy_card[j]); | 5115 | pci_set_drvdata(pdev, &cy_card[j]); |
5115 | 5116 | ||
5116 | dev_info(&pdev->dev, "Cyclades-8Zo/PCI #%d found: %d channels " | 5117 | dev_info(&pdev->dev, "Cyclades-8Zo/PCI #%d found: %d channels " |