Lines Matching refs:hp
110 static __inline__ void tx_add_log(struct happy_meal *hp, unsigned int a, unsigned int s) in tx_add_log() argument
118 tlp->tx_new = hp->tx_new; in tx_add_log()
119 tlp->tx_old = hp->tx_old; in tx_add_log()
138 static __inline__ void tx_dump_ring(struct happy_meal *hp) in tx_dump_ring() argument
140 struct hmeal_init_block *hb = hp->happy_block; in tx_dump_ring()
154 #define tx_add_log(hp, a, s) do { } while(0) argument
156 #define tx_dump_ring(hp) do { } while(0) argument
304 static inline u32 hme_read_desc32(struct happy_meal *hp, hme32 *p) in hme_read_desc32() argument
321 static void BB_PUT_BIT(struct happy_meal *hp, void __iomem *tregs, int bit) in BB_PUT_BIT() argument
323 hme_write32(hp, tregs + TCVR_BBDATA, bit); in BB_PUT_BIT()
324 hme_write32(hp, tregs + TCVR_BBCLOCK, 0); in BB_PUT_BIT()
325 hme_write32(hp, tregs + TCVR_BBCLOCK, 1); in BB_PUT_BIT()
329 static u32 BB_GET_BIT(struct happy_meal *hp, void __iomem *tregs, int internal)
333 hme_write32(hp, tregs + TCVR_BBCLOCK, 0);
334 hme_write32(hp, tregs + TCVR_BBCLOCK, 1);
335 ret = hme_read32(hp, tregs + TCVR_CFG);
345 static u32 BB_GET_BIT2(struct happy_meal *hp, void __iomem *tregs, int internal) in BB_GET_BIT2() argument
349 hme_write32(hp, tregs + TCVR_BBCLOCK, 0); in BB_GET_BIT2()
351 retval = hme_read32(hp, tregs + TCVR_CFG); in BB_GET_BIT2()
356 hme_write32(hp, tregs + TCVR_BBCLOCK, 1); in BB_GET_BIT2()
363 static int happy_meal_bb_read(struct happy_meal *hp, in happy_meal_bb_read() argument
373 hme_write32(hp, tregs + TCVR_BBOENAB, 1); in happy_meal_bb_read()
377 BB_PUT_BIT(hp, tregs, 1); in happy_meal_bb_read()
380 BB_PUT_BIT(hp, tregs, 0); in happy_meal_bb_read()
381 BB_PUT_BIT(hp, tregs, 1); in happy_meal_bb_read()
382 BB_PUT_BIT(hp, tregs, 1); in happy_meal_bb_read()
383 BB_PUT_BIT(hp, tregs, 0); in happy_meal_bb_read()
386 tmp = hp->paddr & 0xff; in happy_meal_bb_read()
388 BB_PUT_BIT(hp, tregs, ((tmp >> i) & 1)); in happy_meal_bb_read()
393 BB_PUT_BIT(hp, tregs, ((tmp >> i) & 1)); in happy_meal_bb_read()
396 hme_write32(hp, tregs + TCVR_BBOENAB, 0); in happy_meal_bb_read()
399 (void) BB_GET_BIT2(hp, tregs, (hp->tcvr_type == internal)); in happy_meal_bb_read()
401 retval |= BB_GET_BIT2(hp, tregs, (hp->tcvr_type == internal)); in happy_meal_bb_read()
402 (void) BB_GET_BIT2(hp, tregs, (hp->tcvr_type == internal)); in happy_meal_bb_read()
403 (void) BB_GET_BIT2(hp, tregs, (hp->tcvr_type == internal)); in happy_meal_bb_read()
404 (void) BB_GET_BIT2(hp, tregs, (hp->tcvr_type == internal)); in happy_meal_bb_read()
409 static void happy_meal_bb_write(struct happy_meal *hp, in happy_meal_bb_write() argument
419 hme_write32(hp, tregs + TCVR_BBOENAB, 1); in happy_meal_bb_write()
423 BB_PUT_BIT(hp, tregs, 1); in happy_meal_bb_write()
426 BB_PUT_BIT(hp, tregs, 0); in happy_meal_bb_write()
427 BB_PUT_BIT(hp, tregs, 1); in happy_meal_bb_write()
428 BB_PUT_BIT(hp, tregs, 0); in happy_meal_bb_write()
429 BB_PUT_BIT(hp, tregs, 1); in happy_meal_bb_write()
432 tmp = (hp->paddr & 0xff); in happy_meal_bb_write()
434 BB_PUT_BIT(hp, tregs, ((tmp >> i) & 1)); in happy_meal_bb_write()
439 BB_PUT_BIT(hp, tregs, ((tmp >> i) & 1)); in happy_meal_bb_write()
442 BB_PUT_BIT(hp, tregs, 1); in happy_meal_bb_write()
443 BB_PUT_BIT(hp, tregs, 0); in happy_meal_bb_write()
446 BB_PUT_BIT(hp, tregs, ((value >> i) & 1)); in happy_meal_bb_write()
449 hme_write32(hp, tregs + TCVR_BBOENAB, 0); in happy_meal_bb_write()
454 static int happy_meal_tcvr_read(struct happy_meal *hp, in happy_meal_tcvr_read() argument
461 if (hp->tcvr_type == none) { in happy_meal_tcvr_read()
466 if (!(hp->happy_flags & HFLAG_FENABLE)) { in happy_meal_tcvr_read()
468 return happy_meal_bb_read(hp, tregs, reg); in happy_meal_tcvr_read()
471 hme_write32(hp, tregs + TCVR_FRAME, in happy_meal_tcvr_read()
472 (FRAME_READ | (hp->paddr << 23) | ((reg & 0xff) << 18))); in happy_meal_tcvr_read()
473 while (!(hme_read32(hp, tregs + TCVR_FRAME) & 0x10000) && --tries) in happy_meal_tcvr_read()
479 retval = hme_read32(hp, tregs + TCVR_FRAME) & 0xffff; in happy_meal_tcvr_read()
486 static void happy_meal_tcvr_write(struct happy_meal *hp, in happy_meal_tcvr_write() argument
495 if (!(hp->happy_flags & HFLAG_FENABLE)) { in happy_meal_tcvr_write()
496 happy_meal_bb_write(hp, tregs, reg, value); in happy_meal_tcvr_write()
501 hme_write32(hp, tregs + TCVR_FRAME, in happy_meal_tcvr_write()
502 (FRAME_WRITE | (hp->paddr << 23) | in happy_meal_tcvr_write()
504 while (!(hme_read32(hp, tregs + TCVR_FRAME) & 0x10000) && --tries) in happy_meal_tcvr_write()
546 static int try_next_permutation(struct happy_meal *hp, void __iomem *tregs) in try_next_permutation() argument
548 hp->sw_bmcr = happy_meal_tcvr_read(hp, tregs, MII_BMCR); in try_next_permutation()
553 if (hp->sw_bmcr & BMCR_FULLDPLX) { in try_next_permutation()
554 hp->sw_bmcr &= ~(BMCR_FULLDPLX); in try_next_permutation()
555 happy_meal_tcvr_write(hp, tregs, MII_BMCR, hp->sw_bmcr); in try_next_permutation()
560 if (hp->sw_bmcr & BMCR_SPEED100) { in try_next_permutation()
561 hp->sw_bmcr &= ~(BMCR_SPEED100); in try_next_permutation()
562 happy_meal_tcvr_write(hp, tregs, MII_BMCR, hp->sw_bmcr); in try_next_permutation()
570 static void display_link_mode(struct happy_meal *hp, void __iomem *tregs) in display_link_mode() argument
572 printk(KERN_INFO "%s: Link is up using ", hp->dev->name); in display_link_mode()
573 if (hp->tcvr_type == external) in display_link_mode()
578 hp->sw_lpa = happy_meal_tcvr_read(hp, tregs, MII_LPA); in display_link_mode()
579 if (hp->sw_lpa & (LPA_100HALF | LPA_100FULL)) { in display_link_mode()
580 if (hp->sw_lpa & LPA_100FULL) in display_link_mode()
585 if (hp->sw_lpa & LPA_10FULL) in display_link_mode()
592 static void display_forced_link_mode(struct happy_meal *hp, void __iomem *tregs) in display_forced_link_mode() argument
594 printk(KERN_INFO "%s: Link has been forced up using ", hp->dev->name); in display_forced_link_mode()
595 if (hp->tcvr_type == external) in display_forced_link_mode()
600 hp->sw_bmcr = happy_meal_tcvr_read(hp, tregs, MII_BMCR); in display_forced_link_mode()
601 if (hp->sw_bmcr & BMCR_SPEED100) in display_forced_link_mode()
605 if (hp->sw_bmcr & BMCR_FULLDPLX) in display_forced_link_mode()
611 static int set_happy_link_modes(struct happy_meal *hp, void __iomem *tregs) in set_happy_link_modes() argument
618 if (hp->timer_state == arbwait) { in set_happy_link_modes()
619 hp->sw_lpa = happy_meal_tcvr_read(hp, tregs, MII_LPA); in set_happy_link_modes()
620 if (!(hp->sw_lpa & (LPA_10HALF | LPA_10FULL | LPA_100HALF | LPA_100FULL))) in set_happy_link_modes()
622 if (hp->sw_lpa & LPA_100FULL) in set_happy_link_modes()
624 else if (hp->sw_lpa & LPA_100HALF) in set_happy_link_modes()
626 else if (hp->sw_lpa & LPA_10FULL) in set_happy_link_modes()
632 hp->sw_bmcr = happy_meal_tcvr_read(hp, tregs, MII_BMCR); in set_happy_link_modes()
633 if (hp->sw_bmcr & BMCR_FULLDPLX) in set_happy_link_modes()
647 hme_write32(hp, hp->bigmacregs + BMAC_TXCFG, in set_happy_link_modes()
648 hme_read32(hp, hp->bigmacregs + BMAC_TXCFG) & in set_happy_link_modes()
650 while (hme_read32(hp, hp->bigmacregs + BMAC_TXCFG) & BIGMAC_TXCFG_ENABLE) in set_happy_link_modes()
653 hp->happy_flags |= HFLAG_FULL; in set_happy_link_modes()
654 hme_write32(hp, hp->bigmacregs + BMAC_TXCFG, in set_happy_link_modes()
655 hme_read32(hp, hp->bigmacregs + BMAC_TXCFG) | in set_happy_link_modes()
658 hp->happy_flags &= ~(HFLAG_FULL); in set_happy_link_modes()
659 hme_write32(hp, hp->bigmacregs + BMAC_TXCFG, in set_happy_link_modes()
660 hme_read32(hp, hp->bigmacregs + BMAC_TXCFG) & in set_happy_link_modes()
663 hme_write32(hp, hp->bigmacregs + BMAC_TXCFG, in set_happy_link_modes()
664 hme_read32(hp, hp->bigmacregs + BMAC_TXCFG) | in set_happy_link_modes()
671 static int happy_meal_init(struct happy_meal *hp);
673 static int is_lucent_phy(struct happy_meal *hp) in is_lucent_phy() argument
675 void __iomem *tregs = hp->tcvregs; in is_lucent_phy()
679 mr2 = happy_meal_tcvr_read(hp, tregs, 2); in is_lucent_phy()
680 mr3 = happy_meal_tcvr_read(hp, tregs, 3); in is_lucent_phy()
690 struct happy_meal *hp = (struct happy_meal *) data; in happy_meal_timer() local
691 void __iomem *tregs = hp->tcvregs; in happy_meal_timer()
694 spin_lock_irq(&hp->happy_lock); in happy_meal_timer()
696 hp->timer_ticks++; in happy_meal_timer()
697 switch(hp->timer_state) { in happy_meal_timer()
702 if (hp->timer_ticks >= 10) { in happy_meal_timer()
705 hp->sw_bmcr = happy_meal_tcvr_read(hp, tregs, MII_BMCR); in happy_meal_timer()
707 hp->dev->name); in happy_meal_timer()
708 hp->sw_bmcr = BMCR_SPEED100; in happy_meal_timer()
709 happy_meal_tcvr_write(hp, tregs, MII_BMCR, hp->sw_bmcr); in happy_meal_timer()
711 if (!is_lucent_phy(hp)) { in happy_meal_timer()
716 hp->sw_csconfig = happy_meal_tcvr_read(hp, tregs, DP83840_CSCONFIG); in happy_meal_timer()
717 hp->sw_csconfig &= ~(CSCONFIG_TCVDISAB); in happy_meal_timer()
718 happy_meal_tcvr_write(hp, tregs, DP83840_CSCONFIG, hp->sw_csconfig); in happy_meal_timer()
720 hp->timer_state = ltrywait; in happy_meal_timer()
721 hp->timer_ticks = 0; in happy_meal_timer()
725 hp->sw_bmsr = happy_meal_tcvr_read(hp, tregs, MII_BMSR); in happy_meal_timer()
726 if (hp->sw_bmsr & BMSR_ANEGCOMPLETE) { in happy_meal_timer()
730 ret = set_happy_link_modes(hp, tregs); in happy_meal_timer()
742 hp->timer_state = lupwait; in happy_meal_timer()
756 hp->sw_bmsr = happy_meal_tcvr_read(hp, tregs, MII_BMSR); in happy_meal_timer()
757 if (hp->sw_bmsr & BMSR_LSTATUS) { in happy_meal_timer()
761 display_link_mode(hp, tregs); in happy_meal_timer()
762 hp->timer_state = asleep; in happy_meal_timer()
765 if (hp->timer_ticks >= 10) { in happy_meal_timer()
767 "not completely up.\n", hp->dev->name); in happy_meal_timer()
768 hp->timer_ticks = 0; in happy_meal_timer()
782 hp->sw_bmsr = happy_meal_tcvr_read(hp, tregs, MII_BMSR); in happy_meal_timer()
783 hp->sw_csconfig = happy_meal_tcvr_read(hp, tregs, DP83840_CSCONFIG); in happy_meal_timer()
784 if (hp->timer_ticks == 1) { in happy_meal_timer()
785 if (!is_lucent_phy(hp)) { in happy_meal_timer()
789 hp->sw_csconfig |= CSCONFIG_TCVDISAB; in happy_meal_timer()
790 happy_meal_tcvr_write(hp, tregs, in happy_meal_timer()
791 DP83840_CSCONFIG, hp->sw_csconfig); in happy_meal_timer()
796 if (hp->timer_ticks == 2) { in happy_meal_timer()
797 if (!is_lucent_phy(hp)) { in happy_meal_timer()
798 hp->sw_csconfig &= ~(CSCONFIG_TCVDISAB); in happy_meal_timer()
799 happy_meal_tcvr_write(hp, tregs, in happy_meal_timer()
800 DP83840_CSCONFIG, hp->sw_csconfig); in happy_meal_timer()
805 if (hp->sw_bmsr & BMSR_LSTATUS) { in happy_meal_timer()
807 display_forced_link_mode(hp, tregs); in happy_meal_timer()
808 set_happy_link_modes(hp, tregs); /* XXX error? then what? */ in happy_meal_timer()
809 hp->timer_state = asleep; in happy_meal_timer()
812 if (hp->timer_ticks >= 4) { /* 6 seconds or so... */ in happy_meal_timer()
815 ret = try_next_permutation(hp, tregs); in happy_meal_timer()
823 hp->dev->name); in happy_meal_timer()
825 ret = happy_meal_init(hp); in happy_meal_timer()
829 "Happy Meal.\n", hp->dev->name); in happy_meal_timer()
833 if (!is_lucent_phy(hp)) { in happy_meal_timer()
834 hp->sw_csconfig = happy_meal_tcvr_read(hp, tregs, in happy_meal_timer()
836 hp->sw_csconfig |= CSCONFIG_TCVDISAB; in happy_meal_timer()
837 happy_meal_tcvr_write(hp, tregs, in happy_meal_timer()
838 DP83840_CSCONFIG, hp->sw_csconfig); in happy_meal_timer()
840 hp->timer_ticks = 0; in happy_meal_timer()
852 hp->dev->name); in happy_meal_timer()
854 hp->timer_ticks = 0; in happy_meal_timer()
855 hp->timer_state = asleep; /* foo on you */ in happy_meal_timer()
860 hp->happy_timer.expires = jiffies + ((12 * HZ)/10); /* 1.2 sec. */ in happy_meal_timer()
861 add_timer(&hp->happy_timer); in happy_meal_timer()
865 spin_unlock_irq(&hp->happy_lock); in happy_meal_timer()
872 static void happy_meal_tx_reset(struct happy_meal *hp, void __iomem *bregs) in happy_meal_tx_reset() argument
879 hme_write32(hp, bregs + BMAC_TXSWRESET, 0); in happy_meal_tx_reset()
880 while ((hme_read32(hp, bregs + BMAC_TXSWRESET) & 1) && --tries) in happy_meal_tx_reset()
892 static void happy_meal_rx_reset(struct happy_meal *hp, void __iomem *bregs) in happy_meal_rx_reset() argument
899 hme_write32(hp, bregs + BMAC_RXSWRESET, 0); in happy_meal_rx_reset()
900 while ((hme_read32(hp, bregs + BMAC_RXSWRESET) & 1) && --tries) in happy_meal_rx_reset()
914 static void happy_meal_stop(struct happy_meal *hp, void __iomem *gregs) in happy_meal_stop() argument
921 hme_write32(hp, gregs + GREG_SWRESET, GREG_RESET_ALL); in happy_meal_stop()
922 while (hme_read32(hp, gregs + GREG_SWRESET) && --tries) in happy_meal_stop()
934 static void happy_meal_get_counters(struct happy_meal *hp, void __iomem *bregs) in happy_meal_get_counters() argument
936 struct net_device_stats *stats = &hp->net_stats; in happy_meal_get_counters()
938 stats->rx_crc_errors += hme_read32(hp, bregs + BMAC_RCRCECTR); in happy_meal_get_counters()
939 hme_write32(hp, bregs + BMAC_RCRCECTR, 0); in happy_meal_get_counters()
941 stats->rx_frame_errors += hme_read32(hp, bregs + BMAC_UNALECTR); in happy_meal_get_counters()
942 hme_write32(hp, bregs + BMAC_UNALECTR, 0); in happy_meal_get_counters()
944 stats->rx_length_errors += hme_read32(hp, bregs + BMAC_GLECTR); in happy_meal_get_counters()
945 hme_write32(hp, bregs + BMAC_GLECTR, 0); in happy_meal_get_counters()
947 stats->tx_aborted_errors += hme_read32(hp, bregs + BMAC_EXCTR); in happy_meal_get_counters()
950 (hme_read32(hp, bregs + BMAC_EXCTR) + in happy_meal_get_counters()
951 hme_read32(hp, bregs + BMAC_LTCTR)); in happy_meal_get_counters()
952 hme_write32(hp, bregs + BMAC_EXCTR, 0); in happy_meal_get_counters()
953 hme_write32(hp, bregs + BMAC_LTCTR, 0); in happy_meal_get_counters()
957 static void happy_meal_poll_stop(struct happy_meal *hp, void __iomem *tregs) in happy_meal_poll_stop() argument
962 if ((hp->happy_flags & (HFLAG_POLLENABLE | HFLAG_POLL)) != in happy_meal_poll_stop()
970 hme_write32(hp, tregs + TCVR_IMASK, 0xffff); in happy_meal_poll_stop()
974 hme_write32(hp, tregs + TCVR_CFG, in happy_meal_poll_stop()
975 hme_read32(hp, tregs + TCVR_CFG) & ~(TCV_CFG_PENABLE)); in happy_meal_poll_stop()
978 hp->happy_flags &= ~(HFLAG_POLL); in happy_meal_poll_stop()
992 static int happy_meal_tcvr_reset(struct happy_meal *hp, void __iomem *tregs) in happy_meal_tcvr_reset() argument
997 tconfig = hme_read32(hp, tregs + TCVR_CFG); in happy_meal_tcvr_reset()
999 if (hp->tcvr_type == external) { in happy_meal_tcvr_reset()
1001 hme_write32(hp, tregs + TCVR_CFG, tconfig & ~(TCV_CFG_PSELECT)); in happy_meal_tcvr_reset()
1002 hp->tcvr_type = internal; in happy_meal_tcvr_reset()
1003 hp->paddr = TCV_PADDR_ITX; in happy_meal_tcvr_reset()
1005 happy_meal_tcvr_write(hp, tregs, MII_BMCR, in happy_meal_tcvr_reset()
1007 result = happy_meal_tcvr_read(hp, tregs, MII_BMCR); in happy_meal_tcvr_reset()
1013 hme_write32(hp, tregs + TCVR_CFG, tconfig | TCV_CFG_PSELECT); in happy_meal_tcvr_reset()
1014 hp->tcvr_type = external; in happy_meal_tcvr_reset()
1015 hp->paddr = TCV_PADDR_ETX; in happy_meal_tcvr_reset()
1019 hme_write32(hp, tregs + TCVR_CFG, (tconfig | TCV_CFG_PSELECT)); in happy_meal_tcvr_reset()
1021 happy_meal_tcvr_write(hp, tregs, MII_BMCR, in happy_meal_tcvr_reset()
1023 result = happy_meal_tcvr_read(hp, tregs, MII_BMCR); in happy_meal_tcvr_reset()
1029 hme_write32(hp, tregs + TCVR_CFG, (tconfig & ~(TCV_CFG_PSELECT))); in happy_meal_tcvr_reset()
1030 hp->tcvr_type = internal; in happy_meal_tcvr_reset()
1031 hp->paddr = TCV_PADDR_ITX; in happy_meal_tcvr_reset()
1036 happy_meal_tcvr_write(hp, tregs, MII_BMCR, BMCR_RESET); in happy_meal_tcvr_reset()
1039 result = happy_meal_tcvr_read(hp, tregs, MII_BMCR); in happy_meal_tcvr_reset()
1042 hp->sw_bmcr = result; in happy_meal_tcvr_reset()
1054 hp->sw_bmsr = happy_meal_tcvr_read(hp, tregs, MII_BMSR); in happy_meal_tcvr_reset()
1055 hp->sw_physid1 = happy_meal_tcvr_read(hp, tregs, MII_PHYSID1); in happy_meal_tcvr_reset()
1056 hp->sw_physid2 = happy_meal_tcvr_read(hp, tregs, MII_PHYSID2); in happy_meal_tcvr_reset()
1057 hp->sw_advertise = happy_meal_tcvr_read(hp, tregs, MII_ADVERTISE); in happy_meal_tcvr_reset()
1060 hp->sw_bmcr &= ~(BMCR_ISOLATE); in happy_meal_tcvr_reset()
1061 happy_meal_tcvr_write(hp, tregs, MII_BMCR, hp->sw_bmcr); in happy_meal_tcvr_reset()
1065 result = happy_meal_tcvr_read(hp, tregs, MII_BMCR); in happy_meal_tcvr_reset()
1077 if (!is_lucent_phy(hp)) { in happy_meal_tcvr_reset()
1078 result = happy_meal_tcvr_read(hp, tregs, in happy_meal_tcvr_reset()
1080 happy_meal_tcvr_write(hp, tregs, in happy_meal_tcvr_reset()
1090 static void happy_meal_transceiver_check(struct happy_meal *hp, void __iomem *tregs) in happy_meal_transceiver_check() argument
1092 unsigned long tconfig = hme_read32(hp, tregs + TCVR_CFG); in happy_meal_transceiver_check()
1095 if (hp->happy_flags & HFLAG_POLL) { in happy_meal_transceiver_check()
1098 if (hp->tcvr_type == internal) { in happy_meal_transceiver_check()
1101 happy_meal_poll_stop(hp, tregs); in happy_meal_transceiver_check()
1102 hp->paddr = TCV_PADDR_ETX; in happy_meal_transceiver_check()
1103 hp->tcvr_type = external; in happy_meal_transceiver_check()
1107 hme_write32(hp, tregs + TCVR_CFG, tconfig); in happy_meal_transceiver_check()
1110 if (hp->tcvr_type == external) { in happy_meal_transceiver_check()
1112 if (!(hme_read32(hp, tregs + TCVR_STATUS) >> 16)) { in happy_meal_transceiver_check()
1114 happy_meal_poll_stop(hp, tregs); in happy_meal_transceiver_check()
1115 hp->paddr = TCV_PADDR_ITX; in happy_meal_transceiver_check()
1116 hp->tcvr_type = internal; in happy_meal_transceiver_check()
1118 hme_write32(hp, tregs + TCVR_CFG, in happy_meal_transceiver_check()
1119 hme_read32(hp, tregs + TCVR_CFG) & in happy_meal_transceiver_check()
1128 u32 reread = hme_read32(hp, tregs + TCVR_CFG); in happy_meal_transceiver_check()
1133 hme_write32(hp, tregs + TCVR_CFG, tconfig | TCV_CFG_PSELECT); in happy_meal_transceiver_check()
1134 hp->paddr = TCV_PADDR_ETX; in happy_meal_transceiver_check()
1135 hp->tcvr_type = external; in happy_meal_transceiver_check()
1139 hme_write32(hp, tregs + TCVR_CFG, in happy_meal_transceiver_check()
1141 hp->paddr = TCV_PADDR_ITX; in happy_meal_transceiver_check()
1142 hp->tcvr_type = internal; in happy_meal_transceiver_check()
1146 hp->tcvr_type = none; /* Grrr... */ in happy_meal_transceiver_check()
1197 static void happy_meal_clean_rings(struct happy_meal *hp) in happy_meal_clean_rings() argument
1202 if (hp->rx_skbs[i] != NULL) { in happy_meal_clean_rings()
1203 struct sk_buff *skb = hp->rx_skbs[i]; in happy_meal_clean_rings()
1207 rxd = &hp->happy_block->happy_meal_rxd[i]; in happy_meal_clean_rings()
1208 dma_addr = hme_read_desc32(hp, &rxd->rx_addr); in happy_meal_clean_rings()
1209 dma_unmap_single(hp->dma_dev, dma_addr, in happy_meal_clean_rings()
1212 hp->rx_skbs[i] = NULL; in happy_meal_clean_rings()
1217 if (hp->tx_skbs[i] != NULL) { in happy_meal_clean_rings()
1218 struct sk_buff *skb = hp->tx_skbs[i]; in happy_meal_clean_rings()
1223 hp->tx_skbs[i] = NULL; in happy_meal_clean_rings()
1226 txd = &hp->happy_block->happy_meal_txd[i]; in happy_meal_clean_rings()
1227 dma_addr = hme_read_desc32(hp, &txd->tx_addr); in happy_meal_clean_rings()
1229 dma_unmap_single(hp->dma_dev, dma_addr, in happy_meal_clean_rings()
1230 (hme_read_desc32(hp, &txd->tx_flags) in happy_meal_clean_rings()
1234 dma_unmap_page(hp->dma_dev, dma_addr, in happy_meal_clean_rings()
1235 (hme_read_desc32(hp, &txd->tx_flags) in happy_meal_clean_rings()
1249 static void happy_meal_init_rings(struct happy_meal *hp) in happy_meal_init_rings() argument
1251 struct hmeal_init_block *hb = hp->happy_block; in happy_meal_init_rings()
1255 hp->rx_new = hp->rx_old = hp->tx_new = hp->tx_old = 0; in happy_meal_init_rings()
1259 happy_meal_clean_rings(hp); in happy_meal_init_rings()
1268 hme_write_rxd(hp, &hb->happy_meal_rxd[i], 0, 0); in happy_meal_init_rings()
1271 hp->rx_skbs[i] = skb; in happy_meal_init_rings()
1275 hme_write_rxd(hp, &hb->happy_meal_rxd[i], in happy_meal_init_rings()
1277 dma_map_single(hp->dma_dev, skb->data, RX_BUF_ALLOC_SIZE, in happy_meal_init_rings()
1284 hme_write_txd(hp, &hb->happy_meal_txd[i], 0, 0); in happy_meal_init_rings()
1290 static void happy_meal_begin_auto_negotiation(struct happy_meal *hp, in happy_meal_begin_auto_negotiation() argument
1297 hp->sw_bmsr = happy_meal_tcvr_read(hp, tregs, MII_BMSR); in happy_meal_begin_auto_negotiation()
1298 hp->sw_bmcr = happy_meal_tcvr_read(hp, tregs, MII_BMCR); in happy_meal_begin_auto_negotiation()
1299 hp->sw_physid1 = happy_meal_tcvr_read(hp, tregs, MII_PHYSID1); in happy_meal_begin_auto_negotiation()
1300 hp->sw_physid2 = happy_meal_tcvr_read(hp, tregs, MII_PHYSID2); in happy_meal_begin_auto_negotiation()
1304 hp->sw_advertise = happy_meal_tcvr_read(hp, tregs, MII_ADVERTISE); in happy_meal_begin_auto_negotiation()
1307 if (hp->sw_bmsr & BMSR_10HALF) in happy_meal_begin_auto_negotiation()
1308 hp->sw_advertise |= (ADVERTISE_10HALF); in happy_meal_begin_auto_negotiation()
1310 hp->sw_advertise &= ~(ADVERTISE_10HALF); in happy_meal_begin_auto_negotiation()
1312 if (hp->sw_bmsr & BMSR_10FULL) in happy_meal_begin_auto_negotiation()
1313 hp->sw_advertise |= (ADVERTISE_10FULL); in happy_meal_begin_auto_negotiation()
1315 hp->sw_advertise &= ~(ADVERTISE_10FULL); in happy_meal_begin_auto_negotiation()
1316 if (hp->sw_bmsr & BMSR_100HALF) in happy_meal_begin_auto_negotiation()
1317 hp->sw_advertise |= (ADVERTISE_100HALF); in happy_meal_begin_auto_negotiation()
1319 hp->sw_advertise &= ~(ADVERTISE_100HALF); in happy_meal_begin_auto_negotiation()
1320 if (hp->sw_bmsr & BMSR_100FULL) in happy_meal_begin_auto_negotiation()
1321 hp->sw_advertise |= (ADVERTISE_100FULL); in happy_meal_begin_auto_negotiation()
1323 hp->sw_advertise &= ~(ADVERTISE_100FULL); in happy_meal_begin_auto_negotiation()
1324 happy_meal_tcvr_write(hp, tregs, MII_ADVERTISE, hp->sw_advertise); in happy_meal_begin_auto_negotiation()
1333 ASD(("%s: Advertising [ ", hp->dev->name)); in happy_meal_begin_auto_negotiation()
1334 if (hp->sw_advertise & ADVERTISE_10HALF) in happy_meal_begin_auto_negotiation()
1336 if (hp->sw_advertise & ADVERTISE_10FULL) in happy_meal_begin_auto_negotiation()
1338 if (hp->sw_advertise & ADVERTISE_100HALF) in happy_meal_begin_auto_negotiation()
1340 if (hp->sw_advertise & ADVERTISE_100FULL) in happy_meal_begin_auto_negotiation()
1345 hp->sw_bmcr |= BMCR_ANENABLE; in happy_meal_begin_auto_negotiation()
1346 happy_meal_tcvr_write(hp, tregs, MII_BMCR, hp->sw_bmcr); in happy_meal_begin_auto_negotiation()
1349 hp->sw_bmcr |= BMCR_ANRESTART; in happy_meal_begin_auto_negotiation()
1350 happy_meal_tcvr_write(hp, tregs, MII_BMCR, hp->sw_bmcr); in happy_meal_begin_auto_negotiation()
1356 hp->sw_bmcr = happy_meal_tcvr_read(hp, tregs, MII_BMCR); in happy_meal_begin_auto_negotiation()
1357 if (!(hp->sw_bmcr & BMCR_ANRESTART)) in happy_meal_begin_auto_negotiation()
1363 "BMCR=0x%04x\n", hp->dev->name, hp->sw_bmcr); in happy_meal_begin_auto_negotiation()
1365 hp->dev->name); in happy_meal_begin_auto_negotiation()
1368 hp->timer_state = arbwait; in happy_meal_begin_auto_negotiation()
1381 hp->sw_bmcr = BMCR_SPEED100; in happy_meal_begin_auto_negotiation()
1384 hp->sw_bmcr = BMCR_SPEED100; in happy_meal_begin_auto_negotiation()
1386 hp->sw_bmcr = 0; in happy_meal_begin_auto_negotiation()
1388 hp->sw_bmcr |= BMCR_FULLDPLX; in happy_meal_begin_auto_negotiation()
1390 happy_meal_tcvr_write(hp, tregs, MII_BMCR, hp->sw_bmcr); in happy_meal_begin_auto_negotiation()
1392 if (!is_lucent_phy(hp)) { in happy_meal_begin_auto_negotiation()
1397 hp->sw_csconfig = happy_meal_tcvr_read(hp, tregs, in happy_meal_begin_auto_negotiation()
1399 hp->sw_csconfig &= ~(CSCONFIG_TCVDISAB); in happy_meal_begin_auto_negotiation()
1400 happy_meal_tcvr_write(hp, tregs, DP83840_CSCONFIG, in happy_meal_begin_auto_negotiation()
1401 hp->sw_csconfig); in happy_meal_begin_auto_negotiation()
1403 hp->timer_state = ltrywait; in happy_meal_begin_auto_negotiation()
1406 hp->timer_ticks = 0; in happy_meal_begin_auto_negotiation()
1407 hp->happy_timer.expires = jiffies + (12 * HZ)/10; /* 1.2 sec. */ in happy_meal_begin_auto_negotiation()
1408 hp->happy_timer.data = (unsigned long) hp; in happy_meal_begin_auto_negotiation()
1409 hp->happy_timer.function = happy_meal_timer; in happy_meal_begin_auto_negotiation()
1410 add_timer(&hp->happy_timer); in happy_meal_begin_auto_negotiation()
1414 static int happy_meal_init(struct happy_meal *hp) in happy_meal_init() argument
1416 void __iomem *gregs = hp->gregs; in happy_meal_init()
1417 void __iomem *etxregs = hp->etxregs; in happy_meal_init()
1418 void __iomem *erxregs = hp->erxregs; in happy_meal_init()
1419 void __iomem *bregs = hp->bigmacregs; in happy_meal_init()
1420 void __iomem *tregs = hp->tcvregs; in happy_meal_init()
1422 unsigned char *e = &hp->dev->dev_addr[0]; in happy_meal_init()
1425 del_timer(&hp->happy_timer); in happy_meal_init()
1428 hp->happy_flags)); in happy_meal_init()
1429 if (!(hp->happy_flags & HFLAG_INIT)) { in happy_meal_init()
1431 hp->happy_flags |= HFLAG_INIT; in happy_meal_init()
1432 happy_meal_get_counters(hp, bregs); in happy_meal_init()
1437 happy_meal_poll_stop(hp, tregs); in happy_meal_init()
1441 happy_meal_stop(hp, gregs); in happy_meal_init()
1445 happy_meal_init_rings(hp); in happy_meal_init()
1449 hme_read32(hp, tregs + TCVR_IMASK))); in happy_meal_init()
1450 hme_write32(hp, tregs + TCVR_IMASK, 0xffff); in happy_meal_init()
1453 if (hp->happy_flags & HFLAG_FENABLE) { in happy_meal_init()
1455 hme_read32(hp, tregs + TCVR_CFG))); in happy_meal_init()
1456 hme_write32(hp, tregs + TCVR_CFG, in happy_meal_init()
1457 hme_read32(hp, tregs + TCVR_CFG) & ~(TCV_CFG_BENABLE)); in happy_meal_init()
1460 hme_read32(hp, tregs + TCVR_CFG))); in happy_meal_init()
1461 hme_write32(hp, tregs + TCVR_CFG, in happy_meal_init()
1462 hme_read32(hp, tregs + TCVR_CFG) | TCV_CFG_BENABLE); in happy_meal_init()
1467 happy_meal_transceiver_check(hp, tregs); in happy_meal_init()
1471 switch(hp->tcvr_type) { in happy_meal_init()
1480 hme_write32(hp, bregs + BMAC_XIFCFG, 0); in happy_meal_init()
1486 hme_write32(hp, bregs + BMAC_XIFCFG, BIGMAC_XCFG_MIIDISAB); in happy_meal_init()
1490 if (happy_meal_tcvr_reset(hp, tregs)) in happy_meal_init()
1495 happy_meal_tx_reset(hp, bregs); in happy_meal_init()
1496 happy_meal_rx_reset(hp, bregs); in happy_meal_init()
1500 hme_write32(hp, bregs + BMAC_JSIZE, DEFAULT_JAMSIZE); in happy_meal_init()
1501 hme_write32(hp, bregs + BMAC_IGAP1, DEFAULT_IPG1); in happy_meal_init()
1502 hme_write32(hp, bregs + BMAC_IGAP2, DEFAULT_IPG2); in happy_meal_init()
1508 hme_write32(hp, bregs + BMAC_RSEED, ((e[5] | e[4]<<8)&0x3ff)); in happy_meal_init()
1510 hme_write32(hp, bregs + BMAC_MACADDR2, ((e[4] << 8) | e[5])); in happy_meal_init()
1511 hme_write32(hp, bregs + BMAC_MACADDR1, ((e[2] << 8) | e[3])); in happy_meal_init()
1512 hme_write32(hp, bregs + BMAC_MACADDR0, ((e[0] << 8) | e[1])); in happy_meal_init()
1515 if ((hp->dev->flags & IFF_ALLMULTI) || in happy_meal_init()
1516 (netdev_mc_count(hp->dev) > 64)) { in happy_meal_init()
1517 hme_write32(hp, bregs + BMAC_HTABLE0, 0xffff); in happy_meal_init()
1518 hme_write32(hp, bregs + BMAC_HTABLE1, 0xffff); in happy_meal_init()
1519 hme_write32(hp, bregs + BMAC_HTABLE2, 0xffff); in happy_meal_init()
1520 hme_write32(hp, bregs + BMAC_HTABLE3, 0xffff); in happy_meal_init()
1521 } else if ((hp->dev->flags & IFF_PROMISC) == 0) { in happy_meal_init()
1527 netdev_for_each_mc_addr(ha, hp->dev) { in happy_meal_init()
1532 hme_write32(hp, bregs + BMAC_HTABLE0, hash_table[0]); in happy_meal_init()
1533 hme_write32(hp, bregs + BMAC_HTABLE1, hash_table[1]); in happy_meal_init()
1534 hme_write32(hp, bregs + BMAC_HTABLE2, hash_table[2]); in happy_meal_init()
1535 hme_write32(hp, bregs + BMAC_HTABLE3, hash_table[3]); in happy_meal_init()
1537 hme_write32(hp, bregs + BMAC_HTABLE3, 0); in happy_meal_init()
1538 hme_write32(hp, bregs + BMAC_HTABLE2, 0); in happy_meal_init()
1539 hme_write32(hp, bregs + BMAC_HTABLE1, 0); in happy_meal_init()
1540 hme_write32(hp, bregs + BMAC_HTABLE0, 0); in happy_meal_init()
1545 ((__u32)hp->hblock_dvma + hblock_offset(happy_meal_rxd, 0)), in happy_meal_init()
1546 ((__u32)hp->hblock_dvma + hblock_offset(happy_meal_txd, 0)))); in happy_meal_init()
1547 hme_write32(hp, erxregs + ERX_RING, in happy_meal_init()
1548 ((__u32)hp->hblock_dvma + hblock_offset(happy_meal_rxd, 0))); in happy_meal_init()
1549 hme_write32(hp, etxregs + ETX_RING, in happy_meal_init()
1550 ((__u32)hp->hblock_dvma + hblock_offset(happy_meal_txd, 0))); in happy_meal_init()
1557 if (hme_read32(hp, erxregs + ERX_RING) != in happy_meal_init()
1558 ((__u32)hp->hblock_dvma + hblock_offset(happy_meal_rxd, 0))) in happy_meal_init()
1559 hme_write32(hp, erxregs + ERX_RING, in happy_meal_init()
1560 ((__u32)hp->hblock_dvma + hblock_offset(happy_meal_rxd, 0)) in happy_meal_init()
1565 hme_read32(hp, gregs + GREG_CFG))); in happy_meal_init()
1569 hme_write32(hp, gregs + GREG_CFG, GREG_CFG_BURST64); in happy_meal_init()
1571 if ((hp->happy_bursts & DMA_BURST64) && in happy_meal_init()
1572 ((hp->happy_flags & HFLAG_PCI) != 0 in happy_meal_init()
1584 if ((hp->happy_flags & HFLAG_PCI) == 0) { in happy_meal_init()
1585 struct platform_device *op = hp->happy_dev; in happy_meal_init()
1588 hp->happy_bursts); in happy_meal_init()
1595 hme_write32(hp, gregs + GREG_CFG, gcfg); in happy_meal_init()
1596 } else if (hp->happy_bursts & DMA_BURST32) { in happy_meal_init()
1598 hme_write32(hp, gregs + GREG_CFG, GREG_CFG_BURST32); in happy_meal_init()
1599 } else if (hp->happy_bursts & DMA_BURST16) { in happy_meal_init()
1601 hme_write32(hp, gregs + GREG_CFG, GREG_CFG_BURST16); in happy_meal_init()
1604 hme_write32(hp, gregs + GREG_CFG, 0); in happy_meal_init()
1610 hme_write32(hp, gregs + GREG_IMASK, in happy_meal_init()
1616 hme_read32(hp, etxregs + ETX_RSIZE))); in happy_meal_init()
1617 hme_write32(hp, etxregs + ETX_RSIZE, (TX_RING_SIZE >> ETX_RSIZE_SHIFT) - 1); in happy_meal_init()
1621 hme_read32(hp, etxregs + ETX_CFG))); in happy_meal_init()
1622 hme_write32(hp, etxregs + ETX_CFG, in happy_meal_init()
1623 hme_read32(hp, etxregs + ETX_CFG) | ETX_CFG_DMAENABLE); in happy_meal_init()
1631 hme_read32(hp, erxregs + ERX_CFG))); in happy_meal_init()
1632 hme_write32(hp, erxregs + ERX_CFG, ERX_CFG_DEFAULT(RX_OFFSET)); in happy_meal_init()
1633 regtmp = hme_read32(hp, erxregs + ERX_CFG); in happy_meal_init()
1634 hme_write32(hp, erxregs + ERX_CFG, ERX_CFG_DEFAULT(RX_OFFSET)); in happy_meal_init()
1635 if (hme_read32(hp, erxregs + ERX_CFG) != ERX_CFG_DEFAULT(RX_OFFSET)) { in happy_meal_init()
1644 hme_read32(hp, bregs + BMAC_RXCFG))); in happy_meal_init()
1646 if (hp->dev->flags & IFF_PROMISC) in happy_meal_init()
1648 hme_write32(hp, bregs + BMAC_RXCFG, rxcfg); in happy_meal_init()
1656 if (hp->happy_flags & HFLAG_FULL) in happy_meal_init()
1662 hme_write32(hp, bregs + BMAC_TXCFG, regtmp /*| BIGMAC_TXCFG_DGIVEUP*/); in happy_meal_init()
1665 hme_write32(hp, bregs + BMAC_ALIMIT, 16); in happy_meal_init()
1671 if (hp->happy_flags & HFLAG_LANCE) in happy_meal_init()
1675 if (hp->tcvr_type == external) in happy_meal_init()
1679 hme_read32(hp, bregs + BMAC_XIFCFG))); in happy_meal_init()
1680 hme_write32(hp, bregs + BMAC_XIFCFG, regtmp); in happy_meal_init()
1684 hme_read32(hp, bregs + BMAC_TXCFG), in happy_meal_init()
1685 hme_read32(hp, bregs + BMAC_RXCFG))); in happy_meal_init()
1688 hme_write32(hp, bregs + BMAC_TXMAX, ETH_FRAME_LEN + 8); in happy_meal_init()
1689 hme_write32(hp, bregs + BMAC_RXMAX, ETH_FRAME_LEN + 8); in happy_meal_init()
1691 hme_write32(hp, bregs + BMAC_TXCFG, in happy_meal_init()
1692 hme_read32(hp, bregs + BMAC_TXCFG) | BIGMAC_TXCFG_ENABLE); in happy_meal_init()
1693 hme_write32(hp, bregs + BMAC_RXCFG, in happy_meal_init()
1694 hme_read32(hp, bregs + BMAC_RXCFG) | BIGMAC_RXCFG_ENABLE); in happy_meal_init()
1697 happy_meal_begin_auto_negotiation(hp, tregs, NULL); in happy_meal_init()
1704 static void happy_meal_set_initial_advertisement(struct happy_meal *hp) in happy_meal_set_initial_advertisement() argument
1706 void __iomem *tregs = hp->tcvregs; in happy_meal_set_initial_advertisement()
1707 void __iomem *bregs = hp->bigmacregs; in happy_meal_set_initial_advertisement()
1708 void __iomem *gregs = hp->gregs; in happy_meal_set_initial_advertisement()
1710 happy_meal_stop(hp, gregs); in happy_meal_set_initial_advertisement()
1711 hme_write32(hp, tregs + TCVR_IMASK, 0xffff); in happy_meal_set_initial_advertisement()
1712 if (hp->happy_flags & HFLAG_FENABLE) in happy_meal_set_initial_advertisement()
1713 hme_write32(hp, tregs + TCVR_CFG, in happy_meal_set_initial_advertisement()
1714 hme_read32(hp, tregs + TCVR_CFG) & ~(TCV_CFG_BENABLE)); in happy_meal_set_initial_advertisement()
1716 hme_write32(hp, tregs + TCVR_CFG, in happy_meal_set_initial_advertisement()
1717 hme_read32(hp, tregs + TCVR_CFG) | TCV_CFG_BENABLE); in happy_meal_set_initial_advertisement()
1718 happy_meal_transceiver_check(hp, tregs); in happy_meal_set_initial_advertisement()
1719 switch(hp->tcvr_type) { in happy_meal_set_initial_advertisement()
1723 hme_write32(hp, bregs + BMAC_XIFCFG, 0); in happy_meal_set_initial_advertisement()
1726 hme_write32(hp, bregs + BMAC_XIFCFG, BIGMAC_XCFG_MIIDISAB); in happy_meal_set_initial_advertisement()
1729 if (happy_meal_tcvr_reset(hp, tregs)) in happy_meal_set_initial_advertisement()
1733 hp->sw_bmsr = happy_meal_tcvr_read(hp, tregs, MII_BMSR); in happy_meal_set_initial_advertisement()
1734 hp->sw_advertise = happy_meal_tcvr_read(hp, tregs, MII_ADVERTISE); in happy_meal_set_initial_advertisement()
1737 if (hp->sw_bmsr & BMSR_10HALF) in happy_meal_set_initial_advertisement()
1738 hp->sw_advertise |= (ADVERTISE_10HALF); in happy_meal_set_initial_advertisement()
1740 hp->sw_advertise &= ~(ADVERTISE_10HALF); in happy_meal_set_initial_advertisement()
1742 if (hp->sw_bmsr & BMSR_10FULL) in happy_meal_set_initial_advertisement()
1743 hp->sw_advertise |= (ADVERTISE_10FULL); in happy_meal_set_initial_advertisement()
1745 hp->sw_advertise &= ~(ADVERTISE_10FULL); in happy_meal_set_initial_advertisement()
1746 if (hp->sw_bmsr & BMSR_100HALF) in happy_meal_set_initial_advertisement()
1747 hp->sw_advertise |= (ADVERTISE_100HALF); in happy_meal_set_initial_advertisement()
1749 hp->sw_advertise &= ~(ADVERTISE_100HALF); in happy_meal_set_initial_advertisement()
1750 if (hp->sw_bmsr & BMSR_100FULL) in happy_meal_set_initial_advertisement()
1751 hp->sw_advertise |= (ADVERTISE_100FULL); in happy_meal_set_initial_advertisement()
1753 hp->sw_advertise &= ~(ADVERTISE_100FULL); in happy_meal_set_initial_advertisement()
1756 happy_meal_tcvr_write(hp, tregs, MII_ADVERTISE, hp->sw_advertise); in happy_meal_set_initial_advertisement()
1764 static int happy_meal_is_not_so_happy(struct happy_meal *hp, u32 status) in happy_meal_is_not_so_happy() argument
1776 hp->dev->name, status); in happy_meal_is_not_so_happy()
1781 printk(KERN_DEBUG "%s: Happy Meal receive FIFO overflow.\n", hp->dev->name); in happy_meal_is_not_so_happy()
1786 printk(KERN_ERR "%s: Happy Meal BigMAC SQE test failed.\n", hp->dev->name); in happy_meal_is_not_so_happy()
1793 hp->dev->name); in happy_meal_is_not_so_happy()
1801 printk(KERN_ERR "%s: Happy Meal MAX Packet size error.\n", hp->dev->name); in happy_meal_is_not_so_happy()
1813 hp->dev->name); in happy_meal_is_not_so_happy()
1818 printk(KERN_ERR "%s: Happy Meal rx DMA errors [ ", hp->dev->name); in happy_meal_is_not_so_happy()
1834 hp->dev->name); in happy_meal_is_not_so_happy()
1840 printk(KERN_ERR "%s: Happy Meal MIF interrupt.\n", hp->dev->name); in happy_meal_is_not_so_happy()
1846 printk(KERN_ERR "%s: Happy Meal tx DMA errors [ ", hp->dev->name); in happy_meal_is_not_so_happy()
1864 hp->dev->name, in happy_meal_is_not_so_happy()
1870 printk(KERN_NOTICE "%s: Resetting...\n", hp->dev->name); in happy_meal_is_not_so_happy()
1871 happy_meal_init(hp); in happy_meal_is_not_so_happy()
1878 static void happy_meal_mif_interrupt(struct happy_meal *hp) in happy_meal_mif_interrupt() argument
1880 void __iomem *tregs = hp->tcvregs; in happy_meal_mif_interrupt()
1882 printk(KERN_INFO "%s: Link status change.\n", hp->dev->name); in happy_meal_mif_interrupt()
1883 hp->sw_bmcr = happy_meal_tcvr_read(hp, tregs, MII_BMCR); in happy_meal_mif_interrupt()
1884 hp->sw_lpa = happy_meal_tcvr_read(hp, tregs, MII_LPA); in happy_meal_mif_interrupt()
1887 if (hp->sw_lpa & LPA_100FULL) { in happy_meal_mif_interrupt()
1888 printk(KERN_INFO "%s: Switching to 100Mbps at full duplex.", hp->dev->name); in happy_meal_mif_interrupt()
1889 hp->sw_bmcr |= (BMCR_FULLDPLX | BMCR_SPEED100); in happy_meal_mif_interrupt()
1890 } else if (hp->sw_lpa & LPA_100HALF) { in happy_meal_mif_interrupt()
1891 printk(KERN_INFO "%s: Switching to 100MBps at half duplex.", hp->dev->name); in happy_meal_mif_interrupt()
1892 hp->sw_bmcr |= BMCR_SPEED100; in happy_meal_mif_interrupt()
1893 } else if (hp->sw_lpa & LPA_10FULL) { in happy_meal_mif_interrupt()
1894 printk(KERN_INFO "%s: Switching to 10MBps at full duplex.", hp->dev->name); in happy_meal_mif_interrupt()
1895 hp->sw_bmcr |= BMCR_FULLDPLX; in happy_meal_mif_interrupt()
1897 printk(KERN_INFO "%s: Using 10Mbps at half duplex.", hp->dev->name); in happy_meal_mif_interrupt()
1899 happy_meal_tcvr_write(hp, tregs, MII_BMCR, hp->sw_bmcr); in happy_meal_mif_interrupt()
1902 happy_meal_poll_stop(hp, tregs); in happy_meal_mif_interrupt()
1912 static void happy_meal_tx(struct happy_meal *hp) in happy_meal_tx() argument
1914 struct happy_meal_txd *txbase = &hp->happy_block->happy_meal_txd[0]; in happy_meal_tx()
1916 struct net_device *dev = hp->dev; in happy_meal_tx()
1919 elem = hp->tx_old; in happy_meal_tx()
1921 while (elem != hp->tx_new) { in happy_meal_tx()
1928 flags = hme_read_desc32(hp, &this->tx_flags); in happy_meal_tx()
1931 skb = hp->tx_skbs[elem]; in happy_meal_tx()
1937 flags = hme_read_desc32(hp, &txbase[last].tx_flags); in happy_meal_tx()
1941 hp->tx_skbs[elem] = NULL; in happy_meal_tx()
1942 hp->net_stats.tx_bytes += skb->len; in happy_meal_tx()
1945 dma_addr = hme_read_desc32(hp, &this->tx_addr); in happy_meal_tx()
1946 dma_len = hme_read_desc32(hp, &this->tx_flags); in happy_meal_tx()
1950 dma_unmap_single(hp->dma_dev, dma_addr, dma_len, DMA_TO_DEVICE); in happy_meal_tx()
1952 dma_unmap_page(hp->dma_dev, dma_addr, dma_len, DMA_TO_DEVICE); in happy_meal_tx()
1959 hp->net_stats.tx_packets++; in happy_meal_tx()
1961 hp->tx_old = elem; in happy_meal_tx()
1965 TX_BUFFS_AVAIL(hp) > (MAX_SKB_FRAGS + 1)) in happy_meal_tx()
1984 static void happy_meal_rx(struct happy_meal *hp, struct net_device *dev) in happy_meal_rx() argument
1986 struct happy_meal_rxd *rxbase = &hp->happy_block->happy_meal_rxd[0]; in happy_meal_rx()
1988 int elem = hp->rx_new, drops = 0; in happy_meal_rx()
1993 while (!((flags = hme_read_desc32(hp, &this->rx_flags)) & RXFLAG_OWN)) { in happy_meal_rx()
1997 u32 dma_addr = hme_read_desc32(hp, &this->rx_addr); in happy_meal_rx()
2004 hp->net_stats.rx_errors++; in happy_meal_rx()
2006 hp->net_stats.rx_length_errors++; in happy_meal_rx()
2008 hp->net_stats.rx_over_errors++; in happy_meal_rx()
2009 hp->net_stats.rx_fifo_errors++; in happy_meal_rx()
2014 hp->net_stats.rx_dropped++; in happy_meal_rx()
2015 hme_write_rxd(hp, this, in happy_meal_rx()
2020 skb = hp->rx_skbs[elem]; in happy_meal_rx()
2030 dma_unmap_single(hp->dma_dev, dma_addr, RX_BUF_ALLOC_SIZE, DMA_FROM_DEVICE); in happy_meal_rx()
2031 hp->rx_skbs[elem] = new_skb; in happy_meal_rx()
2033 hme_write_rxd(hp, this, in happy_meal_rx()
2035 dma_map_single(hp->dma_dev, new_skb->data, RX_BUF_ALLOC_SIZE, in happy_meal_rx()
2051 dma_sync_single_for_cpu(hp->dma_dev, dma_addr, len, DMA_FROM_DEVICE); in happy_meal_rx()
2053 dma_sync_single_for_device(hp->dma_dev, dma_addr, len, DMA_FROM_DEVICE); in happy_meal_rx()
2055 hme_write_rxd(hp, this, in happy_meal_rx()
2070 hp->net_stats.rx_packets++; in happy_meal_rx()
2071 hp->net_stats.rx_bytes += len; in happy_meal_rx()
2076 hp->rx_new = elem; in happy_meal_rx()
2078 printk(KERN_INFO "%s: Memory squeeze, deferring packet.\n", hp->dev->name); in happy_meal_rx()
2085 struct happy_meal *hp = netdev_priv(dev); in happy_meal_interrupt() local
2086 u32 happy_status = hme_read32(hp, hp->gregs + GREG_STAT); in happy_meal_interrupt()
2090 spin_lock(&hp->happy_lock); in happy_meal_interrupt()
2094 if (happy_meal_is_not_so_happy(hp, /* un- */ happy_status)) in happy_meal_interrupt()
2100 happy_meal_mif_interrupt(hp); in happy_meal_interrupt()
2105 happy_meal_tx(hp); in happy_meal_interrupt()
2110 happy_meal_rx(hp, dev); in happy_meal_interrupt()
2115 spin_unlock(&hp->happy_lock); in happy_meal_interrupt()
2128 struct happy_meal *hp = netdev_priv(dev); in quattro_sbus_interrupt() local
2129 u32 happy_status = hme_read32(hp, hp->gregs + GREG_STAT); in quattro_sbus_interrupt()
2139 spin_lock(&hp->happy_lock); in quattro_sbus_interrupt()
2143 if (happy_meal_is_not_so_happy(hp, happy_status)) in quattro_sbus_interrupt()
2149 happy_meal_mif_interrupt(hp); in quattro_sbus_interrupt()
2154 happy_meal_tx(hp); in quattro_sbus_interrupt()
2159 happy_meal_rx(hp, dev); in quattro_sbus_interrupt()
2163 spin_unlock(&hp->happy_lock); in quattro_sbus_interrupt()
2173 struct happy_meal *hp = netdev_priv(dev); in happy_meal_open() local
2181 if ((hp->happy_flags & (HFLAG_QUATTRO|HFLAG_PCI)) != HFLAG_QUATTRO) { in happy_meal_open()
2182 res = request_irq(hp->irq, happy_meal_interrupt, IRQF_SHARED, in happy_meal_open()
2187 hp->irq); in happy_meal_open()
2195 spin_lock_irq(&hp->happy_lock); in happy_meal_open()
2196 res = happy_meal_init(hp); in happy_meal_open()
2197 spin_unlock_irq(&hp->happy_lock); in happy_meal_open()
2199 if (res && ((hp->happy_flags & (HFLAG_QUATTRO|HFLAG_PCI)) != HFLAG_QUATTRO)) in happy_meal_open()
2200 free_irq(hp->irq, dev); in happy_meal_open()
2206 struct happy_meal *hp = netdev_priv(dev); in happy_meal_close() local
2208 spin_lock_irq(&hp->happy_lock); in happy_meal_close()
2209 happy_meal_stop(hp, hp->gregs); in happy_meal_close()
2210 happy_meal_clean_rings(hp); in happy_meal_close()
2213 del_timer(&hp->happy_timer); in happy_meal_close()
2215 spin_unlock_irq(&hp->happy_lock); in happy_meal_close()
2221 if ((hp->happy_flags & (HFLAG_QUATTRO|HFLAG_PCI)) != HFLAG_QUATTRO) in happy_meal_close()
2222 free_irq(hp->irq, dev); in happy_meal_close()
2235 struct happy_meal *hp = netdev_priv(dev); in happy_meal_tx_timeout() local
2240 hme_read32(hp, hp->gregs + GREG_STAT), in happy_meal_tx_timeout()
2241 hme_read32(hp, hp->etxregs + ETX_CFG), in happy_meal_tx_timeout()
2242 hme_read32(hp, hp->bigmacregs + BMAC_TXCFG)); in happy_meal_tx_timeout()
2244 spin_lock_irq(&hp->happy_lock); in happy_meal_tx_timeout()
2245 happy_meal_init(hp); in happy_meal_tx_timeout()
2246 spin_unlock_irq(&hp->happy_lock); in happy_meal_tx_timeout()
2254 struct happy_meal *hp = netdev_priv(dev); in happy_meal_start_xmit() local
2268 spin_lock_irq(&hp->happy_lock); in happy_meal_start_xmit()
2270 if (TX_BUFFS_AVAIL(hp) <= (skb_shinfo(skb)->nr_frags + 1)) { in happy_meal_start_xmit()
2272 spin_unlock_irq(&hp->happy_lock); in happy_meal_start_xmit()
2278 entry = hp->tx_new; in happy_meal_start_xmit()
2280 hp->tx_skbs[entry] = skb; in happy_meal_start_xmit()
2286 mapping = dma_map_single(hp->dma_dev, skb->data, len, DMA_TO_DEVICE); in happy_meal_start_xmit()
2288 hme_write_txd(hp, &hp->happy_block->happy_meal_txd[entry], in happy_meal_start_xmit()
2300 first_mapping = dma_map_single(hp->dma_dev, skb->data, first_len, in happy_meal_start_xmit()
2309 mapping = skb_frag_dma_map(hp->dma_dev, this_frag, in happy_meal_start_xmit()
2314 hme_write_txd(hp, &hp->happy_block->happy_meal_txd[entry], in happy_meal_start_xmit()
2319 hme_write_txd(hp, &hp->happy_block->happy_meal_txd[first_entry], in happy_meal_start_xmit()
2324 hp->tx_new = entry; in happy_meal_start_xmit()
2326 if (TX_BUFFS_AVAIL(hp) <= (MAX_SKB_FRAGS + 1)) in happy_meal_start_xmit()
2330 hme_write32(hp, hp->etxregs + ETX_PENDING, ETX_TP_DMAWAKEUP); in happy_meal_start_xmit()
2332 spin_unlock_irq(&hp->happy_lock); in happy_meal_start_xmit()
2334 tx_add_log(hp, TXLOG_ACTION_TXMIT, 0); in happy_meal_start_xmit()
2340 struct happy_meal *hp = netdev_priv(dev); in happy_meal_get_stats() local
2342 spin_lock_irq(&hp->happy_lock); in happy_meal_get_stats()
2343 happy_meal_get_counters(hp, hp->bigmacregs); in happy_meal_get_stats()
2344 spin_unlock_irq(&hp->happy_lock); in happy_meal_get_stats()
2346 return &hp->net_stats; in happy_meal_get_stats()
2351 struct happy_meal *hp = netdev_priv(dev); in happy_meal_set_multicast() local
2352 void __iomem *bregs = hp->bigmacregs; in happy_meal_set_multicast()
2356 spin_lock_irq(&hp->happy_lock); in happy_meal_set_multicast()
2359 hme_write32(hp, bregs + BMAC_HTABLE0, 0xffff); in happy_meal_set_multicast()
2360 hme_write32(hp, bregs + BMAC_HTABLE1, 0xffff); in happy_meal_set_multicast()
2361 hme_write32(hp, bregs + BMAC_HTABLE2, 0xffff); in happy_meal_set_multicast()
2362 hme_write32(hp, bregs + BMAC_HTABLE3, 0xffff); in happy_meal_set_multicast()
2364 hme_write32(hp, bregs + BMAC_RXCFG, in happy_meal_set_multicast()
2365 hme_read32(hp, bregs + BMAC_RXCFG) | BIGMAC_RXCFG_PMISC); in happy_meal_set_multicast()
2375 hme_write32(hp, bregs + BMAC_HTABLE0, hash_table[0]); in happy_meal_set_multicast()
2376 hme_write32(hp, bregs + BMAC_HTABLE1, hash_table[1]); in happy_meal_set_multicast()
2377 hme_write32(hp, bregs + BMAC_HTABLE2, hash_table[2]); in happy_meal_set_multicast()
2378 hme_write32(hp, bregs + BMAC_HTABLE3, hash_table[3]); in happy_meal_set_multicast()
2381 spin_unlock_irq(&hp->happy_lock); in happy_meal_set_multicast()
2387 struct happy_meal *hp = netdev_priv(dev); in hme_get_settings() local
2401 spin_lock_irq(&hp->happy_lock); in hme_get_settings()
2402 hp->sw_bmcr = happy_meal_tcvr_read(hp, hp->tcvregs, MII_BMCR); in hme_get_settings()
2403 hp->sw_lpa = happy_meal_tcvr_read(hp, hp->tcvregs, MII_LPA); in hme_get_settings()
2404 spin_unlock_irq(&hp->happy_lock); in hme_get_settings()
2406 if (hp->sw_bmcr & BMCR_ANENABLE) { in hme_get_settings()
2408 speed = ((hp->sw_lpa & (LPA_100HALF | LPA_100FULL)) ? in hme_get_settings()
2412 (hp->sw_lpa & (LPA_100FULL)) ? in hme_get_settings()
2416 (hp->sw_lpa & (LPA_10FULL)) ? in hme_get_settings()
2420 speed = (hp->sw_bmcr & BMCR_SPEED100) ? SPEED_100 : SPEED_10; in hme_get_settings()
2422 (hp->sw_bmcr & BMCR_FULLDPLX) ? in hme_get_settings()
2431 struct happy_meal *hp = netdev_priv(dev); in hme_set_settings() local
2445 spin_lock_irq(&hp->happy_lock); in hme_set_settings()
2446 del_timer(&hp->happy_timer); in hme_set_settings()
2447 happy_meal_begin_auto_negotiation(hp, hp->tcvregs, cmd); in hme_set_settings()
2448 spin_unlock_irq(&hp->happy_lock); in hme_set_settings()
2455 struct happy_meal *hp = netdev_priv(dev); in hme_get_drvinfo() local
2459 if (hp->happy_flags & HFLAG_PCI) { in hme_get_drvinfo()
2460 struct pci_dev *pdev = hp->happy_dev; in hme_get_drvinfo()
2466 struct platform_device *op = hp->happy_dev; in hme_get_drvinfo()
2478 struct happy_meal *hp = netdev_priv(dev); in hme_get_link() local
2480 spin_lock_irq(&hp->happy_lock); in hme_get_link()
2481 hp->sw_bmcr = happy_meal_tcvr_read(hp, hp->tcvregs, MII_BMCR); in hme_get_link()
2482 spin_unlock_irq(&hp->happy_lock); in hme_get_link()
2484 return hp->sw_bmsr & BMSR_LSTATUS; in hme_get_link()
2630 struct happy_meal *hp; in happy_meal_sbus_probe_one() local
2684 hp = netdev_priv(dev); in happy_meal_sbus_probe_one()
2686 hp->happy_dev = op; in happy_meal_sbus_probe_one()
2687 hp->dma_dev = &op->dev; in happy_meal_sbus_probe_one()
2689 spin_lock_init(&hp->happy_lock); in happy_meal_sbus_probe_one()
2693 hp->qfe_parent = qp; in happy_meal_sbus_probe_one()
2694 hp->qfe_ent = qfe_slot; in happy_meal_sbus_probe_one()
2698 hp->gregs = of_ioremap(&op->resource[0], 0, in happy_meal_sbus_probe_one()
2700 if (!hp->gregs) { in happy_meal_sbus_probe_one()
2705 hp->etxregs = of_ioremap(&op->resource[1], 0, in happy_meal_sbus_probe_one()
2707 if (!hp->etxregs) { in happy_meal_sbus_probe_one()
2712 hp->erxregs = of_ioremap(&op->resource[2], 0, in happy_meal_sbus_probe_one()
2714 if (!hp->erxregs) { in happy_meal_sbus_probe_one()
2719 hp->bigmacregs = of_ioremap(&op->resource[3], 0, in happy_meal_sbus_probe_one()
2721 if (!hp->bigmacregs) { in happy_meal_sbus_probe_one()
2726 hp->tcvregs = of_ioremap(&op->resource[4], 0, in happy_meal_sbus_probe_one()
2728 if (!hp->tcvregs) { in happy_meal_sbus_probe_one()
2733 hp->hm_revision = of_getintprop_default(dp, "hm-rev", 0xff); in happy_meal_sbus_probe_one()
2734 if (hp->hm_revision == 0xff) in happy_meal_sbus_probe_one()
2735 hp->hm_revision = 0xa0; in happy_meal_sbus_probe_one()
2738 if (hp->hm_revision == 0x20 || hp->hm_revision == 0x21) in happy_meal_sbus_probe_one()
2739 hp->happy_flags = HFLAG_20_21; in happy_meal_sbus_probe_one()
2740 else if (hp->hm_revision != 0xa0) in happy_meal_sbus_probe_one()
2741 hp->happy_flags = HFLAG_NOT_A0; in happy_meal_sbus_probe_one()
2744 hp->happy_flags |= HFLAG_QUATTRO; in happy_meal_sbus_probe_one()
2747 hp->happy_bursts = of_getintprop_default(sbus_dp, in happy_meal_sbus_probe_one()
2750 hp->happy_block = dma_alloc_coherent(hp->dma_dev, in happy_meal_sbus_probe_one()
2752 &hp->hblock_dvma, in happy_meal_sbus_probe_one()
2755 if (!hp->happy_block) in happy_meal_sbus_probe_one()
2759 hp->linkcheck = 0; in happy_meal_sbus_probe_one()
2762 hp->timer_state = asleep; in happy_meal_sbus_probe_one()
2763 hp->timer_ticks = 0; in happy_meal_sbus_probe_one()
2765 init_timer(&hp->happy_timer); in happy_meal_sbus_probe_one()
2767 hp->dev = dev; in happy_meal_sbus_probe_one()
2776 hp->irq = op->archdata.irqs[0]; in happy_meal_sbus_probe_one()
2780 hp->read_desc32 = sbus_hme_read_desc32; in happy_meal_sbus_probe_one()
2781 hp->write_txd = sbus_hme_write_txd; in happy_meal_sbus_probe_one()
2782 hp->write_rxd = sbus_hme_write_rxd; in happy_meal_sbus_probe_one()
2783 hp->read32 = sbus_hme_read32; in happy_meal_sbus_probe_one()
2784 hp->write32 = sbus_hme_write32; in happy_meal_sbus_probe_one()
2790 spin_lock_irq(&hp->happy_lock); in happy_meal_sbus_probe_one()
2791 happy_meal_set_initial_advertisement(hp); in happy_meal_sbus_probe_one()
2792 spin_unlock_irq(&hp->happy_lock); in happy_meal_sbus_probe_one()
2794 err = register_netdev(hp->dev); in happy_meal_sbus_probe_one()
2801 dev_set_drvdata(&op->dev, hp); in happy_meal_sbus_probe_one()
2815 dma_free_coherent(hp->dma_dev, in happy_meal_sbus_probe_one()
2817 hp->happy_block, in happy_meal_sbus_probe_one()
2818 hp->hblock_dvma); in happy_meal_sbus_probe_one()
2821 if (hp->gregs) in happy_meal_sbus_probe_one()
2822 of_iounmap(&op->resource[0], hp->gregs, GREG_REG_SIZE); in happy_meal_sbus_probe_one()
2823 if (hp->etxregs) in happy_meal_sbus_probe_one()
2824 of_iounmap(&op->resource[1], hp->etxregs, ETX_REG_SIZE); in happy_meal_sbus_probe_one()
2825 if (hp->erxregs) in happy_meal_sbus_probe_one()
2826 of_iounmap(&op->resource[2], hp->erxregs, ERX_REG_SIZE); in happy_meal_sbus_probe_one()
2827 if (hp->bigmacregs) in happy_meal_sbus_probe_one()
2828 of_iounmap(&op->resource[3], hp->bigmacregs, BMAC_REG_SIZE); in happy_meal_sbus_probe_one()
2829 if (hp->tcvregs) in happy_meal_sbus_probe_one()
2830 of_iounmap(&op->resource[4], hp->tcvregs, TCVR_REG_SIZE); in happy_meal_sbus_probe_one()
2935 struct happy_meal *hp; in happy_meal_pci_probe() local
2980 hp = netdev_priv(dev); in happy_meal_pci_probe()
2982 hp->happy_dev = pdev; in happy_meal_pci_probe()
2983 hp->dma_dev = &pdev->dev; in happy_meal_pci_probe()
2985 spin_lock_init(&hp->happy_lock); in happy_meal_pci_probe()
2988 hp->qfe_parent = qp; in happy_meal_pci_probe()
2989 hp->qfe_ent = qfe_slot; in happy_meal_pci_probe()
3037 hp->gregs = (hpreg_base + 0x0000UL); in happy_meal_pci_probe()
3038 hp->etxregs = (hpreg_base + 0x2000UL); in happy_meal_pci_probe()
3039 hp->erxregs = (hpreg_base + 0x4000UL); in happy_meal_pci_probe()
3040 hp->bigmacregs = (hpreg_base + 0x6000UL); in happy_meal_pci_probe()
3041 hp->tcvregs = (hpreg_base + 0x7000UL); in happy_meal_pci_probe()
3044 hp->hm_revision = of_getintprop_default(dp, "hm-rev", 0xff); in happy_meal_pci_probe()
3045 if (hp->hm_revision == 0xff) in happy_meal_pci_probe()
3046 hp->hm_revision = 0xc0 | (pdev->revision & 0x0f); in happy_meal_pci_probe()
3049 hp->hm_revision = 0x20; in happy_meal_pci_probe()
3053 if (hp->hm_revision == 0x20 || hp->hm_revision == 0x21) in happy_meal_pci_probe()
3054 hp->happy_flags = HFLAG_20_21; in happy_meal_pci_probe()
3055 else if (hp->hm_revision != 0xa0 && hp->hm_revision != 0xc0) in happy_meal_pci_probe()
3056 hp->happy_flags = HFLAG_NOT_A0; in happy_meal_pci_probe()
3059 hp->happy_flags |= HFLAG_QUATTRO; in happy_meal_pci_probe()
3062 hp->happy_flags |= HFLAG_PCI; in happy_meal_pci_probe()
3066 hp->happy_bursts = DMA_BURSTBITS; in happy_meal_pci_probe()
3069 hp->happy_block = dma_alloc_coherent(&pdev->dev, PAGE_SIZE, in happy_meal_pci_probe()
3070 &hp->hblock_dvma, GFP_KERNEL); in happy_meal_pci_probe()
3072 if (!hp->happy_block) in happy_meal_pci_probe()
3075 hp->linkcheck = 0; in happy_meal_pci_probe()
3076 hp->timer_state = asleep; in happy_meal_pci_probe()
3077 hp->timer_ticks = 0; in happy_meal_pci_probe()
3079 init_timer(&hp->happy_timer); in happy_meal_pci_probe()
3081 hp->irq = pdev->irq; in happy_meal_pci_probe()
3082 hp->dev = dev; in happy_meal_pci_probe()
3093 hp->read_desc32 = pci_hme_read_desc32; in happy_meal_pci_probe()
3094 hp->write_txd = pci_hme_write_txd; in happy_meal_pci_probe()
3095 hp->write_rxd = pci_hme_write_rxd; in happy_meal_pci_probe()
3096 hp->read32 = pci_hme_read32; in happy_meal_pci_probe()
3097 hp->write32 = pci_hme_write32; in happy_meal_pci_probe()
3103 spin_lock_irq(&hp->happy_lock); in happy_meal_pci_probe()
3104 happy_meal_set_initial_advertisement(hp); in happy_meal_pci_probe()
3105 spin_unlock_irq(&hp->happy_lock); in happy_meal_pci_probe()
3107 err = register_netdev(hp->dev); in happy_meal_pci_probe()
3114 dev_set_drvdata(&pdev->dev, hp); in happy_meal_pci_probe()
3145 iounmap(hp->gregs); in happy_meal_pci_probe()
3162 struct happy_meal *hp = dev_get_drvdata(&pdev->dev); in happy_meal_pci_remove() local
3163 struct net_device *net_dev = hp->dev; in happy_meal_pci_remove()
3167 dma_free_coherent(hp->dma_dev, PAGE_SIZE, in happy_meal_pci_remove()
3168 hp->happy_block, hp->hblock_dvma); in happy_meal_pci_remove()
3169 iounmap(hp->gregs); in happy_meal_pci_remove()
3170 pci_release_regions(hp->happy_dev); in happy_meal_pci_remove()
3234 struct happy_meal *hp = dev_get_drvdata(&op->dev); in hme_sbus_remove() local
3235 struct net_device *net_dev = hp->dev; in hme_sbus_remove()
3241 of_iounmap(&op->resource[0], hp->gregs, GREG_REG_SIZE); in hme_sbus_remove()
3242 of_iounmap(&op->resource[1], hp->etxregs, ETX_REG_SIZE); in hme_sbus_remove()
3243 of_iounmap(&op->resource[2], hp->erxregs, ERX_REG_SIZE); in hme_sbus_remove()
3244 of_iounmap(&op->resource[3], hp->bigmacregs, BMAC_REG_SIZE); in hme_sbus_remove()
3245 of_iounmap(&op->resource[4], hp->tcvregs, TCVR_REG_SIZE); in hme_sbus_remove()
3246 dma_free_coherent(hp->dma_dev, in hme_sbus_remove()
3248 hp->happy_block, in hme_sbus_remove()
3249 hp->hblock_dvma); in hme_sbus_remove()