Lines Matching refs:np

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