Lines Matching refs:np

106 	struct natsemi_private *np = container_of ( basher, struct natsemi_private,
111 eereg = inb ( np->ioaddr + EE_REG );
117 struct natsemi_private *np = container_of ( basher, struct natsemi_private,
122 eereg = inb ( np->ioaddr + EE_REG );
125 outb ( eereg, np->ioaddr + EE_REG );
147 static void natsemi_init_eeprom ( struct natsemi_private *np ) {
151 np->spibit.basher.op = &natsemi_basher_ops;
152 np->spibit.bus.mode = SPI_MODE_THREEWIRE;
153 np->spibit.endianness = SPI_BIT_LITTLE_ENDIAN;
154 init_spi_bit_basher ( &np->spibit );
158 init_at93c46 ( &np->eeprom, 16 );
159 np->eeprom.bus = &np->spibit.bus;
160 np->nvo.nvs = &np->eeprom.nvs;
161 np->nvo.fragments = natsemi_nvo_fragments;
174 struct natsemi_private *np = NULL;
183 netdev = alloc_etherdev (sizeof (*np));
188 np = netdev->priv;
191 memset (np, 0, sizeof (*np));
192 np->ioaddr = pci->ioaddr;
197 natsemi_init_eeprom ( np );
198 nvs_read ( &np->eeprom.nvs, EE_MAC-1, prev_bytes, 1 );
199 nvs_read ( &np->eeprom.nvs, EE_MAC, ll_addr_encoded, ETH_ALEN );
249 struct natsemi_private *np = netdev->priv;
267 cfg = inl (np->ioaddr + ChipConfig) & CFG_RESET_SAVE;
270 wcsr = inl (np->ioaddr + WOLCmd) & WCSR_RESET_SAVE;
273 rfcr = inl (np->ioaddr + RxFilterAddr) & RFCR_RESET_SAVE;
277 outl(i*2, np->ioaddr + RxFilterAddr);
278 pmatch[i] = inw(np->ioaddr + RxFilterData);
283 outl(0xa+(i*2), np->ioaddr + RxFilterAddr);
284 sopass[i] = inw(np->ioaddr + RxFilterData);
288 outl(ChipReset, np->ioaddr + ChipCmd);
290 if (! (inl (np->ioaddr + ChipCmd) & ChipReset))
299 cfg |= inl(np->ioaddr + ChipConfig) & ~CFG_RESET_SAVE;
301 outl (cfg, np->ioaddr + ChipConfig);
304 wcsr |= inl (np->ioaddr + WOLCmd) & ~WCSR_RESET_SAVE;
305 outl (wcsr, np->ioaddr + WOLCmd);
308 rfcr |= inl (np->ioaddr + RxFilterAddr) & ~RFCR_RESET_SAVE;
312 outl (i*2, np->ioaddr + RxFilterAddr);
313 outw (pmatch[i], np->ioaddr + RxFilterData);
316 outl (0xa+(i*2), np->ioaddr + RxFilterAddr);
317 outw (sopass[i], np->ioaddr + RxFilterData);
320 outl (rfcr, np->ioaddr + RxFilterAddr);
331 struct natsemi_private *np = netdev->priv;
342 outl (inl (np->ioaddr + ClkRun) & ~0x100, np->ioaddr + ClkRun);
347 outl (i, np->ioaddr + RxFilterAddr);
349 np->ioaddr + RxFilterData);
354 np->tx_cur = 0;
355 np->tx_dirty = 0;
357 np->tx[i].link = virt_to_bus ((i + 1 < TX_RING_SIZE) ? &np->tx[i + 1] : &np->tx[0]);
358 np->tx[i].cmdsts = 0;
359 np->tx[i].bufptr = 0;
361 outl (virt_to_bus (&np->tx[0]),np->ioaddr + TxRingPtr);
364 inl (np->ioaddr + TxRingPtr));
368 np->rx_cur = 0;
370 np->iobuf[i] = alloc_iob (RX_BUF_SIZE);
371 if (! np->iobuf[i])
373 np->rx[i].link = virt_to_bus ((i + 1 < NUM_RX_DESC)
374 ? &np->rx[i + 1] : &np->rx[0]);
375 np->rx[i].cmdsts = RX_BUF_SIZE;
376 np->rx[i].bufptr = virt_to_bus (np->iobuf[i]->data);
378 &np->iobuf[i], &np->iobuf[i]->data);
380 outl (virt_to_bus (&np->rx[0]), np->ioaddr + RxRingPtr);
383 inl (np->ioaddr + RxRingPtr));
388 np->ioaddr + RxFilterAddr);
394 if (inl (np->ioaddr + ChipConfig) & 0x20000000) { /* Full duplex */
403 outl (tx_config, np->ioaddr + TxConfig);
404 outl (rx_config, np->ioaddr + RxConfig);
407 inl (np->ioaddr + TxConfig),
408 inl (np->ioaddr + RxConfig));
412 outl((RxOk|RxErr|TxOk|TxErr),np->ioaddr + IntrMask);
415 outl (RxOn, np->ioaddr + ChipCmd);
425 while (np->rx[i].cmdsts == RX_BUF_SIZE) {
426 free_iob (np->iobuf[i]);
439 struct natsemi_private *np = netdev->priv;
445 free_iob (np->iobuf[i]);
458 struct natsemi_private *np = netdev->priv;
460 if (np->tx[np->tx_cur].cmdsts != 0) {
467 np->tx_iobuf[np->tx_cur] = iobuf;
477 np->tx[np->tx_cur].bufptr = virt_to_bus (iobuf->data);
478 np->tx[np->tx_cur].cmdsts = iob_len (iobuf) | OWN;
480 DBG ("TX id %d at %#08lx + %#08zx\n", np->tx_cur,
485 np->tx_cur = (np->tx_cur + 1) % TX_RING_SIZE;
489 outl (TxOn, np->ioaddr + ChipCmd);
501 struct natsemi_private *np = netdev->priv;
511 intr_status = inl (np->ioaddr + IntrStatus);
520 i = np->tx_dirty;
521 while (i != np->tx_cur) {
522 tx_status = np->tx[np->tx_dirty].cmdsts;
525 np->tx_dirty, np->tx_cur, tx_status);
531 netdev_tx_complete_err (netdev,np->tx_iobuf[np->tx_dirty],-EINVAL);
535 netdev_tx_complete (netdev, np->tx_iobuf[np->tx_dirty]);
539 np->tx[np->tx_dirty].cmdsts = 0;
540 np->tx_dirty = (np->tx_dirty + 1) % TX_RING_SIZE;
546 rx_status = (unsigned int) np->rx[np->rx_cur].cmdsts;
551 np->rx_cur, rx_status, rx_len);
558 np->rx[np->rx_cur].cmdsts);
570 np->iobuf[np->rx_cur]->data, rx_len);
575 np->rx[np->rx_cur].cmdsts = RX_BUF_SIZE;
576 np->rx_cur = (np->rx_cur + 1) % NUM_RX_DESC;
577 rx_status = np->rx[np->rx_cur].cmdsts;
582 outl (RxOn, np->ioaddr + ChipCmd);
593 struct natsemi_private *np = netdev->priv;
596 np->ioaddr + IntrMask);
597 outl ((enable ? 1 : 0), np->ioaddr + IntrEnable);