Lines Matching refs:tregs

255 static void idle_transceiver(void __iomem *tregs)  in idle_transceiver()  argument
260 sbus_writel(MGMT_CLKOFF, tregs + TCVR_MPAL); in idle_transceiver()
261 sbus_readl(tregs + TCVR_MPAL); in idle_transceiver()
262 sbus_writel(MGMT_CLKON, tregs + TCVR_MPAL); in idle_transceiver()
263 sbus_readl(tregs + TCVR_MPAL); in idle_transceiver()
267 static void write_tcvr_bit(struct bigmac *bp, void __iomem *tregs, int bit) in write_tcvr_bit() argument
272 tregs + TCVR_MPAL); in write_tcvr_bit()
273 sbus_readl(tregs + TCVR_MPAL); in write_tcvr_bit()
275 tregs + TCVR_MPAL); in write_tcvr_bit()
276 sbus_readl(tregs + TCVR_MPAL); in write_tcvr_bit()
280 tregs + TCVR_MPAL); in write_tcvr_bit()
281 sbus_readl(tregs + TCVR_MPAL); in write_tcvr_bit()
283 tregs + TCVR_MPAL); in write_tcvr_bit()
284 sbus_readl(tregs + TCVR_MPAL); in write_tcvr_bit()
290 static int read_tcvr_bit(struct bigmac *bp, void __iomem *tregs) in read_tcvr_bit() argument
295 sbus_writel(MGMT_PAL_EXT_MDIO, tregs + TCVR_MPAL); in read_tcvr_bit()
296 sbus_readl(tregs + TCVR_MPAL); in read_tcvr_bit()
298 tregs + TCVR_MPAL); in read_tcvr_bit()
299 sbus_readl(tregs + TCVR_MPAL); in read_tcvr_bit()
300 retval = (sbus_readl(tregs + TCVR_MPAL) & MGMT_PAL_INT_MDIO) >> 3; in read_tcvr_bit()
302 sbus_writel(MGMT_PAL_INT_MDIO, tregs + TCVR_MPAL); in read_tcvr_bit()
303 sbus_readl(tregs + TCVR_MPAL); in read_tcvr_bit()
304 sbus_writel(MGMT_PAL_INT_MDIO | MGMT_PAL_DCLOCK, tregs + TCVR_MPAL); in read_tcvr_bit()
305 sbus_readl(tregs + TCVR_MPAL); in read_tcvr_bit()
306 retval = (sbus_readl(tregs + TCVR_MPAL) & MGMT_PAL_EXT_MDIO) >> 2; in read_tcvr_bit()
313 static int read_tcvr_bit2(struct bigmac *bp, void __iomem *tregs) in read_tcvr_bit2() argument
318 sbus_writel(MGMT_PAL_EXT_MDIO, tregs + TCVR_MPAL); in read_tcvr_bit2()
319 sbus_readl(tregs + TCVR_MPAL); in read_tcvr_bit2()
320 retval = (sbus_readl(tregs + TCVR_MPAL) & MGMT_PAL_INT_MDIO) >> 3; in read_tcvr_bit2()
321 sbus_writel(MGMT_PAL_EXT_MDIO | MGMT_PAL_DCLOCK, tregs + TCVR_MPAL); in read_tcvr_bit2()
322 sbus_readl(tregs + TCVR_MPAL); in read_tcvr_bit2()
324 sbus_writel(MGMT_PAL_INT_MDIO, tregs + TCVR_MPAL); in read_tcvr_bit2()
325 sbus_readl(tregs + TCVR_MPAL); in read_tcvr_bit2()
326 retval = (sbus_readl(tregs + TCVR_MPAL) & MGMT_PAL_EXT_MDIO) >> 2; in read_tcvr_bit2()
327 sbus_writel(MGMT_PAL_INT_MDIO | MGMT_PAL_DCLOCK, tregs + TCVR_MPAL); in read_tcvr_bit2()
328 sbus_readl(tregs + TCVR_MPAL); in read_tcvr_bit2()
336 void __iomem *tregs, in put_tcvr_byte() argument
342 write_tcvr_bit(bp, tregs, ((byte >> shift) & 1)); in put_tcvr_byte()
347 static void bigmac_tcvr_write(struct bigmac *bp, void __iomem *tregs, in bigmac_tcvr_write() argument
364 idle_transceiver(tregs); in bigmac_tcvr_write()
365 write_tcvr_bit(bp, tregs, 0); in bigmac_tcvr_write()
366 write_tcvr_bit(bp, tregs, 1); in bigmac_tcvr_write()
367 write_tcvr_bit(bp, tregs, 0); in bigmac_tcvr_write()
368 write_tcvr_bit(bp, tregs, 1); in bigmac_tcvr_write()
370 put_tcvr_byte(bp, tregs, in bigmac_tcvr_write()
374 put_tcvr_byte(bp, tregs, reg); in bigmac_tcvr_write()
376 write_tcvr_bit(bp, tregs, 1); in bigmac_tcvr_write()
377 write_tcvr_bit(bp, tregs, 0); in bigmac_tcvr_write()
381 write_tcvr_bit(bp, tregs, (val >> shift) & 1); in bigmac_tcvr_write()
387 void __iomem *tregs, in bigmac_tcvr_read() argument
403 idle_transceiver(tregs); in bigmac_tcvr_read()
404 write_tcvr_bit(bp, tregs, 0); in bigmac_tcvr_read()
405 write_tcvr_bit(bp, tregs, 1); in bigmac_tcvr_read()
406 write_tcvr_bit(bp, tregs, 1); in bigmac_tcvr_read()
407 write_tcvr_bit(bp, tregs, 0); in bigmac_tcvr_read()
409 put_tcvr_byte(bp, tregs, in bigmac_tcvr_read()
413 put_tcvr_byte(bp, tregs, reg); in bigmac_tcvr_read()
418 (void) read_tcvr_bit2(bp, tregs); in bigmac_tcvr_read()
419 (void) read_tcvr_bit2(bp, tregs); in bigmac_tcvr_read()
424 tmp = read_tcvr_bit2(bp, tregs); in bigmac_tcvr_read()
429 (void) read_tcvr_bit2(bp, tregs); in bigmac_tcvr_read()
430 (void) read_tcvr_bit2(bp, tregs); in bigmac_tcvr_read()
431 (void) read_tcvr_bit2(bp, tregs); in bigmac_tcvr_read()
435 (void) read_tcvr_bit(bp, tregs); in bigmac_tcvr_read()
436 (void) read_tcvr_bit(bp, tregs); in bigmac_tcvr_read()
441 tmp = read_tcvr_bit(bp, tregs); in bigmac_tcvr_read()
446 (void) read_tcvr_bit(bp, tregs); in bigmac_tcvr_read()
447 (void) read_tcvr_bit(bp, tregs); in bigmac_tcvr_read()
448 (void) read_tcvr_bit(bp, tregs); in bigmac_tcvr_read()
455 void __iomem *tregs = bp->tregs; in bigmac_tcvr_init() local
458 idle_transceiver(tregs); in bigmac_tcvr_init()
460 tregs + TCVR_MPAL); in bigmac_tcvr_init()
461 sbus_readl(tregs + TCVR_MPAL); in bigmac_tcvr_init()
466 sbus_writel(MGMT_PAL_INT_MDIO | MGMT_PAL_EXT_MDIO, tregs + TCVR_MPAL); in bigmac_tcvr_init()
467 sbus_readl(tregs + TCVR_MPAL); in bigmac_tcvr_init()
470 mpal = sbus_readl(tregs + TCVR_MPAL); in bigmac_tcvr_init()
474 tregs + TCVR_TPAL); in bigmac_tcvr_init()
475 sbus_readl(tregs + TCVR_TPAL); in bigmac_tcvr_init()
480 tregs + TCVR_TPAL); in bigmac_tcvr_init()
481 sbus_readl(tregs + TCVR_TPAL); in bigmac_tcvr_init()
486 sbus_readl(tregs + TCVR_MPAL), in bigmac_tcvr_init()
487 sbus_readl(tregs + TCVR_TPAL)); in bigmac_tcvr_init()
493 static int try_next_permutation(struct bigmac *bp, void __iomem *tregs) in try_next_permutation() argument
500 bigmac_tcvr_write(bp, tregs, MII_BMCR, bp->sw_bmcr); in try_next_permutation()
502 bigmac_tcvr_write(bp, tregs, MII_BMCR, bp->sw_bmcr); in try_next_permutation()
506 bp->sw_bmcr = bigmac_tcvr_read(bp, tregs, MII_BMCR); in try_next_permutation()
514 bp->sw_bmcr = bigmac_tcvr_read(bp, tregs, MII_BMCR); in try_next_permutation()
518 bigmac_tcvr_write(bp, tregs, MII_BMCR, bp->sw_bmcr); in try_next_permutation()
529 void __iomem *tregs = bp->tregs; in bigmac_timer() local
534 bp->sw_bmsr = bigmac_tcvr_read(bp, tregs, MII_BMSR); in bigmac_timer()
535 bp->sw_bmcr = bigmac_tcvr_read(bp, tregs, MII_BMCR); in bigmac_timer()
547 ret = try_next_permutation(bp, tregs); in bigmac_timer()
584 void __iomem *tregs = bp->tregs; in bigmac_begin_auto_negotiation() local
588 bp->sw_bmsr = bigmac_tcvr_read(bp, tregs, MII_BMSR); in bigmac_begin_auto_negotiation()
589 bp->sw_bmcr = bigmac_tcvr_read(bp, tregs, MII_BMCR); in bigmac_begin_auto_negotiation()
593 bigmac_tcvr_write(bp, tregs, MII_BMCR, bp->sw_bmcr); in bigmac_begin_auto_negotiation()
595 bigmac_tcvr_write(bp, tregs, MII_BMCR, bp->sw_bmcr); in bigmac_begin_auto_negotiation()
599 bp->sw_bmcr = bigmac_tcvr_read(bp, tregs, MII_BMCR); in bigmac_begin_auto_negotiation()
607 bp->sw_bmcr = bigmac_tcvr_read(bp, tregs, MII_BMCR); in bigmac_begin_auto_negotiation()
611 bigmac_tcvr_write(bp, tregs, MII_BMCR, bp->sw_bmcr); in bigmac_begin_auto_negotiation()
1049 bp->sw_bmsr = bigmac_tcvr_read(bp, bp->tregs, MII_BMSR); in bigmac_get_link()
1153 bp->tregs = of_ioremap(&op->resource[2], 0, in bigmac_ether_init()
1155 if (!bp->tregs) { in bigmac_ether_init()
1212 if (bp->tregs) in bigmac_ether_init()
1213 of_iounmap(&op->resource[2], bp->tregs, TCVR_REG_SIZE); in bigmac_ether_init()
1253 of_iounmap(&op->resource[2], bp->tregs, TCVR_REG_SIZE); in bigmac_sbus_remove()