• Home
  • Raw
  • Download

Lines Matching refs:tregs

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()
364 void __iomem *tregs, int reg) 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()
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()
410 void __iomem *tregs, int reg, 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()
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()
455 void __iomem *tregs, int reg) in happy_meal_tcvr_read() argument
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()
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()
487 void __iomem *tregs, int reg, in happy_meal_tcvr_write() argument
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()
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()
555 happy_meal_tcvr_write(hp, tregs, MII_BMCR, hp->sw_bmcr); 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
578 hp->sw_lpa = happy_meal_tcvr_read(hp, tregs, MII_LPA); in display_link_mode()
592 static void display_forced_link_mode(struct happy_meal *hp, void __iomem *tregs) in display_forced_link_mode() argument
600 hp->sw_bmcr = happy_meal_tcvr_read(hp, tregs, MII_BMCR); 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
619 hp->sw_lpa = happy_meal_tcvr_read(hp, tregs, MII_LPA); in set_happy_link_modes()
632 hp->sw_bmcr = happy_meal_tcvr_read(hp, tregs, MII_BMCR); in set_happy_link_modes()
675 void __iomem *tregs = hp->tcvregs; in is_lucent_phy() local
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()
691 void __iomem *tregs = hp->tcvregs; in happy_meal_timer() local
705 hp->sw_bmcr = happy_meal_tcvr_read(hp, tregs, MII_BMCR); in happy_meal_timer()
709 happy_meal_tcvr_write(hp, tregs, MII_BMCR, hp->sw_bmcr); in happy_meal_timer()
716 hp->sw_csconfig = happy_meal_tcvr_read(hp, tregs, DP83840_CSCONFIG); in happy_meal_timer()
718 happy_meal_tcvr_write(hp, tregs, DP83840_CSCONFIG, hp->sw_csconfig); in happy_meal_timer()
725 hp->sw_bmsr = happy_meal_tcvr_read(hp, tregs, MII_BMSR); in happy_meal_timer()
730 ret = set_happy_link_modes(hp, tregs); in happy_meal_timer()
756 hp->sw_bmsr = happy_meal_tcvr_read(hp, tregs, MII_BMSR); in happy_meal_timer()
761 display_link_mode(hp, tregs); 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()
790 happy_meal_tcvr_write(hp, tregs, in happy_meal_timer()
799 happy_meal_tcvr_write(hp, tregs, 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()
815 ret = try_next_permutation(hp, tregs); in happy_meal_timer()
834 hp->sw_csconfig = happy_meal_tcvr_read(hp, tregs, in happy_meal_timer()
837 happy_meal_tcvr_write(hp, tregs, in happy_meal_timer()
957 static void happy_meal_poll_stop(struct happy_meal *hp, void __iomem *tregs) in happy_meal_poll_stop() argument
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()
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()
1001 hme_write32(hp, tregs + TCVR_CFG, tconfig & ~(TCV_CFG_PSELECT)); 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()
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()
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()
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()
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()
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()
1101 happy_meal_poll_stop(hp, tregs); in happy_meal_transceiver_check()
1107 hme_write32(hp, tregs + TCVR_CFG, tconfig); 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()
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()
1139 hme_write32(hp, tregs + TCVR_CFG, in happy_meal_transceiver_check()
1298 void __iomem *tregs, in happy_meal_begin_auto_negotiation() argument
1304 hp->sw_bmsr = happy_meal_tcvr_read(hp, tregs, MII_BMSR); in happy_meal_begin_auto_negotiation()
1305 hp->sw_bmcr = happy_meal_tcvr_read(hp, tregs, MII_BMCR); in happy_meal_begin_auto_negotiation()
1306 hp->sw_physid1 = happy_meal_tcvr_read(hp, tregs, MII_PHYSID1); in happy_meal_begin_auto_negotiation()
1307 hp->sw_physid2 = happy_meal_tcvr_read(hp, tregs, MII_PHYSID2); in happy_meal_begin_auto_negotiation()
1311 hp->sw_advertise = happy_meal_tcvr_read(hp, tregs, MII_ADVERTISE); in happy_meal_begin_auto_negotiation()
1331 happy_meal_tcvr_write(hp, tregs, MII_ADVERTISE, hp->sw_advertise); in happy_meal_begin_auto_negotiation()
1353 happy_meal_tcvr_write(hp, tregs, MII_BMCR, hp->sw_bmcr); in happy_meal_begin_auto_negotiation()
1357 happy_meal_tcvr_write(hp, tregs, MII_BMCR, hp->sw_bmcr); in happy_meal_begin_auto_negotiation()
1363 hp->sw_bmcr = happy_meal_tcvr_read(hp, tregs, MII_BMCR); in happy_meal_begin_auto_negotiation()
1397 happy_meal_tcvr_write(hp, tregs, MII_BMCR, hp->sw_bmcr); in happy_meal_begin_auto_negotiation()
1404 hp->sw_csconfig = happy_meal_tcvr_read(hp, tregs, in happy_meal_begin_auto_negotiation()
1407 happy_meal_tcvr_write(hp, tregs, DP83840_CSCONFIG, in happy_meal_begin_auto_negotiation()
1427 void __iomem *tregs = hp->tcvregs; in happy_meal_init() local
1444 happy_meal_poll_stop(hp, tregs); in happy_meal_init()
1456 hme_read32(hp, tregs + TCVR_IMASK))); in happy_meal_init()
1457 hme_write32(hp, tregs + TCVR_IMASK, 0xffff); in happy_meal_init()
1462 hme_read32(hp, tregs + TCVR_CFG))); in happy_meal_init()
1463 hme_write32(hp, tregs + TCVR_CFG, in happy_meal_init()
1464 hme_read32(hp, tregs + TCVR_CFG) & ~(TCV_CFG_BENABLE)); in happy_meal_init()
1467 hme_read32(hp, tregs + TCVR_CFG))); in happy_meal_init()
1468 hme_write32(hp, tregs + TCVR_CFG, in happy_meal_init()
1469 hme_read32(hp, tregs + TCVR_CFG) | TCV_CFG_BENABLE); in happy_meal_init()
1474 happy_meal_transceiver_check(hp, tregs); in happy_meal_init()
1497 if (happy_meal_tcvr_reset(hp, tregs)) in happy_meal_init()
1704 happy_meal_begin_auto_negotiation(hp, tregs, NULL); in happy_meal_init()
1713 void __iomem *tregs = hp->tcvregs; in happy_meal_set_initial_advertisement() local
1718 hme_write32(hp, tregs + TCVR_IMASK, 0xffff); in happy_meal_set_initial_advertisement()
1720 hme_write32(hp, tregs + TCVR_CFG, in happy_meal_set_initial_advertisement()
1721 hme_read32(hp, tregs + TCVR_CFG) & ~(TCV_CFG_BENABLE)); in happy_meal_set_initial_advertisement()
1723 hme_write32(hp, tregs + TCVR_CFG, in happy_meal_set_initial_advertisement()
1724 hme_read32(hp, tregs + TCVR_CFG) | TCV_CFG_BENABLE); in happy_meal_set_initial_advertisement()
1725 happy_meal_transceiver_check(hp, tregs); in happy_meal_set_initial_advertisement()
1736 if (happy_meal_tcvr_reset(hp, tregs)) in happy_meal_set_initial_advertisement()
1740 hp->sw_bmsr = happy_meal_tcvr_read(hp, tregs, MII_BMSR); in happy_meal_set_initial_advertisement()
1741 hp->sw_advertise = happy_meal_tcvr_read(hp, tregs, MII_ADVERTISE); in happy_meal_set_initial_advertisement()
1763 happy_meal_tcvr_write(hp, tregs, MII_ADVERTISE, hp->sw_advertise); in happy_meal_set_initial_advertisement()
1887 void __iomem *tregs = hp->tcvregs; in happy_meal_mif_interrupt() local
1890 hp->sw_bmcr = happy_meal_tcvr_read(hp, tregs, MII_BMCR); in happy_meal_mif_interrupt()
1891 hp->sw_lpa = happy_meal_tcvr_read(hp, tregs, MII_LPA); in happy_meal_mif_interrupt()
1906 happy_meal_tcvr_write(hp, tregs, MII_BMCR, hp->sw_bmcr); in happy_meal_mif_interrupt()
1909 happy_meal_poll_stop(hp, tregs); in happy_meal_mif_interrupt()