Lines Matching refs:tregs

322 static void BB_PUT_BIT(struct happy_meal *hp, void __iomem *tregs, int bit)  in BB_PUT_BIT()  argument
324 hme_write32(hp, tregs + TCVR_BBDATA, bit); in BB_PUT_BIT()
325 hme_write32(hp, tregs + TCVR_BBCLOCK, 0); in BB_PUT_BIT()
326 hme_write32(hp, tregs + TCVR_BBCLOCK, 1); in BB_PUT_BIT()
330 static u32 BB_GET_BIT(struct happy_meal *hp, void __iomem *tregs, int internal)
334 hme_write32(hp, tregs + TCVR_BBCLOCK, 0);
335 hme_write32(hp, tregs + TCVR_BBCLOCK, 1);
336 ret = hme_read32(hp, tregs + TCVR_CFG);
346 static u32 BB_GET_BIT2(struct happy_meal *hp, void __iomem *tregs, int internal) in BB_GET_BIT2() argument
350 hme_write32(hp, tregs + TCVR_BBCLOCK, 0); in BB_GET_BIT2()
352 retval = hme_read32(hp, tregs + TCVR_CFG); in BB_GET_BIT2()
357 hme_write32(hp, tregs + TCVR_BBCLOCK, 1); in BB_GET_BIT2()
365 void __iomem *tregs, int reg) in happy_meal_bb_read() argument
374 hme_write32(hp, tregs + TCVR_BBOENAB, 1); in happy_meal_bb_read()
378 BB_PUT_BIT(hp, tregs, 1); in happy_meal_bb_read()
381 BB_PUT_BIT(hp, tregs, 0); in happy_meal_bb_read()
382 BB_PUT_BIT(hp, tregs, 1); in happy_meal_bb_read()
383 BB_PUT_BIT(hp, tregs, 1); in happy_meal_bb_read()
384 BB_PUT_BIT(hp, tregs, 0); in happy_meal_bb_read()
389 BB_PUT_BIT(hp, tregs, ((tmp >> i) & 1)); in happy_meal_bb_read()
394 BB_PUT_BIT(hp, tregs, ((tmp >> i) & 1)); in happy_meal_bb_read()
397 hme_write32(hp, tregs + TCVR_BBOENAB, 0); in happy_meal_bb_read()
400 (void) BB_GET_BIT2(hp, tregs, (hp->tcvr_type == internal)); in happy_meal_bb_read()
402 retval |= 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()
405 (void) BB_GET_BIT2(hp, tregs, (hp->tcvr_type == internal)); in happy_meal_bb_read()
411 void __iomem *tregs, int reg, in happy_meal_bb_write() argument
420 hme_write32(hp, tregs + TCVR_BBOENAB, 1); in happy_meal_bb_write()
424 BB_PUT_BIT(hp, tregs, 1); in happy_meal_bb_write()
427 BB_PUT_BIT(hp, tregs, 0); in happy_meal_bb_write()
428 BB_PUT_BIT(hp, tregs, 1); in happy_meal_bb_write()
429 BB_PUT_BIT(hp, tregs, 0); in happy_meal_bb_write()
430 BB_PUT_BIT(hp, tregs, 1); in happy_meal_bb_write()
435 BB_PUT_BIT(hp, tregs, ((tmp >> i) & 1)); in happy_meal_bb_write()
440 BB_PUT_BIT(hp, tregs, ((tmp >> i) & 1)); in happy_meal_bb_write()
443 BB_PUT_BIT(hp, tregs, 1); in happy_meal_bb_write()
444 BB_PUT_BIT(hp, tregs, 0); in happy_meal_bb_write()
447 BB_PUT_BIT(hp, tregs, ((value >> i) & 1)); in happy_meal_bb_write()
450 hme_write32(hp, tregs + TCVR_BBOENAB, 0); in happy_meal_bb_write()
456 void __iomem *tregs, int reg) in happy_meal_tcvr_read() argument
469 return happy_meal_bb_read(hp, tregs, reg); in happy_meal_tcvr_read()
472 hme_write32(hp, tregs + TCVR_FRAME, in happy_meal_tcvr_read()
474 while (!(hme_read32(hp, tregs + TCVR_FRAME) & 0x10000) && --tries) in happy_meal_tcvr_read()
480 retval = hme_read32(hp, tregs + TCVR_FRAME) & 0xffff; in happy_meal_tcvr_read()
488 void __iomem *tregs, int reg, in happy_meal_tcvr_write() argument
497 happy_meal_bb_write(hp, tregs, reg, value); in happy_meal_tcvr_write()
502 hme_write32(hp, tregs + TCVR_FRAME, in happy_meal_tcvr_write()
505 while (!(hme_read32(hp, tregs + TCVR_FRAME) & 0x10000) && --tries) in happy_meal_tcvr_write()
547 static int try_next_permutation(struct happy_meal *hp, void __iomem *tregs) in try_next_permutation() argument
549 hp->sw_bmcr = happy_meal_tcvr_read(hp, tregs, MII_BMCR); in try_next_permutation()
556 happy_meal_tcvr_write(hp, tregs, MII_BMCR, hp->sw_bmcr); in try_next_permutation()
563 happy_meal_tcvr_write(hp, tregs, MII_BMCR, hp->sw_bmcr); in try_next_permutation()
571 static void display_link_mode(struct happy_meal *hp, void __iomem *tregs) in display_link_mode() argument
579 hp->sw_lpa = happy_meal_tcvr_read(hp, tregs, MII_LPA); in display_link_mode()
593 static void display_forced_link_mode(struct happy_meal *hp, void __iomem *tregs) in display_forced_link_mode() argument
601 hp->sw_bmcr = happy_meal_tcvr_read(hp, tregs, MII_BMCR); in display_forced_link_mode()
612 static int set_happy_link_modes(struct happy_meal *hp, void __iomem *tregs) in set_happy_link_modes() argument
620 hp->sw_lpa = happy_meal_tcvr_read(hp, tregs, MII_LPA); in set_happy_link_modes()
633 hp->sw_bmcr = happy_meal_tcvr_read(hp, tregs, MII_BMCR); in set_happy_link_modes()
676 void __iomem *tregs = hp->tcvregs; in is_lucent_phy() local
680 mr2 = happy_meal_tcvr_read(hp, tregs, 2); in is_lucent_phy()
681 mr3 = happy_meal_tcvr_read(hp, tregs, 3); in is_lucent_phy()
692 void __iomem *tregs = hp->tcvregs; in happy_meal_timer() local
706 hp->sw_bmcr = happy_meal_tcvr_read(hp, tregs, MII_BMCR); in happy_meal_timer()
710 happy_meal_tcvr_write(hp, tregs, MII_BMCR, hp->sw_bmcr); in happy_meal_timer()
717 hp->sw_csconfig = happy_meal_tcvr_read(hp, tregs, DP83840_CSCONFIG); in happy_meal_timer()
719 happy_meal_tcvr_write(hp, tregs, DP83840_CSCONFIG, hp->sw_csconfig); in happy_meal_timer()
726 hp->sw_bmsr = happy_meal_tcvr_read(hp, tregs, MII_BMSR); in happy_meal_timer()
731 ret = set_happy_link_modes(hp, tregs); in happy_meal_timer()
757 hp->sw_bmsr = happy_meal_tcvr_read(hp, tregs, MII_BMSR); in happy_meal_timer()
762 display_link_mode(hp, tregs); in happy_meal_timer()
783 hp->sw_bmsr = happy_meal_tcvr_read(hp, tregs, MII_BMSR); in happy_meal_timer()
784 hp->sw_csconfig = happy_meal_tcvr_read(hp, tregs, DP83840_CSCONFIG); in happy_meal_timer()
791 happy_meal_tcvr_write(hp, tregs, in happy_meal_timer()
800 happy_meal_tcvr_write(hp, tregs, in happy_meal_timer()
808 display_forced_link_mode(hp, tregs); in happy_meal_timer()
809 set_happy_link_modes(hp, tregs); /* XXX error? then what? */ in happy_meal_timer()
816 ret = try_next_permutation(hp, tregs); in happy_meal_timer()
835 hp->sw_csconfig = happy_meal_tcvr_read(hp, tregs, in happy_meal_timer()
838 happy_meal_tcvr_write(hp, tregs, in happy_meal_timer()
958 static void happy_meal_poll_stop(struct happy_meal *hp, void __iomem *tregs) in happy_meal_poll_stop() argument
971 hme_write32(hp, tregs + TCVR_IMASK, 0xffff); in happy_meal_poll_stop()
975 hme_write32(hp, tregs + TCVR_CFG, in happy_meal_poll_stop()
976 hme_read32(hp, tregs + TCVR_CFG) & ~(TCV_CFG_PENABLE)); in happy_meal_poll_stop()
993 static int happy_meal_tcvr_reset(struct happy_meal *hp, void __iomem *tregs) in happy_meal_tcvr_reset() argument
998 tconfig = hme_read32(hp, tregs + TCVR_CFG); in happy_meal_tcvr_reset()
1002 hme_write32(hp, tregs + TCVR_CFG, tconfig & ~(TCV_CFG_PSELECT)); in happy_meal_tcvr_reset()
1006 happy_meal_tcvr_write(hp, tregs, MII_BMCR, in happy_meal_tcvr_reset()
1008 result = happy_meal_tcvr_read(hp, tregs, MII_BMCR); in happy_meal_tcvr_reset()
1014 hme_write32(hp, tregs + TCVR_CFG, tconfig | TCV_CFG_PSELECT); in happy_meal_tcvr_reset()
1020 hme_write32(hp, tregs + TCVR_CFG, (tconfig | TCV_CFG_PSELECT)); in happy_meal_tcvr_reset()
1022 happy_meal_tcvr_write(hp, tregs, MII_BMCR, in happy_meal_tcvr_reset()
1024 result = happy_meal_tcvr_read(hp, tregs, MII_BMCR); in happy_meal_tcvr_reset()
1030 hme_write32(hp, tregs + TCVR_CFG, (tconfig & ~(TCV_CFG_PSELECT))); in happy_meal_tcvr_reset()
1037 happy_meal_tcvr_write(hp, tregs, MII_BMCR, BMCR_RESET); in happy_meal_tcvr_reset()
1040 result = happy_meal_tcvr_read(hp, tregs, MII_BMCR); in happy_meal_tcvr_reset()
1055 hp->sw_bmsr = happy_meal_tcvr_read(hp, tregs, MII_BMSR); in happy_meal_tcvr_reset()
1056 hp->sw_physid1 = happy_meal_tcvr_read(hp, tregs, MII_PHYSID1); in happy_meal_tcvr_reset()
1057 hp->sw_physid2 = happy_meal_tcvr_read(hp, tregs, MII_PHYSID2); in happy_meal_tcvr_reset()
1058 hp->sw_advertise = happy_meal_tcvr_read(hp, tregs, MII_ADVERTISE); in happy_meal_tcvr_reset()
1062 happy_meal_tcvr_write(hp, tregs, MII_BMCR, hp->sw_bmcr); in happy_meal_tcvr_reset()
1066 result = happy_meal_tcvr_read(hp, tregs, MII_BMCR); in happy_meal_tcvr_reset()
1079 result = happy_meal_tcvr_read(hp, tregs, in happy_meal_tcvr_reset()
1081 happy_meal_tcvr_write(hp, tregs, in happy_meal_tcvr_reset()
1091 static void happy_meal_transceiver_check(struct happy_meal *hp, void __iomem *tregs) in happy_meal_transceiver_check() argument
1093 unsigned long tconfig = hme_read32(hp, tregs + TCVR_CFG); in happy_meal_transceiver_check()
1102 happy_meal_poll_stop(hp, tregs); in happy_meal_transceiver_check()
1108 hme_write32(hp, tregs + TCVR_CFG, tconfig); in happy_meal_transceiver_check()
1113 if (!(hme_read32(hp, tregs + TCVR_STATUS) >> 16)) { in happy_meal_transceiver_check()
1115 happy_meal_poll_stop(hp, tregs); in happy_meal_transceiver_check()
1119 hme_write32(hp, tregs + TCVR_CFG, in happy_meal_transceiver_check()
1120 hme_read32(hp, tregs + TCVR_CFG) & in happy_meal_transceiver_check()
1129 u32 reread = hme_read32(hp, tregs + TCVR_CFG); in happy_meal_transceiver_check()
1134 hme_write32(hp, tregs + TCVR_CFG, tconfig | TCV_CFG_PSELECT); in happy_meal_transceiver_check()
1140 hme_write32(hp, tregs + TCVR_CFG, in happy_meal_transceiver_check()
1300 void __iomem *tregs, in happy_meal_begin_auto_negotiation() argument
1306 hp->sw_bmsr = happy_meal_tcvr_read(hp, tregs, MII_BMSR); in happy_meal_begin_auto_negotiation()
1307 hp->sw_bmcr = happy_meal_tcvr_read(hp, tregs, MII_BMCR); in happy_meal_begin_auto_negotiation()
1308 hp->sw_physid1 = happy_meal_tcvr_read(hp, tregs, MII_PHYSID1); in happy_meal_begin_auto_negotiation()
1309 hp->sw_physid2 = happy_meal_tcvr_read(hp, tregs, MII_PHYSID2); in happy_meal_begin_auto_negotiation()
1313 hp->sw_advertise = happy_meal_tcvr_read(hp, tregs, MII_ADVERTISE); in happy_meal_begin_auto_negotiation()
1333 happy_meal_tcvr_write(hp, tregs, MII_ADVERTISE, hp->sw_advertise); in happy_meal_begin_auto_negotiation()
1355 happy_meal_tcvr_write(hp, tregs, MII_BMCR, hp->sw_bmcr); in happy_meal_begin_auto_negotiation()
1359 happy_meal_tcvr_write(hp, tregs, MII_BMCR, hp->sw_bmcr); in happy_meal_begin_auto_negotiation()
1365 hp->sw_bmcr = happy_meal_tcvr_read(hp, tregs, MII_BMCR); in happy_meal_begin_auto_negotiation()
1399 happy_meal_tcvr_write(hp, tregs, MII_BMCR, hp->sw_bmcr); in happy_meal_begin_auto_negotiation()
1406 hp->sw_csconfig = happy_meal_tcvr_read(hp, tregs, in happy_meal_begin_auto_negotiation()
1409 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()