diff options
Diffstat (limited to 'drivers/net/wan/c101.c')
-rw-r--r-- | drivers/net/wan/c101.c | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/drivers/net/wan/c101.c b/drivers/net/wan/c101.c index c92ac9fde083..435e91ec4620 100644 --- a/drivers/net/wan/c101.c +++ b/drivers/net/wan/c101.c | |||
@@ -116,27 +116,33 @@ static inline void openwin(card_t *card, u8 page) | |||
116 | #include "hd6457x.c" | 116 | #include "hd6457x.c" |
117 | 117 | ||
118 | 118 | ||
119 | static inline void set_carrier(port_t *port) | ||
120 | { | ||
121 | if (!sca_in(MSCI1_OFFSET + ST3, port) & ST3_DCD) | ||
122 | netif_carrier_on(port_to_dev(port)); | ||
123 | else | ||
124 | netif_carrier_off(port_to_dev(port)); | ||
125 | } | ||
126 | |||
127 | |||
119 | static void sca_msci_intr(port_t *port) | 128 | static void sca_msci_intr(port_t *port) |
120 | { | 129 | { |
121 | struct net_device *dev = port_to_dev(port); | 130 | u8 stat = sca_in(MSCI1_OFFSET + ST1, port); /* read MSCI ST1 status */ |
122 | card_t* card = port_to_card(port); | ||
123 | u8 stat = sca_in(MSCI1_OFFSET + ST1, card); /* read MSCI ST1 status */ | ||
124 | 131 | ||
125 | /* Reset MSCI TX underrun status bit */ | 132 | /* Reset MSCI TX underrun status bit */ |
126 | sca_out(stat & ST1_UDRN, MSCI0_OFFSET + ST1, card); | 133 | sca_out(stat & ST1_UDRN, MSCI0_OFFSET + ST1, port); |
127 | 134 | ||
128 | if (stat & ST1_UDRN) { | 135 | if (stat & ST1_UDRN) { |
129 | struct net_device_stats *stats = hdlc_stats(dev); | 136 | struct net_device_stats *stats = hdlc_stats(port_to_dev(port)); |
130 | stats->tx_errors++; /* TX Underrun error detected */ | 137 | stats->tx_errors++; /* TX Underrun error detected */ |
131 | stats->tx_fifo_errors++; | 138 | stats->tx_fifo_errors++; |
132 | } | 139 | } |
133 | 140 | ||
134 | /* Reset MSCI CDCD status bit - uses ch#2 DCD input */ | 141 | /* Reset MSCI CDCD status bit - uses ch#2 DCD input */ |
135 | sca_out(stat & ST1_CDCD, MSCI1_OFFSET + ST1, card); | 142 | sca_out(stat & ST1_CDCD, MSCI1_OFFSET + ST1, port); |
136 | 143 | ||
137 | if (stat & ST1_CDCD) | 144 | if (stat & ST1_CDCD) |
138 | hdlc_set_carrier(!(sca_in(MSCI1_OFFSET + ST3, card) & ST3_DCD), | 145 | set_carrier(port); |
139 | dev); | ||
140 | } | 146 | } |
141 | 147 | ||
142 | 148 | ||
@@ -190,8 +196,7 @@ static int c101_open(struct net_device *dev) | |||
190 | sca_out(IE1_UDRN, MSCI0_OFFSET + IE1, port); | 196 | sca_out(IE1_UDRN, MSCI0_OFFSET + IE1, port); |
191 | sca_out(IE0_TXINT, MSCI0_OFFSET + IE0, port); | 197 | sca_out(IE0_TXINT, MSCI0_OFFSET + IE0, port); |
192 | 198 | ||
193 | hdlc_set_carrier(!(sca_in(MSCI1_OFFSET + ST3, port) & ST3_DCD), dev); | 199 | set_carrier(port); |
194 | printk(KERN_DEBUG "0x%X\n", sca_in(MSCI1_OFFSET + ST3, port)); | ||
195 | 200 | ||
196 | /* enable MSCI1 CDCD interrupt */ | 201 | /* enable MSCI1 CDCD interrupt */ |
197 | sca_out(IE1_CDCD, MSCI1_OFFSET + IE1, port); | 202 | sca_out(IE1_CDCD, MSCI1_OFFSET + IE1, port); |
@@ -378,7 +383,7 @@ static int __init c101_run(unsigned long irq, unsigned long winbase) | |||
378 | } | 383 | } |
379 | 384 | ||
380 | sca_init_sync_port(card); /* Set up C101 memory */ | 385 | sca_init_sync_port(card); /* Set up C101 memory */ |
381 | hdlc_set_carrier(!(sca_in(MSCI1_OFFSET + ST3, card) & ST3_DCD), dev); | 386 | set_carrier(card); |
382 | 387 | ||
383 | printk(KERN_INFO "%s: Moxa C101 on IRQ%u," | 388 | printk(KERN_INFO "%s: Moxa C101 on IRQ%u," |
384 | " using %u TX + %u RX packets rings\n", | 389 | " using %u TX + %u RX packets rings\n", |
@@ -443,4 +448,5 @@ module_exit(c101_cleanup); | |||
443 | MODULE_AUTHOR("Krzysztof Halasa <khc@pm.waw.pl>"); | 448 | MODULE_AUTHOR("Krzysztof Halasa <khc@pm.waw.pl>"); |
444 | MODULE_DESCRIPTION("Moxa C101 serial port driver"); | 449 | MODULE_DESCRIPTION("Moxa C101 serial port driver"); |
445 | MODULE_LICENSE("GPL v2"); | 450 | MODULE_LICENSE("GPL v2"); |
446 | module_param(hw, charp, 0444); /* hw=irq,ram:irq,... */ | 451 | module_param(hw, charp, 0444); |
452 | MODULE_PARM_DESC(hw, "irq,ram:irq,..."); | ||