diff options
Diffstat (limited to 'drivers/isdn/hisax')
-rw-r--r-- | drivers/isdn/hisax/nj_u.c | 167 |
1 files changed, 93 insertions, 74 deletions
diff --git a/drivers/isdn/hisax/nj_u.c b/drivers/isdn/hisax/nj_u.c index 8202cf34ecae..f017d3816b1d 100644 --- a/drivers/isdn/hisax/nj_u.c +++ b/drivers/isdn/hisax/nj_u.c | |||
@@ -128,93 +128,69 @@ NETjet_U_card_msg(struct IsdnCardState *cs, int mt, void *arg) | |||
128 | return(0); | 128 | return(0); |
129 | } | 129 | } |
130 | 130 | ||
131 | static struct pci_dev *dev_netjet __devinitdata = NULL; | 131 | static int __devinit nju_pci_probe(struct pci_dev *dev_netjet, |
132 | 132 | struct IsdnCardState *cs) | |
133 | int __devinit | ||
134 | setup_netjet_u(struct IsdnCard *card) | ||
135 | { | 133 | { |
136 | int bytecnt; | 134 | if (pci_enable_device(dev_netjet)) |
137 | struct IsdnCardState *cs = card->cs; | ||
138 | char tmp[64]; | ||
139 | #ifdef CONFIG_PCI | ||
140 | #endif | ||
141 | #ifdef __BIG_ENDIAN | ||
142 | #error "not running on big endian machines now" | ||
143 | #endif | ||
144 | strcpy(tmp, NETjet_U_revision); | ||
145 | printk(KERN_INFO "HiSax: Traverse Tech. NETspider-U driver Rev. %s\n", HiSax_getrev(tmp)); | ||
146 | if (cs->typ != ISDN_CTYPE_NETJET_U) | ||
147 | return(0); | 135 | return(0); |
148 | test_and_clear_bit(FLG_LOCK_ATOMIC, &cs->HW_Flags); | 136 | pci_set_master(dev_netjet); |
149 | 137 | cs->irq = dev_netjet->irq; | |
150 | #ifdef CONFIG_PCI | 138 | if (!cs->irq) { |
139 | printk(KERN_WARNING "NETspider-U: No IRQ for PCI card found\n"); | ||
140 | return(0); | ||
141 | } | ||
142 | cs->hw.njet.base = pci_resource_start(dev_netjet, 0); | ||
143 | if (!cs->hw.njet.base) { | ||
144 | printk(KERN_WARNING "NETspider-U: No IO-Adr for PCI card found\n"); | ||
145 | return(0); | ||
146 | } | ||
151 | 147 | ||
152 | for ( ;; ) | 148 | return (1); |
153 | { | 149 | } |
154 | if ((dev_netjet = pci_find_device(PCI_VENDOR_ID_TIGERJET, | ||
155 | PCI_DEVICE_ID_TIGERJET_300, dev_netjet))) { | ||
156 | if (pci_enable_device(dev_netjet)) | ||
157 | return(0); | ||
158 | pci_set_master(dev_netjet); | ||
159 | cs->irq = dev_netjet->irq; | ||
160 | if (!cs->irq) { | ||
161 | printk(KERN_WARNING "NETspider-U: No IRQ for PCI card found\n"); | ||
162 | return(0); | ||
163 | } | ||
164 | cs->hw.njet.base = pci_resource_start(dev_netjet, 0); | ||
165 | if (!cs->hw.njet.base) { | ||
166 | printk(KERN_WARNING "NETspider-U: No IO-Adr for PCI card found\n"); | ||
167 | return(0); | ||
168 | } | ||
169 | } else { | ||
170 | printk(KERN_WARNING "NETspider-U: No PCI card found\n"); | ||
171 | return(0); | ||
172 | } | ||
173 | 150 | ||
174 | cs->hw.njet.auxa = cs->hw.njet.base + NETJET_AUXDATA; | 151 | static int __devinit nju_cs_init(struct IsdnCard *card, |
175 | cs->hw.njet.isac = cs->hw.njet.base | NETJET_ISAC_OFF; | 152 | struct IsdnCardState *cs) |
176 | mdelay(10); | 153 | { |
154 | cs->hw.njet.auxa = cs->hw.njet.base + NETJET_AUXDATA; | ||
155 | cs->hw.njet.isac = cs->hw.njet.base | NETJET_ISAC_OFF; | ||
156 | mdelay(10); | ||
177 | 157 | ||
178 | cs->hw.njet.ctrl_reg = 0xff; /* Reset On */ | 158 | cs->hw.njet.ctrl_reg = 0xff; /* Reset On */ |
179 | byteout(cs->hw.njet.base + NETJET_CTRL, cs->hw.njet.ctrl_reg); | 159 | byteout(cs->hw.njet.base + NETJET_CTRL, cs->hw.njet.ctrl_reg); |
180 | mdelay(10); | 160 | mdelay(10); |
181 | 161 | ||
182 | cs->hw.njet.ctrl_reg = 0x00; /* Reset Off and status read clear */ | 162 | cs->hw.njet.ctrl_reg = 0x00; /* Reset Off and status read clear */ |
183 | byteout(cs->hw.njet.base + NETJET_CTRL, cs->hw.njet.ctrl_reg); | 163 | byteout(cs->hw.njet.base + NETJET_CTRL, cs->hw.njet.ctrl_reg); |
184 | mdelay(10); | 164 | mdelay(10); |
185 | 165 | ||
186 | cs->hw.njet.auxd = 0xC0; | 166 | cs->hw.njet.auxd = 0xC0; |
187 | cs->hw.njet.dmactrl = 0; | 167 | cs->hw.njet.dmactrl = 0; |
188 | 168 | ||
189 | byteout(cs->hw.njet.auxa, 0); | 169 | byteout(cs->hw.njet.auxa, 0); |
190 | byteout(cs->hw.njet.base + NETJET_AUXCTRL, ~NETJET_ISACIRQ); | 170 | byteout(cs->hw.njet.base + NETJET_AUXCTRL, ~NETJET_ISACIRQ); |
191 | byteout(cs->hw.njet.base + NETJET_IRQMASK1, NETJET_ISACIRQ); | 171 | byteout(cs->hw.njet.base + NETJET_IRQMASK1, NETJET_ISACIRQ); |
192 | byteout(cs->hw.njet.auxa, cs->hw.njet.auxd); | 172 | byteout(cs->hw.njet.auxa, cs->hw.njet.auxd); |
193 | 173 | ||
194 | switch ( ( ( NETjet_ReadIC( cs, ICC_RBCH ) >> 5 ) & 3 ) ) | 174 | switch ( ( ( NETjet_ReadIC( cs, ICC_RBCH ) >> 5 ) & 3 ) ) |
195 | { | 175 | { |
196 | case 3 : | 176 | case 3 : |
197 | break; | 177 | return 1; /* end loop */ |
198 | 178 | ||
199 | case 0 : | 179 | case 0 : |
200 | printk( KERN_WARNING "NETspider-U: NETjet-S PCI card found\n" ); | 180 | printk( KERN_WARNING "NETspider-U: NETjet-S PCI card found\n" ); |
201 | continue; | 181 | return -1; /* continue looping */ |
202 | 182 | ||
203 | default : | 183 | default : |
204 | printk( KERN_WARNING "NETspider-U: No PCI card found\n" ); | 184 | printk( KERN_WARNING "NETspider-U: No PCI card found\n" ); |
205 | return 0; | 185 | return 0; /* end loop & function */ |
206 | } | ||
207 | break; | ||
208 | } | 186 | } |
209 | #else | 187 | return 1; /* end loop */ |
210 | 188 | } | |
211 | printk(KERN_WARNING "NETspider-U: NO_PCI_BIOS\n"); | ||
212 | printk(KERN_WARNING "NETspider-U: unable to config NETspider-U PCI\n"); | ||
213 | return (0); | ||
214 | |||
215 | #endif /* CONFIG_PCI */ | ||
216 | 189 | ||
217 | bytecnt = 256; | 190 | static int __devinit nju_cs_init_rest(struct IsdnCard *card, |
191 | struct IsdnCardState *cs) | ||
192 | { | ||
193 | const int bytecnt = 256; | ||
218 | 194 | ||
219 | printk(KERN_INFO | 195 | printk(KERN_INFO |
220 | "NETspider-U: PCI card configured at %#lx IRQ %d\n", | 196 | "NETspider-U: PCI card configured at %#lx IRQ %d\n", |
@@ -239,5 +215,48 @@ setup_netjet_u(struct IsdnCard *card) | |||
239 | cs->irq_func = &netjet_u_interrupt; | 215 | cs->irq_func = &netjet_u_interrupt; |
240 | cs->irq_flags |= IRQF_SHARED; | 216 | cs->irq_flags |= IRQF_SHARED; |
241 | ICCVersion(cs, "NETspider-U:"); | 217 | ICCVersion(cs, "NETspider-U:"); |
218 | |||
242 | return (1); | 219 | return (1); |
243 | } | 220 | } |
221 | |||
222 | static struct pci_dev *dev_netjet __devinitdata = NULL; | ||
223 | |||
224 | int __devinit | ||
225 | setup_netjet_u(struct IsdnCard *card) | ||
226 | { | ||
227 | int ret; | ||
228 | struct IsdnCardState *cs = card->cs; | ||
229 | char tmp[64]; | ||
230 | |||
231 | #ifdef __BIG_ENDIAN | ||
232 | #error "not running on big endian machines now" | ||
233 | #endif | ||
234 | |||
235 | strcpy(tmp, NETjet_U_revision); | ||
236 | printk(KERN_INFO "HiSax: Traverse Tech. NETspider-U driver Rev. %s\n", HiSax_getrev(tmp)); | ||
237 | if (cs->typ != ISDN_CTYPE_NETJET_U) | ||
238 | return(0); | ||
239 | test_and_clear_bit(FLG_LOCK_ATOMIC, &cs->HW_Flags); | ||
240 | |||
241 | for ( ;; ) | ||
242 | { | ||
243 | if ((dev_netjet = pci_find_device(PCI_VENDOR_ID_TIGERJET, | ||
244 | PCI_DEVICE_ID_TIGERJET_300, dev_netjet))) { | ||
245 | ret = nju_pci_probe(dev_netjet, cs); | ||
246 | if (!ret) | ||
247 | return(0); | ||
248 | } else { | ||
249 | printk(KERN_WARNING "NETspider-U: No PCI card found\n"); | ||
250 | return(0); | ||
251 | } | ||
252 | |||
253 | ret = nju_cs_init(card, cs); | ||
254 | if (!ret) | ||
255 | return (0); | ||
256 | if (ret > 0) | ||
257 | break; | ||
258 | /* ret < 0 == continue looping */ | ||
259 | } | ||
260 | |||
261 | return nju_cs_init_rest(card, cs); | ||
262 | } | ||