Lines Matching refs:tregs

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