Lines Matching refs:tregs

264 static void BB_PUT_BIT(struct happy_meal *hp, void __iomem *tregs, int bit)  in BB_PUT_BIT()  argument
266 hme_write32(hp, tregs + TCVR_BBDATA, bit); in BB_PUT_BIT()
267 hme_write32(hp, tregs + TCVR_BBCLOCK, 0); in BB_PUT_BIT()
268 hme_write32(hp, tregs + TCVR_BBCLOCK, 1); in BB_PUT_BIT()
272 static u32 BB_GET_BIT(struct happy_meal *hp, void __iomem *tregs, int internal)
276 hme_write32(hp, tregs + TCVR_BBCLOCK, 0);
277 hme_write32(hp, tregs + TCVR_BBCLOCK, 1);
278 ret = hme_read32(hp, tregs + TCVR_CFG);
288 static u32 BB_GET_BIT2(struct happy_meal *hp, void __iomem *tregs, int internal) in BB_GET_BIT2() argument
292 hme_write32(hp, tregs + TCVR_BBCLOCK, 0); in BB_GET_BIT2()
294 retval = hme_read32(hp, tregs + TCVR_CFG); in BB_GET_BIT2()
299 hme_write32(hp, tregs + TCVR_BBCLOCK, 1); in BB_GET_BIT2()
307 void __iomem *tregs, int reg) in happy_meal_bb_read() argument
314 hme_write32(hp, tregs + TCVR_BBOENAB, 1); in happy_meal_bb_read()
318 BB_PUT_BIT(hp, tregs, 1); in happy_meal_bb_read()
321 BB_PUT_BIT(hp, tregs, 0); in happy_meal_bb_read()
322 BB_PUT_BIT(hp, tregs, 1); in happy_meal_bb_read()
323 BB_PUT_BIT(hp, tregs, 1); in happy_meal_bb_read()
324 BB_PUT_BIT(hp, tregs, 0); in happy_meal_bb_read()
329 BB_PUT_BIT(hp, tregs, ((tmp >> i) & 1)); in happy_meal_bb_read()
334 BB_PUT_BIT(hp, tregs, ((tmp >> i) & 1)); in happy_meal_bb_read()
337 hme_write32(hp, tregs + TCVR_BBOENAB, 0); in happy_meal_bb_read()
340 (void) BB_GET_BIT2(hp, tregs, (hp->tcvr_type == internal)); in happy_meal_bb_read()
342 retval |= BB_GET_BIT2(hp, tregs, (hp->tcvr_type == internal)); in happy_meal_bb_read()
343 (void) BB_GET_BIT2(hp, tregs, (hp->tcvr_type == internal)); in happy_meal_bb_read()
344 (void) BB_GET_BIT2(hp, tregs, (hp->tcvr_type == internal)); in happy_meal_bb_read()
345 (void) BB_GET_BIT2(hp, tregs, (hp->tcvr_type == internal)); in happy_meal_bb_read()
351 void __iomem *tregs, int reg, in happy_meal_bb_write() argument
360 hme_write32(hp, tregs + TCVR_BBOENAB, 1); in happy_meal_bb_write()
364 BB_PUT_BIT(hp, tregs, 1); in happy_meal_bb_write()
367 BB_PUT_BIT(hp, tregs, 0); in happy_meal_bb_write()
368 BB_PUT_BIT(hp, tregs, 1); in happy_meal_bb_write()
369 BB_PUT_BIT(hp, tregs, 0); in happy_meal_bb_write()
370 BB_PUT_BIT(hp, tregs, 1); in happy_meal_bb_write()
375 BB_PUT_BIT(hp, tregs, ((tmp >> i) & 1)); in happy_meal_bb_write()
380 BB_PUT_BIT(hp, tregs, ((tmp >> i) & 1)); in happy_meal_bb_write()
383 BB_PUT_BIT(hp, tregs, 1); in happy_meal_bb_write()
384 BB_PUT_BIT(hp, tregs, 0); in happy_meal_bb_write()
387 BB_PUT_BIT(hp, tregs, ((value >> i) & 1)); in happy_meal_bb_write()
390 hme_write32(hp, tregs + TCVR_BBOENAB, 0); in happy_meal_bb_write()
396 void __iomem *tregs, int reg) in happy_meal_tcvr_read() argument
408 return happy_meal_bb_read(hp, tregs, reg); in happy_meal_tcvr_read()
411 hme_write32(hp, tregs + TCVR_FRAME, in happy_meal_tcvr_read()
413 while (!(hme_read32(hp, tregs + TCVR_FRAME) & 0x10000) && --tries) in happy_meal_tcvr_read()
419 retval = hme_read32(hp, tregs + TCVR_FRAME) & 0xffff; in happy_meal_tcvr_read()
427 void __iomem *tregs, int reg, in happy_meal_tcvr_write() argument
436 happy_meal_bb_write(hp, tregs, reg, value); in happy_meal_tcvr_write()
441 hme_write32(hp, tregs + TCVR_FRAME, in happy_meal_tcvr_write()
444 while (!(hme_read32(hp, tregs + TCVR_FRAME) & 0x10000) && --tries) in happy_meal_tcvr_write()
486 static int try_next_permutation(struct happy_meal *hp, void __iomem *tregs) in try_next_permutation() argument
488 hp->sw_bmcr = happy_meal_tcvr_read(hp, tregs, MII_BMCR); in try_next_permutation()
495 happy_meal_tcvr_write(hp, tregs, MII_BMCR, hp->sw_bmcr); in try_next_permutation()
502 happy_meal_tcvr_write(hp, tregs, MII_BMCR, hp->sw_bmcr); in try_next_permutation()
510 static void display_link_mode(struct happy_meal *hp, void __iomem *tregs) in display_link_mode() argument
512 hp->sw_lpa = happy_meal_tcvr_read(hp, tregs, MII_LPA); in display_link_mode()
521 static void display_forced_link_mode(struct happy_meal *hp, void __iomem *tregs) in display_forced_link_mode() argument
523 hp->sw_bmcr = happy_meal_tcvr_read(hp, tregs, MII_BMCR); in display_forced_link_mode()
532 static int set_happy_link_modes(struct happy_meal *hp, void __iomem *tregs) in set_happy_link_modes() argument
540 hp->sw_lpa = happy_meal_tcvr_read(hp, tregs, MII_LPA); in set_happy_link_modes()
553 hp->sw_bmcr = happy_meal_tcvr_read(hp, tregs, MII_BMCR); in set_happy_link_modes()
596 void __iomem *tregs = hp->tcvregs; in is_lucent_phy() local
600 mr2 = happy_meal_tcvr_read(hp, tregs, 2); in is_lucent_phy()
601 mr3 = happy_meal_tcvr_read(hp, tregs, 3); in is_lucent_phy()
612 void __iomem *tregs = hp->tcvregs; in happy_meal_timer() local
626 hp->sw_bmcr = happy_meal_tcvr_read(hp, tregs, MII_BMCR); in happy_meal_timer()
630 happy_meal_tcvr_write(hp, tregs, MII_BMCR, hp->sw_bmcr); in happy_meal_timer()
637 hp->sw_csconfig = happy_meal_tcvr_read(hp, tregs, DP83840_CSCONFIG); in happy_meal_timer()
639 happy_meal_tcvr_write(hp, tregs, DP83840_CSCONFIG, hp->sw_csconfig); in happy_meal_timer()
646 hp->sw_bmsr = happy_meal_tcvr_read(hp, tregs, MII_BMSR); in happy_meal_timer()
651 ret = set_happy_link_modes(hp, tregs); in happy_meal_timer()
677 hp->sw_bmsr = happy_meal_tcvr_read(hp, tregs, MII_BMSR); in happy_meal_timer()
682 display_link_mode(hp, tregs); in happy_meal_timer()
703 hp->sw_bmsr = happy_meal_tcvr_read(hp, tregs, MII_BMSR); in happy_meal_timer()
704 hp->sw_csconfig = happy_meal_tcvr_read(hp, tregs, DP83840_CSCONFIG); in happy_meal_timer()
711 happy_meal_tcvr_write(hp, tregs, in happy_meal_timer()
720 happy_meal_tcvr_write(hp, tregs, in happy_meal_timer()
728 display_forced_link_mode(hp, tregs); in happy_meal_timer()
729 set_happy_link_modes(hp, tregs); /* XXX error? then what? */ in happy_meal_timer()
736 ret = try_next_permutation(hp, tregs); in happy_meal_timer()
755 hp->sw_csconfig = happy_meal_tcvr_read(hp, tregs, in happy_meal_timer()
758 happy_meal_tcvr_write(hp, tregs, in happy_meal_timer()
878 static void happy_meal_poll_stop(struct happy_meal *hp, void __iomem *tregs) in happy_meal_poll_stop() argument
889 hme_write32(hp, tregs + TCVR_IMASK, 0xffff); in happy_meal_poll_stop()
892 hme_write32(hp, tregs + TCVR_CFG, in happy_meal_poll_stop()
893 hme_read32(hp, tregs + TCVR_CFG) & ~(TCV_CFG_PENABLE)); in happy_meal_poll_stop()
910 static int happy_meal_tcvr_reset(struct happy_meal *hp, void __iomem *tregs) in happy_meal_tcvr_reset() argument
915 tconfig = hme_read32(hp, tregs + TCVR_CFG); in happy_meal_tcvr_reset()
918 hme_write32(hp, tregs + TCVR_CFG, tconfig & ~(TCV_CFG_PSELECT)); in happy_meal_tcvr_reset()
921 happy_meal_tcvr_write(hp, tregs, MII_BMCR, in happy_meal_tcvr_reset()
923 result = happy_meal_tcvr_read(hp, tregs, MII_BMCR); in happy_meal_tcvr_reset()
929 hme_write32(hp, tregs + TCVR_CFG, tconfig | TCV_CFG_PSELECT); in happy_meal_tcvr_reset()
934 hme_write32(hp, tregs + TCVR_CFG, (tconfig | TCV_CFG_PSELECT)); in happy_meal_tcvr_reset()
935 happy_meal_tcvr_write(hp, tregs, MII_BMCR, in happy_meal_tcvr_reset()
937 result = happy_meal_tcvr_read(hp, tregs, MII_BMCR); in happy_meal_tcvr_reset()
943 hme_write32(hp, tregs + TCVR_CFG, (tconfig & ~(TCV_CFG_PSELECT))); in happy_meal_tcvr_reset()
950 happy_meal_tcvr_write(hp, tregs, MII_BMCR, BMCR_RESET); in happy_meal_tcvr_reset()
953 result = happy_meal_tcvr_read(hp, tregs, MII_BMCR); in happy_meal_tcvr_reset()
968 hp->sw_bmsr = happy_meal_tcvr_read(hp, tregs, MII_BMSR); in happy_meal_tcvr_reset()
969 hp->sw_physid1 = happy_meal_tcvr_read(hp, tregs, MII_PHYSID1); in happy_meal_tcvr_reset()
970 hp->sw_physid2 = happy_meal_tcvr_read(hp, tregs, MII_PHYSID2); in happy_meal_tcvr_reset()
971 hp->sw_advertise = happy_meal_tcvr_read(hp, tregs, MII_ADVERTISE); in happy_meal_tcvr_reset()
975 happy_meal_tcvr_write(hp, tregs, MII_BMCR, hp->sw_bmcr); in happy_meal_tcvr_reset()
979 result = happy_meal_tcvr_read(hp, tregs, MII_BMCR); in happy_meal_tcvr_reset()
992 result = happy_meal_tcvr_read(hp, tregs, in happy_meal_tcvr_reset()
994 happy_meal_tcvr_write(hp, tregs, in happy_meal_tcvr_reset()
1004 static void happy_meal_transceiver_check(struct happy_meal *hp, void __iomem *tregs) in happy_meal_transceiver_check() argument
1006 unsigned long tconfig = hme_read32(hp, tregs + TCVR_CFG); in happy_meal_transceiver_check()
1013 happy_meal_poll_stop(hp, tregs); in happy_meal_transceiver_check()
1018 hme_write32(hp, tregs + TCVR_CFG, tconfig); in happy_meal_transceiver_check()
1023 if (!(hme_read32(hp, tregs + TCVR_STATUS) >> 16)) { in happy_meal_transceiver_check()
1024 happy_meal_poll_stop(hp, tregs); in happy_meal_transceiver_check()
1027 hme_write32(hp, tregs + TCVR_CFG, in happy_meal_transceiver_check()
1028 hme_read32(hp, tregs + TCVR_CFG) & in happy_meal_transceiver_check()
1037 u32 reread = hme_read32(hp, tregs + TCVR_CFG); in happy_meal_transceiver_check()
1041 hme_write32(hp, tregs + TCVR_CFG, tconfig | TCV_CFG_PSELECT); in happy_meal_transceiver_check()
1047 hme_write32(hp, tregs + TCVR_CFG, in happy_meal_transceiver_check()
1207 void __iomem *tregs, in happy_meal_begin_auto_negotiation() argument
1213 hp->sw_bmsr = happy_meal_tcvr_read(hp, tregs, MII_BMSR); in happy_meal_begin_auto_negotiation()
1214 hp->sw_bmcr = happy_meal_tcvr_read(hp, tregs, MII_BMCR); in happy_meal_begin_auto_negotiation()
1215 hp->sw_physid1 = happy_meal_tcvr_read(hp, tregs, MII_PHYSID1); in happy_meal_begin_auto_negotiation()
1216 hp->sw_physid2 = happy_meal_tcvr_read(hp, tregs, MII_PHYSID2); in happy_meal_begin_auto_negotiation()
1220 hp->sw_advertise = happy_meal_tcvr_read(hp, tregs, MII_ADVERTISE); in happy_meal_begin_auto_negotiation()
1240 happy_meal_tcvr_write(hp, tregs, MII_ADVERTISE, hp->sw_advertise); in happy_meal_begin_auto_negotiation()
1256 happy_meal_tcvr_write(hp, tregs, MII_BMCR, hp->sw_bmcr); in happy_meal_begin_auto_negotiation()
1260 happy_meal_tcvr_write(hp, tregs, MII_BMCR, hp->sw_bmcr); in happy_meal_begin_auto_negotiation()
1266 hp->sw_bmcr = happy_meal_tcvr_read(hp, tregs, MII_BMCR); in happy_meal_begin_auto_negotiation()
1301 happy_meal_tcvr_write(hp, tregs, MII_BMCR, hp->sw_bmcr); in happy_meal_begin_auto_negotiation()
1308 hp->sw_csconfig = happy_meal_tcvr_read(hp, tregs, in happy_meal_begin_auto_negotiation()
1311 happy_meal_tcvr_write(hp, tregs, DP83840_CSCONFIG, in happy_meal_begin_auto_negotiation()
1330 void __iomem *tregs = hp->tcvregs; in happy_meal_init() local
1346 happy_meal_poll_stop(hp, tregs); in happy_meal_init()
1358 hme_read32(hp, tregs + TCVR_IMASK)); in happy_meal_init()
1359 hme_write32(hp, tregs + TCVR_IMASK, 0xffff); in happy_meal_init()
1364 hme_read32(hp, tregs + TCVR_CFG)); in happy_meal_init()
1365 hme_write32(hp, tregs + TCVR_CFG, in happy_meal_init()
1366 hme_read32(hp, tregs + TCVR_CFG) & ~(TCV_CFG_BENABLE)); in happy_meal_init()
1369 hme_read32(hp, tregs + TCVR_CFG)); in happy_meal_init()
1370 hme_write32(hp, tregs + TCVR_CFG, in happy_meal_init()
1371 hme_read32(hp, tregs + TCVR_CFG) | TCV_CFG_BENABLE); in happy_meal_init()
1376 happy_meal_transceiver_check(hp, tregs); in happy_meal_init()
1398 if (happy_meal_tcvr_reset(hp, tregs)) in happy_meal_init()
1601 happy_meal_begin_auto_negotiation(hp, tregs, NULL); in happy_meal_init()
1610 void __iomem *tregs = hp->tcvregs; in happy_meal_set_initial_advertisement() local
1615 hme_write32(hp, tregs + TCVR_IMASK, 0xffff); in happy_meal_set_initial_advertisement()
1617 hme_write32(hp, tregs + TCVR_CFG, in happy_meal_set_initial_advertisement()
1618 hme_read32(hp, tregs + TCVR_CFG) & ~(TCV_CFG_BENABLE)); in happy_meal_set_initial_advertisement()
1620 hme_write32(hp, tregs + TCVR_CFG, in happy_meal_set_initial_advertisement()
1621 hme_read32(hp, tregs + TCVR_CFG) | TCV_CFG_BENABLE); in happy_meal_set_initial_advertisement()
1622 happy_meal_transceiver_check(hp, tregs); in happy_meal_set_initial_advertisement()
1633 if (happy_meal_tcvr_reset(hp, tregs)) in happy_meal_set_initial_advertisement()
1637 hp->sw_bmsr = happy_meal_tcvr_read(hp, tregs, MII_BMSR); in happy_meal_set_initial_advertisement()
1638 hp->sw_advertise = happy_meal_tcvr_read(hp, tregs, MII_ADVERTISE); in happy_meal_set_initial_advertisement()
1660 happy_meal_tcvr_write(hp, tregs, MII_ADVERTISE, hp->sw_advertise); in happy_meal_set_initial_advertisement()
1775 void __iomem *tregs = hp->tcvregs; in happy_meal_mif_interrupt() local
1778 hp->sw_bmcr = happy_meal_tcvr_read(hp, tregs, MII_BMCR); in happy_meal_mif_interrupt()
1779 hp->sw_lpa = happy_meal_tcvr_read(hp, tregs, MII_LPA); in happy_meal_mif_interrupt()
1794 happy_meal_tcvr_write(hp, tregs, MII_BMCR, hp->sw_bmcr); in happy_meal_mif_interrupt()
1797 happy_meal_poll_stop(hp, tregs); in happy_meal_mif_interrupt()