Lines Matching refs:tregs

258 static void idle_transceiver(void __iomem *tregs)
263 sbus_writel(MGMT_CLKOFF, tregs + TCVR_MPAL);
264 sbus_readl(tregs + TCVR_MPAL);
265 sbus_writel(MGMT_CLKON, tregs + TCVR_MPAL);
266 sbus_readl(tregs + TCVR_MPAL);
270 static void write_tcvr_bit(struct bigmac *bp, void __iomem *tregs, int bit)
275 tregs + TCVR_MPAL);
276 sbus_readl(tregs + TCVR_MPAL);
278 tregs + TCVR_MPAL);
279 sbus_readl(tregs + TCVR_MPAL);
283 tregs + TCVR_MPAL);
284 sbus_readl(tregs + TCVR_MPAL);
286 tregs + TCVR_MPAL);
287 sbus_readl(tregs + TCVR_MPAL);
293 static int read_tcvr_bit(struct bigmac *bp, void __iomem *tregs)
298 sbus_writel(MGMT_PAL_EXT_MDIO, tregs + TCVR_MPAL);
299 sbus_readl(tregs + TCVR_MPAL);
301 tregs + TCVR_MPAL);
302 sbus_readl(tregs + TCVR_MPAL);
303 retval = (sbus_readl(tregs + TCVR_MPAL) & MGMT_PAL_INT_MDIO) >> 3;
305 sbus_writel(MGMT_PAL_INT_MDIO, tregs + TCVR_MPAL);
306 sbus_readl(tregs + TCVR_MPAL);
307 sbus_writel(MGMT_PAL_INT_MDIO | MGMT_PAL_DCLOCK, tregs + TCVR_MPAL);
308 sbus_readl(tregs + TCVR_MPAL);
309 retval = (sbus_readl(tregs + TCVR_MPAL) & MGMT_PAL_EXT_MDIO) >> 2;
316 static int read_tcvr_bit2(struct bigmac *bp, void __iomem *tregs)
321 sbus_writel(MGMT_PAL_EXT_MDIO, tregs + TCVR_MPAL);
322 sbus_readl(tregs + TCVR_MPAL);
323 retval = (sbus_readl(tregs + TCVR_MPAL) & MGMT_PAL_INT_MDIO) >> 3;
324 sbus_writel(MGMT_PAL_EXT_MDIO | MGMT_PAL_DCLOCK, tregs + TCVR_MPAL);
325 sbus_readl(tregs + TCVR_MPAL);
327 sbus_writel(MGMT_PAL_INT_MDIO, tregs + TCVR_MPAL);
328 sbus_readl(tregs + TCVR_MPAL);
329 retval = (sbus_readl(tregs + TCVR_MPAL) & MGMT_PAL_EXT_MDIO) >> 2;
330 sbus_writel(MGMT_PAL_INT_MDIO | MGMT_PAL_DCLOCK, tregs + TCVR_MPAL);
331 sbus_readl(tregs + TCVR_MPAL);
339 void __iomem *tregs,
345 write_tcvr_bit(bp, tregs, ((byte >> shift) & 1));
350 static void bigmac_tcvr_write(struct bigmac *bp, void __iomem *tregs,
367 idle_transceiver(tregs);
368 write_tcvr_bit(bp, tregs, 0);
369 write_tcvr_bit(bp, tregs, 1);
370 write_tcvr_bit(bp, tregs, 0);
371 write_tcvr_bit(bp, tregs, 1);
373 put_tcvr_byte(bp, tregs,
377 put_tcvr_byte(bp, tregs, reg);
379 write_tcvr_bit(bp, tregs, 1);
380 write_tcvr_bit(bp, tregs, 0);
384 write_tcvr_bit(bp, tregs, (val >> shift) & 1);
390 void __iomem *tregs,
406 idle_transceiver(tregs);
407 write_tcvr_bit(bp, tregs, 0);
408 write_tcvr_bit(bp, tregs, 1);
409 write_tcvr_bit(bp, tregs, 1);
410 write_tcvr_bit(bp, tregs, 0);
412 put_tcvr_byte(bp, tregs,
416 put_tcvr_byte(bp, tregs, reg);
421 (void) read_tcvr_bit2(bp, tregs);
422 (void) read_tcvr_bit2(bp, tregs);
427 tmp = read_tcvr_bit2(bp, tregs);
432 (void) read_tcvr_bit2(bp, tregs);
433 (void) read_tcvr_bit2(bp, tregs);
434 (void) read_tcvr_bit2(bp, tregs);
438 (void) read_tcvr_bit(bp, tregs);
439 (void) read_tcvr_bit(bp, tregs);
444 tmp = read_tcvr_bit(bp, tregs);
449 (void) read_tcvr_bit(bp, tregs);
450 (void) read_tcvr_bit(bp, tregs);
451 (void) read_tcvr_bit(bp, tregs);
458 void __iomem *tregs = bp->tregs;
461 idle_transceiver(tregs);
463 tregs + TCVR_MPAL);
464 sbus_readl(tregs + TCVR_MPAL);
469 sbus_writel(MGMT_PAL_INT_MDIO | MGMT_PAL_EXT_MDIO, tregs + TCVR_MPAL);
470 sbus_readl(tregs + TCVR_MPAL);
473 mpal = sbus_readl(tregs + TCVR_MPAL);
477 tregs + TCVR_TPAL);
478 sbus_readl(tregs + TCVR_TPAL);
483 tregs + TCVR_TPAL);
484 sbus_readl(tregs + TCVR_TPAL);
489 sbus_readl(tregs + TCVR_MPAL),
490 sbus_readl(tregs + TCVR_TPAL));
496 static int try_next_permutation(struct bigmac *bp, void __iomem *tregs)
503 bigmac_tcvr_write(bp, tregs, MII_BMCR, bp->sw_bmcr);
505 bigmac_tcvr_write(bp, tregs, MII_BMCR, bp->sw_bmcr);
509 bp->sw_bmcr = bigmac_tcvr_read(bp, tregs, MII_BMCR);
517 bp->sw_bmcr = bigmac_tcvr_read(bp, tregs, MII_BMCR);
521 bigmac_tcvr_write(bp, tregs, MII_BMCR, bp->sw_bmcr);
532 void __iomem *tregs = bp->tregs;
537 bp->sw_bmsr = bigmac_tcvr_read(bp, tregs, MII_BMSR);
538 bp->sw_bmcr = bigmac_tcvr_read(bp, tregs, MII_BMCR);
550 ret = try_next_permutation(bp, tregs);
587 void __iomem *tregs = bp->tregs;
591 bp->sw_bmsr = bigmac_tcvr_read(bp, tregs, MII_BMSR);
592 bp->sw_bmcr = bigmac_tcvr_read(bp, tregs, MII_BMCR);
596 bigmac_tcvr_write(bp, tregs, MII_BMCR, bp->sw_bmcr);
598 bigmac_tcvr_write(bp, tregs, MII_BMCR, bp->sw_bmcr);
602 bp->sw_bmcr = bigmac_tcvr_read(bp, tregs, MII_BMCR);
610 bp->sw_bmcr = bigmac_tcvr_read(bp, tregs, MII_BMCR);
614 bigmac_tcvr_write(bp, tregs, MII_BMCR, bp->sw_bmcr);
1057 bp->sw_bmsr = bigmac_tcvr_read(bp, bp->tregs, MII_BMSR);
1161 bp->tregs = of_ioremap(&op->resource[2], 0,
1163 if (!bp->tregs) {
1222 if (bp->tregs)
1223 of_iounmap(&op->resource[2], bp->tregs, TCVR_REG_SIZE);
1263 of_iounmap(&op->resource[2], bp->tregs, TCVR_REG_SIZE);