def wedge_board_rev(soc_gpio_table, board_gpio_rev_table):
    # Setup to read revision
    setup_board_gpio(soc_gpio_table, board_gpio_rev_table)
    # Read the gpio values
    v0 = openbmc_gpio.gpio_get_value('BOARD_REV_ID0')
    v1 = openbmc_gpio.gpio_get_value('BOARD_REV_ID1')
    v2 = openbmc_gpio.gpio_get_value('BOARD_REV_ID2')
    return ((v2 << 2) | (v1 << 1) | v0)
Example #2
0
def minipack_board_rev(soc_gpio_table, board_gpio_rev_table):
    # Setup to read revision
    setup_board_gpio(soc_gpio_table, board_gpio_rev_table)
    # Read the gpio values
    v0 = openbmc_gpio.gpio_get_value("BMC_CPLD_BOARD_REV_ID0")
    v1 = openbmc_gpio.gpio_get_value("BMC_CPLD_BOARD_REV_ID1")
    v2 = openbmc_gpio.gpio_get_value("BMC_CPLD_BOARD_REV_ID2")
    return (v2 << 2) | (v1 << 1) | v0
Example #3
0
def setup_board_tolerance_gpio(
    board_tolerance_gpio_table, board_gpioOffsetDic, validate=True
):
    gpio_configured = []
    regs = []
    for gpio in board_tolerance_gpio_table:
        if not (gpio.gpio).startswith("GPIO"):
            continue
        offset = openbmc_gpio.gpio_name_to_offset(gpio.gpio)
        group_index = int(offset / 32)
        phy_addr = board_gpioOffsetDic[str(group_index)]
        bit = offset % 32
        # config the devmem and write through to the hw
        reg = soc_get_tolerance_reg(phy_addr)
        reg.set_bit(bit)
        regs.append(reg)

    for reg in regs:
        reg.write()

        # export gpio
    for gpio in board_tolerance_gpio_table:
        openbmc_gpio.gpio_export(gpio.gpio, gpio.shadow)
        def_val = openbmc_gpio.gpio_get_value(gpio.gpio, change_direction=False)
        if def_val == 1:
            openbmc_gpio.gpio_set_value(gpio.gpio, 1)
        else:
            openbmc_gpio.gpio_set_value(gpio.gpio, 0)
Example #4
0
def wedge400_board_type():
    val = v0 = openbmc_gpio.gpio_get_value("BMC_CPLD_BOARD_TYPE")

    if val == 1:
        return 0
    elif val == 0:
        return 1
    else:
        return None