Lines Matching refs:card

37 	hysdn_card *card = dev_id;	/* parameter from irq */
42 if (!card)
44 if (!card->irq_enabled)
47 spin_lock_irqsave(&card->hysdn_lock, flags); /* no further irqs allowed */
49 if (!(bytein(card->iobase + PCI9050_INTR_REG) & PCI9050_INTR_REG_STAT1)) {
50 spin_unlock_irqrestore(&card->hysdn_lock, flags); /* restore old state */
54 dpr = card->dpram;
60 if (!card->hw_lock)
61 schedule_work(&card->irq_queue);
62 spin_unlock_irqrestore(&card->hysdn_lock, flags);
70 /* the card after booting. The task may be queued from everywhere */
76 hysdn_card *card = container_of(ugli_api, hysdn_card, irq_queue);
81 if (card->state != CARD_STATE_RUN)
84 dpr = card->dpram; /* point to DPRAM */
86 spin_lock_irqsave(&card->hysdn_lock, flags);
87 if (card->hw_lock) {
88 spin_unlock_irqrestore(&card->hysdn_lock, flags); /* hardware currently unavailable */
91 card->hw_lock = 1; /* we now lock the hardware */
99 if (hysdn_sched_tx(card, dpr->ToHyBuf, &dpr->ToHySize, &dpr->ToHyChannel,
108 if (hysdn_sched_rx(card, dpr->ToPcBuf, dpr->ToPcSize, dpr->ToPcChannel)) {
117 card->hw_lock = 0; /* free hardware again */
120 spin_unlock_irqrestore(&card->hysdn_lock, flags);
125 /* stop the card (hardware reset) and disable interrupts */
128 ergo_stopcard(hysdn_card *card)
133 hysdn_net_release(card); /* first release the net device if existing */
135 hycapi_capi_stop(card);
137 spin_lock_irqsave(&card->hysdn_lock, flags);
138 val = bytein(card->iobase + PCI9050_INTR_REG); /* get actual value */
140 byteout(card->iobase + PCI9050_INTR_REG, val);
141 card->irq_enabled = 0;
142 byteout(card->iobase + PCI9050_USER_IO, PCI9050_E1_RESET); /* reset E1 processor */
143 card->state = CARD_STATE_UNUSED;
144 card->err_log_state = ERRLOG_STATE_OFF; /* currently no log active */
146 spin_unlock_irqrestore(&card->hysdn_lock, flags);
153 ergo_set_errlog_state(hysdn_card *card, int on)
157 if (card->state != CARD_STATE_RUN) {
158 card->err_log_state = ERRLOG_STATE_OFF; /* must be off */
161 spin_lock_irqsave(&card->hysdn_lock, flags);
163 if (((card->err_log_state == ERRLOG_STATE_OFF) && !on) ||
164 ((card->err_log_state == ERRLOG_STATE_ON) && on)) {
165 spin_unlock_irqrestore(&card->hysdn_lock, flags);
169 card->err_log_state = ERRLOG_STATE_START; /* request start */
171 card->err_log_state = ERRLOG_STATE_STOP; /* request stop */
173 spin_unlock_irqrestore(&card->hysdn_lock, flags);
174 schedule_work(&card->irq_queue);
183 ergo_testram(hysdn_card *card)
185 tErgDpram *dpr = card->dpram;
209 /* PCI-write-buffers flushed and the card is taken out of reset. */
214 ergo_writebootimg(struct HYSDN_CARD *card, unsigned char *buf,
221 if (card->debug_flags & LOG_POF_CARD)
222 hysdn_addlog(card, "ERGO: write bootldr offs=0x%lx ", offs);
224 dst = card->dpram; /* pointer to start of DPRAM */
236 memset(card->dpram, 0, ERG_DPRAM_FILL_SIZE); /* fill the DPRAM still not cleared */
237 dpram = card->dpram; /* get pointer to dpram structure */
241 byteout(card->iobase + PCI9050_USER_IO, PCI9050_E1_RUN); /* start E1 processor */
246 if (((tDpramBootSpooler *) card->dpram)->Len != DPRAM_SPOOLER_DATA_SIZE) {
247 if (card->debug_flags & LOG_POF_CARD)
248 hysdn_addlog(card, "ERGO: write bootldr no answer");
261 ergo_writebootseq(struct HYSDN_CARD *card, unsigned char *buf, int len)
263 tDpramBootSpooler *sp = (tDpramBootSpooler *) card->dpram;
271 if (card->debug_flags & LOG_POF_CARD)
272 hysdn_addlog(card, "ERGO: write boot seq len=%d ", len);
289 if (card->debug_flags & LOG_POF_CARD)
290 hysdn_addlog(card, "ERGO: write boot seq timeout");
322 ergo_waitpofready(struct HYSDN_CARD *card)
324 tErgDpram *dpr = card->dpram; /* pointer to DPRAM structure */
330 if (card->debug_flags & LOG_POF_CARD)
331 hysdn_addlog(card, "ERGO: waiting for pof ready");
347 if (EvalSysrTokData(card, dpr->ToPcBuf + RDY_MAGIC_SIZE, msg_size))
350 if (card->debug_flags & LOG_POF_RECORD)
351 hysdn_addlog(card, "ERGO: pof boot success");
352 spin_lock_irqsave(&card->hysdn_lock, flags);
354 card->state = CARD_STATE_RUN; /* now card is running */
356 byteout(card->iobase + PCI9050_INTR_REG,
357 bytein(card->iobase + PCI9050_INTR_REG) |
359 card->irq_enabled = 1; /* we are ready to receive interrupts */
365 spin_unlock_irqrestore(&card->hysdn_lock, flags);
366 if ((hynet_enable & (1 << card->myid))
367 && (i = hysdn_net_create(card)))
369 ergo_stopcard(card);
370 card->state = CARD_STATE_BOOTERR;
374 if ((i = hycapi_capi_create(card))) {
383 if (card->debug_flags & LOG_POF_CARD)
384 hysdn_addlog(card, "ERGO: pof boot ready timeout");
396 ergo_releasehardware(hysdn_card *card)
398 ergo_stopcard(card); /* first stop the card if not already done */
399 free_irq(card->irq, card); /* release interrupt */
400 release_region(card->iobase + PCI9050_INTR_REG, 1); /* release all io ports */
401 release_region(card->iobase + PCI9050_USER_IO, 1);
402 iounmap(card->dpram);
403 card->dpram = NULL; /* release shared mem */
413 ergo_inithardware(hysdn_card *card)
415 if (!request_region(card->iobase + PCI9050_INTR_REG, 1, "HYSDN"))
417 if (!request_region(card->iobase + PCI9050_USER_IO, 1, "HYSDN")) {
418 release_region(card->iobase + PCI9050_INTR_REG, 1);
421 card->memend = card->membase + ERG_DPRAM_PAGE_SIZE - 1;
422 if (!(card->dpram = ioremap(card->membase, ERG_DPRAM_PAGE_SIZE))) {
423 release_region(card->iobase + PCI9050_INTR_REG, 1);
424 release_region(card->iobase + PCI9050_USER_IO, 1);
428 ergo_stopcard(card); /* disable interrupts */
429 if (request_irq(card->irq, ergo_interrupt, IRQF_SHARED, "HYSDN", card)) {
430 ergo_releasehardware(card); /* return the acquired hardware */
434 card->stopcard = ergo_stopcard;
435 card->releasehardware = ergo_releasehardware;
436 card->testram = ergo_testram;
437 card->writebootimg = ergo_writebootimg;
438 card->writebootseq = ergo_writebootseq;
439 card->waitpofready = ergo_waitpofready;
440 card->set_errlog_state = ergo_set_errlog_state;
441 INIT_WORK(&card->irq_queue, ergo_irq_bh);
442 spin_lock_init(&card->hysdn_lock);