zy7_slcr.c (67bc8c8b9e69bc53221a9bd914e418d81d6cdc7d) zy7_slcr.c (59249a516a69e3a4055393f0975cdd8a848f5ce8)
1/*-
2 * Copyright (c) 2013 Thomas Skibo
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 482 unchanged lines hidden (view full) ---

491 ZSLCR_LOCK(sc);
492 reg = RD4(sc, ZY7_SLCR_FPGA_THR_CNT(unit));
493 ZSLCR_UNLOCK(sc);
494
495 return !(reg & 1);
496}
497
498int
1/*-
2 * Copyright (c) 2013 Thomas Skibo
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 482 unchanged lines hidden (view full) ---

491 ZSLCR_LOCK(sc);
492 reg = RD4(sc, ZY7_SLCR_FPGA_THR_CNT(unit));
493 ZSLCR_UNLOCK(sc);
494
495 return !(reg & 1);
496}
497
498int
499zy7_pl_level_shifters_enabled()
499zy7_pl_level_shifters_enabled(void)
500{
501 struct zy7_slcr_softc *sc = zy7_slcr_softc_p;
502
503 uint32_t reg;
504
505 if (!sc)
506 return (-1);
507
508 ZSLCR_LOCK(sc);
509 reg = RD4(sc, ZY7_SLCR_LVL_SHFTR_EN);
510 ZSLCR_UNLOCK(sc);
511
512 return (reg == ZY7_SLCR_LVL_SHFTR_EN_ALL);
513}
514
515void
500{
501 struct zy7_slcr_softc *sc = zy7_slcr_softc_p;
502
503 uint32_t reg;
504
505 if (!sc)
506 return (-1);
507
508 ZSLCR_LOCK(sc);
509 reg = RD4(sc, ZY7_SLCR_LVL_SHFTR_EN);
510 ZSLCR_UNLOCK(sc);
511
512 return (reg == ZY7_SLCR_LVL_SHFTR_EN_ALL);
513}
514
515void
516zy7_pl_level_shifters_enable()
516zy7_pl_level_shifters_enable(void)
517{
518 struct zy7_slcr_softc *sc = zy7_slcr_softc_p;
519
520 if (!sc)
521 return;
522
523 ZSLCR_LOCK(sc);
524 zy7_slcr_unlock(sc);
525 WR4(sc, ZY7_SLCR_LVL_SHFTR_EN, ZY7_SLCR_LVL_SHFTR_EN_ALL);
526 zy7_slcr_lock(sc);
527 ZSLCR_UNLOCK(sc);
528}
529
530void
517{
518 struct zy7_slcr_softc *sc = zy7_slcr_softc_p;
519
520 if (!sc)
521 return;
522
523 ZSLCR_LOCK(sc);
524 zy7_slcr_unlock(sc);
525 WR4(sc, ZY7_SLCR_LVL_SHFTR_EN, ZY7_SLCR_LVL_SHFTR_EN_ALL);
526 zy7_slcr_lock(sc);
527 ZSLCR_UNLOCK(sc);
528}
529
530void
531zy7_pl_level_shifters_disable()
531zy7_pl_level_shifters_disable(void)
532{
533 struct zy7_slcr_softc *sc = zy7_slcr_softc_p;
534
535 if (!sc)
536 return;
537
538 ZSLCR_LOCK(sc);
539 zy7_slcr_unlock(sc);

--- 172 unchanged lines hidden ---
532{
533 struct zy7_slcr_softc *sc = zy7_slcr_softc_p;
534
535 if (!sc)
536 return;
537
538 ZSLCR_LOCK(sc);
539 zy7_slcr_unlock(sc);

--- 172 unchanged lines hidden ---