Ejemplo n.º 1
0
class TCA6408(object):
    """
    Abstraction layer for the port/gpio expander
    """
    pins = (
        'PWR-GOOD-3.6V', #3.6V
        'PWR-GOOD-1.1V', #1.1V
        'PWR-GOOD-2.0V', #2.0V
        'PWR-GOOD-5.4V', #5.4V
        'PWR-GOOD-5.5V', #6.8V
    )

    def __init__(self, i2c_dev):
        assert i2c_dev is not None
        self._gpios = SysFSGPIO({'label': 'tca6408'}, 0x3F, 0x00, 0x00, i2c_dev)

    def set(self, name, value=None):
        """
        Assert a pin by name
        """
        assert name in self.pins
        self._gpios.set(self.pins.index(name), value=value)

    def reset(self, name):
        """
        Deassert a pin by name
        """
        self.set(name, value=0)

    def get(self, name):
        """
        Read back a pin by name
        """
        assert name in self.pins
        return self._gpios.get(self.pins.index(name))
Ejemplo n.º 2
0
    def __init__(self, rev):
        # Default state: Turn on GPS power, take GPS out of reset or
        # init-survey, turn on 156.25 MHz clock
        # min Support from revC or rev = 2
        if rev == 2:
            self.pins = self.pins_list[0]
        else:
            self.pins = self.pins_list[1]

        default_val = 0x860101 if rev == 2 else 0x860780
        self._gpios = SysFSGPIO('tca6424', 0xFFF7FF, 0x86F7FF, default_val)
Ejemplo n.º 3
0
 def __init__(self, i2c_dev):
     assert i2c_dev is not None
     self._gpios = SysFSGPIO({'label': 'tca6424', 'device/of_node/name': 'rhodium-lodist-gpio'}, 0x1FFF0F, 0x1FFF00, 0x00A500, i2c_dev)
     board_rev = self._gpios.get(self.pins.index('BD_REV_0')) + \
                 self._gpios.get(self.pins.index('BD_REV_1')) << 1 + \
                 self._gpios.get(self.pins.index('BD_REV_2')) << 2
     if  board_rev != self.EXPECTED_BOARD_REV:
         raise RuntimeError('LO distribution board revision did not match: Expected: {0} Actual: {1}'.format(self.EXPECTED_BOARD_REV, board_rev))
     self._gpios.set(self.pins.index('P6_8V_EN'), 1)
     if not poll_with_timeout(
             lambda: bool(self._gpios.get(self.pins.index('P6_8V_PG'))), 
             self.POWER_ON_TIMEOUT, 
             self.POWER_ON_POLL_INTERVAL):
         self._gpios.set(self.pins.index('P6_8V_EN'), 0)
         raise RuntimeError('Power on failure for LO Distribution board')
     self._gpios.set(self.pins.index('P6_5V_LDO_EN'), 1)
     self._gpios.set(self.pins.index('P3_3V_RF_EN'), 1)
Ejemplo n.º 4
0
    def __init__(self, rev):
        # Default state: Turn on GPS power, take GPS out of reset or
        # init-survey, turn on 156.25 MHz clock
        # min Support from revC or rev = 2
        if rev == 2:
            self.pins = self.pins_list[0]
        else:
            self.pins = self.pins_list[1]

        default_val = 0x860101 if rev == 2 else 0x860780
        self._gpios = SysFSGPIO({'label': 'tca6424', 'device/of_node/name': 'gpio'}, 0xFFF7FF, 0x86F7FF, default_val)
Ejemplo n.º 5
0
class TCA6408(object):
    """
    Abstraction layer for the port/gpio expander
    """
    pins = (
        'PWR-GOOD-3.6V',  #3.6V
        'PWR-EN-3.6V',  #3.6V
        'PWR-GOOD-1.5V',  #1.5V
        'PWR-EN-1.5V',  #1.5V
        'PWR-GOOD-5.5V',  #5.5V
        'PWR-EN-5.5V',  #5.5V
        '6',
        'LED',
    )

    def __init__(self, i2c_dev):
        if i2c_dev is None:
            raise RuntimeError("Need to specify i2c device to use the TCA6408")
        self._gpios = SysFSGPIO({'device/name': 'tca6408'}, 0xBF, 0xAA, 0xAA,
                                i2c_dev)

    def set(self, name, value=None):
        """
        Assert a pin by name
        """
        assert name in self.pins
        self._gpios.set(self.pins.index(name), value=value)

    def reset(self, name):
        """
        Deassert a pin by name
        """
        self.set(name, value=0)

    def get(self, name):
        """
        Read back a pin by name
        """
        assert name in self.pins
        return self._gpios.get(self.pins.index(name))
Ejemplo n.º 6
0
class TCA6408(object):
    """
    Abstraction layer for the port/gpio expander
    """
    pins = (
        'PWR-GOOD-3.6V', #3.6V
        'PWR-EN-3.6V',   #3.6V
        'PWR-GOOD-1.5V', #1.5V
        'PWR-EN-1.5V',   #1.5V
        'PWR-GOOD-5.5V', #5.5V
        'PWR-EN-5.5V',   #5.5V
        '6',
        'LED',
    )

    def __init__(self, i2c_dev):
        if i2c_dev is None:
            raise RuntimeError("Need to specify i2c device to use the TCA6408")
        self._gpios = SysFSGPIO({'label': 'tca6408'}, 0xBF, 0xAA, 0xAA, i2c_dev)

    def set(self, name, value=None):
        """
        Assert a pin by name
        """
        assert name in self.pins
        self._gpios.set(self.pins.index(name), value=value)

    def reset(self, name):
        """
        Deassert a pin by name
        """
        self.set(name, value=0)

    def get(self, name):
        """
        Read back a pin by name
        """
        assert name in self.pins
        return self._gpios.get(self.pins.index(name))
Ejemplo n.º 7
0
class TCA6424(object):
    """
    Abstraction layer for the port/gpio expander
    pins_list is  an array of different version of TCA6424 pins map.
    First element of this array corresponding to revC, second is revD etc...
    """
    pins_list = [
        (
            'PWREN-CLK-MGT156MHz',
            'NETCLK-CE',  #revC name: 'PWREN-CLK-WB-CDCM',
            'NETCLK-RESETn',  #revC name: 'WB-CDCM-RESETn',
            'NETCLK-PR0',  #revC name: 'WB-CDCM-PR0',
            'NETCLK-PR1',  #revC name: 'WB-CDCM-PR1',
            'NETCLK-OD0',  #revC name: 'WB-CDCM-OD0',
            'NETCLK-OD1',  #revC name: 'WB-CDCM-OD1',
            'NETCLK-OD2',  #revC name: 'WB-CDCM-OD2',
            'PWREN-CLK-MAINREF',
            'CLK-MAINSEL-25MHz',  #revC name: 'CLK-MAINREF-SEL1',
            'CLK-MAINSEL-EX_B',  #revC name: 'CLK-MAINREF-SEL0',
            '12',
            'CLK-MAINSEL-GPS',  #revC name: '13',
            'FPGA-GPIO-EN',
            'PWREN-CLK-WB-20MHz',
            'PWREN-CLK-WB-25MHz',
            'GPS-PHASELOCK',
            'GPS-nINITSURV',
            'GPS-nRESET',
            'GPS-WARMUP',
            'GPS-SURVEY',
            'GPS-LOCKOK',
            'GPS-ALARM',
            'PWREN-GPS',
        ),
        (
            'NETCLK-PR1',
            'NETCLK-PR0',
            'NETCLK-CE',
            'NETCLK-RESETn',
            'NETCLK-OD2',
            'NETCLK-OD1',
            'NETCLK-OD0',
            'PWREN-CLK-MGT156MHz',
            'PWREN-CLK-MAINREF',
            'CLK-MAINSEL-25MHz',
            'CLK-MAINSEL-EX_B',
            '12',
            'CLK-MAINSEL-GPS',
            'FPGA-GPIO-EN',
            'PWREN-CLK-WB-20MHz',
            'PWREN-CLK-WB-25MHz',
            'GPS-PHASELOCK',
            'GPS-nINITSURV',
            'GPS-nRESET',
            'GPS-WARMUP',
            'GPS-SURVEY',
            'GPS-LOCKOK',
            'GPS-ALARM',
            'PWREN-GPS',
        )
    ]

    def __init__(self, rev):
        # Default state: Turn on GPS power, take GPS out of reset or
        # init-survey, turn on 156.25 MHz clock
        # min Support from revC or rev = 2
        if rev == 2:
            self.pins = self.pins_list[0]
        else:
            self.pins = self.pins_list[1]

        default_val = 0x860101 if rev == 2 else 0x860780
        self._gpios = SysFSGPIO('tca6424', 0xFFF7FF, 0x86F7FF, default_val)

    def set(self, name, value=None):
        """
        Assert a pin by name
        """
        assert name in self.pins
        self._gpios.set(self.pins.index(name), value=value)

    def reset(self, name):
        """
        Deassert a pin by name
        """
        self.set(name, value=0)

    def get(self, name):
        """
        Read back a pin by name
        """
        assert name in self.pins
        return self._gpios.get(self.pins.index(name))
Ejemplo n.º 8
0
 def __init__(self, i2c_dev):
     if i2c_dev is None:
         raise RuntimeError("Need to specify i2c device to use the TCA6408")
     self._gpios = SysFSGPIO('tca6408', 0xBF, 0xAA, 0xAA, i2c_dev)
Ejemplo n.º 9
0
class FPGAtoLoDist(object):
    """
    Abstraction layer for the port/gpio expander on the LO Distribution board
    """
    EXPECTED_BOARD_REV = 0
    POWER_ON_TIMEOUT = 20 #ms
    POWER_ON_POLL_INTERVAL = 1 #ms

    pins = (
        'BD_REV_0', #Board revision bit 0
        'BD_REV_1', #Board revision bit 1
        'BD_REV_2', #Board revision bit 2
        'P6_8V_PG', #6.8V Power good
        '4', #No connect
        '5', #No connect
        '6', #No connect
        '7', #No connect
        'RX_OUT0_CTRL', #RX Out0 Port Termination Switch
        'RX_OUT1_CTRL', #RX Out1 Port Termination Switch
        'RX_OUT2_CTRL', #RX Out2 Port Termination Switch
        'RX_OUT3_CTRL', #RX Out3 Port Termination Switch
        'RX_INSWITCH_CTRL', #RX 1:4 splitter input select
        'TX_OUT0_CTRL', #TX Out0 Port Termination Switch
        'TX_OUT1_CTRL', #TX Out1 Port Termination Switch
        'TX_OUT2_CTRL', #TX Out2 Port Termination Switch
        'TX_OUT3_CTRL', #TX Out3 Port Termination Switch
        'TX_INSWITCH_CTRL', #TX 1:4 splitter input select
        'P6_8V_EN', #6.8V supply enable
        'P6_5V_LDO_EN', #6.5V LDO enable
        'P3_3V_RF_EN' #3.3V LDO for RF enable
    )

    def __init__(self, i2c_dev):
        assert i2c_dev is not None
        self._gpios = SysFSGPIO({'label': 'tca6424', 'device/of_node/name': 'rhodium-lodist-gpio'}, 0x1FFF0F, 0x1FFF00, 0x00A500, i2c_dev)
        board_rev = self._gpios.get(self.pins.index('BD_REV_0')) + \
                    self._gpios.get(self.pins.index('BD_REV_1')) << 1 + \
                    self._gpios.get(self.pins.index('BD_REV_2')) << 2
        if  board_rev != self.EXPECTED_BOARD_REV:
            raise RuntimeError('LO distribution board revision did not match: Expected: {0} Actual: {1}'.format(self.EXPECTED_BOARD_REV, board_rev))
        self._gpios.set(self.pins.index('P6_8V_EN'), 1)
        if not poll_with_timeout(
                lambda: bool(self._gpios.get(self.pins.index('P6_8V_PG'))), 
                self.POWER_ON_TIMEOUT, 
                self.POWER_ON_POLL_INTERVAL):
            self._gpios.set(self.pins.index('P6_8V_EN'), 0)
            raise RuntimeError('Power on failure for LO Distribution board')
        self._gpios.set(self.pins.index('P6_5V_LDO_EN'), 1)
        self._gpios.set(self.pins.index('P3_3V_RF_EN'), 1)

    def set(self, name, value=None):
        """
        Assert a pin by name
        """
        assert name in self.pins
        self._gpios.set(self.pins.index(name), value=value)

    def reset(self, name):
        """
        Deassert a pin by name
        """
        assert name in self.pins
        self.set(name, value=0)

    def get(self, name):
        """
        Read back a pin by name
        """
        assert name in self.pins
        return self._gpios.get(self.pins.index(name))
Ejemplo n.º 10
0
 def __init__(self, i2c_dev):
     assert i2c_dev is not None
     self._gpios = SysFSGPIO({'label': 'tca6408'}, 0x3F, 0x00, 0x00, i2c_dev)
Ejemplo n.º 11
0
 def __init__(self, i2c_dev):
     if i2c_dev is None:
         raise RuntimeError("Need to specify i2c device to use the TCA6408")
     self._gpios = SysFSGPIO({'label': 'tca6408'}, 0x3F, 0x00, 0x00, i2c_dev)
Ejemplo n.º 12
0
class TCA6424(object):
    """
    Abstraction layer for the port/gpio expander
    pins_list is  an array of different version of TCA6424 pins map.
    First element of this array corresponding to revC, second is revD etc...
    """
    pins_list = [
        (
            'PWREN-CLK-MGT156MHz',
            'NETCLK-CE',         #revC name: 'PWREN-CLK-WB-CDCM',
            'NETCLK-RESETn',     #revC name: 'WB-CDCM-RESETn',
            'NETCLK-PR0',        #revC name: 'WB-CDCM-PR0',
            'NETCLK-PR1',        #revC name: 'WB-CDCM-PR1',
            'NETCLK-OD0',        #revC name: 'WB-CDCM-OD0',
            'NETCLK-OD1',        #revC name: 'WB-CDCM-OD1',
            'NETCLK-OD2',        #revC name: 'WB-CDCM-OD2',
            'PWREN-CLK-MAINREF',
            'CLK-MAINSEL-25MHz', #revC name: 'CLK-MAINREF-SEL1',
            'CLK-MAINSEL-EX_B',  #revC name: 'CLK-MAINREF-SEL0',
            '12',
            'CLK-MAINSEL-GPS',   #revC name: '13',
            'FPGA-GPIO-EN',
            'PWREN-CLK-WB-20MHz',
            'PWREN-CLK-WB-25MHz',
            'GPS-PHASELOCK',
            'GPS-nINITSURV',
            'GPS-nRESET',
            'GPS-WARMUP',
            'GPS-SURVEY',
            'GPS-LOCKOK',
            'GPS-ALARM',
            'PWREN-GPS',
        ),
        (
            'NETCLK-PR1',
            'NETCLK-PR0',
            'NETCLK-CE',
            'NETCLK-RESETn',
            'NETCLK-OD2',
            'NETCLK-OD1',
            'NETCLK-OD0',
            'PWREN-CLK-MGT156MHz',
            'PWREN-CLK-MAINREF',
            'CLK-MAINSEL-25MHz',
            'CLK-MAINSEL-EX_B',
            '12',
            'CLK-MAINSEL-GPS',
            'FPGA-GPIO-EN',
            'PWREN-CLK-WB-20MHz',
            'PWREN-CLK-WB-25MHz',
            'GPS-PHASELOCK',
            'GPS-nINITSURV',
            'GPS-nRESET',
            'GPS-WARMUP',
            'GPS-SURVEY',
            'GPS-LOCKOK',
            'GPS-ALARM',
            'PWREN-GPS',
        )]

    def __init__(self, rev):
        # Default state: Turn on GPS power, take GPS out of reset or
        # init-survey, turn on 156.25 MHz clock
        # min Support from revC or rev = 2
        if rev == 2:
            self.pins = self.pins_list[0]
        else:
            self.pins = self.pins_list[1]

        default_val = 0x860101 if rev == 2 else 0x860780
        self._gpios = SysFSGPIO({'label': 'tca6424', 'device/of_node/name': 'gpio'}, 0xFFF7FF, 0x86F7FF, default_val)

    def set(self, name, value=None):
        """
        Assert a pin by name
        """
        assert name in self.pins
        self._gpios.set(self.pins.index(name), value=value)

    def reset(self, name):
        """
        Deassert a pin by name
        """
        self.set(name, value=0)

    def get(self, name):
        """
        Read back a pin by name
        """
        assert name in self.pins
        return self._gpios.get(self.pins.index(name))
Ejemplo n.º 13
0
 def __init__(self, i2c_dev):
     if i2c_dev is None:
         raise RuntimeError("Need to specify i2c device to use the TCA6408")
     self._gpios = SysFSGPIO({'label': 'tca6408'}, 0xBF, 0xAA, 0xAA, i2c_dev)