Lines Matching refs:tregs

256 static void idle_transceiver(void __iomem *tregs)  in idle_transceiver()  argument
261 sbus_writel(MGMT_CLKOFF, tregs + TCVR_MPAL); in idle_transceiver()
262 sbus_readl(tregs + TCVR_MPAL); in idle_transceiver()
263 sbus_writel(MGMT_CLKON, tregs + TCVR_MPAL); in idle_transceiver()
264 sbus_readl(tregs + TCVR_MPAL); in idle_transceiver()
268 static void write_tcvr_bit(struct bigmac *bp, void __iomem *tregs, int bit) in write_tcvr_bit() argument
273 tregs + TCVR_MPAL); in write_tcvr_bit()
274 sbus_readl(tregs + TCVR_MPAL); in write_tcvr_bit()
276 tregs + TCVR_MPAL); in write_tcvr_bit()
277 sbus_readl(tregs + TCVR_MPAL); in write_tcvr_bit()
281 tregs + TCVR_MPAL); in write_tcvr_bit()
282 sbus_readl(tregs + TCVR_MPAL); in write_tcvr_bit()
284 tregs + TCVR_MPAL); in write_tcvr_bit()
285 sbus_readl(tregs + TCVR_MPAL); in write_tcvr_bit()
291 static int read_tcvr_bit(struct bigmac *bp, void __iomem *tregs) in read_tcvr_bit() argument
296 sbus_writel(MGMT_PAL_EXT_MDIO, tregs + TCVR_MPAL); in read_tcvr_bit()
297 sbus_readl(tregs + TCVR_MPAL); in read_tcvr_bit()
299 tregs + TCVR_MPAL); in read_tcvr_bit()
300 sbus_readl(tregs + TCVR_MPAL); in read_tcvr_bit()
301 retval = (sbus_readl(tregs + TCVR_MPAL) & MGMT_PAL_INT_MDIO) >> 3; in read_tcvr_bit()
303 sbus_writel(MGMT_PAL_INT_MDIO, tregs + TCVR_MPAL); in read_tcvr_bit()
304 sbus_readl(tregs + TCVR_MPAL); in read_tcvr_bit()
305 sbus_writel(MGMT_PAL_INT_MDIO | MGMT_PAL_DCLOCK, tregs + TCVR_MPAL); in read_tcvr_bit()
306 sbus_readl(tregs + TCVR_MPAL); in read_tcvr_bit()
307 retval = (sbus_readl(tregs + TCVR_MPAL) & MGMT_PAL_EXT_MDIO) >> 2; in read_tcvr_bit()
314 static int read_tcvr_bit2(struct bigmac *bp, void __iomem *tregs) in read_tcvr_bit2() argument
319 sbus_writel(MGMT_PAL_EXT_MDIO, tregs + TCVR_MPAL); in read_tcvr_bit2()
320 sbus_readl(tregs + TCVR_MPAL); in read_tcvr_bit2()
321 retval = (sbus_readl(tregs + TCVR_MPAL) & MGMT_PAL_INT_MDIO) >> 3; in read_tcvr_bit2()
322 sbus_writel(MGMT_PAL_EXT_MDIO | MGMT_PAL_DCLOCK, tregs + TCVR_MPAL); in read_tcvr_bit2()
323 sbus_readl(tregs + TCVR_MPAL); in read_tcvr_bit2()
325 sbus_writel(MGMT_PAL_INT_MDIO, tregs + TCVR_MPAL); in read_tcvr_bit2()
326 sbus_readl(tregs + TCVR_MPAL); in read_tcvr_bit2()
327 retval = (sbus_readl(tregs + TCVR_MPAL) & MGMT_PAL_EXT_MDIO) >> 2; in read_tcvr_bit2()
328 sbus_writel(MGMT_PAL_INT_MDIO | MGMT_PAL_DCLOCK, tregs + TCVR_MPAL); in read_tcvr_bit2()
329 sbus_readl(tregs + TCVR_MPAL); in read_tcvr_bit2()
337 void __iomem *tregs, in put_tcvr_byte() argument
343 write_tcvr_bit(bp, tregs, ((byte >> shift) & 1)); in put_tcvr_byte()
348 static void bigmac_tcvr_write(struct bigmac *bp, void __iomem *tregs, in bigmac_tcvr_write() argument
365 idle_transceiver(tregs); in bigmac_tcvr_write()
366 write_tcvr_bit(bp, tregs, 0); in bigmac_tcvr_write()
367 write_tcvr_bit(bp, tregs, 1); in bigmac_tcvr_write()
368 write_tcvr_bit(bp, tregs, 0); in bigmac_tcvr_write()
369 write_tcvr_bit(bp, tregs, 1); in bigmac_tcvr_write()
371 put_tcvr_byte(bp, tregs, in bigmac_tcvr_write()
375 put_tcvr_byte(bp, tregs, reg); in bigmac_tcvr_write()
377 write_tcvr_bit(bp, tregs, 1); in bigmac_tcvr_write()
378 write_tcvr_bit(bp, tregs, 0); in bigmac_tcvr_write()
382 write_tcvr_bit(bp, tregs, (val >> shift) & 1); in bigmac_tcvr_write()
388 void __iomem *tregs, in bigmac_tcvr_read() argument
404 idle_transceiver(tregs); in bigmac_tcvr_read()
405 write_tcvr_bit(bp, tregs, 0); in bigmac_tcvr_read()
406 write_tcvr_bit(bp, tregs, 1); in bigmac_tcvr_read()
407 write_tcvr_bit(bp, tregs, 1); in bigmac_tcvr_read()
408 write_tcvr_bit(bp, tregs, 0); in bigmac_tcvr_read()
410 put_tcvr_byte(bp, tregs, in bigmac_tcvr_read()
414 put_tcvr_byte(bp, tregs, reg); in bigmac_tcvr_read()
419 (void) read_tcvr_bit2(bp, tregs); in bigmac_tcvr_read()
420 (void) read_tcvr_bit2(bp, tregs); in bigmac_tcvr_read()
425 tmp = 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()
432 (void) read_tcvr_bit2(bp, tregs); in bigmac_tcvr_read()
436 (void) read_tcvr_bit(bp, tregs); in bigmac_tcvr_read()
437 (void) read_tcvr_bit(bp, tregs); in bigmac_tcvr_read()
442 tmp = 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()
449 (void) read_tcvr_bit(bp, tregs); in bigmac_tcvr_read()
456 void __iomem *tregs = bp->tregs; in bigmac_tcvr_init() local
459 idle_transceiver(tregs); in bigmac_tcvr_init()
461 tregs + TCVR_MPAL); in bigmac_tcvr_init()
462 sbus_readl(tregs + TCVR_MPAL); in bigmac_tcvr_init()
467 sbus_writel(MGMT_PAL_INT_MDIO | MGMT_PAL_EXT_MDIO, tregs + TCVR_MPAL); in bigmac_tcvr_init()
468 sbus_readl(tregs + TCVR_MPAL); in bigmac_tcvr_init()
471 mpal = sbus_readl(tregs + TCVR_MPAL); in bigmac_tcvr_init()
475 tregs + TCVR_TPAL); in bigmac_tcvr_init()
476 sbus_readl(tregs + TCVR_TPAL); in bigmac_tcvr_init()
481 tregs + TCVR_TPAL); in bigmac_tcvr_init()
482 sbus_readl(tregs + TCVR_TPAL); in bigmac_tcvr_init()
487 sbus_readl(tregs + TCVR_MPAL), in bigmac_tcvr_init()
488 sbus_readl(tregs + TCVR_TPAL)); in bigmac_tcvr_init()
494 static int try_next_permutation(struct bigmac *bp, void __iomem *tregs) in try_next_permutation() argument
501 bigmac_tcvr_write(bp, tregs, MII_BMCR, bp->sw_bmcr); in try_next_permutation()
503 bigmac_tcvr_write(bp, tregs, MII_BMCR, bp->sw_bmcr); in try_next_permutation()
507 bp->sw_bmcr = bigmac_tcvr_read(bp, tregs, MII_BMCR); in try_next_permutation()
515 bp->sw_bmcr = bigmac_tcvr_read(bp, tregs, MII_BMCR); in try_next_permutation()
519 bigmac_tcvr_write(bp, tregs, MII_BMCR, bp->sw_bmcr); in try_next_permutation()
530 void __iomem *tregs = bp->tregs; in bigmac_timer() local
535 bp->sw_bmsr = bigmac_tcvr_read(bp, tregs, MII_BMSR); in bigmac_timer()
536 bp->sw_bmcr = bigmac_tcvr_read(bp, tregs, MII_BMCR); in bigmac_timer()
548 ret = try_next_permutation(bp, tregs); in bigmac_timer()
585 void __iomem *tregs = bp->tregs; in bigmac_begin_auto_negotiation() local
589 bp->sw_bmsr = bigmac_tcvr_read(bp, tregs, MII_BMSR); in bigmac_begin_auto_negotiation()
590 bp->sw_bmcr = bigmac_tcvr_read(bp, tregs, MII_BMCR); in bigmac_begin_auto_negotiation()
594 bigmac_tcvr_write(bp, tregs, MII_BMCR, bp->sw_bmcr); in bigmac_begin_auto_negotiation()
596 bigmac_tcvr_write(bp, tregs, MII_BMCR, bp->sw_bmcr); in bigmac_begin_auto_negotiation()
600 bp->sw_bmcr = bigmac_tcvr_read(bp, tregs, MII_BMCR); in bigmac_begin_auto_negotiation()
608 bp->sw_bmcr = bigmac_tcvr_read(bp, tregs, MII_BMCR); in bigmac_begin_auto_negotiation()
612 bigmac_tcvr_write(bp, tregs, MII_BMCR, bp->sw_bmcr); in bigmac_begin_auto_negotiation()
1050 bp->sw_bmsr = bigmac_tcvr_read(bp, bp->tregs, MII_BMSR); in bigmac_get_link()
1151 bp->tregs = of_ioremap(&op->resource[2], 0, in bigmac_ether_init()
1153 if (!bp->tregs) { in bigmac_ether_init()
1210 if (bp->tregs) in bigmac_ether_init()
1211 of_iounmap(&op->resource[2], bp->tregs, TCVR_REG_SIZE); in bigmac_ether_init()
1251 of_iounmap(&op->resource[2], bp->tregs, TCVR_REG_SIZE); in bigmac_sbus_remove()